@justifi/webcomponents 4.0.6 → 4.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +9 -0
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-card-form.cjs.entry.js +9 -0
- package/dist/cjs/justifi-card-form.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +5 -2
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/bank-account-form/bank-account-form.js +25 -0
- package/dist/collection/components/bank-account-form/bank-account-form.js.map +1 -1
- package/dist/collection/components/bank-account-form/bank-account-form.stories.js +10 -1
- package/dist/collection/components/bank-account-form/bank-account-form.stories.js.map +1 -1
- package/dist/collection/components/card-form/card-form.js +25 -0
- package/dist/collection/components/card-form/card-form.js.map +1 -1
- package/dist/collection/components/card-form/card-form.stories.js +10 -1
- package/dist/collection/components/card-form/card-form.stories.js.map +1 -1
- package/dist/collection/components/payment-form/payment-form.stories.js +2 -1
- package/dist/collection/components/payment-form/payment-form.stories.js.map +1 -1
- package/dist/collection/components/payment-method-form/payment-method-form.js +20 -1
- package/dist/collection/components/payment-method-form/payment-method-form.js.map +1 -1
- package/dist/components/justifi-bank-account-form.js +11 -1
- package/dist/components/justifi-bank-account-form.js.map +1 -1
- package/dist/components/justifi-card-form.js +11 -1
- package/dist/components/justifi-card-form.js.map +1 -1
- package/dist/components/payment-method-form.js +7 -3
- package/dist/components/payment-method-form.js.map +1 -1
- package/dist/esm/justifi-bank-account-form.entry.js +9 -0
- package/dist/esm/justifi-bank-account-form.entry.js.map +1 -1
- package/dist/esm/justifi-card-form.entry.js +9 -0
- package/dist/esm/justifi-card-form.entry.js.map +1 -1
- package/dist/esm/justifi-payment-method-form.entry.js +5 -2
- package/dist/esm/justifi-payment-method-form.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/bank-account-form/bank-account-form.d.ts +4 -0
- package/dist/types/components/card-form/card-form.d.ts +4 -0
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -0
- package/dist/types/components.d.ts +9 -0
- package/dist/webcomponents/{p-16b4e90a.entry.js → p-0969db8f.entry.js} +2 -2
- package/dist/webcomponents/p-0969db8f.entry.js.map +1 -0
- package/dist/webcomponents/p-4ef14106.entry.js +2 -0
- package/dist/webcomponents/{p-1f23b391.entry.js.map → p-4ef14106.entry.js.map} +1 -1
- package/dist/webcomponents/{p-f66f024e.entry.js → p-bd5352d6.entry.js} +2 -2
- package/dist/webcomponents/p-bd5352d6.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/dist/webcomponents/webcomponents.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/webcomponents/p-16b4e90a.entry.js.map +0 -1
- package/dist/webcomponents/p-1f23b391.entry.js +0 -2
- package/dist/webcomponents/p-f66f024e.entry.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardForm","readyHandler","event","this","cardFormReady","emit","tokenizeHandler","cardFormTokenize","validateHandler","cardFormValidate","async","args","childRef","Error","tokenize","validate","resize","render","h","ref","el","iframeOrigin","singleLine","validationMode"],"sources":["./src/components/card-form/card-form.tsx"],"sourcesContent":["import { Component, Event, Prop, h, EventEmitter, Method, Listen, State } from '@stencil/core';\nimport { CreatePaymentMethodResponse } from '../payment-method-form/payment-method-responses';\nimport { Theme } from '../payment-method-form/theme';\n\n@Component({\n tag: 'justifi-card-form',\n shadow: false,\n})\nexport class CardForm {\n /**\n * When to trigger validation of the form.\n */\n @Prop({ mutable: true }) validationMode: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n\n /**\n * URL for the rendered iFrame. End-users need not use this.\n */\n @Prop({ mutable: true }) iframeOrigin?: string;\n\n /**\n * Boolean indicating if the Card Form should render in a single line\n */\n @Prop() singleLine: boolean = false;\n @State() internalStyleOverrides: Theme;\n\n /**\n * Triggered when iframe has loaded\n * @event justifi-card-form#cardFormReady\n */\n\n @Event() cardFormReady: EventEmitter;\n\n /**\n * Triggered when the tokenize method is called on the component\n * @event justifi-card-form#cardFormTokenize\n */\n @Event() cardFormTokenize: EventEmitter<{ data: any }>;\n\n /**\n * Triggered when the validate method is called on the component\n * @event justifi-card-form#cardFormTokenize\n */\n @Event() cardFormValidate: EventEmitter<{ data: { isValid: boolean } }>;\n\n @Listen('paymentMethodFormReady')\n readyHandler(event: CustomEvent) {\n this.cardFormReady.emit(event);\n }\n\n @Listen('paymentMethodFormTokenize')\n tokenizeHandler(event: { data: any }) {\n this.cardFormTokenize.emit(event);\n }\n\n @Listen('paymentMethodFormValidate')\n validateHandler(event: { data: any }) {\n this.cardFormValidate.emit(event);\n }\n\n private childRef?: HTMLJustifiPaymentMethodFormElement;\n\n /**\n * Makes a tokenization request to the iframe\n */\n @Method()\n async tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<CreatePaymentMethodResponse> {\n if (!this.childRef) {\n throw new Error('Cannot call tokenize');\n }\n return this.childRef.tokenize(...args);\n }\n\n /**\n * Runs a validation on the form and shows errors if any\n */\n @Method()\n async validate(): Promise<{ isValid: boolean }> {\n if (!this.childRef) {\n throw new Error('Cannot call validate');\n }\n return this.childRef.validate();\n }\n\n /**\n * Manually resizes the iframe to fit the contents of the iframe\n */\n @Method()\n async resize(): Promise<void> {\n if (!this.childRef) {\n throw new Error('Cannot call validate');\n }\n return this.childRef.resize();\n }\n\n render() {\n return (\n <justifi-payment-method-form\n ref={el => {\n if (el) {\n this.childRef = el;\n }\n }}\n iframe-origin={this.iframeOrigin}\n payment-method-form-type=\"card\"\n single-line={this.singleLine}\n payment-method-form-ready={this.cardFormReady}\n payment-method-form-tokenize={this.cardFormTokenize}\n payment-method-form-validation-mode={this.validationMode || 'onSubmit'}\n />\n );\n }\n}\n"],"mappings":"wDAQaA,EAAQ,M,sPAcW,M,sCAuB9BC,aAAaC,GACXC,KAAKC,cAAcC,KAAKH,E,CAI1BI,gBAAgBJ,GACdC,KAAKI,iBAAiBF,KAAKH,E,CAI7BM,gBAAgBN,GACdC,KAAKM,iBAAiBJ,KAAKH,E,CAS7BQ,kBAAkBC,GAChB,IAAKR,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASE,YAAYH,E,CAOnCD,iBACE,IAAKP,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASG,U,CAOvBL,eACE,IAAKP,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASI,Q,CAGvBC,SACE,OACEC,EAAA,+BACEC,IAAKC,IACH,GAAIA,EAAI,CACNjB,KAAKS,SAAWQ,C,GAEnB,gBACcjB,KAAKkB,aAAY,2BACP,OAAM,cAClBlB,KAAKmB,WAAU,4BACDnB,KAAKC,cAAa,+BACfD,KAAKI,iBAAgB,sCACdJ,KAAKoB,gBAAkB,Y"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as o,c as t,h as e,H as r}from"./p-3aa91155.js";const i={card:{ready:"justifi.card.ready",tokenize:"justifi.card.tokenize",validate:"justifi.card.validate",resize:"justifi.card.resize",styleOverrides:"justifi.card.styleOverrides"},bankAccount:{ready:"justifi.bankAccount.ready",tokenize:"justifi.bankAccount.tokenize",validate:"justifi.bankAccount.validate",resize:"justifi.bankAccount.resize",styleOverrides:"justifi.bankAccount.styleOverrides"}};const s="@justifi/webcomponents";const n="4.2.0-rc.0";const c="JustiFi Web Components";const d="dist/index.cjs.js";const a="dist/components/index.js";const l="dist/esm/index.mjs";const f="dist/esm/index.mjs";const m="dist/types/index.d.ts";const h="dist/collection/collection-manifest.json";const u={type:"git",url:"git+https://github.com/justifi-tech/web-component-library.git"};const b={registry:"https://registry.npmjs.org"};const p=["dist/","loader/"];const g={"auto-changelog":"auto-changelog","build:dev":"NODE_ENV=dev stencil build --docs","build:staging":"NODE_ENV=staging stencil build --docs","build:prod":"NODE_ENV=prod stencil build --docs",start:'NODE_ENV=dev concurrently -c "bgBlue.bold,bgMagenta.bold,bgGreen.bold" "yarn run start-stencil" "yarn run storybook"',"start-stencil":"stencil build --watch --serve --no-open",test:"stencil test --spec","test:watch":"stencil test --spec --watchAll","test:e2e":"stencil test --e2e",generate:"stencil generate",storybook:"storybook dev -p 6006 --quiet","build-storybook":"storybook build -o ../docs"};const y={"@stencil/core":"^3.3.0","@stencil/react-output-target":"^0.3.1",bootstrap:"^5.2.3","date-fns":"^2.29.3","dinero.js":"^1.9.1","ts-dedent":"^2.2.0",uuid:"^9.0.0",yup:"^1.0.0"};const j={"@babel/preset-env":"^7.21.5","@babel/preset-react":"^7.18.6","@babel/preset-typescript":"^7.21.5","@pxtrn/storybook-addon-docs-stencil":"^6.4.1","@stencil/sass":"^3.0.1","@storybook/addon-actions":"^7.0.4","@storybook/addon-essentials":"^7.0.4","@storybook/addon-interactions":"^7.0.4","@storybook/addon-links":"^7.0.4","@storybook/html":"^7.0.4","@storybook/html-webpack5":"^7.0.4","@storybook/jest":"^0.1.0","@storybook/testing-library":"^0.1.0","@types/jest":"27.0.3","@types/node":"^20.1.4","@types/react":"^18.0.37","@types/react-dom":"^18.0.11","auto-changelog":"^2.4.0",concurrently:"^7.6.0",jest:"^27.4.5","jest-cli":"^27.4.5",puppeteer:"^10.0.0",react:"^18.2.0","react-dom":"^18.2.0","release-it":"^15.6.0","rollup-plugin-replace":"^2.2.0",storybook:"^7.0.4"};const k="MIT";const w={name:s,version:n,description:c,main:d,module:a,es2015:l,es2017:f,types:m,collection:h,"collection:main":"dist/collection/index.js",repository:u,publishConfig:b,files:p,scripts:g,"auto-changelog":{output:"../CHANGELOG.md",hideCredtis:"true",commitLimit:"true"},dependencies:y,devDependencies:j,license:k};const v=()=>{const o=getComputedStyle(document.body);const t={layout:{padding:o.getPropertyValue("--jfi-layout-padding"),formControlSpacingHorizontal:o.getPropertyValue("--jfi-layout-form-control-spacing-x"),formControlSpacingVertical:o.getPropertyValue("--jfi-layout-form-control-spacing-y")},formControl:{backgroundColor:o.getPropertyValue("--jfi-form-control-background-color"),borderColor:o.getPropertyValue("--jfi-form-control-border-color"),borderColorFocus:o.getPropertyValue("--jfi-form-control-border-color-focus"),borderColorError:o.getPropertyValue("--jfi-form-control-border-color-error"),borderWidth:o.getPropertyValue("--jfi-form-control-border-width"),borderBottomWidth:o.getPropertyValue("--jfi-form-control-border-bottom-width"),borderLeftWidth:o.getPropertyValue("--jfi-form-control-border-left-width"),borderRightWidth:o.getPropertyValue("--jfi-form-control-border-right-width"),borderTopWidth:o.getPropertyValue("--jfi-form-control-border-top-width"),borderRadius:o.getPropertyValue("--jfi-form-control-border-radius"),borderStyle:o.getPropertyValue("--jfi-form-control-border-style"),boxShadow:o.getPropertyValue("--jfi-form-control-box-shadow"),boxShadowError:o.getPropertyValue("--jfi-form-control-box-shadow-error"),boxShadowErrorFocus:o.getPropertyValue("--jfi-form-control-box-shadow-error-focus"),boxShadowFocus:o.getPropertyValue("--jfi-form-control-box-shadow-focus"),color:o.getPropertyValue("--jfi-form-control-color"),colorFocus:o.getPropertyValue("--jfi-form-control-color-focus"),fontSize:o.getPropertyValue("--jfi-form-control-font-size"),fontWeight:o.getPropertyValue("--jfi-form-control-font-weight"),lineHeight:o.getPropertyValue("--jfi-form-control-line-height"),margin:o.getPropertyValue("--jfi-form-control-margin"),padding:o.getPropertyValue("--jfi-form-control-padding")},formLabel:{color:o.getPropertyValue("--jfi-form-label-color"),fontFamily:o.getPropertyValue("--jfi-form-label-font-family"),fontSize:o.getPropertyValue("--jfi-form-label-font-size"),fontWeight:o.getPropertyValue("--jfi-form-label-font-weight"),margin:o.getPropertyValue("--jfi-form-label-margin")},errorMessage:{color:o.getPropertyValue("--jfi-error-message-color"),margin:o.getPropertyValue("--jfi-error-message-margin"),fontSize:o.getPropertyValue("--jfi-error-message-font-size")}};return t};const z=":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";const x=class{constructor(e){o(this,e);this.paymentMethodFormReady=t(this,"paymentMethodFormReady",7);this.paymentMethodFormTokenize=t(this,"paymentMethodFormTokenize",7);this.computedTheme=v();this.paymentMethodFormType=undefined;this.paymentMethodFormValidationMode=undefined;this.iframeOrigin=undefined;this.singleLine=undefined;this.height=55}connectedCallback(){window.addEventListener("message",this.dispatchMessageEvent.bind(this))}disconnectedCallback(){window.removeEventListener("message",this.dispatchMessageEvent.bind(this))}componentShouldUpdate(){this.sendStyleOverrides()}sendStyleOverrides(){if(this.computedTheme){this.postMessage(i[this.paymentMethodFormType].styleOverrides,{styleOverrides:this.computedTheme})}}dispatchMessageEvent(o){const t=o.data;const e=t.eventType;const r=t.data;if(e===i[this.paymentMethodFormType].ready){this.paymentMethodFormReady.emit(r)}if(e===i[this.paymentMethodFormType].resize){this.height=r.height}}postMessage(o,t){var e,r;(r=(e=this.iframeElement)===null||e===void 0?void 0:e.contentWindow)===null||r===void 0?void 0:r.postMessage(Object.assign({eventType:o},t),"*")}async postMessageWithResponseListener(o,t){return new Promise((e=>{const r=t=>{if(t.data.eventType!==o)return;window.removeEventListener("message",r);e(t.data.data)};window.addEventListener("message",r);this.postMessage(o,t)}))}async tokenize(o,t,e){const r=i[this.paymentMethodFormType].tokenize;const s={clientId:o,componentVersion:w.version,paymentMethodMetadata:t,account:e};return this.postMessageWithResponseListener(r,s)}async validate(){return this.postMessageWithResponseListener(i[this.paymentMethodFormType].validate)}async resize(){this.postMessage(i[this.paymentMethodFormType].resize)}composeQueryParams(o){const t=o.map((t=>{if(t===o[0]){return t=`?${t}`}else{return t=`&${t}`}}));return t.join("")}getIframeSrc(){const o=this.iframeOrigin||undefined;let t=`${o}/${this.paymentMethodFormType}`;let e=[];if(this.paymentMethodFormValidationMode){e.push(`validationMode=${this.paymentMethodFormValidationMode}`)}if(this.singleLine){e.push(`singleLine=${this.singleLine}`)}return t.concat(this.composeQueryParams(e))}render(){return e(r,null,e("iframe",{id:`justifi-payment-method-form-${this.paymentMethodFormType}`,src:this.getIframeSrc(),ref:o=>this.iframeElement=o,height:this.height}))}};x.style=z;export{x as justifi_payment_method_form};
|
|
2
|
+
//# sourceMappingURL=p-4ef14106.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MessageEventType","card","ready","tokenize","validate","resize","styleOverrides","bankAccount","getComputedTheme","computedStyles","getComputedStyle","document","body","computedTheme","layout","padding","getPropertyValue","formControlSpacingHorizontal","formControlSpacingVertical","formControl","backgroundColor","borderColor","borderColorFocus","borderColorError","borderWidth","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","borderRadius","borderStyle","boxShadow","boxShadowError","boxShadowErrorFocus","boxShadowFocus","color","colorFocus","fontSize","fontWeight","lineHeight","margin","formLabel","fontFamily","errorMessage","paymentMethodFormCss","PaymentMethodForm","this","connectedCallback","window","addEventListener","dispatchMessageEvent","bind","disconnectedCallback","removeEventListener","componentShouldUpdate","sendStyleOverrides","postMessage","paymentMethodFormType","messageEvent","messagePayload","data","messageType","eventType","messageData","paymentMethodFormReady","emit","height","payload","_b","_a","iframeElement","contentWindow","Object","assign","async","Promise","resolve","responseListener","event","clientId","paymentMethodMetadata","account","componentVersion","packageJson","version","postMessageWithResponseListener","composeQueryParams","values","queryParams","map","value","join","getIframeSrc","iframeOrigin","undefined","iframeSrc","paramsList","paymentMethodFormValidationMode","push","singleLine","concat","render","h","Host","id","src","ref","el"],"sources":["./src/components/payment-method-form/message-event-types.ts","./src/components/payment-method-form/get-computed-theme.ts","./src/components/payment-method-form/payment-method-form.css?tag=justifi-payment-method-form","./src/components/payment-method-form/payment-method-form.tsx"],"sourcesContent":["export const MessageEventType = {\n card: {\n ready: 'justifi.card.ready',\n tokenize: 'justifi.card.tokenize',\n validate: 'justifi.card.validate',\n resize: 'justifi.card.resize',\n styleOverrides: 'justifi.card.styleOverrides',\n },\n bankAccount: {\n ready: 'justifi.bankAccount.ready',\n tokenize: 'justifi.bankAccount.tokenize',\n validate: 'justifi.bankAccount.validate',\n resize: 'justifi.bankAccount.resize',\n styleOverrides: 'justifi.bankAccount.styleOverrides',\n },\n};\n","import { Theme } from './theme';\n\nconst getComputedTheme = () => {\n const computedStyles = getComputedStyle(document.body);\n\n const computedTheme: Theme = {\n layout: {\n padding: computedStyles.getPropertyValue('--jfi-layout-padding'),\n formControlSpacingHorizontal: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-x'),\n formControlSpacingVertical: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-y'),\n },\n formControl: {\n backgroundColor: computedStyles.getPropertyValue('--jfi-form-control-background-color'),\n borderColor: computedStyles.getPropertyValue('--jfi-form-control-border-color'),\n borderColorFocus: computedStyles.getPropertyValue('--jfi-form-control-border-color-focus'),\n borderColorError: computedStyles.getPropertyValue('--jfi-form-control-border-color-error'),\n borderWidth: computedStyles.getPropertyValue('--jfi-form-control-border-width'),\n borderBottomWidth: computedStyles.getPropertyValue('--jfi-form-control-border-bottom-width'),\n borderLeftWidth: computedStyles.getPropertyValue('--jfi-form-control-border-left-width'),\n borderRightWidth: computedStyles.getPropertyValue('--jfi-form-control-border-right-width'),\n borderTopWidth: computedStyles.getPropertyValue('--jfi-form-control-border-top-width'),\n borderRadius: computedStyles.getPropertyValue('--jfi-form-control-border-radius'),\n borderStyle: computedStyles.getPropertyValue('--jfi-form-control-border-style'),\n boxShadow: computedStyles.getPropertyValue('--jfi-form-control-box-shadow'),\n boxShadowError: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error'),\n boxShadowErrorFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error-focus'),\n boxShadowFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-focus'),\n color: computedStyles.getPropertyValue('--jfi-form-control-color'),\n colorFocus: computedStyles.getPropertyValue('--jfi-form-control-color-focus'),\n fontSize: computedStyles.getPropertyValue('--jfi-form-control-font-size'),\n fontWeight: computedStyles.getPropertyValue('--jfi-form-control-font-weight'),\n lineHeight: computedStyles.getPropertyValue('--jfi-form-control-line-height'),\n margin: computedStyles.getPropertyValue('--jfi-form-control-margin'),\n padding: computedStyles.getPropertyValue('--jfi-form-control-padding'),\n },\n formLabel: {\n color: computedStyles.getPropertyValue('--jfi-form-label-color'),\n fontFamily: computedStyles.getPropertyValue('--jfi-form-label-font-family'),\n fontSize: computedStyles.getPropertyValue('--jfi-form-label-font-size'),\n fontWeight: computedStyles.getPropertyValue('--jfi-form-label-font-weight'),\n margin: computedStyles.getPropertyValue('--jfi-form-label-margin'),\n },\n errorMessage: {\n color: computedStyles.getPropertyValue('--jfi-error-message-color'),\n margin: computedStyles.getPropertyValue('--jfi-error-message-margin'),\n fontSize: computedStyles.getPropertyValue('--jfi-error-message-font-size'),\n },\n };\n\n return computedTheme;\n};\n\nexport default getComputedTheme;\n",":host {\n display: block;\n}\n\njustifi-payment-method-form iframe {\n border: none;\n width: 100%;\n}\n","import { Component, Event, Host, Prop, h, EventEmitter, Method, State } from '@stencil/core';\nimport { MessageEventType } from './message-event-types';\nimport { Theme } from './theme';\nimport packageJson from '../../../package.json';\nimport getComputedTheme from './get-computed-theme';\nimport { CreatePaymentMethodResponse } from './payment-method-responses';\n\n@Component({\n tag: 'justifi-payment-method-form',\n styleUrl: 'payment-method-form.css',\n shadow: false,\n})\nexport class PaymentMethodForm {\n @Prop() paymentMethodFormType: 'card' | 'bankAccount';\n @Prop({\n mutable: true,\n })\n paymentMethodFormValidationMode: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n @Prop() iframeOrigin?: string;\n @Prop() singleLine: boolean;\n @Event({ bubbles: true }) paymentMethodFormReady: EventEmitter;\n @Event({ bubbles: true }) paymentMethodFormTokenize: EventEmitter<{ data: any }>;\n @State() height: number = 55;\n\n private computedTheme: Theme = getComputedTheme();\n\n iframeElement!: HTMLIFrameElement;\n\n connectedCallback() {\n window.addEventListener('message', this.dispatchMessageEvent.bind(this));\n }\n\n disconnectedCallback() {\n window.removeEventListener('message', this.dispatchMessageEvent.bind(this));\n }\n\n componentShouldUpdate() {\n this.sendStyleOverrides();\n }\n\n sendStyleOverrides() {\n if (this.computedTheme) {\n this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.computedTheme });\n }\n }\n\n private dispatchMessageEvent(messageEvent: MessageEvent) {\n const messagePayload = messageEvent.data;\n const messageType = messagePayload.eventType;\n const messageData = messagePayload.data;\n\n if (messageType === MessageEventType[this.paymentMethodFormType].ready) {\n this.paymentMethodFormReady.emit(messageData);\n }\n\n if (messageType === MessageEventType[this.paymentMethodFormType].resize) {\n this.height = messageData.height;\n }\n }\n\n private postMessage(eventType: string, payload?: any) {\n this.iframeElement?.contentWindow?.postMessage({ eventType: eventType, ...payload }, '*');\n }\n\n private async postMessageWithResponseListener(eventType: string, payload?: any): Promise<any> {\n return new Promise(resolve => {\n const responseListener = (event: MessageEvent) => {\n if (event.data.eventType !== eventType) return;\n window.removeEventListener('message', responseListener);\n resolve(event.data.data);\n };\n window.addEventListener('message', responseListener);\n this.postMessage(eventType, payload);\n });\n }\n\n @Method()\n async tokenize(clientId: string, paymentMethodMetadata: any, account?: string): Promise<CreatePaymentMethodResponse> {\n const eventType = MessageEventType[this.paymentMethodFormType].tokenize;\n const payload = {\n clientId: clientId,\n componentVersion: packageJson.version,\n paymentMethodMetadata: paymentMethodMetadata,\n account: account,\n };\n\n return this.postMessageWithResponseListener(eventType, payload);\n }\n\n @Method()\n async validate(): Promise<any> {\n return this.postMessageWithResponseListener(MessageEventType[this.paymentMethodFormType].validate);\n }\n\n private composeQueryParams(values: string[]) {\n const queryParams = values.map(value => {\n if (value === values[0]) {\n return (value = `?${value}`);\n } else {\n return (value = `&${value}`);\n }\n });\n return queryParams.join('');\n }\n\n private getIframeSrc() {\n const iframeOrigin = process.env.IFRAME_ORIGIN;\n let iframeSrc = `${iframeOrigin}/${this.paymentMethodFormType}`;\n let paramsList = [];\n if (this.paymentMethodFormValidationMode) {\n paramsList.push(`validationMode=${this.paymentMethodFormValidationMode}`);\n }\n if (this.singleLine) {\n paramsList.push(`singleLine=${this.singleLine}`);\n }\n\n return iframeSrc.concat(this.composeQueryParams(paramsList));\n }\n\n render() {\n return (\n <Host>\n <iframe\n id={`justifi-payment-method-form-${this.paymentMethodFormType}`}\n src={this.getIframeSrc()}\n ref={el => (this.iframeElement = el as HTMLIFrameElement)}\n height={this.height}\n ></iframe>\n </Host>\n );\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"names":["MessageEventType","card","ready","tokenize","validate","resize","styleOverrides","bankAccount","getComputedTheme","computedStyles","getComputedStyle","document","body","computedTheme","layout","padding","getPropertyValue","formControlSpacingHorizontal","formControlSpacingVertical","formControl","backgroundColor","borderColor","borderColorFocus","borderColorError","borderWidth","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","borderRadius","borderStyle","boxShadow","boxShadowError","boxShadowErrorFocus","boxShadowFocus","color","colorFocus","fontSize","fontWeight","lineHeight","margin","formLabel","fontFamily","errorMessage","paymentMethodFormCss","PaymentMethodForm","this","connectedCallback","window","addEventListener","dispatchMessageEvent","bind","disconnectedCallback","removeEventListener","componentShouldUpdate","sendStyleOverrides","postMessage","paymentMethodFormType","messageEvent","messagePayload","data","messageType","eventType","messageData","paymentMethodFormReady","emit","height","payload","_b","_a","iframeElement","contentWindow","Object","assign","async","Promise","resolve","responseListener","event","clientId","paymentMethodMetadata","account","componentVersion","packageJson","version","postMessageWithResponseListener","composeQueryParams","values","queryParams","map","value","join","getIframeSrc","iframeOrigin","undefined","iframeSrc","paramsList","paymentMethodFormValidationMode","push","singleLine","concat","render","h","Host","id","src","ref","el"],"sources":["./src/components/payment-method-form/message-event-types.ts","./src/components/payment-method-form/get-computed-theme.ts","./src/components/payment-method-form/payment-method-form.css?tag=justifi-payment-method-form","./src/components/payment-method-form/payment-method-form.tsx"],"sourcesContent":["export const MessageEventType = {\n card: {\n ready: 'justifi.card.ready',\n tokenize: 'justifi.card.tokenize',\n validate: 'justifi.card.validate',\n resize: 'justifi.card.resize',\n styleOverrides: 'justifi.card.styleOverrides',\n },\n bankAccount: {\n ready: 'justifi.bankAccount.ready',\n tokenize: 'justifi.bankAccount.tokenize',\n validate: 'justifi.bankAccount.validate',\n resize: 'justifi.bankAccount.resize',\n styleOverrides: 'justifi.bankAccount.styleOverrides',\n },\n};\n","import { Theme } from './theme';\n\nconst getComputedTheme = () => {\n const computedStyles = getComputedStyle(document.body);\n\n const computedTheme: Theme = {\n layout: {\n padding: computedStyles.getPropertyValue('--jfi-layout-padding'),\n formControlSpacingHorizontal: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-x'),\n formControlSpacingVertical: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-y'),\n },\n formControl: {\n backgroundColor: computedStyles.getPropertyValue('--jfi-form-control-background-color'),\n borderColor: computedStyles.getPropertyValue('--jfi-form-control-border-color'),\n borderColorFocus: computedStyles.getPropertyValue('--jfi-form-control-border-color-focus'),\n borderColorError: computedStyles.getPropertyValue('--jfi-form-control-border-color-error'),\n borderWidth: computedStyles.getPropertyValue('--jfi-form-control-border-width'),\n borderBottomWidth: computedStyles.getPropertyValue('--jfi-form-control-border-bottom-width'),\n borderLeftWidth: computedStyles.getPropertyValue('--jfi-form-control-border-left-width'),\n borderRightWidth: computedStyles.getPropertyValue('--jfi-form-control-border-right-width'),\n borderTopWidth: computedStyles.getPropertyValue('--jfi-form-control-border-top-width'),\n borderRadius: computedStyles.getPropertyValue('--jfi-form-control-border-radius'),\n borderStyle: computedStyles.getPropertyValue('--jfi-form-control-border-style'),\n boxShadow: computedStyles.getPropertyValue('--jfi-form-control-box-shadow'),\n boxShadowError: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error'),\n boxShadowErrorFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error-focus'),\n boxShadowFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-focus'),\n color: computedStyles.getPropertyValue('--jfi-form-control-color'),\n colorFocus: computedStyles.getPropertyValue('--jfi-form-control-color-focus'),\n fontSize: computedStyles.getPropertyValue('--jfi-form-control-font-size'),\n fontWeight: computedStyles.getPropertyValue('--jfi-form-control-font-weight'),\n lineHeight: computedStyles.getPropertyValue('--jfi-form-control-line-height'),\n margin: computedStyles.getPropertyValue('--jfi-form-control-margin'),\n padding: computedStyles.getPropertyValue('--jfi-form-control-padding'),\n },\n formLabel: {\n color: computedStyles.getPropertyValue('--jfi-form-label-color'),\n fontFamily: computedStyles.getPropertyValue('--jfi-form-label-font-family'),\n fontSize: computedStyles.getPropertyValue('--jfi-form-label-font-size'),\n fontWeight: computedStyles.getPropertyValue('--jfi-form-label-font-weight'),\n margin: computedStyles.getPropertyValue('--jfi-form-label-margin'),\n },\n errorMessage: {\n color: computedStyles.getPropertyValue('--jfi-error-message-color'),\n margin: computedStyles.getPropertyValue('--jfi-error-message-margin'),\n fontSize: computedStyles.getPropertyValue('--jfi-error-message-font-size'),\n },\n };\n\n return computedTheme;\n};\n\nexport default getComputedTheme;\n",":host {\n display: block;\n}\n\njustifi-payment-method-form iframe {\n border: none;\n width: 100%;\n}\n","import { Component, Event, Host, Prop, h, EventEmitter, Method, State } from '@stencil/core';\nimport { MessageEventType } from './message-event-types';\nimport { Theme } from './theme';\nimport packageJson from '../../../package.json';\nimport getComputedTheme from './get-computed-theme';\nimport { CreatePaymentMethodResponse } from './payment-method-responses';\n\n@Component({\n tag: 'justifi-payment-method-form',\n styleUrl: 'payment-method-form.css',\n shadow: false,\n})\nexport class PaymentMethodForm {\n @Prop() paymentMethodFormType: 'card' | 'bankAccount';\n @Prop({\n mutable: true,\n })\n paymentMethodFormValidationMode: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n @Prop() iframeOrigin?: string;\n @Prop() singleLine: boolean;\n @Event({ bubbles: true }) paymentMethodFormReady: EventEmitter;\n @Event({ bubbles: true }) paymentMethodFormTokenize: EventEmitter<{ data: any }>;\n @State() height: number = 55;\n\n private computedTheme: Theme = getComputedTheme();\n\n iframeElement!: HTMLIFrameElement;\n\n connectedCallback() {\n window.addEventListener('message', this.dispatchMessageEvent.bind(this));\n }\n\n disconnectedCallback() {\n window.removeEventListener('message', this.dispatchMessageEvent.bind(this));\n }\n\n componentShouldUpdate() {\n this.sendStyleOverrides();\n }\n\n sendStyleOverrides() {\n if (this.computedTheme) {\n this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.computedTheme });\n }\n }\n\n private dispatchMessageEvent(messageEvent: MessageEvent) {\n const messagePayload = messageEvent.data;\n const messageType = messagePayload.eventType;\n const messageData = messagePayload.data;\n\n if (messageType === MessageEventType[this.paymentMethodFormType].ready) {\n this.paymentMethodFormReady.emit(messageData);\n }\n\n if (messageType === MessageEventType[this.paymentMethodFormType].resize) {\n this.height = messageData.height;\n }\n }\n\n private postMessage(eventType: string, payload?: any) {\n this.iframeElement?.contentWindow?.postMessage({ eventType: eventType, ...payload }, '*');\n }\n\n private async postMessageWithResponseListener(eventType: string, payload?: any): Promise<any> {\n return new Promise(resolve => {\n const responseListener = (event: MessageEvent) => {\n if (event.data.eventType !== eventType) return;\n window.removeEventListener('message', responseListener);\n resolve(event.data.data);\n };\n window.addEventListener('message', responseListener);\n this.postMessage(eventType, payload);\n });\n }\n\n @Method()\n async tokenize(clientId: string, paymentMethodMetadata: any, account?: string): Promise<CreatePaymentMethodResponse> {\n const eventType = MessageEventType[this.paymentMethodFormType].tokenize;\n const payload = {\n clientId: clientId,\n componentVersion: packageJson.version,\n paymentMethodMetadata: paymentMethodMetadata,\n account: account,\n };\n\n return this.postMessageWithResponseListener(eventType, payload);\n }\n\n @Method()\n async validate(): Promise<any> {\n return this.postMessageWithResponseListener(MessageEventType[this.paymentMethodFormType].validate);\n }\n\n @Method()\n async resize(): Promise<any> {\n this.postMessage(MessageEventType[this.paymentMethodFormType].resize);\n }\n\n private composeQueryParams(values: string[]) {\n const queryParams = values.map(value => {\n if (value === values[0]) {\n return (value = `?${value}`);\n } else {\n return (value = `&${value}`);\n }\n });\n return queryParams.join('');\n }\n\n private getIframeSrc() {\n const iframeOrigin = this.iframeOrigin || process.env.IFRAME_ORIGIN;\n let iframeSrc = `${iframeOrigin}/${this.paymentMethodFormType}`;\n let paramsList = [];\n if (this.paymentMethodFormValidationMode) {\n paramsList.push(`validationMode=${this.paymentMethodFormValidationMode}`);\n }\n if (this.singleLine) {\n paramsList.push(`singleLine=${this.singleLine}`);\n }\n\n return iframeSrc.concat(this.composeQueryParams(paramsList));\n }\n\n render() {\n return (\n <Host>\n <iframe\n id={`justifi-payment-method-form-${this.paymentMethodFormType}`}\n src={this.getIframeSrc()}\n ref={el => (this.iframeElement = el as HTMLIFrameElement)}\n height={this.height}\n ></iframe>\n </Host>\n );\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,c as e,h as i}from"./p-3aa91155.js";const n=class{constructor(i){t(this,i);this.bankAccountFormReady=e(this,"bankAccountFormReady",7);this.bankAccountFormTokenize=e(this,"bankAccountFormTokenize",7);this.bankAccountFormValidate=e(this,"bankAccountFormValidate",7);this.validationMode=undefined;this.iframeOrigin=undefined;this.internalStyleOverrides=undefined}readyHandler(t){this.bankAccountFormReady.emit(t)}tokenizeHandler(t){this.bankAccountFormTokenize.emit(t)}validateHandler(t){this.bankAccountFormValidate.emit(t)}async tokenize(...t){if(!this.childRef){throw new Error("Cannot call tokenize")}return this.childRef.tokenize(...t)}async validate(){if(!this.childRef){throw new Error("Cannot call validate")}return this.childRef.validate()}render(){return i("justifi-payment-method-form",{ref:t=>{if(t){this.childRef=t}},"iframe-origin":this.iframeOrigin,"payment-method-form-type":"bankAccount","payment-method-form-ready":this.bankAccountFormReady,"payment-method-form-tokenize":this.bankAccountFormTokenize,"payment-method-form-validation-mode":this.validationMode||"onSubmit"})}};export{n as justifi_bank_account_form};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,c as e,h as i}from"./p-3aa91155.js";const n=class{constructor(i){t(this,i);this.bankAccountFormReady=e(this,"bankAccountFormReady",7);this.bankAccountFormTokenize=e(this,"bankAccountFormTokenize",7);this.bankAccountFormValidate=e(this,"bankAccountFormValidate",7);this.validationMode=undefined;this.iframeOrigin=undefined;this.internalStyleOverrides=undefined}readyHandler(t){this.bankAccountFormReady.emit(t)}tokenizeHandler(t){this.bankAccountFormTokenize.emit(t)}validateHandler(t){this.bankAccountFormValidate.emit(t)}async tokenize(...t){if(!this.childRef){throw new Error("Cannot call tokenize")}return this.childRef.tokenize(...t)}async validate(){if(!this.childRef){throw new Error("Cannot call validate")}return this.childRef.validate()}async resize(){if(!this.childRef){throw new Error("Cannot call validate")}return this.childRef.resize()}render(){return i("justifi-payment-method-form",{ref:t=>{if(t){this.childRef=t}},"iframe-origin":this.iframeOrigin,"payment-method-form-type":"bankAccount","payment-method-form-ready":this.bankAccountFormReady,"payment-method-form-tokenize":this.bankAccountFormTokenize,"payment-method-form-validation-mode":this.validationMode||"onSubmit"})}};export{n as justifi_bank_account_form};
|
|
2
|
+
//# sourceMappingURL=p-bd5352d6.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BankAccountForm","readyHandler","event","this","bankAccountFormReady","emit","tokenizeHandler","bankAccountFormTokenize","validateHandler","bankAccountFormValidate","async","args","childRef","Error","tokenize","validate","resize","render","h","ref","el","iframeOrigin","validationMode"],"sources":["./src/components/bank-account-form/bank-account-form.tsx"],"sourcesContent":["import { Component, Event, Prop, h, EventEmitter, Listen, Method, State } from '@stencil/core';\nimport { CreatePaymentMethodResponse } from '../payment-method-form/payment-method-responses';\nimport { Theme } from '../payment-method-form/theme';\n\n@Component({\n tag: 'justifi-bank-account-form',\n shadow: false,\n})\nexport class BankAccountForm {\n /**\n * When to trigger validation of the form.\n */\n @Prop({ mutable: true }) validationMode: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n\n /**\n * URL for the rendered iFrame. End-users need not use this.\n */\n @Prop({ mutable: true }) iframeOrigin?: string;\n\n @State() internalStyleOverrides: Theme;\n\n /**\n * Triggered when iframe has loaded\n * @event justifi-bank-account-form#bankAccountFormReady\n */\n @Event() bankAccountFormReady: EventEmitter<any>;\n\n /**\n * Triggered when the tokenize method is called on the component\n * @event justifi-bank-account-form#bankAccountFormTokenize\n */\n @Event() bankAccountFormTokenize: EventEmitter<{ data: any }>;\n\n /**\n * Triggered when the validate method is called on the component\n * @event justifi-bank-account-form#bankAccountFormValidate\n */\n @Event() bankAccountFormValidate: EventEmitter<{ data: { isValid: boolean } }>;\n\n @Listen('paymentMethodFormReady')\n readyHandler(event: CustomEvent) {\n this.bankAccountFormReady.emit(event);\n }\n\n @Listen('paymentMethodFormTokenize')\n tokenizeHandler(event: { data: any }) {\n this.bankAccountFormTokenize.emit(event);\n }\n\n @Listen('paymentMethodFormValidate')\n validateHandler(event: { data: any }) {\n this.bankAccountFormValidate.emit(event);\n }\n\n private childRef?: HTMLJustifiPaymentMethodFormElement;\n\n /**\n * Makes a tokenization request to the iframe\n */\n @Method()\n async tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<CreatePaymentMethodResponse> {\n if (!this.childRef) {\n throw new Error('Cannot call tokenize');\n }\n return this.childRef.tokenize(...args);\n }\n\n /**\n * Runs a validation on the form and shows errors if any\n */\n @Method()\n async validate() {\n if (!this.childRef) {\n throw new Error('Cannot call validate');\n }\n return this.childRef.validate();\n }\n\n /**\n * Manually resizes the iframe to fit the contents of the iframe\n */\n @Method()\n async resize(): Promise<void> {\n if (!this.childRef) {\n throw new Error('Cannot call validate');\n }\n return this.childRef.resize();\n }\n\n render() {\n return (\n <justifi-payment-method-form\n ref={el => {\n if (el) {\n this.childRef = el;\n }\n }}\n iframe-origin={this.iframeOrigin}\n payment-method-form-type=\"bankAccount\"\n payment-method-form-ready={this.bankAccountFormReady}\n payment-method-form-tokenize={this.bankAccountFormTokenize}\n payment-method-form-validation-mode={this.validationMode || 'onSubmit'}\n />\n );\n }\n}\n"],"mappings":"wDAQaA,EAAe,M,sTAgC1BC,aAAaC,GACXC,KAAKC,qBAAqBC,KAAKH,E,CAIjCI,gBAAgBJ,GACdC,KAAKI,wBAAwBF,KAAKH,E,CAIpCM,gBAAgBN,GACdC,KAAKM,wBAAwBJ,KAAKH,E,CASpCQ,kBAAkBC,GAChB,IAAKR,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASE,YAAYH,E,CAOnCD,iBACE,IAAKP,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASG,U,CAOvBL,eACE,IAAKP,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASI,Q,CAGvBC,SACE,OACEC,EAAA,+BACEC,IAAKC,IACH,GAAIA,EAAI,CACNjB,KAAKS,SAAWQ,C,GAEnB,gBACcjB,KAAKkB,aAAY,2BACP,cAAa,4BACXlB,KAAKC,qBAAoB,+BACtBD,KAAKI,wBAAuB,sCACrBJ,KAAKmB,gBAAkB,Y"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-3aa91155.js";export{s as setNonce}from"./p-3aa91155.js";const i=()=>{const t=import.meta.url;const i={};if(t!==""){i.resourcesUrl=new URL(".",t).href}return e(i)};i().then((e=>t([["p-d87b0711",[[1,"justifi-payment-form",{bankAccount:[4,"bank-account"],card:[4],email:[1],iframeOrigin:[1,"iframe-origin"],clientId:[1,"client-id"],accountId:[1,"account-id"],submitButtonText:[1,"submit-button-text"],submitButtonEnabled:[32],isLoading:[32],selectedPaymentMethodType:[32],allowedPaymentMethodTypes:[32],fillBillingForm:[64],enableSubmitButton:[64]},[[0,"paymentMethodSelected","paymentMethodSelectedHandler"]]]]],["p-255b1284",[[1,"justifi-business-address",{businessAddress:[32],businessAddressErrors:[32],submit:[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["p-90c0d9e1",[[1,"justifi-business-info",{authToken:[1,"auth-token"],businessId:[1,"business-id"],businessInfoPrefillData:[32],businessInfo:[32],businessInfoFieldsErrors:[32],submit:[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-3aa91155.js";export{s as setNonce}from"./p-3aa91155.js";const i=()=>{const t=import.meta.url;const i={};if(t!==""){i.resourcesUrl=new URL(".",t).href}return e(i)};i().then((e=>t([["p-d87b0711",[[1,"justifi-payment-form",{bankAccount:[4,"bank-account"],card:[4],email:[1],iframeOrigin:[1,"iframe-origin"],clientId:[1,"client-id"],accountId:[1,"account-id"],submitButtonText:[1,"submit-button-text"],submitButtonEnabled:[32],isLoading:[32],selectedPaymentMethodType:[32],allowedPaymentMethodTypes:[32],fillBillingForm:[64],enableSubmitButton:[64]},[[0,"paymentMethodSelected","paymentMethodSelectedHandler"]]]]],["p-255b1284",[[1,"justifi-business-address",{businessAddress:[32],businessAddressErrors:[32],submit:[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["p-90c0d9e1",[[1,"justifi-business-info",{authToken:[1,"auth-token"],businessId:[1,"business-id"],businessInfoPrefillData:[32],businessInfo:[32],businessInfoFieldsErrors:[32],submit:[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["p-4ef14106",[[0,"justifi-payment-method-form",{paymentMethodFormType:[1,"payment-method-form-type"],paymentMethodFormValidationMode:[1025,"payment-method-form-validation-mode"],iframeOrigin:[1,"iframe-origin"],singleLine:[4,"single-line"],height:[32],tokenize:[64],validate:[64],resize:[64]}]]],["p-bd5352d6",[[0,"justifi-bank-account-form",{validationMode:[1025,"validation-mode"],iframeOrigin:[1025,"iframe-origin"],internalStyleOverrides:[32],tokenize:[64],validate:[64],resize:[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["p-0969db8f",[[0,"justifi-card-form",{validationMode:[1025,"validation-mode"],iframeOrigin:[1025,"iframe-origin"],singleLine:[4,"single-line"],internalStyleOverrides:[32],tokenize:[64],validate:[64],resize:[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["p-f30d1567",[[1,"justifi-payments-list",{accountId:[1,"account-id"],auth:[16],payments:[32]}]]],["p-dbf7100f",[[1,"select-input",{name:[1],label:[1],defaultValue:[1,"default-value"],error:[1],options:[16],internalValue:[32]}],[1,"text-input",{name:[1],label:[1],defaultValue:[1,"default-value"],error:[1],internalValue:[32]}]]],["p-c903cc5a",[[1,"justifi-billing-form",{legend:[1],billingFields:[32],billingFieldsErrors:[32],fill:[64],validate:[64],getValues:[64]},[[0,"fieldReceivedInput","setFormValue"]]],[1,"justifi-payment-method-selector",{paymentMethodTypes:[16],selectedPaymentMethodType:[1,"selected-payment-method-type"]}]]]],e)));
|
|
2
2
|
//# sourceMappingURL=webcomponents.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","bankAccount","card","email","iframeOrigin","clientId","accountId","submitButtonText","submitButtonEnabled","isLoading","selectedPaymentMethodType","allowedPaymentMethodTypes","fillBillingForm","enableSubmitButton","businessAddress","businessAddressErrors","submit","authToken","businessId","businessInfoPrefillData","businessInfo","businessInfoFieldsErrors","paymentMethodFormType","paymentMethodFormValidationMode","singleLine","height","tokenize","validate","validationMode","internalStyleOverrides","auth","payments","name","label","defaultValue","error","internalValue","legend","billingFields","billingFieldsErrors","fill","getValues","paymentMethodTypes"],"sources":["./node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.3.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name=\"csp-nonce\"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"sFAmBA,MAAMA,EAAe,KAkCjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAiB3E,GAAuBF,IAAe,GAAI,CACtCE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IAGrD,CAcI,OAAOC,EAAeJ,EAAK,ECrF/BH,IAAeQ,MAAKC,GAEXC,EAAc,0CAAuC,CAAAC,YAAA,mBAAAC,KAAA,IAAAC,MAAA,IAAAC,aAAA,oBAAAC,SAAA,gBAAAC,UAAA,iBAAAC,iBAAA,yBAAAC,oBAAA,KAAAC,UAAA,KAAAC,0BAAA,KAAAC,0BAAA,KAAAC,gBAAA,KAAAC,mBAAA,oHAAAC,gBAAA,KAAAC,sBAAA,KAAAC,OAAA,8FAAAC,UAAA,iBAAAC,WAAA,kBAAAC,wBAAA,KAAAC,aAAA,KAAAC,yBAAA,KAAAL,OAAA,oGAAAM,sBAAA,+BAAAC,gCAAA,6CAAAnB,aAAA,oBAAAoB,WAAA,kBAAAC,OAAA,KAAAC,SAAA,KAAAC,SAAA,wDAAAC,eAAA,yBAAAxB,aAAA,uBAAAyB,uBAAA,KAAAH,SAAA,KAAAC,SAAA,kMAAAC,eAAA,yBAAAxB,aAAA,uBAAAoB,WAAA,kBAAAK,uBAAA,KAAAH,SAAA,KAAAC,SAAA,sMAAArB,UAAA,iBAAAwB,KAAA,KAAAC,SAAA,2CAAAC,KAAA,IAAAC,MAAA,IAAAC,aAAA,oBAAAC,MAAA,IAAApC,QAAA,KAAAqC,cAAA,wBAAAJ,KAAA,IAAAC,MAAA,IAAAC,aAAA,oBAAAC,MAAA,IAAAC,cAAA,mDAAAC,OAAA,IAAAC,cAAA,KAAAC,oBAAA,KAAAC,KAAA,KAAAb,SAAA,KAAAc,UAAA,uFAAAC,mBAAA,KAAAhC,0BAAA,wCAAAX"}
|
|
1
|
+
{"version":3,"names":["patchBrowser","importMeta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","bootstrapLazy","bankAccount","card","email","iframeOrigin","clientId","accountId","submitButtonText","submitButtonEnabled","isLoading","selectedPaymentMethodType","allowedPaymentMethodTypes","fillBillingForm","enableSubmitButton","businessAddress","businessAddressErrors","submit","authToken","businessId","businessInfoPrefillData","businessInfo","businessInfoFieldsErrors","paymentMethodFormType","paymentMethodFormValidationMode","singleLine","height","tokenize","validate","resize","validationMode","internalStyleOverrides","auth","payments","name","label","defaultValue","error","internalValue","legend","billingFields","billingFieldsErrors","fill","getValues","paymentMethodTypes"],"sources":["./node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v3.3.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, plt, win, doc, promiseResolve, H } from '@stencil/core';\n/**\n * Helper method for querying a `meta` tag that contains a nonce value\n * out of a DOM's head.\n *\n * @param doc The DOM containing the `head` to query against\n * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag\n * exists or the tag has no content.\n */\nfunction queryNonceMetaTagContent(doc) {\n var _a, _b, _c;\n return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name=\"csp-nonce\"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;\n}\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\\s|-/g, '_')}`;\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n if (BUILD.cssVarShim) {\n // shim css vars\n // TODO(STENCIL-659): Remove code implementing the CSS variable shim\n plt.$cssShim$ = win.__cssshim;\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = \n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {\n // Safari < v11 support: This IF is true if it's Safari below v11.\n // This fn cannot use async/await since Safari didn't support it until v11,\n // however, Safari 10 did support modules. Safari 10 also didn't support \"nomodule\",\n // so both the ESM file and nomodule file would get downloaded. Only Safari\n // has 'onbeforeload' in the script, and \"history.scrollRestoration\" was added\n // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.\n // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.\n return {\n then() {\n /* promise noop */\n },\n };\n }\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n if (!BUILD.safari10 && importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n // TODO(STENCIL-663): Remove code related to deprecated `safari10` field.\n }\n else if (BUILD.dynamicImportShim || BUILD.safari10) {\n opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim) {\n patchDynamicImport(opts.resourcesUrl, scriptElm);\n }\n // TODO(STENCIL-661): Remove code related to the dynamic import shim\n if (BUILD.dynamicImportShim && !win.customElements) {\n // module support, but no custom elements support (Old Edge)\n // @ts-ignore\n return import(/* webpackChunkName: \"polyfills-dom\" */ './dom.js').then(() => opts);\n }\n }\n return promiseResolve(opts);\n};\n// TODO(STENCIL-661): Remove code related to the dynamic import shim\nconst patchDynamicImport = (base, orgScriptElm) => {\n const importFunctionName = getDynamicImportFunction(NAMESPACE);\n try {\n // test if this browser supports dynamic imports\n // There is a caching issue in V8, that breaks using import() in Function\n // By generating a random string, we can workaround it\n // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info\n win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);\n }\n catch (e) {\n // this shim is specifically for browsers that do support \"esm\" imports\n // however, they do NOT support \"dynamic\" imports\n // basically this code is for old Edge, v18 and below\n const moduleMap = new Map();\n win[importFunctionName] = (src) => {\n var _a;\n const url = new URL(src, base).href;\n let mod = moduleMap.get(url);\n if (!mod) {\n const script = doc.createElement('script');\n script.type = 'module';\n script.crossOrigin = orgScriptElm.crossOrigin;\n script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {\n type: 'application/javascript',\n }));\n // Apply CSP nonce to the script tag if it exists\n const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);\n if (nonce != null) {\n script.setAttribute('nonce', nonce);\n }\n mod = new Promise((resolve) => {\n script.onload = () => {\n resolve(win[importFunctionName].m);\n script.remove();\n };\n });\n moduleMap.set(url, mod);\n doc.head.appendChild(script);\n }\n return mod;\n };\n }\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":"sFAmBA,MAAMA,EAAe,KAkCjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAiB3E,GAAuBF,IAAe,GAAI,CACtCE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IAGrD,CAcI,OAAOC,EAAeJ,EAAK,ECrF/BH,IAAeQ,MAAKC,GAEXC,EAAc,0CAAuC,CAAAC,YAAA,mBAAAC,KAAA,IAAAC,MAAA,IAAAC,aAAA,oBAAAC,SAAA,gBAAAC,UAAA,iBAAAC,iBAAA,yBAAAC,oBAAA,KAAAC,UAAA,KAAAC,0BAAA,KAAAC,0BAAA,KAAAC,gBAAA,KAAAC,mBAAA,oHAAAC,gBAAA,KAAAC,sBAAA,KAAAC,OAAA,8FAAAC,UAAA,iBAAAC,WAAA,kBAAAC,wBAAA,KAAAC,aAAA,KAAAC,yBAAA,KAAAL,OAAA,oGAAAM,sBAAA,+BAAAC,gCAAA,6CAAAnB,aAAA,oBAAAoB,WAAA,kBAAAC,OAAA,KAAAC,SAAA,KAAAC,SAAA,KAAAC,OAAA,wDAAAC,eAAA,yBAAAzB,aAAA,uBAAA0B,uBAAA,KAAAJ,SAAA,KAAAC,SAAA,KAAAC,OAAA,kMAAAC,eAAA,yBAAAzB,aAAA,uBAAAoB,WAAA,kBAAAM,uBAAA,KAAAJ,SAAA,KAAAC,SAAA,KAAAC,OAAA,sMAAAtB,UAAA,iBAAAyB,KAAA,KAAAC,SAAA,2CAAAC,KAAA,IAAAC,MAAA,IAAAC,aAAA,oBAAAC,MAAA,IAAArC,QAAA,KAAAsC,cAAA,wBAAAJ,KAAA,IAAAC,MAAA,IAAAC,aAAA,oBAAAC,MAAA,IAAAC,cAAA,mDAAAC,OAAA,IAAAC,cAAA,KAAAC,oBAAA,KAAAC,KAAA,KAAAd,SAAA,KAAAe,UAAA,uFAAAC,mBAAA,KAAAjC,0BAAA,wCAAAX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justifi/webcomponents",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.2.0-rc.0",
|
|
4
4
|
"description": "JustiFi Web Components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/components/index.js",
|
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
"storybook": "^7.0.4"
|
|
80
80
|
},
|
|
81
81
|
"license": "MIT"
|
|
82
|
-
}
|
|
82
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CardForm","readyHandler","event","this","cardFormReady","emit","tokenizeHandler","cardFormTokenize","validateHandler","cardFormValidate","async","args","childRef","Error","tokenize","validate","render","h","ref","el","iframeOrigin","singleLine","validationMode"],"sources":["./src/components/card-form/card-form.tsx"],"sourcesContent":["import { Component, Event, Prop, h, EventEmitter, Method, Listen, State } from '@stencil/core';\nimport { CreatePaymentMethodResponse } from '../payment-method-form/payment-method-responses';\nimport { Theme } from '../payment-method-form/theme';\n\n@Component({\n tag: 'justifi-card-form',\n shadow: false,\n})\nexport class CardForm {\n /**\n * When to trigger validation of the form.\n */\n @Prop({ mutable: true }) validationMode: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n\n /**\n * URL for the rendered iFrame. End-users need not use this.\n */\n @Prop({ mutable: true }) iframeOrigin?: string;\n\n /**\n * Boolean indicating if the Card Form should render in a single line\n */\n @Prop() singleLine: boolean = false;\n @State() internalStyleOverrides: Theme;\n\n /**\n * Triggered when iframe has loaded\n * @event justifi-card-form#cardFormReady\n */\n\n @Event() cardFormReady: EventEmitter;\n\n /**\n * Triggered when the tokenize method is called on the component\n * @event justifi-card-form#cardFormTokenize\n */\n @Event() cardFormTokenize: EventEmitter<{ data: any }>;\n\n /**\n * Triggered when the validate method is called on the component\n * @event justifi-card-form#cardFormTokenize\n */\n @Event() cardFormValidate: EventEmitter<{ data: { isValid: boolean } }>;\n\n @Listen('paymentMethodFormReady')\n readyHandler(event: CustomEvent) {\n this.cardFormReady.emit(event);\n }\n\n @Listen('paymentMethodFormTokenize')\n tokenizeHandler(event: { data: any }) {\n this.cardFormTokenize.emit(event);\n }\n\n @Listen('paymentMethodFormValidate')\n validateHandler(event: { data: any }) {\n this.cardFormValidate.emit(event);\n }\n\n private childRef?: HTMLJustifiPaymentMethodFormElement;\n\n /**\n * Makes a tokenization request to the iframe\n */\n @Method()\n async tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<CreatePaymentMethodResponse> {\n if (!this.childRef) {\n throw new Error('Cannot call tokenize');\n }\n return this.childRef.tokenize(...args);\n }\n\n /**\n * Runs a validation on the form and shows errors if any\n */\n @Method()\n async validate(): Promise<{ isValid: boolean }> {\n if (!this.childRef) {\n throw new Error('Cannot call validate');\n }\n return this.childRef.validate();\n }\n\n render() {\n return (\n <justifi-payment-method-form\n ref={el => {\n if (el) {\n this.childRef = el;\n }\n }}\n iframe-origin={this.iframeOrigin}\n payment-method-form-type=\"card\"\n single-line={this.singleLine}\n payment-method-form-ready={this.cardFormReady}\n payment-method-form-tokenize={this.cardFormTokenize}\n payment-method-form-validation-mode={this.validationMode || 'onSubmit'}\n />\n );\n }\n}\n"],"mappings":"wDAQaA,EAAQ,M,sPAcW,M,sCAuB9BC,aAAaC,GACXC,KAAKC,cAAcC,KAAKH,E,CAI1BI,gBAAgBJ,GACdC,KAAKI,iBAAiBF,KAAKH,E,CAI7BM,gBAAgBN,GACdC,KAAKM,iBAAiBJ,KAAKH,E,CAS7BQ,kBAAkBC,GAChB,IAAKR,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASE,YAAYH,E,CAOnCD,iBACE,IAAKP,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASG,U,CAGvBC,SACE,OACEC,EAAA,+BACEC,IAAKC,IACH,GAAIA,EAAI,CACNhB,KAAKS,SAAWO,C,GAEnB,gBACchB,KAAKiB,aAAY,2BACP,OAAM,cAClBjB,KAAKkB,WAAU,4BACDlB,KAAKC,cAAa,+BACfD,KAAKI,iBAAgB,sCACdJ,KAAKmB,gBAAkB,Y"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as o,c as t,h as e,H as r}from"./p-3aa91155.js";const i={card:{ready:"justifi.card.ready",tokenize:"justifi.card.tokenize",validate:"justifi.card.validate",resize:"justifi.card.resize",styleOverrides:"justifi.card.styleOverrides"},bankAccount:{ready:"justifi.bankAccount.ready",tokenize:"justifi.bankAccount.tokenize",validate:"justifi.bankAccount.validate",resize:"justifi.bankAccount.resize",styleOverrides:"justifi.bankAccount.styleOverrides"}};const s="@justifi/webcomponents";const n="4.0.6";const c="JustiFi Web Components";const d="dist/index.cjs.js";const a="dist/components/index.js";const l="dist/esm/index.mjs";const f="dist/esm/index.mjs";const m="dist/types/index.d.ts";const u="dist/collection/collection-manifest.json";const h={type:"git",url:"git+https://github.com/justifi-tech/web-component-library.git"};const b={registry:"https://registry.npmjs.org"};const p=["dist/","loader/"];const g={"auto-changelog":"auto-changelog","build:dev":"NODE_ENV=dev stencil build --docs","build:staging":"NODE_ENV=staging stencil build --docs","build:prod":"NODE_ENV=prod stencil build --docs",start:'NODE_ENV=dev concurrently -c "bgBlue.bold,bgMagenta.bold,bgGreen.bold" "yarn run start-stencil" "yarn run storybook"',"start-stencil":"stencil build --watch --serve --no-open",test:"stencil test --spec","test:watch":"stencil test --spec --watchAll","test:e2e":"stencil test --e2e",generate:"stencil generate",storybook:"storybook dev -p 6006 --quiet","build-storybook":"storybook build -o ../docs"};const y={"@stencil/core":"^3.3.0","@stencil/react-output-target":"^0.3.1",bootstrap:"^5.2.3","date-fns":"^2.29.3","dinero.js":"^1.9.1","ts-dedent":"^2.2.0",uuid:"^9.0.0",yup:"^1.0.0"};const j={"@babel/preset-env":"^7.21.5","@babel/preset-react":"^7.18.6","@babel/preset-typescript":"^7.21.5","@pxtrn/storybook-addon-docs-stencil":"^6.4.1","@stencil/sass":"^3.0.1","@storybook/addon-actions":"^7.0.4","@storybook/addon-essentials":"^7.0.4","@storybook/addon-interactions":"^7.0.4","@storybook/addon-links":"^7.0.4","@storybook/html":"^7.0.4","@storybook/html-webpack5":"^7.0.4","@storybook/jest":"^0.1.0","@storybook/testing-library":"^0.1.0","@types/jest":"27.0.3","@types/node":"^20.1.4","@types/react":"^18.0.37","@types/react-dom":"^18.0.11","auto-changelog":"^2.4.0",concurrently:"^7.6.0",jest:"^27.4.5","jest-cli":"^27.4.5",puppeteer:"^10.0.0",react:"^18.2.0","react-dom":"^18.2.0","release-it":"^15.6.0","rollup-plugin-replace":"^2.2.0",storybook:"^7.0.4"};const k="MIT";const w={name:s,version:n,description:c,main:d,module:a,es2015:l,es2017:f,types:m,collection:u,"collection:main":"dist/collection/index.js",repository:h,publishConfig:b,files:p,scripts:g,"auto-changelog":{output:"../CHANGELOG.md",hideCredtis:"true",commitLimit:"true"},dependencies:y,devDependencies:j,license:k};const v=()=>{const o=getComputedStyle(document.body);const t={layout:{padding:o.getPropertyValue("--jfi-layout-padding"),formControlSpacingHorizontal:o.getPropertyValue("--jfi-layout-form-control-spacing-x"),formControlSpacingVertical:o.getPropertyValue("--jfi-layout-form-control-spacing-y")},formControl:{backgroundColor:o.getPropertyValue("--jfi-form-control-background-color"),borderColor:o.getPropertyValue("--jfi-form-control-border-color"),borderColorFocus:o.getPropertyValue("--jfi-form-control-border-color-focus"),borderColorError:o.getPropertyValue("--jfi-form-control-border-color-error"),borderWidth:o.getPropertyValue("--jfi-form-control-border-width"),borderBottomWidth:o.getPropertyValue("--jfi-form-control-border-bottom-width"),borderLeftWidth:o.getPropertyValue("--jfi-form-control-border-left-width"),borderRightWidth:o.getPropertyValue("--jfi-form-control-border-right-width"),borderTopWidth:o.getPropertyValue("--jfi-form-control-border-top-width"),borderRadius:o.getPropertyValue("--jfi-form-control-border-radius"),borderStyle:o.getPropertyValue("--jfi-form-control-border-style"),boxShadow:o.getPropertyValue("--jfi-form-control-box-shadow"),boxShadowError:o.getPropertyValue("--jfi-form-control-box-shadow-error"),boxShadowErrorFocus:o.getPropertyValue("--jfi-form-control-box-shadow-error-focus"),boxShadowFocus:o.getPropertyValue("--jfi-form-control-box-shadow-focus"),color:o.getPropertyValue("--jfi-form-control-color"),colorFocus:o.getPropertyValue("--jfi-form-control-color-focus"),fontSize:o.getPropertyValue("--jfi-form-control-font-size"),fontWeight:o.getPropertyValue("--jfi-form-control-font-weight"),lineHeight:o.getPropertyValue("--jfi-form-control-line-height"),margin:o.getPropertyValue("--jfi-form-control-margin"),padding:o.getPropertyValue("--jfi-form-control-padding")},formLabel:{color:o.getPropertyValue("--jfi-form-label-color"),fontFamily:o.getPropertyValue("--jfi-form-label-font-family"),fontSize:o.getPropertyValue("--jfi-form-label-font-size"),fontWeight:o.getPropertyValue("--jfi-form-label-font-weight"),margin:o.getPropertyValue("--jfi-form-label-margin")},errorMessage:{color:o.getPropertyValue("--jfi-error-message-color"),margin:o.getPropertyValue("--jfi-error-message-margin"),fontSize:o.getPropertyValue("--jfi-error-message-font-size")}};return t};const x=":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";const z=class{constructor(e){o(this,e);this.paymentMethodFormReady=t(this,"paymentMethodFormReady",7);this.paymentMethodFormTokenize=t(this,"paymentMethodFormTokenize",7);this.computedTheme=v();this.paymentMethodFormType=undefined;this.paymentMethodFormValidationMode=undefined;this.iframeOrigin=undefined;this.singleLine=undefined;this.height=55}connectedCallback(){window.addEventListener("message",this.dispatchMessageEvent.bind(this))}disconnectedCallback(){window.removeEventListener("message",this.dispatchMessageEvent.bind(this))}componentShouldUpdate(){this.sendStyleOverrides()}sendStyleOverrides(){if(this.computedTheme){this.postMessage(i[this.paymentMethodFormType].styleOverrides,{styleOverrides:this.computedTheme})}}dispatchMessageEvent(o){const t=o.data;const e=t.eventType;const r=t.data;if(e===i[this.paymentMethodFormType].ready){this.paymentMethodFormReady.emit(r)}if(e===i[this.paymentMethodFormType].resize){this.height=r.height}}postMessage(o,t){var e,r;(r=(e=this.iframeElement)===null||e===void 0?void 0:e.contentWindow)===null||r===void 0?void 0:r.postMessage(Object.assign({eventType:o},t),"*")}async postMessageWithResponseListener(o,t){return new Promise((e=>{const r=t=>{if(t.data.eventType!==o)return;window.removeEventListener("message",r);e(t.data.data)};window.addEventListener("message",r);this.postMessage(o,t)}))}async tokenize(o,t,e){const r=i[this.paymentMethodFormType].tokenize;const s={clientId:o,componentVersion:w.version,paymentMethodMetadata:t,account:e};return this.postMessageWithResponseListener(r,s)}async validate(){return this.postMessageWithResponseListener(i[this.paymentMethodFormType].validate)}composeQueryParams(o){const t=o.map((t=>{if(t===o[0]){return t=`?${t}`}else{return t=`&${t}`}}));return t.join("")}getIframeSrc(){const o=undefined;let t=`${o}/${this.paymentMethodFormType}`;let e=[];if(this.paymentMethodFormValidationMode){e.push(`validationMode=${this.paymentMethodFormValidationMode}`)}if(this.singleLine){e.push(`singleLine=${this.singleLine}`)}return t.concat(this.composeQueryParams(e))}render(){return e(r,null,e("iframe",{id:`justifi-payment-method-form-${this.paymentMethodFormType}`,src:this.getIframeSrc(),ref:o=>this.iframeElement=o,height:this.height}))}};z.style=x;export{z as justifi_payment_method_form};
|
|
2
|
-
//# sourceMappingURL=p-1f23b391.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BankAccountForm","readyHandler","event","this","bankAccountFormReady","emit","tokenizeHandler","bankAccountFormTokenize","validateHandler","bankAccountFormValidate","async","args","childRef","Error","tokenize","validate","render","h","ref","el","iframeOrigin","validationMode"],"sources":["./src/components/bank-account-form/bank-account-form.tsx"],"sourcesContent":["import { Component, Event, Prop, h, EventEmitter, Listen, Method, State } from '@stencil/core';\nimport { CreatePaymentMethodResponse } from '../payment-method-form/payment-method-responses';\nimport { Theme } from '../payment-method-form/theme';\n\n@Component({\n tag: 'justifi-bank-account-form',\n shadow: false,\n})\nexport class BankAccountForm {\n /**\n * When to trigger validation of the form.\n */\n @Prop({ mutable: true }) validationMode: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n\n /**\n * URL for the rendered iFrame. End-users need not use this.\n */\n @Prop({ mutable: true }) iframeOrigin?: string;\n\n @State() internalStyleOverrides: Theme;\n\n /**\n * Triggered when iframe has loaded\n * @event justifi-bank-account-form#bankAccountFormReady\n */\n @Event() bankAccountFormReady: EventEmitter<any>;\n\n /**\n * Triggered when the tokenize method is called on the component\n * @event justifi-bank-account-form#bankAccountFormTokenize\n */\n @Event() bankAccountFormTokenize: EventEmitter<{ data: any }>;\n\n /**\n * Triggered when the validate method is called on the component\n * @event justifi-bank-account-form#bankAccountFormValidate\n */\n @Event() bankAccountFormValidate: EventEmitter<{ data: { isValid: boolean } }>;\n\n @Listen('paymentMethodFormReady')\n readyHandler(event: CustomEvent) {\n this.bankAccountFormReady.emit(event);\n }\n\n @Listen('paymentMethodFormTokenize')\n tokenizeHandler(event: { data: any }) {\n this.bankAccountFormTokenize.emit(event);\n }\n\n @Listen('paymentMethodFormValidate')\n validateHandler(event: { data: any }) {\n this.bankAccountFormValidate.emit(event);\n }\n\n private childRef?: HTMLJustifiPaymentMethodFormElement;\n\n /**\n * Makes a tokenization request to the iframe\n */\n @Method()\n async tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<CreatePaymentMethodResponse> {\n if (!this.childRef) {\n throw new Error('Cannot call tokenize');\n }\n return this.childRef.tokenize(...args);\n }\n\n /**\n * Runs a validation on the form and shows errors if any\n */\n @Method()\n async validate() {\n if (!this.childRef) {\n throw new Error('Cannot call validate');\n }\n return this.childRef.validate();\n }\n\n render() {\n return (\n <justifi-payment-method-form\n ref={el => {\n if (el) {\n this.childRef = el;\n }\n }}\n iframe-origin={this.iframeOrigin}\n payment-method-form-type=\"bankAccount\"\n payment-method-form-ready={this.bankAccountFormReady}\n payment-method-form-tokenize={this.bankAccountFormTokenize}\n payment-method-form-validation-mode={this.validationMode || 'onSubmit'}\n />\n );\n }\n}\n"],"mappings":"wDAQaA,EAAe,M,sTAgC1BC,aAAaC,GACXC,KAAKC,qBAAqBC,KAAKH,E,CAIjCI,gBAAgBJ,GACdC,KAAKI,wBAAwBF,KAAKH,E,CAIpCM,gBAAgBN,GACdC,KAAKM,wBAAwBJ,KAAKH,E,CASpCQ,kBAAkBC,GAChB,IAAKR,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASE,YAAYH,E,CAOnCD,iBACE,IAAKP,KAAKS,SAAU,CAClB,MAAM,IAAIC,MAAM,uB,CAElB,OAAOV,KAAKS,SAASG,U,CAGvBC,SACE,OACEC,EAAA,+BACEC,IAAKC,IACH,GAAIA,EAAI,CACNhB,KAAKS,SAAWO,C,GAEnB,gBACchB,KAAKiB,aAAY,2BACP,cAAa,4BACXjB,KAAKC,qBAAoB,+BACtBD,KAAKI,wBAAuB,sCACrBJ,KAAKkB,gBAAkB,Y"}
|