@justifi/webcomponents 4.16.0 → 4.17.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 (293) hide show
  1. package/dist/cjs/{Analytics-423b2bb5.js → Analytics-80336968.js} +1 -1
  2. package/dist/cjs/{SubAccount-4f4fac22.js → SubAccount-135ff8c8.js} +1 -1
  3. package/dist/cjs/additional-questions-details_5.cjs.entry.js +1 -1
  4. package/dist/cjs/{business-additional-questions-schema-606d1292.js → business-additional-questions-schema-cf545610.js} +2 -2
  5. package/dist/cjs/form-alert_5.cjs.entry.js +2 -2
  6. package/dist/cjs/form-control-checkbox_5.cjs.entry.js +7 -10
  7. package/dist/cjs/form-control-date_3.cjs.entry.js +3 -3
  8. package/dist/cjs/form-control-error-text_4.cjs.entry.js +2 -2
  9. package/dist/cjs/form-control-file.cjs.entry.js +1 -1
  10. package/dist/cjs/form-control-monetary.cjs.entry.js +1 -1
  11. package/dist/cjs/form-control-number.cjs.entry.js +1 -1
  12. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +2 -2
  13. package/dist/cjs/justifi-additional-questions-form-step_10.cjs.entry.js +8 -11
  14. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +2 -2
  15. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +13 -1678
  16. package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
  17. package/dist/cjs/justifi-business-form.cjs.entry.js +5 -5
  18. package/dist/cjs/justifi-business-list.cjs.entry.js +1 -1
  19. package/dist/cjs/justifi-card-form.cjs.entry.js +2 -2
  20. package/dist/cjs/justifi-checkout-core.cjs.entry.js +13 -5
  21. package/dist/cjs/justifi-checkout.cjs.entry.js +11 -3
  22. package/dist/cjs/justifi-details.cjs.entry.js +1 -1
  23. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  24. package/dist/cjs/justifi-new-payment-method_4.cjs.entry.js +68 -26
  25. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +2 -2
  26. package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
  27. package/dist/cjs/justifi-payment-form.cjs.entry.js +6 -6
  28. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +1688 -0
  29. package/dist/cjs/justifi-payment-method-selector.cjs.entry.js +1 -1
  30. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
  31. package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
  32. package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
  33. package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
  34. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +2 -2
  35. package/dist/cjs/justifi-refund-form.cjs.entry.js +1 -1
  36. package/dist/cjs/justifi-season-interruption-insurance-core.cjs.entry.js +3 -3
  37. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +1 -1
  38. package/dist/cjs/justifi-skeleton.cjs.entry.js +1 -1
  39. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +3 -3
  40. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +3 -3
  41. package/dist/cjs/loader.cjs.js +1 -1
  42. package/dist/cjs/{package-b40227dd.js → package-7b63c02b.js} +1 -1
  43. package/dist/cjs/{payload-parsers-6e4cf5d7.js → payload-parsers-78445405.js} +1 -1
  44. package/dist/cjs/payment-details-core.cjs.entry.js +8 -8
  45. package/dist/cjs/payments-list-core.cjs.entry.js +2 -2
  46. package/dist/cjs/payout-details-core.cjs.entry.js +2 -2
  47. package/dist/cjs/payouts-list-core.cjs.entry.js +2 -2
  48. package/dist/cjs/{schema-validations-9668fd79.js → schema-validations-2733de42.js} +3 -4
  49. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +5 -5
  50. package/dist/cjs/subaccount-bank-details.cjs.entry.js +1 -1
  51. package/dist/cjs/subaccount-terms-details.cjs.entry.js +1 -1
  52. package/dist/cjs/{utils-fd644316.js → utils-742da2e3.js} +12 -3
  53. package/dist/cjs/{utils-17869710.js → utils-80191fbe.js} +6 -0
  54. package/dist/cjs/webcomponents.cjs.js +1 -1
  55. package/dist/collection/api/Checkout.js +0 -1
  56. package/dist/collection/collection-manifest.json +1 -0
  57. package/dist/collection/components/billing-form/billing-form.js +2 -2
  58. package/dist/collection/components/business-forms/business-form/additional-questions/additional-questions.js +1 -1
  59. package/dist/collection/components/business-forms/owner-form/owner-form.js +2 -5
  60. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +1 -1
  61. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +3 -2
  62. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +1 -4
  63. package/dist/collection/components/business-forms/schemas/business-core-info-schema.js +1 -1
  64. package/dist/collection/components/business-forms/schemas/schema-helpers.js +0 -1
  65. package/dist/collection/components/business-forms/schemas/schema-validations.js +4 -4
  66. package/dist/collection/components/checkout/checkout-core.js +64 -5
  67. package/dist/collection/components/checkout/checkout.js +59 -1
  68. package/dist/collection/components/checkout/new-payment-method.js +94 -14
  69. package/dist/collection/components/checkout/payment-method-option-utils.js +2 -0
  70. package/dist/collection/components/checkout/payment-method-options.css +8 -0
  71. package/dist/collection/components/checkout/payment-method-options.js +98 -14
  72. package/dist/collection/components/checkout/save-new-payment-method.js +38 -0
  73. package/dist/collection/components/checkout/saved-payment-method.js +11 -4
  74. package/dist/collection/components/checkout/sezzle-payment-method.js +11 -4
  75. package/dist/collection/components/details/details.js +1 -1
  76. package/dist/collection/components/form/form-control-checkbox.js +1 -1
  77. package/dist/collection/components/form/form-control-date.js +1 -1
  78. package/dist/collection/components/form/form-control-file.js +1 -1
  79. package/dist/collection/components/form/form-control-monetary.js +1 -1
  80. package/dist/collection/components/form/form-control-number-masked.js +1 -1
  81. package/dist/collection/components/form/form-control-number.js +1 -1
  82. package/dist/collection/components/form/form-control-select.js +1 -1
  83. package/dist/collection/components/form/form-control-text.js +1 -1
  84. package/dist/collection/components/form/utils.js +12 -3
  85. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +1 -1
  86. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance-core.js +2 -2
  87. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance.js +1 -1
  88. package/dist/collection/components/payment-balance-transactions/payment-balance-transactions.js +1 -1
  89. package/dist/collection/components/payment-details/payment-details-core.js +7 -7
  90. package/dist/collection/components/payment-form/payment-form.js +3 -3
  91. package/dist/collection/components/payment-form/payment-method-selector.js +1 -1
  92. package/dist/collection/components/payments-list/payments-list-core.js +1 -1
  93. package/dist/collection/components/payout-details/payout-details-core.js +1 -1
  94. package/dist/collection/components/payouts-list/payouts-list-core.js +1 -1
  95. package/dist/collection/components/proceeds-list/proceeds-list.js +1 -1
  96. package/dist/collection/components/refund-form/refund-form.js +1 -1
  97. package/dist/collection/components/skeleton/skeleton.js +1 -1
  98. package/dist/collection/components/subaccount-details/subaccount-account-details/subaccount-account-details.js +1 -1
  99. package/dist/collection/components/subaccount-details/subaccount-bank-details/subaccount-bank-details.js +1 -1
  100. package/dist/collection/components/subaccount-details/subaccount-details.js +1 -1
  101. package/dist/collection/components/subaccount-details/subaccount-merchant-details/subaccount-merchant-details.js +1 -1
  102. package/dist/collection/components/subaccount-details/subaccount-owners-details/subaccount-owners-details.js +1 -1
  103. package/dist/collection/components/subaccount-details/subaccount-representative-details/subaccount-representative-details.js +1 -1
  104. package/dist/collection/components/subaccount-details/subaccount-terms-details/subaccount-terms-details.js +1 -1
  105. package/dist/collection/components/subaccounts-list/subaccounts-list.js +1 -1
  106. package/dist/collection/utils/utils.js +5 -0
  107. package/dist/docs.json +415 -41
  108. package/dist/esm/{Analytics-17c33e9e.js → Analytics-c52faca6.js} +1 -1
  109. package/dist/esm/{SubAccount-8bf9cb0c.js → SubAccount-7fcb1450.js} +1 -1
  110. package/dist/esm/additional-questions-details_5.entry.js +1 -1
  111. package/dist/esm/{business-additional-questions-schema-b00a73ba.js → business-additional-questions-schema-956e3caf.js} +2 -2
  112. package/dist/esm/form-alert_5.entry.js +2 -2
  113. package/dist/esm/form-control-checkbox_5.entry.js +7 -10
  114. package/dist/esm/form-control-date_3.entry.js +3 -3
  115. package/dist/esm/form-control-error-text_4.entry.js +2 -2
  116. package/dist/esm/form-control-file.entry.js +1 -1
  117. package/dist/esm/form-control-monetary.entry.js +1 -1
  118. package/dist/esm/form-control-number.entry.js +1 -1
  119. package/dist/esm/gross-payment-chart-core.entry.js +2 -2
  120. package/dist/esm/justifi-additional-questions-form-step_10.entry.js +9 -12
  121. package/dist/esm/justifi-bank-account-form.entry.js +2 -2
  122. package/dist/esm/justifi-billing-form_2.entry.js +13 -1678
  123. package/dist/esm/justifi-business-details.entry.js +2 -2
  124. package/dist/esm/justifi-business-form.entry.js +5 -5
  125. package/dist/esm/justifi-business-list.entry.js +1 -1
  126. package/dist/esm/justifi-card-form.entry.js +2 -2
  127. package/dist/esm/justifi-checkout-core.entry.js +13 -5
  128. package/dist/esm/justifi-checkout.entry.js +11 -3
  129. package/dist/esm/justifi-details.entry.js +1 -1
  130. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  131. package/dist/esm/justifi-new-payment-method_4.entry.js +68 -26
  132. package/dist/esm/justifi-payment-balance-transactions.entry.js +2 -2
  133. package/dist/esm/justifi-payment-details.entry.js +2 -2
  134. package/dist/esm/justifi-payment-form.entry.js +6 -6
  135. package/dist/esm/justifi-payment-method-form.entry.js +1684 -0
  136. package/dist/esm/justifi-payment-method-selector.entry.js +1 -1
  137. package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
  138. package/dist/esm/justifi-payments-list.entry.js +2 -2
  139. package/dist/esm/justifi-payout-details.entry.js +2 -2
  140. package/dist/esm/justifi-payouts-list.entry.js +2 -2
  141. package/dist/esm/justifi-proceeds-list.entry.js +2 -2
  142. package/dist/esm/justifi-refund-form.entry.js +1 -1
  143. package/dist/esm/justifi-season-interruption-insurance-core.entry.js +3 -3
  144. package/dist/esm/justifi-season-interruption-insurance.entry.js +1 -1
  145. package/dist/esm/justifi-skeleton.entry.js +1 -1
  146. package/dist/esm/justifi-subaccount-details.entry.js +3 -3
  147. package/dist/esm/justifi-subaccounts-list.entry.js +3 -3
  148. package/dist/esm/loader.js +1 -1
  149. package/dist/esm/{package-02a6e473.js → package-8ab448a3.js} +1 -1
  150. package/dist/esm/{payload-parsers-a9e8f8cc.js → payload-parsers-57289fc4.js} +1 -1
  151. package/dist/esm/payment-details-core.entry.js +8 -8
  152. package/dist/esm/payments-list-core.entry.js +2 -2
  153. package/dist/esm/payout-details-core.entry.js +2 -2
  154. package/dist/esm/payouts-list-core.entry.js +2 -2
  155. package/dist/esm/{schema-validations-770bdf3e.js → schema-validations-a83ff220.js} +3 -4
  156. package/dist/esm/subaccount-account-details_4.entry.js +5 -5
  157. package/dist/esm/subaccount-bank-details.entry.js +1 -1
  158. package/dist/esm/subaccount-terms-details.entry.js +1 -1
  159. package/dist/esm/{utils-61a21dea.js → utils-5f4c4faa.js} +6 -1
  160. package/dist/esm/{utils-8de964da.js → utils-c7b3f21a.js} +12 -3
  161. package/dist/esm/webcomponents.js +1 -1
  162. package/dist/module/SubAccount.js +1 -1
  163. package/dist/module/additional-questions.js +1 -1
  164. package/dist/module/billing-form.js +2 -2
  165. package/dist/module/business-additional-questions-form-step.js +1 -1
  166. package/dist/module/business-core-info-form-step.js +3 -2
  167. package/dist/module/business-core-info-schema.js +1 -1
  168. package/dist/module/business-representative-form-step.js +1 -4
  169. package/dist/module/checkout-core.js +37 -21
  170. package/dist/module/details.js +1 -1
  171. package/dist/module/form-control-checkbox2.js +1 -1
  172. package/dist/module/form-control-date2.js +1 -1
  173. package/dist/module/form-control-file2.js +1 -1
  174. package/dist/module/form-control-monetary2.js +1 -1
  175. package/dist/module/form-control-number-masked2.js +1 -1
  176. package/dist/module/form-control-number.js +1 -1
  177. package/dist/module/form-control-select2.js +1 -1
  178. package/dist/module/form-control-text2.js +1 -1
  179. package/dist/module/gross-payment-chart-core2.js +1 -1
  180. package/dist/module/justifi-checkout.js +35 -20
  181. package/dist/module/justifi-payment-balance-transactions.js +2 -2
  182. package/dist/module/justifi-payment-form.js +3 -3
  183. package/dist/module/justifi-proceeds-list.js +1 -1
  184. package/dist/module/justifi-refund-form.js +1 -1
  185. package/dist/module/justifi-save-new-payment-method.d.ts +11 -0
  186. package/dist/module/justifi-save-new-payment-method.js +6 -0
  187. package/dist/module/justifi-season-interruption-insurance.js +1 -1
  188. package/dist/module/justifi-subaccount-details.js +2 -2
  189. package/dist/module/justifi-subaccounts-list.js +2 -2
  190. package/dist/module/new-payment-method.js +52 -24
  191. package/dist/module/owner-form.js +2 -5
  192. package/dist/module/package.js +1 -1
  193. package/dist/module/payment-details-core2.js +8 -8
  194. package/dist/module/payment-method-options.js +51 -26
  195. package/dist/module/payment-method-selector.js +1 -1
  196. package/dist/module/payments-list-core2.js +2 -2
  197. package/dist/module/payout-details-core2.js +2 -2
  198. package/dist/module/payouts-list-core2.js +2 -2
  199. package/dist/module/save-new-payment-method.js +36 -0
  200. package/dist/module/saved-payment-method.js +7 -2
  201. package/dist/module/schema-validations.js +3 -4
  202. package/dist/module/season-interruption-insurance-core.js +2 -2
  203. package/dist/module/sezzle-payment-method.js +5 -2
  204. package/dist/module/skeleton.js +1 -1
  205. package/dist/module/subaccount-account-details2.js +1 -1
  206. package/dist/module/subaccount-bank-details.js +1 -1
  207. package/dist/module/subaccount-merchant-details2.js +2 -2
  208. package/dist/module/subaccount-owners-details2.js +1 -1
  209. package/dist/module/subaccount-representative-details2.js +1 -1
  210. package/dist/module/subaccount-terms-details.js +1 -1
  211. package/dist/module/utils2.js +6 -1
  212. package/dist/module/utils3.js +12 -3
  213. package/dist/types/api/Checkout.d.ts +6 -0
  214. package/dist/types/components/business-forms/owner-form/owner-form.d.ts +0 -1
  215. package/dist/types/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.d.ts +0 -1
  216. package/dist/types/components/business-forms/schemas/schema-helpers.d.ts +0 -1
  217. package/dist/types/components/checkout/checkout-core.d.ts +5 -1
  218. package/dist/types/components/checkout/checkout.d.ts +5 -0
  219. package/dist/types/components/checkout/new-payment-method.d.ts +8 -2
  220. package/dist/types/components/checkout/payment-method-option-utils.d.ts +1 -0
  221. package/dist/types/components/checkout/payment-method-options.d.ts +6 -2
  222. package/dist/types/components/checkout/payment-method-payload.d.ts +1 -0
  223. package/dist/types/components/checkout/save-new-payment-method.d.ts +7 -0
  224. package/dist/types/components/checkout/saved-payment-method.d.ts +1 -1
  225. package/dist/types/components/checkout/sezzle-payment-method.d.ts +1 -1
  226. package/dist/types/components/form/utils.d.ts +1 -1
  227. package/dist/types/components/payment-method-form/payment-method-responses.d.ts +6 -4
  228. package/dist/types/components.d.ts +55 -12
  229. package/dist/types/utils/utils.d.ts +1 -0
  230. package/dist/webcomponents/{p-4791c1f2.entry.js → p-00de4ae0.entry.js} +1 -1
  231. package/dist/webcomponents/{p-0f10316f.entry.js → p-015ba24e.entry.js} +1 -1
  232. package/dist/webcomponents/p-0575daac.js +1 -0
  233. package/dist/webcomponents/p-0a09edbb.entry.js +1 -0
  234. package/dist/webcomponents/{p-31031d15.entry.js → p-0fc18c89.entry.js} +1 -1
  235. package/dist/webcomponents/{p-f14db665.entry.js → p-100cb35c.entry.js} +1 -1
  236. package/dist/webcomponents/{p-b01c0120.entry.js → p-189dee9f.entry.js} +1 -1
  237. package/dist/webcomponents/{p-288c95b3.entry.js → p-1c60004a.entry.js} +1 -1
  238. package/dist/webcomponents/{p-65969627.entry.js → p-30a7bebc.entry.js} +2 -2
  239. package/dist/webcomponents/{p-7ae2d26f.entry.js → p-378bb067.entry.js} +1 -1
  240. package/dist/webcomponents/p-3fd13ca3.js +1 -0
  241. package/dist/webcomponents/{p-923c37a2.entry.js → p-404d7c56.entry.js} +1 -1
  242. package/dist/webcomponents/{p-f18e63c3.entry.js → p-43326623.entry.js} +1 -1
  243. package/dist/webcomponents/{p-9228912b.entry.js → p-4c5f9260.entry.js} +1 -1
  244. package/dist/webcomponents/{p-7c28a80d.entry.js → p-5309e887.entry.js} +1 -1
  245. package/dist/webcomponents/{p-fee616cf.entry.js → p-6006e085.entry.js} +1 -1
  246. package/dist/webcomponents/{p-9c00adf1.entry.js → p-61e486ad.entry.js} +1 -1
  247. package/dist/webcomponents/{p-eefe2f29.entry.js → p-738049aa.entry.js} +1 -1
  248. package/dist/webcomponents/{p-56275f64.entry.js → p-739f1e09.entry.js} +1 -1
  249. package/dist/webcomponents/{p-4b260a52.entry.js → p-7f77d91f.entry.js} +1 -1
  250. package/dist/webcomponents/{p-ebce7b2f.entry.js → p-84b3cead.entry.js} +1 -1
  251. package/dist/webcomponents/{p-06baf263.entry.js → p-8805d083.entry.js} +1 -1
  252. package/dist/webcomponents/p-89887332.js +1 -0
  253. package/dist/webcomponents/p-95c18035.entry.js +1 -0
  254. package/dist/webcomponents/{p-fa9773c0.entry.js → p-95c8c313.entry.js} +1 -1
  255. package/dist/webcomponents/p-97220d5b.entry.js +1 -0
  256. package/dist/webcomponents/{p-8e8f5033.entry.js → p-98985c7d.entry.js} +1 -1
  257. package/dist/webcomponents/{p-e3a31451.entry.js → p-9936c393.entry.js} +1 -1
  258. package/dist/webcomponents/p-9d03464e.entry.js +1 -0
  259. package/dist/webcomponents/{p-3a7e0753.entry.js → p-a34c28af.entry.js} +1 -1
  260. package/dist/webcomponents/{p-d42e284d.entry.js → p-a6477232.entry.js} +1 -1
  261. package/dist/webcomponents/{p-2451611d.entry.js → p-a90a6703.entry.js} +1 -1
  262. package/dist/webcomponents/{p-a33c3e1c.entry.js → p-b1a24d24.entry.js} +1 -1
  263. package/dist/webcomponents/{p-9b1e7f5e.entry.js → p-b27d2ce1.entry.js} +1 -1
  264. package/dist/webcomponents/{p-3394ff6c.js → p-b7d9d9fa.js} +1 -1
  265. package/dist/webcomponents/{p-1e53021d.entry.js → p-be049573.entry.js} +1 -1
  266. package/dist/webcomponents/{p-c85fb952.entry.js → p-bfe69314.entry.js} +1 -1
  267. package/dist/webcomponents/{p-9601cf9d.entry.js → p-c2d6a5e2.entry.js} +1 -1
  268. package/dist/webcomponents/{p-4b4fc43d.js → p-c4264aaf.js} +1 -1
  269. package/dist/webcomponents/{p-808c8988.entry.js → p-c69713c2.entry.js} +1 -1
  270. package/dist/webcomponents/{p-9e5d765c.js → p-c8c08fe3.js} +1 -1
  271. package/dist/webcomponents/{p-b94bf537.entry.js → p-d779f2f2.entry.js} +1 -1
  272. package/dist/webcomponents/{p-26779944.entry.js → p-da313a7e.entry.js} +1 -1
  273. package/dist/webcomponents/{p-6ce586e0.entry.js → p-e04f7070.entry.js} +1 -1
  274. package/dist/webcomponents/p-e7915927.entry.js +1 -0
  275. package/dist/webcomponents/{p-fb53112b.js → p-e8c651b8.js} +1 -1
  276. package/dist/webcomponents/p-eb142b8a.entry.js +1 -0
  277. package/dist/webcomponents/{p-851e57f4.js → p-edb605b3.js} +1 -1
  278. package/dist/webcomponents/{p-e673e681.entry.js → p-efe744ce.entry.js} +1 -1
  279. package/dist/webcomponents/p-f6858597.entry.js +1 -0
  280. package/dist/webcomponents/p-f68cf935.entry.js +1 -0
  281. package/dist/webcomponents/{p-3f06ce2f.entry.js → p-fcf42299.entry.js} +1 -1
  282. package/dist/webcomponents/webcomponents.esm.js +1 -1
  283. package/package.json +1 -1
  284. package/dist/webcomponents/p-038fb958.entry.js +0 -1
  285. package/dist/webcomponents/p-144e4bda.js +0 -1
  286. package/dist/webcomponents/p-1feebf9c.entry.js +0 -1
  287. package/dist/webcomponents/p-306aea52.entry.js +0 -1
  288. package/dist/webcomponents/p-6b05f357.entry.js +0 -1
  289. package/dist/webcomponents/p-71800e4c.js +0 -1
  290. package/dist/webcomponents/p-88d68804.entry.js +0 -1
  291. package/dist/webcomponents/p-8a6049ed.js +0 -1
  292. package/dist/webcomponents/p-bacd9d6e.entry.js +0 -1
  293. package/dist/webcomponents/p-f3ae3cb6.entry.js +0 -1
