Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@transcend-io/contact-form-schema

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transcend-io/contact-form-schema - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

dist/index.cjs

17

dist/index.d.ts
import { z } from 'zod';
/**

@@ -6,3 +7,3 @@ * The version of this contact form schema.

*/
export declare const CONTACT_FORM_VERSION: string;
declare const CONTACT_FORM_VERSION: string;
/**

@@ -12,3 +13,3 @@ * The fields that are part of the contact form itself.

*/
export declare const ContactFormFields: z.ZodObject<{
declare const ContactFormFields: z.ZodObject<{
/** The submitter's first name */

@@ -94,7 +95,7 @@ firstName: z.ZodOptional<z.ZodString>;

}>;
export type ContactFormFields = z.infer<typeof ContactFormFields>;
type ContactFormFields = z.infer<typeof ContactFormFields>;
/**
* Metadata that is included in the form body, but is not part of the form component itself.
*/
export declare const ContactFormMetadata: z.ZodObject<{
declare const ContactFormMetadata: z.ZodObject<{
/** Which version of the form the client is on */

@@ -154,7 +155,7 @@ formVersion: z.ZodOptional<z.ZodString>;

}>;
export type ContactFormMetadata = z.infer<typeof ContactFormMetadata>;
type ContactFormMetadata = z.infer<typeof ContactFormMetadata>;
/**
* The ultimate payload of the contact form sent via HTTP POST to the contact form handler.
*/
export declare const ContactFormBody: z.ZodIntersection<z.ZodObject<{
declare const ContactFormBody: z.ZodIntersection<z.ZodObject<{
/** The submitter's first name */

@@ -294,2 +295,4 @@ firstName: z.ZodOptional<z.ZodString>;

}>>;
export type ContactFormBody = z.infer<typeof ContactFormBody>;
type ContactFormBody = z.infer<typeof ContactFormBody>;
export { CONTACT_FORM_VERSION, ContactFormBody, ContactFormFields, ContactFormMetadata };

@@ -1,100 +0,2 @@

import { phone } from 'phone';
import { z } from 'zod';
/**
* The version of this contact form schema.
* The client includes the version in the form body for debugging purposes.
*/
export const CONTACT_FORM_VERSION = '2.2.0';
/**
* The fields that are part of the contact form itself.
* This can be used to validate ALL contact forms, even if they omit some of the optional fields.
*/
export const ContactFormFields = z.object({
/** The submitter's first name */
firstName: z.string().optional(),
/** The submitter's last name */
lastName: z.string().optional(),
/** The submitter's work email */
email: z.string().email(),
/** The submitter's job title */
title: z.string().optional(),
/** The submitter's company name */
company: z.string().optional(),
/** The company's employee count */
companySize: z
.enum([
'Under 200 employees',
'200 to 500 employees',
'500 to 1000 employees',
'1000 to 5000 employees',
'Above 5000 employees',
])
.optional(),
/** The submitter's phone number */
phone: z
.string()
.refine((val) => phone(val).isValid, {
message: 'Must be a valid phone number.',
})
.optional(),
/** The submitter's country of residence */
country: z.string().optional(),
/** The submitter's state of residence */
state: z.string().optional(),
/** Any text that the submitter sent with this submission */
message: z.string().optional(),
/** If this is a partner submitting a referral */
referralPartner: z
.object({
partnerFirstName: z.string(),
partnerLastName: z.string(),
partnerEmail: z.string().email(),
partnerCompany: z.string(),
})
.optional(),
/**
* The submitter's consent to be contacted. If the user is requesting a demo (i.e. be contacted), this is `true` as implied consent.
* This is only `false` when we're using this form for another purpose on the marketing website, such as to send swag / unlock content downloads.
* In such a case, we can also request consent for marketing in that contact form.
*/
consent: z.union([z.boolean(), z.enum(['true', 'false'])]),
});
/**
* Metadata that is included in the form body, but is not part of the form component itself.
*/
export const ContactFormMetadata = z.object({
/** Which version of the form the client is on */
formVersion: z
.string()
.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/)
.optional(),
/** The reCAPTCHA token (only for use on our marketing website) */
recaptchaToken: z.string().min(50).optional(),
/** This is set up by the marketing team in Salesforce Pardot to label which contact form is being used */
pardotCampaignId: z.union([z.number(), z.string().regex(/^\d+$/)]),
/**
* Comma and space-separated string, e.g.: `9123, 1231`
* This is set up by the marketing team in Salesforce Pardot to label which mailing lists the user should be added to
*/
pardotListIds: z.string().regex(/^(\d+)(,\s*\d+)*$/),
/** Pardot visitor ID */
pardotVisitorId: z.string().optional(),
/** The user's existing anonymousId from Segment */
anonymousId: z.string().optional(),
/** Which channel this traffic is coming from. In `main` this'll likely always be "Admin Dashboard" */
utm_source: z.string().optional(),
/** What type of channel this traffic is coming from. */
utm_medium: z.string().optional(),
/** Which marketing campaign this is coming from. */
utm_campaign: z.string().optional(),
/** A unique ID */
utm_id: z.string().optional(),
/** Only relevant for search campaigns (e.g. what google search term they came from) */
utm_term: z.string().optional(),
/** Only relevant for content-based campaigns (e.g. what blog post they were on) */
utm_content: z.string().optional(),
});
/**
* The ultimate payload of the contact form sent via HTTP POST to the contact form handler.
*/
export const ContactFormBody = z.intersection(ContactFormFields, ContactFormMetadata);
import{phone as n}from"phone";import{z as t}from"zod";var s="2.3.0",e=t.object({firstName:t.string().optional(),lastName:t.string().optional(),email:t.string().email(),title:t.string().optional(),company:t.string().optional(),companySize:t.enum(["Under 200 employees","200 to 500 employees","500 to 1000 employees","1000 to 5000 employees","Above 5000 employees"]).optional(),phone:t.string().refine(o=>n(o).isValid,{message:"Must be a valid phone number."}).optional(),country:t.string().optional(),state:t.string().optional(),message:t.string().optional(),referralPartner:t.object({partnerFirstName:t.string(),partnerLastName:t.string(),partnerEmail:t.string().email(),partnerCompany:t.string()}).optional(),consent:t.union([t.boolean(),t.enum(["true","false"])])}),r=t.object({formVersion:t.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/).optional(),recaptchaToken:t.string().min(50).optional(),pardotCampaignId:t.union([t.number(),t.string().regex(/^\d+$/)]),pardotListIds:t.string().regex(/^(\d+)(,\s*\d+)*$/),pardotVisitorId:t.string().optional(),anonymousId:t.string().optional(),utm_source:t.string().optional(),utm_medium:t.string().optional(),utm_campaign:t.string().optional(),utm_id:t.string().optional(),utm_term:t.string().optional(),utm_content:t.string().optional()}),p=t.intersection(e,r);export{s as CONTACT_FORM_VERSION,p as ContactFormBody,e as ContactFormFields,r as ContactFormMetadata};
//# sourceMappingURL=index.js.map
{
"name": "@transcend-io/contact-form-schema",
"type": "module",
"version": "2.2.0",
"version": "2.3.0",
"description": "Schema for the marketing contact form.",
"license": "UNLICENSED",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
"require": {
"default": "./dist/index.cjs",
"types": "./dist/index.d.cts"
},
"import": {
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist"
"dist",
"src"
],
"scripts": {
"build": "del dist && tsc",
"build": "del dist && tsup --dts --format cjs,esm --minify --sourcemap --clean src/index.ts",
"test": "tsx --test test/**.test.ts",

@@ -33,2 +42,3 @@ "lint": "concurrently -c auto \"yarn:lint:*\"",

"prettier": "^2.8.8",
"tsup": "^8.0.1",
"tsx": "^4.6.2",

@@ -35,0 +45,0 @@ "typescript": "^5.3.3"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc