@justifi/webcomponents 4.0.5 → 4.2.0

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 (268) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/Api-11362403.js +111 -0
  3. package/dist/cjs/Api-11362403.js.map +1 -0
  4. package/dist/cjs/Payment-ac4dea02.js +2 -0
  5. package/dist/cjs/Payment-ac4dea02.js.map +1 -0
  6. package/dist/cjs/{index-051b6dd0.js → index-34312a38.js} +185 -21
  7. package/dist/cjs/index-34312a38.js.map +1 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/index.cjs.js.map +1 -0
  10. package/dist/cjs/{index.esm-8df4906e.js → index.esm-bcf90c56.js} +2 -244
  11. package/dist/cjs/index.esm-bcf90c56.js.map +1 -0
  12. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +12 -1
  13. package/dist/cjs/justifi-bank-account-form.cjs.entry.js.map +1 -0
  14. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +8 -5
  15. package/dist/cjs/justifi-billing-form_2.cjs.entry.js.map +1 -0
  16. package/dist/cjs/justifi-business-address.cjs.entry.js +7 -4
  17. package/dist/cjs/justifi-business-address.cjs.entry.js.map +1 -0
  18. package/dist/cjs/justifi-business-info.cjs.entry.js +174 -0
  19. package/dist/cjs/justifi-business-info.cjs.entry.js.map +1 -0
  20. package/dist/cjs/justifi-card-form.cjs.entry.js +12 -1
  21. package/dist/cjs/justifi-card-form.cjs.entry.js.map +1 -0
  22. package/dist/cjs/justifi-payment-form.cjs.entry.js +10 -4
  23. package/dist/cjs/justifi-payment-form.cjs.entry.js.map +1 -0
  24. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +15 -7
  25. package/dist/cjs/justifi-payment-method-form.cjs.entry.js.map +1 -0
  26. package/dist/cjs/justifi-payments-list.cjs.entry.js +5 -108
  27. package/dist/cjs/justifi-payments-list.cjs.entry.js.map +1 -0
  28. package/dist/cjs/loader.cjs.js +6 -3
  29. package/dist/cjs/loader.cjs.js.map +1 -0
  30. package/dist/cjs/select-input_2.cjs.entry.js +5 -3
  31. package/dist/cjs/select-input_2.cjs.entry.js.map +1 -0
  32. package/dist/cjs/state-options-efeaa587.js +248 -0
  33. package/dist/cjs/state-options-efeaa587.js.map +1 -0
  34. package/dist/cjs/webcomponents.cjs.js +12 -3
  35. package/dist/cjs/webcomponents.cjs.js.map +1 -0
  36. package/dist/collection/api/Api.js +2 -1
  37. package/dist/collection/api/Api.js.map +1 -0
  38. package/dist/collection/api/Pagination.js +1 -0
  39. package/dist/collection/api/Pagination.js.map +1 -0
  40. package/dist/collection/api/Payment.js +1 -0
  41. package/dist/collection/api/Payment.js.map +1 -0
  42. package/dist/collection/api/index.js +1 -0
  43. package/dist/collection/api/index.js.map +1 -0
  44. package/dist/collection/api/mockData/MockPayments.js +1 -0
  45. package/dist/collection/api/mockData/MockPayments.js.map +1 -0
  46. package/dist/collection/collection-manifest.json +4 -3
  47. package/dist/collection/components/bank-account-form/bank-account-form.js +26 -0
  48. package/dist/collection/components/bank-account-form/bank-account-form.js.map +1 -0
  49. package/dist/collection/components/bank-account-form/bank-account-form.stories.js +11 -1
  50. package/dist/collection/components/bank-account-form/bank-account-form.stories.js.map +1 -0
  51. package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js +14 -0
  52. package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js.map +1 -0
  53. package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js +48 -0
  54. package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js.map +1 -0
  55. package/dist/collection/components/billing-form/billing-form-schema.js +1 -0
  56. package/dist/collection/components/billing-form/billing-form-schema.js.map +1 -0
  57. package/dist/collection/components/billing-form/billing-form.css +337 -0
  58. package/dist/collection/components/billing-form/billing-form.js +1 -0
  59. package/dist/collection/components/billing-form/billing-form.js.map +1 -0
  60. package/dist/collection/components/billing-form/billing-form.stories.js +1 -0
  61. package/dist/collection/components/billing-form/billing-form.stories.js.map +1 -0
  62. package/dist/collection/components/billing-form/state-options.js +1 -0
  63. package/dist/collection/components/billing-form/state-options.js.map +1 -0
  64. package/dist/collection/components/billing-form/test/billing-form.spec.js +31 -0
  65. package/dist/collection/components/billing-form/test/billing-form.spec.js.map +1 -0
  66. package/dist/collection/components/business-address/business-address-schema.js +1 -0
  67. package/dist/collection/components/business-address/business-address-schema.js.map +1 -0
  68. package/dist/collection/components/business-address/business-address.css +337 -0
  69. package/dist/collection/components/business-address/business-address.js +1 -0
  70. package/dist/collection/components/business-address/business-address.js.map +1 -0
  71. package/dist/collection/components/business-address/test/business-address.e2e.js +10 -0
  72. package/dist/collection/components/business-address/test/business-address.e2e.js.map +1 -0
  73. package/dist/collection/components/business-address/test/business-address.spec.js +18 -0
  74. package/dist/collection/components/business-address/test/business-address.spec.js.map +1 -0
  75. package/dist/collection/components/business-info/business-info-schema.js +94 -0
  76. package/dist/collection/components/business-info/business-info-schema.js.map +1 -0
  77. package/dist/collection/components/business-info/business-info.css +2274 -0
  78. package/dist/collection/components/business-info/business-info.js +168 -0
  79. package/dist/collection/components/business-info/business-info.js.map +1 -0
  80. package/dist/collection/components/card-form/card-form.js +26 -0
  81. package/dist/collection/components/card-form/card-form.js.map +1 -0
  82. package/dist/collection/components/card-form/card-form.stories.js +11 -1
  83. package/dist/collection/components/card-form/card-form.stories.js.map +1 -0
  84. package/dist/collection/components/card-form/test/card-form.e2e.js +14 -0
  85. package/dist/collection/components/card-form/test/card-form.e2e.js.map +1 -0
  86. package/dist/collection/components/card-form/test/card-form.spec.js +56 -0
  87. package/dist/collection/components/card-form/test/card-form.spec.js.map +1 -0
  88. package/dist/collection/components/payment-form/payment-form.css +412 -0
  89. package/dist/collection/components/payment-form/payment-form.js +8 -2
  90. package/dist/collection/components/payment-form/payment-form.js.map +1 -0
  91. package/dist/collection/components/payment-form/payment-form.stories.js +3 -1
  92. package/dist/collection/components/payment-form/payment-form.stories.js.map +1 -0
  93. package/dist/collection/components/payment-form/payment-method-selector.css +337 -0
  94. package/dist/collection/components/payment-form/payment-method-selector.js +1 -0
  95. package/dist/collection/components/payment-form/payment-method-selector.js.map +1 -0
  96. package/dist/collection/components/payment-form/test/payment-form.e2e.js +23 -0
  97. package/dist/collection/components/payment-form/test/payment-form.e2e.js.map +1 -0
  98. package/dist/collection/components/payment-form/test/payment-form.spec.js +182 -0
  99. package/dist/collection/components/payment-form/test/payment-form.spec.js.map +1 -0
  100. package/dist/collection/components/payment-form/tokenize.js +1 -0
  101. package/dist/collection/components/payment-form/tokenize.js.map +1 -0
  102. package/dist/collection/components/payment-method-form/get-computed-theme.js +1 -0
  103. package/dist/collection/components/payment-method-form/get-computed-theme.js.map +1 -0
  104. package/dist/collection/components/payment-method-form/message-event-types.js +1 -0
  105. package/dist/collection/components/payment-method-form/message-event-types.js.map +1 -0
  106. package/dist/collection/components/payment-method-form/payment-method-form.js +21 -2
  107. package/dist/collection/components/payment-method-form/payment-method-form.js.map +1 -0
  108. package/dist/collection/components/payment-method-form/payment-method-responses.js +1 -0
  109. package/dist/collection/components/payment-method-form/payment-method-responses.js.map +1 -0
  110. package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js +22 -0
  111. package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js.map +1 -0
  112. package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js +83 -0
  113. package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js.map +1 -0
  114. package/dist/collection/components/payment-method-form/theme.js +1 -0
  115. package/dist/collection/components/payment-method-form/theme.js.map +1 -0
  116. package/dist/collection/components/payments-list/payments-list.js +1 -0
  117. package/dist/collection/components/payments-list/payments-list.js.map +1 -0
  118. package/dist/collection/components/payments-list/test/payments-list.spec.js +21 -0
  119. package/dist/collection/components/payments-list/test/payments-list.spec.js.map +1 -0
  120. package/dist/collection/components/select-input/select-input.css +337 -0
  121. package/dist/collection/components/select-input/select-input.js +1 -0
  122. package/dist/collection/components/select-input/select-input.js.map +1 -0
  123. package/dist/collection/components/select-input/test/select-input.spec.js +36 -0
  124. package/dist/collection/components/select-input/test/select-input.spec.js.map +1 -0
  125. package/dist/collection/components/text-input/test/text-input.spec.js +19 -0
  126. package/dist/collection/components/text-input/test/text-input.spec.js.map +1 -0
  127. package/dist/collection/components/text-input/text-input.css +337 -0
  128. package/dist/collection/components/text-input/text-input.js +1 -0
  129. package/dist/collection/components/text-input/text-input.js.map +1 -0
  130. package/dist/collection/index.js +1 -0
  131. package/dist/collection/index.js.map +1 -0
  132. package/dist/collection/utils/utils.js +1 -0
  133. package/dist/collection/utils/utils.js.map +1 -0
  134. package/dist/components/Api.js +109 -0
  135. package/dist/components/Api.js.map +1 -0
  136. package/dist/components/Payment.js +2 -0
  137. package/dist/components/Payment.js.map +1 -0
  138. package/dist/components/billing-form.js +6 -3
  139. package/dist/components/billing-form.js.map +1 -0
  140. package/dist/components/index.d.ts +9 -13
  141. package/dist/{esm/index.esm-c6a89005.js → components/index.esm.js} +3 -244
  142. package/dist/components/index.esm.js.map +1 -0
  143. package/dist/components/index.js +3 -11
  144. package/dist/components/index.js.map +1 -0
  145. package/dist/components/justifi-bank-account-form.js +14 -2
  146. package/dist/components/justifi-bank-account-form.js.map +1 -0
  147. package/dist/components/justifi-billing-form.js +2 -0
  148. package/dist/components/justifi-billing-form.js.map +1 -0
  149. package/dist/components/justifi-business-address.js +6 -3
  150. package/dist/components/justifi-business-address.js.map +1 -0
  151. package/dist/components/justifi-business-info.d.ts +11 -0
  152. package/dist/components/justifi-business-info.js +207 -0
  153. package/dist/components/justifi-business-info.js.map +1 -0
  154. package/dist/components/justifi-card-form.js +14 -2
  155. package/dist/components/justifi-card-form.js.map +1 -0
  156. package/dist/components/justifi-payment-form.js +11 -4
  157. package/dist/components/justifi-payment-form.js.map +1 -0
  158. package/dist/components/justifi-payment-method-form.js +2 -0
  159. package/dist/components/justifi-payment-method-form.js.map +1 -0
  160. package/dist/components/justifi-payment-method-selector.js +2 -0
  161. package/dist/components/justifi-payment-method-selector.js.map +1 -0
  162. package/dist/components/justifi-payments-list.js +4 -107
  163. package/dist/components/justifi-payments-list.js.map +1 -0
  164. package/dist/components/payment-method-form.js +17 -8
  165. package/dist/components/payment-method-form.js.map +1 -0
  166. package/dist/components/payment-method-selector.js +4 -2
  167. package/dist/components/payment-method-selector.js.map +1 -0
  168. package/dist/components/select-input.js +2 -0
  169. package/dist/components/select-input.js.map +1 -0
  170. package/dist/components/select-input2.js +4 -2
  171. package/dist/components/select-input2.js.map +1 -0
  172. package/dist/components/state-options.js +3 -1845
  173. package/dist/components/state-options.js.map +1 -0
  174. package/dist/components/text-input.js +2 -0
  175. package/dist/components/text-input.js.map +1 -0
  176. package/dist/components/text-input2.js +4 -2
  177. package/dist/components/text-input2.js.map +1 -0
  178. package/dist/esm/Api-a07f0057.js +109 -0
  179. package/dist/esm/Api-a07f0057.js.map +1 -0
  180. package/dist/esm/Payment-c86e1e84.js +2 -0
  181. package/dist/esm/Payment-c86e1e84.js.map +1 -0
  182. package/dist/esm/{index-605b421a.js → index-044f93fc.js} +185 -22
  183. package/dist/esm/index-044f93fc.js.map +1 -0
  184. package/dist/esm/index.esm-5624a5ed.js +1847 -0
  185. package/dist/esm/index.esm-5624a5ed.js.map +1 -0
  186. package/dist/esm/index.js +2 -0
  187. package/dist/esm/index.js.map +1 -0
  188. package/dist/esm/justifi-bank-account-form.entry.js +12 -1
  189. package/dist/esm/justifi-bank-account-form.entry.js.map +1 -0
  190. package/dist/esm/justifi-billing-form_2.entry.js +7 -4
  191. package/dist/esm/justifi-billing-form_2.entry.js.map +1 -0
  192. package/dist/esm/justifi-business-address.entry.js +6 -3
  193. package/dist/esm/justifi-business-address.entry.js.map +1 -0
  194. package/dist/esm/justifi-business-info.entry.js +170 -0
  195. package/dist/esm/justifi-business-info.entry.js.map +1 -0
  196. package/dist/esm/justifi-card-form.entry.js +12 -1
  197. package/dist/esm/justifi-card-form.entry.js.map +1 -0
  198. package/dist/esm/justifi-payment-form.entry.js +10 -4
  199. package/dist/esm/justifi-payment-form.entry.js.map +1 -0
  200. package/dist/esm/justifi-payment-method-form.entry.js +15 -7
  201. package/dist/esm/justifi-payment-method-form.entry.js.map +1 -0
  202. package/dist/esm/justifi-payments-list.entry.js +4 -107
  203. package/dist/esm/justifi-payments-list.entry.js.map +1 -0
  204. package/dist/esm/loader.js +6 -3
  205. package/dist/esm/loader.js.map +1 -0
  206. package/dist/esm/polyfills/css-shim.js +1 -1
  207. package/dist/esm/select-input_2.entry.js +5 -3
  208. package/dist/esm/select-input_2.entry.js.map +1 -0
  209. package/dist/esm/state-options-188acc34.js +246 -0
  210. package/dist/esm/state-options-188acc34.js.map +1 -0
  211. package/dist/esm/webcomponents.js +9 -3
  212. package/dist/esm/webcomponents.js.map +1 -0
  213. package/dist/types/api/Api.d.ts +1 -1
  214. package/dist/types/api/Payment.d.ts +1 -1
  215. package/dist/types/components/bank-account-form/bank-account-form.d.ts +4 -0
  216. package/dist/types/components/business-info/business-info-schema.d.ts +42 -0
  217. package/dist/types/components/business-info/business-info.d.ts +20 -0
  218. package/dist/types/components/card-form/card-form.d.ts +4 -0
  219. package/dist/types/components/payment-form/payment-form.d.ts +1 -0
  220. package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -0
  221. package/dist/types/components/payment-method-form/payment-method-responses.d.ts +1 -1
  222. package/dist/types/components.d.ts +72 -0
  223. package/dist/types/stencil-public-runtime.d.ts +72 -15
  224. package/dist/webcomponents/index.esm.js +2 -0
  225. package/dist/webcomponents/index.esm.js.map +1 -0
  226. package/dist/webcomponents/p-0969db8f.entry.js +2 -0
  227. package/dist/webcomponents/p-0969db8f.entry.js.map +1 -0
  228. package/dist/webcomponents/p-0ea23153.js +2 -0
  229. package/dist/webcomponents/p-0ea23153.js.map +1 -0
  230. package/dist/webcomponents/p-1ca0646b.js +2 -1
  231. package/dist/webcomponents/p-1ca0646b.js.map +1 -0
  232. package/dist/webcomponents/p-1f151d49.js +2 -0
  233. package/dist/webcomponents/p-1f151d49.js.map +1 -0
  234. package/dist/webcomponents/p-255b1284.entry.js +2 -0
  235. package/dist/webcomponents/p-255b1284.entry.js.map +1 -0
  236. package/dist/webcomponents/p-3aa91155.js +3 -0
  237. package/dist/webcomponents/p-3aa91155.js.map +1 -0
  238. package/dist/webcomponents/p-68e82f00.entry.js +2 -0
  239. package/dist/webcomponents/p-68e82f00.entry.js.map +1 -0
  240. package/dist/webcomponents/p-90c0d9e1.entry.js +2 -0
  241. package/dist/webcomponents/p-90c0d9e1.entry.js.map +1 -0
  242. package/dist/webcomponents/p-bd5352d6.entry.js +2 -0
  243. package/dist/webcomponents/p-bd5352d6.entry.js.map +1 -0
  244. package/dist/webcomponents/p-c903cc5a.entry.js +2 -0
  245. package/dist/webcomponents/p-c903cc5a.entry.js.map +1 -0
  246. package/dist/webcomponents/p-d87b0711.entry.js +2 -0
  247. package/dist/webcomponents/p-d87b0711.entry.js.map +1 -0
  248. package/dist/webcomponents/p-dbf7100f.entry.js +2 -0
  249. package/dist/webcomponents/p-dbf7100f.entry.js.map +1 -0
  250. package/dist/webcomponents/p-e0054bc3.js +2 -0
  251. package/dist/webcomponents/p-e0054bc3.js.map +1 -0
  252. package/dist/webcomponents/p-f30d1567.entry.js +2 -0
  253. package/dist/webcomponents/p-f30d1567.entry.js.map +1 -0
  254. package/dist/webcomponents/webcomponents.css +1 -1
  255. package/dist/webcomponents/webcomponents.esm.js +2 -1
  256. package/dist/webcomponents/webcomponents.esm.js.map +1 -0
  257. package/loader/index.d.ts +9 -0
  258. package/package.json +9 -5
  259. package/dist/webcomponents/p-039e3540.entry.js +0 -1
  260. package/dist/webcomponents/p-11e5bef9.entry.js +0 -1
  261. package/dist/webcomponents/p-20732337.js +0 -1
  262. package/dist/webcomponents/p-24409e8e.entry.js +0 -1
  263. package/dist/webcomponents/p-4a406704.js +0 -2
  264. package/dist/webcomponents/p-5774e36e.entry.js +0 -1
  265. package/dist/webcomponents/p-5b5e8351.entry.js +0 -1
  266. package/dist/webcomponents/p-5b68fa52.entry.js +0 -1
  267. package/dist/webcomponents/p-7747c086.entry.js +0 -1
  268. package/dist/webcomponents/p-bc35e124.entry.js +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### 4.2.0
