@justifi/webcomponents 4.19.1-rc → 4.19.1-rc-4

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