@@ -4,11 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-b4498996.js');
6
6
  const index_esm = require('./index.esm-52757963.js');
7
- const schemaValidations = require('./schema-validations-9668fd79.js');
7
+ const schemaValidations = require('./schema-validations-2733de42.js');
8
8
  const stateOptions = require('./state-options-4fbcb48a.js');
9
- const utils = require('./utils-fd644316.js');
10
- const _package = require('./package-b40227dd.js');
11
- const utils$1 = require('./utils-17869710.js');
9
+ const utils = require('./utils-742da2e3.js');
12
10
  require('./business-form-options-582467fe.js');
13
11
  require('./Business-aacbe893.js');
14
12
  require('./helpers-602962eb.js');
@@ -49,7 +47,7 @@ const BillingForm = class {
49
47
  return this.formController.values.getValue();
50
48
  }
51
49
  async fill(fields) {
52
- this.formController.setValues(fields);
50
+ this.formController.setInitialValues(fields);
53
51
  }
54
52
  async validate() {
55
53
  let isValid = await this.formController.validate();
@@ -57,1689 +55,26 @@ const BillingForm = class {
57
55
  }
58
56
  render() {
59
57
  const billingFormDefaultValue = this.formController.getInitialValues();
60
- return (index.h(index.Host, { key: '394ccc8799078a3c6d0deb96d6b96553c0268d40', exportparts: "label,input,input-invalid" }, index.h("form", { key: 'a4796aa2ddc184bf881b9ca620ccdf54cb4ea9d5' }, index.h("fieldset", { key: '437d9d75bb9614349520b477e0b9f69c400fee8b' }, this.legend && index.h("legend", { key: '7f5c1078da38049ee2dc486b9c7eccff10a3698b' }, this.legend), index.h("div", { key: 'f8624c6ed26e5f052675ba6c40d98a1d7da02e86', class: "row gy-3" }, index.h("div", { key: '9aa4fb17b220bacaad519949a7686968e43a5d2d', class: "col-12" }, index.h("form-control-text", { key: 'f46a938e7ccb2f390675cc95adea78de91b7746b', name: 'name', label: 'Full Name', defaultValue: billingFormDefaultValue.name, errorText: this.errors.name, inputHandler: this.inputHandler })), index.h("div", { key: '2c725e13c99d39ff1d583bdfadc8353e71df9a49', class: "col-12" }, index.h("form-control-text", { key: '893a63193b8be1172140a9475d552e16f2281c4e', name: 'address_line1', label: 'Street Address', defaultValue: billingFormDefaultValue.address_line1, errorText: this.errors.address_line1, inputHandler: this.inputHandler })), index.h("div", { key: '327ecba6bd968e4a24055446a45cdb2fdb51aa7b', class: "col-12" }, index.h("form-control-text", { key: '13524570e96720e0b2fcdc75e170bd52d77a1f78', name: 'address_line2', label: "Apartment, Suite, etc. (optional)", defaultValue: billingFormDefaultValue.address_line2, errorText: this.errors.address_line2, inputHandler: this.inputHandler })), index.h("div", { key: '894c40be08af53aca60a549c12d60e98038b0388', class: "col-12" }, index.h("form-control-text", { key: 'ed13196ca464b162805bed6bb4c0e1ebbe20f028', name: 'address_city', label: "City", defaultValue: billingFormDefaultValue.address_city, errorText: this.errors.address_city, inputHandler: this.inputHandler })), index.h("div", { key: '56aedf85b8c85ba0bda37fa5de223598ab38c950', class: "col-12" }, index.h("form-control-select", { key: 'c8fdf53bcff9ce6b5caeb5e06f15ff47b1ec633e', name: 'address_state', label: 'State', options: stateOptions.StateOptions, defaultValue: billingFormDefaultValue.address_state, errorText: this.errors.address_state, inputHandler: this.inputHandler })), index.h("div", { key: 'cdb3b5406da9d459fada4e59080bd94bd2d9b621', class: "col-12" }, index.h("form-control-text", { key: '67c0ca310493470e79866e11959edb91a77883e8', name: 'address_postal_code', label: "ZIP", defaultValue: billingFormDefaultValue.address_postal_code, errorText: this.errors.address_postal_code, inputHandler: this.inputHandler, maxLength: 5, keyDownHandler: utils.numberOnlyHandler })))))));
58
+ return (index.h(index.Host, { key: '3e0954b4babb893c7409e91fcb18184298bc0b65', exportparts: "label,input,input-invalid" }, index.h("form", { key: 'fb71a434643015867f88d0efce59d31c3c7429c6' }, index.h("fieldset", { key: 'd24b2ab37867192046a27d5a4ff697474c4bf3da' }, this.legend && index.h("legend", { key: '67232ddf644cdc43c314f0dd5c3d25cf2fa70457' }, this.legend), index.h("div", { key: 'cedc173c4b65caf38fa43db6e82784cd10389dbb', class: "row gy-3" }, index.h("div", { key: '29bb833c0d6ab0a382422970df82538d22d4faee', class: "col-12" }, index.h("form-control-text", { key: '5b1dd1dc7020ee795c8676a59888c66fbaa10729', name: 'name', label: 'Full Name', defaultValue: billingFormDefaultValue.name, errorText: this.errors.name, inputHandler: this.inputHandler })), index.h("div", { key: 'c04e342634d5eca451f98a043b3aa57d06a141cd', class: "col-12" }, index.h("form-control-text", { key: '61407ae0370b96357c671a6db9f3a689db5df222', name: 'address_line1', label: 'Street Address', defaultValue: billingFormDefaultValue.address_line1, errorText: this.errors.address_line1, inputHandler: this.inputHandler })), index.h("div", { key: '7dbf877e690936a53d2e11075a0904ae66854e6a', class: "col-12" }, index.h("form-control-text", { key: 'e13552aad0d46d7edf88c28c4348b0b401107b10', name: 'address_line2', label: "Apartment, Suite, etc. (optional)", defaultValue: billingFormDefaultValue.address_line2, errorText: this.errors.address_line2, inputHandler: this.inputHandler })), index.h("div", { key: 'c5be293a5559cbfa2e0c5425fb6ec0ec798c2af8', class: "col-12" }, index.h("form-control-text", { key: 'd6c6502bb828ab30598bb8f528d53a1431069dd5', name: 'address_city', label: "City", defaultValue: billingFormDefaultValue.address_city, errorText: this.errors.address_city, inputHandler: this.inputHandler })), index.h("div", { key: 'ec50b1ba2b7b2b687d9e6ad3c1c7af89d0dc6f74', class: "col-12" }, index.h("form-control-select", { key: '275e63c9b8b8b743c27d6053c36a2c14a57754fc', name: 'address_state', label: 'State', options: stateOptions.StateOptions, defaultValue: billingFormDefaultValue.address_state, errorText: this.errors.address_state, inputHandler: this.inputHandler })), index.h("div", { key: '4bfb86b74779742bb6816ed923ac06d28da142b2', class: "col-12" }, index.h("form-control-text", { key: 'a901279bda8599a14d4c440998f0d8da48b28252', name: 'address_postal_code', label: "ZIP", defaultValue: billingFormDefaultValue.address_postal_code, errorText: this.errors.address_postal_code, inputHandler: this.inputHandler, maxLength: 5, keyDownHandler: utils.numberOnlyHandler })))))));
61
59
  }
62
60
  };
