@justifi/webcomponents 0.0.11 → 0.0.12
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-68222998.js → index-4f753ffd.js} +32 -1
- package/dist/cjs/justifi-bank-account-form_4.cjs.entry.js +69 -61
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/webcomponents.cjs.js +7 -3
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/bank-account-form/bank-account-form.js +43 -45
- package/dist/collection/components/card-form/card-form.js +43 -55
- package/dist/collection/components/payment-method-form/message-event-types.js +12 -0
- package/dist/collection/components/payment-method-form/payment-method-form.js +68 -73
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +1 -1
- package/dist/components/justifi-bank-account-form.js +16 -13
- package/dist/components/justifi-card-form.js +16 -16
- package/dist/components/payment-method-form.js +48 -39
- package/dist/esm/{index-e279d85e.js → index-3d88d85c.js} +32 -2
- package/dist/esm/justifi-bank-account-form_4.entry.js +69 -61
- package/dist/esm/loader.js +4 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/webcomponents.js +4 -3
- package/dist/types/api/Api.d.ts +1 -1
- package/dist/types/api/Payment.d.ts +1 -1
- package/dist/types/components/bank-account-form/bank-account-form.d.ts +10 -5
- package/dist/types/components/card-form/card-form.d.ts +10 -5
- package/dist/types/components/payment-method-form/message-event-types.d.ts +12 -0
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +5 -4
- package/dist/types/components.d.ts +13 -12
- package/dist/types/stencil-public-runtime.d.ts +48 -3
- package/dist/webcomponents/p-8ad58e9a.entry.js +1 -0
- package/dist/webcomponents/p-de108437.js +2 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/loader/index.d.ts +9 -0
- package/package.json +1 -1
- package/dist/collection/components/card-form/card-form.css +0 -3
- package/dist/webcomponents/p-146348d6.js +0 -2
- package/dist/webcomponents/p-a967d55b.entry.js +0 -1
|
@@ -41,6 +41,18 @@ const isComplexType = (o) => {
|
|
|
41
41
|
o = typeof o;
|
|
42
42
|
return o === 'object' || o === 'function';
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
|
46
|
+
* out of a DOM's head.
|
|
47
|
+
*
|
|
48
|
+
* @param doc The DOM containing the `head` to query against
|
|
49
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
50
|
+
* exists or the tag has no content.
|
|
51
|
+
*/
|
|
52
|
+
function queryNonceMetaTagContent(doc) {
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
55
|
+
}
|
|
44
56
|
/**
|
|
45
57
|
* Production h() function based on Preact by
|
|
46
58
|
* Jason Miller (@developit)
|
|
@@ -49,7 +61,6 @@ const isComplexType = (o) => {
|
|
|
49
61
|
*
|
|
50
62
|
* Modified for Stencil's compiler and vdom
|
|
51
63
|
*/
|
|
52
|
-
// const stack: any[] = [];
|
|
53
64
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
54
65
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
55
66
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -197,6 +208,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
197
208
|
styles.set(scopeId, style);
|
|
198
209
|
};
|
|
199
210
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
211
|
+
var _a;
|
|
200
212
|
let scopeId = getScopeId(cmpMeta);
|
|
201
213
|
const style = styles.get(scopeId);
|
|
202
214
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
@@ -216,6 +228,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
216
228
|
styleElm = doc.createElement('style');
|
|
217
229
|
styleElm.innerHTML = style;
|
|
218
230
|
}
|
|
231
|
+
// Apply CSP nonce to the style tag if it exists
|
|
232
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
233
|
+
if (nonce != null) {
|
|
234
|
+
styleElm.setAttribute('nonce', nonce);
|
|
235
|
+
}
|
|
219
236
|
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
220
237
|
}
|
|
221
238
|
if (appliedStyles) {
|
|
@@ -1136,6 +1153,7 @@ const disconnectedCallback = (elm) => {
|
|
|
1136
1153
|
}
|
|
1137
1154
|
};
|
|
1138
1155
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1156
|
+
var _a;
|
|
1139
1157
|
const endBootstrap = createTime();
|
|
1140
1158
|
const cmpTags = [];
|
|
1141
1159
|
const exclude = options.exclude || [];
|
|
@@ -1215,6 +1233,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1215
1233
|
{
|
|
1216
1234
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1217
1235
|
visibilityStyle.setAttribute('data-styles', '');
|
|
1236
|
+
// Apply CSP nonce to the style tag if it exists
|
|
1237
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
1238
|
+
if (nonce != null) {
|
|
1239
|
+
visibilityStyle.setAttribute('nonce', nonce);
|
|
1240
|
+
}
|
|
1218
1241
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
1219
1242
|
}
|
|
1220
1243
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -1259,6 +1282,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
1259
1282
|
};
|
|
1260
1283
|
// prettier-ignore
|
|
1261
1284
|
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1285
|
+
/**
|
|
1286
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1287
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
1288
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
|
1289
|
+
* @returns void
|
|
1290
|
+
*/
|
|
1291
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
1262
1292
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1263
1293
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1264
1294
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -1369,4 +1399,4 @@ const flush = () => {
|
|
|
1369
1399
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1370
1400
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1371
1401
|
|
|
1372
|
-
export { Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r };
|
|
1402
|
+
export { Host as H, bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
|
@@ -1,97 +1,103 @@
|
|
|
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-3d88d85c.js';
|
|
2
2
|
|
|
3
3
|
const BankAccountForm = class {
|
|
4
4
|
constructor(hostRef) {
|
|
5
5
|
registerInstance(this, hostRef);
|
|
6
6
|
this.bankAccountFormReady = createEvent(this, "bankAccountFormReady", 7);
|
|
7
|
-
this.bankAccountFormChange = createEvent(this, "bankAccountFormChange", 7);
|
|
8
|
-
this.bankAccountFormBlur = createEvent(this, "bankAccountFormBlur", 7);
|
|
9
7
|
this.bankAccountFormTokenize = createEvent(this, "bankAccountFormTokenize", 7);
|
|
10
|
-
this.
|
|
8
|
+
this.bankAccountFormValidate = createEvent(this, "bankAccountFormValidate", 7);
|
|
9
|
+
this.validationStrategy = undefined;
|
|
11
10
|
}
|
|
12
11
|
readyHandler(event) {
|
|
13
12
|
this.bankAccountFormReady.emit(event);
|
|
14
13
|
}
|
|
15
|
-
changeHandler(event) {
|
|
16
|
-
this.bankAccountFormChange.emit(event);
|
|
17
|
-
}
|
|
18
|
-
blurHandler(event) {
|
|
19
|
-
this.bankAccountFormBlur.emit(event);
|
|
20
|
-
}
|
|
21
14
|
tokenizeHandler(event) {
|
|
22
15
|
this.bankAccountFormTokenize.emit(event);
|
|
23
16
|
}
|
|
17
|
+
validateHandler(event) {
|
|
18
|
+
this.bankAccountFormValidate.emit(event);
|
|
19
|
+
}
|
|
24
20
|
async tokenize(...args) {
|
|
25
21
|
if (!this.childRef) {
|
|
26
22
|
throw new Error('Cannot call tokenize');
|
|
27
23
|
}
|
|
28
24
|
return this.childRef.tokenize(...args);
|
|
29
25
|
}
|
|
26
|
+
async validate() {
|
|
27
|
+
if (!this.childRef) {
|
|
28
|
+
throw new Error('Cannot call validate');
|
|
29
|
+
}
|
|
30
|
+
return this.childRef.validate();
|
|
31
|
+
}
|
|
30
32
|
render() {
|
|
31
33
|
return (h("justifi-payment-method-form", { ref: el => {
|
|
32
34
|
if (el) {
|
|
33
35
|
this.childRef = el;
|
|
34
36
|
}
|
|
35
|
-
}, "
|
|
37
|
+
}, "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' }));
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
40
|
|
|
39
|
-
const cardFormCss = "justifi-card-form iframe{height:55px}";
|
|
40
|
-
|
|
41
41
|
const CardForm = class {
|
|
42
42
|
constructor(hostRef) {
|
|
43
43
|
registerInstance(this, hostRef);
|
|
44
44
|
this.cardFormReady = createEvent(this, "cardFormReady", 7);
|
|
45
|
-
this.cardFormChange = createEvent(this, "cardFormChange", 7);
|
|
46
|
-
this.cardFormBlur = createEvent(this, "cardFormBlur", 7);
|
|
47
45
|
this.cardFormTokenize = createEvent(this, "cardFormTokenize", 7);
|
|
48
|
-
this.
|
|
46
|
+
this.cardFormValidate = createEvent(this, "cardFormValidate", 7);
|
|
47
|
+
this.validationStrategy = undefined;
|
|
49
48
|
}
|
|
50
49
|
readyHandler(event) {
|
|
51
50
|
this.cardFormReady.emit(event);
|
|
52
51
|
}
|
|
53
|
-
changeHandler(event) {
|
|
54
|
-
this.cardFormChange.emit(event);
|
|
55
|
-
}
|
|
56
|
-
blurHandler(event) {
|
|
57
|
-
this.cardFormBlur.emit(event);
|
|
58
|
-
}
|
|
59
52
|
tokenizeHandler(event) {
|
|
60
53
|
this.cardFormTokenize.emit(event);
|
|
61
54
|
}
|
|
55
|
+
validateHandler(event) {
|
|
56
|
+
this.cardFormValidate.emit(event);
|
|
57
|
+
}
|
|
62
58
|
async tokenize(...args) {
|
|
63
59
|
if (!this.childRef) {
|
|
64
60
|
throw new Error('Cannot call tokenize');
|
|
65
61
|
}
|
|
66
62
|
return this.childRef.tokenize(...args);
|
|
67
63
|
}
|
|
64
|
+
async validate() {
|
|
65
|
+
if (!this.childRef) {
|
|
66
|
+
throw new Error('Cannot call validate');
|
|
67
|
+
}
|
|
68
|
+
return this.childRef.validate();
|
|
69
|
+
}
|
|
68
70
|
render() {
|
|
69
71
|
return (h("justifi-payment-method-form", { ref: el => {
|
|
70
72
|
if (el) {
|
|
71
73
|
this.childRef = el;
|
|
72
74
|
}
|
|
73
|
-
}, "
|
|
75
|
+
}, "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' }));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const MessageEventType = {
|
|
80
|
+
card: {
|
|
81
|
+
ready: 'justifi.card.ready',
|
|
82
|
+
tokenize: 'justifi.card.tokenize',
|
|
83
|
+
validate: 'justifi.card.validate',
|
|
84
|
+
},
|
|
85
|
+
bankAccount: {
|
|
86
|
+
ready: 'justifi.bank_account.ready',
|
|
87
|
+
tokenize: 'justifi.bank_account.tokenize',
|
|
88
|
+
validate: 'justifi.bank_account.validate',
|
|
74
89
|
}
|
|
75
90
|
};
|
|
76
|
-
CardForm.style = cardFormCss;
|
|
77
91
|
|
|
78
92
|
const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";
|
|
79
93
|
|
|
80
|
-
var DispatchedEventTypes;
|
|
81
|
-
(function (DispatchedEventTypes) {
|
|
82
|
-
DispatchedEventTypes["blur"] = "blur";
|
|
83
|
-
DispatchedEventTypes["change"] = "change";
|
|
84
|
-
DispatchedEventTypes["ready"] = "ready";
|
|
85
|
-
DispatchedEventTypes["tokenize"] = "tokenize";
|
|
86
|
-
})(DispatchedEventTypes || (DispatchedEventTypes = {}));
|
|
87
94
|
const PaymentMethodForm = class {
|
|
88
95
|
constructor(hostRef) {
|
|
89
96
|
registerInstance(this, hostRef);
|
|
90
97
|
this.paymentMethodFormReady = createEvent(this, "paymentMethodFormReady", 7);
|
|
91
|
-
this.paymentMethodFormChange = createEvent(this, "paymentMethodFormChange", 7);
|
|
92
|
-
this.paymentMethodFormBlur = createEvent(this, "paymentMethodFormBlur", 7);
|
|
93
98
|
this.paymentMethodFormTokenize = createEvent(this, "paymentMethodFormTokenize", 7);
|
|
94
|
-
this.
|
|
99
|
+
this.paymentMethodFormType = undefined;
|
|
100
|
+
this.paymentMethodFormValidationStrategy = undefined;
|
|
95
101
|
}
|
|
96
102
|
connectedCallback() {
|
|
97
103
|
window.addEventListener('message', this.dispatchMessageEvent.bind(this));
|
|
@@ -103,43 +109,45 @@ const PaymentMethodForm = class {
|
|
|
103
109
|
const messagePayload = messageEvent.data;
|
|
104
110
|
const messageType = messagePayload.eventType;
|
|
105
111
|
const messageData = messagePayload.data;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.paymentMethodFormReady.emit(messageData);
|
|
109
|
-
break;
|
|
110
|
-
case DispatchedEventTypes.change:
|
|
111
|
-
this.paymentMethodFormChange.emit(messageData);
|
|
112
|
-
break;
|
|
113
|
-
case DispatchedEventTypes.blur:
|
|
114
|
-
this.paymentMethodFormBlur.emit(messageData);
|
|
115
|
-
break;
|
|
112
|
+
if (messageType === MessageEventType[this.paymentMethodFormType].ready) {
|
|
113
|
+
this.paymentMethodFormReady.emit(messageData);
|
|
116
114
|
}
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
if (this.iframeElement && this.iframeElement.contentWindow) {
|
|
120
|
-
this.iframeElement.contentWindow.postMessage({
|
|
121
|
-
eventType: DispatchedEventTypes.tokenize,
|
|
122
|
-
clientKey: clientKey,
|
|
123
|
-
paymentMethodMetadata: paymentMethodMetadata,
|
|
124
|
-
account: account
|
|
125
|
-
}, '*');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async tokenize(clientKey, paymentMethodMetadata, account) {
|
|
116
|
+
async postMessageWithResponseListener(eventType, payload) {
|
|
129
117
|
return new Promise((resolve) => {
|
|
130
|
-
const
|
|
131
|
-
if (event.data.eventType !==
|
|
118
|
+
const responseListener = (event) => {
|
|
119
|
+
if (event.data.eventType !== eventType)
|
|
132
120
|
return;
|
|
133
|
-
window.removeEventListener('message',
|
|
121
|
+
window.removeEventListener('message', responseListener);
|
|
134
122
|
resolve(event.data.data);
|
|
135
123
|
};
|
|
136
|
-
window.addEventListener('message',
|
|
137
|
-
this.
|
|
124
|
+
window.addEventListener('message', responseListener);
|
|
125
|
+
this.iframeElement.contentWindow.postMessage(Object.assign({ eventType: eventType }, payload), '*');
|
|
138
126
|
});
|
|
139
127
|
}
|
|
128
|
+
async tokenize(clientKey, paymentMethodMetadata, account) {
|
|
129
|
+
const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
|
|
130
|
+
const payload = {
|
|
131
|
+
clientKey: clientKey,
|
|
132
|
+
paymentMethodMetadata: paymentMethodMetadata,
|
|
133
|
+
account: account
|
|
134
|
+
};
|
|
135
|
+
return this.postMessageWithResponseListener(eventType, payload);
|
|
136
|
+
}
|
|
137
|
+
;
|
|
138
|
+
async validate() {
|
|
139
|
+
return this.postMessageWithResponseListener(MessageEventType[this.paymentMethodFormType].validate);
|
|
140
|
+
}
|
|
140
141
|
;
|
|
142
|
+
getIframeSrc() {
|
|
143
|
+
let iframeSrc = `https://js.justifi.ai/v2/${this.paymentMethodFormType}`;
|
|
144
|
+
if (this.paymentMethodFormValidationStrategy) {
|
|
145
|
+
iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
|
|
146
|
+
}
|
|
147
|
+
return iframeSrc;
|
|
148
|
+
}
|
|
141
149
|
render() {
|
|
142
|
-
return (h(Host, null, h("iframe", { id:
|
|
150
|
+
return (h(Host, null, h("iframe", { id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: (el) => this.iframeElement = el })));
|
|
143
151
|
}
|
|
144
152
|
};
|
|
145
153
|
PaymentMethodForm.style = paymentMethodFormCss;
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-3d88d85c.js';
|
|
2
|
+
export { s as setNonce } from './index-3d88d85c.js';
|
|
2
3
|
|
|
3
4
|
/*
|
|
4
|
-
Stencil Client Patch Esm v2.
|
|
5
|
+
Stencil Client Patch Esm v2.22.1 | MIT Licensed | https://stenciljs.com
|
|
5
6
|
*/
|
|
6
7
|
const patchEsm = () => {
|
|
7
8
|
return promiseResolve();
|
|
@@ -10,7 +11,7 @@ const patchEsm = () => {
|
|
|
10
11
|
const defineCustomElements = (win, options) => {
|
|
11
12
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
13
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["justifi-bank-account-form_4",[[0,"justifi-bank-account-form",{"
|
|
14
|
+
return bootstrapLazy([["justifi-bank-account-form_4",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}],[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"tokenize":[64],"validate":[64]}]]]], options);
|
|
14
15
|
});
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@",VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.slice(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
|
|
1
|
+
var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@",VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.slice(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-3d88d85c.js';
|
|
2
|
+
export { s as setNonce } from './index-3d88d85c.js';
|
|
2
3
|
|
|
3
4
|
/*
|
|
4
|
-
Stencil Client Patch Browser v2.
|
|
5
|
+
Stencil Client Patch Browser v2.22.1 | MIT Licensed | https://stenciljs.com
|
|
5
6
|
*/
|
|
6
7
|
const patchBrowser = () => {
|
|
7
8
|
const importMeta = import.meta.url;
|
|
@@ -13,5 +14,5 @@ const patchBrowser = () => {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["justifi-bank-account-form_4",[[0,"justifi-bank-account-form",{"
|
|
17
|
+
return bootstrapLazy([["justifi-bank-account-form_4",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}],[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"tokenize":[64],"validate":[64]}]]]], options);
|
|
17
18
|
});
|
package/dist/types/api/Api.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare enum PaymentDisputedStatuses {
|
|
|
22
22
|
export interface IPaymentMethod {
|
|
23
23
|
card?: ICard;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
25
|
+
export type CardBrand = 'american_express' | 'diners_club' | 'discover' | 'jcb' | 'mastercard' | 'china_unionpay' | 'visa' | 'unknown';
|
|
26
26
|
export interface ICard {
|
|
27
27
|
id: string;
|
|
28
28
|
acct_last_four: string;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
export declare class BankAccountForm {
|
|
3
|
-
|
|
3
|
+
validationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
4
4
|
bankAccountFormReady: EventEmitter;
|
|
5
|
-
bankAccountFormChange: EventEmitter;
|
|
6
|
-
bankAccountFormBlur: EventEmitter;
|
|
7
5
|
bankAccountFormTokenize: EventEmitter<{
|
|
8
6
|
data: any;
|
|
9
7
|
}>;
|
|
8
|
+
bankAccountFormValidate: EventEmitter<{
|
|
9
|
+
data: {
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
10
13
|
readyHandler(event: CustomEvent): void;
|
|
11
|
-
changeHandler(event: CustomEvent): void;
|
|
12
|
-
blurHandler(event: CustomEvent): void;
|
|
13
14
|
tokenizeHandler(event: {
|
|
14
15
|
data: any;
|
|
15
16
|
}): void;
|
|
17
|
+
validateHandler(event: {
|
|
18
|
+
data: any;
|
|
19
|
+
}): void;
|
|
16
20
|
private childRef?;
|
|
17
21
|
tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<any>;
|
|
22
|
+
validate(): Promise<any>;
|
|
18
23
|
render(): any;
|
|
19
24
|
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
export declare class CardForm {
|
|
3
|
-
|
|
3
|
+
validationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
4
4
|
cardFormReady: EventEmitter;
|
|
5
|
-
cardFormChange: EventEmitter;
|
|
6
|
-
cardFormBlur: EventEmitter;
|
|
7
5
|
cardFormTokenize: EventEmitter<{
|
|
8
6
|
data: any;
|
|
9
7
|
}>;
|
|
8
|
+
cardFormValidate: EventEmitter<{
|
|
9
|
+
data: {
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
|
10
13
|
readyHandler(event: CustomEvent): void;
|
|
11
|
-
changeHandler(event: CustomEvent): void;
|
|
12
|
-
blurHandler(event: CustomEvent): void;
|
|
13
14
|
tokenizeHandler(event: {
|
|
14
15
|
data: any;
|
|
15
16
|
}): void;
|
|
17
|
+
validateHandler(event: {
|
|
18
|
+
data: any;
|
|
19
|
+
}): void;
|
|
16
20
|
private childRef?;
|
|
17
21
|
tokenize(...args: Parameters<HTMLJustifiPaymentMethodFormElement['tokenize']>): Promise<any>;
|
|
22
|
+
validate(): Promise<any>;
|
|
18
23
|
render(): any;
|
|
19
24
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
export declare class PaymentMethodForm {
|
|
3
|
-
|
|
3
|
+
paymentMethodFormType: 'card' | 'bankAccount';
|
|
4
|
+
paymentMethodFormValidationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
4
5
|
paymentMethodFormReady: EventEmitter;
|
|
5
|
-
paymentMethodFormChange: EventEmitter;
|
|
6
|
-
paymentMethodFormBlur: EventEmitter;
|
|
7
6
|
paymentMethodFormTokenize: EventEmitter<{
|
|
8
7
|
data: any;
|
|
9
8
|
}>;
|
|
@@ -11,7 +10,9 @@ export declare class PaymentMethodForm {
|
|
|
11
10
|
connectedCallback(): void;
|
|
12
11
|
disconnectedCallback(): void;
|
|
13
12
|
private dispatchMessageEvent;
|
|
14
|
-
private
|
|
13
|
+
private postMessageWithResponseListener;
|
|
15
14
|
tokenize(clientKey: string, paymentMethodMetadata: any, account?: string): Promise<any>;
|
|
15
|
+
validate(): Promise<any>;
|
|
16
|
+
private getIframeSrc;
|
|
16
17
|
render(): any;
|
|
17
18
|
}
|
|
@@ -7,16 +7,20 @@
|
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
export namespace Components {
|
|
9
9
|
interface JustifiBankAccountForm {
|
|
10
|
-
"iframeOrigin": string;
|
|
11
10
|
"tokenize": (clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
|
|
11
|
+
"validate": () => Promise<any>;
|
|
12
|
+
"validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
12
13
|
}
|
|
13
14
|
interface JustifiCardForm {
|
|
14
|
-
"iframeOrigin": string;
|
|
15
15
|
"tokenize": (clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
|
|
16
|
+
"validate": () => Promise<any>;
|
|
17
|
+
"validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
16
18
|
}
|
|
17
19
|
interface JustifiPaymentMethodForm {
|
|
18
|
-
"
|
|
20
|
+
"paymentMethodFormType": 'card' | 'bankAccount';
|
|
21
|
+
"paymentMethodFormValidationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
19
22
|
"tokenize": (clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
|
|
23
|
+
"validate": () => Promise<any>;
|
|
20
24
|
}
|
|
21
25
|
interface JustifiPaymentsList {
|
|
22
26
|
"accountId": string;
|
|
@@ -69,25 +73,22 @@ declare global {
|
|
|
69
73
|
}
|
|
70
74
|
declare namespace LocalJSX {
|
|
71
75
|
interface JustifiBankAccountForm {
|
|
72
|
-
"iframeOrigin"?: string;
|
|
73
|
-
"onBankAccountFormBlur"?: (event: JustifiBankAccountFormCustomEvent<any>) => void;
|
|
74
|
-
"onBankAccountFormChange"?: (event: JustifiBankAccountFormCustomEvent<any>) => void;
|
|
75
76
|
"onBankAccountFormReady"?: (event: JustifiBankAccountFormCustomEvent<any>) => void;
|
|
76
77
|
"onBankAccountFormTokenize"?: (event: JustifiBankAccountFormCustomEvent<{ data: any }>) => void;
|
|
78
|
+
"onBankAccountFormValidate"?: (event: JustifiBankAccountFormCustomEvent<{ data: { isValid: boolean } }>) => void;
|
|
79
|
+
"validationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
77
80
|
}
|
|
78
81
|
interface JustifiCardForm {
|
|
79
|
-
"iframeOrigin"?: string;
|
|
80
|
-
"onCardFormBlur"?: (event: JustifiCardFormCustomEvent<any>) => void;
|
|
81
|
-
"onCardFormChange"?: (event: JustifiCardFormCustomEvent<any>) => void;
|
|
82
82
|
"onCardFormReady"?: (event: JustifiCardFormCustomEvent<any>) => void;
|
|
83
83
|
"onCardFormTokenize"?: (event: JustifiCardFormCustomEvent<{ data: any }>) => void;
|
|
84
|
+
"onCardFormValidate"?: (event: JustifiCardFormCustomEvent<{ data: { isValid: boolean } }>) => void;
|
|
85
|
+
"validationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
84
86
|
}
|
|
85
87
|
interface JustifiPaymentMethodForm {
|
|
86
|
-
"iframeOrigin"?: string;
|
|
87
|
-
"onPaymentMethodFormBlur"?: (event: JustifiPaymentMethodFormCustomEvent<any>) => void;
|
|
88
|
-
"onPaymentMethodFormChange"?: (event: JustifiPaymentMethodFormCustomEvent<any>) => void;
|
|
89
88
|
"onPaymentMethodFormReady"?: (event: JustifiPaymentMethodFormCustomEvent<any>) => void;
|
|
90
89
|
"onPaymentMethodFormTokenize"?: (event: JustifiPaymentMethodFormCustomEvent<{ data: any }>) => void;
|
|
90
|
+
"paymentMethodFormType"?: 'card' | 'bankAccount';
|
|
91
|
+
"paymentMethodFormValidationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
|
|
91
92
|
}
|
|
92
93
|
interface JustifiPaymentsList {
|
|
93
94
|
"accountId"?: string;
|
|
@@ -133,7 +133,7 @@ export interface ListenOptions {
|
|
|
133
133
|
*/
|
|
134
134
|
passive?: boolean;
|
|
135
135
|
}
|
|
136
|
-
export
|
|
136
|
+
export type ListenTargetOptions = 'body' | 'document' | 'window';
|
|
137
137
|
export interface StateDecorator {
|
|
138
138
|
(): PropertyDecorator;
|
|
139
139
|
}
|
|
@@ -214,8 +214,8 @@ export declare const State: StateDecorator;
|
|
|
214
214
|
* https://stenciljs.com/docs/reactive-data#watch-decorator
|
|
215
215
|
*/
|
|
216
216
|
export declare const Watch: WatchDecorator;
|
|
217
|
-
export
|
|
218
|
-
export
|
|
217
|
+
export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
|
|
218
|
+
export type ErrorHandler = (err: any, element?: HTMLElement) => void;
|
|
219
219
|
/**
|
|
220
220
|
* `setMode()` is used for libraries which provide multiple "modes" for styles.
|
|
221
221
|
*/
|
|
@@ -257,6 +257,15 @@ export declare function getAssetPath(path: string): string;
|
|
|
257
257
|
* @returns the set path
|
|
258
258
|
*/
|
|
259
259
|
export declare function setAssetPath(path: string): string;
|
|
260
|
+
/**
|
|
261
|
+
* Used to specify a nonce value that corresponds with an application's
|
|
262
|
+
* [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
|
|
263
|
+
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
264
|
+
* Alternatively, the nonce value can be set on a `meta` tag in the DOM head
|
|
265
|
+
* (<meta name="csp-nonce" content="{ nonce value here }" />) and will result in the same behavior.
|
|
266
|
+
* @param nonce The value to be used for the nonce attribute.
|
|
267
|
+
*/
|
|
268
|
+
export declare function setNonce(nonce: string): void;
|
|
260
269
|
/**
|
|
261
270
|
* Retrieve a Stencil element for a given reference
|
|
262
271
|
* @param ref the ref to get the Stencil element for
|
|
@@ -433,8 +442,44 @@ interface HostAttributes {
|
|
|
433
442
|
ref?: (el: HTMLElement | null) => void;
|
|
434
443
|
[prop: string]: any;
|
|
435
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* Utilities for working with functional Stencil components. An object
|
|
447
|
+
* conforming to this interface is passed by the Stencil runtime as the third
|
|
448
|
+
* argument to a functional component, allowing component authors to work with
|
|
449
|
+
* features like children.
|
|
450
|
+
*
|
|
451
|
+
* The children of a functional component will be passed as the second
|
|
452
|
+
* argument, so a functional component which uses these utils to transform its
|
|
453
|
+
* children might look like the following:
|
|
454
|
+
*
|
|
455
|
+
* ```ts
|
|
456
|
+
* export const AddClass: FunctionalComponent = (_, children, utils) => (
|
|
457
|
+
* utils.map(children, child => ({
|
|
458
|
+
* ...child,
|
|
459
|
+
* vattrs: {
|
|
460
|
+
* ...child.vattrs,
|
|
461
|
+
* class: `${child.vattrs.class} add-class`
|
|
462
|
+
* }
|
|
463
|
+
* }))
|
|
464
|
+
* );
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* For more see the Stencil documentation, here:
|
|
468
|
+
* https://stenciljs.com/docs/functional-components
|
|
469
|
+
*/
|
|
436
470
|
export interface FunctionalUtilities {
|
|
471
|
+
/**
|
|
472
|
+
* Utility for reading the children of a functional component at runtime.
|
|
473
|
+
* Since the Stencil runtime uses a different interface for children it is
|
|
474
|
+
* not recommendeded to read the children directly, and is preferable to use
|
|
475
|
+
* this utility to, for instance, perform a side effect for each child.
|
|
476
|
+
*/
|
|
437
477
|
forEach: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => void) => void;
|
|
478
|
+
/**
|
|
479
|
+
* Utility for transforming the children of a functional component. Given an
|
|
480
|
+
* array of children and a callback this will return a list of the results of
|
|
481
|
+
* passing each child to the supplied callback.
|
|
482
|
+
*/
|
|
438
483
|
map: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => ChildNode) => VNode[];
|
|
439
484
|
}
|
|
440
485
|
export interface FunctionalComponent<T = {}> {
|