@justifi/webcomponents 0.0.11 → 0.0.13

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.
Files changed (35) hide show
  1. package/dist/cjs/{index-68222998.js → index-4f753ffd.js} +32 -1
  2. package/dist/cjs/justifi-bank-account-form_4.cjs.entry.js +74 -60
  3. package/dist/cjs/loader.cjs.js +4 -3
  4. package/dist/cjs/webcomponents.cjs.js +7 -3
  5. package/dist/collection/collection-manifest.json +2 -2
  6. package/dist/collection/components/bank-account-form/bank-account-form.js +43 -45
  7. package/dist/collection/components/card-form/card-form.js +43 -55
  8. package/dist/collection/components/payment-method-form/message-event-types.js +14 -0
  9. package/dist/collection/components/payment-method-form/payment-method-form.js +76 -72
  10. package/dist/components/index.d.ts +9 -0
  11. package/dist/components/index.js +1 -1
  12. package/dist/components/justifi-bank-account-form.js +16 -13
  13. package/dist/components/justifi-card-form.js +16 -16
  14. package/dist/components/payment-method-form.js +54 -38
  15. package/dist/esm/{index-e279d85e.js → index-3d88d85c.js} +32 -2
  16. package/dist/esm/justifi-bank-account-form_4.entry.js +74 -60
  17. package/dist/esm/loader.js +4 -3
  18. package/dist/esm/polyfills/css-shim.js +1 -1
  19. package/dist/esm/webcomponents.js +4 -3
  20. package/dist/types/api/Api.d.ts +1 -1
  21. package/dist/types/api/Payment.d.ts +1 -1
  22. package/dist/types/components/bank-account-form/bank-account-form.d.ts +10 -5
  23. package/dist/types/components/card-form/card-form.d.ts +10 -5
  24. package/dist/types/components/payment-method-form/message-event-types.d.ts +14 -0
  25. package/dist/types/components/payment-method-form/payment-method-form.d.ts +6 -4
  26. package/dist/types/components.d.ts +13 -12
  27. package/dist/types/stencil-public-runtime.d.ts +48 -3
  28. package/dist/webcomponents/p-338453e1.entry.js +1 -0
  29. package/dist/webcomponents/p-de108437.js +2 -0
  30. package/dist/webcomponents/webcomponents.esm.js +1 -1
  31. package/loader/index.d.ts +9 -0
  32. package/package.json +1 -1
  33. package/dist/collection/components/card-form/card-form.css +0 -3
  34. package/dist/webcomponents/p-146348d6.js +0 -2
  35. package/dist/webcomponents/p-a967d55b.entry.js +0 -1
@@ -63,6 +63,18 @@ const isComplexType = (o) => {
63
63
  o = typeof o;
64
64
  return o === 'object' || o === 'function';
65
65
  };
66
+ /**
67
+ * Helper method for querying a `meta` tag that contains a nonce value
68
+ * out of a DOM's head.
69
+ *
70
+ * @param doc The DOM containing the `head` to query against
71
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
72
+ * exists or the tag has no content.
73
+ */
74
+ function queryNonceMetaTagContent(doc) {
75
+ var _a, _b, _c;
76
+ 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;
77
+ }
66
78
  /**
67
79
  * Production h() function based on Preact by
68
80
  * Jason Miller (@developit)
@@ -71,7 +83,6 @@ const isComplexType = (o) => {
71
83
  *
72
84
  * Modified for Stencil's compiler and vdom
73
85
  */
74
- // const stack: any[] = [];
75
86
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
76
87
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
77
88
  const h = (nodeName, vnodeData, ...children) => {
@@ -219,6 +230,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
219
230
  styles.set(scopeId, style);
220
231
  };
221
232
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
233
+ var _a;
222
234
  let scopeId = getScopeId(cmpMeta);
223
235
  const style = styles.get(scopeId);
224
236
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -238,6 +250,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
238
250
  styleElm = doc.createElement('style');