63
61
  BillingForm.style = JustifiBillingFormStyle0;
64
62
 
65
- var iframeResizer = {exports: {}};
66
-
67
- /*
68
- * File: iframeResizer.js
69
- * Desc: Force iframes to size to content.
70
- * Requires: iframeResizer.contentWindow.js to be loaded into the target frame.
71
- * Doc: https://iframe-resizer.com
72
- * Author: David J. Bradshaw - info@iframe-resizer.com
73
- */
74
-
75
- (function (module) {
76
- console.info(`
77
- IFRAME-RESIZER
78
-
79
- Iframe-Resizer 5 is now available via the following two packages:
80
-
81
- * @iframe-resizer/parent
82
- * @iframe-resizer/child
83
-
84
- Additionally their are also new versions of iframe-resizer for React, Vue, and jQuery.
85
-
86
- Version 5 of iframe-resizer has been extensively rewritten to use modern browser APIs, which has enabled significantly better performance and greater accuracy in the detection of content resizing events.
87
-
88
- Please see https://iframe-resizer.com/upgrade for more details.
89
- `)
90
-
91
- // eslint-disable-next-line sonarjs/cognitive-complexity, no-shadow-restricted-names
92
- ;(function (undefined$1) {
93
- if (typeof window === 'undefined') return // don't run for server side render
94
-
95
- // var VERSION = '4.3.11'
96
-
97
- var count = 0,
98
- destroyObserver,
99
- logEnabled = false,
100
- hiddenCheckEnabled = false,
101
- msgHeader = 'message',
102
- msgHeaderLen = msgHeader.length,
103
- msgId = '[iFrameSizer]', // Must match iframe msg ID
104
- msgIdLen = msgId.length,
105
- pagePosition = null,
106
- requestAnimationFrame = window.requestAnimationFrame,
107
- resetRequiredMethods = Object.freeze({
108
- max: 1,
109
- scroll: 1,
110
- bodyScroll: 1,
111
- documentElementScroll: 1
112
- }),
113
- settings = {},
114
- timer = null,
115
- defaults = Object.freeze({
116
- autoResize: true,
117
- bodyBackground: null,
118
- bodyMargin: null,
119
- bodyMarginV1: 8,
120
- bodyPadding: null,
121
- checkOrigin: true,
122
- inPageLinks: false,
123
- enablePublicMethods: true,
124
- heightCalculationMethod: 'bodyOffset',
125
- id: 'iFrameResizer',
126
- interval: 32,
127
- license: '1jqr0si6pnt',
128
- log: false,
129
- maxHeight: Infinity,
130
- maxWidth: Infinity,
131
- minHeight: 0,
132
- minWidth: 0,
133
- mouseEvents: true,
134
- resizeFrom: 'parent',
135
- scrolling: false,
136
- sizeHeight: true,
137
- sizeWidth: false,
138
- warningTimeout: 5000,
139
- tolerance: 0,
140
- widthCalculationMethod: 'scroll',
141
- onClose: function () {
142
- return true
143
- },
144
- onClosed: function () {},
145
- onInit: function () {},
146
- onMessage: function () {
147
- warn('onMessage function not defined');
148
- },
149
- onMouseEnter: function () {},
150
- onMouseLeave: function () {},
151
- onResized: function () {},
152
- onScroll: function () {
153
- return true
154
- }
155
- });
156
-
157
- function getMutationObserver() {
158
- return (
159
- window.MutationObserver ||
160
- window.WebKitMutationObserver ||
161
- window.MozMutationObserver
162
- )
163
- }
164
-
165
- function addEventListener(el, evt, func) {
166
- el.addEventListener(evt, func, false);
167
- }
168
-
169
- function removeEventListener(el, evt, func) {
170
- el.removeEventListener(evt, func, false);
171
- }
172
-
173
- function setupRequestAnimationFrame() {
174
- var vendors = ['moz', 'webkit', 'o', 'ms'];
175
- var x;
176
-
177
- // Remove vendor prefixing if prefixed and break early if not
178
- for (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {
179
- requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
180
- }
181
-
182
- if (requestAnimationFrame) {
183
- // Firefox extension content-scripts have a globalThis object that is not the same as window.
184
- // Binding `requestAnimationFrame` to window allows the function to work and prevents errors
185
- // being thrown when run in that context, and should be a no-op in every other context.
186
- requestAnimationFrame = requestAnimationFrame.bind(window);
187
- } else {
188
- log('setup', 'RequestAnimationFrame not supported');
189
- }
190
- }
191
-
192
- function getMyID(iframeId) {
193
- var retStr = 'Host page: ' + iframeId;
194
-
195
- if (window.top !== window.self) {
196
- retStr =
197
- window.parentIFrame && window.parentIFrame.getId
198
- ? window.parentIFrame.getId() + ': ' + iframeId
199
- : 'Nested host page: ' + iframeId;
200
- }
201
-
202
- return retStr
203
- }
204
-
205
- function formatLogHeader(iframeId) {
206
- return msgId + '[' + getMyID(iframeId) + ']'
207
- }
208
-
209
- function isLogEnabled(iframeId) {
210
- return settings[iframeId] ? settings[iframeId].log : logEnabled
211
- }
212
-
213
- function log(iframeId, msg) {
214
- output('log', iframeId, msg, isLogEnabled(iframeId));
215
- }
216
-
217
- function info(iframeId, msg) {
218
- output('info', iframeId, msg, isLogEnabled(iframeId));
219
- }
220
-
221
- function warn(iframeId, msg) {
222
- output('warn', iframeId, msg, true);
223
- }
224
-
225
- function output(type, iframeId, msg, enabled) {
226
- if (true === enabled && 'object' === typeof window.console) {
227
- // eslint-disable-next-line no-console
228
- console[type](formatLogHeader(iframeId), msg);
229
- }
230
- }
231
-
232
- function iFrameListener(event) {
233
- function resizeIFrame() {
234
- function resize() {
235
- setSize(messageData);
236
- setPagePosition(iframeId);
237
- on('onResized', messageData);
238
- }
239
-
240
- ensureInRange('Height');
241
- ensureInRange('Width');
242
-
243
- syncResize(resize, messageData, 'init');
244
- }
245
-
246
- function processMsg() {
247
- var data = msg.slice(msgIdLen).split(':');
248
- var height = data[1] ? parseInt(data[1], 10) : 0;
249
- var iframe = settings[data[0]] && settings[data[0]].iframe;
250
- var compStyle = getComputedStyle(iframe);
251
-
252
- return {
253
- iframe: iframe,
254
- id: data[0],
255
- height: height + getPaddingEnds(compStyle) + getBorderEnds(compStyle),
256
- width: data[2],
257
- type: data[3]
258
- }
259
- }
260
-
261
- function getPaddingEnds(compStyle) {
262
- if (compStyle.boxSizing !== 'border-box') {
263
- return 0
264
- }
265
- var top = compStyle.paddingTop ? parseInt(compStyle.paddingTop, 10) : 0;
266
- var bot = compStyle.paddingBottom
267
- ? parseInt(compStyle.paddingBottom, 10)
268
- : 0;
269
- return top + bot
270
- }
271
-
272
- function getBorderEnds(compStyle) {
273
- if (compStyle.boxSizing !== 'border-box') {
274
- return 0
275
- }
276
- var top = compStyle.borderTopWidth
277
- ? parseInt(compStyle.borderTopWidth, 10)
278
- : 0;
279
- var bot = compStyle.borderBottomWidth
280
- ? parseInt(compStyle.borderBottomWidth, 10)
281
- : 0;
282
- return top + bot
283
- }
284
-
285
- function ensureInRange(Dimension) {
286
- var max = Number(settings[iframeId]['max' + Dimension]),
287
- min = Number(settings[iframeId]['min' + Dimension]),
288
- dimension = Dimension.toLowerCase(),
289
- size = Number(messageData[dimension]);
290
-
291
- log(iframeId, 'Checking ' + dimension + ' is in range ' + min + '-' + max);
292
-
293
- if (size < min) {
294
- size = min;
295
- log(iframeId, 'Set ' + dimension + ' to min value');
296
- }
297
-
298
- if (size > max) {
299
- size = max;
300
- log(iframeId, 'Set ' + dimension + ' to max value');
301
- }
302
-
303
- messageData[dimension] = '' + size;
304
- }
305
-
306
- function isMessageFromIFrame() {
307
- function checkAllowedOrigin() {
308
- function checkList() {
309
- var i = 0,
310
- retCode = false;
311
-
312
- log(
313
- iframeId,
314
- 'Checking connection is from allowed list of origins: ' +
315
- checkOrigin
316
- );
317
-
318
- for (; i < checkOrigin.length; i++) {
319
- if (checkOrigin[i] === origin) {
320
- retCode = true;
321
- break
322
- }
323
- }
324
- return retCode
325
- }
326
-
327
- function checkSingle() {
328
- var remoteHost = settings[iframeId] && settings[iframeId].remoteHost;
329
- log(iframeId, 'Checking connection is from: ' + remoteHost);
330
- return origin === remoteHost
331
- }
332
-
333
- return checkOrigin.constructor === Array ? checkList() : checkSingle()
334
- }
335
-
336
- var origin = event.origin,
337
- checkOrigin = settings[iframeId] && settings[iframeId].checkOrigin;
338
-
339
- if (checkOrigin && '' + origin !== 'null' && !checkAllowedOrigin()) {
340
- throw new Error(
341
- 'Unexpected message received from: ' +
342
- origin +
343
- ' for ' +
344
- messageData.iframe.id +
345
- '. Message was: ' +
346
- event.data +
347
- '. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'
348
- )
349
- }
350
-
351
- return true
352
- }
353
-
354
- function isMessageForUs() {
355
- return (
356
- msgId === ('' + msg).slice(0, msgIdLen) &&
357
- msg.slice(msgIdLen).split(':')[0] in settings
358
- ) // ''+Protects against non-string msg
359
- }
360
-
361
- function isMessageFromMetaParent() {
362
- // Test if this message is from a parent above us. This is an ugly test, however, updating
363
- // the message format would break backwards compatibility.
364
- var retCode = messageData.type in { true: 1, false: 1, undefined: 1 };
365
-
366
- if (retCode) {
367
- log(iframeId, 'Ignoring init message from meta parent page');
368
- }
369
-
370
- return retCode
371
- }
372
-
373
- function getMsgBody(offset) {
374
- return msg.slice(msg.indexOf(':') + msgHeaderLen + offset)
375
- }
376
-
377
- function forwardMsgFromIFrame(msgBody) {
378
- log(
379
- iframeId,
380
- 'onMessage passed: {iframe: ' +
381
- messageData.iframe.id +
382
- ', message: ' +
383
- msgBody +
384
- '}'
385
- );
386
-
387
- on('onMessage', {
388
- iframe: messageData.iframe,
389
- message: JSON.parse(msgBody)
390
- });
391
-
392
- log(iframeId, '--');
393
- }
394
-
395
- function getPageInfo() {
396
- var bodyPosition = document.body.getBoundingClientRect(),
397
- iFramePosition = messageData.iframe.getBoundingClientRect();
398
-
399
- return JSON.stringify({
400
- iframeHeight: iFramePosition.height,
401
- iframeWidth: iFramePosition.width,
402
- clientHeight: Math.max(
403
- document.documentElement.clientHeight,
404
- window.innerHeight || 0
405
- ),
406
- clientWidth: Math.max(
407
- document.documentElement.clientWidth,
408
- window.innerWidth || 0
409
- ),
410
- offsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),
411
- offsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),
412
- scrollTop: window.pageYOffset,
413
- scrollLeft: window.pageXOffset,
414
- documentHeight: document.documentElement.clientHeight,
415
- documentWidth: document.documentElement.clientWidth,
416
- windowHeight: window.innerHeight,
417
- windowWidth: window.innerWidth
418
- })
419
- }
420
-
421
- function sendPageInfoToIframe(iframe, iframeId) {
422
- function debouncedTrigger() {
423
- trigger('Send Page Info', 'pageInfo:' + getPageInfo(), iframe, iframeId);
424
- }
425
- debounceFrameEvents(debouncedTrigger, 32, iframeId);
426
- }
427
-
428
- function startPageInfoMonitor() {
429
- function setListener(type, func) {
430
- function sendPageInfo() {
431
- if (settings[id]) {
432
- sendPageInfoToIframe(settings[id].iframe, id);
433
- } else {
434
- stop();
435
- }
436
- }
437
- ['scroll', 'resize'].forEach(function (evt) {
438
- log(id, type + evt + ' listener for sendPageInfo');
439
- func(window, evt, sendPageInfo);
440
- });
441
- }
442
-
443
- function stop() {
444
- setListener('Remove ', removeEventListener);
445
- }
446
-
447
- function start() {
448
- setListener('Add ', addEventListener);
449
- }
450
-
451
- var id = iframeId; // Create locally scoped copy of iFrame ID
452
-
453
- start();
454
-
455
- if (settings[id]) {
456
- settings[id].stopPageInfo = stop;
457
- }
458
- }
459
-
460
- function stopPageInfoMonitor() {
461
- if (settings[iframeId] && settings[iframeId].stopPageInfo) {
462
- settings[iframeId].stopPageInfo();
463
- delete settings[iframeId].stopPageInfo;
464
- }
465
- }
466
-
467
- function checkIFrameExists() {
468
- var retBool = true;
469
-
470
- if (null === messageData.iframe) {
471
- warn(iframeId, 'IFrame (' + messageData.id + ') not found');
472
- retBool = false;
473
- }
474
- return retBool
475
- }
476
-
477
- function getElementPosition(target) {
478
- var iFramePosition = target.getBoundingClientRect();
479
-
480
- getPagePosition(iframeId);
481
-
482
- return {
483
- x: Math.floor(Number(iFramePosition.left) + Number(pagePosition.x)),
484
- y: Math.floor(Number(iFramePosition.top) + Number(pagePosition.y))
485
- }
486
- }
487
-
488
- function scrollRequestFromChild(addOffset) {
489
- /* istanbul ignore next */ // Not testable in Karma
490
- function reposition() {
491
- pagePosition = newPosition;
492
- scrollTo();
493
- log(iframeId, '--');
494
- }
495
-
496
- function calcOffset() {
497
- return {
498
- x: Number(messageData.width) + offset.x,
499
- y: Number(messageData.height) + offset.y
500
- }
501
- }
502
-
503
- function scrollParent() {
504
- if (window.parentIFrame) {
505
- window.parentIFrame['scrollTo' + (addOffset ? 'Offset' : '')](
506
- newPosition.x,
507
- newPosition.y
508
- );
509
- } else {
510
- warn(
511
- iframeId,
512
- 'Unable to scroll to requested position, window.parentIFrame not found'
513
- );
514
- }
515
- }
516
-
517
- var offset = addOffset
518
- ? getElementPosition(messageData.iframe)
519
- : { x: 0, y: 0 },
520
- newPosition = calcOffset();
521
-
522
- log(
523
- iframeId,
524
- 'Reposition requested from iFrame (offset x:' +
525
- offset.x +
526
- ' y:' +
527
- offset.y +
528
- ')'
529
- );
530
-
531
- if (window.top === window.self) {
532
- reposition();
533
- } else {
534
- scrollParent();
535
- }
536
- }
537
-
538
- function scrollTo() {
539
- if (false === on('onScroll', pagePosition)) {
540
- unsetPagePosition();
541
- } else {
542
- setPagePosition(iframeId);
543
- }
544
- }
545
-
546
- function findTarget(location) {
547
- function jumpToTarget() {
548
- var jumpPosition = getElementPosition(target);
549
-
550
- log(
551
- iframeId,
552
- 'Moving to in page link (#' +
553
- hash +
554
- ') at x: ' +
555
- jumpPosition.x +
556
- ' y: ' +
557
- jumpPosition.y
558
- );
559
- pagePosition = {
560
- x: jumpPosition.x,
561
- y: jumpPosition.y
562
- };
563
-
564
- scrollTo();
565
- log(iframeId, '--');
566
- }
567
-
568
- function jumpToParent() {
569
- if (window.parentIFrame) {
570
- window.parentIFrame.moveToAnchor(hash);
571
- } else {
572
- log(
573
- iframeId,
574
- 'In page link #' +
575
- hash +
576
- ' not found and window.parentIFrame not found'
577
- );
578
- }
579
- }
580
-
581
- var hash = location.split('#')[1] || '',
582
- hashData = decodeURIComponent(hash),
583
- target =
584
- document.getElementById(hashData) ||
585
- document.getElementsByName(hashData)[0];
586
-
587
- if (target) {
588
- jumpToTarget();
589
- } else if (window.top === window.self) {
590
- log(iframeId, 'In page link #' + hash + ' not found');
591
- } else {
592
- jumpToParent();
593
- }
594
- }
595
-
596
- function onMouse(event) {
597
- var mousePos = {};
598
-
599
- if (Number(messageData.width) === 0 && Number(messageData.height) === 0) {
600
- var data = getMsgBody(9).split(':');
601
- mousePos = {
602
- x: data[1],
603
- y: data[0]
604
- };
605
- } else {
606
- mousePos = {
607
- x: messageData.width,
608
- y: messageData.height
609
- };
610
- }
611
-
612
- on(event, {
613
- iframe: messageData.iframe,
614
- screenX: Number(mousePos.x),
615
- screenY: Number(mousePos.y),
616
- type: messageData.type
617
- });
618
- }
619
-
620
- function on(funcName, val) {
621
- return chkEvent(iframeId, funcName, val)
622
- }
623
-
624
- function actionMsg() {
625
- if (settings[iframeId] && settings[iframeId].firstRun) firstRun();
626
-
627
- switch (messageData.type) {
628
- case 'close': {
629
- closeIFrame(messageData.iframe);
630
- break
631
- }
632
-
633
- case 'message': {
634
- forwardMsgFromIFrame(getMsgBody(6));
635
- break
636
- }
637
-
638
- case 'mouseenter': {
639
- onMouse('onMouseEnter');
640
- break
641
- }
642
-
643
- case 'mouseleave': {
644
- onMouse('onMouseLeave');
645
- break
646
- }
647
-
648
- case 'autoResize': {
649
- settings[iframeId].autoResize = JSON.parse(getMsgBody(9));
650
- break
651
- }
652
-
653
- case 'scrollTo': {
654
- scrollRequestFromChild(false);
655
- break
656
- }
657
-
658
- case 'scrollToOffset': {
659
- scrollRequestFromChild(true);
660
- break
661
- }
662
-
663
- case 'pageInfo': {
664
- sendPageInfoToIframe(
665
- settings[iframeId] && settings[iframeId].iframe,
666
- iframeId
667
- );
668
- startPageInfoMonitor();
669
- break
670
- }
671
-
672
- case 'pageInfoStop': {
673
- stopPageInfoMonitor();
674
- break
675
- }
676
-
677
- case 'inPageLink': {
678
- findTarget(getMsgBody(9));
679
- break
680
- }
681
-
682
- case 'reset': {
683
- resetIFrame(messageData);
684
- break
685
- }
686
-
687
- case 'init': {
688
- resizeIFrame();
689
- on('onInit', messageData.iframe);
690
- break
691
- }
692
-
693
- default: {
694
- if (
695
- Number(messageData.width) === 0 &&
696
- Number(messageData.height) === 0
697
- ) {
698
- warn(
699
- 'Unsupported message received (' +
700
- messageData.type +
701
- '), this is likely due to the iframe containing a later ' +
702
- 'version of iframe-resizer than the parent page'
703
- );
704
- } else {
705
- resizeIFrame();
706
- }
707
- }
708
- }
709
- }
710
-
711
- function hasSettings(iframeId) {
712
- var retBool = true;
713
-
714
- if (!settings[iframeId]) {
715
- retBool = false;
716
- warn(
717
- messageData.type +
718
- ' No settings for ' +
719
- iframeId +
720
- '. Message was: ' +
721
- msg
722
- );
723
- }
724
-
725
- return retBool
726
- }
727
-
728
- function iFrameReadyMsgReceived() {
729
- // eslint-disable-next-line no-restricted-syntax, guard-for-in
730
- for (var iframeId in settings) {
731
- trigger(
732
- 'iFrame requested init',
733
- createOutgoingMsg(iframeId),
734
- settings[iframeId].iframe,
735
- iframeId
736
- );
737
- }
738
- }
739
-
740
- function firstRun() {
741
- if (settings[iframeId]) {
742
- settings[iframeId].firstRun = false;
743
- }
744
- }
745
-
746
- var msg = event.data,
747
- messageData = {},
748
- iframeId = null;
749
-
750
- if ('[iFrameResizerChild]Ready' === msg) {
751
- iFrameReadyMsgReceived();
752
- } else if (isMessageForUs()) {
753
- messageData = processMsg();
754
- iframeId = messageData.id;
755
- if (settings[iframeId]) {
756
- settings[iframeId].loaded = true;
757
- }
758
-
759
- if (!isMessageFromMetaParent() && hasSettings(iframeId)) {
760
- log(iframeId, 'Received: ' + msg);
761
-
762
- if (checkIFrameExists() && isMessageFromIFrame()) {
763
- actionMsg();
764
- }
765
- }
766
- } else {
767
- info(iframeId, 'Ignored: ' + msg);
768
- }
769
- }
770
-
771
- function chkEvent(iframeId, funcName, val) {
772
- var func = null,
773
- retVal = null;
774
-
775
- if (settings[iframeId]) {
776
- func = settings[iframeId][funcName];
777
-
778
- if ('function' === typeof func) {
779
- retVal = func(val);
780
- } else {
781
- throw new TypeError(
782
- funcName + ' on iFrame[' + iframeId + '] is not a function'
783
- )
784
- }
785
- }
786
-
787
- return retVal
788
- }
789
-
790
- function removeIframeListeners(iframe) {
791
- var iframeId = iframe.id;
792
- delete settings[iframeId];
793
- }
794
-
795
- function closeIFrame(iframe) {
796
- var iframeId = iframe.id;
797
- if (chkEvent(iframeId, 'onClose', iframeId) === false) {
798
- log(iframeId, 'Close iframe cancelled by onClose event');
799
- return
800
- }
801
- log(iframeId, 'Removing iFrame: ' + iframeId);
802
-
803
- try {
804
- // Catch race condition error with React
805
- if (iframe.parentNode) {
806
- iframe.parentNode.removeChild(iframe);
807
- }
808
- } catch (error) {
809
- warn(error);
810
- }
811
-
812
- chkEvent(iframeId, 'onClosed', iframeId);
813
- log(iframeId, '--');
814
- removeIframeListeners(iframe);
815
- if (destroyObserver) {
816
- destroyObserver.disconnect();
817
- destroyObserver = null;
818
- }
819
- }
820
-
821
- function getPagePosition(iframeId) {
822
- if (null === pagePosition) {
823
- pagePosition = {
824
- x:
825
- window.pageXOffset === undefined$1
826
- ? document.documentElement.scrollLeft
827
- : window.pageXOffset,
828
- y:
829
- window.pageYOffset === undefined$1
830
- ? document.documentElement.scrollTop
831
- : window.pageYOffset
832
- };
833
- log(
834
- iframeId,
835
- 'Get page position: ' + pagePosition.x + ',' + pagePosition.y
836
- );
837
- }
838
- }
839
-
840
- function setPagePosition(iframeId) {
841
- if (null !== pagePosition) {
842
- window.scrollTo(pagePosition.x, pagePosition.y);
843
- log(
844
- iframeId,
845
- 'Set page position: ' + pagePosition.x + ',' + pagePosition.y
846
- );
847
- unsetPagePosition();
848
- }
849
- }
850
-
851
- function unsetPagePosition() {
852
- pagePosition = null;
853
- }
854
-
855
- function resetIFrame(messageData) {
856
- function reset() {
857
- setSize(messageData);
858
- trigger('reset', 'reset', messageData.iframe, messageData.id);
859
- }
860
-
861
- log(
862
- messageData.id,
863
- 'Size reset requested by ' +
864
- ('init' === messageData.type ? 'host page' : 'iFrame')
865
- );
866
- getPagePosition(messageData.id);
867
- syncResize(reset, messageData, 'reset');
868
- }
869
-
870
- function setSize(messageData) {
871
- function setDimension(dimension) {
872
- if (!messageData.id) {
873
- log('undefined', 'messageData id not set');
874
- return
875
- }
876
- messageData.iframe.style[dimension] = messageData[dimension] + 'px';
877
- log(
878
- messageData.id,
879
- 'IFrame (' +
880
- iframeId +
881
- ') ' +
882
- dimension +
883
- ' set to ' +
884
- messageData[dimension] +
885
- 'px'
886
- );
887
- }
888
-
889
- function chkZero(dimension) {
890
- // FireFox sets dimension of hidden iFrames to zero.
891
- // So if we detect that set up an event to check for
892
- // when iFrame becomes visible.
893
-
894
- /* istanbul ignore next */ // Not testable in PhantomJS
895
- if (!hiddenCheckEnabled && '0' === messageData[dimension]) {
896
- hiddenCheckEnabled = true;
897
- log(iframeId, 'Hidden iFrame detected, creating visibility listener');
898
- fixHiddenIFrames();
899
- }
900
- }
901
-
902
- function processDimension(dimension) {
903
- setDimension(dimension);
904
- chkZero(dimension);
905
- }
906
-
907
- var iframeId = messageData.iframe.id;
908
-
909
- if (settings[iframeId]) {
910
- if (settings[iframeId].sizeHeight) {
911
- processDimension('height');
912
- }
913
- if (settings[iframeId].sizeWidth) {
914
- processDimension('width');
915
- }
916
- }
917
- }
918
-
919
- function syncResize(func, messageData, doNotSync) {
920
- /* istanbul ignore if */ // Not testable in PhantomJS
921
- if (
922
- doNotSync !== messageData.type &&
923
- requestAnimationFrame &&
924
- // including check for jasmine because had trouble getting spy to work in unit test using requestAnimationFrame
925
- !window.jasmine
926
- ) {
927
- log(messageData.id, 'Requesting animation frame');
928
- requestAnimationFrame(func);
929
- } else {
930
- func();
931
- }
932
- }
933
-
934
- function trigger(calleeMsg, msg, iframe, id, noResponseWarning) {
935
- function postMessageToIFrame() {
936
- var target = settings[id] && settings[id].targetOrigin;
937
- log(
938
- id,
939
- '[' +
940
- calleeMsg +
941
- '] Sending msg to iframe[' +
942
- id +
943
- '] (' +
944
- msg +
945
- ') targetOrigin: ' +
946
- target
947
- );
948
- iframe.contentWindow.postMessage(msgId + msg, target);
949
- }
950
-
951
- function iFrameNotFound() {
952
- warn(id, '[' + calleeMsg + '] IFrame(' + id + ') not found');
953
- }
954
-
955
- function chkAndSend() {
956
- if (
957
- iframe &&
958
- 'contentWindow' in iframe &&
959
- null !== iframe.contentWindow
960
- ) {
961
- // Null test for PhantomJS
962
- postMessageToIFrame();
963
- } else {
964
- iFrameNotFound();
965
- }
966
- }
967
-
968
- function warnOnNoResponse() {
969
- function warning() {
970
- if (settings[id] && !settings[id].loaded && !errorShown) {
971
- errorShown = true;
972
- warn(
973
- id,
974
- 'IFrame has not responded within ' +
975
- settings[id].warningTimeout / 1000 +
976
- ' seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning.'
977
- );
978
- }
979
- }
980
-
981
- if (
982
- !!noResponseWarning &&
983
- settings[id] &&
984
- !!settings[id].warningTimeout
985
- ) {
986
- settings[id].msgTimeout = setTimeout(
987
- warning,
988
- settings[id].warningTimeout
989
- );
990
- }
991
- }
992
-
993
- var errorShown = false;
994
-
995
- id = id || iframe.id;
996
-
997
- if (settings[id]) {
998
- chkAndSend();
999
- warnOnNoResponse();
1000
- }
1001
- }
1002
-
1003
- function createOutgoingMsg(iframeId) {
1004
- return (
1005
- iframeId +
1006
- ':' +
1007
- settings[iframeId].bodyMarginV1 +
1008
- ':' +
1009
- settings[iframeId].sizeWidth +
1010
- ':' +
1011
- settings[iframeId].log +
1012
- ':' +
1013
- settings[iframeId].interval +
1014
- ':' +
1015
- settings[iframeId].enablePublicMethods +
1016
- ':' +
1017
- settings[iframeId].autoResize +
1018
- ':' +
1019
- settings[iframeId].bodyMargin +
1020
- ':' +
1021
- settings[iframeId].heightCalculationMethod +
1022
- ':' +
1023
- settings[iframeId].bodyBackground +
1024
- ':' +
1025
- settings[iframeId].bodyPadding +
1026
- ':' +
1027
- settings[iframeId].tolerance +
1028
- ':' +
1029
- settings[iframeId].inPageLinks +
1030
- ':' +
1031
- settings[iframeId].resizeFrom +
1032
- ':' +
1033
- settings[iframeId].widthCalculationMethod +
1034
- ':' +
1035
- settings[iframeId].mouseEvents
1036
- )
1037
- }
1038
-
1039
- function isNumber(value) {
1040
- return typeof value === 'number'
1041
- }
1042
-
1043
- function setupIFrame(iframe, options) {
1044
- function setLimits() {
1045
- function addStyle(style) {
1046
- var styleValue = settings[iframeId][style];
1047
- if (Infinity !== styleValue && 0 !== styleValue) {
1048
- iframe.style[style] = isNumber(styleValue)
1049
- ? styleValue + 'px'
1050
- : styleValue;
1051
- log(iframeId, 'Set ' + style + ' = ' + iframe.style[style]);
1052
- }
1053
- }
1054
-
1055
- function chkMinMax(dimension) {
1056
- if (
1057
- settings[iframeId]['min' + dimension] >
1058
- settings[iframeId]['max' + dimension]
1059
- ) {
1060
- throw new Error(
1061
- 'Value for min' +
1062
- dimension +
1063
- ' can not be greater than max' +
1064
- dimension
1065
- )
1066
- }
1067
- }
1068
-
1069
- chkMinMax('Height');
1070
- chkMinMax('Width');
1071
-
1072
- addStyle('maxHeight');
1073
- addStyle('minHeight');
1074
- addStyle('maxWidth');
1075
- addStyle('minWidth');
1076
- }
1077
-
1078
- function newId() {
1079
- var id = (options && options.id) || defaults.id + count++;
1080
- if (null !== document.getElementById(id)) {
1081
- id += count++;
1082
- }
1083
- return id
1084
- }
1085
-
1086
- function ensureHasId(iframeId) {
1087
- if (typeof iframeId !== 'string') {
1088
- throw new TypeError('Invaild id for iFrame. Expected String')
1089
- }
1090
-
1091
- if ('' === iframeId) {
1092
- // eslint-disable-next-line no-multi-assign
1093
- iframe.id = iframeId = newId();
1094
- logEnabled = (options || {}).log;
1095
- log(
1096
- iframeId,
1097
- 'Added missing iframe ID: ' + iframeId + ' (' + iframe.src + ')'
1098
- );
1099
- }
1100
-
1101
- return iframeId
1102
- }
1103
-
1104
- function setScrolling() {
1105
- log(
1106
- iframeId,
1107
- 'IFrame scrolling ' +
1108
- (settings[iframeId] && settings[iframeId].scrolling
1109
- ? 'enabled'
1110
- : 'disabled') +
1111
- ' for ' +
1112
- iframeId
1113
- );
1114
- iframe.style.overflow =
1115
- false === (settings[iframeId] && settings[iframeId].scrolling)
1116
- ? 'hidden'
1117
- : 'auto';
1118
- switch (settings[iframeId] && settings[iframeId].scrolling) {
1119
- case 'omit': {
1120
- break
1121
- }
1122
-
1123
- case true: {
1124
- iframe.scrolling = 'yes';
1125
- break
1126
- }
1127
-
1128
- case false: {
1129
- iframe.scrolling = 'no';
1130
- break
1131
- }
1132
-
1133
- default: {
1134
- iframe.scrolling = settings[iframeId]
1135
- ? settings[iframeId].scrolling
1136
- : 'no';
1137
- }
1138
- }
1139
- }
1140
-
1141
- // The V1 iFrame script expects an int, where as in V2 expects a CSS
1142
- // string value such as '1px 3em', so if we have an int for V2, set V1=V2
1143
- // and then convert V2 to a string PX value.
1144
- function setupBodyMarginValues() {
1145
- if (
1146
- 'number' ===
1147
- typeof (settings[iframeId] && settings[iframeId].bodyMargin) ||
1148
- '0' === (settings[iframeId] && settings[iframeId].bodyMargin)
1149
- ) {
1150
- settings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;
1151
- settings[iframeId].bodyMargin =
1152
- '' + settings[iframeId].bodyMargin + 'px';
1153
- }
1154
- }
1155
-
1156
- function checkReset() {
1157
- // Reduce scope of firstRun to function, because IE8's JS execution
1158
- // context stack is borked and this value gets externally
1159
- // changed midway through running this function!!!
1160
- var firstRun = settings[iframeId] && settings[iframeId].firstRun,
1161
- resetRequertMethod =
1162
- settings[iframeId] &&
1163
- settings[iframeId].heightCalculationMethod in resetRequiredMethods;
1164
-
1165
- if (!firstRun && resetRequertMethod) {
1166
- resetIFrame({ iframe: iframe, height: 0, width: 0, type: 'init' });
1167
- }
1168
- }
1169
-
1170
- function setupIFrameObject() {
1171
- if (settings[iframeId]) {
1172
- settings[iframeId].iframe.iFrameResizer = {
1173
- close: closeIFrame.bind(null, settings[iframeId].iframe),
1174
-
1175
- removeListeners: removeIframeListeners.bind(
1176
- null,
1177
- settings[iframeId].iframe
1178
- ),
1179
-
1180
- resize: trigger.bind(
1181
- null,
1182
- 'Window resize',
1183
- 'resize',
1184
- settings[iframeId].iframe
1185
- ),
1186
-
1187
- moveToAnchor: function (anchor) {
1188
- trigger(
1189
- 'Move to anchor',
1190
- 'moveToAnchor:' + anchor,
1191
- settings[iframeId].iframe,
1192
- iframeId
1193
- );
1194
- },
1195
-
1196
- sendMessage: function (message) {
1197
- message = JSON.stringify(message);
1198
- trigger(
1199
- 'Send Message',
1200
- 'message:' + message,
1201
- settings[iframeId].iframe,
1202
- iframeId
1203
- );
1204
- }
1205
- };
1206
- }
1207
- }
1208
-
1209
- // We have to call trigger twice, as we can not be sure if all
1210
- // iframes have completed loading when this code runs. The
1211
- // event listener also catches the page changing in the iFrame.
1212
- function init(msg) {
1213
- function iFrameLoaded() {
1214
- trigger('iFrame.onload', msg, iframe, undefined$1, true);
1215
- checkReset();
1216
- }
1217
-
1218
- function createDestroyObserver(MutationObserver) {
1219
- if (!iframe.parentNode) {
1220
- return null
1221
- }
1222
-
1223
- var destroyObserver = new MutationObserver(function (mutations) {
1224
- mutations.forEach(function (mutation) {
1225
- var removedNodes = Array.prototype.slice.call(mutation.removedNodes); // Transform NodeList into an Array
1226
- removedNodes.forEach(function (removedNode) {
1227
- if (removedNode === iframe) {
1228
- closeIFrame(iframe);
1229
- }
1230
- });
1231
- });
1232
- });
1233
- destroyObserver.observe(iframe.parentNode, {
1234
- childList: true
1235
- });
1236
- return destroyObserver
1237
- }
1238
-
1239
- var MutationObserver = getMutationObserver();
1240
- if (MutationObserver) {
1241
- destroyObserver = createDestroyObserver(MutationObserver);
1242
- }
1243
-
1244
- addEventListener(iframe, 'load', iFrameLoaded);
1245
- trigger('init', msg, iframe, undefined$1, true);
1246
- }
1247
-
1248
- function checkOptions(options) {
1249
- if ('object' !== typeof options) {
1250
- throw new TypeError('Options is not an object')
1251
- }
1252
- }
1253
-
1254
- function copyOptions(options) {
1255
- // eslint-disable-next-line no-restricted-syntax
1256
- for (var option in defaults) {
1257
- if (Object.prototype.hasOwnProperty.call(defaults, option)) {
1258
- settings[iframeId][option] = Object.prototype.hasOwnProperty.call(
1259
- options,
1260
- option
1261
- )
1262
- ? options[option]
1263
- : defaults[option];
1264
- }
1265
- }
1266
- }
1267
-
1268
- function getTargetOrigin(remoteHost) {
1269
- return '' === remoteHost ||
1270
- null !== remoteHost.match(/^(about:blank|javascript:|file:\/\/)/)
1271
- ? '*'
1272
- : remoteHost
1273
- }
1274
-
1275
- function depricate(key) {
1276
- var splitName = key.split('Callback');
1277
-
1278
- if (splitName.length === 2) {
1279
- var name =
1280
- 'on' + splitName[0].charAt(0).toUpperCase() + splitName[0].slice(1);
1281
- this[name] = this[key];
1282
- delete this[key];
1283
- warn(
1284
- iframeId,
1285
- "Deprecated: '" +
1286
- key +
1287
- "' has been renamed '" +
1288
- name +
1289
- "'. The old method will be removed in the next major version."
1290
- );
1291
- }
1292
- }
1293
-
1294
- function processOptions(options) {
1295
- options = options || {};
1296
-
1297
- settings[iframeId] = Object.create(null); // Protect against prototype attacks
1298
- settings[iframeId].iframe = iframe;
1299
- settings[iframeId].firstRun = true;
1300
- settings[iframeId].remoteHost =
1301
- iframe.src && iframe.src.split('/').slice(0, 3).join('/');
1302
-
1303
- checkOptions(options);
1304
- Object.keys(options).forEach(depricate, options);
1305
- copyOptions(options);
1306
-
1307
- if (settings[iframeId]) {
1308
- settings[iframeId].targetOrigin =
1309
- true === settings[iframeId].checkOrigin
1310
- ? getTargetOrigin(settings[iframeId].remoteHost)
1311
- : '*';
1312
- }
1313
- }
1314
-
1315
- function beenHere() {
1316
- return iframeId in settings && 'iFrameResizer' in iframe
1317
- }
1318
-
1319
- var iframeId = ensureHasId(iframe.id);
1320
-
1321
- if (beenHere()) {
1322
- warn(iframeId, 'Ignored iFrame, already setup.');
1323
- } else {
1324
- processOptions(options);
1325
- setScrolling();
1326
- setLimits();
1327
- setupBodyMarginValues();
1328
- init(createOutgoingMsg(iframeId));
1329
- setupIFrameObject();
1330
- }
1331
- }
1332
-
1333
- function debouce(fn, time) {
1334
- if (null === timer) {
1335
- timer = setTimeout(function () {
1336
- timer = null;
1337
- fn();
1338
- }, time);
1339
- }
1340
- }
1341
-
1342
- var frameTimer = {};
1343
- function debounceFrameEvents(fn, time, frameId) {
1344
- if (!frameTimer[frameId]) {
1345
- frameTimer[frameId] = setTimeout(function () {
1346
- frameTimer[frameId] = null;
1347
- fn();
1348
- }, time);
1349
- }
1350
- }
1351
-
1352
- // Not testable in PhantomJS
1353
- /* istanbul ignore next */
1354
-
1355
- function fixHiddenIFrames() {
1356
- function checkIFrames() {
1357
- function checkIFrame(settingId) {
1358
- function chkDimension(dimension) {
1359
- return (
1360
- '0px' ===
1361
- (settings[settingId] && settings[settingId].iframe.style[dimension])
1362
- )
1363
- }
1364
-
1365
- function isVisible(el) {
1366
- return null !== el.offsetParent
1367
- }
1368
-
1369
- if (
1370
- settings[settingId] &&
1371
- isVisible(settings[settingId].iframe) &&
1372
- (chkDimension('height') || chkDimension('width'))
1373
- ) {
1374
- trigger(
1375
- 'Visibility change',
1376
- 'resize',
1377
- settings[settingId].iframe,
1378
- settingId
1379
- );
1380
- }
1381
- }
1382
-
1383
- Object.keys(settings).forEach(function (key) {
1384
- checkIFrame(key);
1385
- });
1386
- }
1387
-
1388
- function mutationObserved(mutations) {
1389
- log(
1390
- 'window',
1391
- 'Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type
1392
- );
1393
- debouce(checkIFrames, 16);
1394
- }
1395
-
1396
- function createMutationObserver() {
1397
- var target = document.querySelector('body'),
1398
- config = {
1399
- attributes: true,
1400
- attributeOldValue: false,
1401
- characterData: true,
1402
- characterDataOldValue: false,
1403
- childList: true,
1404
- subtree: true
1405
- },
1406
- observer = new MutationObserver(mutationObserved);
1407
-
1408
- observer.observe(target, config);
1409
- }
1410
-
1411
- var MutationObserver = getMutationObserver();
1412
- if (MutationObserver) {
1413
- createMutationObserver();
1414
- }
1415
- }
1416
-
1417
- function resizeIFrames(event) {
1418
- function resize() {
1419
- sendTriggerMsg('Window ' + event, 'resize');
1420
- }
1421
-
1422
- log('window', 'Trigger event: ' + event);
1423
- debouce(resize, 16);
1424
- }
1425
-
1426
- // Not testable in PhantomJS
1427
- /* istanbul ignore next */
1428
- function tabVisible() {
1429
- function resize() {
1430
- sendTriggerMsg('Tab Visible', 'resize');
1431
- }
1432
-
1433
- if ('hidden' !== document.visibilityState) {
1434
- log('document', 'Trigger event: Visibility change');
1435
- debouce(resize, 16);
1436
- }
1437
- }
1438
-
1439
- function sendTriggerMsg(eventName, event) {
1440
- function isIFrameResizeEnabled(iframeId) {
1441
- return (
1442
- settings[iframeId] &&
1443
- 'parent' === settings[iframeId].resizeFrom &&
1444
- settings[iframeId].autoResize &&
1445
- !settings[iframeId].firstRun
1446
- )
1447
- }
1448
-
1449
- Object.keys(settings).forEach(function (iframeId) {
1450
- if (isIFrameResizeEnabled(iframeId)) {
1451
- trigger(eventName, event, settings[iframeId].iframe, iframeId);
1452
- }
1453
- });
1454
- }
1455
-
1456
- function setupEventListeners() {
1457
- addEventListener(window, 'message', iFrameListener);
1458
-
1459
- addEventListener(window, 'resize', function () {
1460
- resizeIFrames('resize');
1461
- });
1462
-
1463
- addEventListener(document, 'visibilitychange', tabVisible);
1464
-
1465
- addEventListener(document, '-webkit-visibilitychange', tabVisible);
1466
- }
1467
-
1468
- function factory() {
1469
- function init(options, element) {
1470
- function chkType() {
1471
- if (!element.tagName) {
1472
- throw new TypeError('Object is not a valid DOM element')
1473
- } else if ('IFRAME' !== element.tagName.toUpperCase()) {
1474
- throw new TypeError(
1475
- 'Expected <IFRAME> tag, found <' + element.tagName + '>'
1476
- )
1477
- }
1478
- }
1479
-
1480
- if (element) {
1481
- chkType();
1482
- setupIFrame(element, options);
1483
- iFrames.push(element);
1484
- }
1485
- }
1486
-
1487
- function warnDeprecatedOptions(options) {
1488
- if (options && options.enablePublicMethods) {
1489
- warn(
1490
- 'enablePublicMethods option has been removed, public methods are now always available in the iFrame'
1491
- );
1492
- }
1493
- }
1494
-
1495
- var iFrames;
1496
-
1497
- setupRequestAnimationFrame();
1498
- setupEventListeners();
1499
-
1500
- return function iFrameResizeF(options, target) {
1501
- iFrames = []; // Only return iFrames past in on this call
1502
-
1503
- warnDeprecatedOptions(options);
1504
-
1505
- switch (typeof target) {
1506
- case 'undefined':
1507
- case 'string': {
1508
- Array.prototype.forEach.call(
1509
- document.querySelectorAll(target || 'iframe'),
1510
- init.bind(undefined$1, options)
1511
- );
1512
- break
1513
- }
1514
-
1515
- case 'object': {
1516
- init(options, target);
1517
- break
1518
- }
1519
-
1520
- default: {
1521
- throw new TypeError('Unexpected data type (' + typeof target + ')')
1522
- }
1523
- }
1524
-
1525
- return iFrames
1526
- }
1527
- }
1528
-
1529
- function createJQueryPublicMethod($) {
1530
- if (!$.fn) {
1531
- info('', 'Unable to bind to jQuery, it is not fully loaded.');
1532
- } else if (!$.fn.iFrameResize) {
1533
- $.fn.iFrameResize = function $iFrameResizeF(options) {
1534
- function init(index, element) {
1535
- setupIFrame(element, options);
1536
- }
1537
-
1538
- return this.filter('iframe').each(init).end()
1539
- };
1540
- }
1541
- }
1542
-
1543
- if (window.jQuery !== undefined$1) {
1544
- createJQueryPublicMethod(window.jQuery);
1545
- }
1546
-
1547
- if (typeof undefined$1 === 'function' && undefined$1.amd) {
1548
- undefined$1([], factory);
1549
- } else {
1550
- // Node for browserfy
1551
- module.exports = factory();
1552
- }
1553
- window.iFrameResize = window.iFrameResize || factory();
1554
- })();
1555
- }(iframeResizer));
1556
-
1557
- const iFrameResize = iframeResizer.exports;
1558
-
1559
- const MessageEventType = {
1560
- card: {
1561
- ready: 'justifi.card.ready',
1562
- tokenize: 'justifi.card.tokenize',
1563
- validate: 'justifi.card.validate',
1564
- resize: 'justifi.card.resize',
1565
- styleOverrides: 'justifi.card.styleOverrides',
1566
- },
1567
- bankAccount: {
1568
- ready: 'justifi.bankAccount.ready',
1569
- tokenize: 'justifi.bankAccount.tokenize',
1570
- validate: 'justifi.bankAccount.validate',
1571
- resize: 'justifi.bankAccount.resize',
1572
- styleOverrides: 'justifi.bankAccount.styleOverrides',
1573
- },
1574
- };
1575
-
1576
- const getComputedTheme = () => {
1577
- const computedStyles = getComputedStyle(document.body);
1578
- const computedTheme = {
1579
- loadGoogleFont: computedStyles.getPropertyValue('--jfi-load-google-font'),
1580
- layout: {
1581
- fontFamily: computedStyles.getPropertyValue('--jfi-layout-font-family'),
1582
- padding: computedStyles.getPropertyValue('--jfi-layout-padding'),
1583
- formControlSpacingHorizontal: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-x'),
1584
- formControlSpacingVertical: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-y'),
1585
- },
1586
- formControl: {
1587
- backgroundColor: computedStyles.getPropertyValue('--jfi-form-control-background-color'),
1588
- borderColor: computedStyles.getPropertyValue('--jfi-form-control-border-color'),
1589
- borderColorFocus: computedStyles.getPropertyValue('--jfi-form-control-border-color-focus'),
1590
- borderColorError: computedStyles.getPropertyValue('--jfi-form-control-border-color-error'),
1591
- borderWidth: computedStyles.getPropertyValue('--jfi-form-control-border-width'),
1592
- borderBottomWidth: computedStyles.getPropertyValue('--jfi-form-control-border-bottom-width'),
1593
- borderLeftWidth: computedStyles.getPropertyValue('--jfi-form-control-border-left-width'),
1594
- borderRightWidth: computedStyles.getPropertyValue('--jfi-form-control-border-right-width'),
1595
- borderTopWidth: computedStyles.getPropertyValue('--jfi-form-control-border-top-width'),
1596
- borderRadius: computedStyles.getPropertyValue('--jfi-form-control-border-radius'),
1597
- borderStyle: computedStyles.getPropertyValue('--jfi-form-control-border-style'),
1598
- boxShadow: computedStyles.getPropertyValue('--jfi-form-control-box-shadow'),
1599
- boxShadowError: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error'),
1600
- boxShadowErrorFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error-focus'),
1601
- boxShadowFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-focus'),
1602
- color: computedStyles.getPropertyValue('--jfi-form-control-color'),
1603
- colorFocus: computedStyles.getPropertyValue('--jfi-form-control-color-focus'),
1604
- fontSize: computedStyles.getPropertyValue('--jfi-form-control-font-size'),
1605
- fontWeight: computedStyles.getPropertyValue('--jfi-form-control-font-weight'),
1606
- lineHeight: computedStyles.getPropertyValue('--jfi-form-control-line-height'),
1607
- margin: computedStyles.getPropertyValue('--jfi-form-control-margin'),
1608
- padding: computedStyles.getPropertyValue('--jfi-form-control-padding'),
1609
- },
1610
- formLabel: {
1611
- color: computedStyles.getPropertyValue('--jfi-form-label-color'),
1612
- fontFamily: computedStyles.getPropertyValue('--jfi-form-label-font-family'),
1613
- fontSize: computedStyles.getPropertyValue('--jfi-form-label-font-size'),
1614
- fontWeight: computedStyles.getPropertyValue('--jfi-form-label-font-weight'),
1615
- margin: computedStyles.getPropertyValue('--jfi-form-label-margin'),
1616
- },
1617
- errorMessage: {
1618
- color: computedStyles.getPropertyValue('--jfi-error-message-color'),
1619
- margin: computedStyles.getPropertyValue('--jfi-error-message-margin'),
1620
- fontSize: computedStyles.getPropertyValue('--jfi-error-message-font-size'),
1621
- },
1622
- };
1623
- return computedTheme;
1624
- };
1625
-
1626
- /**
1627
- * This approach decouples the communication logic from PaymentMethodForm component,
1628
- * making it cleaner, more maintainable, and easier to test
1629
- */
1630
- class FrameCommunicationService {
1631
- constructor(iframe, iframeOrigin) {
1632
- this.iframe = iframe;
1633
- this.iframeOrigin = iframeOrigin;
1634
- }
1635
- postMessage(eventType, payload) {
1636
- const message = Object.assign({ eventType }, payload);
1637
- this.iframe.contentWindow.postMessage(message, this.iframeOrigin);
1638
- }
1639
- addMessageListener(callback) {
1640
- window.addEventListener('message', callback);
1641
- }
1642
- removeMessageListener(callback) {
1643
- window.removeEventListener('message', callback);
1644
- }
1645
- postMessageWithResponseListener(eventType, payload) {
1646
- return new Promise((resolve) => {
1647
- const responseListener = (event) => {
1648
- if (event.data.eventType !== eventType)
1649
- return;
1650
- window.removeEventListener('message', responseListener);
1651
- resolve(event.data.data);
1652
- };
1653
- window.addEventListener('message', responseListener);
1654
- this.postMessage(eventType, payload);
1655
- });
1656
- }
1657
- }
1658
-
1659
- const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}iframe{width:1px;min-width:100%}";
1660
- const JustifiPaymentMethodFormStyle0 = paymentMethodFormCss;
1661
-
1662
- const PaymentMethodForm = class {
63
+ const SaveNewPaymentMethod = class {
1663
64
  constructor(hostRef) {
1664
65
  index.registerInstance(this, hostRef);
1665
- this.paymentMethodFormReady = index.createEvent(this, "paymentMethodFormReady", 7);
1666
- this.paymentMethodFormValidated = index.createEvent(this, "paymentMethodFormValidated", 7);
1667
- this.paymentMethodFormTokenized = index.createEvent(this, "paymentMethodFormTokenized", 7);
1668
- this.computedTheme = getComputedTheme();
1669
- this.dispatchMessageEvent = (messageEvent) => {
1670
- const { eventType, data } = messageEvent.data;
1671
- const eventTypeMessage = MessageEventType[this.paymentMethodFormType];
1672
- if (eventType === eventTypeMessage.ready) {
1673
- this.paymentMethodFormReady.emit(data);
1674
- }
1675
- else if (eventType === eventTypeMessage.tokenize) {
1676
- this.paymentMethodFormTokenized.emit(data);
1677
- }
1678
- else if (eventType === eventTypeMessage.validate) {
1679
- this.paymentMethodFormValidated.emit(data);
1680
- }
1681
- };
1682
- this.postMessage = (eventType, payload) => {
1683
- this.frameService.postMessage(eventType, payload);
1684
- };
1685
- this.paymentMethodFormType = undefined;
1686
- this.paymentMethodFormValidationMode = undefined;
1687
- this.iframeOrigin = undefined;
1688
- this.singleLine = undefined;
1689
- }
1690
- disconnectedCallback() {
1691
- this.frameService.removeMessageListener(this.dispatchMessageEvent);
1692
- }
1693
- async resize() {
1694
- this.postMessage(MessageEventType[this.paymentMethodFormType].resize);
1695
- }
1696
- async tokenize(clientId, paymentMethodMetadata, account) {
1697
- const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
1698
- return this.frameService.postMessageWithResponseListener(eventType, {
1699
- clientId,
1700
- paymentMethodMetadata,
1701
- account,
1702
- componentVersion: _package.packageJson.version,
1703
- });
1704
- }
1705
- async validate() {
1706
- const eventType = MessageEventType[this.paymentMethodFormType].validate;
1707
- return this.frameService.postMessageWithResponseListener(eventType);
1708
- }
1709
- sendStyleOverrides() {
1710
- if (this.computedTheme) {
1711
- this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.computedTheme });
1712
- }
1713
- }
1714
- getIframeSrc() {
1715
- let paramsList = [];
1716
- if (this.paymentMethodFormValidationMode) {
1717
- paramsList.push(`validationMode=${this.paymentMethodFormValidationMode}`);
1718
- }
1719
- if (this.singleLine) {
1720
- paramsList.push(`singleLine=${this.singleLine}`);
1721
- }
1722
- let iframeSrc = `${this.iframeOrigin}/${this.paymentMethodFormType}${utils$1.composeQueryParams(paramsList)}`;
1723
- return iframeSrc;
66
+ this.checkboxChanged = index.createEvent(this, "checkboxChanged", 7);
67
+ this.isChecked = false;
1724
68
  }
