@justifi/webcomponents 0.2.1 → 0.3.2
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 +11 -0
- package/dist/cjs/Payment-5781460e.js +71 -0
- package/dist/cjs/{index-ca2cd154.js → index-4f2a13d2.js} +13 -389
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +3 -2
- package/dist/cjs/{justifi-billing-form.cjs.entry.js → justifi-billing-form_2.cjs.entry.js} +30 -1
- package/dist/cjs/justifi-card-form.cjs.entry.js +3 -2
- package/dist/cjs/justifi-payment-form.cjs.entry.js +46 -3
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +22 -16
- package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -70
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/select-input_2.cjs.entry.js +1 -1
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/api/Payment.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/bank-account-form/bank-account-form.js +19 -1
- package/dist/collection/components/billing-form/billing-form.js +49 -0
- package/dist/collection/components/card-form/card-form.js +19 -1
- package/dist/collection/components/card-form/card-form.stories.js +35 -28
- package/dist/collection/components/payment-form/payment-form.js +145 -7
- package/dist/collection/components/payment-form/payment-form.stories.js +82 -0
- package/dist/collection/components/payment-form/payment-method-selector.js +86 -0
- package/dist/collection/components/payment-form/tokenize.js +1 -0
- package/dist/collection/components/payment-method-form/payment-method-form.js +21 -1
- package/dist/components/Payment.js +69 -0
- package/dist/components/billing-form.js +2185 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/justifi-bank-account-form.js +3 -1
- package/dist/components/justifi-billing-form.js +1 -2175
- package/dist/components/justifi-card-form.js +3 -1
- package/dist/components/justifi-payment-form.js +85 -6
- package/dist/components/justifi-payment-method-selector.d.ts +11 -0
- package/dist/components/justifi-payment-method-selector.js +6 -0
- package/dist/components/justifi-payments-list.js +1 -68
- package/dist/components/payment-method-form.js +22 -15
- package/dist/components/payment-method-selector.js +42 -0
- package/dist/esm/Payment-3f7570a8.js +69 -0
- package/dist/esm/{index-05706eb5.js → index-3ce5521c.js} +13 -389
- package/dist/esm/justifi-bank-account-form.entry.js +3 -2
- package/dist/esm/{justifi-billing-form.entry.js → justifi-billing-form_2.entry.js} +30 -2
- package/dist/esm/justifi-card-form.entry.js +3 -2
- package/dist/esm/justifi-payment-form.entry.js +46 -3
- package/dist/esm/justifi-payment-method-form.entry.js +22 -16
- package/dist/esm/justifi-payments-list.entry.js +2 -69
- package/dist/esm/loader.js +2 -2
- package/dist/esm/select-input_2.entry.js +1 -1
- package/dist/esm/webcomponents.js +2 -2
- package/dist/types/api/Payment.d.ts +1 -1
- package/dist/types/components/bank-account-form/bank-account-form.d.ts +1 -0
- package/dist/types/components/billing-form/billing-form-schema.d.ts +7 -0
- package/dist/types/components/billing-form/billing-form.d.ts +3 -8
- package/dist/types/components/card-form/card-form.d.ts +1 -0
- package/dist/types/components/card-form/card-form.stories.d.ts +1 -0
- package/dist/types/components/payment-form/payment-form.d.ts +17 -1
- package/dist/types/components/payment-form/payment-form.stories.d.ts +44 -0
- package/dist/types/components/payment-form/payment-method-selector.d.ts +10 -0
- package/dist/types/components/payment-form/tokenize.d.ts +5 -0
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -0
- package/dist/types/components.d.ts +40 -2
- package/dist/webcomponents/p-19a76621.entry.js +1 -0
- package/dist/webcomponents/p-21e020a8.js +1 -0
- package/dist/webcomponents/p-250118e4.entry.js +1 -0
- package/dist/webcomponents/p-3536328b.entry.js +1 -0
- package/dist/webcomponents/p-6633de1b.entry.js +1 -0
- package/dist/webcomponents/p-68e47ee5.entry.js +1 -0
- package/dist/webcomponents/p-6c3a226e.entry.js +1 -0
- package/dist/webcomponents/{p-3809130a.entry.js → p-763a2b4f.entry.js} +1 -1
- package/dist/webcomponents/p-9f34a2c1.js +2 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +18 -14
- package/readme.md +1 -1
- package/dist/webcomponents/p-67be9585.entry.js +0 -1
- package/dist/webcomponents/p-787671b9.entry.js +0 -1
- package/dist/webcomponents/p-87654bf4.entry.js +0 -1
- package/dist/webcomponents/p-8ee06fd1.js +0 -2
- package/dist/webcomponents/p-94ef2d0e.entry.js +0 -1
- package/dist/webcomponents/p-c07191dc.entry.js +0 -1
- package/dist/webcomponents/p-e5b0f047.entry.js +0 -1
|
@@ -1,12 +1,55 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-3ce5521c.js';
|
|
2
|
+
import { P as PaymentMethodTypes } from './Payment-3f7570a8.js';
|
|
2
3
|
|
|
3
4
|
const PaymentForm = class {
|
|
4
5
|
constructor(hostRef) {
|
|
5
6
|
registerInstance(this, hostRef);
|
|
6
|
-
this.
|
|
7
|
+
this.bankAccount = undefined;
|
|
8
|
+
this.card = undefined;
|
|
9
|
+
this.iframeOrigin = undefined;
|
|
10
|
+
this.selectedPaymentMethodType = undefined;
|
|
11
|
+
this.allowedPaymentMethodTypes = [];
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
if (this.card) {
|
|
15
|
+
this.allowedPaymentMethodTypes.push(PaymentMethodTypes.card);
|
|
16
|
+
}
|
|
17
|
+
if (this.bankAccount) {
|
|
18
|
+
this.allowedPaymentMethodTypes.push(PaymentMethodTypes.bankAccount);
|
|
19
|
+
}
|
|
20
|
+
if (!this.allowedPaymentMethodTypes.length) {
|
|
21
|
+
this.allowedPaymentMethodTypes.push(PaymentMethodTypes.card);
|
|
22
|
+
}
|
|
23
|
+
this.selectedPaymentMethodType = this.allowedPaymentMethodTypes[0];
|
|
24
|
+
}
|
|
25
|
+
paymentMethodSelectedHandler(event) {
|
|
26
|
+
const paymentMethodType = event.detail;
|
|
27
|
+
this.selectedPaymentMethodType = paymentMethodType;
|
|
28
|
+
}
|
|
29
|
+
async fillBillingForm(fields) {
|
|
30
|
+
this.billingFormRef.fill(fields);
|
|
31
|
+
}
|
|
32
|
+
async submit(args) {
|
|
33
|
+
if (!this.paymentMethodFormRef || !this.billingFormRef)
|
|
34
|
+
return;
|
|
35
|
+
const billingFormValidation = await this.billingFormRef.validate();
|
|
36
|
+
const paymentMethodFormValidation = await this.paymentMethodFormRef.validate();
|
|
37
|
+
if (!billingFormValidation.isValid || !paymentMethodFormValidation.isValid)
|
|
38
|
+
return;
|
|
39
|
+
const billingFormFieldValues = await this.billingFormRef.getValues();
|
|
40
|
+
const paymentMethodData = Object.assign(Object.assign({}, args.paymentMethodData), billingFormFieldValues);
|
|
41
|
+
return this.paymentMethodFormRef.tokenize(args.clientId, paymentMethodData, args.accountId);
|
|
7
42
|
}
|
|
8
43
|
render() {
|
|
9
|
-
return (h(Host, null, h("form", null, h("
|
|
44
|
+
return (h(Host, null, h("form", null, (this.allowedPaymentMethodTypes.length > 1) && (h("justifi-payment-method-selector", { paymentMethodTypes: this.allowedPaymentMethodTypes, selectedPaymentMethodType: this.selectedPaymentMethodType })), h("justifi-payment-method-form", { "payment-method-form-type": this.selectedPaymentMethodType, "iframe-origin": this.iframeOrigin, ref: el => {
|
|
45
|
+
if (el) {
|
|
46
|
+
this.paymentMethodFormRef = el;
|
|
47
|
+
}
|
|
48
|
+
} }), h("justifi-billing-form", { ref: el => {
|
|
49
|
+
if (el) {
|
|
50
|
+
this.billingFormRef = el;
|
|
51
|
+
}
|
|
52
|
+
} }))));
|
|
10
53
|
}
|
|
11
54
|
};
|
|
12
55
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-3ce5521c.js';
|
|
2
2
|
|
|
3
3
|
const MessageEventType = {
|
|
4
4
|
card: {
|
|
@@ -18,7 +18,7 @@ const MessageEventType = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const name = "@justifi/webcomponents";
|
|
21
|
-
const version = "0.2
|
|
21
|
+
const version = "0.3.2";
|
|
22
22
|
const description = "JustiFi Web Components";
|
|
23
23
|
const main = "dist/index.cjs.js";
|
|
24
24
|
const module = "dist/index.js";
|
|
@@ -26,7 +26,6 @@ const es2015 = "dist/esm/index.mjs";
|
|
|
26
26
|
const es2017 = "dist/esm/index.mjs";
|
|
27
27
|
const types = "dist/types/index.d.ts";
|
|
28
28
|
const collection = "dist/collection/collection-manifest.json";
|
|
29
|
-
const unpkg = "dist/stencil-webcomponents/stencil-webcomponents.esm.js";
|
|
30
29
|
const repository = {
|
|
31
30
|
type: "git",
|
|
32
31
|
url: "git+https://github.com/justifi-tech/web-component-library.git"
|
|
@@ -47,8 +46,8 @@ const scripts = {
|
|
|
47
46
|
test: "stencil test --spec --e2e",
|
|
48
47
|
"test:watch": "stencil test --spec --e2e --watchAll",
|
|
49
48
|
generate: "stencil generate",
|
|
50
|
-
storybook: "
|
|
51
|
-
"build-storybook": "build
|
|
49
|
+
storybook: "storybook dev -p 6006 --quiet",
|
|
50
|
+
"build-storybook": "storybook build"
|
|
52
51
|
};
|
|
53
52
|
const dependencies = {
|
|
54
53
|
"@stencil/core": "^2.13.0",
|
|
@@ -59,22 +58,27 @@ const dependencies = {
|
|
|
59
58
|
yup: "^1.0.0"
|
|
60
59
|
};
|
|
61
60
|
const devDependencies = {
|
|
61
|
+
"@babel/preset-env": "^7.21.4",
|
|
62
|
+
"@babel/preset-typescript": "^7.21.4",
|
|
62
63
|
"@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
|
|
63
|
-
"@storybook/addon-actions": "^
|
|
64
|
-
"@storybook/addon-essentials": "^
|
|
65
|
-
"@storybook/addon-interactions": "^
|
|
66
|
-
"@storybook/addon-links": "^
|
|
67
|
-
"@storybook/
|
|
68
|
-
"@storybook/html": "^
|
|
69
|
-
"@storybook/
|
|
70
|
-
"@storybook/testing-library": "^0.0
|
|
64
|
+
"@storybook/addon-actions": "^7.0.4",
|
|
65
|
+
"@storybook/addon-essentials": "^7.0.4",
|
|
66
|
+
"@storybook/addon-interactions": "^7.0.4",
|
|
67
|
+
"@storybook/addon-links": "^7.0.4",
|
|
68
|
+
"@storybook/html": "^7.0.4",
|
|
69
|
+
"@storybook/html-webpack5": "^7.0.4",
|
|
70
|
+
"@storybook/jest": "^0.1.0",
|
|
71
|
+
"@storybook/testing-library": "^0.1.0",
|
|
71
72
|
"@types/jest": "^27.0.3",
|
|
72
73
|
"auto-changelog": "^2.4.0",
|
|
73
74
|
concurrently: "^7.6.0",
|
|
74
75
|
jest: "^27.4.5",
|
|
75
76
|
"jest-cli": "^27.4.5",
|
|
76
77
|
puppeteer: "^10.0.0",
|
|
77
|
-
|
|
78
|
+
react: "^18.2.0",
|
|
79
|
+
"react-dom": "^18.2.0",
|
|
80
|
+
"release-it": "^15.6.0",
|
|
81
|
+
storybook: "^7.0.4"
|
|
78
82
|
};
|
|
79
83
|
const license = "MIT";
|
|
80
84
|
const packageJson = {
|
|
@@ -88,7 +92,6 @@ const packageJson = {
|
|
|
88
92
|
types: types,
|
|
89
93
|
collection: collection,
|
|
90
94
|
"collection:main": "dist/collection/index.js",
|
|
91
|
-
unpkg: unpkg,
|
|
92
95
|
repository: repository,
|
|
93
96
|
publishConfig: publishConfig,
|
|
94
97
|
files: files,
|
|
@@ -108,6 +111,7 @@ const PaymentMethodForm = class {
|
|
|
108
111
|
this.paymentMethodFormType = undefined;
|
|
109
112
|
this.paymentMethodFormValidationStrategy = undefined;
|
|
110
113
|
this.paymentMethodStyleOverrides = undefined;
|
|
114
|
+
this.iframeOrigin = undefined;
|
|
111
115
|
this.height = 55;
|
|
112
116
|
}
|
|
113
117
|
connectedCallback() {
|
|
@@ -169,7 +173,9 @@ const PaymentMethodForm = class {
|
|
|
169
173
|
}
|
|
170
174
|
;
|
|
171
175
|
getIframeSrc() {
|
|
172
|
-
|
|
176
|
+
const productionIframeOrigin = 'https://js.justifi.ai/v2';
|
|
177
|
+
const iframeOrigin = this.iframeOrigin || productionIframeOrigin;
|
|
178
|
+
let iframeSrc = `${iframeOrigin}/${this.paymentMethodFormType}`;
|
|
173
179
|
if (this.paymentMethodFormValidationStrategy) {
|
|
174
180
|
iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
|
|
175
181
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-3ce5521c.js';
|
|
2
|
+
import { a as Payment } from './Payment-3f7570a8.js';
|
|
2
3
|
|
|
3
4
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
4
5
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
@@ -106,74 +107,6 @@ function handleError(requestUrl) {
|
|
|
106
107
|
console.error(`Error fetching from ${requestUrl}`);
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
var CaptureStrategy;
|
|
110
|
-
(function (CaptureStrategy) {
|
|
111
|
-
CaptureStrategy["automatic"] = "automatic";
|
|
112
|
-
CaptureStrategy["manual"] = "manual";
|
|
113
|
-
})(CaptureStrategy || (CaptureStrategy = {}));
|
|
114
|
-
var PaymentMethodTypes;
|
|
115
|
-
(function (PaymentMethodTypes) {
|
|
116
|
-
PaymentMethodTypes["card"] = "card";
|
|
117
|
-
PaymentMethodTypes["bankAccount"] = "bank_account";
|
|
118
|
-
})(PaymentMethodTypes || (PaymentMethodTypes = {}));
|
|
119
|
-
var PaymentStatuses;
|
|
120
|
-
(function (PaymentStatuses) {
|
|
121
|
-
PaymentStatuses["pending"] = "pending";
|
|
122
|
-
PaymentStatuses["authorized"] = "authorized";
|
|
123
|
-
PaymentStatuses["succeeded"] = "succeeded";
|
|
124
|
-
PaymentStatuses["failed"] = "failed";
|
|
125
|
-
PaymentStatuses["disputed"] = "disputed";
|
|
126
|
-
PaymentStatuses["fully_refunded"] = "fully_refunded";
|
|
127
|
-
PaymentStatuses["partially_refunded"] = "partially_refunded";
|
|
128
|
-
})(PaymentStatuses || (PaymentStatuses = {}));
|
|
129
|
-
var PaymentDisputedStatuses;
|
|
130
|
-
(function (PaymentDisputedStatuses) {
|
|
131
|
-
// if a dispute is 'won', we don't show a dispute status, just general status
|
|
132
|
-
PaymentDisputedStatuses["lost"] = "lost";
|
|
133
|
-
PaymentDisputedStatuses["open"] = "open";
|
|
134
|
-
})(PaymentDisputedStatuses || (PaymentDisputedStatuses = {}));
|
|
135
|
-
class Payment {
|
|
136
|
-
constructor(payment) {
|
|
137
|
-
this.id = payment.id;
|
|
138
|
-
this.account_id = payment.account_id;
|
|
139
|
-
this.amount = payment.amount;
|
|
140
|
-
this.amount_disputed = payment.amount_disputed;
|
|
141
|
-
this.amount_refundable = payment.amount_refundable;
|
|
142
|
-
this.amount_refunded = payment.amount_refunded;
|
|
143
|
-
this.balance = payment.balance;
|
|
144
|
-
this.captured = payment.captured;
|
|
145
|
-
this.capture_strategy = payment.capture_strategy;
|
|
146
|
-
this.currency = payment.currency;
|
|
147
|
-
this.description = payment.description;
|
|
148
|
-
this.disputed = payment.disputed;
|
|
149
|
-
this.disputes = payment.disputes;
|
|
150
|
-
this.error_code = payment.error_code;
|
|
151
|
-
this.error_description = payment.error_description;
|
|
152
|
-
this.fee_amount = payment.fee_amount;
|
|
153
|
-
this.is_test = payment.is_test;
|
|
154
|
-
this.metadata = payment.metadata;
|
|
155
|
-
this.payment_method = payment.payment_method;
|
|
156
|
-
this.payment_intent_id = payment.payment_intent_id;
|
|
157
|
-
this.refunded = payment.refunded;
|
|
158
|
-
this.status = payment.status;
|
|
159
|
-
this.created_at = payment.created_at;
|
|
160
|
-
this.updated_at = payment.updated_at;
|
|
161
|
-
}
|
|
162
|
-
get disputedStatus() {
|
|
163
|
-
const lost = this.disputes.some((dispute) => dispute.status === PaymentDisputedStatuses.lost);
|
|
164
|
-
// if a dispute is 'won', we don't show a dispute status, just general status
|
|
165
|
-
if (!this.disputed) {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
else if (lost) {
|
|
169
|
-
return PaymentDisputedStatuses.lost;
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
return PaymentDisputedStatuses.open;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
110
|
function toInteger(dirtyNumber) {
|
|
178
111
|
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
179
112
|
return NaN;
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-3ce5521c.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["justifi-
|
|
13
|
+
return bootstrapLazy([["justifi-payment-form",[[0,"justifi-payment-form",{"bankAccount":[4,"bank-account"],"card":[4],"iframeOrigin":[1,"iframe-origin"],"selectedPaymentMethodType":[32],"allowedPaymentMethodTypes":[32],"fillBillingForm":[64],"submit":[64]},[[0,"paymentMethodSelected","paymentMethodSelectedHandler"]]]]],["justifi-bank-account-form",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payments-list",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2",[[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]}]]],["justifi-billing-form_2",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"fill":[64],"validate":[64],"getValues":[64]},[[0,"fieldReceivedInput","setFormValue"]]],[0,"justifi-payment-method-selector",{"paymentMethodTypes":[16],"selectedPaymentMethodType":[1,"selected-payment-method-type"]}]]],["justifi-payment-method-form",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"iframeOrigin":[1,"iframe-origin"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-3ce5521c.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["justifi-
|
|
16
|
+
return bootstrapLazy([["justifi-payment-form",[[0,"justifi-payment-form",{"bankAccount":[4,"bank-account"],"card":[4],"iframeOrigin":[1,"iframe-origin"],"selectedPaymentMethodType":[32],"allowedPaymentMethodTypes":[32],"fillBillingForm":[64],"submit":[64]},[[0,"paymentMethodSelected","paymentMethodSelectedHandler"]]]]],["justifi-bank-account-form",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payments-list",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2",[[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]}]]],["justifi-billing-form_2",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"fill":[64],"validate":[64],"getValues":[64]},[[0,"fieldReceivedInput","setFormValue"]]],[0,"justifi-payment-method-selector",{"paymentMethodTypes":[16],"selectedPaymentMethodType":[1,"selected-payment-method-type"]}]]],["justifi-payment-method-form",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"iframeOrigin":[1,"iframe-origin"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
|
|
17
17
|
});
|
|
@@ -3,6 +3,7 @@ import { Theme } from '../payment-method-form/theme';
|
|
|
3
3
|
export declare class BankAccountForm {
|
|
4
4
|
validationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
5
5
|
styleOverrides?: string;
|
|
6
|
+
iframeOrigin?: string;
|
|
6
7
|
internalStyleOverrides: Theme;
|
|
7
8
|
bankAccountFormReady: EventEmitter;
|
|
8
9
|
bankAccountFormTokenize: EventEmitter<{
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export declare const RegExZip: RegExp;
|
|
2
|
+
export interface BillingFormFields {
|
|
3
|
+
address_line1: string;
|
|
4
|
+
address_line2?: string;
|
|
5
|
+
address_city: string;
|
|
6
|
+
address_state: string;
|
|
7
|
+
address_postal_code: string;
|
|
8
|
+
}
|
|
2
9
|
declare const BillingFormSchema: import("yup").ObjectSchema<{
|
|
3
10
|
address_line1: string;
|
|
4
11
|
address_line2: string;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
address_line1: string;
|
|
3
|
-
address_line2?: string;
|
|
4
|
-
address_city: string;
|
|
5
|
-
address_state: string;
|
|
6
|
-
address_postal_code: string;
|
|
7
|
-
}
|
|
1
|
+
import { BillingFormFields } from './billing-form-schema';
|
|
8
2
|
export declare class BillingForm {
|
|
9
3
|
billingFields: BillingFormFields;
|
|
10
4
|
billingFieldsErrors: any;
|
|
11
5
|
setFormValue(event: any): void;
|
|
6
|
+
fill(fields: BillingFormFields): Promise<void>;
|
|
12
7
|
validate(): Promise<{
|
|
13
8
|
isValid: boolean;
|
|
14
9
|
}>;
|
|
10
|
+
getValues(): Promise<BillingFormFields>;
|
|
15
11
|
render(): any;
|
|
16
12
|
}
|
|
17
|
-
export {};
|
|
@@ -3,6 +3,7 @@ import { Theme } from '../payment-method-form/theme';
|
|
|
3
3
|
export declare class CardForm {
|
|
4
4
|
validationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
5
5
|
styleOverrides?: string;
|
|
6
|
+
iframeOrigin?: string;
|
|
6
7
|
internalStyleOverrides: Theme;
|
|
7
8
|
cardFormReady: EventEmitter;
|
|
8
9
|
cardFormTokenize: EventEmitter<{
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { PaymentMethodTypes } from '../../api';
|
|
2
|
+
import { BillingFormFields } from '../billing-form/billing-form-schema';
|
|
1
3
|
export declare class PaymentForm {
|
|
2
|
-
|
|
4
|
+
bankAccount?: boolean;
|
|
5
|
+
card?: boolean;
|
|
6
|
+
iframeOrigin?: string;
|
|
7
|
+
selectedPaymentMethodType: PaymentMethodTypes;
|
|
8
|
+
allowedPaymentMethodTypes: PaymentMethodTypes[];
|
|
9
|
+
private paymentMethodFormRef?;
|
|
10
|
+
private billingFormRef?;
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
paymentMethodSelectedHandler(event: CustomEvent): void;
|
|
13
|
+
fillBillingForm(fields: BillingFormFields): Promise<void>;
|
|
14
|
+
submit(args: {
|
|
15
|
+
clientId: string;
|
|
16
|
+
paymentMethodData: any;
|
|
17
|
+
accountId?: string;
|
|
18
|
+
}): Promise<any>;
|
|
3
19
|
render(): any;
|
|
4
20
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
component: string;
|
|
4
|
+
argTypes: {
|
|
5
|
+
'bank-account': {
|
|
6
|
+
control: string;
|
|
7
|
+
table: {
|
|
8
|
+
category: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
card: {
|
|
12
|
+
control: string;
|
|
13
|
+
table: {
|
|
14
|
+
category: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
accountId: {
|
|
18
|
+
control: string;
|
|
19
|
+
table: {
|
|
20
|
+
category: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
clientId: {
|
|
24
|
+
control: string;
|
|
25
|
+
table: {
|
|
26
|
+
category: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
paymentMethodData: {
|
|
30
|
+
control: string;
|
|
31
|
+
table: {
|
|
32
|
+
category: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
parameters: {
|
|
37
|
+
actions: {
|
|
38
|
+
handles: any[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
decorators: ((story: any) => any)[];
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
44
|
+
export declare const Basic: any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { PaymentMethodTypes } from '../../api';
|
|
3
|
+
export declare class PaymentMethodSelector {
|
|
4
|
+
paymentMethodTypes: PaymentMethodTypes[];
|
|
5
|
+
selectedPaymentMethodType: PaymentMethodTypes;
|
|
6
|
+
paymentMethodSelected: EventEmitter;
|
|
7
|
+
defaultRadioButtonOption: HTMLInputElement;
|
|
8
|
+
onChangeHandler(event: any): void;
|
|
9
|
+
render(): any;
|
|
10
|
+
}
|
|
@@ -4,6 +4,7 @@ export declare class PaymentMethodForm {
|
|
|
4
4
|
paymentMethodFormType: 'card' | 'bankAccount';
|
|
5
5
|
paymentMethodFormValidationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
6
6
|
paymentMethodStyleOverrides: Theme | undefined;
|
|
7
|
+
iframeOrigin?: string;
|
|
7
8
|
paymentMethodFormReady: EventEmitter;
|
|
8
9
|
paymentMethodFormTokenize: EventEmitter<{
|
|
9
10
|
data: any;
|
|
@@ -5,34 +5,49 @@
|
|
|
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 { BillingFormFields } from "./components/billing-form/billing-form-schema";
|
|
8
9
|
import { ValidationError } from "yup";
|
|
9
10
|
import { Theme } from "./components/payment-method-form/theme";
|
|
11
|
+
import { PaymentMethodTypes } from "./api";
|
|
10
12
|
export namespace Components {
|
|
11
13
|
interface JustifiBankAccountForm {
|
|
14
|
+
"iframeOrigin"?: string;
|
|
12
15
|
"styleOverrides"?: string;
|
|
13
16
|
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
|
|
14
17
|
"validate": () => Promise<any>;
|
|
15
18
|
"validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
16
19
|
}
|
|
17
20
|
interface JustifiBillingForm {
|
|
21
|
+
"fill": (fields: BillingFormFields) => Promise<void>;
|
|
22
|
+
"getValues": () => Promise<BillingFormFields>;
|
|
18
23
|
"validate": () => Promise<{ isValid: boolean; }>;
|
|
19
24
|
}
|
|
20
25
|
interface JustifiCardForm {
|
|
26
|
+
"iframeOrigin"?: string;
|
|
21
27
|
"styleOverrides"?: string;
|
|
22
28
|
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
|
|
23
29
|
"validate": () => Promise<any>;
|
|
24
30
|
"validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
25
31
|
}
|
|
26
32
|
interface JustifiPaymentForm {
|
|
27
|
-
"
|
|
33
|
+
"bankAccount"?: boolean;
|
|
34
|
+
"card"?: boolean;
|
|
35
|
+
"fillBillingForm": (fields: BillingFormFields) => Promise<void>;
|
|
36
|
+
"iframeOrigin"?: string;
|
|
37
|
+
"submit": (args: { clientId: string; paymentMethodData: any; accountId?: string; }) => Promise<any>;
|
|
28
38
|
}
|
|
29
39
|
interface JustifiPaymentMethodForm {
|
|
40
|
+
"iframeOrigin"?: string;
|
|
30
41
|
"paymentMethodFormType": 'card' | 'bankAccount';
|
|
31
42
|
"paymentMethodFormValidationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
32
43
|
"paymentMethodStyleOverrides": Theme | undefined;
|
|
33
44
|
"tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
|
|
34
45
|
"validate": () => Promise<any>;
|
|
35
46
|
}
|
|
47
|
+
interface JustifiPaymentMethodSelector {
|
|
48
|
+
"paymentMethodTypes": PaymentMethodTypes[];
|
|
49
|
+
"selectedPaymentMethodType": PaymentMethodTypes;
|
|
50
|
+
}
|
|
36
51
|
interface JustifiPaymentsList {
|
|
37
52
|
"accountId": string;
|
|
38
53
|
"auth": { token?: string };
|
|
@@ -63,6 +78,10 @@ export interface JustifiPaymentMethodFormCustomEvent<T> extends CustomEvent<T> {
|
|
|
63
78
|
detail: T;
|
|
64
79
|
target: HTMLJustifiPaymentMethodFormElement;
|
|
65
80
|
}
|
|
81
|
+
export interface JustifiPaymentMethodSelectorCustomEvent<T> extends CustomEvent<T> {
|
|
82
|
+
detail: T;
|
|
83
|
+
target: HTMLJustifiPaymentMethodSelectorElement;
|
|
84
|
+
}
|
|
66
85
|
export interface SelectInputCustomEvent<T> extends CustomEvent<T> {
|
|
67
86
|
detail: T;
|
|
68
87
|
target: HTMLSelectInputElement;
|
|
@@ -102,6 +121,12 @@ declare global {
|
|
|
102
121
|
prototype: HTMLJustifiPaymentMethodFormElement;
|
|
103
122
|
new (): HTMLJustifiPaymentMethodFormElement;
|
|
104
123
|
};
|
|
124
|
+
interface HTMLJustifiPaymentMethodSelectorElement extends Components.JustifiPaymentMethodSelector, HTMLStencilElement {
|
|
125
|
+
}
|
|
126
|
+
var HTMLJustifiPaymentMethodSelectorElement: {
|
|
127
|
+
prototype: HTMLJustifiPaymentMethodSelectorElement;
|
|
128
|
+
new (): HTMLJustifiPaymentMethodSelectorElement;
|
|
129
|
+
};
|
|
105
130
|
interface HTMLJustifiPaymentsListElement extends Components.JustifiPaymentsList, HTMLStencilElement {
|
|
106
131
|
}
|
|
107
132
|
var HTMLJustifiPaymentsListElement: {
|
|
@@ -126,6 +151,7 @@ declare global {
|
|
|
126
151
|
"justifi-card-form": HTMLJustifiCardFormElement;
|
|
127
152
|
"justifi-payment-form": HTMLJustifiPaymentFormElement;
|
|
128
153
|
"justifi-payment-method-form": HTMLJustifiPaymentMethodFormElement;
|
|
154
|
+
"justifi-payment-method-selector": HTMLJustifiPaymentMethodSelectorElement;
|
|
129
155
|
"justifi-payments-list": HTMLJustifiPaymentsListElement;
|
|
130
156
|
"select-input": HTMLSelectInputElement;
|
|
131
157
|
"text-input": HTMLTextInputElement;
|
|
@@ -133,6 +159,7 @@ declare global {
|
|
|
133
159
|
}
|
|
134
160
|
declare namespace LocalJSX {
|
|
135
161
|
interface JustifiBankAccountForm {
|
|
162
|
+
"iframeOrigin"?: string;
|
|
136
163
|
"onBankAccountFormReady"?: (event: JustifiBankAccountFormCustomEvent<any>) => void;
|
|
137
164
|
"onBankAccountFormTokenize"?: (event: JustifiBankAccountFormCustomEvent<{ data: any }>) => void;
|
|
138
165
|
"onBankAccountFormValidate"?: (event: JustifiBankAccountFormCustomEvent<{ data: { isValid: boolean } }>) => void;
|
|
@@ -142,6 +169,7 @@ declare namespace LocalJSX {
|
|
|
142
169
|
interface JustifiBillingForm {
|
|
143
170
|
}
|
|
144
171
|
interface JustifiCardForm {
|
|
172
|
+
"iframeOrigin"?: string;
|
|
145
173
|
"onCardFormReady"?: (event: JustifiCardFormCustomEvent<any>) => void;
|
|
146
174
|
"onCardFormTokenize"?: (event: JustifiCardFormCustomEvent<{ data: any }>) => void;
|
|
147
175
|
"onCardFormValidate"?: (event: JustifiCardFormCustomEvent<{ data: { isValid: boolean } }>) => void;
|
|
@@ -149,15 +177,23 @@ declare namespace LocalJSX {
|
|
|
149
177
|
"validationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
150
178
|
}
|
|
151
179
|
interface JustifiPaymentForm {
|
|
152
|
-
"
|
|
180
|
+
"bankAccount"?: boolean;
|
|
181
|
+
"card"?: boolean;
|
|
182
|
+
"iframeOrigin"?: string;
|
|
153
183
|
}
|
|
154
184
|
interface JustifiPaymentMethodForm {
|
|
185
|
+
"iframeOrigin"?: string;
|
|
155
186
|
"onPaymentMethodFormReady"?: (event: JustifiPaymentMethodFormCustomEvent<any>) => void;
|
|
156
187
|
"onPaymentMethodFormTokenize"?: (event: JustifiPaymentMethodFormCustomEvent<{ data: any }>) => void;
|
|
157
188
|
"paymentMethodFormType"?: 'card' | 'bankAccount';
|
|
158
189
|
"paymentMethodFormValidationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
159
190
|
"paymentMethodStyleOverrides"?: Theme | undefined;
|
|
160
191
|
}
|
|
192
|
+
interface JustifiPaymentMethodSelector {
|
|
193
|
+
"onPaymentMethodSelected"?: (event: JustifiPaymentMethodSelectorCustomEvent<any>) => void;
|
|
194
|
+
"paymentMethodTypes"?: PaymentMethodTypes[];
|
|
195
|
+
"selectedPaymentMethodType"?: PaymentMethodTypes;
|
|
196
|
+
}
|
|
161
197
|
interface JustifiPaymentsList {
|
|
162
198
|
"accountId"?: string;
|
|
163
199
|
"auth"?: { token?: string };
|
|
@@ -183,6 +219,7 @@ declare namespace LocalJSX {
|
|
|
183
219
|
"justifi-card-form": JustifiCardForm;
|
|
184
220
|
"justifi-payment-form": JustifiPaymentForm;
|
|
185
221
|
"justifi-payment-method-form": JustifiPaymentMethodForm;
|
|
222
|
+
"justifi-payment-method-selector": JustifiPaymentMethodSelector;
|
|
186
223
|
"justifi-payments-list": JustifiPaymentsList;
|
|
187
224
|
"select-input": SelectInput;
|
|
188
225
|
"text-input": TextInput;
|
|
@@ -197,6 +234,7 @@ declare module "@stencil/core" {
|
|
|
197
234
|
"justifi-card-form": LocalJSX.JustifiCardForm & JSXBase.HTMLAttributes<HTMLJustifiCardFormElement>;
|
|
198
235
|
"justifi-payment-form": LocalJSX.JustifiPaymentForm & JSXBase.HTMLAttributes<HTMLJustifiPaymentFormElement>;
|
|
199
236
|
"justifi-payment-method-form": LocalJSX.JustifiPaymentMethodForm & JSXBase.HTMLAttributes<HTMLJustifiPaymentMethodFormElement>;
|
|
237
|
+
"justifi-payment-method-selector": LocalJSX.JustifiPaymentMethodSelector & JSXBase.HTMLAttributes<HTMLJustifiPaymentMethodSelectorElement>;
|
|
200
238
|
"justifi-payments-list": LocalJSX.JustifiPaymentsList & JSXBase.HTMLAttributes<HTMLJustifiPaymentsListElement>;
|
|
201
239
|
"select-input": LocalJSX.SelectInput & JSXBase.HTMLAttributes<HTMLSelectInputElement>;
|
|
202
240
|
"text-input": LocalJSX.TextInput & JSXBase.HTMLAttributes<HTMLTextInputElement>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,H as s}from"./p-9f34a2c1.js";import{P as e}from"./p-21e020a8.js";const h=class{constructor(i){t(this,i),this.bankAccount=void 0,this.card=void 0,this.iframeOrigin=void 0,this.selectedPaymentMethodType=void 0,this.allowedPaymentMethodTypes=[]}connectedCallback(){this.card&&this.allowedPaymentMethodTypes.push(e.card),this.bankAccount&&this.allowedPaymentMethodTypes.push(e.bankAccount),this.allowedPaymentMethodTypes.length||this.allowedPaymentMethodTypes.push(e.card),this.selectedPaymentMethodType=this.allowedPaymentMethodTypes[0]}paymentMethodSelectedHandler(t){this.selectedPaymentMethodType=t.detail}async fillBillingForm(t){this.billingFormRef.fill(t)}async submit(t){if(!this.paymentMethodFormRef||!this.billingFormRef)return;const i=await this.billingFormRef.validate(),s=await this.paymentMethodFormRef.validate();if(!i.isValid||!s.isValid)return;const e=await this.billingFormRef.getValues(),h=Object.assign(Object.assign({},t.paymentMethodData),e);return this.paymentMethodFormRef.tokenize(t.clientId,h,t.accountId)}render(){return i(s,null,i("form",null,this.allowedPaymentMethodTypes.length>1&&i("justifi-payment-method-selector",{paymentMethodTypes:this.allowedPaymentMethodTypes,selectedPaymentMethodType:this.selectedPaymentMethodType}),i("justifi-payment-method-form",{"payment-method-form-type":this.selectedPaymentMethodType,"iframe-origin":this.iframeOrigin,ref:t=>{t&&(this.paymentMethodFormRef=t)}}),i("justifi-billing-form",{ref:t=>{t&&(this.billingFormRef=t)}})))}};export{h as justifi_payment_form}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t,i,s,h;!function(t){t.automatic="automatic",t.manual="manual"}(t||(t={})),function(t){t.card="card",t.bankAccount="bankAccount"}(i||(i={})),function(t){t.pending="pending",t.authorized="authorized",t.succeeded="succeeded",t.failed="failed",t.disputed="disputed",t.fully_refunded="fully_refunded",t.partially_refunded="partially_refunded"}(s||(s={})),function(t){t.lost="lost",t.open="open"}(h||(h={}));class n{constructor(t){this.id=t.id,this.account_id=t.account_id,this.amount=t.amount,this.amount_disputed=t.amount_disputed,this.amount_refundable=t.amount_refundable,this.amount_refunded=t.amount_refunded,this.balance=t.balance,this.captured=t.captured,this.capture_strategy=t.capture_strategy,this.currency=t.currency,this.description=t.description,this.disputed=t.disputed,this.disputes=t.disputes,this.error_code=t.error_code,this.error_description=t.error_description,this.fee_amount=t.fee_amount,this.is_test=t.is_test,this.metadata=t.metadata,this.payment_method=t.payment_method,this.payment_intent_id=t.payment_intent_id,this.refunded=t.refunded,this.status=t.status,this.created_at=t.created_at,this.updated_at=t.updated_at}get disputedStatus(){const t=this.disputes.some((t=>t.status===h.lost));return this.disputed?t?h.lost:h.open:null}}export{i as P,n as a}
|