8
+
9
+ > 27 June 2023
10
+
11
+ - Add `resize` method to `CardForm` and `BankAccount` form
12
+
13
+ #### 4.1.6
14
+
15
+ > 23 June 2023
16
+
17
+ - Add spinner indicator when `PaymmentForm` is submitting.
18
+ - Add `--jfi-submit-button-color-loading`, `--jfi-submit-button-background-color-loading` and `--jfi-submit-button-border-color-loading` variables to style the new loading state.
19
+
7
20
  #### 4.0.0
8
21
 
9
22
  > 08 May 2023
@@ -0,0 +1,111 @@
1
+ 'use strict';
2
+
3
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
4
+ // require the crypto API and do not support built-in fallback to lower quality random number
5
+ // generators (like Math.random()).
6
+ let getRandomValues;
7
+ const rnds8 = new Uint8Array(16);
8
+ function rng() {
9
+ // lazy load so that environments that need to polyfill have a chance to do so
10
+ if (!getRandomValues) {
11
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
12
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
13
+
14
+ if (!getRandomValues) {
15
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
16
+ }
17
+ }
18
+
19
+ return getRandomValues(rnds8);
20
+ }
21
+
22
+ /**
23
+ * Convert array of 16 byte values to UUID string format of the form:
24
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
25
+ */
26
+
27
+ const byteToHex = [];
28
+
29
+ for (let i = 0; i < 256; ++i) {
30
+ byteToHex.push((i + 0x100).toString(16).slice(1));
31
+ }
32
+
33
+ function unsafeStringify(arr, offset = 0) {
34
+ // Note: Be careful editing this code! It's been tuned for performance
35
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
36
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
37
+ }
38
+
39
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
40
+ const native = {
41
+ randomUUID
42
+ };
43
+
44
+ function v4(options, buf, offset) {
45
+ if (native.randomUUID && !buf && !options) {
46
+ return native.randomUUID();
47
+ }
48
+
49
+ options = options || {};
50
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
51
+
52
+ rnds[6] = rnds[6] & 0x0f | 0x40;
53
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
54
+
55
+ if (buf) {
56
+ offset = offset || 0;
57
+
58
+ for (let i = 0; i < 16; ++i) {
59
+ buf[offset + i] = rnds[i];
60
+ }
61
+
62
+ return buf;
63
+ }
64
+
65
+ return unsafeStringify(rnds);
66
+ }
67
+
68
+ const Api = (authToken) => {
69
+ const apiOrigin = 'https://justifi.ai';
70
+ async function getAuthorizationHeader() {
71
+ return {
72
+ 'Authorization': `Bearer ${authToken}`,
73
+ 'Idempotency-Key': v4(),
74
+ 'Content-Type': 'application/json',
75
+ };
76
+ }
77
+ async function makeRequest(endpoint, method, params, body, signal) {
78
+ const url = `${apiOrigin}/v1/${endpoint}`;
79
+ const requestUrl = params ? `${url}?${new URLSearchParams(params)}` : url;
80
+ const response = await fetch(requestUrl, {
81
+ method: method,
82
+ headers: await getAuthorizationHeader(),
83
+ body: body,
84
+ signal: signal,
85
+ });
86
+ if (response) {
87
+ return response.status === 204 ? {} : response.json();
88
+ }
89
+ handleError(requestUrl);
90
+ }
91
+ async function get(endpoint, params, signal) {
92
+ return makeRequest(endpoint, 'GET', params, null, signal);
93
+ }
94
+ async function post(endpoint, body, params, signal) {
95
+ return makeRequest(endpoint, 'POST', params, body, signal);
96
+ }
97
+ async function patch(endpoint, body, params, signal) {
98
+ return makeRequest(endpoint, 'PATCH', params, body, signal);
99
+ }
100
+ async function destroy(endpoint, params, signal) {
101
+ return makeRequest(endpoint, 'DELETE', params, null, signal);
102
+ }
103
+ return { get, post, patch, destroy };
104
+ };
105
+ function handleError(requestUrl) {
106
+ console.error(`Error fetching from ${requestUrl}`);
107
+ }
108
+
109
+ exports.Api = Api;
110
+
111
+ //# sourceMappingURL=Api-11362403.js.map
@@ -0,0 +1 @@
1
+ {"file":"Api-11362403.js","mappings":";;AAAA;AACA;AACA;AACA,IAAI,eAAe,CAAC;AACpB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AAClB,SAAS,GAAG,GAAG;AAC9B;AACA,EAAE,IAAI,CAAC,eAAe,EAAE;AACxB;AACA,IAAI,eAAe,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrH;AACA,IAAI,IAAI,CAAC,eAAe,EAAE;AAC1B,MAAM,MAAM,IAAI,KAAK,CAAC,0GAA0G,CAAC,CAAC;AAClI,KAAK;AACL,GAAG;AACH;AACA,EAAE,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC;;AChBA;AACA;AACA;AACA;AACA;AACA,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB;AACA,KAAK,IAAI,CAAC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AE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;GAC7D;EAED,eAAe,OAAO,CAAC,QAAgB,EAAE,MAAY,EAAE,MAAoB;IACzE,OAAO,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;GAC9D;EAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACvC,EAAE;AAEF,SAAS,WAAW,CAAC,UAAkB;EACrC,OAAO,CAAC,KAAK,CAAC,uBAAuB,UAAU,EAAE,CAAC,CAAC;AACrD;;;;","names":["uuidv4"],"sources":["./node_modules/uuid/dist/esm-browser/rng.js","./node_modules/uuid/dist/esm-browser/stringify.js","./node_modules/uuid/dist/esm-browser/native.js","./node_modules/uuid/dist/esm-browser/v4.js","./src/api/Api.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import { v4 as uuidv4 } from 'uuid';\nimport { IPagination } from './Pagination';\n\nexport interface IApiResponse<T> {\n data: T;\n error?: IErrorObject | IServerError;\n page_info?: IPagination;\n errors?: string[];\n id: number;\n type: string;\n}\n\nexport type IServerError = string;\n\nexport interface IErrorObject {\n message: string;\n code: string;\n param?: string;\n}\n\nexport interface IApiResponseCollection<T> extends IApiResponse<T> {\n page_info: IPagination;\n}\n\nconst Api = (authToken: string) => {\n const apiOrigin = 'https://justifi.ai';\n\n async function getAuthorizationHeader() {\n return {\n 'Authorization': `Bearer ${authToken}`,\n 'Idempotency-Key': uuidv4(),\n 'Content-Type': 'application/json',\n };\n }\n\n async function makeRequest(endpoint: string, method: string, params?: any, body?: any, signal?: AbortSignal) {\n const url = `${apiOrigin}/v1/${endpoint}`;\n const requestUrl = params ? `${url}?${new URLSearchParams(params)}` : url;\n const response = await fetch(requestUrl, {\n method: method,\n headers: await getAuthorizationHeader(),\n body: body,\n signal: signal,\n });\n\n if (response) {\n return response.status === 204 ? {} : response.json();\n }\n handleError(requestUrl);\n }\n\n async function get(endpoint: string, params?: any, signal?: AbortSignal) {\n return makeRequest(endpoint, 'GET', params, null, signal);\n }\n\n async function post(endpoint: string, body?: any, params?: any, signal?: AbortSignal) {\n return makeRequest(endpoint, 'POST', params, body, signal);\n }\n\n async function patch(endpoint: string, body?: any, params?: any, signal?: AbortSignal) {\n return makeRequest(endpoint, 'PATCH', params, body, signal);\n }\n\n async function destroy(endpoint: string, params?: any, signal?: AbortSignal) {\n return makeRequest(endpoint, 'DELETE', params, null, signal);\n }\n\n return { get, post, patch, destroy };\n};\n\nfunction handleError(requestUrl: string): void {\n console.error(`Error fetching from ${requestUrl}`);\n}\n\nexport default Api;\n"],"version":3}
@@ -69,3 +69,5 @@ class Payment {
69
69
  }