1725
- initializeFrameCommunicationService() {
1726
- var _a;
1727
- this.frameService = new FrameCommunicationService(this.iframeElement, this.iframeOrigin);
1728
- (_a = this.frameService) === null || _a === void 0 ? void 0 : _a.addMessageListener(this.dispatchMessageEvent);
69
+ handleCheckboxChange(event) {
70
+ const target = event.target;
71
+ this.isChecked = target.checked;
72
+ this.checkboxChanged.emit(this.isChecked);
1729
73
  }
1730
74
  render() {
1731
- return (index.h(index.Host, { key: '91a69ce3f918c98248d6bb5df6dc5ec0dffe3c26' }, index.h("iframe", { key: '99c06be5a78a3849e687f7f95f8fe3382cc2c4cd', id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: el => {
1732
- this.iframeElement = el;
1733
- this.initializeFrameCommunicationService();
1734
- }, onLoad: () => {
1735
- iFrameResize({
1736
- scrollbars: false,
1737
- }, this.iframeElement);
1738
- this.sendStyleOverrides();
1739
- } })));
75
+ return (index.h("div", { key: '2de6df80b2da83b29a9adb8b1a94d6326200567b', class: "mt-4 d-flex align-items-center" }, index.h("input", { key: 'ad5bac37f404ed7abf754d7ed87b58a80f04150e', type: "checkbox", checked: this.isChecked, onChange: (event) => this.handleCheckboxChange(event), class: "me-2" }), index.h("label", { key: 'cc860c51e9a9efdb95cdaf974723b2538204d6a0', class: 'checkbox-label' }, "Save new payment method")));
1740
76
  }
1741
77
  };
1742
- PaymentMethodForm.style = JustifiPaymentMethodFormStyle0;
1743
78
 
1744
79
  exports.justifi_billing_form = BillingForm;
1745
- exports.justifi_payment_method_form = PaymentMethodForm;
80
+ exports.justifi_save_new_payment_method = SaveNewPaymentMethod;