@justifi/webcomponents 0.0.7 → 0.0.9
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/dist/cjs/{index-ee888432.js → index-68222998.js} +52 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/justifi-bank-account-form_4.cjs.entry.js +80 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{justifi-card-form_2.cjs.entry.js → payments-list-d2dfcef1.js} +49 -56
- package/dist/cjs/webcomponents.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +5 -3
- package/dist/collection/components/bank-account-form/bank-account-form.js +172 -0
- package/dist/collection/components/card-form/card-form.css +1 -7
- package/dist/collection/components/card-form/card-form.js +16 -64
- package/dist/collection/components/payment-method-form/payment-method-form.css +8 -0
- package/dist/collection/components/payment-method-form/payment-method-form.js +190 -0
- package/dist/collection/index.js +3 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +4 -2
- package/dist/components/justifi-bank-account-form.d.ts +11 -0
- package/dist/components/justifi-bank-account-form.js +65 -0
- package/dist/components/justifi-card-form.js +20 -57
- package/dist/components/justifi-payment-method-form.d.ts +11 -0
- package/dist/components/justifi-payment-method-form.js +6 -0
- package/dist/components/justifi-payments-list.js +1 -1
- package/dist/components/payment-method-form.js +89 -0
- package/dist/esm/{index-2324c14b.js → index-e279d85e.js} +52 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/justifi-bank-account-form_4.entry.js +73 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{justifi-card-form_2.entry.js → payments-list-91eba70b.js} +48 -54
- package/dist/esm/webcomponents.js +3 -3
- package/dist/types/components/bank-account-form/bank-account-form.d.ts +19 -0
- package/dist/types/components/card-form/card-form.d.ts +2 -6
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +17 -0
- package/dist/types/components.d.ts +49 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/webcomponents/index.esm.js +1 -0
- package/dist/webcomponents/p-146348d6.js +2 -0
- package/dist/webcomponents/p-a688f9d3.entry.js +1 -0
- package/dist/webcomponents/p-c94a0f7f.js +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/webcomponents/p-5bf626ec.js +0 -2
- package/dist/webcomponents/p-a7effb1e.entry.js +0 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Host, h } from '@stencil/core';
|
|
2
|
+
var DispatchedEventTypes;
|
|
3
|
+
(function (DispatchedEventTypes) {
|
|
4
|
+
DispatchedEventTypes["blur"] = "blur";
|
|
5
|
+
DispatchedEventTypes["change"] = "change";
|
|
6
|
+
DispatchedEventTypes["ready"] = "ready";
|
|
7
|
+
DispatchedEventTypes["tokenize"] = "tokenize";
|
|
8
|
+
})(DispatchedEventTypes || (DispatchedEventTypes = {}));
|
|
9
|
+
export class PaymentMethodForm {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.iframeOrigin = undefined;
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
window.addEventListener('message', this.dispatchMessageEvent.bind(this));
|
|
15
|
+
}
|
|
16
|
+
disconnectedCallback() {
|
|
17
|
+
window.removeEventListener('message', this.dispatchMessageEvent.bind(this));
|
|
18
|
+
}
|
|
19
|
+
dispatchMessageEvent(messageEvent) {
|
|
20
|
+
const messagePayload = messageEvent.data;
|
|
21
|
+
const messageType = messagePayload.eventType;
|
|
22
|
+
const messageData = messagePayload.data;
|
|
23
|
+
switch (messageType) {
|
|
24
|
+
case DispatchedEventTypes.ready:
|
|
25
|
+
this.paymentMethodFormReady.emit(messageData);
|
|
26
|
+
break;
|
|
27
|
+
case DispatchedEventTypes.change:
|
|
28
|
+
this.paymentMethodFormChange.emit(messageData);
|
|
29
|
+
break;
|
|
30
|
+
case DispatchedEventTypes.blur:
|
|
31
|
+
this.paymentMethodFormBlur.emit(messageData);
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
triggerTokenization(clientKey, paymentMethodMetadata, account) {
|
|
38
|
+
if (this.iframeElement && this.iframeElement.contentWindow) {
|
|
39
|
+
this.iframeElement.contentWindow.postMessage({
|
|
40
|
+
eventType: DispatchedEventTypes.tokenize,
|
|
41
|
+
clientKey: clientKey,
|
|
42
|
+
paymentMethodMetadata: paymentMethodMetadata,
|
|
43
|
+
account: account
|
|
44
|
+
}, '*');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async tokenize(clientKey, paymentMethodMetadata, account) {
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
const tokenizeEventListener = (event) => {
|
|
50
|
+
if (event.data.eventType !== DispatchedEventTypes.tokenize)
|
|
51
|
+
return;
|
|
52
|
+
window.removeEventListener('message', tokenizeEventListener);
|
|
53
|
+
resolve(event.data.data);
|
|
54
|
+
};
|
|
55
|
+
window.addEventListener('message', tokenizeEventListener);
|
|
56
|
+
this.triggerTokenization(clientKey, paymentMethodMetadata, account);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
;
|
|
60
|
+
render() {
|
|
61
|
+
return (h(Host, null, h("iframe", { id: "justifi-payment-method-form", src: this.iframeOrigin, ref: (el) => this.iframeElement = el })));
|
|
62
|
+
}
|
|
63
|
+
static get is() { return "justifi-payment-method-form"; }
|
|
64
|
+
static get originalStyleUrls() {
|
|
65
|
+
return {
|
|
66
|
+
"$": ["payment-method-form.css"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static get styleUrls() {
|
|
70
|
+
return {
|
|
71
|
+
"$": ["payment-method-form.css"]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
static get properties() {
|
|
75
|
+
return {
|
|
76
|
+
"iframeOrigin": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"mutable": false,
|
|
79
|
+
"complexType": {
|
|
80
|
+
"original": "string",
|
|
81
|
+
"resolved": "string",
|
|
82
|
+
"references": {}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": false,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": ""
|
|
89
|
+
},
|
|
90
|
+
"attribute": "iframe-origin",
|
|
91
|
+
"reflect": false
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
static get events() {
|
|
96
|
+
return [{
|
|
97
|
+
"method": "paymentMethodFormReady",
|
|
98
|
+
"name": "paymentMethodFormReady",
|
|
99
|
+
"bubbles": true,
|
|
100
|
+
"cancelable": true,
|
|
101
|
+
"composed": true,
|
|
102
|
+
"docs": {
|
|
103
|
+
"tags": [],
|
|
104
|
+
"text": ""
|
|
105
|
+
},
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "any",
|
|
108
|
+
"resolved": "any",
|
|
109
|
+
"references": {}
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
"method": "paymentMethodFormChange",
|
|
113
|
+
"name": "paymentMethodFormChange",
|
|
114
|
+
"bubbles": true,
|
|
115
|
+
"cancelable": true,
|
|
116
|
+
"composed": true,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [],
|
|
119
|
+
"text": ""
|
|
120
|
+
},
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "any",
|
|
123
|
+
"resolved": "any",
|
|
124
|
+
"references": {}
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
"method": "paymentMethodFormBlur",
|
|
128
|
+
"name": "paymentMethodFormBlur",
|
|
129
|
+
"bubbles": true,
|
|
130
|
+
"cancelable": true,
|
|
131
|
+
"composed": true,
|
|
132
|
+
"docs": {
|
|
133
|
+
"tags": [],
|
|
134
|
+
"text": ""
|
|
135
|
+
},
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "any",
|
|
138
|
+
"resolved": "any",
|
|
139
|
+
"references": {}
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
"method": "paymentMethodFormTokenize",
|
|
143
|
+
"name": "paymentMethodFormTokenize",
|
|
144
|
+
"bubbles": true,
|
|
145
|
+
"cancelable": true,
|
|
146
|
+
"composed": true,
|
|
147
|
+
"docs": {
|
|
148
|
+
"tags": [],
|
|
149
|
+
"text": ""
|
|
150
|
+
},
|
|
151
|
+
"complexType": {
|
|
152
|
+
"original": "{ data: any }",
|
|
153
|
+
"resolved": "{ data: any; }",
|
|
154
|
+
"references": {}
|
|
155
|
+
}
|
|
156
|
+
}];
|
|
157
|
+
}
|
|
158
|
+
static get methods() {
|
|
159
|
+
return {
|
|
160
|
+
"tokenize": {
|
|
161
|
+
"complexType": {
|
|
162
|
+
"signature": "(clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>",
|
|
163
|
+
"parameters": [{
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": ""
|
|
166
|
+
}, {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": ""
|
|
169
|
+
}, {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
}],
|
|
173
|
+
"references": {
|
|
174
|
+
"Promise": {
|
|
175
|
+
"location": "global"
|
|
176
|
+
},
|
|
177
|
+
"MessageEvent": {
|
|
178
|
+
"location": "global"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"return": "Promise<any>"
|
|
182
|
+
},
|
|
183
|
+
"docs": {
|
|
184
|
+
"text": "",
|
|
185
|
+
"tags": []
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
}
|
package/dist/collection/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* webcomponents custom elements */
|
|
2
|
+
export { BankAccountForm as JustifiBankAccountForm } from '../types/components/bank-account-form/bank-account-form';
|
|
2
3
|
export { CardForm as JustifiCardForm } from '../types/components/card-form/card-form';
|
|
4
|
+
export { PaymentMethodForm as JustifiPaymentMethodForm } from '../types/components/payment-method-form/payment-method-form';
|
|
3
5
|
export { PaymentsList as JustifiPaymentsList } from '../types/components/payments-list/payments-list';
|
|
4
6
|
|
|
5
7
|
/**
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { B as BankAccountForm, JustifiBankAccountForm, defineCustomElement as defineCustomElementJustifiBankAccountForm } from './justifi-bank-account-form.js';
|
|
3
|
+
export { C as CardForm, JustifiCardForm, defineCustomElement as defineCustomElementJustifiCardForm } from './justifi-card-form.js';
|
|
4
|
+
export { JustifiPaymentsList, P as PaymentsList, defineCustomElement as defineCustomElementJustifiPaymentsList } from './justifi-payments-list.js';
|
|
5
|
+
export { JustifiPaymentMethodForm, defineCustomElement as defineCustomElementJustifiPaymentMethodForm } from './justifi-payment-method-form.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface JustifiBankAccountForm extends Components.JustifiBankAccountForm, HTMLElement {}
|
|
4
|
+
export const JustifiBankAccountForm: {
|
|
5
|
+
prototype: JustifiBankAccountForm;
|
|
6
|
+
new (): JustifiBankAccountForm;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './payment-method-form.js';
|
|
3
|
+
|
|
4
|
+
const BankAccountForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.__registerHost();
|
|
8
|
+
this.bankAccountFormReady = createEvent(this, "bankAccountFormReady", 7);
|
|
9
|
+
this.bankAccountFormChange = createEvent(this, "bankAccountFormChange", 7);
|
|
10
|
+
this.bankAccountFormBlur = createEvent(this, "bankAccountFormBlur", 7);
|
|
11
|
+
this.bankAccountFormTokenize = createEvent(this, "bankAccountFormTokenize", 7);
|
|
12
|
+
this.iframeOrigin = undefined;
|
|
13
|
+
}
|
|
14
|
+
readyHandler(event) {
|
|
15
|
+
this.bankAccountFormReady.emit(event);
|
|
16
|
+
}
|
|
17
|
+
changeHandler(event) {
|
|
18
|
+
this.bankAccountFormChange.emit(event);
|
|
19
|
+
}
|
|
20
|
+
blurHandler(event) {
|
|
21
|
+
this.bankAccountFormBlur.emit(event);
|
|
22
|
+
}
|
|
23
|
+
tokenizeHandler(event) {
|
|
24
|
+
this.bankAccountFormTokenize.emit(event);
|
|
25
|
+
}
|
|
26
|
+
async tokenize(...args) {
|
|
27
|
+
if (!this.childRef) {
|
|
28
|
+
throw new Error('Cannot call tokenize');
|
|
29
|
+
}
|
|
30
|
+
return this.childRef.tokenize(...args);
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
return (h("justifi-payment-method-form", { ref: el => {
|
|
34
|
+
if (el) {
|
|
35
|
+
this.childRef = el;
|
|
36
|
+
}
|
|
37
|
+
}, "iframe-origin": this.iframeOrigin || 'https://js.justifi.ai/bank-account', "payment-method-form-ready": this.bankAccountFormReady, "payment-method-form-change": this.bankAccountFormChange, "payment-method-form-blur": this.bankAccountFormBlur, "payment-method-form-tokenize": this.bankAccountFormTokenize }));
|
|
38
|
+
}
|
|
39
|
+
}, [0, "justifi-bank-account-form", {
|
|
40
|
+
"iframeOrigin": [1, "iframe-origin"],
|
|
41
|
+
"tokenize": [64]
|
|
42
|
+
}, [[0, "paymentMethodFormReady", "readyHandler"], [0, "paymentMethodFormChange", "changeHandler"], [0, "paymentMethodFormBlur", "blurHandler"], [0, "paymentMethodFormTokenize", "tokenizeHandler"]]]);
|
|
43
|
+
function defineCustomElement$1() {
|
|
44
|
+
if (typeof customElements === "undefined") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const components = ["justifi-bank-account-form", "justifi-payment-method-form"];
|
|
48
|
+
components.forEach(tagName => { switch (tagName) {
|
|
49
|
+
case "justifi-bank-account-form":
|
|
50
|
+
if (!customElements.get(tagName)) {
|
|
51
|
+
customElements.define(tagName, BankAccountForm);
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case "justifi-payment-method-form":
|
|
55
|
+
if (!customElements.get(tagName)) {
|
|
56
|
+
defineCustomElement$2();
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
} });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const JustifiBankAccountForm = BankAccountForm;
|
|
63
|
+
const defineCustomElement = defineCustomElement$1;
|
|
64
|
+
|
|
65
|
+
export { BankAccountForm as B, JustifiBankAccountForm, defineCustomElement };
|
|
@@ -1,75 +1,33 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './payment-method-form.js';
|
|
2
3
|
|
|
3
|
-
const cardFormCss = "
|
|
4
|
+
const cardFormCss = "justifi-card-form iframe{height:55px}";
|
|
4
5
|
|
|
5
|
-
var DispatchedEventTypes;
|
|
6
|
-
(function (DispatchedEventTypes) {
|
|
7
|
-
DispatchedEventTypes["blur"] = "blur";
|
|
8
|
-
DispatchedEventTypes["change"] = "change";
|
|
9
|
-
DispatchedEventTypes["ready"] = "ready";
|
|
10
|
-
DispatchedEventTypes["tokenize"] = "tokenize";
|
|
11
|
-
})(DispatchedEventTypes || (DispatchedEventTypes = {}));
|
|
12
6
|
const CardForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
13
7
|
constructor() {
|
|
14
8
|
super();
|
|
15
9
|
this.__registerHost();
|
|
16
|
-
this.__attachShadow();
|
|
17
10
|
this.cardFormReady = createEvent(this, "cardFormReady", 7);
|
|
18
11
|
this.cardFormChange = createEvent(this, "cardFormChange", 7);
|
|
19
12
|
this.cardFormBlur = createEvent(this, "cardFormBlur", 7);
|
|
20
13
|
this.cardFormTokenize = createEvent(this, "cardFormTokenize", 7);
|
|
21
14
|
this.iframeOrigin = undefined;
|
|
22
15
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
disconnectedCallback() {
|
|
27
|
-
window.removeEventListener('message', this.dispatchMessageEvent.bind(this));
|
|
28
|
-
}
|
|
29
|
-
dispatchMessageEvent(messageEvent) {
|
|
30
|
-
const messagePayload = messageEvent.data;
|
|
31
|
-
const messageType = messagePayload.eventType;
|
|
32
|
-
const messageData = messagePayload.data;
|
|
33
|
-
switch (messageType) {
|
|
34
|
-
case DispatchedEventTypes.ready:
|
|
35
|
-
this.cardFormReady.emit(messageData);
|
|
36
|
-
break;
|
|
37
|
-
case DispatchedEventTypes.change:
|
|
38
|
-
this.cardFormChange.emit(messageData);
|
|
39
|
-
break;
|
|
40
|
-
case DispatchedEventTypes.blur:
|
|
41
|
-
this.cardFormBlur.emit(messageData);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
triggerTokenization(clientKey, paymentMethodMetadata, account) {
|
|
46
|
-
if (this.iframeElement && this.iframeElement.contentWindow) {
|
|
47
|
-
this.iframeElement.contentWindow.postMessage({
|
|
48
|
-
eventType: DispatchedEventTypes.tokenize,
|
|
49
|
-
clientKey: clientKey,
|
|
50
|
-
paymentMethodMetadata: paymentMethodMetadata,
|
|
51
|
-
account: account
|
|
52
|
-
}, '*');
|
|
16
|
+
async tokenize(...args) {
|
|
17
|
+
if (!this.childRef) {
|
|
18
|
+
throw new Error('Cannot call tokenize');
|
|
53
19
|
}
|
|
20
|
+
return this.childRef.tokenize(...args);
|
|
54
21
|
}
|
|
55
|
-
async tokenize(clientKey, paymentMethodMetadata, account) {
|
|
56
|
-
return new Promise((resolve) => {
|
|
57
|
-
const tokenizeEventListener = (event) => {
|
|
58
|
-
if (event.data.eventType !== DispatchedEventTypes.tokenize)
|
|
59
|
-
return;
|
|
60
|
-
window.removeEventListener('message', tokenizeEventListener);
|
|
61
|
-
resolve(event.data.data);
|
|
62
|
-
};
|
|
63
|
-
window.addEventListener('message', tokenizeEventListener);
|
|
64
|
-
this.triggerTokenization(clientKey, paymentMethodMetadata, account);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
;
|
|
68
22
|
render() {
|
|
69
|
-
return (h(
|
|
23
|
+
return (h("justifi-payment-method-form", { ref: el => {
|
|
24
|
+
if (el) {
|
|
25
|
+
this.childRef = el;
|
|
26
|
+
}
|
|
27
|
+
}, "iframe-origin": this.iframeOrigin || 'https://js.justifi.ai/card', "payment-method-form-ready": this.cardFormReady, "payment-method-form-change": this.cardFormChange, "payment-method-form-blur": this.cardFormBlur, "payment-method-form-tokenize": this.cardFormTokenize }));
|
|
70
28
|
}
|
|
71
29
|
static get style() { return cardFormCss; }
|
|
72
|
-
}, [
|
|
30
|
+
}, [0, "justifi-card-form", {
|
|
73
31
|
"iframeOrigin": [1, "iframe-origin"],
|
|
74
32
|
"tokenize": [64]
|
|
75
33
|
}]);
|
|
@@ -77,17 +35,22 @@ function defineCustomElement$1() {
|
|
|
77
35
|
if (typeof customElements === "undefined") {
|
|
78
36
|
return;
|
|
79
37
|
}
|
|
80
|
-
const components = ["justifi-card-form"];
|
|
38
|
+
const components = ["justifi-card-form", "justifi-payment-method-form"];
|
|
81
39
|
components.forEach(tagName => { switch (tagName) {
|
|
82
40
|
case "justifi-card-form":
|
|
83
41
|
if (!customElements.get(tagName)) {
|
|
84
42
|
customElements.define(tagName, CardForm);
|
|
85
43
|
}
|
|
86
44
|
break;
|
|
45
|
+
case "justifi-payment-method-form":
|
|
46
|
+
if (!customElements.get(tagName)) {
|
|
47
|
+
defineCustomElement$2();
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
87
50
|
} });
|
|
88
51
|
}
|
|
89
52
|
|
|
90
53
|
const JustifiCardForm = CardForm;
|
|
91
54
|
const defineCustomElement = defineCustomElement$1;
|
|
92
55
|
|
|
93
|
-
export { JustifiCardForm, defineCustomElement };
|
|
56
|
+
export { CardForm as C, JustifiCardForm, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface JustifiPaymentMethodForm extends Components.JustifiPaymentMethodForm, HTMLElement {}
|
|
4
|
+
export const JustifiPaymentMethodForm: {
|
|
5
|
+
prototype: JustifiPaymentMethodForm;
|
|
6
|
+
new (): JustifiPaymentMethodForm;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -4250,4 +4250,4 @@ function defineCustomElement$1() {
|
|
|
4250
4250
|
const JustifiPaymentsList = PaymentsList;
|
|
4251
4251
|
const defineCustomElement = defineCustomElement$1;
|
|
4252
4252
|
|
|
4253
|
-
export { JustifiPaymentsList, defineCustomElement };
|
|
4253
|
+
export { JustifiPaymentsList, PaymentsList as P, defineCustomElement };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";
|
|
4
|
+
|
|
5
|
+
var DispatchedEventTypes;
|
|
6
|
+
(function (DispatchedEventTypes) {
|
|
7
|
+
DispatchedEventTypes["blur"] = "blur";
|
|
8
|
+
DispatchedEventTypes["change"] = "change";
|
|
9
|
+
DispatchedEventTypes["ready"] = "ready";
|
|
10
|
+
DispatchedEventTypes["tokenize"] = "tokenize";
|
|
11
|
+
})(DispatchedEventTypes || (DispatchedEventTypes = {}));
|
|
12
|
+
const PaymentMethodForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
this.paymentMethodFormReady = createEvent(this, "paymentMethodFormReady", 7);
|
|
17
|
+
this.paymentMethodFormChange = createEvent(this, "paymentMethodFormChange", 7);
|
|
18
|
+
this.paymentMethodFormBlur = createEvent(this, "paymentMethodFormBlur", 7);
|
|
19
|
+
this.paymentMethodFormTokenize = createEvent(this, "paymentMethodFormTokenize", 7);
|
|
20
|
+
this.iframeOrigin = undefined;
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
window.addEventListener('message', this.dispatchMessageEvent.bind(this));
|
|
24
|
+
}
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
window.removeEventListener('message', this.dispatchMessageEvent.bind(this));
|
|
27
|
+
}
|
|
28
|
+
dispatchMessageEvent(messageEvent) {
|
|
29
|
+
const messagePayload = messageEvent.data;
|
|
30
|
+
const messageType = messagePayload.eventType;
|
|
31
|
+
const messageData = messagePayload.data;
|
|
32
|
+
switch (messageType) {
|
|
33
|
+
case DispatchedEventTypes.ready:
|
|
34
|
+
this.paymentMethodFormReady.emit(messageData);
|
|
35
|
+
break;
|
|
36
|
+
case DispatchedEventTypes.change:
|
|
37
|
+
this.paymentMethodFormChange.emit(messageData);
|
|
38
|
+
break;
|
|
39
|
+
case DispatchedEventTypes.blur:
|
|
40
|
+
this.paymentMethodFormBlur.emit(messageData);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
triggerTokenization(clientKey, paymentMethodMetadata, account) {
|
|
45
|
+
if (this.iframeElement && this.iframeElement.contentWindow) {
|
|
46
|
+
this.iframeElement.contentWindow.postMessage({
|
|
47
|
+
eventType: DispatchedEventTypes.tokenize,
|
|
48
|
+
clientKey: clientKey,
|
|
49
|
+
paymentMethodMetadata: paymentMethodMetadata,
|
|
50
|
+
account: account
|
|
51
|
+
}, '*');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async tokenize(clientKey, paymentMethodMetadata, account) {
|
|
55
|
+
return new Promise((resolve) => {
|
|
56
|
+
const tokenizeEventListener = (event) => {
|
|
57
|
+
if (event.data.eventType !== DispatchedEventTypes.tokenize)
|
|
58
|
+
return;
|
|
59
|
+
window.removeEventListener('message', tokenizeEventListener);
|
|
60
|
+
resolve(event.data.data);
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener('message', tokenizeEventListener);
|
|
63
|
+
this.triggerTokenization(clientKey, paymentMethodMetadata, account);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
;
|
|
67
|
+
render() {
|
|
68
|
+
return (h(Host, null, h("iframe", { id: "justifi-payment-method-form", src: this.iframeOrigin, ref: (el) => this.iframeElement = el })));
|
|
69
|
+
}
|
|
70
|
+
static get style() { return paymentMethodFormCss; }
|
|
71
|
+
}, [0, "justifi-payment-method-form", {
|
|
72
|
+
"iframeOrigin": [1, "iframe-origin"],
|
|
73
|
+
"tokenize": [64]
|
|
74
|
+
}]);
|
|
75
|
+
function defineCustomElement() {
|
|
76
|
+
if (typeof customElements === "undefined") {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const components = ["justifi-payment-method-form"];
|
|
80
|
+
components.forEach(tagName => { switch (tagName) {
|
|
81
|
+
case "justifi-payment-method-form":
|
|
82
|
+
if (!customElements.get(tagName)) {
|
|
83
|
+
customElements.define(tagName, PaymentMethodForm);
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
} });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { PaymentMethodForm as P, defineCustomElement as d };
|
|
@@ -695,6 +695,15 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
695
695
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
696
696
|
const instance = hostRef.$lazyInstance$ ;
|
|
697
697
|
let promise;
|
|
698
|
+
if (isInitialLoad) {
|
|
699
|
+
{
|
|
700
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
701
|
+
if (hostRef.$queuedListeners$) {
|
|
702
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
703
|
+
hostRef.$queuedListeners$ = null;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
698
707
|
endSchedule();
|
|
699
708
|
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
700
709
|
};
|
|
@@ -1101,6 +1110,10 @@ const connectedCallback = (elm) => {
|
|
|
1101
1110
|
}
|
|
1102
1111
|
}
|
|
1103
1112
|
else {
|
|
1113
|
+
// not the first time this has connected
|
|
1114
|
+
// reattach any event listeners to the host
|
|
1115
|
+
// since they would have been removed when disconnected
|
|
1116
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
1104
1117
|
// fire off connectedCallback() on component instance
|
|
1105
1118
|
fireConnectedCallback(hostRef.$lazyInstance$);
|
|
1106
1119
|
}
|
|
@@ -1111,6 +1124,12 @@ const disconnectedCallback = (elm) => {
|
|
|
1111
1124
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1112
1125
|
const hostRef = getHostRef(elm);
|
|
1113
1126
|
const instance = hostRef.$lazyInstance$ ;
|
|
1127
|
+
{
|
|
1128
|
+
if (hostRef.$rmListeners$) {
|
|
1129
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1130
|
+
hostRef.$rmListeners$ = undefined;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1114
1133
|
{
|
|
1115
1134
|
safeCall(instance, 'disconnectedCallback');
|
|
1116
1135
|
}
|
|
@@ -1140,6 +1159,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1140
1159
|
{
|
|
1141
1160
|
cmpMeta.$members$ = compactMeta[2];
|
|
1142
1161
|
}
|
|
1162
|
+
{
|
|
1163
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
|
1164
|
+
}
|
|
1143
1165
|
{
|
|
1144
1166
|
cmpMeta.$watchers$ = {};
|
|
1145
1167
|
}
|
|
@@ -1208,6 +1230,35 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1208
1230
|
// Fallback appLoad event
|
|
1209
1231
|
endBootstrap();
|
|
1210
1232
|
};
|
|
1233
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1234
|
+
if (listeners) {
|
|
1235
|
+
listeners.map(([flags, name, method]) => {
|
|
1236
|
+
const target = elm;
|
|
1237
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1238
|
+
const opts = hostListenerOpts(flags);
|
|
1239
|
+
plt.ael(target, name, handler, opts);
|
|
1240
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1245
|
+
try {
|
|
1246
|
+
{
|
|
1247
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1248
|
+
// instance is ready, let's call it's member method for this event
|
|
1249
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
catch (e) {
|
|
1257
|
+
consoleError(e);
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
// prettier-ignore
|
|
1261
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1211
1262
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1212
1263
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1213
1264
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -1226,6 +1277,7 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
1226
1277
|
elm['s-p'] = [];
|
|
1227
1278
|
elm['s-rc'] = [];
|
|
1228
1279
|
}
|
|
1280
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
|
1229
1281
|
return hostRefs.set(elm, hostRef);
|
|
1230
1282
|
};
|
|
1231
1283
|
const isMemberInElement = (elm, memberName) => memberName in elm;
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { B as BankAccountForm, C as CardForm, P as PaymentsList } from './payments-list-91eba70b.js';
|
|
2
|
+
import './index-e279d85e.js';
|