70
70
 
71
71
  exports.Payment = Payment;
72
+
73
+ //# sourceMappingURL=Payment-ac4dea02.js.map
@@ -0,0 +1 @@
1
+ {"file":"Payment-ac4dea02.js","mappings":";;AAAA,IAAY,eAGX;AAHD,WAAY,eAAe;EACzB,0CAAuB,CAAA;EACvB,oCAAiB,CAAA;AACnB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAEWA;AAAZ,WAAY,kBAAkB;EAC5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AO,CAAC,UAAU,CAAC;IACrC,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IACnD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAC/B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACjC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAC7C,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IACnD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC7B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACrC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;GACtC;EAED,IAAI,cAAc;IAChB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,uBAAuB,CAAC,IAAI,CAAC,CAAC;;IAE5F,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;MAClB,OAAO,IAAI,CAAC;KACb;SAAM,IAAI,IAAI,EAAE;MACf,OAAO,uBAAuB,CAAC,IAAI,CAAC;KACrC;SAAM;MACL,OAAO,uBAAuB,CAAC,IAAI,CAAC;KACrC;GACF;;;;;","names":["PaymentMethodTypes"],"sources":["./src/api/Payment.ts"],"sourcesContent":["export enum CaptureStrategy {\n automatic = 'automatic',\n manual = 'manual',\n}\n\nexport enum PaymentMethodTypes {\n card = 'card',\n bankAccount = 'bankAccount',\n}\n\nexport enum PaymentStatuses {\n pending = 'pending',\n authorized = 'authorized',\n succeeded = 'succeeded',\n failed = 'failed',\n disputed = 'disputed',\n fully_refunded = 'fully_refunded',\n partially_refunded = 'partially_refunded',\n}\n\nexport enum PaymentDisputedStatuses {\n // if a dispute is 'won', we don't show a dispute status, just general status\n lost = 'lost',\n open = 'open',\n}\n\nexport interface IPaymentMethod {\n card?: ICard;\n}\n\nexport type CardBrand = 'american_express' | 'diners_club' | 'discover' | 'jcb' | 'mastercard' | 'china_unionpay' | 'visa' | 'unknown';\n\nexport interface ICard {\n id: string;\n acct_last_four: string;\n name: string;\n brand: CardBrand;\n token: string;\n created_at: string;\n updated_at: string;\n}\n\nexport interface IDispute {\n amount_cents: number;\n created_at: string;\n currency: string;\n gateway_ref_id: string;\n id: string;\n payment_id: string;\n reason: null;\n status: string;\n updated_at: string;\n}\n\nexport interface IPayment {\n id: string;\n account_id: string;\n amount: number;\n amount_disputed: number;\n amount_refundable: number;\n amount_refunded: number;\n balance: number;\n captured: boolean;\n capture_strategy: CaptureStrategy;\n currency: 'usd';\n description: string;\n disputed: boolean;\n disputes: IDispute[];\n error_code: string | null;\n error_description: string | null;\n fee_amount: number;\n is_test: boolean;\n metadata: Object | null;\n payment_method: IPaymentMethod;\n payment_intent_id: string | null;\n refunded: boolean;\n status: PaymentStatuses;\n created_at: string;\n updated_at: string;\n}\n\nexport class Payment implements IPayment {\n public id: string;\n public account_id: string;\n public amount: number;\n public amount_disputed: number;\n public amount_refundable: number;\n public amount_refunded: number;\n public balance: number;\n public captured: boolean;\n public capture_strategy: CaptureStrategy;\n public currency: 'usd';\n public description: string;\n public disputed: boolean;\n public disputes: IDispute[];\n public error_code: string | null;\n public error_description: string | null;\n public fee_amount: number;\n public is_test: boolean;\n public metadata: Object | null;\n public payment_method: IPaymentMethod;\n public payment_intent_id: string | null;\n public refunded: boolean;\n public status: PaymentStatuses;\n public created_at: string;\n public updated_at: string;\n\n constructor(payment: IPayment) {\n this.id = payment.id;\n this.account_id = payment.account_id;\n this.amount = payment.amount;\n this.amount_disputed = payment.amount_disputed;\n this.amount_refundable = payment.amount_refundable;\n this.amount_refunded = payment.amount_refunded;\n this.balance = payment.balance;\n this.captured = payment.captured;\n this.capture_strategy = payment.capture_strategy;\n this.currency = payment.currency;\n this.description = payment.description;\n this.disputed = payment.disputed;\n this.disputes = payment.disputes;\n this.error_code = payment.error_code;\n this.error_description = payment.error_description;\n this.fee_amount = payment.fee_amount;\n this.is_test = payment.is_test;\n this.metadata = payment.metadata;\n this.payment_method = payment.payment_method;\n this.payment_intent_id = payment.payment_intent_id;\n this.refunded = payment.refunded;\n this.status = payment.status;\n this.created_at = payment.created_at;\n this.updated_at = payment.updated_at;\n }\n\n get disputedStatus(): PaymentDisputedStatuses | null {\n const lost = this.disputes.some(dispute => dispute.status === PaymentDisputedStatuses.lost);\n // if a dispute is 'won', we don't show a dispute status, just general status\n if (!this.disputed) {\n return null;\n } else if (lost) {\n return PaymentDisputedStatuses.lost;\n } else {\n return PaymentDisputedStatuses.open;\n }\n }\n}\n"],"version":3}
@@ -58,11 +58,30 @@ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
58
58
  */
