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
0
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.6.0 to 3.0.0

72

dist/esm/index.d.ts

@@ -13,11 +13,11 @@ import { z } from 'zod';

/** The submitter's first name */
firstName: z.ZodOptional<z.ZodString>;
firstName: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's last name */
lastName: z.ZodOptional<z.ZodString>;
lastName: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's work email */
email: z.ZodString;
/** The submitter's job title */
title: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's company name */
company: z.ZodOptional<z.ZodString>;
company: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The company's employee count */

@@ -28,7 +28,7 @@ companySize: z.ZodOptional<z.ZodEnum<["Under 200 employees", "200 to 500 employees", "500 to 1000 employees", "1000 to 5000 employees", "Above 5000 employees"]>>;

/** The submitter's country of residence */
country: z.ZodOptional<z.ZodString>;
country: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's state of residence */
state: z.ZodOptional<z.ZodString>;
state: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Any text that the submitter sent with this submission */
message: z.ZodOptional<z.ZodString>;
message: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** If this is a partner contacting us */

@@ -38,6 +38,6 @@ partnerType: z.ZodOptional<z.ZodEnum<["Technology partner", "Law firm partner", "Consulting partner"]>>;

referralPartner: z.ZodOptional<z.ZodObject<{
partnerFirstName: z.ZodString;
partnerLastName: z.ZodString;
partnerFirstName: z.ZodEffects<z.ZodString, string, string>;
partnerLastName: z.ZodEffects<z.ZodString, string, string>;
partnerEmail: z.ZodString;
partnerCompany: z.ZodString;
partnerCompany: z.ZodEffects<z.ZodString, string, string>;
}, "strip", z.ZodTypeAny, {

@@ -116,17 +116,17 @@ partnerFirstName: string;

/** Pardot visitor ID */
pardotVisitorId: z.ZodOptional<z.ZodString>;
pardotVisitorId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The user's existing anonymousId from Segment */
anonymousId: z.ZodOptional<z.ZodString>;
anonymousId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Which channel this traffic is coming from. In `main` this'll likely always be "Admin Dashboard" */
utm_source: z.ZodOptional<z.ZodString>;
utm_source: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** What type of channel this traffic is coming from. */
utm_medium: z.ZodOptional<z.ZodString>;
utm_medium: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Which marketing campaign this is coming from. */
utm_campaign: z.ZodOptional<z.ZodString>;
utm_campaign: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** A unique ID */
utm_id: z.ZodOptional<z.ZodString>;
utm_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Only relevant for search campaigns (e.g. what google search term they came from) */
utm_term: z.ZodOptional<z.ZodString>;
utm_term: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Only relevant for content-based campaigns (e.g. what blog post they were on) */
utm_content: z.ZodOptional<z.ZodString>;
utm_content: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
}, "strip", z.ZodTypeAny, {

@@ -165,11 +165,11 @@ pardotCampaignId: string | number;

/** The submitter's first name */
firstName: z.ZodOptional<z.ZodString>;
firstName: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's last name */
lastName: z.ZodOptional<z.ZodString>;
lastName: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's work email */
email: z.ZodString;
/** The submitter's job title */
title: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's company name */
company: z.ZodOptional<z.ZodString>;
company: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The company's employee count */

@@ -180,7 +180,7 @@ companySize: z.ZodOptional<z.ZodEnum<["Under 200 employees", "200 to 500 employees", "500 to 1000 employees", "1000 to 5000 employees", "Above 5000 employees"]>>;

/** The submitter's country of residence */
country: z.ZodOptional<z.ZodString>;
country: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The submitter's state of residence */
state: z.ZodOptional<z.ZodString>;
state: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Any text that the submitter sent with this submission */
message: z.ZodOptional<z.ZodString>;
message: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** If this is a partner contacting us */

@@ -190,6 +190,6 @@ partnerType: z.ZodOptional<z.ZodEnum<["Technology partner", "Law firm partner", "Consulting partner"]>>;

referralPartner: z.ZodOptional<z.ZodObject<{
partnerFirstName: z.ZodString;
partnerLastName: z.ZodString;
partnerFirstName: z.ZodEffects<z.ZodString, string, string>;
partnerLastName: z.ZodEffects<z.ZodString, string, string>;
partnerEmail: z.ZodString;
partnerCompany: z.ZodString;
partnerCompany: z.ZodEffects<z.ZodString, string, string>;
}, "strip", z.ZodTypeAny, {

@@ -263,17 +263,17 @@ partnerFirstName: string;

/** Pardot visitor ID */
pardotVisitorId: z.ZodOptional<z.ZodString>;
pardotVisitorId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** The user's existing anonymousId from Segment */
anonymousId: z.ZodOptional<z.ZodString>;
anonymousId: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Which channel this traffic is coming from. In `main` this'll likely always be "Admin Dashboard" */
utm_source: z.ZodOptional<z.ZodString>;
utm_source: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** What type of channel this traffic is coming from. */
utm_medium: z.ZodOptional<z.ZodString>;
utm_medium: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Which marketing campaign this is coming from. */
utm_campaign: z.ZodOptional<z.ZodString>;
utm_campaign: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** A unique ID */
utm_id: z.ZodOptional<z.ZodString>;
utm_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Only relevant for search campaigns (e.g. what google search term they came from) */
utm_term: z.ZodOptional<z.ZodString>;
utm_term: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
/** Only relevant for content-based campaigns (e.g. what blog post they were on) */
utm_content: z.ZodOptional<z.ZodString>;
utm_content: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
}, "strip", z.ZodTypeAny, {

@@ -280,0 +280,0 @@ pardotCampaignId: string | number;

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

import DOMPurify from 'isomorphic-dompurify';
import { phone } from 'phone';

@@ -8,4 +9,11 @@ import { z } from 'zod';

*/
const CONTACT_FORM_VERSION = '2.6.0';
const CONTACT_FORM_VERSION = '3.0.0';
/**
* Sanitize inputs to prevent XSS
* @see https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
*/
const SanitizedString = z.string().transform((value) => {
return DOMPurify.sanitize(value);
});
/**
* The fields that are part of the contact form itself.

@@ -16,11 +24,11 @@ * This can be used to validate ALL contact forms, even if they omit some of the optional fields.

/** The submitter's first name */
firstName: z.string().optional(),
firstName: SanitizedString.optional(),
/** The submitter's last name */
lastName: z.string().optional(),
lastName: SanitizedString.optional(),
/** The submitter's work email */
email: z.string().email(),
/** The submitter's job title */
title: z.string().optional(),
title: SanitizedString.optional(),
/** The submitter's company name */
company: z.string().optional(),
company: SanitizedString.optional(),
/** The company's employee count */

@@ -44,7 +52,7 @@ companySize: z

/** The submitter's country of residence */
country: z.string().optional(),
country: SanitizedString.optional(),
/** The submitter's state of residence */
state: z.string().optional(),
state: SanitizedString.optional(),
/** Any text that the submitter sent with this submission */
message: z.string().optional(),
message: SanitizedString.optional(),
/** If this is a partner contacting us */

@@ -57,6 +65,6 @@ partnerType: z

.object({
partnerFirstName: z.string(),
partnerLastName: z.string(),
partnerFirstName: SanitizedString,
partnerLastName: SanitizedString,
partnerEmail: z.string().email(),
partnerCompany: z.string(),
partnerCompany: SanitizedString,
})

@@ -81,3 +89,8 @@ .optional(),

/** The reCAPTCHA token (only for use on our marketing website) */
recaptchaToken: z.string().min(50).optional(),
recaptchaToken: z
.string()
.min(50)
// alphanumeric or underscore or hyphen
.regex(/^(\w|-)+$/)
.optional(),
/** This is set up by the marketing team in Salesforce Pardot to label which contact form is being used */

@@ -91,17 +104,17 @@ pardotCampaignId: z.union([z.number(), z.string().regex(/^\d+$/)]),

/** Pardot visitor ID */
pardotVisitorId: z.string().optional(),
pardotVisitorId: SanitizedString.optional(),
/** The user's existing anonymousId from Segment */
anonymousId: z.string().optional(),
anonymousId: SanitizedString.optional(),
/** Which channel this traffic is coming from. In `main` this'll likely always be "Admin Dashboard" */
utm_source: z.string().optional(),
utm_source: SanitizedString.optional(),
/** What type of channel this traffic is coming from. */
utm_medium: z.string().optional(),
utm_medium: SanitizedString.optional(),
/** Which marketing campaign this is coming from. */
utm_campaign: z.string().optional(),
utm_campaign: SanitizedString.optional(),
/** A unique ID */
utm_id: z.string().optional(),
utm_id: SanitizedString.optional(),
/** Only relevant for search campaigns (e.g. what google search term they came from) */
utm_term: z.string().optional(),
utm_term: SanitizedString.optional(),
/** Only relevant for content-based campaigns (e.g. what blog post they were on) */
utm_content: z.string().optional(),
utm_content: SanitizedString.optional(),
});

