diff --git a/src/Form.tsx b/src/Form.tsx index 2e5b448..26f1fb3 100644 --- a/src/Form.tsx +++ b/src/Form.tsx @@ -64,6 +64,12 @@ export function VGSCollectForm(props: ICollectFormProps) { if (cname) { form.useCname(cname); } + + if (form.insightsConfig) { + form.insightsConfig({ + framework: 'react' + }) + } setFormInstance(form); } diff --git a/src/constants.ts b/src/constants.ts index 184c652..cedb94d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -7,43 +7,42 @@ const FIELD_EVENTS = { onKeyDown: 'keydown', onKeyPress: 'keypress' }; - const DEFAULT_CONFIG = { TEXT: { type: 'text', - placeholder: 'Cardholder Name' + placeholder: 'Cardholder Name', }, CARD_NUMBER: { type: 'card-number', - placeholder: 'Credit Card Number' + placeholder: 'Credit Card Number', }, CARD_EXPIRATION_DATE: { type: 'card-expiration-date', - placeholder: 'Card Expiration Date' + placeholder: 'Card Expiration Date', }, CARD_SECURITY_CODE: { type: 'card-security-code', - placeholder: 'CVC/CVV' + placeholder: 'CVC/CVV', }, PASSWORD: { type: 'password', - placeholder: 'Enter password' + placeholder: 'Enter password', }, SSN: { type: 'ssn', - placeholder: 'SSN' + placeholder: 'SSN', }, ZIP_CODE: { type: 'zip-code', - placeholder: 'Zip Code' + placeholder: 'Zip Code', }, TEXTAREA: { type: 'textarea', - placeholder: 'Comment' + placeholder: 'Comment', }, NUMBER: { type: 'number', - placeholder: 'Number' + placeholder: 'Number', } }; diff --git a/src/types/Form.ts b/src/types/Form.ts index 3d8305d..194060b 100644 --- a/src/types/Form.ts +++ b/src/types/Form.ts @@ -200,12 +200,16 @@ interface VGSCollectSubmitOptions { withCredentials: BooleanValue; } +interface VGSCollectInsightsConfig { + framework?: string; +} interface IVGSCollectForm { /** * Docs: https://www.verygoodsecurity.com/docs/api/collect/#api-formfield */ field(selector: string, options: FieldConfig): IVGSCollectFieldInstance; - + + insightsConfig(insightParameters: VGSCollectInsightsConfig): void; /** * Docs: https://www.verygoodsecurity.com/docs/api/collect/#api-fieldon * https://www.verygoodsecurity.com/docs/api/collect/#api-fieldoff