@justifi/webcomponents 3.3.5 → 4.0.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 +14 -0
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +1 -1
- package/dist/collection/components/bank-account-form/bank-account-form.js +6 -2
- package/dist/collection/components/card-form/card-form.js +6 -2
- package/dist/collection/components/payment-form/payment-form.js +8 -3
- package/dist/collection/components/payment-method-form/payment-method-form.js +6 -2
- package/dist/collection/components/payment-method-form/payment-method-responses.js +1 -0
- package/dist/components/payment-method-form.js +1 -1
- package/dist/esm/justifi-payment-method-form.entry.js +1 -1
- package/dist/types/components/bank-account-form/bank-account-form.d.ts +2 -1
- package/dist/types/components/card-form/card-form.d.ts +2 -1
- package/dist/types/components/payment-form/payment-form.d.ts +2 -3
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +2 -1
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +46 -0
- package/dist/types/components.d.ts +5 -4
- package/dist/webcomponents/{p-c3c51a2a.entry.js → p-48bd3d00.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### 4.0.0
|
|
8
|
+
> 08 May 2023
|
|
9
|
+
|
|
10
|
+
- Changed: `CardForm.tokenize`, `BankAccountForm.tokenize` and `PaymentForm.submitted` will now return the full response from the `payment_methods` endpoint instead of just `errors` or `token`. See the API documentation to see payment method CREATE sample responses: https://developer.justifi.ai/tag/Payment-Methods#operation/CreatePaymentMethod
|
|
11
|
+
|
|
12
|
+
Migration notes:
|
|
13
|
+
- Errors - instead of getting errors via `data.errors[0]`, which was an error code, you will now need to use `data.error.code`. There is also now a human readable message (`data.error.message`)
|
|
14
|
+
- Success/created payment method - instead of getting the token via `data.token`, it is nested within a full payment method response. In order to get the token you will need to use `data.card.token` or `data.bank_account.token` depending on what payment method type is being tokenized
|
|
15
|
+
|
|
7
16
|
#### 3.3.5
|
|
8
17
|
> 11 May 2023
|
|
9
18
|
|
|
@@ -23,6 +32,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
23
32
|
|
|
24
33
|
- Fix missing url to show recently added introduction page.
|
|
25
34
|
|
|
35
|
+
#### 3.0.4
|
|
36
|
+
> 08 May 2023
|
|
37
|
+
|
|
38
|
+
- Add Storybook landing page with general info
|
|
39
|
+
|
|
26
40
|
#### 3.0.3
|
|
27
41
|
> 04 May 2023
|
|
28
42
|
|
|
@@ -22,7 +22,7 @@ const MessageEventType = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const name = "@justifi/webcomponents";
|
|
25
|
-
const version = "
|
|
25
|
+
const version = "4.0.0";
|
|
26
26
|
const description = "JustiFi Web Components";
|
|
27
27
|
const main = "dist/index.cjs.js";
|
|
28
28
|
const module$1 = "dist/components/index.js";
|
|
@@ -144,7 +144,7 @@ export class BankAccountForm {
|
|
|
144
144
|
return {
|
|
145
145
|
"tokenize": {
|
|
146
146
|
"complexType": {
|
|
147
|
-
"signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<
|
|
147
|
+
"signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<CreatePaymentMethodResponse>",
|
|
148
148
|
"parameters": [{
|
|
149
149
|
"tags": [],
|
|
150
150
|
"text": ""
|
|
@@ -153,6 +153,10 @@ export class BankAccountForm {
|
|
|
153
153
|
"Promise": {
|
|
154
154
|
"location": "global"
|
|
155
155
|
},
|
|
156
|
+
"CreatePaymentMethodResponse": {
|
|
157
|
+
"location": "import",
|
|
158
|
+
"path": "../payment-method-form/payment-method-responses"
|
|
159
|
+
},
|
|
156
160
|
"Parameters": {
|
|
157
161
|
"location": "global"
|
|
158
162
|
},
|
|
@@ -160,7 +164,7 @@ export class BankAccountForm {
|
|
|
160
164
|
"location": "global"
|
|
161
165
|
}
|
|
162
166
|
},
|
|
163
|
-
"return": "Promise<
|
|
167
|
+
"return": "Promise<CreatePaymentMethodResponse>"
|
|
164
168
|
},
|
|
165
169
|
"docs": {
|
|
166
170
|
"text": "Makes a tokenization request to the iframe",
|
|
@@ -163,7 +163,7 @@ export class CardForm {
|
|
|
163
163
|
return {
|
|
164
164
|
"tokenize": {
|
|
165
165
|
"complexType": {
|
|
166
|
-
"signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<
|
|
166
|
+
"signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<CreatePaymentMethodResponse>",
|
|
167
167
|
"parameters": [{
|
|
168
168
|
"tags": [],
|
|
169
169
|
"text": ""
|
|
@@ -172,6 +172,10 @@ export class CardForm {
|
|
|
172
172
|
"Promise": {
|
|
173
173
|
"location": "global"
|
|
174
174
|
},
|
|
175
|
+
"CreatePaymentMethodResponse": {
|
|
176
|
+
"location": "import",
|
|
177
|
+
"path": "../payment-method-form/payment-method-responses"
|
|
178
|
+
},
|
|
175
179
|
"Parameters": {
|
|
176
180
|
"location": "global"
|
|
177
181
|
},
|
|
@@ -179,7 +183,7 @@ export class CardForm {
|
|
|
179
183
|
"location": "global"
|
|
180
184
|
}
|
|
181
185
|
},
|
|
182
|
-
"return": "Promise<
|
|
186
|
+
"return": "Promise<CreatePaymentMethodResponse>"
|
|
183
187
|
},
|
|
184
188
|
"docs": {
|
|
185
189
|
"text": "Makes a tokenization request to the iframe",
|
|
@@ -214,9 +214,14 @@ export class PaymentForm {
|
|
|
214
214
|
"text": ""
|
|
215
215
|
},
|
|
216
216
|
"complexType": {
|
|
217
|
-
"original": "
|
|
218
|
-
"resolved": "
|
|
219
|
-
"references": {
|
|
217
|
+
"original": "CreatePaymentMethodResponse",
|
|
218
|
+
"resolved": "BankAccountCreateResponse | CardCreateResponse",
|
|
219
|
+
"references": {
|
|
220
|
+
"CreatePaymentMethodResponse": {
|
|
221
|
+
"location": "import",
|
|
222
|
+
"path": "../payment-method-form/payment-method-responses"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
220
225
|
}
|
|
221
226
|
}];
|
|
222
227
|
}
|
|
@@ -220,7 +220,7 @@ export class PaymentMethodForm {
|
|
|
220
220
|
return {
|
|
221
221
|
"tokenize": {
|
|
222
222
|
"complexType": {
|
|
223
|
-
"signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<
|
|
223
|
+
"signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<CreatePaymentMethodResponse>",
|
|
224
224
|
"parameters": [{
|
|
225
225
|
"tags": [],
|
|
226
226
|
"text": ""
|
|
@@ -234,9 +234,13 @@ export class PaymentMethodForm {
|
|
|
234
234
|
"references": {
|
|
235
235
|
"Promise": {
|
|
236
236
|
"location": "global"
|
|
237
|
+
},
|
|
238
|
+
"CreatePaymentMethodResponse": {
|
|
239
|
+
"location": "import",
|
|
240
|
+
"path": "./payment-method-responses"
|
|
237
241
|
}
|
|
238
242
|
},
|
|
239
|
-
"return": "Promise<
|
|
243
|
+
"return": "Promise<CreatePaymentMethodResponse>"
|
|
240
244
|
},
|
|
241
245
|
"docs": {
|
|
242
246
|
"text": "",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,7 +18,7 @@ const MessageEventType = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const name = "@justifi/webcomponents";
|
|
21
|
-
const version = "
|
|
21
|
+
const version = "4.0.0";
|
|
22
22
|
const description = "JustiFi Web Components";
|
|
23
23
|
const main = "dist/index.cjs.js";
|
|
24
24
|
const module = "dist/components/index.js";
|
|
@@ -18,7 +18,7 @@ const MessageEventType = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const name = "@justifi/webcomponents";
|
|
21
|
-
const version = "
|
|
21
|
+
const version = "4.0.0";
|
|
22
22
|
const description = "JustiFi Web Components";
|
|
23
23
|
const main = "dist/index.cjs.js";
|
|
24
24
|
const module = "dist/components/index.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { CreatePaymentMethodResponse } from '../payment-method-form/payment-method-responses';
|
|
2
3
|
import { Theme } from '../payment-method-form/theme';
|
|
3
4
|
export declare class BankAccountForm {
|
|
4
5
|
/**
|
|
@@ -42,7 +43,7 @@ export declare class BankAccountForm {
|
|
|
42
43
|
/**
|
|
43
44
|
* Makes a tokenization request to the iframe
|
|
44
45
|
*/
|
|
45
|
-
tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<
|
|
46
|
+
tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<CreatePaymentMethodResponse>;
|
|
46
47
|
/**
|
|
47
48
|
* Runs a validation on the form and shows errors if any
|
|
48
49
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { CreatePaymentMethodResponse } from '../payment-method-form/payment-method-responses';
|
|
2
3
|
import { Theme } from '../payment-method-form/theme';
|
|
3
4
|
export declare class CardForm {
|
|
4
5
|
/**
|
|
@@ -46,7 +47,7 @@ export declare class CardForm {
|
|
|
46
47
|
/**
|
|
47
48
|
* Makes a tokenization request to the iframe
|
|
48
49
|
*/
|
|
49
|
-
tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<
|
|
50
|
+
tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<CreatePaymentMethodResponse>;
|
|
50
51
|
/**
|
|
51
52
|
* Runs a validation on the form and shows errors if any
|
|
52
53
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { PaymentMethodTypes } from '../../api';
|
|
3
3
|
import { BillingFormFields } from '../billing-form/billing-form-schema';
|
|
4
|
+
import { CreatePaymentMethodResponse } from '../payment-method-form/payment-method-responses';
|
|
4
5
|
export declare class PaymentForm {
|
|
5
6
|
bankAccount?: boolean;
|
|
6
7
|
card?: boolean;
|
|
@@ -9,9 +10,7 @@ export declare class PaymentForm {
|
|
|
9
10
|
clientId: string;
|
|
10
11
|
accountId?: string;
|
|
11
12
|
submitButtonText?: string;
|
|
12
|
-
submitted: EventEmitter<
|
|
13
|
-
data: any;
|
|
14
|
-
}>;
|
|
13
|
+
submitted: EventEmitter<CreatePaymentMethodResponse>;
|
|
15
14
|
submitButtonEnabled: boolean;
|
|
16
15
|
selectedPaymentMethodType: PaymentMethodTypes;
|
|
17
16
|
allowedPaymentMethodTypes: PaymentMethodTypes[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { CreatePaymentMethodResponse } from './payment-method-responses';
|
|
2
3
|
export declare class PaymentMethodForm {
|
|
3
4
|
paymentMethodFormType: 'card' | 'bankAccount';
|
|
4
5
|
paymentMethodFormValidationMode: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
@@ -18,7 +19,7 @@ export declare class PaymentMethodForm {
|
|
|
18
19
|
private dispatchMessageEvent;
|
|
19
20
|
private postMessage;
|
|
20
21
|
private postMessageWithResponseListener;
|
|
21
|
-
tokenize(clientId: string, paymentMethodMetadata: any, account?: string): Promise<
|
|
22
|
+
tokenize(clientId: string, paymentMethodMetadata: any, account?: string): Promise<CreatePaymentMethodResponse>;
|
|
22
23
|
validate(): Promise<any>;
|
|
23
24
|
private composeQueryParams;
|
|
24
25
|
private getIframeSrc;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
interface PaymentMethodCreateResponseWrapper {
|
|
2
|
+
id: string;
|
|
3
|
+
type: 'payment_method';
|
|
4
|
+
error?: {
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
page_info: string;
|
|
9
|
+
}
|
|
10
|
+
interface CardCreateResponse extends PaymentMethodCreateResponseWrapper {
|
|
11
|
+
data?: {
|
|
12
|
+
signature: string;
|
|
13
|
+
customer_id: string;
|
|
14
|
+
account_id: string;
|
|
15
|
+
card: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
acct_last_four: number;
|
|
19
|
+
brand: string;
|
|
20
|
+
token: string;
|
|
21
|
+
month: string;
|
|
22
|
+
year: string;
|
|
23
|
+
metadata: any;
|
|
24
|
+
address_line1_check: string;
|
|
25
|
+
address_postal_code_check: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface BankAccountCreateResponse extends PaymentMethodCreateResponseWrapper {
|
|
30
|
+
data?: {
|
|
31
|
+
signature: string;
|
|
32
|
+
customer_id: string;
|
|
33
|
+
account_id: string;
|
|
34
|
+
bank_account: {
|
|
35
|
+
id: string;
|
|
36
|
+
account_owner_name: string;
|
|
37
|
+
account_type: 'checking' | 'savings';
|
|
38
|
+
bank_name: string;
|
|
39
|
+
acct_last_four: number;
|
|
40
|
+
token: string;
|
|
41
|
+
metadata: any;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare type CreatePaymentMethodResponse = CardCreateResponse | BankAccountCreateResponse;
|
|
46
|
+
export {};
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
import { CreatePaymentMethodResponse } from "./components/payment-method-form/payment-method-responses";
|
|
8
9
|
import { BillingFormFields } from "./components/billing-form/billing-form-schema";
|
|
9
10
|
import { ValidationError } from "yup";
|
|
10
11
|
import { PaymentMethodTypes } from "./api";
|
|
@@ -17,7 +18,7 @@ export namespace Components {
|
|
|
17
18
|
/**
|
|
18
19
|
* Makes a tokenization request to the iframe
|
|
19
20
|
*/
|
|
20
|
-
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<
|
|
21
|
+
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<CreatePaymentMethodResponse>;
|
|
21
22
|
/**
|
|
22
23
|
* Runs a validation on the form and shows errors if any
|
|
23
24
|
*/
|
|
@@ -59,7 +60,7 @@ export namespace Components {
|
|
|
59
60
|
/**
|
|
60
61
|
* Makes a tokenization request to the iframe
|
|
61
62
|
*/
|
|
62
|
-
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<
|
|
63
|
+
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<CreatePaymentMethodResponse>;
|
|
63
64
|
/**
|
|
64
65
|
* Runs a validation on the form and shows errors if any
|
|
65
66
|
*/
|
|
@@ -85,7 +86,7 @@ export namespace Components {
|
|
|
85
86
|
"paymentMethodFormType": 'card' | 'bankAccount';
|
|
86
87
|
"paymentMethodFormValidationMode": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
87
88
|
"singleLine": boolean;
|
|
88
|
-
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<
|
|
89
|
+
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<CreatePaymentMethodResponse>;
|
|
89
90
|
"validate": () => Promise<any>;
|
|
90
91
|
}
|
|
91
92
|
interface JustifiPaymentMethodSelector {
|
|
@@ -273,7 +274,7 @@ declare namespace LocalJSX {
|
|
|
273
274
|
"clientId"?: string;
|
|
274
275
|
"email"?: string;
|
|
275
276
|
"iframeOrigin"?: string;
|
|
276
|
-
"onSubmitted"?: (event: JustifiPaymentFormCustomEvent<
|
|
277
|
+
"onSubmitted"?: (event: JustifiPaymentFormCustomEvent<CreatePaymentMethodResponse>) => void;
|
|
277
278
|
"submitButtonText"?: string;
|
|
278
279
|
}
|
|
279
280
|
interface JustifiPaymentMethodForm {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,c as r,h as t,H as i}from"./p-4a406704.js";const e={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"}},s=class{constructor(t){o(this,t),this.paymentMethodFormReady=r(this,"paymentMethodFormReady",7),this.paymentMethodFormTokenize=r(this,"paymentMethodFormTokenize",7),this.computedTheme=(()=>{const o=getComputedStyle(document.body);return{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")}}})(),this.paymentMethodFormType=void 0,this.paymentMethodFormValidationMode=void 0,this.iframeOrigin=void 0,this.singleLine=void 0,this.height=55}connectedCallback(){window.addEventListener("message",this.dispatchMessageEvent.bind(this))}disconnectedCallback(){window.removeEventListener("message",this.dispatchMessageEvent.bind(this))}componentShouldUpdate(){this.sendStyleOverrides()}sendStyleOverrides(){this.computedTheme&&this.postMessage(e[this.paymentMethodFormType].styleOverrides,{styleOverrides:this.computedTheme})}dispatchMessageEvent(o){const r=o.data,t=r.eventType,i=r.data;t===e[this.paymentMethodFormType].ready&&this.paymentMethodFormReady.emit(i),t===e[this.paymentMethodFormType].resize&&(this.height=i.height)}postMessage(o,r){var t,i;null===(i=null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow)||void 0===i||i.postMessage(Object.assign({eventType:o},r),"*")}async postMessageWithResponseListener(o,r){return new Promise((t=>{const i=r=>{r.data.eventType===o&&(window.removeEventListener("message",i),t(r.data.data))};window.addEventListener("message",i),this.postMessage(o,r)}))}async tokenize(o,r,t){return this.postMessageWithResponseListener(e[this.paymentMethodFormType].tokenize,{clientId:o,componentVersion:"
|
|
1
|
+
import{r as o,c as r,h as t,H as i}from"./p-4a406704.js";const e={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"}},s=class{constructor(t){o(this,t),this.paymentMethodFormReady=r(this,"paymentMethodFormReady",7),this.paymentMethodFormTokenize=r(this,"paymentMethodFormTokenize",7),this.computedTheme=(()=>{const o=getComputedStyle(document.body);return{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")}}})(),this.paymentMethodFormType=void 0,this.paymentMethodFormValidationMode=void 0,this.iframeOrigin=void 0,this.singleLine=void 0,this.height=55}connectedCallback(){window.addEventListener("message",this.dispatchMessageEvent.bind(this))}disconnectedCallback(){window.removeEventListener("message",this.dispatchMessageEvent.bind(this))}componentShouldUpdate(){this.sendStyleOverrides()}sendStyleOverrides(){this.computedTheme&&this.postMessage(e[this.paymentMethodFormType].styleOverrides,{styleOverrides:this.computedTheme})}dispatchMessageEvent(o){const r=o.data,t=r.eventType,i=r.data;t===e[this.paymentMethodFormType].ready&&this.paymentMethodFormReady.emit(i),t===e[this.paymentMethodFormType].resize&&(this.height=i.height)}postMessage(o,r){var t,i;null===(i=null===(t=this.iframeElement)||void 0===t?void 0:t.contentWindow)||void 0===i||i.postMessage(Object.assign({eventType:o},r),"*")}async postMessageWithResponseListener(o,r){return new Promise((t=>{const i=r=>{r.data.eventType===o&&(window.removeEventListener("message",i),t(r.data.data))};window.addEventListener("message",i),this.postMessage(o,r)}))}async tokenize(o,r,t){return this.postMessageWithResponseListener(e[this.paymentMethodFormType].tokenize,{clientId:o,componentVersion:"4.0.0",paymentMethodMetadata:r,account:t})}async validate(){return this.postMessageWithResponseListener(e[this.paymentMethodFormType].validate)}composeQueryParams(o){return o.map((r=>r===o[0]?`?${r}`:`&${r}`)).join("")}getIframeSrc(){let o=`${this.iframeOrigin||"https://js.justifi.ai/v2"}/${this.paymentMethodFormType}`,r=[];return this.paymentMethodFormValidationMode&&r.push(`validationMode=${this.paymentMethodFormValidationMode}`),this.singleLine&&r.push(`singleLine=${this.singleLine}`),o.concat(this.composeQueryParams(r))}render(){return t(i,null,t("iframe",{id:`justifi-payment-method-form-${this.paymentMethodFormType}`,src:this.getIframeSrc(),ref:o=>this.iframeElement=o,height:this.height}))}};s.style=":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";export{s as justifi_payment_method_form}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-4a406704.js";(()=>{const t=import.meta.url,
|
|
1
|
+
import{p as e,b as t}from"./p-4a406704.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((e=>t([["p-bf40b1ca",[[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],selectedPaymentMethodType:[32],allowedPaymentMethodTypes:[32],fillBillingForm:[64],enableSubmitButton:[64]},[[0,"paymentMethodSelected","paymentMethodSelectedHandler"]]]]],["p-bc35e124",[[0,"justifi-bank-account-form",{validationMode:[1025,"validation-mode"],iframeOrigin:[1025,"iframe-origin"],internalStyleOverrides:[32],tokenize:[64],validate:[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["p-5774e36e",[[0,"justifi-card-form",{validationMode:[1025,"validation-mode"],iframeOrigin:[1025,"iframe-origin"],singleLine:[4,"single-line"],internalStyleOverrides:[32],tokenize:[64],validate:[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["p-64b19598",[[1,"justifi-payments-list",{accountId:[1,"account-id"],auth:[16],payments:[32]}]]],["p-24409e8e",[[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-2530278e",[[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"]}]]],["p-48bd3d00",[[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]}]]]],e)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justifi/webcomponents",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "JustiFi Web Components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/components/index.js",
|
|
@@ -72,4 +72,4 @@
|
|
|
72
72
|
"storybook": "^7.0.4"
|
|
73
73
|
},
|
|
74
74
|
"license": "MIT"
|
|
75
|
-
}
|
|
75
|
+
}
|