@@ -108,0 +121,0 @@ /**

{
"name": "@transcend-io/contact-form-schema",
"type": "module",
"version": "2.6.0",
"version": "3.0.0",
"description": "Schema for the marketing contact form.",

@@ -54,2 +54,3 @@ "license": "UNLICENSED",

"dependencies": {
"isomorphic-dompurify": "^2.12.0",
"phone": "^3.1.41",

@@ -56,0 +57,0 @@ "zod": "^3.22.4"

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

import DOMPurify from 'isomorphic-dompurify';
import { phone } from 'phone';

@@ -8,5 +9,13 @@ import { z } from 'zod';

*/
export const CONTACT_FORM_VERSION: string = '2.6.0';
export const CONTACT_FORM_VERSION: string = '3.0.0';
/**
* Sanitize inputs to prevent XSS
* @see https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
*/
const SanitizedString = z.string().transform((value) => {
return DOMPurify.sanitize(value);
});
/**
* The fields that are part of the contact form itself.

@@ -17,6 +26,6 @@ * This can be used to validate ALL contact forms, even if they omit some of the optional fields.

/** The submitter's first name */
firstName: z.string().optional(),
firstName: SanitizedString.optional(),
/** The submitter's last name */
lastName: z.string().optional(),
lastName: SanitizedString.optional(),