59
59
  const EMPTY_OBJ = {};
60
60
  const isDef = (v) => v != null;
61
+ /**
62
+ * Check whether a value is a 'complex type', defined here as an object or a
63
+ * function.
64
+ *
65
+ * @param o the value to check
66
+ * @returns whether it's a complex type or not
67
+ */
61
68
  const isComplexType = (o) => {
62
69
  // https://jsperf.com/typeof-fn-object/5
63
70
  o = typeof o;
64
71
  return o === 'object' || o === 'function';
65
72
  };
73
+ /**
74
+ * Helper method for querying a `meta` tag that contains a nonce value
75
+ * out of a DOM's head.
76
+ *
77
+ * @param doc The DOM containing the `head` to query against
78
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
79
+ * exists or the tag has no content.
80
+ */
81
+ function queryNonceMetaTagContent(doc) {
82
+ var _a, _b, _c;
83
+ 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;
84
+ }
66
85
  /**
67
86
  * Production h() function based on Preact by
68
87
  * Jason Miller (@developit)
@@ -71,7 +90,6 @@ const isComplexType = (o) => {
71
90
  *
72
91
  * Modified for Stencil's compiler and vdom
73
92
  */
74
- // const stack: any[] = [];
75
93
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
76
94
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
77
95
  const h = (nodeName, vnodeData, ...children) => {
@@ -126,6 +144,14 @@ const h = (nodeName, vnodeData, ...children) => {
126
144
  }
127
145
  return vnode;
128
146
  };