239
251
  styleElm.innerHTML = style;
240
252
  }
253
+ // Apply CSP nonce to the style tag if it exists
254
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
255
+ if (nonce != null) {
256
+ styleElm.setAttribute('nonce', nonce);
257
+ }
241
258
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
242
259
  }
243
260
  if (appliedStyles) {
@@ -1158,6 +1175,7 @@ const disconnectedCallback = (elm) => {
1158
1175
  }
1159
1176
  };
1160
1177
  const bootstrapLazy = (lazyBundles, options = {}) => {
1178
+ var _a;
1161
1179
  const endBootstrap = createTime();
1162
1180
  const cmpTags = [];
1163
1181
  const exclude = options.exclude || [];
@@ -1237,6 +1255,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1237
1255
  {
1238
1256
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1239
1257
  visibilityStyle.setAttribute('data-styles', '');
1258
+ // Apply CSP nonce to the style tag if it exists
1259
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1260
+ if (nonce != null) {
1261
+ visibilityStyle.setAttribute('nonce', nonce);
1262
+ }
1240
1263
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1241
1264
  }
1242
1265
  // Process deferred connectedCallbacks now all components have been registered
@@ -1281,6 +1304,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1281
1304
  };
1282
1305
  // prettier-ignore
1283
1306
  const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1307
+ /**
1308
+ * Assigns the given value to the nonce property on the runtime platform object.
1309
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1310
+ * @param nonce The value to be assigned to the platform nonce property.
1311
+ * @returns void
1312
+ */
1313
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1284
1314
  const hostRefs = /*@__PURE__*/ new WeakMap();
1285
1315
  const getHostRef = (ref) => hostRefs.get(ref);
1286
1316
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1397,3 +1427,4 @@ exports.createEvent = createEvent;
1397
1427
  exports.h = h;
1398
1428
  exports.promiseResolve = promiseResolve;
1399
1429
  exports.registerInstance = registerInstance;
1430
+ exports.setNonce = setNonce;
@@ -2,100 +2,109 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-68222998.js');
5
+ const index = require('./index-4f753ffd.js');
6
6
 