@@ -27,6 +36,6 @@ /** The submitter's work email */

/** The submitter's job title */
title: z.string().optional(),
title: SanitizedString.optional(),
/** The submitter's company name */
company: z.string().optional(),
company: SanitizedString.optional(),

@@ -53,9 +62,9 @@ /** The company's employee count */

/** The submitter's country of residence */
country: z.string().optional(),
country: SanitizedString.optional(),
/** The submitter's state of residence */
state: z.string().optional(),
state: SanitizedString.optional(),
/** Any text that the submitter sent with this submission */
message: z.string().optional(),
message: SanitizedString.optional(),

@@ -70,6 +79,6 @@ /** If this is a partner contacting us */

.object({
partnerFirstName: z.string(),
partnerLastName: z.string(),
partnerFirstName: SanitizedString,
partnerLastName: SanitizedString,
partnerEmail: z.string().email(),
partnerCompany: z.string(),
partnerCompany: SanitizedString,
})

@@ -98,3 +107,8 @@ .optional(),

/** The reCAPTCHA token (only for use on our marketing website) */
recaptchaToken: z.string().min(50).optional(),
recaptchaToken: z
.string()
.min(50)
// alphanumeric or underscore or hyphen
.regex(/^(\w|-)+$/)
.optional(),

@@ -111,24 +125,24 @@ /** This is set up by the marketing team in Salesforce Pardot to label which contact form is being used */

/** Pardot visitor ID */
pardotVisitorId: z.string().optional(),
pardotVisitorId: SanitizedString.optional(),
/** The user's existing anonymousId from Segment */
anonymousId: z.string().optional(),
anonymousId: SanitizedString.optional(),
/** Which channel this traffic is coming from. In `main` this'll likely always be "Admin Dashboard" */
utm_source: z.string().optional(),
utm_source: SanitizedString.optional(),
/** What type of channel this traffic is coming from. */
utm_medium: z.string().optional(),
utm_medium: SanitizedString.optional(),
/** Which marketing campaign this is coming from. */
utm_campaign: z.string().optional(),
utm_campaign: SanitizedString.optional(),
/** A unique ID */
utm_id: z.string().optional(),
utm_id: SanitizedString.optional(),
/** Only relevant for search campaigns (e.g. what google search term they came from) */
utm_term: z.string().optional(),
utm_term: SanitizedString.optional(),
/** Only relevant for content-based campaigns (e.g. what blog post they were on) */
utm_content: z.string().optional(),
utm_content: SanitizedString.optional(),
});

@@ -135,0 +149,0 @@ export type ContactFormMetadata = z.infer<typeof ContactFormMetadata>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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