@rebilly/instruments 3.0.0-beta.0 → 3.1.2-beta.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/index.js +88 -107
- package/dist/index.min.js +88 -0
- package/package.json +17 -6
- package/rollup.config.js +84 -0
- package/src/functions/mount/fetch-data.js +13 -1
- package/src/functions/mount/index.js +6 -42
- package/src/functions/mount/setup-framepay-theme.js +2 -2
- package/src/functions/mount/setup-options.js +3 -0
- package/src/functions/mount/setup-user-flow.js +49 -0
- package/src/functions/purchase.js +1 -1
- package/src/functions/setup.js +1 -1
- package/src/functions/show.spec.js +1 -1
- package/src/i18n/en.json +3 -0
- package/src/i18n/index.js +1 -1
- package/src/index.js +1 -61
- package/src/instance.js +65 -0
- package/src/{index.spec.js → instance.spec.js} +2 -1
- package/src/loader/index.js +21 -1
- package/src/storefront/models/ready-to-pay-model.js +13 -2
- package/src/storefront/plans.js +8 -4
- package/src/storefront/plans.spec.js +8 -2
- package/src/storefront/products.js +8 -4
- package/src/storefront/products.spec.js +8 -2
- package/src/storefront/ready-to-pay.js +5 -4
- package/src/style/base/__snapshots__/theme.spec.js.snap +34 -2
- package/src/style/base/default-theme.js +106 -3
- package/src/style/components/button.js +17 -1
- package/src/style/components/forms/label.js +0 -5
- package/src/style/components/loader.js +2 -1
- package/src/style/payment-instruments/payment-card.js +2 -1
- package/src/style/utils/remove-empty-null.js +9 -9
- package/src/style/vendor/postmate.js +13 -0
- package/src/style/views/confirmation.js +2 -1
- package/src/views/common/iframe/base-iframe.js +2 -0
- package/src/views/common/iframe/event-listeners.js +10 -0
- package/src/views/common/iframe/method-iframe.js +3 -1
- package/src/views/confirmation.js +1 -0
- package/src/views/method-selector/express-methods/{google-pay.js → index.js} +3 -2
- package/src/views/method-selector/mount-express-methods.js +6 -18
- package/src/views/result.js +1 -0
- package/tests/mocks/rebilly-instruments-mock.js +2 -2
- package/dist/events/base-event.js +0 -66
- package/dist/events/events.spec.js +0 -18
- package/dist/events/index.js +0 -22
- package/dist/functions/destroy.js +0 -34
- package/dist/functions/destroy.spec.js +0 -69
- package/dist/functions/mount/fetch-data.js +0 -187
- package/dist/functions/mount/fetch-data.spec.js +0 -189
- package/dist/functions/mount/index.js +0 -218
- package/dist/functions/mount/mount.spec.js +0 -64
- package/dist/functions/mount/setup-element.js +0 -40
- package/dist/functions/mount/setup-framepay-theme.js +0 -95
- package/dist/functions/mount/setup-framepay.js +0 -46
- package/dist/functions/mount/setup-i18n.js +0 -33
- package/dist/functions/mount/setup-options.js +0 -99
- package/dist/functions/mount/setup-options.spec.js +0 -66
- package/dist/functions/mount/setup-storefront.js +0 -34
- package/dist/functions/mount/setup-styles.js +0 -43
- package/dist/functions/on.js +0 -40
- package/dist/functions/on.spec.js +0 -55
- package/dist/functions/purchase.js +0 -158
- package/dist/functions/purchase.spec.js +0 -74
- package/dist/functions/setup.js +0 -85
- package/dist/functions/setup.spec.js +0 -87
- package/dist/functions/show.js +0 -55
- package/dist/functions/show.spec.js +0 -61
- package/dist/functions/update.js +0 -74
- package/dist/functions/update.spec.js +0 -86
- package/dist/i18n/en.json +0 -22
- package/dist/i18n/es.json +0 -22
- package/dist/i18n/i18n.spec.js +0 -22
- package/dist/i18n/index.js +0 -72
- package/dist/index.spec.js +0 -35
- package/dist/loader/index.js +0 -94
- package/dist/loader/loader.spec.js +0 -69
- package/dist/storefront/index.js +0 -73
- package/dist/storefront/invoices.js +0 -27
- package/dist/storefront/models/base-model.js +0 -18
- package/dist/storefront/models/invoice-model.js +0 -14
- package/dist/storefront/models/plan-model.js +0 -14
- package/dist/storefront/models/product-model.js +0 -14
- package/dist/storefront/models/ready-to-pay-model.js +0 -46
- package/dist/storefront/models/summary-model.js +0 -79
- package/dist/storefront/models/transaction-model.js +0 -31
- package/dist/storefront/payment-instruments.js +0 -47
- package/dist/storefront/payment-instruments.spec.js +0 -55
- package/dist/storefront/plans.js +0 -37
- package/dist/storefront/plans.spec.js +0 -64
- package/dist/storefront/products.js +0 -40
- package/dist/storefront/products.spec.js +0 -65
- package/dist/storefront/purchase.js +0 -43
- package/dist/storefront/purchase.spec.js +0 -48
- package/dist/storefront/ready-to-pay.js +0 -58
- package/dist/storefront/ready-to-pay.spec.js +0 -69
- package/dist/storefront/storefront.spec.js +0 -15
- package/dist/storefront/summary.js +0 -55
- package/dist/storefront/summary.spec.js +0 -124
- package/dist/storefront/transactions.js +0 -27
- package/dist/style/base/__snapshots__/theme.spec.js.snap +0 -195
- package/dist/style/base/default-theme.js +0 -699
- package/dist/style/base/index.js +0 -104
- package/dist/style/base/theme.js +0 -41
- package/dist/style/base/theme.spec.js +0 -19
- package/dist/style/browserslist.js +0 -8
- package/dist/style/components/address.js +0 -64
- package/dist/style/components/button.js +0 -71
- package/dist/style/components/divider.js +0 -48
- package/dist/style/components/forms/checkbox.js +0 -86
- package/dist/style/components/forms/field.js +0 -65
- package/dist/style/components/forms/form.js +0 -28
- package/dist/style/components/forms/input.js +0 -86
- package/dist/style/components/forms/label.js +0 -69
- package/dist/style/components/forms/select.js +0 -95
- package/dist/style/components/forms/validation.js +0 -81
- package/dist/style/components/icons.js +0 -22
- package/dist/style/components/index.js +0 -57
- package/dist/style/components/loader.js +0 -50
- package/dist/style/components/methods.js +0 -108
- package/dist/style/components/overlay.js +0 -33
- package/dist/style/helpers/index.js +0 -59
- package/dist/style/index.js +0 -50
- package/dist/style/payment-instruments/content.js +0 -17
- package/dist/style/payment-instruments/index.js +0 -20
- package/dist/style/payment-instruments/payment-card.js +0 -35
- package/dist/style/utils/border.js +0 -47
- package/dist/style/utils/color-values.js +0 -58
- package/dist/style/utils/remove-empty-null.js +0 -20
- package/dist/style/vendor/framepay.js +0 -37
- package/dist/style/vendor/postmate.js +0 -17
- package/dist/style/views/confirmation.js +0 -85
- package/dist/style/views/index.js +0 -29
- package/dist/style/views/method-selector.js +0 -20
- package/dist/style/views/modal.js +0 -93
- package/dist/style/views/result.js +0 -61
- package/dist/style/views/summary.js +0 -127
- package/dist/utils/add-dom-element.js +0 -26
- package/dist/utils/format-currency.js +0 -15
- package/dist/utils/has-valid-css-selector.js +0 -11
- package/dist/utils/index.js +0 -55
- package/dist/utils/is-dom-element.js +0 -10
- package/dist/utils/process-property-as-dom-element.js +0 -38
- package/dist/utils/sleep.js +0 -10
- package/dist/views/__snapshots__/summary.spec.js.snap +0 -246
- package/dist/views/common/iframe/base-iframe.js +0 -59
- package/dist/views/common/iframe/event-listeners.js +0 -50
- package/dist/views/common/iframe/index.js +0 -19
- package/dist/views/common/iframe/method-iframe.js +0 -33
- package/dist/views/common/iframe/modal-iframe.js +0 -84
- package/dist/views/common/iframe/view-iframe.js +0 -31
- package/dist/views/common/render-utilities.js +0 -11
- package/dist/views/confirmation.js +0 -92
- package/dist/views/method-selector/__snapshots__/method-selector.spec.js.snap +0 -3
- package/dist/views/method-selector/express-methods/apple-pay.js +0 -92
- package/dist/views/method-selector/express-methods/google-pay.js +0 -31
- package/dist/views/method-selector/express-methods/paypal.js +0 -19
- package/dist/views/method-selector/generate-digital-wallet.js +0 -68
- package/dist/views/method-selector/generate-digital-wallet.spec.js +0 -135
- package/dist/views/method-selector/get-method-data.js +0 -25
- package/dist/views/method-selector/get-payment-methods.js +0 -66
- package/dist/views/method-selector/get-payment-methods.spec.js +0 -46
- package/dist/views/method-selector/index.js +0 -122
- package/dist/views/method-selector/method-selector.spec.js +0 -124
- package/dist/views/method-selector/mount-express-methods.js +0 -69
- package/dist/views/method-selector/mount-methods.js +0 -74
- package/dist/views/modal.js +0 -88
- package/dist/views/result.js +0 -40
- package/dist/views/summary.js +0 -215
- package/dist/views/summary.spec.js +0 -134
- package/src/views/method-selector/express-methods/paypal.js +0 -7
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = processPropertyAsDOMElement;
|
|
7
|
-
|
|
8
|
-
var _hasValidCssSelector = _interopRequireDefault(require("./has-valid-css-selector"));
|
|
9
|
-
|
|
10
|
-
var _isDomElement = _interopRequireDefault(require("./is-dom-element"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function processPropertyAsDOMElement({
|
|
15
|
-
prop,
|
|
16
|
-
propName = 'Mounting',
|
|
17
|
-
isRequired = true
|
|
18
|
-
} = {}) {
|
|
19
|
-
let DOMElement;
|
|
20
|
-
|
|
21
|
-
if (typeof prop === 'undefined') {
|
|
22
|
-
throw new Error('processPropertyDOMElement: Missing argument "prop"');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if ((0, _hasValidCssSelector.default)(prop)) {
|
|
26
|
-
DOMElement = document.querySelector(prop);
|
|
27
|
-
} else if ((0, _isDomElement.default)(prop)) {
|
|
28
|
-
DOMElement = prop;
|
|
29
|
-
} else {
|
|
30
|
-
throw new Error(`Please provide a valid CSS class, id or DOM element for "${propName}" property`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (!DOMElement && isRequired) {
|
|
34
|
-
throw new Error(`Could not find DOM element with CSS class or id "${prop}" to mount ${propName}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return DOMElement;
|
|
38
|
-
}
|
package/dist/utils/sleep.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Summary component should render the summary correctly 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
class="rebilly-instruments-summary-line-items"
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<div
|
|
10
|
-
class="rebilly-instruments-summary-line-item"
|
|
11
|
-
>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<div
|
|
16
|
-
class="rebilly-instruments-summary-line-item-synopsis"
|
|
17
|
-
>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<p
|
|
21
|
-
class="rebilly-instruments-summary-line-item-synopsis-title"
|
|
22
|
-
>
|
|
23
|
-
My Awesome Product
|
|
24
|
-
</p>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<p
|
|
29
|
-
class="rebilly-instruments-summary-line-item-synopsis-description"
|
|
30
|
-
>
|
|
31
|
-
My Awesome Product
|
|
32
|
-
</p>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<div
|
|
40
|
-
class="rebilly-instruments-summary-line-item-price-breakdown"
|
|
41
|
-
>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<p
|
|
45
|
-
class="rebilly-instruments-summary-line-item-price-breakdown-quantity"
|
|
46
|
-
>
|
|
47
|
-
1
|
|
48
|
-
</p>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<svg
|
|
52
|
-
class="rebilly-instruments-icon"
|
|
53
|
-
viewBox="0 0 24 24"
|
|
54
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
55
|
-
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<path
|
|
59
|
-
d="M12 10.5858l2.8284-2.8284c.3906-.3906 1.0237-.3906 1.4142 0 .3906.3905.3906 1.0236 0 1.4142L13.4142 12l2.8284 2.8284c.3906.3906.3906 1.0237 0 1.4142-.3905.3906-1.0236.3906-1.4142 0L12 13.4142l-2.8284 2.8284c-.3906.3906-1.0237.3906-1.4142 0-.3906-.3905-.3906-1.0236 0-1.4142L10.5858 12 7.7574 9.1716c-.3906-.3906-.3906-1.0237 0-1.4142.3905-.3906 1.0236-.3906 1.4142 0L12 10.5858z"
|
|
60
|
-
fill-rule="nonzero"
|
|
61
|
-
/>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</svg>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<p
|
|
68
|
-
class="rebilly-instruments-summary-line-item-price-breakdown-unit-price"
|
|
69
|
-
>
|
|
70
|
-
$30.00
|
|
71
|
-
</p>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<div
|
|
83
|
-
class="rebilly-instruments-summary-line-item"
|
|
84
|
-
>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<div
|
|
89
|
-
class="rebilly-instruments-summary-line-item-synopsis"
|
|
90
|
-
>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<p
|
|
94
|
-
class="rebilly-instruments-summary-line-item-synopsis-title"
|
|
95
|
-
>
|
|
96
|
-
My Awesome T-Shirt
|
|
97
|
-
</p>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
<p
|
|
102
|
-
class="rebilly-instruments-summary-line-item-synopsis-description"
|
|
103
|
-
>
|
|
104
|
-
Awesome T-Shirt
|
|
105
|
-
</p>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<div
|
|
113
|
-
class="rebilly-instruments-summary-line-item-price-breakdown"
|
|
114
|
-
>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<p
|
|
118
|
-
class="rebilly-instruments-summary-line-item-price-breakdown-quantity"
|
|
119
|
-
>
|
|
120
|
-
2
|
|
121
|
-
</p>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<svg
|
|
125
|
-
class="rebilly-instruments-icon"
|
|
126
|
-
viewBox="0 0 24 24"
|
|
127
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
128
|
-
>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<path
|
|
132
|
-
d="M12 10.5858l2.8284-2.8284c.3906-.3906 1.0237-.3906 1.4142 0 .3906.3905.3906 1.0236 0 1.4142L13.4142 12l2.8284 2.8284c.3906.3906.3906 1.0237 0 1.4142-.3905.3906-1.0236.3906-1.4142 0L12 13.4142l-2.8284 2.8284c-.3906.3906-1.0237.3906-1.4142 0-.3906-.3905-.3906-1.0236 0-1.4142L10.5858 12 7.7574 9.1716c-.3906-.3906-.3906-1.0237 0-1.4142.3905-.3906 1.0236-.3906 1.4142 0L12 10.5858z"
|
|
133
|
-
fill-rule="nonzero"
|
|
134
|
-
/>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
</svg>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<p
|
|
141
|
-
class="rebilly-instruments-summary-line-item-price-breakdown-unit-price"
|
|
142
|
-
>
|
|
143
|
-
$20.00
|
|
144
|
-
</p>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
</div>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
</div>
|
|
154
|
-
`;
|
|
155
|
-
|
|
156
|
-
exports[`Summary component should render the summary correctly 2`] = `
|
|
157
|
-
<div
|
|
158
|
-
class="rebilly-instruments-summary-breakdown"
|
|
159
|
-
>
|
|
160
|
-
<table>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<colgroup>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<col />
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
<col />
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
</colgroup>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<tr
|
|
176
|
-
class="rebilly-instruments-summary-breakdown-sub-total"
|
|
177
|
-
>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
<td
|
|
181
|
-
data-rebilly-i18n="summary.subTotal"
|
|
182
|
-
>
|
|
183
|
-
Sub Total
|
|
184
|
-
</td>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<td>
|
|
188
|
-
$70.00
|
|
189
|
-
</td>
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
</tr>
|
|
193
|
-
<tr
|
|
194
|
-
class="rebilly-instruments-summary-breakdown-taxes"
|
|
195
|
-
>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<td
|
|
199
|
-
data-rebilly-i18n="summary.taxes"
|
|
200
|
-
>
|
|
201
|
-
Taxes
|
|
202
|
-
</td>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
<td>
|
|
206
|
-
$0.00
|
|
207
|
-
</td>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
</tr>
|
|
211
|
-
</table>
|
|
212
|
-
<div
|
|
213
|
-
class="rebilly-instruments-summary-breakdown-total"
|
|
214
|
-
>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<p
|
|
218
|
-
data-rebilly-i18n="summary.total"
|
|
219
|
-
>
|
|
220
|
-
Total
|
|
221
|
-
</p>
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
<p
|
|
225
|
-
class="rebilly-instruments-summary-breakdown-total-amount"
|
|
226
|
-
>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
<span
|
|
230
|
-
class="rebilly-instruments-summary-breakdown-total-amount-currency"
|
|
231
|
-
>
|
|
232
|
-
|
|
233
|
-
USD
|
|
234
|
-
|
|
235
|
-
</span>
|
|
236
|
-
|
|
237
|
-
$70.00
|
|
238
|
-
|
|
239
|
-
</p>
|
|
240
|
-
<p>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
</p>
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
`;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _popostmate = _interopRequireDefault(require("popostmate"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
class BaseIframe {
|
|
13
|
-
constructor({
|
|
14
|
-
state = {},
|
|
15
|
-
name = '',
|
|
16
|
-
url = '',
|
|
17
|
-
model = {},
|
|
18
|
-
container = null,
|
|
19
|
-
classListArray = []
|
|
20
|
-
} = {}) {
|
|
21
|
-
classListArray = Array.isArray(classListArray) ? classListArray : [];
|
|
22
|
-
|
|
23
|
-
if (!classListArray.includes('rebilly-instruments-iframe')) {
|
|
24
|
-
classListArray.push('rebilly-instruments-iframe');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.state = state;
|
|
28
|
-
this.container = container;
|
|
29
|
-
this.classListArray = classListArray;
|
|
30
|
-
this.name = name;
|
|
31
|
-
this.url = url;
|
|
32
|
-
this.model = model;
|
|
33
|
-
this.component = null;
|
|
34
|
-
return (async () => {
|
|
35
|
-
this.component = await this.createComponent();
|
|
36
|
-
return this;
|
|
37
|
-
})();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async destroy() {
|
|
41
|
-
if (this.component.frame.parentNode) {
|
|
42
|
-
await this.component.destroy();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async createComponent() {
|
|
47
|
-
const component = await new _popostmate.default({
|
|
48
|
-
name: this.name,
|
|
49
|
-
url: this.url,
|
|
50
|
-
container: this.container,
|
|
51
|
-
classListArray: this.classListArray,
|
|
52
|
-
model: this.model
|
|
53
|
-
});
|
|
54
|
-
return component;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
exports.default = BaseIframe;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dispatchRebillyInsturmentEventHandler = dispatchRebillyInsturmentEventHandler;
|
|
7
|
-
exports.resizeComponentHandler = resizeComponentHandler;
|
|
8
|
-
exports.stopLoaderHandler = stopLoaderHandler;
|
|
9
|
-
exports.changeIframeSrcHandler = changeIframeSrcHandler;
|
|
10
|
-
|
|
11
|
-
var _lodash = _interopRequireDefault(require("lodash.camelcase"));
|
|
12
|
-
|
|
13
|
-
var _events = _interopRequireDefault(require("../../../events"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
function dispatchRebillyInsturmentEventHandler(iframe) {
|
|
18
|
-
iframe.component.on(`${iframe.name}-dispatch`, ({
|
|
19
|
-
event,
|
|
20
|
-
detail
|
|
21
|
-
}) => {
|
|
22
|
-
_events.default[(0, _lodash.default)(event).replace(/-/, '')].dispatch(detail);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function resizeComponentHandler(iframe) {
|
|
27
|
-
iframe.component.on(`${iframe.name}-resize-frame`, height => {
|
|
28
|
-
iframe.component.frame.style.height = height;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function stopLoaderHandler(iframe, data = {
|
|
33
|
-
section: 'form'
|
|
34
|
-
}) {
|
|
35
|
-
iframe.component.on(`${iframe.name}-stop-loading`, (id = null) => {
|
|
36
|
-
var _data$loader;
|
|
37
|
-
|
|
38
|
-
(_data$loader = data.loader) === null || _data$loader === void 0 ? void 0 : _data$loader.stopLoading({
|
|
39
|
-
section: data.section,
|
|
40
|
-
id: id || data.id
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function changeIframeSrcHandler(iframe) {
|
|
46
|
-
iframe.component.on(`${iframe.name}-change-iframe-src`, (url = null) => {
|
|
47
|
-
iframe.component.frame.src = url;
|
|
48
|
-
iframe.component.frame.style.height = '75vh';
|
|
49
|
-
});
|
|
50
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ModalIframe = exports.ViewIframe = exports.MethodIframe = void 0;
|
|
7
|
-
|
|
8
|
-
var _methodIframe = require("./method-iframe");
|
|
9
|
-
|
|
10
|
-
var _viewIframe = require("./view-iframe");
|
|
11
|
-
|
|
12
|
-
var _modalIframe = require("./modal-iframe");
|
|
13
|
-
|
|
14
|
-
const MethodIframe = _methodIframe.MethodIframe;
|
|
15
|
-
exports.MethodIframe = MethodIframe;
|
|
16
|
-
const ViewIframe = _viewIframe.ViewIframe;
|
|
17
|
-
exports.ViewIframe = ViewIframe;
|
|
18
|
-
const ModalIframe = _modalIframe.ModalIframe;
|
|
19
|
-
exports.ModalIframe = ModalIframe;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MethodIframe = void 0;
|
|
7
|
-
|
|
8
|
-
var _baseIframe = _interopRequireDefault(require("./base-iframe"));
|
|
9
|
-
|
|
10
|
-
var _eventListeners = require("./event-listeners");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
class MethodIframe extends _baseIframe.default {
|
|
15
|
-
constructor(args = {}) {
|
|
16
|
-
super(args);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
bindEventListeners({
|
|
20
|
-
loader,
|
|
21
|
-
id
|
|
22
|
-
} = {}) {
|
|
23
|
-
(0, _eventListeners.dispatchRebillyInsturmentEventHandler)(this);
|
|
24
|
-
(0, _eventListeners.resizeComponentHandler)(this);
|
|
25
|
-
(0, _eventListeners.stopLoaderHandler)(this, {
|
|
26
|
-
loader,
|
|
27
|
-
id
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
exports.MethodIframe = MethodIframe;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ModalIframe = void 0;
|
|
7
|
-
|
|
8
|
-
var _baseIframe = _interopRequireDefault(require("./base-iframe"));
|
|
9
|
-
|
|
10
|
-
var _eventListeners = require("./event-listeners");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
class ModalIframe extends _baseIframe.default {
|
|
15
|
-
constructor(args = {}) {
|
|
16
|
-
super(args);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
bindEventListeners({
|
|
20
|
-
close = () => {},
|
|
21
|
-
loader
|
|
22
|
-
} = {}) {
|
|
23
|
-
(0, _eventListeners.dispatchRebillyInsturmentEventHandler)(this);
|
|
24
|
-
(0, _eventListeners.resizeComponentHandler)(this);
|
|
25
|
-
(0, _eventListeners.changeIframeSrcHandler)(this);
|
|
26
|
-
(0, _eventListeners.stopLoaderHandler)(this, {
|
|
27
|
-
loader,
|
|
28
|
-
section: 'modal',
|
|
29
|
-
id: 'modal-content'
|
|
30
|
-
}); // Close modal via postmate
|
|
31
|
-
|
|
32
|
-
this.component.on(`${this.name}-close`, (...args) => {
|
|
33
|
-
close(...args);
|
|
34
|
-
}); // Close modal via postMessage (specifically during approal url flow)
|
|
35
|
-
|
|
36
|
-
window.addEventListener('message', async event => {
|
|
37
|
-
if (event.data === 'rebilly-instruments-approval-url-close') {
|
|
38
|
-
if (this.state.options.transactionType === 'purchase') {
|
|
39
|
-
var _this$state$data$invo;
|
|
40
|
-
|
|
41
|
-
this.state.storefront.setSessionToken(this.state.data.token);
|
|
42
|
-
const [{
|
|
43
|
-
fields: transaction
|
|
44
|
-
}, {
|
|
45
|
-
fields: invoice
|
|
46
|
-
}] = await Promise.all([this.state.storefront.transactions.get({
|
|
47
|
-
id: this.state.data.transaction.id
|
|
48
|
-
}), (_this$state$data$invo = this.state.data.invoice) !== null && _this$state$data$invo !== void 0 && _this$state$data$invo.id ? this.state.storefront.invoices.get({
|
|
49
|
-
id: this.state.data.invoice.id
|
|
50
|
-
}) : {
|
|
51
|
-
fields: null
|
|
52
|
-
}]);
|
|
53
|
-
const updatedPurchase = {
|
|
54
|
-
orderId: this.state.data.orderId,
|
|
55
|
-
token: this.state.data.token,
|
|
56
|
-
transaction
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
if (invoice) {
|
|
60
|
-
updatedPurchase.invoice = invoice;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
close(updatedPurchase);
|
|
64
|
-
} else if (this.state.options.transactionType === 'setup') {
|
|
65
|
-
this.state.storefront.setSessionToken(this.state.data.instrument.token);
|
|
66
|
-
const {
|
|
67
|
-
fields: transaction
|
|
68
|
-
} = await this.state.storefront.transactions.get({
|
|
69
|
-
id: this.state.data.transaction.id
|
|
70
|
-
});
|
|
71
|
-
close({
|
|
72
|
-
transaction,
|
|
73
|
-
instrument: this.state.data.instrument
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
close();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, false);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
exports.ModalIframe = ModalIframe;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ViewIframe = void 0;
|
|
7
|
-
|
|
8
|
-
var _baseIframe = _interopRequireDefault(require("./base-iframe"));
|
|
9
|
-
|
|
10
|
-
var _eventListeners = require("./event-listeners");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
class ViewIframe extends _baseIframe.default {
|
|
15
|
-
constructor(args = {}) {
|
|
16
|
-
super(args);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
bindEventListeners({
|
|
20
|
-
loader
|
|
21
|
-
} = {}) {
|
|
22
|
-
(0, _eventListeners.dispatchRebillyInsturmentEventHandler)(this);
|
|
23
|
-
(0, _eventListeners.resizeComponentHandler)(this);
|
|
24
|
-
(0, _eventListeners.stopLoaderHandler)(this, {
|
|
25
|
-
loader
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.ViewIframe = ViewIframe;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.replaceContent = replaceContent;
|
|
7
|
-
|
|
8
|
-
function replaceContent(form, newContent) {
|
|
9
|
-
const contentElement = form.querySelector('.rebilly-instruments-content');
|
|
10
|
-
contentElement.innerHTML = newContent;
|
|
11
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mountConfirmation = mountConfirmation;
|
|
7
|
-
exports.baseConfirmationHTML = void 0;
|
|
8
|
-
|
|
9
|
-
var _purchase = require("../functions/purchase");
|
|
10
|
-
|
|
11
|
-
var _setup = require("../functions/setup");
|
|
12
|
-
|
|
13
|
-
var _iframe = require("./common/iframe");
|
|
14
|
-
|
|
15
|
-
var _renderUtilities = require("./common/render-utilities");
|
|
16
|
-
|
|
17
|
-
var _methodSelector = require("./method-selector");
|
|
18
|
-
|
|
19
|
-
var _summary = require("./summary");
|
|
20
|
-
|
|
21
|
-
const baseConfirmationHTML = '<div class="rebilly-instruments-confirmation"></div>';
|
|
22
|
-
exports.baseConfirmationHTML = baseConfirmationHTML;
|
|
23
|
-
|
|
24
|
-
async function mountConfirmation({
|
|
25
|
-
payload: instrument,
|
|
26
|
-
state
|
|
27
|
-
}) {
|
|
28
|
-
if (instrument.billingAddress && state.summary && state.data.isPurchase) {
|
|
29
|
-
(0, _summary.updateSummary)({
|
|
30
|
-
state,
|
|
31
|
-
instrument
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
(0, _renderUtilities.replaceContent)(state.form, baseConfirmationHTML);
|
|
36
|
-
state.loader.startLoading({
|
|
37
|
-
id: 'confirmation'
|
|
38
|
-
});
|
|
39
|
-
const container = document.querySelector('.rebilly-instruments-confirmation');
|
|
40
|
-
const {
|
|
41
|
-
paymentMethodsUrl
|
|
42
|
-
} = state.options._computed;
|
|
43
|
-
const model = {
|
|
44
|
-
options: state.options,
|
|
45
|
-
mainStyle: state.mainStyle,
|
|
46
|
-
instrument
|
|
47
|
-
};
|
|
48
|
-
const name = 'rebilly-instruments-confirmation';
|
|
49
|
-
const iframe = await new _iframe.ViewIframe({
|
|
50
|
-
name,
|
|
51
|
-
url: `${paymentMethodsUrl}/confirmation`,
|
|
52
|
-
container,
|
|
53
|
-
model
|
|
54
|
-
});
|
|
55
|
-
iframe.bindEventListeners({
|
|
56
|
-
loader: state.loader
|
|
57
|
-
});
|
|
58
|
-
iframe.component.on(`${name}-confirm-purchase`, confirmedInstrument => {
|
|
59
|
-
(0, _purchase.purchase)({
|
|
60
|
-
state,
|
|
61
|
-
payload: confirmedInstrument
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
iframe.component.on(`${name}-confirm-setup`, confirmedInstrument => {
|
|
65
|
-
(0, _setup.setup)({
|
|
66
|
-
state,
|
|
67
|
-
payload: confirmedInstrument
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
iframe.component.on('choose-another-method', () => {
|
|
71
|
-
state.iframeComponents = state.iframeComponents.filter(item => {
|
|
72
|
-
if (item.name === iframe.name) {
|
|
73
|
-
item.destroy();
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
if (state.data.isPurchase) {
|
|
81
|
-
(0, _summary.updateSummary)({
|
|
82
|
-
state
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
(0, _methodSelector.updateMethodSelector)({
|
|
87
|
-
state,
|
|
88
|
-
mainStyle: state.mainStyle
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
state.iframeComponents.push(iframe);
|
|
92
|
-
}
|