7
7
  const BankAccountForm = class {
8
8
  constructor(hostRef) {
9
9
  index.registerInstance(this, hostRef);
10
10
  this.bankAccountFormReady = index.createEvent(this, "bankAccountFormReady", 7);
11
- this.bankAccountFormChange = index.createEvent(this, "bankAccountFormChange", 7);
12
- this.bankAccountFormBlur = index.createEvent(this, "bankAccountFormBlur", 7);
13
11
  this.bankAccountFormTokenize = index.createEvent(this, "bankAccountFormTokenize", 7);
14
- this.iframeOrigin = undefined;
12
+ this.bankAccountFormValidate = index.createEvent(this, "bankAccountFormValidate", 7);
13
+ this.validationStrategy = undefined;
15
14
  }
16
15
  readyHandler(event) {
17
16
  this.bankAccountFormReady.emit(event);
18
17
  }
19
- changeHandler(event) {
20
- this.bankAccountFormChange.emit(event);
21
- }
22
- blurHandler(event) {
23
- this.bankAccountFormBlur.emit(event);
24
- }
25
18
  tokenizeHandler(event) {
26
19
  this.bankAccountFormTokenize.emit(event);
27
20
  }
21
+ validateHandler(event) {
22
+ this.bankAccountFormValidate.emit(event);
23
+ }
28
24
  async tokenize(...args) {
29
25
  if (!this.childRef) {
30
26
  throw new Error('Cannot call tokenize');
31
27
  }
32
28
  return this.childRef.tokenize(...args);
33
29
  }
30
+ async validate() {
31
+ if (!this.childRef) {
32
+ throw new Error('Cannot call validate');
33
+ }
34
+ return this.childRef.validate();
35
+ }
34
36
  render() {
35
37
  return (index.h("justifi-payment-method-form", { ref: el => {
36
38
  if (el) {
37
39
  this.childRef = el;
38
40
  }
39
- }, "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 }));
41
+ }, "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' }));
40
42
  }
41
43
  };
42
44
 
43
- const cardFormCss = "justifi-card-form iframe{height:55px}";
44
-
45
45
  const CardForm = class {
46
46
  constructor(hostRef) {
47
47
  index.registerInstance(this, hostRef);
48
48
  this.cardFormReady = index.createEvent(this, "cardFormReady", 7);
49
- this.cardFormChange = index.createEvent(this, "cardFormChange", 7);
50
- this.cardFormBlur = index.createEvent(this, "cardFormBlur", 7);
51
49
  this.cardFormTokenize = index.createEvent(this, "cardFormTokenize", 7);
52
- this.iframeOrigin = undefined;
50
+ this.cardFormValidate = index.createEvent(this, "cardFormValidate", 7);
51
+ this.validationStrategy = undefined;
53
52
  }
54
53
  readyHandler(event) {
55
54
  this.cardFormReady.emit(event);
56
55
  }
57
- changeHandler(event) {
58
- this.cardFormChange.emit(event);
59
- }
60
- blurHandler(event) {
61
- this.cardFormBlur.emit(event);
62
- }
63
56
  tokenizeHandler(event) {
64
57
  this.cardFormTokenize.emit(event);
65
58
  }
59
+ validateHandler(event) {
60
+ this.cardFormValidate.emit(event);
61
+ }
66
62
  async tokenize(...args) {
67
63
  if (!this.childRef) {
68
64
  throw new Error('Cannot call tokenize');
69
65
  }
70
66
  return this.childRef.tokenize(...args);
71
67
  }
68
+ async validate() {
69
+ if (!this.childRef) {
70
+ throw new Error('Cannot call validate');
71
+ }
72
+ return this.childRef.validate();
73
+ }
72
74
  render() {
73
75
  return (index.h("justifi-payment-method-form", { ref: el => {
74
76
  if (el) {
75
77
  this.childRef = el;
76
78
  }
77
- }, "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 }));
79
+ }, "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' }));
80
+ }
81
+ };
82
+
83
+ const MessageEventType = {
84
+ card: {
85
+ ready: 'justifi.card.ready',
86
+ tokenize: 'justifi.card.tokenize',
87
+ validate: 'justifi.card.validate',
88
+ resize: 'justifi.card.resize',
89
+ },
90
+ bankAccount: {
91
+ ready: 'justifi.bankAccount.ready',
92
+ tokenize: 'justifi.bankAccount.tokenize',
93
+ validate: 'justifi.bankAccount.validate',
94
+ resize: 'justifi.bankAccount.resize',
78
95
  }
79
96
  };
80
- CardForm.style = cardFormCss;
81
97
 
82
98
  const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";
83
99
 
84
- var DispatchedEventTypes;
85
- (function (DispatchedEventTypes) {
86
- DispatchedEventTypes["blur"] = "blur";
87
- DispatchedEventTypes["change"] = "change";
88
- DispatchedEventTypes["ready"] = "ready";
89
- DispatchedEventTypes["tokenize"] = "tokenize";
90
- })(DispatchedEventTypes || (DispatchedEventTypes = {}));
91
100
  const PaymentMethodForm = class {
92
101
  constructor(hostRef) {
93
102
  index.registerInstance(this, hostRef);
94
103
  this.paymentMethodFormReady = index.createEvent(this, "paymentMethodFormReady", 7);
95
- this.paymentMethodFormChange = index.createEvent(this, "paymentMethodFormChange", 7);
96
- this.paymentMethodFormBlur = index.createEvent(this, "paymentMethodFormBlur", 7);
97
104
  this.paymentMethodFormTokenize = index.createEvent(this, "paymentMethodFormTokenize", 7);
98
- this.iframeOrigin = undefined;
105
+ this.paymentMethodFormType = undefined;
106
+ this.paymentMethodFormValidationStrategy = undefined;
107
+ this.height = 55;
99
108
  }
100
109
  connectedCallback() {
101
110
  window.addEventListener('message', this.dispatchMessageEvent.bind(this));
@@ -107,43 +116,48 @@ const PaymentMethodForm = class {
107
116
  const messagePayload = messageEvent.data;
108
117
  const messageType = messagePayload.eventType;
109
118
  const messageData = messagePayload.data;
110
- switch (messageType) {
111
- case DispatchedEventTypes.ready:
112
- this.paymentMethodFormReady.emit(messageData);
113
- break;
114
- case DispatchedEventTypes.change:
115
- this.paymentMethodFormChange.emit(messageData);
116
- break;
117
- case DispatchedEventTypes.blur:
118
- this.paymentMethodFormBlur.emit(messageData);
119
- break;
119
+ if (messageType === MessageEventType[this.paymentMethodFormType].ready) {
120
+ this.paymentMethodFormReady.emit(messageData);
120
121
  }
121
- }
122
- triggerTokenization(clientKey, paymentMethodMetadata, account) {
123
- if (this.iframeElement && this.iframeElement.contentWindow) {
124
- this.iframeElement.contentWindow.postMessage({
125
- eventType: DispatchedEventTypes.tokenize,
126
- clientKey: clientKey,
127
- paymentMethodMetadata: paymentMethodMetadata,
128
- account: account
129
- }, '*');
122
+ if (messageType === MessageEventType[this.paymentMethodFormType].resize) {
123
+ this.height = messageData.height;
130
124
  }
131
125
  }
132
- async tokenize(clientKey, paymentMethodMetadata, account) {
126
+ async postMessageWithResponseListener(eventType, payload) {
133
127
  return new Promise((resolve) => {
134
- const tokenizeEventListener = (event) => {
135
- if (event.data.eventType !== DispatchedEventTypes.tokenize)
128
+ const responseListener = (event) => {
129
+ if (event.data.eventType !== eventType)
136
130
  return;
137
- window.removeEventListener('message', tokenizeEventListener);
131
+ window.removeEventListener('message', responseListener);
138
132
  resolve(event.data.data);
139
133
  };
140
- window.addEventListener('message', tokenizeEventListener);
141
- this.triggerTokenization(clientKey, paymentMethodMetadata, account);
134
+ window.addEventListener('message', responseListener);
135
+ this.iframeElement.contentWindow.postMessage(Object.assign({ eventType: eventType }, payload), '*');
142
136
  });
143
137
  }
138
+ async tokenize(clientKey, paymentMethodMetadata, account) {
139
+ const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
140
+ const payload = {
141
+ clientKey: clientKey,
142
+ paymentMethodMetadata: paymentMethodMetadata,
143
+ account: account
144
+ };
145
+ return this.postMessageWithResponseListener(eventType, payload);
146
+ }
147
+ ;
148
+ async validate() {
149
+ return this.postMessageWithResponseListener(MessageEventType[this.paymentMethodFormType].validate);
150
+ }
144
151
  ;
152
+ getIframeSrc() {
153
+ let iframeSrc = `https://js.justifi.ai/v2/${this.paymentMethodFormType}`;
154
+ if (this.paymentMethodFormValidationStrategy) {
155
+ iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
156
+ }
157
+ return iframeSrc;
158
+ }
145
159
  render() {
146
- return (index.h(index.Host, null, index.h("iframe", { id: "justifi-payment-method-form", src: this.iframeOrigin, ref: (el) => this.iframeElement = el })));
160
+ return (index.h(index.Host, null, index.h("iframe", { id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: (el) => this.iframeElement = el, height: this.height })));
147
161
  }
148
162
  };
149
163
  PaymentMethodForm.style = paymentMethodFormCss;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-68222998.js');
5
+ const index = require('./index-4f753ffd.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.22.1 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -14,8 +14,9 @@ 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-bank-account-form_4.cjs",[[0,"justifi-bank-account-form",{"iframeOrigin":[1,"iframe-origin"],"tokenize":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormChange","changeHandler"],[0,"paymentMethodFormBlur","blurHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"]]],[0,"justifi-card-form",{"iframeOrigin":[1,"iframe-origin"],"tokenize":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormChange","changeHandler"],[0,"paymentMethodFormBlur","blurHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"]]],[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}],[0,"justifi-payment-method-form",{"iframeOrigin":[1,"iframe-origin"],"tokenize":[64]}]]]], options);
17
+ return index.bootstrapLazy([["justifi-bank-account-form_4.cjs",[[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"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
18
18
  });
19
19
  };
20
20
 
21
+ exports.setNonce = index.setNonce;
21
22
  exports.defineCustomElements = defineCustomElements;
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-68222998.js');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4f753ffd.js');
4
6
 
5
7
  /*
6
- Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v2.22.1 | MIT Licensed | https://stenciljs.com
7
9
  */
8
10
  const patchBrowser = () => {
9
11
  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));
@@ -15,5 +17,7 @@ const patchBrowser = () => {
15
17
  };
16
18
 
17
19
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["justifi-bank-account-form_4.cjs",[[0,"justifi-bank-account-form",{"iframeOrigin":[1,"iframe-origin"],"tokenize":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormChange","changeHandler"],[0,"paymentMethodFormBlur","blurHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"]]],[0,"justifi-card-form",{"iframeOrigin":[1,"iframe-origin"],"tokenize":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormChange","changeHandler"],[0,"paymentMethodFormBlur","blurHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"]]],[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}],[0,"justifi-payment-method-form",{"iframeOrigin":[1,"iframe-origin"],"tokenize":[64]}]]]], options);
20
+ return index.bootstrapLazy([["justifi-bank-account-form_4.cjs",[[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"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
19
21
  });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -7,8 +7,8 @@
7
7
  ],
8
8
  "compiler": {
9
9
  "name": "@stencil/core",
10
- "version": "2.20.0",
11
- "typescriptVersion": "4.8.4"
10
+ "version": "2.22.1",
11
+ "typescriptVersion": "4.9.4"
12
12
  },
13
13
  "collections": [],
14
14
  "bundles": []
@@ -1,42 +1,45 @@
1
1
  import { h } from '@stencil/core';
2
2
  export class BankAccountForm {
3
3
  constructor() {
4
- this.iframeOrigin = undefined;
4
+ this.validationStrategy = undefined;
5
5
  }
6
6
  readyHandler(event) {
7
7
  this.bankAccountFormReady.emit(event);
8
8
  }
9
- changeHandler(event) {
10
- this.bankAccountFormChange.emit(event);
11
- }
12
- blurHandler(event) {
13
- this.bankAccountFormBlur.emit(event);
14
- }
15
9
  tokenizeHandler(event) {
16
10
  this.bankAccountFormTokenize.emit(event);
17
11
  }
12
+ validateHandler(event) {
13
+ this.bankAccountFormValidate.emit(event);
14
+ }
18
15
  async tokenize(...args) {
19
16
  if (!this.childRef) {
20
17
  throw new Error('Cannot call tokenize');
21
18
  }
22
19
  return this.childRef.tokenize(...args);
23
20
  }
21
+ async validate() {
22
+ if (!this.childRef) {
23
+ throw new Error('Cannot call validate');
24
+ }
25
+ return this.childRef.validate();
26
+ }
24
27
  render() {
25
28
  return (h("justifi-payment-method-form", { ref: el => {
26
29
  if (el) {
27
30
  this.childRef = el;
28
31
  }
29
- }, "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 }));
32
+ }, "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' }));
30
33
  }
31
34
  static get is() { return "justifi-bank-account-form"; }
32
35
  static get properties() {
33
36
  return {
34
- "iframeOrigin": {
37
+ "validationStrategy": {
35
38
  "type": "string",
36
39
  "mutable": false,
37
40
  "complexType": {
38
- "original": "string",
39
- "resolved": "string",
41
+ "original": "'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all'",
42
+ "resolved": "\"all\" | \"onBlur\" | \"onChange\" | \"onSubmit\" | \"onTouched\"",
40
43
  "references": {}
41
44
  },
42
45
  "required": false,
@@ -45,7 +48,7 @@ export class BankAccountForm {
45
48
  "tags": [],
46
49
  "text": ""
47
50
  },
48
- "attribute": "iframe-origin",
51
+ "attribute": "validation-strategy",
49
52
  "reflect": false
50
53
  }
51
54
  };
@@ -67,8 +70,8 @@ export class BankAccountForm {
67
70
  "references": {}
68
71
  }
69
72
  }, {
70
- "method": "bankAccountFormChange",
71
- "name": "bankAccountFormChange",
73
+ "method": "bankAccountFormTokenize",
74
+ "name": "bankAccountFormTokenize",
72
75
  "bubbles": true,
73
76
  "cancelable": true,
74
77
  "composed": true,
@@ -77,13 +80,13 @@ export class BankAccountForm {
77
80
  "text": ""
78
81
  },
79
82
  "complexType": {
80
- "original": "any",
81
- "resolved": "any",
83
+ "original": "{ data: any }",
84
+ "resolved": "{ data: any; }",
82
85
  "references": {}
83
86
  }
84
87
  }, {
85
- "method": "bankAccountFormBlur",
86
- "name": "bankAccountFormBlur",
88
+ "method": "bankAccountFormValidate",
89
+ "name": "bankAccountFormValidate",
87
90
  "bubbles": true,
88
91
  "cancelable": true,
89
92
  "composed": true,
@@ -92,23 +95,8 @@ export class BankAccountForm {
92
95
  "text": ""
93
96
  },
94
97
  "complexType": {
95
- "original": "any",
96
- "resolved": "any",
97
- "references": {}
98
- }
99
- }, {
100
- "method": "bankAccountFormTokenize",
101
- "name": "bankAccountFormTokenize",
102
- "bubbles": true,
103
- "cancelable": true,
104
- "composed": true,
105
- "docs": {
106
- "tags": [],
107
- "text": ""
108
- },
109
- "complexType": {
110
- "original": "{ data: any }",
111
- "resolved": "{ data: any; }",
98
+ "original": "{ data: { isValid: boolean } }",
99
+ "resolved": "{ data: { isValid: boolean; }; }",
112
100
  "references": {}
113
101
  }
114
102
  }];
@@ -139,6 +127,22 @@ export class BankAccountForm {
139
127
  "text": "",
140
128
  "tags": []
141
129
  }
130
+ },
131
+ "validate": {
132
+ "complexType": {
133
+ "signature": "() => Promise<any>",
134
+ "parameters": [],
135
+ "references": {
136
+ "Promise": {
137
+ "location": "global"
138
+ }
139
+ },
140
+ "return": "Promise<any>"
141
+ },
142
+ "docs": {
143
+ "text": "",
144
+ "tags": []
145
+ }
142
146
  }
143
147
  };
144
148
  }
@@ -150,20 +154,14 @@ export class BankAccountForm {
150
154
  "capture": false,
151
155
  "passive": false
152
156
  }, {
153
- "name": "paymentMethodFormChange",
154
- "method": "changeHandler",
155
- "target": undefined,
156
- "capture": false,
157
- "passive": false
158
- }, {
159
- "name": "paymentMethodFormBlur",
160
- "method": "blurHandler",
157
+ "name": "paymentMethodFormTokenize",
158
+ "method": "tokenizeHandler",
161
159
  "target": undefined,
162
160
  "capture": false,
163
161
  "passive": false
164
162
  }, {
165
- "name": "paymentMethodFormTokenize",
166
- "method": "tokenizeHandler",
163
+ "name": "paymentMethodFormValidate",
164
+ "method": "validateHandler",
167
165
  "target": undefined,
168
166
  "capture": false,
169
167
  "passive": false