147
+ /**
148
+ * A utility function for creating a virtual DOM node from a tag and some
149
+ * possible text content.
150
+ *
151
+ * @param tag the tag for this element
152
+ * @param text possible text content for the node
153
+ * @returns a newly-minted virtual DOM node
154
+ */
129
155
  const newVNode = (tag, text) => {
130
156
  const vnode = {
131
157
  $flags$: 0,
@@ -140,11 +166,31 @@ const newVNode = (tag, text) => {
140
166
  return vnode;
141
167
  };
142
168
  const Host = {};
169
+ /**
170
+ * Check whether a given node is a Host node or not
171
+ *
172
+ * @param node the virtual DOM node to check
173
+ * @returns whether it's a Host node or not
174
+ */
143
175
  const isHost = (node) => node && node.$tag$ === Host;
176
+ /**
177
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
178
+ *
179
+ * Note that these functions convert from {@link d.VNode} to
180
+ * {@link d.ChildNode} to give functional component developers a friendly
181
+ * interface.
182
+ */
144
183
  const vdomFnUtils = {
145
184
  forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
146
185
  map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
147
186
  };
187
+ /**
188
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
189
+ * friendlier public interface (hence, 'convertToPublic').
190
+ *
191
+ * @param node the virtual DOM node to convert
192
+ * @returns a converted child node
193
+ */
148
194
  const convertToPublic = (node) => ({
149
195
  vattrs: node.$attrs$,
150
196
  vchildren: node.$children$,
@@ -153,6 +199,15 @@ const convertToPublic = (node) => ({
153
199
  vtag: node.$tag$,
154
200
  vtext: node.$text$,
155
201
  });
202
+ /**
203
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
204
+ * order to use the resulting object in the virtual DOM. The initial object was
205
+ * likely created as part of presenting a public API, so converting it back
206
+ * involved making it 'private' again (hence, `convertToPrivate`).
207
+ *
208
+ * @param node the child node to convert
209
+ * @returns a converted virtual DOM node
210
+ */
156
211
  const convertToPrivate = (node) => {
157
212
  if (typeof node.vtag === 'function') {
158
213
  const vnodeData = Object.assign({}, node.vattrs);
@@ -258,6 +313,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
258
313
  styles.set(scopeId, style);
259
314
  };
260
315
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
316
+ var _a;
261
317
  let scopeId = getScopeId(cmpMeta);
262
318
  const style = styles.get(scopeId);
263
319
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -273,10 +329,16 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
273
329
  }
274
330
  if (!appliedStyles.has(scopeId)) {
275
331
  {
332
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
276
333
  {
277
334
  styleElm = doc.createElement('style');
278
335
  styleElm.innerHTML = style;
279
336
  }
337
+ // Apply CSP nonce to the style tag if it exists
338
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
339
+ if (nonce != null) {
340
+ styleElm.setAttribute('nonce', nonce);
341
+ }
280
342
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
281
343
  }
282
344
  if (appliedStyles) {
@@ -296,6 +358,7 @@ const attachStyles = (hostRef) => {
296
358
  const flags = cmpMeta.$flags$;
297
359
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
298
360
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
361
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
299
362
  if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
300
363
  // only required when we're NOT using native shadow dom (slot)
301
364
  // or this browser doesn't support native shadow dom
@@ -481,6 +544,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
481
544
  }
482
545
  return elm;
483
546
  };
547
+ /**
548
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
549
+ * add them to the DOM in the appropriate place.
550
+ *
551
+ * @param parentElm the DOM node which should be used as a parent for the new
552
+ * DOM nodes
553
+ * @param before a child of the `parentElm` which the new children should be
554
+ * inserted before (optional)
555
+ * @param parentVNode the parent virtual DOM node
556
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
557
+ * @param startIdx the index in the child virtual DOM nodes at which to start
558
+ * creating DOM nodes (inclusive)
559
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
560
+ * creating DOM nodes (inclusive)
561
+ */
484
562
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
485
563
  let containerElm = (parentElm);
486
564
  let childNode;
@@ -497,13 +575,27 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
497
575
  }
498
576
  }
499
577
  };
500
- const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
501
- for (; startIdx <= endIdx; ++startIdx) {
502
- if ((vnode = vnodes[startIdx])) {
503
- elm = vnode.$elm$;
504
- callNodeRefs(vnode);
505
- // remove the vnode's element from the dom
506
- elm.remove();
578
+ /**
579
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
580
+ * This can be used to, for instance, clean up after a list of children which
581
+ * should no longer be shown.
582
+ *
583
+ * This function also handles some of Stencil's slot relocation logic.
584
+ *
585
+ * @param vnodes a list of virtual DOM nodes to remove
586
+ * @param startIdx the index at which to start removing nodes (inclusive)
587
+ * @param endIdx the index at which to stop removing nodes (inclusive)
588
+ */
589
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
590
+ for (let index = startIdx; index <= endIdx; ++index) {
591
+ const vnode = vnodes[index];
592
+ if (vnode) {
593
+ const elm = vnode.$elm$;
594
+ nullifyVNodeRefs(vnode);
595
+ if (elm) {
596
+ // remove the vnode's element from the dom
597
+ elm.remove();
598
+ }
507
599
  }
508
600
  }
509
601
  };
@@ -689,7 +781,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
689
781
  *
690
782
  * So, in other words, if `key` attrs are not set on VNodes which may be
691
783
  * changing order within a `children` array or something along those lines then
692
- * we could obtain a false positive and then have to do needless re-rendering.
784
+ * we could obtain a false negative and then have to do needless re-rendering
785
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
693
786
  *
694
787
  * @param leftVNode the first VNode to check
695
788
  * @param rightVNode the second VNode to check
@@ -750,12 +843,31 @@ const patch = (oldVNode, newVNode) => {
750
843
  elm.data = text;
751
844
  }
752
845
  };
753
- const callNodeRefs = (vNode) => {
846
+ /**
847
+ * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
848
+ * calling them with `null`. This signals that the DOM element corresponding to
849
+ * the VDom node has been removed from the DOM.
850
+ *
851
+ * @param vNode a virtual DOM node
852
+ */
853
+ const nullifyVNodeRefs = (vNode) => {
754
854
  {
755
855
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
756
- vNode.$children$ && vNode.$children$.map(callNodeRefs);
856
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
757
857
  }
758
858
  };
859
+ /**
860
+ * The main entry point for Stencil's virtual DOM-based rendering engine
861
+ *
862
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
863
+ * function will handle creating a virtual DOM tree with a single root, patching
864
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
865
+ * relocation, and reflecting attributes.
866
+ *
867
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
868
+ * the DOM node into which it should be rendered.
869
+ * @param renderFnResults the virtual DOM nodes to be rendered
870
+ */
759
871
  const renderVdom = (hostRef, renderFnResults) => {
760
872
  const hostElm = hostRef.$hostElement$;
761
873
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -791,24 +903,63 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
791
903
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
792
904
  return writeTask(dispatch) ;
793
905
  };
906
+ /**
907
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
908
+ * component lifecycle methods like `componentWillLoad` as well as
909
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
910
+ *
911
+ * @param hostRef a reference to a host DOM node
912
+ * @param isInitialLoad whether we're on the initial load or not
913
+ * @returns an empty Promise which is used to enqueue a series of operations for
914
+ * the component
915
+ */
794
916
  const dispatchHooks = (hostRef, isInitialLoad) => {
795
917
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
796
918
  const instance = hostRef.$lazyInstance$ ;
797
- let promise;
919
+ // We're going to use this variable together with `enqueue` to implement a
920
+ // little promise-based queue. We start out with it `undefined`. When we add
921
+ // the first function to the queue we'll set this variable to be that
922
+ // function's return value. When we attempt to add subsequent values to the
923
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
924
+ // the new function off of that `Promise` using `.then()`. This will give our
925
+ // queue two nice properties:
926
+ //
927
+ // 1. If all functions added to the queue are synchronous they'll be called
928
+ // synchronously right away.
929
+ // 2. If all functions added to the queue are asynchronous they'll all be
930
+ // called in order after `dispatchHooks` exits.
931
+ let maybePromise;
798
932
  if (isInitialLoad) {
799
933
  {
800
934
  hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
801
935
  if (hostRef.$queuedListeners$) {
802
936
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
803
- hostRef.$queuedListeners$ = null;
937
+ hostRef.$queuedListeners$ = undefined;
804
938
  }
805
939
  }
806
940
  }
807
941
  endSchedule();
808
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
942
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
809
943
  };
944
+ /**
945
+ * This function uses a Promise to implement a simple first-in, first-out queue
946
+ * of functions to be called.
947
+ *
948
+ * The queue is ordered on the basis of the first argument. If it's
949
+ * `undefined`, then nothing is on the queue yet, so the provided function can
950
+ * be called synchronously (although note that this function may return a
951
+ * `Promise`). The idea is that then the return value of that enqueueing
952
+ * operation is kept around, so that if it was a `Promise` then subsequent
953
+ * functions can be enqueued by calling this function again with that `Promise`
954
+ * as the first argument.
955
+ *
956
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
957
+ * @param fn a function to enqueue
958
+ * @returns either a `Promise` or the return value of the provided function
959
+ */
960
+ const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
810
961
  const updateComponent = async (hostRef, instance, isInitialLoad) => {
811
- // updateComponent
962
+ var _a;
812
963
  const elm = hostRef.$hostElement$;
813
964
  const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
814
965
  const rc = elm['s-rc'];
@@ -830,7 +981,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
830
981
  endRender();
831
982
  endUpdate();
832
983
  {
833
- const childrenPromises = elm['s-p'];
984
+ const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
834
985
  const postUpdate = () => postUpdateComponent(hostRef);
835
986
  if (childrenPromises.length === 0) {
836
987
  postUpdate();
@@ -927,9 +1078,6 @@ const safeCall = (instance, method, arg) => {
927
1078
  }
928
1079
  return undefined;
929
1080
  };
930
- const then = (promise, thenFn) => {
931
- return promise && promise.then ? promise.then(thenFn) : thenFn();
932
- };
933
1081
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
934
1082
  ;
935
1083
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
@@ -1095,9 +1243,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1095
1243
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1096
1244
  // initializeComponent
1097
1245
  if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1246
+ // Let the runtime know that the component has been initialized
1247
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1098
1248
  {
1099
- // we haven't initialized this element yet
1100
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1101
1249
  // lazy loaded components
1102
1250
  // request the component's implementation to be
1103
1251
  // wired up with the host element
@@ -1241,6 +1389,7 @@ const disconnectedCallback = (elm) => {
1241
1389
  }
1242
1390
  };
1243
1391
  const bootstrapLazy = (lazyBundles, options = {}) => {
1392
+ var _a;
1244
1393
  const endBootstrap = createTime();
1245
1394
  const cmpTags = [];
1246
1395
  const exclude = options.exclude || [];
@@ -1320,6 +1469,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1320
1469
  {
1321
1470
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1322
1471
  visibilityStyle.setAttribute('data-styles', '');
1472
+ // Apply CSP nonce to the style tag if it exists
1473
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1474
+ if (nonce != null) {
1475
+ visibilityStyle.setAttribute('nonce', nonce);
1476
+ }
1323
1477
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1324
1478
  }
1325
1479
  // Process deferred connectedCallbacks now all components have been registered
@@ -1365,6 +1519,13 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1365
1519
  };
1366
1520
  // prettier-ignore
1367
1521
  const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1522
+ /**
1523
+ * Assigns the given value to the nonce property on the runtime platform object.
1524
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1525
+ * @param nonce The value to be assigned to the platform nonce property.
1526
+ * @returns void
1527
+ */
1528
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1368
1529
  const hostRefs = /*@__PURE__*/ new WeakMap();
1369
1530
  const getHostRef = (ref) => hostRefs.get(ref);
1370
1531
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1482,3 +1643,6 @@ exports.createEvent = createEvent;
1482
1643
  exports.h = h;
1483
1644
  exports.promiseResolve = promiseResolve;
1484
1645
  exports.registerInstance = registerInstance;
1646
+ exports.setNonce = setNonce;
1647
+
1648
+ //# sourceMappingURL=index-34312a38.js.map