@justifi/webcomponents 0.0.10 → 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.
Files changed (44) hide show
  1. package/dist/cjs/{index-68222998.js → index-4f753ffd.js} +32 -1
  2. package/dist/cjs/index.cjs.js +0 -10
  3. package/dist/cjs/justifi-bank-account-form_4.cjs.entry.js +4352 -42
  4. package/dist/cjs/loader.cjs.js +4 -3
  5. package/dist/cjs/webcomponents.cjs.js +7 -3
  6. package/dist/collection/collection-manifest.json +4 -4
  7. package/dist/collection/components/bank-account-form/bank-account-form.js +43 -45
  8. package/dist/collection/components/card-form/card-form.js +66 -39
  9. package/dist/collection/components/payment-method-form/message-event-types.js +12 -0
  10. package/dist/collection/components/payment-method-form/payment-method-form.js +68 -73
  11. package/dist/collection/index.js +1 -3
  12. package/dist/components/index.d.ts +9 -0
  13. package/dist/components/index.js +4 -4
  14. package/dist/components/justifi-bank-account-form.js +17 -14
  15. package/dist/components/justifi-card-form.js +23 -11
  16. package/dist/components/justifi-payments-list.js +1 -1
  17. package/dist/components/payment-method-form.js +48 -39
  18. package/dist/esm/{index-e279d85e.js → index-3d88d85c.js} +32 -2
  19. package/dist/esm/index.js +1 -2
  20. package/dist/esm/justifi-bank-account-form_4.entry.js +4350 -40
  21. package/dist/esm/loader.js +4 -3
  22. package/dist/esm/polyfills/css-shim.js +1 -1
  23. package/dist/esm/webcomponents.js +4 -3
  24. package/dist/types/api/Api.d.ts +1 -1
  25. package/dist/types/api/Payment.d.ts +1 -1
  26. package/dist/types/components/bank-account-form/bank-account-form.d.ts +10 -5
  27. package/dist/types/components/card-form/card-form.d.ts +14 -3
  28. package/dist/types/components/payment-method-form/message-event-types.d.ts +12 -0
  29. package/dist/types/components/payment-method-form/payment-method-form.d.ts +5 -4
  30. package/dist/types/components.d.ts +13 -12
  31. package/dist/types/index.d.ts +1 -4
  32. package/dist/types/stencil-public-runtime.d.ts +48 -3
  33. package/dist/webcomponents/index.esm.js +0 -1
  34. package/dist/webcomponents/p-8ad58e9a.entry.js +1 -0
  35. package/dist/webcomponents/p-de108437.js +2 -0
  36. package/dist/webcomponents/webcomponents.esm.js +1 -1
  37. package/loader/index.d.ts +9 -0
  38. package/package.json +2 -3
  39. package/dist/cjs/payments-list-d2dfcef1.js +0 -4298
  40. package/dist/collection/components/card-form/card-form.css +0 -3
  41. package/dist/esm/payments-list-91eba70b.js +0 -4294
  42. package/dist/webcomponents/p-146348d6.js +0 -2
  43. package/dist/webcomponents/p-a688f9d3.entry.js +0 -1
  44. package/dist/webcomponents/p-c94a0f7f.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;
@@ -1,12 +1,2 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const paymentsList = require('./payments-list-d2dfcef1.js');
6
- require('./index-68222998.js');
7
-
8
-
9
-
10
- exports.BankAccountForm = paymentsList.BankAccountForm;
11
- exports.CardForm = paymentsList.CardForm;
12
- exports.PaymentsList = paymentsList.PaymentsList;