@justifi/webcomponents 4.8.3 → 4.10.0-rc.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.
- package/dist/cjs/{Business-42d0c522.js → Business-79361c8a.js} +7 -7
- package/dist/cjs/Identity-b6364aee.js +27 -0
- package/dist/cjs/{Payout-44b49b2d.js → Payment-89a8bc21.js} +0 -43
- package/dist/cjs/Payout-a2dd7b01.js +45 -0
- package/dist/cjs/{SubAccount-2a803b22.js → SubAccount-b3902202.js} +1 -1
- package/dist/cjs/additional-questions-details_5.cjs.entry.js +24 -10
- package/dist/cjs/business-additional-questions-schema-cbac27f2.js +26 -0
- package/dist/cjs/business-details-core.cjs.entry.js +55 -0
- package/dist/cjs/business-form-select-options-7ccd8dca.js +85 -0
- package/dist/cjs/business-form-types-3cdd5447.js +19 -0
- package/dist/cjs/form-control-datepart_3.cjs.entry.js +32 -46
- package/dist/cjs/form-control-monetary.cjs.entry.js +1 -1
- package/dist/cjs/{form-control-select_2.cjs.entry.js → form-control-number_3.cjs.entry.js} +44 -1
- package/dist/cjs/gross-payment-chart-core.cjs.entry.js +11036 -0
- package/dist/cjs/{index-55950669.js → index-69b9386b.js} +57 -3
- package/dist/cjs/justifi-additional-questions-form-step_5.cjs.entry.js +505 -0
- package/dist/cjs/{justifi-additional-questions_5.cjs.entry.js → justifi-additional-questions_4.cjs.entry.js} +12 -42
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +1 -1
- package/dist/cjs/{select-input_2.cjs.entry.js → justifi-billing-form_4.cjs.entry.js} +1810 -1
- package/dist/cjs/justifi-business-address-form-step.cjs.entry.js +35 -0
- package/dist/cjs/justifi-business-details.cjs.entry.js +43 -57
- package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +36 -89
- package/dist/cjs/justifi-business-form.cjs.entry.js +18 -16
- package/dist/cjs/justifi-business-list.cjs.entry.js +5 -4
- package/dist/cjs/justifi-business-owners.cjs.entry.js +1 -1
- package/dist/cjs/justifi-card-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-checkout-core.cjs.entry.js +95 -0
- package/dist/cjs/justifi-checkout.cjs.entry.js +99 -0
- package/dist/cjs/justifi-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +39 -11008
- package/dist/cjs/justifi-new-payment-method_3.cjs.entry.js +168 -0
- package/dist/cjs/justifi-owner-form.cjs.entry.js +160 -0
- package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +5 -4
- package/dist/cjs/justifi-payment-details.cjs.entry.js +6 -5
- package/dist/cjs/justifi-payment-form.cjs.entry.js +5 -4
- package/dist/cjs/{justifi-billing-form_2.cjs.entry.js → justifi-payment-method-selector.cjs.entry.js} +4 -79
- package/dist/cjs/justifi-payments-list.cjs.entry.js +6 -5
- package/dist/cjs/justifi-payout-details.cjs.entry.js +5 -4
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +5 -4
- package/dist/cjs/justifi-proceeds-list.cjs.entry.js +4 -3
- package/dist/cjs/justifi-refund-form.cjs.entry.js +3 -2
- package/dist/cjs/justifi-subaccount-details.cjs.entry.js +6 -5
- package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +5 -4
- package/dist/cjs/justifi-table_2.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/payload-parsers-25ed3936.js +98 -0
- package/dist/cjs/payment-details-core.cjs.entry.js +10 -4
- package/dist/cjs/{payment.service-605896dc.js → payment.service-0b0086dc.js} +2 -1
- package/dist/cjs/payments-list-core.cjs.entry.js +4 -3
- package/dist/cjs/payout-details-core.cjs.entry.js +4 -4
- package/dist/cjs/{payout.service-b39f2739.js → payout.service-5cc3b4e9.js} +2 -1
- package/dist/cjs/payouts-list-core.cjs.entry.js +4 -3
- package/dist/cjs/subaccount-account-details_4.cjs.entry.js +7 -7
- package/dist/cjs/subaccount-bank-details.cjs.entry.js +3 -3
- package/dist/cjs/subaccount-terms-details.cjs.entry.js +3 -3
- package/dist/cjs/{utils-d126d17c.js → utils-23e70ef2.js} +5 -5
- package/dist/cjs/{utils-29a8a91d.js → utils-6f62f7a1.js} +29 -2
- package/dist/cjs/utils-df5167a8.js +13 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/api/Business.js +6 -7
- package/dist/collection/api/Checkout.js +1 -0
- package/dist/collection/api/Identity.js +43 -0
- package/dist/collection/api/index.js +1 -0
- package/dist/collection/api/services/business.service.js +8 -0
- package/dist/collection/api/services/checkout.service.js +12 -0
- package/dist/collection/api/services/reports.service.js +9 -0
- package/dist/collection/collection-manifest.json +22 -8
- package/dist/collection/components/billing-form/billing-form-schema.js +1 -1
- package/dist/collection/components/billing-form/billing-form.js +1 -2
- package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +5 -2
- package/dist/collection/components/business-details/additional-questions-details/test/additional-questions.spec.js +16 -0
- package/dist/collection/components/business-details/business-details-core.js +86 -0
- package/dist/collection/components/business-details/business-details.js +20 -65
- package/dist/collection/components/business-details/generic-info-details/generic-info-details.js +4 -2
- package/dist/collection/components/business-details/generic-info-details/test/generic-info-details.spec.js +16 -0
- package/dist/collection/components/business-details/get-business.js +17 -0
- package/dist/collection/components/business-details/legal-address-details/legal-address-details.js +5 -2
- package/dist/collection/components/business-details/legal-address-details/test/legal-address-details.spec.js +16 -0
- package/dist/collection/components/business-details/owner-details/owner-details.js +12 -14
- package/dist/collection/components/business-details/owner-details/test/owner-details.spec.js +16 -0
- package/dist/collection/components/business-details/representative-details/representative-details.js +7 -5
- package/dist/collection/components/business-details/representative-details/test/representative-details.spec.js +16 -0
- package/dist/collection/components/business-details/test/busines-details-core.spec.js +53 -0
- package/dist/collection/components/business-details/test/business-details.spec.js +40 -0
- package/dist/collection/components/business-details/test/get-business.spec.js +60 -0
- package/dist/collection/components/{business-form → business-forms/business-form}/additional-questions/additional-questions.js +1 -1
- package/dist/collection/components/business-forms/business-form/business-address/business-address-form.css +2536 -0
- package/dist/collection/components/{business-form → business-forms/business-form}/business-address/business-address-form.js +4 -4
- package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.css +2493 -0
- package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.js +77 -0
- package/dist/collection/components/{business-form → business-forms/business-form}/business-form.js +32 -24
- package/dist/collection/components/business-forms/business-form/business-owners/business-owners.css +7779 -0
- package/dist/collection/components/{business-form → business-forms/business-form}/business-owners/business-owners.js +2 -2
- package/dist/collection/components/business-forms/business-form/business-representative/business-representative.css +2493 -0
- package/dist/collection/components/{business-form → business-forms/business-form}/business-representative/business-representative.js +3 -3
- package/dist/collection/components/business-forms/business-form/legal-address-form/legal-address-form.css +2493 -0
- package/dist/collection/components/{business-form → business-forms/business-form}/legal-address-form/legal-address-form.js +1 -1
- package/dist/collection/components/business-forms/business-form-stepped/additional-questions/business-additional-questions-form-step.js +218 -0
- package/dist/collection/components/business-forms/business-form-stepped/additional-questions/test/business-additional-questions-form-step.spec.js +97 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-address/business-address-form-step.js +97 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-address/test/business-address-form-step.spec.js +97 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-core-info/business-core-info-form-step.js +239 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-core-info/test/business-core-info-form-step.spec.js +97 -0
- package/dist/collection/components/{business-form → business-forms/business-form-stepped}/business-form-stepped.css +105 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-form-stepped.js +199 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-owners/business-owners-form-step.js +284 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-owners/test/business-owners-form-step.spec.js +97 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-representative/business-representative-form-step.js +230 -0
- package/dist/collection/components/business-forms/business-form-stepped/business-representative/test/business-representative-form-step.spec.js +97 -0
- package/dist/collection/components/business-forms/business-form-stepped/legal-address-form/legal-address-form-step.js +232 -0
- package/dist/collection/components/business-forms/business-form-stepped/test/business-form-stepped.spec.js +61 -0
- package/dist/collection/components/business-forms/owner-form/owner-form.css +7779 -0
- package/dist/collection/components/business-forms/owner-form/owner-form.js +367 -0
- package/dist/collection/components/business-forms/schemas/business-additional-questions-schema.js +7 -0
- package/dist/collection/components/business-forms/schemas/business-address-schema.js +15 -0
- package/dist/collection/components/business-forms/schemas/business-core-info-schema.js +13 -0
- package/dist/collection/components/business-forms/schemas/business-form-schema.js +6 -0
- package/dist/collection/components/business-forms/schemas/business-identity-schema.js +35 -0
- package/dist/collection/components/business-forms/schemas/business-owners-schema.js +16 -0
- package/dist/collection/components/business-forms/utils/business-form-select-options.js +80 -0
- package/dist/collection/components/business-forms/utils/business-form-types.js +17 -0
- package/dist/collection/components/business-forms/utils/payload-parsers.js +37 -0
- package/dist/collection/components/checkout/checkout-actions.js +33 -0
- package/dist/collection/components/checkout/checkout-core.css +2604 -0
- package/dist/collection/components/checkout/checkout-core.js +248 -0
- package/dist/collection/components/checkout/checkout.js +112 -0
- package/dist/collection/components/checkout/new-payment-method.js +188 -0
- package/dist/collection/components/checkout/payment-method-option-utils.js +19 -0
- package/dist/collection/components/checkout/payment-method-options.css +7073 -0
- package/dist/collection/components/checkout/payment-method-options.js +248 -0
- package/dist/collection/components/checkout/saved-payment-method.js +123 -0
- package/dist/collection/components/checkout/test/checkout.js +22 -0
- package/dist/collection/components/checkout/test/checkout.spec.js +166 -0
- package/dist/collection/components/checkout/test/mockCheckout.js +19 -0
- package/dist/collection/components/details/utils.js +4 -1
- package/dist/collection/components/form/utils.js +1 -0
- package/dist/collection/components/gross-payment-chart/get-gross-payment-chart-data.js +14 -0
- package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +119 -0
- package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +25 -73
- package/dist/collection/components/gross-payment-chart/test/get-gross-payment-chart-data.spec.js +69 -0
- package/dist/collection/components/gross-payment-chart/test/gross-payment-chart-core.spec.js +64 -0
- package/dist/collection/components/gross-payment-chart/test/gross-payment-chart.spec.js +23 -8
- package/dist/collection/components/payment-details/payment-details-core.js +8 -2
- package/dist/collection/components/payment-details/payment-details.js +0 -1
- package/dist/collection/components/payment-form/payment-form.js +1 -1
- package/dist/collection/components/payment-method-form/payment-method-form.js +1 -1
- package/dist/collection/components/payout-details/payout-details-core.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-account-details/subaccount-account-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-bank-details/subaccount-bank-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-merchant-details/subaccount-merchant-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-owners-details/subaccount-owners-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-representative-details/subaccount-representative-details.js +2 -2
- package/dist/collection/components/subaccount-details/subaccount-terms-details/subaccount-terms-details.js +2 -2
- package/dist/collection/utils/utils.js +25 -3
- package/dist/docs.json +2945 -590
- package/dist/esm/{Business-e9340f6b.js → Business-1df362e0.js} +7 -8
- package/dist/esm/Identity-774788c0.js +25 -0
- package/dist/esm/{Payout-dc5f009c.js → Payment-55886c86.js} +1 -43
- package/dist/esm/Payout-dfe15b00.js +43 -0
- package/dist/esm/{SubAccount-46b4c2b1.js → SubAccount-f4ae9809.js} +1 -1
- package/dist/esm/additional-questions-details_5.entry.js +24 -10
- package/dist/esm/business-additional-questions-schema-2cb80f70.js +23 -0
- package/dist/esm/business-details-core.entry.js +51 -0
- package/dist/esm/business-form-select-options-6b9293fe.js +82 -0
- package/dist/esm/business-form-types-de9f38cd.js +19 -0
- package/dist/esm/form-control-datepart_3.entry.js +32 -46
- package/dist/esm/form-control-monetary.entry.js +1 -1
- package/dist/esm/{form-control-select_2.entry.js → form-control-number_3.entry.js} +44 -2
- package/dist/esm/gross-payment-chart-core.entry.js +11032 -0
- package/dist/esm/{index-62b8aa8a.js → index-df86d9a2.js} +57 -3
- package/dist/esm/justifi-additional-questions-form-step_5.entry.js +497 -0
- package/dist/esm/{justifi-additional-questions_5.entry.js → justifi-additional-questions_4.entry.js} +12 -41
- package/dist/esm/justifi-bank-account-form.entry.js +1 -1
- package/dist/esm/{select-input_2.entry.js → justifi-billing-form_4.entry.js} +1809 -2
- package/dist/esm/justifi-business-address-form-step.entry.js +31 -0
- package/dist/esm/justifi-business-details.entry.js +42 -56
- package/dist/esm/justifi-business-form-stepped.entry.js +36 -89
- package/dist/esm/justifi-business-form.entry.js +17 -15
- package/dist/esm/justifi-business-list.entry.js +5 -4
- package/dist/esm/justifi-business-owners.entry.js +1 -1
- package/dist/esm/justifi-card-form.entry.js +1 -1
- package/dist/esm/justifi-checkout-core.entry.js +91 -0
- package/dist/esm/justifi-checkout.entry.js +95 -0
- package/dist/esm/justifi-details.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +39 -11008
- package/dist/esm/justifi-new-payment-method_3.entry.js +162 -0
- package/dist/esm/justifi-owner-form.entry.js +156 -0
- package/dist/esm/justifi-payment-balance-transactions.entry.js +4 -3
- package/dist/esm/justifi-payment-details.entry.js +5 -4
- package/dist/esm/justifi-payment-form.entry.js +4 -3
- package/dist/esm/{justifi-billing-form_2.entry.js → justifi-payment-method-selector.entry.js} +4 -78
- package/dist/esm/justifi-payments-list.entry.js +5 -4
- package/dist/esm/justifi-payout-details.entry.js +5 -4
- package/dist/esm/justifi-payouts-list.entry.js +5 -4
- package/dist/esm/justifi-proceeds-list.entry.js +4 -3
- package/dist/esm/justifi-refund-form.entry.js +3 -2
- package/dist/esm/justifi-subaccount-details.entry.js +6 -5
- package/dist/esm/justifi-subaccounts-list.entry.js +5 -4
- package/dist/esm/justifi-table_2.entry.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/payload-parsers-1dd7474f.js +90 -0
- package/dist/esm/payment-details-core.entry.js +10 -4
- package/dist/esm/{payment.service-bea02ccf.js → payment.service-f274ef98.js} +2 -1
- package/dist/esm/payments-list-core.entry.js +4 -3
- package/dist/esm/payout-details-core.entry.js +4 -4
- package/dist/esm/{payout.service-92e56814.js → payout.service-af293f61.js} +2 -1
- package/dist/esm/payouts-list-core.entry.js +4 -3
- package/dist/esm/subaccount-account-details_4.entry.js +7 -7
- package/dist/esm/subaccount-bank-details.entry.js +3 -3
- package/dist/esm/subaccount-terms-details.entry.js +3 -3
- package/dist/esm/{utils-76a93600.js → utils-243abdb4.js} +26 -3
- package/dist/esm/utils-2828201a.js +10 -0
- package/dist/esm/{utils-576874df.js → utils-d01c5f3a.js} +5 -5
- package/dist/esm/webcomponents.js +3 -3
- package/dist/module/Business.js +7 -8
- package/dist/module/Payment.js +138 -0
- package/dist/module/Payout.js +1 -138
- package/dist/module/SubAccount.js +1 -1
- package/dist/module/additional-questions-details2.js +5 -2
- package/dist/module/billing-form.js +2 -3
- package/dist/module/business-additional-questions-form-step.js +120 -0
- package/dist/module/business-additional-questions-schema.js +10 -0
- package/dist/module/business-address-form.js +3 -3
- package/dist/module/business-address-schema.js +18 -0
- package/dist/module/business-core-info-form-step.js +141 -0
- package/dist/module/business-core-info-schema.js +16 -0
- package/dist/module/business-core-info.js +69 -0
- package/dist/module/business-details-core.d.ts +11 -0
- package/dist/module/business-details-core.js +6 -0
- package/dist/module/business-details-core2.js +101 -0
- package/dist/module/business-form-select-options.js +82 -0
- package/dist/module/business-form-types.js +19 -0
- package/dist/module/business-identity-schema.js +38 -0
- package/dist/module/business-owners-form-step.js +213 -0
- package/dist/module/business-representative-form-step.js +157 -0
- package/dist/module/business-representative.js +1 -1
- package/dist/module/checkout-core.js +163 -0
- package/dist/module/generic-info-details2.js +4 -2
- package/dist/module/gross-payment-chart-core.d.ts +11 -0
- package/dist/module/gross-payment-chart-core.js +6 -0
- package/dist/module/gross-payment-chart-core2.js +11055 -0
- package/dist/module/justifi-additional-questions-form-step.d.ts +11 -0
- package/dist/module/justifi-additional-questions-form-step.js +6 -0
- package/dist/module/justifi-business-address-form-step.d.ts +11 -0
- package/dist/module/justifi-business-address-form-step.js +75 -0
- package/dist/module/justifi-business-core-info-form-step.d.ts +11 -0
- package/dist/module/justifi-business-core-info-form-step.js +6 -0
- package/dist/module/justifi-business-core-info.d.ts +11 -0
- package/dist/module/justifi-business-core-info.js +6 -0
- package/dist/module/justifi-business-details.js +51 -60
- package/dist/module/justifi-business-form-stepped.js +72 -112
- package/dist/module/justifi-business-form.js +20 -14
- package/dist/module/justifi-business-list.js +2 -1
- package/dist/module/justifi-business-owners-form-step.d.ts +11 -0
- package/dist/module/justifi-business-owners-form-step.js +6 -0
- package/dist/module/justifi-business-representative-form-step.d.ts +11 -0
- package/dist/module/justifi-business-representative-form-step.js +6 -0
- package/dist/module/justifi-checkout-core.d.ts +11 -0
- package/dist/module/justifi-checkout-core.js +6 -0
- package/dist/module/justifi-checkout.d.ts +11 -0
- package/dist/module/justifi-checkout.js +172 -0
- package/dist/module/justifi-gross-payment-chart.js +49 -11016
- package/dist/module/justifi-legal-address-form-step.d.ts +11 -0
- package/dist/module/justifi-legal-address-form-step.js +6 -0
- package/dist/module/justifi-new-payment-method.d.ts +11 -0
- package/dist/module/justifi-new-payment-method.js +6 -0
- package/dist/module/justifi-owner-form.d.ts +11 -0
- package/dist/module/justifi-owner-form.js +6 -0
- package/dist/module/justifi-payment-balance-transactions.js +3 -2
- package/dist/module/justifi-payment-details.js +2 -1
- package/dist/module/justifi-payment-form.js +2 -1
- package/dist/module/justifi-payment-method-options.d.ts +11 -0
- package/dist/module/justifi-payment-method-options.js +6 -0
- package/dist/module/justifi-payments-list.js +2 -1
- package/dist/module/justifi-payout-details.js +2 -1
- package/dist/module/justifi-payouts-list.js +2 -1
- package/dist/module/justifi-proceeds-list.js +2 -1
- package/dist/module/justifi-refund-form.js +1 -0
- package/dist/module/justifi-saved-payment-method.d.ts +11 -0
- package/dist/module/justifi-saved-payment-method.js +6 -0
- package/dist/module/justifi-subaccount-details.js +2 -1
- package/dist/module/justifi-subaccounts-list.js +2 -1
- package/dist/module/legal-address-details2.js +5 -2
- package/dist/module/legal-address-form-step.js +136 -0
- package/dist/module/new-payment-method.js +105 -0
- package/dist/module/owner-details2.js +10 -4
- package/dist/module/owner-form.js +244 -0
- package/dist/module/payload-parsers.js +39 -0
- package/dist/module/payment-details-core2.js +9 -3
- package/dist/module/payment-method-form.js +4 -10
- package/dist/module/payment-method-options.js +128 -0
- package/dist/module/payment-method-selector.js +2 -1
- package/dist/module/payment.service.js +1 -0
- package/dist/module/payments-list-core2.js +2 -1
- package/dist/module/payout-details-core2.js +3 -3
- package/dist/module/payout.service.js +1 -0
- package/dist/module/payouts-list-core2.js +3 -2
- package/dist/module/representative-details2.js +5 -3
- package/dist/module/saved-payment-method.js +66 -0
- package/dist/module/subaccount-account-details2.js +2 -2
- package/dist/module/subaccount-bank-details.js +2 -2
- package/dist/module/subaccount-merchant-details2.js +3 -3
- package/dist/module/subaccount-owners-details2.js +2 -2
- package/dist/module/subaccount-representative-details2.js +2 -2
- package/dist/module/subaccount-terms-details.js +2 -2
- package/dist/module/utils.js +4 -4
- package/dist/module/utils2.js +26 -3
- package/dist/module/utils4.js +10 -0
- package/dist/types/api/Api.d.ts +1 -1
- package/dist/types/api/Business.d.ts +1 -18
- package/dist/types/api/Checkout.d.ts +14 -0
- package/dist/types/api/Identity.d.ts +60 -0
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/services/business.service.d.ts +8 -0
- package/dist/types/api/services/checkout.service.d.ts +9 -0
- package/dist/types/api/services/reports.service.d.ts +5 -0
- package/dist/types/components/billing-form/billing-form-schema.d.ts +0 -1
- package/dist/types/components/billing-form/billing-form.d.ts +0 -1
- package/dist/types/components/business-details/business-details-core.d.ts +16 -0
- package/dist/types/components/business-details/business-details.d.ts +3 -13
- package/dist/types/components/business-details/get-business.d.ts +8 -0
- package/dist/types/components/business-details/owner-details/owner-details.d.ts +1 -9
- package/dist/types/components/business-details/representative-details/representative-details.d.ts +1 -1
- package/dist/types/components/{business-form → business-forms/business-form}/additional-questions/additional-questions.d.ts +1 -1
- package/dist/types/components/{business-form → business-forms/business-form}/business-address/business-address-form.d.ts +1 -1
- package/dist/types/components/{business-form/business-generic-info/business-generic-info.d.ts → business-forms/business-form/business-core-info/business-core-info.d.ts} +5 -5
- package/dist/types/components/{business-form → business-forms/business-form}/business-form.d.ts +5 -10
- package/dist/types/components/{business-form → business-forms/business-form}/business-owners/business-owners.d.ts +1 -1
- package/dist/types/components/{business-form → business-forms/business-form}/business-representative/business-representative.d.ts +1 -1
- package/dist/types/components/{business-form → business-forms/business-form}/legal-address-form/legal-address-form.d.ts +2 -2
- package/dist/types/components/business-forms/business-form-stepped/additional-questions/business-additional-questions-form-step.d.ts +30 -0
- package/dist/types/components/business-forms/business-form-stepped/business-address/business-address-form-step.d.ts +9 -0
- package/dist/types/components/business-forms/business-form-stepped/business-core-info/business-core-info-form-step.d.ts +36 -0
- package/dist/types/components/business-forms/business-form-stepped/business-form-stepped.d.ts +45 -0
- package/dist/types/components/business-forms/business-form-stepped/business-owners/business-owners-form-step.d.ts +36 -0
- package/dist/types/components/business-forms/business-form-stepped/business-representative/business-representative-form-step.d.ts +26 -0
- package/dist/types/components/business-forms/business-form-stepped/legal-address-form/legal-address-form-step.d.ts +31 -0
- package/dist/types/components/business-forms/owner-form/owner-form.d.ts +36 -0
- package/dist/types/components/business-forms/schemas/business-additional-questions-schema.d.ts +11 -0
- package/dist/types/components/{business-form/business-address/business-address-form-schema.d.ts → business-forms/schemas/business-address-schema.d.ts} +11 -8
- package/dist/types/components/business-forms/schemas/business-core-info-schema.d.ts +19 -0
- package/dist/types/components/{business-form → business-forms/schemas}/business-form-schema.d.ts +2 -26
- package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +59 -0
- package/dist/types/components/business-forms/schemas/business-owners-schema.d.ts +33 -0
- package/dist/types/components/business-forms/utils/business-form-select-options.d.ts +11 -0
- package/dist/types/components/business-forms/utils/business-form-types.d.ts +39 -0
- package/dist/types/components/business-forms/utils/payload-parsers.d.ts +4 -0
- package/dist/types/components/checkout/checkout-actions.d.ts +17 -0
- package/dist/types/components/checkout/checkout-core.d.ts +28 -0
- package/dist/types/components/checkout/checkout.d.ts +12 -0
- package/dist/types/components/checkout/new-payment-method.d.ts +17 -0
- package/dist/types/components/checkout/payment-method-option-utils.d.ts +16 -0
- package/dist/types/components/checkout/payment-method-options.d.ts +18 -0
- package/dist/types/components/checkout/saved-payment-method.d.ts +11 -0
- package/dist/types/components/checkout/test/checkout.d.ts +1 -0
- package/dist/types/components/checkout/test/mockCheckout.d.ts +19 -0
- package/dist/types/components/details/utils.d.ts +1 -1
- package/dist/types/components/form/form.d.ts +1 -1
- package/dist/types/components/form/utils.d.ts +1 -0
- package/dist/types/components/gross-payment-chart/get-gross-payment-chart-data.d.ts +11 -0
- package/dist/types/components/gross-payment-chart/gross-payment-chart-core.d.ts +18 -0
- package/dist/types/components/gross-payment-chart/gross-payment-chart.d.ts +4 -14
- package/dist/types/components/payment-details/payment-details.d.ts +0 -1
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +3 -9
- package/dist/types/components.d.ts +626 -91
- package/dist/types/utils/utils.d.ts +3 -0
- package/dist/webcomponents/p-0399f02b.entry.js +1 -0
- package/dist/webcomponents/{p-6478f3ca.js → p-04a98c63.js} +1 -1
- package/dist/webcomponents/p-06888c2e.entry.js +1 -0
- package/dist/webcomponents/{p-234bc840.entry.js → p-07b326d0.entry.js} +1 -1
- package/dist/webcomponents/p-0811bc77.entry.js +1 -0
- package/dist/webcomponents/p-0923e39c.js +1 -0
- package/dist/webcomponents/p-17d72f4a.js +1 -0
- package/dist/webcomponents/p-17f64853.entry.js +1 -0
- package/dist/webcomponents/p-1bfadb9f.entry.js +1 -0
- package/dist/webcomponents/p-22085999.entry.js +1 -0
- package/dist/webcomponents/p-252835df.entry.js +1 -0
- package/dist/webcomponents/{p-22c1acd6.js → p-28b38699.js} +1 -1
- package/dist/webcomponents/p-34352d04.js +1 -0
- package/dist/webcomponents/p-374c44e6.entry.js +1 -0
- package/dist/webcomponents/{p-0a0cf2e6.entry.js → p-4697ccfa.entry.js} +1 -1
- package/dist/webcomponents/p-4781cd06.js +1 -0
- package/dist/webcomponents/{p-4c01df65.entry.js → p-4d50d08a.entry.js} +1 -1
- package/dist/webcomponents/p-4d806131.entry.js +1 -0
- package/dist/webcomponents/{p-7a1a06c0.entry.js → p-4df6174c.entry.js} +1 -1
- package/dist/webcomponents/p-4e0b3206.entry.js +1 -0
- package/dist/webcomponents/{p-4ee44c76.entry.js → p-583dd5a2.entry.js} +1 -1
- package/dist/webcomponents/p-5be4e217.entry.js +1 -0
- package/dist/webcomponents/p-5da4fbe7.entry.js +1 -0
- package/dist/webcomponents/{p-40349ffc.entry.js → p-6103c20d.entry.js} +1 -1
- package/dist/webcomponents/p-63296409.js +1 -0
- package/dist/webcomponents/{p-5c0310ee.js → p-65510838.js} +1 -1
- package/dist/webcomponents/p-688bb5da.js +2 -0
- package/dist/webcomponents/p-6b51cf97.entry.js +1 -0
- package/dist/webcomponents/p-7654c70d.entry.js +1 -0
- package/dist/webcomponents/p-7b2cddc7.js +1 -0
- package/dist/webcomponents/p-847441ce.entry.js +1 -0
- package/dist/webcomponents/p-861ba3fc.entry.js +1 -0
- package/dist/webcomponents/p-9207ccb2.entry.js +1 -0
- package/dist/webcomponents/p-975ab96e.js +1 -0
- package/dist/webcomponents/p-9ce8d98c.entry.js +1 -0
- package/dist/webcomponents/p-9e4b81ad.entry.js +1 -0
- package/dist/webcomponents/p-a141c531.js +1 -0
- package/dist/webcomponents/p-a2dbe90f.entry.js +1 -0
- package/dist/webcomponents/{p-4fa27a28.entry.js → p-a46174e0.entry.js} +1 -1
- package/dist/webcomponents/p-a98eea84.entry.js +1 -0
- package/dist/webcomponents/p-b1bc23af.entry.js +1 -0
- package/dist/webcomponents/p-b27c9b0d.entry.js +1 -0
- package/dist/webcomponents/{p-7c0f91fa.entry.js → p-b68f1dd9.entry.js} +1 -1
- package/dist/webcomponents/p-b8f22856.js +1 -0
- package/dist/webcomponents/p-c8d62072.entry.js +1 -0
- package/dist/webcomponents/{p-08833966.entry.js → p-da34bba7.entry.js} +1 -1
- package/dist/webcomponents/p-e3748ea4.entry.js +1 -0
- package/dist/webcomponents/p-e3fab0e2.js +1 -0
- package/dist/webcomponents/p-e924f2e1.entry.js +1 -0
- package/dist/webcomponents/p-ebf7c70f.entry.js +1 -0
- package/dist/webcomponents/p-eef5ed19.entry.js +1 -0
- package/dist/webcomponents/p-efc7025c.entry.js +1 -0
- package/dist/webcomponents/p-f3453ca2.js +1 -0
- package/dist/webcomponents/p-f3ca6fda.entry.js +1 -0
- package/dist/webcomponents/p-fb49ef28.entry.js +1 -0
- package/dist/webcomponents/p-fe2af0cf.entry.js +19 -0
- package/dist/webcomponents/p-fe8a94c1.entry.js +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +3 -2
- package/dist/cjs/BusinessFormEventTypes-863f48e9.js +0 -42
- package/dist/cjs/business-form-schema-37e5381d.js +0 -148
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +0 -1747
- package/dist/collection/components/business-form/BusinessFormEventTypes.js +0 -6
- package/dist/collection/components/business-form/business-address/business-address-form-schema.js +0 -13
- package/dist/collection/components/business-form/business-form-schema.js +0 -159
- package/dist/collection/components/business-form/business-form-stepped.js +0 -260
- package/dist/collection/components/business-form/business-generic-info/business-generic-info.js +0 -77
- package/dist/collection/components/business-form/business-representative/business-representative-schema.js +0 -1
- package/dist/collection/components/business-form/helpers.js +0 -23
- package/dist/collection/components/business-form/legal-address-form/legal-address-form-schema.js +0 -10
- package/dist/esm/BusinessFormEventTypes-989960ba.js +0 -39
- package/dist/esm/business-form-schema-f8f554d1.js +0 -144
- package/dist/esm/justifi-payment-method-form.entry.js +0 -1743
- package/dist/module/BusinessFormEventTypes.js +0 -39
- package/dist/module/business-generic-info.js +0 -210
- package/dist/module/justifi-business-generic-info.d.ts +0 -11
- package/dist/module/justifi-business-generic-info.js +0 -6
- package/dist/types/components/business-form/BusinessFormEventTypes.d.ts +0 -5
- package/dist/types/components/business-form/business-form-stepped.d.ts +0 -48
- package/dist/types/components/business-form/business-representative/business-representative-schema.d.ts +0 -17
- package/dist/types/components/business-form/helpers.d.ts +0 -1
- package/dist/types/components/business-form/legal-address-form/legal-address-form-schema.d.ts +0 -17
- package/dist/webcomponents/p-081cf5f6.entry.js +0 -1
- package/dist/webcomponents/p-0bc8b02e.entry.js +0 -1
- package/dist/webcomponents/p-112acd3c.entry.js +0 -1
- package/dist/webcomponents/p-1555e6b1.js +0 -1
- package/dist/webcomponents/p-16f41fd0.entry.js +0 -1
- package/dist/webcomponents/p-17715325.js +0 -1
- package/dist/webcomponents/p-3a4d4869.entry.js +0 -1
- package/dist/webcomponents/p-3cb0b96d.js +0 -1
- package/dist/webcomponents/p-4ba2c711.entry.js +0 -1
- package/dist/webcomponents/p-4f14df36.js +0 -2
- package/dist/webcomponents/p-5422a24b.entry.js +0 -1
- package/dist/webcomponents/p-578e0a05.entry.js +0 -1
- package/dist/webcomponents/p-640d90dc.entry.js +0 -1
- package/dist/webcomponents/p-663bfe87.js +0 -1
- package/dist/webcomponents/p-696396c7.entry.js +0 -1
- package/dist/webcomponents/p-6ab67031.entry.js +0 -1
- package/dist/webcomponents/p-6d0725ef.entry.js +0 -1
- package/dist/webcomponents/p-810b72b5.js +0 -1
- package/dist/webcomponents/p-8516d602.entry.js +0 -1
- package/dist/webcomponents/p-894a7475.entry.js +0 -19
- package/dist/webcomponents/p-94ebfafb.entry.js +0 -1
- package/dist/webcomponents/p-9cb3ff78.entry.js +0 -1
- package/dist/webcomponents/p-9e81808f.entry.js +0 -1
- package/dist/webcomponents/p-a432110c.entry.js +0 -1
- package/dist/webcomponents/p-b1881723.entry.js +0 -1
- package/dist/webcomponents/p-b5aba473.entry.js +0 -1
- package/dist/webcomponents/p-b8a8b551.js +0 -1
- package/dist/webcomponents/p-bd099662.entry.js +0 -1
- package/dist/webcomponents/p-bfd917b8.entry.js +0 -1
- package/dist/webcomponents/p-c90fa055.entry.js +0 -1
- package/dist/webcomponents/p-ebb91944.entry.js +0 -1
- package/dist/webcomponents/p-ec4f27e7.entry.js +0 -1
- package/dist/webcomponents/p-fa495a43.entry.js +0 -1
- /package/dist/collection/components/{business-form → business-forms/business-form}/business-address/test/business-address.e2e.js +0 -0
- /package/dist/collection/components/{business-form → business-forms/business-form}/business-address/test/business-address.spec.js +0 -0
- /package/dist/collection/components/{business-form → business-forms/business-form}/business-form.css +0 -0
- /package/dist/collection/components/{business-form → business-forms/business-form}/test/business-form.spec.js +0 -0
- /package/dist/collection/components/{business-form/business-address/business-address-form.css → business-forms/business-form-stepped/business-address/business-address-form-step.css} +0 -0
- /package/dist/collection/components/{business-form/business-generic-info/business-generic-info.css → business-forms/business-form-stepped/business-core-info/business-core-info-form-step.css} +0 -0
- /package/dist/collection/components/{business-form/business-owners/business-owners.css → business-forms/business-form-stepped/business-owners/business-owners-form-step.css} +0 -0
- /package/dist/collection/components/{business-form/business-representative/business-representative.css → business-forms/business-form-stepped/business-representative/business-representative-form-step.css} +0 -0
- /package/dist/collection/components/{business-form/legal-address-form/legal-address-form.css → business-forms/business-form-stepped/legal-address-form/legal-address-form-step.css} +0 -0
|
@@ -1,1747 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-55950669.js');
|
|
6
|
-
const utils = require('./utils-29a8a91d.js');
|
|
7
|
-
|
|
8
|
-
function createCommonjsModule(fn, basedir, module) {
|
|
9
|
-
return module = {
|
|
10
|
-
path: basedir,
|
|
11
|
-
exports: {},
|
|
12
|
-
require: function (path, base) {
|
|
13
|
-
return commonjsRequire();
|
|
14
|
-
}
|
|
15
|
-
}, fn(module, module.exports), module.exports;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function commonjsRequire () {
|
|
19
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var iframeResizer = createCommonjsModule(function (module) {
|
|
23
|
-
(function (undefined$1) {
|
|
24
|
-
if (typeof window === 'undefined') return // don't run for server side render
|
|
25
|
-
|
|
26
|
-
var count = 0,
|
|
27
|
-
logEnabled = false,
|
|
28
|
-
hiddenCheckEnabled = false,
|
|
29
|
-
msgHeader = 'message',
|
|
30
|
-
msgHeaderLen = msgHeader.length,
|
|
31
|
-
msgId = '[iFrameSizer]', // Must match iframe msg ID
|
|
32
|
-
msgIdLen = msgId.length,
|
|
33
|
-
pagePosition = null,
|
|
34
|
-
requestAnimationFrame = window.requestAnimationFrame,
|
|
35
|
-
resetRequiredMethods = Object.freeze({
|
|
36
|
-
max: 1,
|
|
37
|
-
scroll: 1,
|
|
38
|
-
bodyScroll: 1,
|
|
39
|
-
documentElementScroll: 1
|
|
40
|
-
}),
|
|
41
|
-
settings = {},
|
|
42
|
-
timer = null,
|
|
43
|
-
defaults = Object.freeze({
|
|
44
|
-
autoResize: true,
|
|
45
|
-
bodyBackground: null,
|
|
46
|
-
bodyMargin: null,
|
|
47
|
-
bodyMarginV1: 8,
|
|
48
|
-
bodyPadding: null,
|
|
49
|
-
checkOrigin: true,
|
|
50
|
-
inPageLinks: false,
|
|
51
|
-
enablePublicMethods: true,
|
|
52
|
-
heightCalculationMethod: 'bodyOffset',
|
|
53
|
-
id: 'iFrameResizer',
|
|
54
|
-
interval: 32,
|
|
55
|
-
log: false,
|
|
56
|
-
maxHeight: Infinity,
|
|
57
|
-
maxWidth: Infinity,
|
|
58
|
-
minHeight: 0,
|
|
59
|
-
minWidth: 0,
|
|
60
|
-
mouseEvents: true,
|
|
61
|
-
resizeFrom: 'parent',
|
|
62
|
-
scrolling: false,
|
|
63
|
-
sizeHeight: true,
|
|
64
|
-
sizeWidth: false,
|
|
65
|
-
warningTimeout: 5000,
|
|
66
|
-
tolerance: 0,
|
|
67
|
-
widthCalculationMethod: 'scroll',
|
|
68
|
-
onClose: function () {
|
|
69
|
-
return true
|
|
70
|
-
},
|
|
71
|
-
onClosed: function () {},
|
|
72
|
-
onInit: function () {},
|
|
73
|
-
onMessage: function () {
|
|
74
|
-
warn('onMessage function not defined');
|
|
75
|
-
},
|
|
76
|
-
onMouseEnter: function () {},
|
|
77
|
-
onMouseLeave: function () {},
|
|
78
|
-
onResized: function () {},
|
|
79
|
-
onScroll: function () {
|
|
80
|
-
return true
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
function getMutationObserver() {
|
|
85
|
-
return (
|
|
86
|
-
window.MutationObserver ||
|
|
87
|
-
window.WebKitMutationObserver ||
|
|
88
|
-
window.MozMutationObserver
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function addEventListener(el, evt, func) {
|
|
93
|
-
el.addEventListener(evt, func, false);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function removeEventListener(el, evt, func) {
|
|
97
|
-
el.removeEventListener(evt, func, false);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function setupRequestAnimationFrame() {
|
|
101
|
-
var vendors = ['moz', 'webkit', 'o', 'ms'];
|
|
102
|
-
var x;
|
|
103
|
-
|
|
104
|
-
// Remove vendor prefixing if prefixed and break early if not
|
|
105
|
-
for (x = 0; x < vendors.length && !requestAnimationFrame; x += 1) {
|
|
106
|
-
requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (requestAnimationFrame) {
|
|
110
|
-
// Firefox extension content-scripts have a globalThis object that is not the same as window.
|
|
111
|
-
// Binding `requestAnimationFrame` to window allows the function to work and prevents errors
|
|
112
|
-
// being thrown when run in that context, and should be a no-op in every other context.
|
|
113
|
-
requestAnimationFrame = requestAnimationFrame.bind(window);
|
|
114
|
-
} else {
|
|
115
|
-
log('setup', 'RequestAnimationFrame not supported');
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function getMyID(iframeId) {
|
|
120
|
-
var retStr = 'Host page: ' + iframeId;
|
|
121
|
-
|
|
122
|
-
if (window.top !== window.self) {
|
|
123
|
-
retStr =
|
|
124
|
-
window.parentIFrame && window.parentIFrame.getId
|
|
125
|
-
? window.parentIFrame.getId() + ': ' + iframeId
|
|
126
|
-
: 'Nested host page: ' + iframeId;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return retStr
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function formatLogHeader(iframeId) {
|
|
133
|
-
return msgId + '[' + getMyID(iframeId) + ']'
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function isLogEnabled(iframeId) {
|
|
137
|
-
return settings[iframeId] ? settings[iframeId].log : logEnabled
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function log(iframeId, msg) {
|
|
141
|
-
output('log', iframeId, msg, isLogEnabled(iframeId));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function info(iframeId, msg) {
|
|
145
|
-
output('info', iframeId, msg, isLogEnabled(iframeId));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function warn(iframeId, msg) {
|
|
149
|
-
output('warn', iframeId, msg, true);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function output(type, iframeId, msg, enabled) {
|
|
153
|
-
if (true === enabled && 'object' === typeof window.console) {
|
|
154
|
-
// eslint-disable-next-line no-console
|
|
155
|
-
console[type](formatLogHeader(iframeId), msg);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function iFrameListener(event) {
|
|
160
|
-
function resizeIFrame() {
|
|
161
|
-
function resize() {
|
|
162
|
-
setSize(messageData);
|
|
163
|
-
setPagePosition(iframeId);
|
|
164
|
-
on('onResized', messageData);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
ensureInRange('Height');
|
|
168
|
-
ensureInRange('Width');
|
|
169
|
-
|
|
170
|
-
syncResize(resize, messageData, 'init');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function processMsg() {
|
|
174
|
-
var data = msg.slice(msgIdLen).split(':');
|
|
175
|
-
var height = data[1] ? parseInt(data[1], 10) : 0;
|
|
176
|
-
var iframe = settings[data[0]] && settings[data[0]].iframe;
|
|
177
|
-
var compStyle = getComputedStyle(iframe);
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
iframe: iframe,
|
|
181
|
-
id: data[0],
|
|
182
|
-
height: height + getPaddingEnds(compStyle) + getBorderEnds(compStyle),
|
|
183
|
-
width: data[2],
|
|
184
|
-
type: data[3]
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function getPaddingEnds(compStyle) {
|
|
189
|
-
if (compStyle.boxSizing !== 'border-box') {
|
|
190
|
-
return 0
|
|
191
|
-
}
|
|
192
|
-
var top = compStyle.paddingTop ? parseInt(compStyle.paddingTop, 10) : 0;
|
|
193
|
-
var bot = compStyle.paddingBottom
|
|
194
|
-
? parseInt(compStyle.paddingBottom, 10)
|
|
195
|
-
: 0;
|
|
196
|
-
return top + bot
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function getBorderEnds(compStyle) {
|
|
200
|
-
if (compStyle.boxSizing !== 'border-box') {
|
|
201
|
-
return 0
|
|
202
|
-
}
|
|
203
|
-
var top = compStyle.borderTopWidth
|
|
204
|
-
? parseInt(compStyle.borderTopWidth, 10)
|
|
205
|
-
: 0;
|
|
206
|
-
var bot = compStyle.borderBottomWidth
|
|
207
|
-
? parseInt(compStyle.borderBottomWidth, 10)
|
|
208
|
-
: 0;
|
|
209
|
-
return top + bot
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function ensureInRange(Dimension) {
|
|
213
|
-
var max = Number(settings[iframeId]['max' + Dimension]),
|
|
214
|
-
min = Number(settings[iframeId]['min' + Dimension]),
|
|
215
|
-
dimension = Dimension.toLowerCase(),
|
|
216
|
-
size = Number(messageData[dimension]);
|
|
217
|
-
|
|
218
|
-
log(iframeId, 'Checking ' + dimension + ' is in range ' + min + '-' + max);
|
|
219
|
-
|
|
220
|
-
if (size < min) {
|
|
221
|
-
size = min;
|
|
222
|
-
log(iframeId, 'Set ' + dimension + ' to min value');
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (size > max) {
|
|
226
|
-
size = max;
|
|
227
|
-
log(iframeId, 'Set ' + dimension + ' to max value');
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
messageData[dimension] = '' + size;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function isMessageFromIFrame() {
|
|
234
|
-
function checkAllowedOrigin() {
|
|
235
|
-
function checkList() {
|
|
236
|
-
var i = 0,
|
|
237
|
-
retCode = false;
|
|
238
|
-
|
|
239
|
-
log(
|
|
240
|
-
iframeId,
|
|
241
|
-
'Checking connection is from allowed list of origins: ' +
|
|
242
|
-
checkOrigin
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
for (; i < checkOrigin.length; i++) {
|
|
246
|
-
if (checkOrigin[i] === origin) {
|
|
247
|
-
retCode = true;
|
|
248
|
-
break
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return retCode
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function checkSingle() {
|
|
255
|
-
var remoteHost = settings[iframeId] && settings[iframeId].remoteHost;
|
|
256
|
-
log(iframeId, 'Checking connection is from: ' + remoteHost);
|
|
257
|
-
return origin === remoteHost
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return checkOrigin.constructor === Array ? checkList() : checkSingle()
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
var origin = event.origin,
|
|
264
|
-
checkOrigin = settings[iframeId] && settings[iframeId].checkOrigin;
|
|
265
|
-
|
|
266
|
-
if (checkOrigin && '' + origin !== 'null' && !checkAllowedOrigin()) {
|
|
267
|
-
throw new Error(
|
|
268
|
-
'Unexpected message received from: ' +
|
|
269
|
-
origin +
|
|
270
|
-
' for ' +
|
|
271
|
-
messageData.iframe.id +
|
|
272
|
-
'. Message was: ' +
|
|
273
|
-
event.data +
|
|
274
|
-
'. This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.'
|
|
275
|
-
)
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return true
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
function isMessageForUs() {
|
|
282
|
-
return (
|
|
283
|
-
msgId === ('' + msg).slice(0, msgIdLen) &&
|
|
284
|
-
msg.slice(msgIdLen).split(':')[0] in settings
|
|
285
|
-
) // ''+Protects against non-string msg
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function isMessageFromMetaParent() {
|
|
289
|
-
// Test if this message is from a parent above us. This is an ugly test, however, updating
|
|
290
|
-
// the message format would break backwards compatibility.
|
|
291
|
-
var retCode = messageData.type in { true: 1, false: 1, undefined: 1 };
|
|
292
|
-
|
|
293
|
-
if (retCode) {
|
|
294
|
-
log(iframeId, 'Ignoring init message from meta parent page');
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return retCode
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function getMsgBody(offset) {
|
|
301
|
-
return msg.slice(msg.indexOf(':') + msgHeaderLen + offset)
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function forwardMsgFromIFrame(msgBody) {
|
|
305
|
-
log(
|
|
306
|
-
iframeId,
|
|
307
|
-
'onMessage passed: {iframe: ' +
|
|
308
|
-
messageData.iframe.id +
|
|
309
|
-
', message: ' +
|
|
310
|
-
msgBody +
|
|
311
|
-
'}'
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
on('onMessage', {
|
|
315
|
-
iframe: messageData.iframe,
|
|
316
|
-
message: JSON.parse(msgBody)
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
log(iframeId, '--');
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function getPageInfo() {
|
|
323
|
-
var bodyPosition = document.body.getBoundingClientRect(),
|
|
324
|
-
iFramePosition = messageData.iframe.getBoundingClientRect();
|
|
325
|
-
|
|
326
|
-
return JSON.stringify({
|
|
327
|
-
iframeHeight: iFramePosition.height,
|
|
328
|
-
iframeWidth: iFramePosition.width,
|
|
329
|
-
clientHeight: Math.max(
|
|
330
|
-
document.documentElement.clientHeight,
|
|
331
|
-
window.innerHeight || 0
|
|
332
|
-
),
|
|
333
|
-
clientWidth: Math.max(
|
|
334
|
-
document.documentElement.clientWidth,
|
|
335
|
-
window.innerWidth || 0
|
|
336
|
-
),
|
|
337
|
-
offsetTop: parseInt(iFramePosition.top - bodyPosition.top, 10),
|
|
338
|
-
offsetLeft: parseInt(iFramePosition.left - bodyPosition.left, 10),
|
|
339
|
-
scrollTop: window.pageYOffset,
|
|
340
|
-
scrollLeft: window.pageXOffset,
|
|
341
|
-
documentHeight: document.documentElement.clientHeight,
|
|
342
|
-
documentWidth: document.documentElement.clientWidth,
|
|
343
|
-
windowHeight: window.innerHeight,
|
|
344
|
-
windowWidth: window.innerWidth
|
|
345
|
-
})
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
function sendPageInfoToIframe(iframe, iframeId) {
|
|
349
|
-
function debouncedTrigger() {
|
|
350
|
-
trigger('Send Page Info', 'pageInfo:' + getPageInfo(), iframe, iframeId);
|
|
351
|
-
}
|
|
352
|
-
debounceFrameEvents(debouncedTrigger, 32, iframeId);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
function startPageInfoMonitor() {
|
|
356
|
-
function setListener(type, func) {
|
|
357
|
-
function sendPageInfo() {
|
|
358
|
-
if (settings[id]) {
|
|
359
|
-
sendPageInfoToIframe(settings[id].iframe, id);
|
|
360
|
-
} else {
|
|
361
|
-
stop();
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
['scroll', 'resize'].forEach(function (evt) {
|
|
365
|
-
log(id, type + evt + ' listener for sendPageInfo');
|
|
366
|
-
func(window, evt, sendPageInfo);
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
function stop() {
|
|
371
|
-
setListener('Remove ', removeEventListener);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
function start() {
|
|
375
|
-
setListener('Add ', addEventListener);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
var id = iframeId; // Create locally scoped copy of iFrame ID
|
|
379
|
-
|
|
380
|
-
start();
|
|
381
|
-
|
|
382
|
-
if (settings[id]) {
|
|
383
|
-
settings[id].stopPageInfo = stop;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
function stopPageInfoMonitor() {
|
|
388
|
-
if (settings[iframeId] && settings[iframeId].stopPageInfo) {
|
|
389
|
-
settings[iframeId].stopPageInfo();
|
|
390
|
-
delete settings[iframeId].stopPageInfo;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
function checkIFrameExists() {
|
|
395
|
-
var retBool = true;
|
|
396
|
-
|
|
397
|
-
if (null === messageData.iframe) {
|
|
398
|
-
warn(iframeId, 'IFrame (' + messageData.id + ') not found');
|
|
399
|
-
retBool = false;
|
|
400
|
-
}
|
|
401
|
-
return retBool
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function getElementPosition(target) {
|
|
405
|
-
var iFramePosition = target.getBoundingClientRect();
|
|
406
|
-
|
|
407
|
-
getPagePosition(iframeId);
|
|
408
|
-
|
|
409
|
-
return {
|
|
410
|
-
x: Math.floor(Number(iFramePosition.left) + Number(pagePosition.x)),
|
|
411
|
-
y: Math.floor(Number(iFramePosition.top) + Number(pagePosition.y))
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function scrollRequestFromChild(addOffset) {
|
|
416
|
-
/* istanbul ignore next */ // Not testable in Karma
|
|
417
|
-
function reposition() {
|
|
418
|
-
pagePosition = newPosition;
|
|
419
|
-
scrollTo();
|
|
420
|
-
log(iframeId, '--');
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
function calcOffset() {
|
|
424
|
-
return {
|
|
425
|
-
x: Number(messageData.width) + offset.x,
|
|
426
|
-
y: Number(messageData.height) + offset.y
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
function scrollParent() {
|
|
431
|
-
if (window.parentIFrame) {
|
|
432
|
-
window.parentIFrame['scrollTo' + (addOffset ? 'Offset' : '')](
|
|
433
|
-
newPosition.x,
|
|
434
|
-
newPosition.y
|
|
435
|
-
);
|
|
436
|
-
} else {
|
|
437
|
-
warn(
|
|
438
|
-
iframeId,
|
|
439
|
-
'Unable to scroll to requested position, window.parentIFrame not found'
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
var offset = addOffset
|
|
445
|
-
? getElementPosition(messageData.iframe)
|
|
446
|
-
: { x: 0, y: 0 },
|
|
447
|
-
newPosition = calcOffset();
|
|
448
|
-
|
|
449
|
-
log(
|
|
450
|
-
iframeId,
|
|
451
|
-
'Reposition requested from iFrame (offset x:' +
|
|
452
|
-
offset.x +
|
|
453
|
-
' y:' +
|
|
454
|
-
offset.y +
|
|
455
|
-
')'
|
|
456
|
-
);
|
|
457
|
-
|
|
458
|
-
if (window.top === window.self) {
|
|
459
|
-
reposition();
|
|
460
|
-
} else {
|
|
461
|
-
scrollParent();
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
function scrollTo() {
|
|
466
|
-
if (false === on('onScroll', pagePosition)) {
|
|
467
|
-
unsetPagePosition();
|
|
468
|
-
} else {
|
|
469
|
-
setPagePosition(iframeId);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
function findTarget(location) {
|
|
474
|
-
function jumpToTarget() {
|
|
475
|
-
var jumpPosition = getElementPosition(target);
|
|
476
|
-
|
|
477
|
-
log(
|
|
478
|
-
iframeId,
|
|
479
|
-
'Moving to in page link (#' +
|
|
480
|
-
hash +
|
|
481
|
-
') at x: ' +
|
|
482
|
-
jumpPosition.x +
|
|
483
|
-
' y: ' +
|
|
484
|
-
jumpPosition.y
|
|
485
|
-
);
|
|
486
|
-
pagePosition = {
|
|
487
|
-
x: jumpPosition.x,
|
|
488
|
-
y: jumpPosition.y
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
scrollTo();
|
|
492
|
-
log(iframeId, '--');
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
function jumpToParent() {
|
|
496
|
-
if (window.parentIFrame) {
|
|
497
|
-
window.parentIFrame.moveToAnchor(hash);
|
|
498
|
-
} else {
|
|
499
|
-
log(
|
|
500
|
-
iframeId,
|
|
501
|
-
'In page link #' +
|
|
502
|
-
hash +
|
|
503
|
-
' not found and window.parentIFrame not found'
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
var hash = location.split('#')[1] || '',
|
|
509
|
-
hashData = decodeURIComponent(hash),
|
|
510
|
-
target =
|
|
511
|
-
document.getElementById(hashData) ||
|
|
512
|
-
document.getElementsByName(hashData)[0];
|
|
513
|
-
|
|
514
|
-
if (target) {
|
|
515
|
-
jumpToTarget();
|
|
516
|
-
} else if (window.top === window.self) {
|
|
517
|
-
log(iframeId, 'In page link #' + hash + ' not found');
|
|
518
|
-
} else {
|
|
519
|
-
jumpToParent();
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
function onMouse(event) {
|
|
524
|
-
var mousePos = {};
|
|
525
|
-
|
|
526
|
-
if (Number(messageData.width) === 0 && Number(messageData.height) === 0) {
|
|
527
|
-
var data = getMsgBody(9).split(':');
|
|
528
|
-
mousePos = {
|
|
529
|
-
x: data[1],
|
|
530
|
-
y: data[0]
|
|
531
|
-
};
|
|
532
|
-
} else {
|
|
533
|
-
mousePos = {
|
|
534
|
-
x: messageData.width,
|
|
535
|
-
y: messageData.height
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
on(event, {
|
|
540
|
-
iframe: messageData.iframe,
|
|
541
|
-
screenX: Number(mousePos.x),
|
|
542
|
-
screenY: Number(mousePos.y),
|
|
543
|
-
type: messageData.type
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function on(funcName, val) {
|
|
548
|
-
return chkEvent(iframeId, funcName, val)
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
function actionMsg() {
|
|
552
|
-
if (settings[iframeId] && settings[iframeId].firstRun) firstRun();
|
|
553
|
-
|
|
554
|
-
switch (messageData.type) {
|
|
555
|
-
case 'close': {
|
|
556
|
-
closeIFrame(messageData.iframe);
|
|
557
|
-
break
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
case 'message': {
|
|
561
|
-
forwardMsgFromIFrame(getMsgBody(6));
|
|
562
|
-
break
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
case 'mouseenter': {
|
|
566
|
-
onMouse('onMouseEnter');
|
|
567
|
-
break
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
case 'mouseleave': {
|
|
571
|
-
onMouse('onMouseLeave');
|
|
572
|
-
break
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
case 'autoResize': {
|
|
576
|
-
settings[iframeId].autoResize = JSON.parse(getMsgBody(9));
|
|
577
|
-
break
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
case 'scrollTo': {
|
|
581
|
-
scrollRequestFromChild(false);
|
|
582
|
-
break
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
case 'scrollToOffset': {
|
|
586
|
-
scrollRequestFromChild(true);
|
|
587
|
-
break
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
case 'pageInfo': {
|
|
591
|
-
sendPageInfoToIframe(
|
|
592
|
-
settings[iframeId] && settings[iframeId].iframe,
|
|
593
|
-
iframeId
|
|
594
|
-
);
|
|
595
|
-
startPageInfoMonitor();
|
|
596
|
-
break
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
case 'pageInfoStop': {
|
|
600
|
-
stopPageInfoMonitor();
|
|
601
|
-
break
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
case 'inPageLink': {
|
|
605
|
-
findTarget(getMsgBody(9));
|
|
606
|
-
break
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
case 'reset': {
|
|
610
|
-
resetIFrame(messageData);
|
|
611
|
-
break
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
case 'init': {
|
|
615
|
-
resizeIFrame();
|
|
616
|
-
on('onInit', messageData.iframe);
|
|
617
|
-
break
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
default: {
|
|
621
|
-
if (
|
|
622
|
-
Number(messageData.width) === 0 &&
|
|
623
|
-
Number(messageData.height) === 0
|
|
624
|
-
) {
|
|
625
|
-
warn(
|
|
626
|
-
'Unsupported message received (' +
|
|
627
|
-
messageData.type +
|
|
628
|
-
'), this is likely due to the iframe containing a later ' +
|
|
629
|
-
'version of iframe-resizer than the parent page'
|
|
630
|
-
);
|
|
631
|
-
} else {
|
|
632
|
-
resizeIFrame();
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
function hasSettings(iframeId) {
|
|
639
|
-
var retBool = true;
|
|
640
|
-
|
|
641
|
-
if (!settings[iframeId]) {
|
|
642
|
-
retBool = false;
|
|
643
|
-
warn(
|
|
644
|
-
messageData.type +
|
|
645
|
-
' No settings for ' +
|
|
646
|
-
iframeId +
|
|
647
|
-
'. Message was: ' +
|
|
648
|
-
msg
|
|
649
|
-
);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
return retBool
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
function iFrameReadyMsgReceived() {
|
|
656
|
-
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
657
|
-
for (var iframeId in settings) {
|
|
658
|
-
trigger(
|
|
659
|
-
'iFrame requested init',
|
|
660
|
-
createOutgoingMsg(iframeId),
|
|
661
|
-
settings[iframeId].iframe,
|
|
662
|
-
iframeId
|
|
663
|
-
);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
function firstRun() {
|
|
668
|
-
if (settings[iframeId]) {
|
|
669
|
-
settings[iframeId].firstRun = false;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
var msg = event.data,
|
|
674
|
-
messageData = {},
|
|
675
|
-
iframeId = null;
|
|
676
|
-
|
|
677
|
-
if ('[iFrameResizerChild]Ready' === msg) {
|
|
678
|
-
iFrameReadyMsgReceived();
|
|
679
|
-
} else if (isMessageForUs()) {
|
|
680
|
-
messageData = processMsg();
|
|
681
|
-
iframeId = messageData.id;
|
|
682
|
-
if (settings[iframeId]) {
|
|
683
|
-
settings[iframeId].loaded = true;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
if (!isMessageFromMetaParent() && hasSettings(iframeId)) {
|
|
687
|
-
log(iframeId, 'Received: ' + msg);
|
|
688
|
-
|
|
689
|
-
if (checkIFrameExists() && isMessageFromIFrame()) {
|
|
690
|
-
actionMsg();
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
} else {
|
|
694
|
-
info(iframeId, 'Ignored: ' + msg);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
function chkEvent(iframeId, funcName, val) {
|
|
699
|
-
var func = null,
|
|
700
|
-
retVal = null;
|
|
701
|
-
|
|
702
|
-
if (settings[iframeId]) {
|
|
703
|
-
func = settings[iframeId][funcName];
|
|
704
|
-
|
|
705
|
-
if ('function' === typeof func) {
|
|
706
|
-
retVal = func(val);
|
|
707
|
-
} else {
|
|
708
|
-
throw new TypeError(
|
|
709
|
-
funcName + ' on iFrame[' + iframeId + '] is not a function'
|
|
710
|
-
)
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
return retVal
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
function removeIframeListeners(iframe) {
|
|
718
|
-
var iframeId = iframe.id;
|
|
719
|
-
delete settings[iframeId];
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
function closeIFrame(iframe) {
|
|
723
|
-
var iframeId = iframe.id;
|
|
724
|
-
if (chkEvent(iframeId, 'onClose', iframeId) === false) {
|
|
725
|
-
log(iframeId, 'Close iframe cancelled by onClose event');
|
|
726
|
-
return
|
|
727
|
-
}
|
|
728
|
-
log(iframeId, 'Removing iFrame: ' + iframeId);
|
|
729
|
-
|
|
730
|
-
try {
|
|
731
|
-
// Catch race condition error with React
|
|
732
|
-
if (iframe.parentNode) {
|
|
733
|
-
iframe.parentNode.removeChild(iframe);
|
|
734
|
-
}
|
|
735
|
-
} catch (error) {
|
|
736
|
-
warn(error);
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
chkEvent(iframeId, 'onClosed', iframeId);
|
|
740
|
-
log(iframeId, '--');
|
|
741
|
-
removeIframeListeners(iframe);
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
function getPagePosition(iframeId) {
|
|
745
|
-
if (null === pagePosition) {
|
|
746
|
-
pagePosition = {
|
|
747
|
-
x:
|
|
748
|
-
window.pageXOffset === undefined$1
|
|
749
|
-
? document.documentElement.scrollLeft
|
|
750
|
-
: window.pageXOffset,
|
|
751
|
-
y:
|
|
752
|
-
window.pageYOffset === undefined$1
|
|
753
|
-
? document.documentElement.scrollTop
|
|
754
|
-
: window.pageYOffset
|
|
755
|
-
};
|
|
756
|
-
log(
|
|
757
|
-
iframeId,
|
|
758
|
-
'Get page position: ' + pagePosition.x + ',' + pagePosition.y
|
|
759
|
-
);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
function setPagePosition(iframeId) {
|
|
764
|
-
if (null !== pagePosition) {
|
|
765
|
-
window.scrollTo(pagePosition.x, pagePosition.y);
|
|
766
|
-
log(
|
|
767
|
-
iframeId,
|
|
768
|
-
'Set page position: ' + pagePosition.x + ',' + pagePosition.y
|
|
769
|
-
);
|
|
770
|
-
unsetPagePosition();
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
function unsetPagePosition() {
|
|
775
|
-
pagePosition = null;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
function resetIFrame(messageData) {
|
|
779
|
-
function reset() {
|
|
780
|
-
setSize(messageData);
|
|
781
|
-
trigger('reset', 'reset', messageData.iframe, messageData.id);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
log(
|
|
785
|
-
messageData.id,
|
|
786
|
-
'Size reset requested by ' +
|
|
787
|
-
('init' === messageData.type ? 'host page' : 'iFrame')
|
|
788
|
-
);
|
|
789
|
-
getPagePosition(messageData.id);
|
|
790
|
-
syncResize(reset, messageData, 'reset');
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
function setSize(messageData) {
|
|
794
|
-
function setDimension(dimension) {
|
|
795
|
-
if (!messageData.id) {
|
|
796
|
-
log('undefined', 'messageData id not set');
|
|
797
|
-
return
|
|
798
|
-
}
|
|
799
|
-
messageData.iframe.style[dimension] = messageData[dimension] + 'px';
|
|
800
|
-
log(
|
|
801
|
-
messageData.id,
|
|
802
|
-
'IFrame (' +
|
|
803
|
-
iframeId +
|
|
804
|
-
') ' +
|
|
805
|
-
dimension +
|
|
806
|
-
' set to ' +
|
|
807
|
-
messageData[dimension] +
|
|
808
|
-
'px'
|
|
809
|
-
);
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
function chkZero(dimension) {
|
|
813
|
-
// FireFox sets dimension of hidden iFrames to zero.
|
|
814
|
-
// So if we detect that set up an event to check for
|
|
815
|
-
// when iFrame becomes visible.
|
|
816
|
-
|
|
817
|
-
/* istanbul ignore next */ // Not testable in PhantomJS
|
|
818
|
-
if (!hiddenCheckEnabled && '0' === messageData[dimension]) {
|
|
819
|
-
hiddenCheckEnabled = true;
|
|
820
|
-
log(iframeId, 'Hidden iFrame detected, creating visibility listener');
|
|
821
|
-
fixHiddenIFrames();
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
function processDimension(dimension) {
|
|
826
|
-
setDimension(dimension);
|
|
827
|
-
chkZero(dimension);
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
var iframeId = messageData.iframe.id;
|
|
831
|
-
|
|
832
|
-
if (settings[iframeId]) {
|
|
833
|
-
if (settings[iframeId].sizeHeight) {
|
|
834
|
-
processDimension('height');
|
|
835
|
-
}
|
|
836
|
-
if (settings[iframeId].sizeWidth) {
|
|
837
|
-
processDimension('width');
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
function syncResize(func, messageData, doNotSync) {
|
|
843
|
-
/* istanbul ignore if */ // Not testable in PhantomJS
|
|
844
|
-
if (
|
|
845
|
-
doNotSync !== messageData.type &&
|
|
846
|
-
requestAnimationFrame &&
|
|
847
|
-
// including check for jasmine because had trouble getting spy to work in unit test using requestAnimationFrame
|
|
848
|
-
!window.jasmine
|
|
849
|
-
) {
|
|
850
|
-
log(messageData.id, 'Requesting animation frame');
|
|
851
|
-
requestAnimationFrame(func);
|
|
852
|
-
} else {
|
|
853
|
-
func();
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
function trigger(calleeMsg, msg, iframe, id, noResponseWarning) {
|
|
858
|
-
function postMessageToIFrame() {
|
|
859
|
-
var target = settings[id] && settings[id].targetOrigin;
|
|
860
|
-
log(
|
|
861
|
-
id,
|
|
862
|
-
'[' +
|
|
863
|
-
calleeMsg +
|
|
864
|
-
'] Sending msg to iframe[' +
|
|
865
|
-
id +
|
|
866
|
-
'] (' +
|
|
867
|
-
msg +
|
|
868
|
-
') targetOrigin: ' +
|
|
869
|
-
target
|
|
870
|
-
);
|
|
871
|
-
iframe.contentWindow.postMessage(msgId + msg, target);
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
function iFrameNotFound() {
|
|
875
|
-
warn(id, '[' + calleeMsg + '] IFrame(' + id + ') not found');
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
function chkAndSend() {
|
|
879
|
-
if (
|
|
880
|
-
iframe &&
|
|
881
|
-
'contentWindow' in iframe &&
|
|
882
|
-
null !== iframe.contentWindow
|
|
883
|
-
) {
|
|
884
|
-
// Null test for PhantomJS
|
|
885
|
-
postMessageToIFrame();
|
|
886
|
-
} else {
|
|
887
|
-
iFrameNotFound();
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
function warnOnNoResponse() {
|
|
892
|
-
function warning() {
|
|
893
|
-
if (settings[id] && !settings[id].loaded && !errorShown) {
|
|
894
|
-
errorShown = true;
|
|
895
|
-
warn(
|
|
896
|
-
id,
|
|
897
|
-
'IFrame has not responded within ' +
|
|
898
|
-
settings[id].warningTimeout / 1000 +
|
|
899
|
-
' 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.'
|
|
900
|
-
);
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
if (
|
|
905
|
-
!!noResponseWarning &&
|
|
906
|
-
settings[id] &&
|
|
907
|
-
!!settings[id].warningTimeout
|
|
908
|
-
) {
|
|
909
|
-
settings[id].msgTimeout = setTimeout(
|
|
910
|
-
warning,
|
|
911
|
-
settings[id].warningTimeout
|
|
912
|
-
);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
var errorShown = false;
|
|
917
|
-
|
|
918
|
-
id = id || iframe.id;
|
|
919
|
-
|
|
920
|
-
if (settings[id]) {
|
|
921
|
-
chkAndSend();
|
|
922
|
-
warnOnNoResponse();
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
function createOutgoingMsg(iframeId) {
|
|
927
|
-
return (
|
|
928
|
-
iframeId +
|
|
929
|
-
':' +
|
|
930
|
-
settings[iframeId].bodyMarginV1 +
|
|
931
|
-
':' +
|
|
932
|
-
settings[iframeId].sizeWidth +
|
|
933
|
-
':' +
|
|
934
|
-
settings[iframeId].log +
|
|
935
|
-
':' +
|
|
936
|
-
settings[iframeId].interval +
|
|
937
|
-
':' +
|
|
938
|
-
settings[iframeId].enablePublicMethods +
|
|
939
|
-
':' +
|
|
940
|
-
settings[iframeId].autoResize +
|
|
941
|
-
':' +
|
|
942
|
-
settings[iframeId].bodyMargin +
|
|
943
|
-
':' +
|
|
944
|
-
settings[iframeId].heightCalculationMethod +
|
|
945
|
-
':' +
|
|
946
|
-
settings[iframeId].bodyBackground +
|
|
947
|
-
':' +
|
|
948
|
-
settings[iframeId].bodyPadding +
|
|
949
|
-
':' +
|
|
950
|
-
settings[iframeId].tolerance +
|
|
951
|
-
':' +
|
|
952
|
-
settings[iframeId].inPageLinks +
|
|
953
|
-
':' +
|
|
954
|
-
settings[iframeId].resizeFrom +
|
|
955
|
-
':' +
|
|
956
|
-
settings[iframeId].widthCalculationMethod +
|
|
957
|
-
':' +
|
|
958
|
-
settings[iframeId].mouseEvents
|
|
959
|
-
)
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
function isNumber(value) {
|
|
963
|
-
return typeof value === 'number'
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
function setupIFrame(iframe, options) {
|
|
967
|
-
function setLimits() {
|
|
968
|
-
function addStyle(style) {
|
|
969
|
-
var styleValue = settings[iframeId][style];
|
|
970
|
-
if (Infinity !== styleValue && 0 !== styleValue) {
|
|
971
|
-
iframe.style[style] = isNumber(styleValue)
|
|
972
|
-
? styleValue + 'px'
|
|
973
|
-
: styleValue;
|
|
974
|
-
log(iframeId, 'Set ' + style + ' = ' + iframe.style[style]);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
function chkMinMax(dimension) {
|
|
979
|
-
if (
|
|
980
|
-
settings[iframeId]['min' + dimension] >
|
|
981
|
-
settings[iframeId]['max' + dimension]
|
|
982
|
-
) {
|
|
983
|
-
throw new Error(
|
|
984
|
-
'Value for min' +
|
|
985
|
-
dimension +
|
|
986
|
-
' can not be greater than max' +
|
|
987
|
-
dimension
|
|
988
|
-
)
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
chkMinMax('Height');
|
|
993
|
-
chkMinMax('Width');
|
|
994
|
-
|
|
995
|
-
addStyle('maxHeight');
|
|
996
|
-
addStyle('minHeight');
|
|
997
|
-
addStyle('maxWidth');
|
|
998
|
-
addStyle('minWidth');
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
function newId() {
|
|
1002
|
-
var id = (options && options.id) || defaults.id + count++;
|
|
1003
|
-
if (null !== document.getElementById(id)) {
|
|
1004
|
-
id += count++;
|
|
1005
|
-
}
|
|
1006
|
-
return id
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
function ensureHasId(iframeId) {
|
|
1010
|
-
if (typeof iframeId !== 'string') {
|
|
1011
|
-
throw new TypeError('Invaild id for iFrame. Expected String')
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
if ('' === iframeId) {
|
|
1015
|
-
// eslint-disable-next-line no-multi-assign
|
|
1016
|
-
iframe.id = iframeId = newId();
|
|
1017
|
-
logEnabled = (options || {}).log;
|
|
1018
|
-
log(
|
|
1019
|
-
iframeId,
|
|
1020
|
-
'Added missing iframe ID: ' + iframeId + ' (' + iframe.src + ')'
|
|
1021
|
-
);
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
return iframeId
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
function setScrolling() {
|
|
1028
|
-
log(
|
|
1029
|
-
iframeId,
|
|
1030
|
-
'IFrame scrolling ' +
|
|
1031
|
-
(settings[iframeId] && settings[iframeId].scrolling
|
|
1032
|
-
? 'enabled'
|
|
1033
|
-
: 'disabled') +
|
|
1034
|
-
' for ' +
|
|
1035
|
-
iframeId
|
|
1036
|
-
);
|
|
1037
|
-
iframe.style.overflow =
|
|
1038
|
-
false === (settings[iframeId] && settings[iframeId].scrolling)
|
|
1039
|
-
? 'hidden'
|
|
1040
|
-
: 'auto';
|
|
1041
|
-
switch (settings[iframeId] && settings[iframeId].scrolling) {
|
|
1042
|
-
case 'omit': {
|
|
1043
|
-
break
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
case true: {
|
|
1047
|
-
iframe.scrolling = 'yes';
|
|
1048
|
-
break
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
case false: {
|
|
1052
|
-
iframe.scrolling = 'no';
|
|
1053
|
-
break
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
default: {
|
|
1057
|
-
iframe.scrolling = settings[iframeId]
|
|
1058
|
-
? settings[iframeId].scrolling
|
|
1059
|
-
: 'no';
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
// The V1 iFrame script expects an int, where as in V2 expects a CSS
|
|
1065
|
-
// string value such as '1px 3em', so if we have an int for V2, set V1=V2
|
|
1066
|
-
// and then convert V2 to a string PX value.
|
|
1067
|
-
function setupBodyMarginValues() {
|
|
1068
|
-
if (
|
|
1069
|
-
'number' ===
|
|
1070
|
-
typeof (settings[iframeId] && settings[iframeId].bodyMargin) ||
|
|
1071
|
-
'0' === (settings[iframeId] && settings[iframeId].bodyMargin)
|
|
1072
|
-
) {
|
|
1073
|
-
settings[iframeId].bodyMarginV1 = settings[iframeId].bodyMargin;
|
|
1074
|
-
settings[iframeId].bodyMargin =
|
|
1075
|
-
'' + settings[iframeId].bodyMargin + 'px';
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
function checkReset() {
|
|
1080
|
-
// Reduce scope of firstRun to function, because IE8's JS execution
|
|
1081
|
-
// context stack is borked and this value gets externally
|
|
1082
|
-
// changed midway through running this function!!!
|
|
1083
|
-
var firstRun = settings[iframeId] && settings[iframeId].firstRun,
|
|
1084
|
-
resetRequertMethod =
|
|
1085
|
-
settings[iframeId] &&
|
|
1086
|
-
settings[iframeId].heightCalculationMethod in resetRequiredMethods;
|
|
1087
|
-
|
|
1088
|
-
if (!firstRun && resetRequertMethod) {
|
|
1089
|
-
resetIFrame({ iframe: iframe, height: 0, width: 0, type: 'init' });
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
function setupIFrameObject() {
|
|
1094
|
-
if (settings[iframeId]) {
|
|
1095
|
-
settings[iframeId].iframe.iFrameResizer = {
|
|
1096
|
-
close: closeIFrame.bind(null, settings[iframeId].iframe),
|
|
1097
|
-
|
|
1098
|
-
removeListeners: removeIframeListeners.bind(
|
|
1099
|
-
null,
|
|
1100
|
-
settings[iframeId].iframe
|
|
1101
|
-
),
|
|
1102
|
-
|
|
1103
|
-
resize: trigger.bind(
|
|
1104
|
-
null,
|
|
1105
|
-
'Window resize',
|
|
1106
|
-
'resize',
|
|
1107
|
-
settings[iframeId].iframe
|
|
1108
|
-
),
|
|
1109
|
-
|
|
1110
|
-
moveToAnchor: function (anchor) {
|
|
1111
|
-
trigger(
|
|
1112
|
-
'Move to anchor',
|
|
1113
|
-
'moveToAnchor:' + anchor,
|
|
1114
|
-
settings[iframeId].iframe,
|
|
1115
|
-
iframeId
|
|
1116
|
-
);
|
|
1117
|
-
},
|
|
1118
|
-
|
|
1119
|
-
sendMessage: function (message) {
|
|
1120
|
-
message = JSON.stringify(message);
|
|
1121
|
-
trigger(
|
|
1122
|
-
'Send Message',
|
|
1123
|
-
'message:' + message,
|
|
1124
|
-
settings[iframeId].iframe,
|
|
1125
|
-
iframeId
|
|
1126
|
-
);
|
|
1127
|
-
}
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
// We have to call trigger twice, as we can not be sure if all
|
|
1133
|
-
// iframes have completed loading when this code runs. The
|
|
1134
|
-
// event listener also catches the page changing in the iFrame.
|
|
1135
|
-
function init(msg) {
|
|
1136
|
-
function iFrameLoaded() {
|
|
1137
|
-
trigger('iFrame.onload', msg, iframe, undefined$1, true);
|
|
1138
|
-
checkReset();
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
function createDestroyObserver(MutationObserver) {
|
|
1142
|
-
if (!iframe.parentNode) {
|
|
1143
|
-
return
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
var destroyObserver = new MutationObserver(function (mutations) {
|
|
1147
|
-
mutations.forEach(function (mutation) {
|
|
1148
|
-
var removedNodes = Array.prototype.slice.call(mutation.removedNodes); // Transform NodeList into an Array
|
|
1149
|
-
removedNodes.forEach(function (removedNode) {
|
|
1150
|
-
if (removedNode === iframe) {
|
|
1151
|
-
closeIFrame(iframe);
|
|
1152
|
-
}
|
|
1153
|
-
});
|
|
1154
|
-
});
|
|
1155
|
-
});
|
|
1156
|
-
destroyObserver.observe(iframe.parentNode, {
|
|
1157
|
-
childList: true
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
var MutationObserver = getMutationObserver();
|
|
1162
|
-
if (MutationObserver) {
|
|
1163
|
-
createDestroyObserver(MutationObserver);
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
addEventListener(iframe, 'load', iFrameLoaded);
|
|
1167
|
-
trigger('init', msg, iframe, undefined$1, true);
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
function checkOptions(options) {
|
|
1171
|
-
if ('object' !== typeof options) {
|
|
1172
|
-
throw new TypeError('Options is not an object')
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
function copyOptions(options) {
|
|
1177
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
1178
|
-
for (var option in defaults) {
|
|
1179
|
-
if (Object.prototype.hasOwnProperty.call(defaults, option)) {
|
|
1180
|
-
settings[iframeId][option] = Object.prototype.hasOwnProperty.call(
|
|
1181
|
-
options,
|
|
1182
|
-
option
|
|
1183
|
-
)
|
|
1184
|
-
? options[option]
|
|
1185
|
-
: defaults[option];
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
function getTargetOrigin(remoteHost) {
|
|
1191
|
-
return '' === remoteHost ||
|
|
1192
|
-
null !== remoteHost.match(/^(about:blank|javascript:|file:\/\/)/)
|
|
1193
|
-
? '*'
|
|
1194
|
-
: remoteHost
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
function depricate(key) {
|
|
1198
|
-
var splitName = key.split('Callback');
|
|
1199
|
-
|
|
1200
|
-
if (splitName.length === 2) {
|
|
1201
|
-
var name =
|
|
1202
|
-
'on' + splitName[0].charAt(0).toUpperCase() + splitName[0].slice(1);
|
|
1203
|
-
this[name] = this[key];
|
|
1204
|
-
delete this[key];
|
|
1205
|
-
warn(
|
|
1206
|
-
iframeId,
|
|
1207
|
-
"Deprecated: '" +
|
|
1208
|
-
key +
|
|
1209
|
-
"' has been renamed '" +
|
|
1210
|
-
name +
|
|
1211
|
-
"'. The old method will be removed in the next major version."
|
|
1212
|
-
);
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
function processOptions(options) {
|
|
1217
|
-
options = options || {};
|
|
1218
|
-
|
|
1219
|
-
settings[iframeId] = Object.create(null); // Protect against prototype attacks
|
|
1220
|
-
settings[iframeId].iframe = iframe;
|
|
1221
|
-
settings[iframeId].firstRun = true;
|
|
1222
|
-
settings[iframeId].remoteHost =
|
|
1223
|
-
iframe.src && iframe.src.split('/').slice(0, 3).join('/');
|
|
1224
|
-
|
|
1225
|
-
checkOptions(options);
|
|
1226
|
-
Object.keys(options).forEach(depricate, options);
|
|
1227
|
-
copyOptions(options);
|
|
1228
|
-
|
|
1229
|
-
if (settings[iframeId]) {
|
|
1230
|
-
settings[iframeId].targetOrigin =
|
|
1231
|
-
true === settings[iframeId].checkOrigin
|
|
1232
|
-
? getTargetOrigin(settings[iframeId].remoteHost)
|
|
1233
|
-
: '*';
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
function beenHere() {
|
|
1238
|
-
return iframeId in settings && 'iFrameResizer' in iframe
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
var iframeId = ensureHasId(iframe.id);
|
|
1242
|
-
|
|
1243
|
-
if (beenHere()) {
|
|
1244
|
-
warn(iframeId, 'Ignored iFrame, already setup.');
|
|
1245
|
-
} else {
|
|
1246
|
-
processOptions(options);
|
|
1247
|
-
setScrolling();
|
|
1248
|
-
setLimits();
|
|
1249
|
-
setupBodyMarginValues();
|
|
1250
|
-
init(createOutgoingMsg(iframeId));
|
|
1251
|
-
setupIFrameObject();
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
function debouce(fn, time) {
|
|
1256
|
-
if (null === timer) {
|
|
1257
|
-
timer = setTimeout(function () {
|
|
1258
|
-
timer = null;
|
|
1259
|
-
fn();
|
|
1260
|
-
}, time);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
var frameTimer = {};
|
|
1265
|
-
function debounceFrameEvents(fn, time, frameId) {
|
|
1266
|
-
if (!frameTimer[frameId]) {
|
|
1267
|
-
frameTimer[frameId] = setTimeout(function () {
|
|
1268
|
-
frameTimer[frameId] = null;
|
|
1269
|
-
fn();
|
|
1270
|
-
}, time);
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
// Not testable in PhantomJS
|
|
1275
|
-
/* istanbul ignore next */
|
|
1276
|
-
|
|
1277
|
-
function fixHiddenIFrames() {
|
|
1278
|
-
function checkIFrames() {
|
|
1279
|
-
function checkIFrame(settingId) {
|
|
1280
|
-
function chkDimension(dimension) {
|
|
1281
|
-
return (
|
|
1282
|
-
'0px' ===
|
|
1283
|
-
(settings[settingId] && settings[settingId].iframe.style[dimension])
|
|
1284
|
-
)
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
function isVisible(el) {
|
|
1288
|
-
return null !== el.offsetParent
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
if (
|
|
1292
|
-
settings[settingId] &&
|
|
1293
|
-
isVisible(settings[settingId].iframe) &&
|
|
1294
|
-
(chkDimension('height') || chkDimension('width'))
|
|
1295
|
-
) {
|
|
1296
|
-
trigger(
|
|
1297
|
-
'Visibility change',
|
|
1298
|
-
'resize',
|
|
1299
|
-
settings[settingId].iframe,
|
|
1300
|
-
settingId
|
|
1301
|
-
);
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
Object.keys(settings).forEach(function (key) {
|
|
1306
|
-
checkIFrame(key);
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
function mutationObserved(mutations) {
|
|
1311
|
-
log(
|
|
1312
|
-
'window',
|
|
1313
|
-
'Mutation observed: ' + mutations[0].target + ' ' + mutations[0].type
|
|
1314
|
-
);
|
|
1315
|
-
debouce(checkIFrames, 16);
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
function createMutationObserver() {
|
|
1319
|
-
var target = document.querySelector('body'),
|
|
1320
|
-
config = {
|
|
1321
|
-
attributes: true,
|
|
1322
|
-
attributeOldValue: false,
|
|
1323
|
-
characterData: true,
|
|
1324
|
-
characterDataOldValue: false,
|
|
1325
|
-
childList: true,
|
|
1326
|
-
subtree: true
|
|
1327
|
-
},
|
|
1328
|
-
observer = new MutationObserver(mutationObserved);
|
|
1329
|
-
|
|
1330
|
-
observer.observe(target, config);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
var MutationObserver = getMutationObserver();
|
|
1334
|
-
if (MutationObserver) {
|
|
1335
|
-
createMutationObserver();
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
function resizeIFrames(event) {
|
|
1340
|
-
function resize() {
|
|
1341
|
-
sendTriggerMsg('Window ' + event, 'resize');
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
log('window', 'Trigger event: ' + event);
|
|
1345
|
-
debouce(resize, 16);
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
// Not testable in PhantomJS
|
|
1349
|
-
/* istanbul ignore next */
|
|
1350
|
-
function tabVisible() {
|
|
1351
|
-
function resize() {
|
|
1352
|
-
sendTriggerMsg('Tab Visible', 'resize');
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
if ('hidden' !== document.visibilityState) {
|
|
1356
|
-
log('document', 'Trigger event: Visibility change');
|
|
1357
|
-
debouce(resize, 16);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
function sendTriggerMsg(eventName, event) {
|
|
1362
|
-
function isIFrameResizeEnabled(iframeId) {
|
|
1363
|
-
return (
|
|
1364
|
-
settings[iframeId] &&
|
|
1365
|
-
'parent' === settings[iframeId].resizeFrom &&
|
|
1366
|
-
settings[iframeId].autoResize &&
|
|
1367
|
-
!settings[iframeId].firstRun
|
|
1368
|
-
)
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
Object.keys(settings).forEach(function (iframeId) {
|
|
1372
|
-
if (isIFrameResizeEnabled(iframeId)) {
|
|
1373
|
-
trigger(eventName, event, settings[iframeId].iframe, iframeId);
|
|
1374
|
-
}
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
function setupEventListeners() {
|
|
1379
|
-
addEventListener(window, 'message', iFrameListener);
|
|
1380
|
-
|
|
1381
|
-
addEventListener(window, 'resize', function () {
|
|
1382
|
-
resizeIFrames('resize');
|
|
1383
|
-
});
|
|
1384
|
-
|
|
1385
|
-
addEventListener(document, 'visibilitychange', tabVisible);
|
|
1386
|
-
|
|
1387
|
-
addEventListener(document, '-webkit-visibilitychange', tabVisible);
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
function factory() {
|
|
1391
|
-
function init(options, element) {
|
|
1392
|
-
function chkType() {
|
|
1393
|
-
if (!element.tagName) {
|
|
1394
|
-
throw new TypeError('Object is not a valid DOM element')
|
|
1395
|
-
} else if ('IFRAME' !== element.tagName.toUpperCase()) {
|
|
1396
|
-
throw new TypeError(
|
|
1397
|
-
'Expected <IFRAME> tag, found <' + element.tagName + '>'
|
|
1398
|
-
)
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
if (element) {
|
|
1403
|
-
chkType();
|
|
1404
|
-
setupIFrame(element, options);
|
|
1405
|
-
iFrames.push(element);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
function warnDeprecatedOptions(options) {
|
|
1410
|
-
if (options && options.enablePublicMethods) {
|
|
1411
|
-
warn(
|
|
1412
|
-
'enablePublicMethods option has been removed, public methods are now always available in the iFrame'
|
|
1413
|
-
);
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
var iFrames;
|
|
1418
|
-
|
|
1419
|
-
setupRequestAnimationFrame();
|
|
1420
|
-
setupEventListeners();
|
|
1421
|
-
|
|
1422
|
-
return function iFrameResizeF(options, target) {
|
|
1423
|
-
iFrames = []; // Only return iFrames past in on this call
|
|
1424
|
-
|
|
1425
|
-
warnDeprecatedOptions(options);
|
|
1426
|
-
|
|
1427
|
-
switch (typeof target) {
|
|
1428
|
-
case 'undefined':
|
|
1429
|
-
case 'string': {
|
|
1430
|
-
Array.prototype.forEach.call(
|
|
1431
|
-
document.querySelectorAll(target || 'iframe'),
|
|
1432
|
-
init.bind(undefined$1, options)
|
|
1433
|
-
);
|
|
1434
|
-
break
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
case 'object': {
|
|
1438
|
-
init(options, target);
|
|
1439
|
-
break
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
default: {
|
|
1443
|
-
throw new TypeError('Unexpected data type (' + typeof target + ')')
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
return iFrames
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
function createJQueryPublicMethod($) {
|
|
1452
|
-
if (!$.fn) {
|
|
1453
|
-
info('', 'Unable to bind to jQuery, it is not fully loaded.');
|
|
1454
|
-
} else if (!$.fn.iFrameResize) {
|
|
1455
|
-
$.fn.iFrameResize = function $iFrameResizeF(options) {
|
|
1456
|
-
function init(index, element) {
|
|
1457
|
-
setupIFrame(element, options);
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
return this.filter('iframe').each(init).end()
|
|
1461
|
-
};
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
if (window.jQuery !== undefined$1) {
|
|
1466
|
-
createJQueryPublicMethod(window.jQuery);
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
if (typeof undefined$1 === 'function' && undefined$1.amd) {
|
|
1470
|
-
undefined$1([], factory);
|
|
1471
|
-
} else {
|
|
1472
|
-
// Node for browserfy
|
|
1473
|
-
module.exports = factory();
|
|
1474
|
-
}
|
|
1475
|
-
window.iFrameResize = window.iFrameResize || factory();
|
|
1476
|
-
})();
|
|
1477
|
-
});
|
|
1478
|
-
|
|
1479
|
-
const MessageEventType = {
|
|
1480
|
-
card: {
|
|
1481
|
-
ready: 'justifi.card.ready',
|
|
1482
|
-
tokenize: 'justifi.card.tokenize',
|
|
1483
|
-
validate: 'justifi.card.validate',
|
|
1484
|
-
resize: 'justifi.card.resize',
|
|
1485
|
-
styleOverrides: 'justifi.card.styleOverrides',
|
|
1486
|
-
},
|
|
1487
|
-
bankAccount: {
|
|
1488
|
-
ready: 'justifi.bankAccount.ready',
|
|
1489
|
-
tokenize: 'justifi.bankAccount.tokenize',
|
|
1490
|
-
validate: 'justifi.bankAccount.validate',
|
|
1491
|
-
resize: 'justifi.bankAccount.resize',
|
|
1492
|
-
styleOverrides: 'justifi.bankAccount.styleOverrides',
|
|
1493
|
-
},
|
|
1494
|
-
};
|
|
1495
|
-
|
|
1496
|
-
const name = "@justifi/webcomponents";
|
|
1497
|
-
const version = "4.8.3";
|
|
1498
|
-
const description = "JustiFi Web Components";
|
|
1499
|
-
const main = "dist/module/index.js";
|
|
1500
|
-
const module$1 = "dist/module/index.js";
|
|
1501
|
-
const types = "./dist/types/index.d.ts";
|
|
1502
|
-
const repository = {
|
|
1503
|
-
type: "git",
|
|
1504
|
-
url: "git+https://github.com/justifi-tech/web-component-library.git"
|
|
1505
|
-
};
|
|
1506
|
-
const homepage = "https://storybook.justifi.ai/?path=/docs/introduction--docs";
|
|
1507
|
-
const publishConfig = {
|
|
1508
|
-
registry: "https://registry.npmjs.org"
|
|
1509
|
-
};
|
|
1510
|
-
const files = [
|
|
1511
|
-
"dist/"
|
|
1512
|
-
];
|
|
1513
|
-
const scripts = {
|
|
1514
|
-
build: "stencil build --docs",
|
|
1515
|
-
dev: "stencil build --watch",
|
|
1516
|
-
lint: "eslint . --max-warnings 0",
|
|
1517
|
-
clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
1518
|
-
generate: "stencil generate",
|
|
1519
|
-
test: "TZ=utc stencil test --spec",
|
|
1520
|
-
"test:watch": "TZ=utc stencil test --spec --watchAll",
|
|
1521
|
-
"test:e2e": "stencil test --e2e"
|
|
1522
|
-
};
|
|
1523
|
-
const dependencies = {
|
|
1524
|
-
"@stencil/core": "^4.0.5",
|
|
1525
|
-
bootstrap: "^5.2.3",
|
|
1526
|
-
"chart.js": "^4.4.1",
|
|
1527
|
-
"date-fns": "^2.29.3",
|
|
1528
|
-
"dinero.js": "^1.9.1",
|
|
1529
|
-
"iframe-resizer": "^4.3.7",
|
|
1530
|
-
imask: "^7.1.3",
|
|
1531
|
-
rxjs: "^7.8.1",
|
|
1532
|
-
"ts-dedent": "^2.2.0",
|
|
1533
|
-
uuid: "^9.0.0",
|
|
1534
|
-
yup: "^1.0.0"
|
|
1535
|
-
};
|
|
1536
|
-
const devDependencies = {
|
|
1537
|
-
"@babel/preset-env": "^7.21.5",
|
|
1538
|
-
"@babel/preset-react": "^7.18.6",
|
|
1539
|
-
"@babel/preset-typescript": "^7.21.5",
|
|
1540
|
-
"@stencil/sass": "^3.0.1",
|
|
1541
|
-
"@stencil/store": "^2.0.8",
|
|
1542
|
-
"@types/jest": "27.0.3",
|
|
1543
|
-
"@types/node": "^20.1.4",
|
|
1544
|
-
"@types/react": "^18.0.37",
|
|
1545
|
-
"@types/react-dom": "^18.0.11",
|
|
1546
|
-
dotenv: "^16.3.1",
|
|
1547
|
-
jest: "^29.7.0",
|
|
1548
|
-
"jest-cli": "^29.7.0",
|
|
1549
|
-
"jest-environment-node": "^29.7.0",
|
|
1550
|
-
puppeteer: "^21.0.0",
|
|
1551
|
-
"ts-jest": "^29.1.2"
|
|
1552
|
-
};
|
|
1553
|
-
const license = "MIT";
|
|
1554
|
-
const gitHead = "507bac1d941eae6e1f56e185ecd9bc9d22637783";
|
|
1555
|
-
const pnpm = {
|
|
1556
|
-
overrides: {
|
|
1557
|
-
"ip@<1.1.9": ">=1.1.9",
|
|
1558
|
-
"ip@=2.0.0": ">=2.0.1"
|
|
1559
|
-
}
|
|
1560
|
-
};
|
|
1561
|
-
const packageJson = {
|
|
1562
|
-
name: name,
|
|
1563
|
-
version: version,
|
|
1564
|
-
description: description,
|
|
1565
|
-
main: main,
|
|
1566
|
-
module: module$1,
|
|
1567
|
-
types: types,
|
|
1568
|
-
repository: repository,
|
|
1569
|
-
homepage: homepage,
|
|
1570
|
-
publishConfig: publishConfig,
|
|
1571
|
-
files: files,
|
|
1572
|
-
scripts: scripts,
|
|
1573
|
-
dependencies: dependencies,
|
|
1574
|
-
devDependencies: devDependencies,
|
|
1575
|
-
license: license,
|
|
1576
|
-
gitHead: gitHead,
|
|
1577
|
-
pnpm: pnpm
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
const getComputedTheme = () => {
|
|
1581
|
-
const computedStyles = getComputedStyle(document.body);
|
|
1582
|
-
const computedTheme = {
|
|
1583
|
-
loadGoogleFont: computedStyles.getPropertyValue('--jfi-load-google-font'),
|
|
1584
|
-
layout: {
|
|
1585
|
-
fontFamily: computedStyles.getPropertyValue('--jfi-layout-font-family'),
|
|
1586
|
-
padding: computedStyles.getPropertyValue('--jfi-layout-padding'),
|
|
1587
|
-
formControlSpacingHorizontal: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-x'),
|
|
1588
|
-
formControlSpacingVertical: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-y'),
|
|
1589
|
-
},
|
|
1590
|
-
formControl: {
|
|
1591
|
-
backgroundColor: computedStyles.getPropertyValue('--jfi-form-control-background-color'),
|
|
1592
|
-
borderColor: computedStyles.getPropertyValue('--jfi-form-control-border-color'),
|
|
1593
|
-
borderColorFocus: computedStyles.getPropertyValue('--jfi-form-control-border-color-focus'),
|
|
1594
|
-
borderColorError: computedStyles.getPropertyValue('--jfi-form-control-border-color-error'),
|
|
1595
|
-
borderWidth: computedStyles.getPropertyValue('--jfi-form-control-border-width'),
|
|
1596
|
-
borderBottomWidth: computedStyles.getPropertyValue('--jfi-form-control-border-bottom-width'),
|
|
1597
|
-
borderLeftWidth: computedStyles.getPropertyValue('--jfi-form-control-border-left-width'),
|
|
1598
|
-
borderRightWidth: computedStyles.getPropertyValue('--jfi-form-control-border-right-width'),
|
|
1599
|
-
borderTopWidth: computedStyles.getPropertyValue('--jfi-form-control-border-top-width'),
|
|
1600
|
-
borderRadius: computedStyles.getPropertyValue('--jfi-form-control-border-radius'),
|
|
1601
|
-
borderStyle: computedStyles.getPropertyValue('--jfi-form-control-border-style'),
|
|
1602
|
-
boxShadow: computedStyles.getPropertyValue('--jfi-form-control-box-shadow'),
|
|
1603
|
-
boxShadowError: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error'),
|
|
1604
|
-
boxShadowErrorFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error-focus'),
|
|
1605
|
-
boxShadowFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-focus'),
|
|
1606
|
-
color: computedStyles.getPropertyValue('--jfi-form-control-color'),
|
|
1607
|
-
colorFocus: computedStyles.getPropertyValue('--jfi-form-control-color-focus'),
|
|
1608
|
-
fontSize: computedStyles.getPropertyValue('--jfi-form-control-font-size'),
|
|
1609
|
-
fontWeight: computedStyles.getPropertyValue('--jfi-form-control-font-weight'),
|
|
1610
|
-
lineHeight: computedStyles.getPropertyValue('--jfi-form-control-line-height'),
|
|
1611
|
-
margin: computedStyles.getPropertyValue('--jfi-form-control-margin'),
|
|
1612
|
-
padding: computedStyles.getPropertyValue('--jfi-form-control-padding'),
|
|
1613
|
-
},
|
|
1614
|
-
formLabel: {
|
|
1615
|
-
color: computedStyles.getPropertyValue('--jfi-form-label-color'),
|
|
1616
|
-
fontFamily: computedStyles.getPropertyValue('--jfi-form-label-font-family'),
|
|
1617
|
-
fontSize: computedStyles.getPropertyValue('--jfi-form-label-font-size'),
|
|
1618
|
-
fontWeight: computedStyles.getPropertyValue('--jfi-form-label-font-weight'),
|
|
1619
|
-
margin: computedStyles.getPropertyValue('--jfi-form-label-margin'),
|
|
1620
|
-
},
|
|
1621
|
-
errorMessage: {
|
|
1622
|
-
color: computedStyles.getPropertyValue('--jfi-error-message-color'),
|
|
1623
|
-
margin: computedStyles.getPropertyValue('--jfi-error-message-margin'),
|
|
1624
|
-
fontSize: computedStyles.getPropertyValue('--jfi-error-message-font-size'),
|
|
1625
|
-
},
|
|
1626
|
-
};
|
|
1627
|
-
return computedTheme;
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
|
-
/**
|
|
1631
|
-
* This approach decouples the communication logic from PaymentMethodForm component,
|
|
1632
|
-
* making it cleaner, more maintainable, and easier to test
|
|
1633
|
-
*/
|
|
1634
|
-
class FrameCommunicationService {
|
|
1635
|
-
constructor(iframe, iframeOrigin) {
|
|
1636
|
-
this.iframe = iframe;
|
|
1637
|
-
this.iframeOrigin = iframeOrigin;
|
|
1638
|
-
}
|
|
1639
|
-
postMessage(eventType, payload) {
|
|
1640
|
-
const message = Object.assign({ eventType }, payload);
|
|
1641
|
-
this.iframe.contentWindow.postMessage(message, this.iframeOrigin);
|
|
1642
|
-
}
|
|
1643
|
-
addMessageListener(callback) {
|
|
1644
|
-
window.addEventListener('message', callback);
|
|
1645
|
-
}
|
|
1646
|
-
removeMessageListener(callback) {
|
|
1647
|
-
window.removeEventListener('message', callback);
|
|
1648
|
-
}
|
|
1649
|
-
postMessageWithResponseListener(eventType, payload) {
|
|
1650
|
-
return new Promise((resolve) => {
|
|
1651
|
-
const responseListener = (event) => {
|
|
1652
|
-
if (event.data.eventType !== eventType)
|
|
1653
|
-
return;
|
|
1654
|
-
window.removeEventListener('message', responseListener);
|
|
1655
|
-
resolve(event.data.data);
|
|
1656
|
-
};
|
|
1657
|
-
window.addEventListener('message', responseListener);
|
|
1658
|
-
this.postMessage(eventType, payload);
|
|
1659
|
-
});
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}iframe{width:1px;min-width:100%}";
|
|
1664
|
-
|
|
1665
|
-
const PaymentMethodForm = class {
|
|
1666
|
-
constructor(hostRef) {
|
|
1667
|
-
index.registerInstance(this, hostRef);
|
|
1668
|
-
this.paymentMethodFormReady = index.createEvent(this, "paymentMethodFormReady", 7);
|
|
1669
|
-
this.paymentMethodFormValidated = index.createEvent(this, "paymentMethodFormValidated", 7);
|
|
1670
|
-
this.paymentMethodFormTokenized = index.createEvent(this, "paymentMethodFormTokenized", 7);
|
|
1671
|
-
this.computedTheme = getComputedTheme();
|
|
1672
|
-
this.dispatchMessageEvent = (messageEvent) => {
|
|
1673
|
-
const { eventType, data } = messageEvent.data;
|
|
1674
|
-
const eventTypeMessage = MessageEventType[this.paymentMethodFormType];
|
|
1675
|
-
if (eventType === eventTypeMessage.ready) {
|
|
1676
|
-
this.paymentMethodFormReady.emit(data);
|
|
1677
|
-
}
|
|
1678
|
-
else if (eventType === eventTypeMessage.tokenize) {
|
|
1679
|
-
this.paymentMethodFormTokenized.emit(data);
|
|
1680
|
-
}
|
|
1681
|
-
else if (eventType === eventTypeMessage.validate) {
|
|
1682
|
-
this.paymentMethodFormValidated.emit(data);
|
|
1683
|
-
}
|
|
1684
|
-
};
|
|
1685
|
-
this.postMessage = (eventType, payload) => {
|
|
1686
|
-
this.frameService.postMessage(eventType, payload);
|
|
1687
|
-
};
|
|
1688
|
-
this.paymentMethodFormType = undefined;
|
|
1689
|
-
this.paymentMethodFormValidationMode = undefined;
|
|
1690
|
-
this.iframeOrigin = undefined;
|
|
1691
|
-
this.singleLine = undefined;
|
|
1692
|
-
}
|
|
1693
|
-
disconnectedCallback() {
|
|
1694
|
-
this.frameService.removeMessageListener(this.dispatchMessageEvent);
|
|
1695
|
-
}
|
|
1696
|
-
async resize() {
|
|
1697
|
-
this.postMessage(MessageEventType[this.paymentMethodFormType].resize);
|
|
1698
|
-
}
|
|
1699
|
-
async tokenize(clientId, paymentMethodMetadata, account) {
|
|
1700
|
-
const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
|
|
1701
|
-
return this.frameService.postMessageWithResponseListener(eventType, {
|
|
1702
|
-
clientId,
|
|
1703
|
-
paymentMethodMetadata,
|
|
1704
|
-
account,
|
|
1705
|
-
componentVersion: packageJson.version,
|
|
1706
|
-
});
|
|
1707
|
-
}
|
|
1708
|
-
async validate() {
|
|
1709
|
-
const eventType = MessageEventType[this.paymentMethodFormType].validate;
|
|
1710
|
-
return this.frameService.postMessageWithResponseListener(eventType);
|
|
1711
|
-
}
|
|
1712
|
-
sendStyleOverrides() {
|
|
1713
|
-
if (this.computedTheme) {
|
|
1714
|
-
this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.computedTheme });
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
getIframeSrc() {
|
|
1718
|
-
let paramsList = [];
|
|
1719
|
-
if (this.paymentMethodFormValidationMode) {
|
|
1720
|
-
paramsList.push(`validationMode=${this.paymentMethodFormValidationMode}`);
|
|
1721
|
-
}
|
|
1722
|
-
if (this.singleLine) {
|
|
1723
|
-
paramsList.push(`singleLine=${this.singleLine}`);
|
|
1724
|
-
}
|
|
1725
|
-
let iframeSrc = `${this.iframeOrigin}/${this.paymentMethodFormType}${utils.composeQueryParams(paramsList)}`;
|
|
1726
|
-
return iframeSrc;
|
|
1727
|
-
}
|
|
1728
|
-
initializeFrameCommunicationService() {
|
|
1729
|
-
var _a;
|
|
1730
|
-
this.frameService = new FrameCommunicationService(this.iframeElement, this.iframeOrigin);
|
|
1731
|
-
(_a = this.frameService) === null || _a === void 0 ? void 0 : _a.addMessageListener(this.dispatchMessageEvent);
|
|
1732
|
-
}
|
|
1733
|
-
render() {
|
|
1734
|
-
return (index.h(index.Host, null, index.h("iframe", { id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: el => {
|
|
1735
|
-
this.iframeElement = el;
|
|
1736
|
-
}, onLoad: () => {
|
|
1737
|
-
iframeResizer({
|
|
1738
|
-
scrollbars: false,
|
|
1739
|
-
}, this.iframeElement);
|
|
1740
|
-
this.initializeFrameCommunicationService();
|
|
1741
|
-
this.sendStyleOverrides();
|
|
1742
|
-
} })));
|
|
1743
|
-
}
|
|
1744
|
-
};
|
|
1745
|
-
PaymentMethodForm.style = paymentMethodFormCss;
|
|
1746
|
-
|
|
1747
|
-
exports.justifi_payment_method_form = PaymentMethodForm;
|