@justifi/webcomponents 0.0.15 → 0.2.1
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 +45 -0
- package/changelog-template.hbs +41 -0
- package/dist/cjs/{index-e1b45289.js → index-ca2cd154.js} +456 -97
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +59 -0
- package/dist/cjs/justifi-billing-form.cjs.entry.js +2150 -0
- package/dist/cjs/justifi-card-form.cjs.entry.js +59 -0
- package/dist/cjs/justifi-payment-form.cjs.entry.js +17 -0
- package/dist/cjs/{justifi-bank-account-form_3.cjs.entry.js → justifi-payment-method-form.cjs.entry.js} +86 -110
- package/dist/cjs/justifi-payments-list.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/select-input_2.cjs.entry.js +59 -0
- package/dist/cjs/webcomponents.cjs.js +3 -7
- package/dist/collection/collection-manifest.json +7 -3
- package/dist/collection/components/bank-account-form/bank-account-form.js +1 -1
- package/dist/collection/components/billing-form/billing-form-schema.js +14 -0
- package/dist/collection/components/billing-form/billing-form.css +11 -0
- package/dist/collection/components/billing-form/billing-form.js +92 -0
- package/dist/collection/components/billing-form/state-options.js +243 -0
- package/dist/collection/components/card-form/card-form.js +1 -1
- package/dist/collection/components/card-form/card-form.stories.js +132 -0
- package/dist/collection/components/payment-form/payment-form.js +31 -0
- package/dist/collection/components/payment-method-form/payment-method-form.js +6 -4
- package/dist/collection/components/select-input/select-input.css +7 -0
- package/dist/collection/components/select-input/select-input.js +144 -0
- package/dist/collection/components/text-input/text-input.css +7 -0
- package/dist/collection/components/text-input/text-input.js +126 -0
- package/dist/components/index.d.ts +4 -9
- package/dist/components/index.js +5 -1
- package/dist/components/justifi-billing-form.d.ts +11 -0
- package/dist/components/justifi-billing-form.js +2180 -0
- package/dist/components/justifi-payment-form.d.ts +11 -0
- package/dist/components/justifi-payment-form.js +32 -0
- package/dist/components/payment-method-form.js +85 -3
- package/dist/components/select-input.d.ts +11 -0
- package/dist/components/select-input.js +6 -0
- package/dist/components/select-input2.js +52 -0
- package/dist/components/text-input.d.ts +11 -0
- package/dist/components/text-input.js +6 -0
- package/dist/components/text-input2.js +48 -0
- package/dist/esm/{index-c1f569bd.js → index-05706eb5.js} +457 -97
- package/dist/esm/justifi-bank-account-form.entry.js +55 -0
- package/dist/esm/justifi-billing-form.entry.js +2146 -0
- package/dist/esm/justifi-card-form.entry.js +55 -0
- package/dist/esm/justifi-payment-form.entry.js +13 -0
- package/dist/esm/justifi-payment-method-form.entry.js +187 -0
- package/dist/esm/justifi-payments-list.entry.js +1 -1
- package/dist/esm/loader.js +3 -4
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/select-input_2.entry.js +54 -0
- package/dist/esm/webcomponents.js +3 -4
- package/dist/types/api/Api.d.ts +1 -1
- package/dist/types/api/Payment.d.ts +1 -1
- package/dist/types/components/billing-form/billing-form-schema.d.ts +15 -0
- package/dist/types/components/billing-form/billing-form.d.ts +17 -0
- package/dist/types/components/billing-form/state-options.d.ts +5 -0
- package/dist/types/components/card-form/card-form.stories.d.ts +14 -0
- package/dist/types/components/payment-form/payment-form.d.ts +4 -0
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -1
- package/dist/types/components/payment-method-form/theme.d.ts +3 -1
- package/dist/types/components/select-input/select-input.d.ts +18 -0
- package/dist/types/components/text-input/text-input.d.ts +14 -0
- package/dist/types/components.d.ts +87 -3
- package/dist/types/stencil-public-runtime.d.ts +3 -59
- package/dist/webcomponents/p-3809130a.entry.js +1 -0
- package/dist/webcomponents/p-67be9585.entry.js +1 -0
- package/dist/webcomponents/p-787671b9.entry.js +1 -0
- package/dist/webcomponents/p-87654bf4.entry.js +1 -0
- package/dist/webcomponents/p-8ee06fd1.js +2 -0
- package/dist/webcomponents/p-94ef2d0e.entry.js +1 -0
- package/dist/webcomponents/p-c07191dc.entry.js +1 -0
- package/dist/webcomponents/p-e5b0f047.entry.js +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/loader/index.d.ts +0 -9
- package/package.json +23 -5
- package/LICENSE +0 -21
- package/dist/esm/justifi-bank-account-form_3.entry.js +0 -209
- package/dist/webcomponents/p-1de39730.js +0 -2
- package/dist/webcomponents/p-f0eb5ed0.entry.js +0 -1
- package/dist/webcomponents/p-f91b7b05.entry.js +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-ca2cd154.js');
|
|
6
|
+
|
|
7
|
+
const CardForm = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.cardFormReady = index.createEvent(this, "cardFormReady", 7);
|
|
11
|
+
this.cardFormTokenize = index.createEvent(this, "cardFormTokenize", 7);
|
|
12
|
+
this.cardFormValidate = index.createEvent(this, "cardFormValidate", 7);
|
|
13
|
+
this.validationStrategy = undefined;
|
|
14
|
+
this.styleOverrides = undefined;
|
|
15
|
+
this.internalStyleOverrides = undefined;
|
|
16
|
+
}
|
|
17
|
+
readyHandler(event) {
|
|
18
|
+
this.cardFormReady.emit(event);
|
|
19
|
+
}
|
|
20
|
+
tokenizeHandler(event) {
|
|
21
|
+
this.cardFormTokenize.emit(event);
|
|
22
|
+
}
|
|
23
|
+
validateHandler(event) {
|
|
24
|
+
this.cardFormValidate.emit(event);
|
|
25
|
+
}
|
|
26
|
+
componentWillLoad() {
|
|
27
|
+
this.parseStyleOverrides();
|
|
28
|
+
}
|
|
29
|
+
parseStyleOverrides() {
|
|
30
|
+
if (this.styleOverrides) {
|
|
31
|
+
const parsedStyleOverrides = JSON.parse(this.styleOverrides);
|
|
32
|
+
this.internalStyleOverrides = parsedStyleOverrides;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async tokenize(...args) {
|
|
36
|
+
if (!this.childRef) {
|
|
37
|
+
throw new Error('Cannot call tokenize');
|
|
38
|
+
}
|
|
39
|
+
return this.childRef.tokenize(...args);
|
|
40
|
+
}
|
|
41
|
+
async validate() {
|
|
42
|
+
if (!this.childRef) {
|
|
43
|
+
throw new Error('Cannot call validate');
|
|
44
|
+
}
|
|
45
|
+
return this.childRef.validate();
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
return (index.h("justifi-payment-method-form", { ref: el => {
|
|
49
|
+
if (el) {
|
|
50
|
+
this.childRef = el;
|
|
51
|
+
}
|
|
52
|
+
}, "payment-method-form-type": "card", "payment-method-form-ready": this.cardFormReady, "payment-method-form-tokenize": this.cardFormTokenize, "payment-method-form-validation-strategy": this.validationStrategy || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
|
|
53
|
+
}
|
|
54
|
+
static get watchers() { return {
|
|
55
|
+
"styleOverrides": ["parseStyleOverrides"]
|
|
56
|
+
}; }
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.justifi_card_form = CardForm;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-ca2cd154.js');
|
|
6
|
+
|
|
7
|
+
const PaymentForm = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
this.validationStrategy = undefined;
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
return (index.h(index.Host, null, index.h("form", null, index.h("slot", null))));
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.justifi_payment_form = PaymentForm;
|
|
@@ -2,111 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
|
|
7
|
-
const BankAccountForm = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
index.registerInstance(this, hostRef);
|
|
10
|
-
this.bankAccountFormReady = index.createEvent(this, "bankAccountFormReady", 7);
|
|
11
|
-
this.bankAccountFormTokenize = index.createEvent(this, "bankAccountFormTokenize", 7);
|
|
12
|
-
this.bankAccountFormValidate = index.createEvent(this, "bankAccountFormValidate", 7);
|
|
13
|
-
this.validationStrategy = undefined;
|
|
14
|
-
this.styleOverrides = undefined;
|
|
15
|
-
this.internalStyleOverrides = undefined;
|
|
16
|
-
}
|
|
17
|
-
readyHandler(event) {
|
|
18
|
-
this.bankAccountFormReady.emit(event);
|
|
19
|
-
}
|
|
20
|
-
tokenizeHandler(event) {
|
|
21
|
-
this.bankAccountFormTokenize.emit(event);
|
|
22
|
-
}
|
|
23
|
-
validateHandler(event) {
|
|
24
|
-
this.bankAccountFormValidate.emit(event);
|
|
25
|
-
}
|
|
26
|
-
componentWillLoad() {
|
|
27
|
-
this.parseStyleOverrides();
|
|
28
|
-
}
|
|
29
|
-
parseStyleOverrides() {
|
|
30
|
-
if (this.styleOverrides) {
|
|
31
|
-
const parsedStyleOverrides = JSON.parse(this.styleOverrides);
|
|
32
|
-
this.internalStyleOverrides = parsedStyleOverrides;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async tokenize(...args) {
|
|
36
|
-
if (!this.childRef) {
|
|
37
|
-
throw new Error('Cannot call tokenize');
|
|
38
|
-
}
|
|
39
|
-
return this.childRef.tokenize(...args);
|
|
40
|
-
}
|
|
41
|
-
async validate() {
|
|
42
|
-
if (!this.childRef) {
|
|
43
|
-
throw new Error('Cannot call validate');
|
|
44
|
-
}
|
|
45
|
-
return this.childRef.validate();
|
|
46
|
-
}
|
|
47
|
-
render() {
|
|
48
|
-
return (index.h("justifi-payment-method-form", { ref: el => {
|
|
49
|
-
if (el) {
|
|
50
|
-
this.childRef = el;
|
|
51
|
-
}
|
|
52
|
-
}, "payment-method-form-type": "bankAccount", "payment-method-form-ready": this.bankAccountFormReady, "payment-method-form-tokenize": this.bankAccountFormTokenize, "payment-method-form-validation-strategy": this.validationStrategy || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
|
|
53
|
-
}
|
|
54
|
-
static get watchers() { return {
|
|
55
|
-
"styleOverrides": ["parseStyleOverrides"]
|
|
56
|
-
}; }
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const CardForm = class {
|
|
60
|
-
constructor(hostRef) {
|
|
61
|
-
index.registerInstance(this, hostRef);
|
|
62
|
-
this.cardFormReady = index.createEvent(this, "cardFormReady", 7);
|
|
63
|
-
this.cardFormTokenize = index.createEvent(this, "cardFormTokenize", 7);
|
|
64
|
-
this.cardFormValidate = index.createEvent(this, "cardFormValidate", 7);
|
|
65
|
-
this.validationStrategy = undefined;
|
|
66
|
-
this.styleOverrides = undefined;
|
|
67
|
-
this.internalStyleOverrides = undefined;
|
|
68
|
-
}
|
|
69
|
-
readyHandler(event) {
|
|
70
|
-
this.cardFormReady.emit(event);
|
|
71
|
-
}
|
|
72
|
-
tokenizeHandler(event) {
|
|
73
|
-
this.cardFormTokenize.emit(event);
|
|
74
|
-
}
|
|
75
|
-
validateHandler(event) {
|
|
76
|
-
this.cardFormValidate.emit(event);
|
|
77
|
-
}
|
|
78
|
-
componentWillLoad() {
|
|
79
|
-
this.parseStyleOverrides();
|
|
80
|
-
}
|
|
81
|
-
parseStyleOverrides() {
|
|
82
|
-
if (this.styleOverrides) {
|
|
83
|
-
const parsedStyleOverrides = JSON.parse(this.styleOverrides);
|
|
84
|
-
this.internalStyleOverrides = parsedStyleOverrides;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async tokenize(...args) {
|
|
88
|
-
if (!this.childRef) {
|
|
89
|
-
throw new Error('Cannot call tokenize');
|
|
90
|
-
}
|
|
91
|
-
return this.childRef.tokenize(...args);
|
|
92
|
-
}
|
|
93
|
-
async validate() {
|
|
94
|
-
if (!this.childRef) {
|
|
95
|
-
throw new Error('Cannot call validate');
|
|
96
|
-
}
|
|
97
|
-
return this.childRef.validate();
|
|
98
|
-
}
|
|
99
|
-
render() {
|
|
100
|
-
return (index.h("justifi-payment-method-form", { ref: el => {
|
|
101
|
-
if (el) {
|
|
102
|
-
this.childRef = el;
|
|
103
|
-
}
|
|
104
|
-
}, "payment-method-form-type": "card", "payment-method-form-ready": this.cardFormReady, "payment-method-form-tokenize": this.cardFormTokenize, "payment-method-form-validation-strategy": this.validationStrategy || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
|
|
105
|
-
}
|
|
106
|
-
static get watchers() { return {
|
|
107
|
-
"styleOverrides": ["parseStyleOverrides"]
|
|
108
|
-
}; }
|
|
109
|
-
};
|
|
5
|
+
const index = require('./index-ca2cd154.js');
|
|
110
6
|
|
|
111
7
|
const MessageEventType = {
|
|
112
8
|
card: {
|
|
@@ -125,6 +21,87 @@ const MessageEventType = {
|
|
|
125
21
|
}
|
|
126
22
|
};
|
|
127
23
|
|
|
24
|
+
const name = "@justifi/webcomponents";
|
|
25
|
+
const version = "0.2.1";
|
|
26
|
+
const description = "JustiFi Web Components";
|
|
27
|
+
const main = "dist/index.cjs.js";
|
|
28
|
+
const module$1 = "dist/index.js";
|
|
29
|
+
const es2015 = "dist/esm/index.mjs";
|
|
30
|
+
const es2017 = "dist/esm/index.mjs";
|
|
31
|
+
const types = "dist/types/index.d.ts";
|
|
32
|
+
const collection = "dist/collection/collection-manifest.json";
|
|
33
|
+
const unpkg = "dist/stencil-webcomponents/stencil-webcomponents.esm.js";
|
|
34
|
+
const repository = {
|
|
35
|
+
type: "git",
|
|
36
|
+
url: "git+https://github.com/justifi-tech/web-component-library.git"
|
|
37
|
+
};
|
|
38
|
+
const publishConfig = {
|
|
39
|
+
registry: "https://registry.npmjs.org"
|
|
40
|
+
};
|
|
41
|
+
const files = [
|
|
42
|
+
"dist/",
|
|
43
|
+
"loader/"
|
|
44
|
+
];
|
|
45
|
+
const scripts = {
|
|
46
|
+
"auto-changelog": "auto-changelog",
|
|
47
|
+
release: "release-it --no-npm",
|
|
48
|
+
build: "stencil build --docs",
|
|
49
|
+
start: "concurrently -c \"bgBlue.bold,bgMagenta.bold,bgGreen.bold\" \"yarn run start-stencil\" \"yarn run storybook\"",
|
|
50
|
+
"start-stencil": "stencil build --watch --serve --no-open",
|
|
51
|
+
test: "stencil test --spec --e2e",
|
|
52
|
+
"test:watch": "stencil test --spec --e2e --watchAll",
|
|
53
|
+
generate: "stencil generate",
|
|
54
|
+
storybook: "start-storybook -p 6006",
|
|
55
|
+
"build-storybook": "build-storybook"
|
|
56
|
+
};
|
|
57
|
+
const dependencies = {
|
|
58
|
+
"@stencil/core": "^2.13.0",
|
|
59
|
+
"@stencil/react-output-target": "^0.3.1",
|
|
60
|
+
"date-fns": "^2.29.3",
|
|
61
|
+
"dinero.js": "^1.9.1",
|
|
62
|
+
uuid: "^9.0.0",
|
|
63
|
+
yup: "^1.0.0"
|
|
64
|
+
};
|
|
65
|
+
const devDependencies = {
|
|
66
|
+
"@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
|
|
67
|
+
"@storybook/addon-actions": "^6.5.16",
|
|
68
|
+
"@storybook/addon-essentials": "^6.5.16",
|
|
69
|
+
"@storybook/addon-interactions": "^6.5.16",
|
|
70
|
+
"@storybook/addon-links": "^6.5.16",
|
|
71
|
+
"@storybook/builder-webpack4": "^6.5.16",
|
|
72
|
+
"@storybook/html": "^6.5.16",
|
|
73
|
+
"@storybook/manager-webpack4": "^6.5.16",
|
|
74
|
+
"@storybook/testing-library": "^0.0.13",
|
|
75
|
+
"@types/jest": "^27.0.3",
|
|
76
|
+
"auto-changelog": "^2.4.0",
|
|
77
|
+
concurrently: "^7.6.0",
|
|
78
|
+
jest: "^27.4.5",
|
|
79
|
+
"jest-cli": "^27.4.5",
|
|
80
|
+
puppeteer: "^10.0.0",
|
|
81
|
+
"release-it": "^15.6.0"
|
|
82
|
+
};
|
|
83
|
+
const license = "MIT";
|
|
84
|
+
const packageJson = {
|
|
85
|
+
name: name,
|
|
86
|
+
version: version,
|
|
87
|
+
description: description,
|
|
88
|
+
main: main,
|
|
89
|
+
module: module$1,
|
|
90
|
+
es2015: es2015,
|
|
91
|
+
es2017: es2017,
|
|
92
|
+
types: types,
|
|
93
|
+
collection: collection,
|
|
94
|
+
"collection:main": "dist/collection/index.js",
|
|
95
|
+
unpkg: unpkg,
|
|
96
|
+
repository: repository,
|
|
97
|
+
publishConfig: publishConfig,
|
|
98
|
+
files: files,
|
|
99
|
+
scripts: scripts,
|
|
100
|
+
dependencies: dependencies,
|
|
101
|
+
devDependencies: devDependencies,
|
|
102
|
+
license: license
|
|
103
|
+
};
|
|
104
|
+
|
|
128
105
|
const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";
|
|
129
106
|
|
|
130
107
|
const PaymentMethodForm = class {
|
|
@@ -180,12 +157,13 @@ const PaymentMethodForm = class {
|
|
|
180
157
|
this.postMessage(eventType, payload);
|
|
181
158
|
});
|
|
182
159
|
}
|
|
183
|
-
async tokenize(
|
|
160
|
+
async tokenize(clientId, paymentMethodMetadata, account) {
|
|
184
161
|
const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
|
|
185
162
|
const payload = {
|
|
186
|
-
|
|
163
|
+
clientId: clientId,
|
|
164
|
+
componentVersion: packageJson.version,
|
|
187
165
|
paymentMethodMetadata: paymentMethodMetadata,
|
|
188
|
-
account: account
|
|
166
|
+
account: account,
|
|
189
167
|
};
|
|
190
168
|
return this.postMessageWithResponseListener(eventType, payload);
|
|
191
169
|
}
|
|
@@ -210,6 +188,4 @@ const PaymentMethodForm = class {
|
|
|
210
188
|
};
|
|
211
189
|
PaymentMethodForm.style = paymentMethodFormCss;
|
|
212
190
|
|
|
213
|
-
exports.justifi_bank_account_form = BankAccountForm;
|
|
214
|
-
exports.justifi_card_form = CardForm;
|
|
215
191
|
exports.justifi_payment_method_form = PaymentMethodForm;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-ca2cd154.js');
|
|
6
6
|
|
|
7
7
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
8
8
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-ca2cd154.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Esm v2.
|
|
8
|
+
Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchEsm = () => {
|
|
11
11
|
return index.promiseResolve();
|
|
@@ -14,9 +14,8 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["justifi-
|
|
17
|
+
return index.bootstrapLazy([["justifi-billing-form.cjs",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["justifi-bank-account-form.cjs",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form.cjs",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payment-form.cjs",[[4,"justifi-payment-form",{"validationStrategy":[1,"validation-strategy"]}]]],["justifi-payments-list.cjs",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2.cjs",[[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-payment-method-form.cjs",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
exports.setNonce = index.setNonce;
|
|
22
21
|
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-ca2cd154.js');
|
|
6
|
+
|
|
7
|
+
const selectInputCss = ":host{display:block}label{display:block}";
|
|
8
|
+
|
|
9
|
+
const SelectInput = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.fieldReceivedInput = index.createEvent(this, "fieldReceivedInput", 7);
|
|
13
|
+
this.name = undefined;
|
|
14
|
+
this.label = undefined;
|
|
15
|
+
this.defaultValue = undefined;
|
|
16
|
+
this.error = undefined;
|
|
17
|
+
this.options = undefined;
|
|
18
|
+
this.internalValue = '';
|
|
19
|
+
}
|
|
20
|
+
onInput(event) {
|
|
21
|
+
const target = event.target;
|
|
22
|
+
const name = target.getAttribute('name');
|
|
23
|
+
this.fieldReceivedInput.emit({ name: name, value: target.value });
|
|
24
|
+
}
|
|
25
|
+
;
|
|
26
|
+
render() {
|
|
27
|
+
return (index.h(index.Host, null, index.h("label", null, this.label), index.h("select", { name: this.name, onInput: (event) => this.onInput(event) }, this.options.map((option) => {
|
|
28
|
+
return (index.h("option", { value: option.value }, option.label));
|
|
29
|
+
})), this.error && index.h("div", { style: { color: 'red' } }, this.error)));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
SelectInput.style = selectInputCss;
|
|
33
|
+
|
|
34
|
+
const textInputCss = ":host{display:block}label{display:block}";
|
|
35
|
+
|
|
36
|
+
const TextInput = class {
|
|
37
|
+
constructor(hostRef) {
|
|
38
|
+
index.registerInstance(this, hostRef);
|
|
39
|
+
this.fieldReceivedInput = index.createEvent(this, "fieldReceivedInput", 7);
|
|
40
|
+
this.name = undefined;
|
|
41
|
+
this.label = undefined;
|
|
42
|
+
this.defaultValue = undefined;
|
|
43
|
+
this.error = undefined;
|
|
44
|
+
this.internalValue = '';
|
|
45
|
+
}
|
|
46
|
+
onInput(event) {
|
|
47
|
+
const target = event.target;
|
|
48
|
+
const name = target.getAttribute('name');
|
|
49
|
+
this.fieldReceivedInput.emit({ name: name, value: target.value });
|
|
50
|
+
}
|
|
51
|
+
;
|
|
52
|
+
render() {
|
|
53
|
+
return (index.h(index.Host, null, index.h("label", null, this.label), index.h("input", { name: this.name, type: "text", onInput: (event) => this.onInput(event), value: this.internalValue || this.defaultValue }), this.error && index.h("div", { style: { color: 'red' } }, this.error)));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
TextInput.style = textInputCss;
|
|
57
|
+
|
|
58
|
+
exports.select_input = SelectInput;
|
|
59
|
+
exports.text_input = TextInput;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const index = require('./index-e1b45289.js');
|
|
3
|
+
const index = require('./index-ca2cd154.js');
|
|
6
4
|
|
|
7
5
|
/*
|
|
8
|
-
Stencil Client Patch Browser v2.
|
|
6
|
+
Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
|
|
9
7
|
*/
|
|
10
8
|
const patchBrowser = () => {
|
|
11
9
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('webcomponents.cjs.js', document.baseURI).href));
|
|
@@ -17,7 +15,5 @@ const patchBrowser = () => {
|
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["justifi-
|
|
18
|
+
return index.bootstrapLazy([["justifi-billing-form.cjs",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["justifi-bank-account-form.cjs",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form.cjs",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payment-form.cjs",[[4,"justifi-payment-form",{"validationStrategy":[1,"validation-strategy"]}]]],["justifi-payments-list.cjs",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2.cjs",[[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-payment-method-form.cjs",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
|
|
21
19
|
});
|
|
22
|
-
|
|
23
|
-
exports.setNonce = index.setNonce;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
3
|
"./components/bank-account-form/bank-account-form.js",
|
|
4
|
+
"./components/billing-form/billing-form.js",
|
|
4
5
|
"./components/card-form/card-form.js",
|
|
6
|
+
"./components/payment-form/payment-form.js",
|
|
5
7
|
"./components/payment-method-form/payment-method-form.js",
|
|
6
|
-
"./components/payments-list/payments-list.js"
|
|
8
|
+
"./components/payments-list/payments-list.js",
|
|
9
|
+
"./components/select-input/select-input.js",
|
|
10
|
+
"./components/text-input/text-input.js"
|
|
7
11
|
],
|
|
8
12
|
"compiler": {
|
|
9
13
|
"name": "@stencil/core",
|
|
10
|
-
"version": "2.
|
|
11
|
-
"typescriptVersion": "4.
|
|
14
|
+
"version": "2.20.0",
|
|
15
|
+
"typescriptVersion": "4.8.4"
|
|
12
16
|
},
|
|
13
17
|
"collections": [],
|
|
14
18
|
"bundles": []
|
|
@@ -138,7 +138,7 @@ export class BankAccountForm {
|
|
|
138
138
|
return {
|
|
139
139
|
"tokenize": {
|
|
140
140
|
"complexType": {
|
|
141
|
-
"signature": "(
|
|
141
|
+
"signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>",
|
|
142
142
|
"parameters": [{
|
|
143
143
|
"tags": [],
|
|
144
144
|
"text": ""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { object, string } from 'yup';
|
|
2
|
+
export const RegExZip = /^\d{5}/;
|
|
3
|
+
const BillingFormSchema = object({
|
|
4
|
+
// name: string().required('Enter name'),
|
|
5
|
+
address_line1: string().required('Enter street address'),
|
|
6
|
+
address_line2: string(),
|
|
7
|
+
address_city: string().required('Enter city'),
|
|
8
|
+
address_state: string().required('Choose state'),
|
|
9
|
+
address_postal_code: string()
|
|
10
|
+
.required('Enter ZIP')
|
|
11
|
+
.matches(RegExZip, 'Enter a valid ZIP')
|
|
12
|
+
.min(5, 'Enter a valid ZIP')
|
|
13
|
+
});
|
|
14
|
+
export default BillingFormSchema;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Host, h } from '@stencil/core';
|
|
2
|
+
import BillingFormSchema from './billing-form-schema';
|
|
3
|
+
import StateOptions from './state-options';
|
|
4
|
+
export class BillingForm {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.billingFields = {
|
|
7
|
+
address_line1: '',
|
|
8
|
+
address_line2: '',
|
|
9
|
+
address_city: '',
|
|
10
|
+
address_state: '',
|
|
11
|
+
address_postal_code: ''
|
|
12
|
+
};
|
|
13
|
+
this.billingFieldsErrors = {};
|
|
14
|
+
}
|
|
15
|
+
setFormValue(event) {
|
|
16
|
+
const data = event.detail;
|
|
17
|
+
const billingFieldsClone = Object.assign({}, this.billingFields);
|
|
18
|
+
if (data.name) {
|
|
19
|
+
billingFieldsClone[data.name] = data.value;
|
|
20
|
+
this.billingFields = billingFieldsClone;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async validate() {
|
|
24
|
+
const newErrors = {};
|
|
25
|
+
let isValid = true;
|
|
26
|
+
try {
|
|
27
|
+
await BillingFormSchema.validate(this.billingFields, { abortEarly: false });
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
isValid = false;
|
|
31
|
+
err.inner.map((item) => {
|
|
32
|
+
newErrors[item.path] = item.message;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
this.billingFieldsErrors = newErrors;
|
|
36
|
+
return { isValid: isValid };
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return (h(Host, null, h("fieldset", null, h("text-input", { name: "address_line1", label: "Street Address", defaultValue: this.billingFields.address_line1, error: this.billingFieldsErrors.address_line1 }), h("text-input", { name: "address_line2", label: "Apartment, Suite, etc. (optional)", defaultValue: this.billingFields.address_line2, error: this.billingFieldsErrors.address_line2 }), h("text-input", { name: "address_city", label: "City", defaultValue: this.billingFields.address_city, error: this.billingFieldsErrors.address_city }), h("select-input", { name: "address_state", label: "State", options: StateOptions, defaultValue: this.billingFields.address_state, error: this.billingFieldsErrors.address_state }), h("text-input", { name: "address_postal_code", label: "ZIP", defaultValue: this.billingFields.address_postal_code, error: this.billingFieldsErrors.address_postal_code }))));
|
|
40
|
+
}
|
|
41
|
+
static get is() { return "justifi-billing-form"; }
|
|
42
|
+
static get encapsulation() { return "shadow"; }
|
|
43
|
+
static get originalStyleUrls() {
|
|
44
|
+
return {
|
|
45
|
+
"$": ["billing-form.css"]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static get styleUrls() {
|
|
49
|
+
return {
|
|
50
|
+
"$": ["billing-form.css"]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
static get states() {
|
|
54
|
+
return {
|
|
55
|
+
"billingFields": {},
|
|
56
|
+
"billingFieldsErrors": {}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static get methods() {
|
|
60
|
+
return {
|
|
61
|
+
"validate": {
|
|
62
|
+
"complexType": {
|
|
63
|
+
"signature": "() => Promise<{ isValid: boolean; }>",
|
|
64
|
+
"parameters": [],
|
|
65
|
+
"references": {
|
|
66
|
+
"Promise": {
|
|
67
|
+
"location": "global"
|
|
68
|
+
},
|
|
69
|
+
"ValidationError": {
|
|
70
|
+
"location": "import",
|
|
71
|
+
"path": "yup"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"return": "Promise<{ isValid: boolean; }>"
|
|
75
|
+
},
|
|
76
|
+
"docs": {
|
|
77
|
+
"text": "",
|
|
78
|
+
"tags": []
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static get listeners() {
|
|
84
|
+
return [{
|
|
85
|
+
"name": "fieldReceivedInput",
|
|
86
|
+
"method": "setFormValue",
|
|
87
|
+
"target": undefined,
|
|
88
|
+
"capture": false,
|
|
89
|
+
"passive": false
|
|
90
|
+
}];
|
|
91
|
+
}
|
|
92
|
+
}
|