@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
|
@@ -28,12 +28,13 @@ export async function fetchReadyToPay({ state, riskMetadata = null }) {
|
|
|
28
28
|
const { fields: readyToPayFields } =
|
|
29
29
|
await state.storefront.purchase.readyToPay({ data });
|
|
30
30
|
|
|
31
|
-
return Object.values(readyToPayFields)
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
return Object.values(readyToPayFields)
|
|
32
|
+
// Remove result for "old" paypal method
|
|
33
|
+
.filter((fields) => !(fields.method === 'paypal' && !fields.feature))
|
|
34
|
+
.map((fields, index) => new ReadyToPayModel({
|
|
34
35
|
index,
|
|
35
36
|
...fields
|
|
36
37
|
})
|
|
37
|
-
|
|
38
|
+
);
|
|
38
39
|
});
|
|
39
40
|
}
|
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
exports[`RebillyInstruments theme builds the theme object 1`] = `
|
|
4
4
|
Object {
|
|
5
5
|
"borderRadius": "4px",
|
|
6
|
+
"buttonActiveBorder": "var(--rebilly-buttonHoverBorder)",
|
|
7
|
+
"buttonActiveBorderRadius": "var(--rebilly-buttonHoverBorderRadius)",
|
|
8
|
+
"buttonActiveBoxShadow": "var(--rebilly-buttonHoverBoxShadow)",
|
|
6
9
|
"buttonActiveColorBackground": "var(--rebilly-buttonHoverColorBackground)",
|
|
10
|
+
"buttonActiveColorText": "var(--rebilly-buttonHoverColorText)",
|
|
11
|
+
"buttonActiveFontFamily": "var(--rebilly-buttonHoverFontFamily)",
|
|
12
|
+
"buttonActiveFontLineHeight": "var(--rebilly-buttonHoverFontLineHeight)",
|
|
13
|
+
"buttonActiveFontSize": "var(--rebilly-buttonHoverFontSize)",
|
|
14
|
+
"buttonActiveFontWeight": "var(--rebilly-buttonHoverFontWeight)",
|
|
7
15
|
"buttonBorder": "1px solid transparent",
|
|
8
16
|
"buttonBorderRadius": "var(--rebilly-borderRadius)",
|
|
9
17
|
"buttonBoxShadow": "none",
|
|
@@ -13,7 +21,15 @@ Object {
|
|
|
13
21
|
"buttonFontLineHeight": "1.5",
|
|
14
22
|
"buttonFontSize": "var(--rebilly-fontSizeBase)",
|
|
15
23
|
"buttonFontWeight": "var(--rebilly-fontWeightBase)",
|
|
24
|
+
"buttonHoverBorder": "1px solid #0036aa",
|
|
25
|
+
"buttonHoverBorderRadius": "var(--rebilly-buttonBorderRadius)",
|
|
26
|
+
"buttonHoverBoxShadow": "var(--rebilly-buttonBoxShadow)",
|
|
16
27
|
"buttonHoverColorBackground": "#0036aa",
|
|
28
|
+
"buttonHoverColorText": "var(--rebilly-buttonColorText)",
|
|
29
|
+
"buttonHoverFontFamily": "var(--rebilly-buttonFontFamily)",
|
|
30
|
+
"buttonHoverFontLineHeight": "var(--rebilly-buttonFontLineHeight)",
|
|
31
|
+
"buttonHoverFontSize": "var(--rebilly-buttonFontSize)",
|
|
32
|
+
"buttonHoverFontWeight": "var(--rebilly-buttonFontWeight)",
|
|
17
33
|
"colorBackground": "#FFFFFF",
|
|
18
34
|
"colorDanger": "#CD5C5C",
|
|
19
35
|
"colorMutedBorder": "rgba(13, 43, 62, 0.25)",
|
|
@@ -45,7 +61,23 @@ Object {
|
|
|
45
61
|
--rebilly-buttonBorderRadius: var(--rebilly-borderRadius);
|
|
46
62
|
--rebilly-buttonBoxShadow: none;
|
|
47
63
|
--rebilly-buttonHoverColorBackground: #0036aa;
|
|
64
|
+
--rebilly-buttonHoverColorText: var(--rebilly-buttonColorText);
|
|
65
|
+
--rebilly-buttonHoverFontFamily: var(--rebilly-buttonFontFamily);
|
|
66
|
+
--rebilly-buttonHoverFontSize: var(--rebilly-buttonFontSize);
|
|
67
|
+
--rebilly-buttonHoverFontLineHeight: var(--rebilly-buttonFontLineHeight);
|
|
68
|
+
--rebilly-buttonHoverFontWeight: var(--rebilly-buttonFontWeight);
|
|
69
|
+
--rebilly-buttonHoverBorder: 1px solid #0036aa;
|
|
70
|
+
--rebilly-buttonHoverBorderRadius: var(--rebilly-buttonBorderRadius);
|
|
71
|
+
--rebilly-buttonHoverBoxShadow: var(--rebilly-buttonBoxShadow);
|
|
48
72
|
--rebilly-buttonActiveColorBackground: var(--rebilly-buttonHoverColorBackground);
|
|
73
|
+
--rebilly-buttonActiveColorText: var(--rebilly-buttonHoverColorText);
|
|
74
|
+
--rebilly-buttonActiveFontFamily: var(--rebilly-buttonHoverFontFamily);
|
|
75
|
+
--rebilly-buttonActiveFontSize: var(--rebilly-buttonHoverFontSize);
|
|
76
|
+
--rebilly-buttonActiveFontLineHeight: var(--rebilly-buttonHoverFontLineHeight);
|
|
77
|
+
--rebilly-buttonActiveFontWeight: var(--rebilly-buttonHoverFontWeight);
|
|
78
|
+
--rebilly-buttonActiveBorder: var(--rebilly-buttonHoverBorder);
|
|
79
|
+
--rebilly-buttonActiveBorderRadius: var(--rebilly-buttonHoverBorderRadius);
|
|
80
|
+
--rebilly-buttonActiveBoxShadow: var(--rebilly-buttonHoverBoxShadow);
|
|
49
81
|
--rebilly-inputColorBackground: transparent;
|
|
50
82
|
--rebilly-inputColorText: var(--rebilly-colorText);
|
|
51
83
|
--rebilly-inputFontFamily: var(--rebilly-fontFamily);
|
|
@@ -79,7 +111,7 @@ Object {
|
|
|
79
111
|
--rebilly-inputPlaceholderFontLineHeight: var(--rebilly-inputFontLineHeight);
|
|
80
112
|
--rebilly-inputPlaceholderFontWeight: var(--rebilly-inputFontWeight);
|
|
81
113
|
--rebilly-inputSelectionColorText: initial;
|
|
82
|
-
--rebilly-inputSelectionColorBackground:
|
|
114
|
+
--rebilly-inputSelectionColorBackground: highlight;
|
|
83
115
|
--rebilly-inputErrorColorBackground: var(--rebilly-inputColorBackground);
|
|
84
116
|
--rebilly-inputErrorColorText: var(--rebilly-colorDanger);
|
|
85
117
|
--rebilly-inputErrorFontFamily: var(--rebilly-inputFontFamily);
|
|
@@ -188,7 +220,7 @@ Object {
|
|
|
188
220
|
"inputPlaceholderFontLineHeight": "var(--rebilly-inputFontLineHeight)",
|
|
189
221
|
"inputPlaceholderFontSize": "var(--rebilly-inputFontSize)",
|
|
190
222
|
"inputPlaceholderFontWeight": "var(--rebilly-inputFontWeight)",
|
|
191
|
-
"inputSelectionColorBackground": "
|
|
223
|
+
"inputSelectionColorBackground": "highlight",
|
|
192
224
|
"inputSelectionColorText": "initial",
|
|
193
225
|
"labels": "floating",
|
|
194
226
|
}
|
|
@@ -156,7 +156,7 @@ const properties = {
|
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
158
|
|
|
159
|
-
/** Buttons:
|
|
159
|
+
/** Buttons: Hover */
|
|
160
160
|
buttonHoverColorBackground: {
|
|
161
161
|
fallback: {
|
|
162
162
|
type: 'func',
|
|
@@ -168,13 +168,116 @@ const properties = {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
|
-
|
|
171
|
+
buttonHoverColorText: {
|
|
172
|
+
fallback: {
|
|
173
|
+
type: 'variable',
|
|
174
|
+
value: 'buttonColorText',
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
buttonHoverFontFamily: {
|
|
178
|
+
fallback: {
|
|
179
|
+
type: 'variable',
|
|
180
|
+
value: 'buttonFontFamily',
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
buttonHoverFontSize: {
|
|
184
|
+
fallback: {
|
|
185
|
+
type: 'variable',
|
|
186
|
+
value: 'buttonFontSize',
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
buttonHoverFontLineHeight: {
|
|
190
|
+
fallback: {
|
|
191
|
+
type: 'variable',
|
|
192
|
+
value: 'buttonFontLineHeight',
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
buttonHoverFontWeight: {
|
|
196
|
+
fallback: {
|
|
197
|
+
type: 'variable',
|
|
198
|
+
value: 'buttonFontWeight',
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
buttonHoverBorder: {
|
|
202
|
+
fallback: {
|
|
203
|
+
type: 'func',
|
|
204
|
+
value: theme => {
|
|
205
|
+
if(theme.buttonBorderProvided) {
|
|
206
|
+
return theme.buttonBorder;
|
|
207
|
+
}
|
|
208
|
+
const buttonBorder = new Border(theme.buttonBorder);
|
|
209
|
+
return buttonBorder.updateColor(theme.buttonHoverColorBackground).value;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
buttonHoverBorderRadius: {
|
|
214
|
+
fallback: {
|
|
215
|
+
type: 'variable',
|
|
216
|
+
value: 'buttonBorderRadius',
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
buttonHoverBoxShadow: {
|
|
220
|
+
fallback: {
|
|
221
|
+
type: 'variable',
|
|
222
|
+
value: 'buttonBoxShadow',
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
/** Buttons: Active */
|
|
172
227
|
buttonActiveColorBackground: {
|
|
173
228
|
fallback: {
|
|
174
229
|
type: 'variable',
|
|
175
230
|
value: 'buttonHoverColorBackground',
|
|
176
231
|
}
|
|
177
232
|
},
|
|
233
|
+
buttonActiveColorText: {
|
|
234
|
+
fallback: {
|
|
235
|
+
type: 'variable',
|
|
236
|
+
value: 'buttonHoverColorText',
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
buttonActiveFontFamily: {
|
|
240
|
+
fallback: {
|
|
241
|
+
type: 'variable',
|
|
242
|
+
value: 'buttonHoverFontFamily',
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
buttonActiveFontSize: {
|
|
246
|
+
fallback: {
|
|
247
|
+
type: 'variable',
|
|
248
|
+
value: 'buttonHoverFontSize',
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
buttonActiveFontLineHeight: {
|
|
252
|
+
fallback: {
|
|
253
|
+
type: 'variable',
|
|
254
|
+
value: 'buttonHoverFontLineHeight',
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
buttonActiveFontWeight: {
|
|
258
|
+
fallback: {
|
|
259
|
+
type: 'variable',
|
|
260
|
+
value: 'buttonHoverFontWeight',
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
buttonActiveBorder: {
|
|
264
|
+
fallback: {
|
|
265
|
+
type: 'variable',
|
|
266
|
+
value: 'buttonHoverBorder'
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
buttonActiveBorderRadius: {
|
|
270
|
+
fallback: {
|
|
271
|
+
type: 'variable',
|
|
272
|
+
value: 'buttonHoverBorderRadius',
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
buttonActiveBoxShadow: {
|
|
276
|
+
fallback: {
|
|
277
|
+
type: 'variable',
|
|
278
|
+
value: 'buttonHoverBoxShadow',
|
|
279
|
+
}
|
|
280
|
+
},
|
|
178
281
|
|
|
179
282
|
/** Inputs: Base */
|
|
180
283
|
inputColorBackground: {
|
|
@@ -397,7 +500,7 @@ const properties = {
|
|
|
397
500
|
inputSelectionColorBackground: {
|
|
398
501
|
fallback: {
|
|
399
502
|
type: 'static',
|
|
400
|
-
value: '
|
|
503
|
+
value: 'highlight',
|
|
401
504
|
}
|
|
402
505
|
},
|
|
403
506
|
|
|
@@ -12,7 +12,7 @@ export const button = () => `
|
|
|
12
12
|
padding: var(--rebilly-spacings-button-py) var(--rebilly-spacings-button-px);
|
|
13
13
|
box-sizing: border-box;
|
|
14
14
|
background: var(--rebilly-buttonColorBackground);
|
|
15
|
-
color: var(--rebilly-buttonColorText
|
|
15
|
+
color: var(--rebilly-buttonColorText);
|
|
16
16
|
border-radius: var(--rebilly-buttonBorderRadius);
|
|
17
17
|
font-weight: var(--rebilly-buttonFontWeight);
|
|
18
18
|
border: var(--rebilly-buttonBorder);
|
|
@@ -27,10 +27,26 @@ export const button = () => `
|
|
|
27
27
|
|
|
28
28
|
.rebilly-instruments-button:not([disabled]):hover {
|
|
29
29
|
background: var(--rebilly-buttonHoverColorBackground);
|
|
30
|
+
color: var(--rebilly-buttonHoverColorText);
|
|
31
|
+
font-family: var(--rebilly-buttonHoverFontFamily);
|
|
32
|
+
font-size: var(--rebilly-buttonHoverFontSize);
|
|
33
|
+
line-height: var(--rebilly-buttonHoverFontLineHeight);
|
|
34
|
+
font-weight: var(--rebilly-buttonHoverFontWeight);
|
|
35
|
+
border: var(--rebilly-buttonHoverBorder);
|
|
36
|
+
border-radius: var(--rebilly-buttonHoverBorderRadius);
|
|
37
|
+
box-shadow: var(--rebilly-buttonHoverBoxShadow);
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
.rebilly-instruments-button:not([disabled]):active {
|
|
33
41
|
background: var(--rebilly-buttonActiveColorBackground);
|
|
42
|
+
color: var(--rebilly-buttonActiveColorText);
|
|
43
|
+
font-family: var(--rebilly-buttonActiveFontFamily);
|
|
44
|
+
font-size: var(--rebilly-buttonActiveFontSize);
|
|
45
|
+
line-height: var(--rebilly-buttonActiveFontLineHeight);
|
|
46
|
+
font-weight: var(--rebilly-buttonActiveFontWeight);
|
|
47
|
+
border: var(--rebilly-buttonActiveBorder);
|
|
48
|
+
border-radius: var(--rebilly-buttonActiveBorderRadius);
|
|
49
|
+
box-shadow: var(--rebilly-buttonActiveBoxShadow);
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
.rebilly-instruments-button.rebilly-instruments-button-secondary {
|
|
@@ -42,11 +42,6 @@ export const label = () => `
|
|
|
42
42
|
transform: translateY(-175%) scale(0.875);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.is-floating .rebilly-instruments-form-field-select + .rebilly-instruments-form-field-label {
|
|
46
|
-
font-size: var(--rebilly-fontSizeBase);
|
|
47
|
-
opacity: 0.5;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
45
|
.is-floating .rebilly-instruments-form-field-input:focus + .rebilly-instruments-form-field-label,
|
|
51
46
|
.is-floating .rebilly-instruments-form-field-select:focus + .rebilly-instruments-form-field-label,
|
|
52
47
|
.is-floating .rebilly-instruments-form-field-label.is-active {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export default () => ({
|
|
2
|
+
postcssPlugin: 'postcss-remove-empty-null',
|
|
3
|
+
Once (root) {
|
|
4
|
+
root.walkAtRules(decl => {
|
|
5
|
+
if ((decl.value === '\'\'' || decl.value === '""' || decl.value.includes('null')) && decl.prop !== 'content') {
|
|
6
|
+
decl.remove();
|
|
7
|
+
}
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
|
-
})
|
|
9
|
-
}
|
|
10
|
-
);
|
|
10
|
+
})
|
|
@@ -4,5 +4,18 @@ export const postmateStyle = () => `
|
|
|
4
4
|
width: 100%;
|
|
5
5
|
min-height: var(--rebilly-spacings-form-element-min-height);
|
|
6
6
|
transition: all 0.2s ease;
|
|
7
|
+
transition: width 0s ease;
|
|
8
|
+
transition: height 0s ease;
|
|
9
|
+
transition: position 0s ease;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.rebilly-instruments-iframe-overlay {
|
|
13
|
+
top: -2px;
|
|
14
|
+
left: -2px;
|
|
15
|
+
width: calc(100vw + 2px);
|
|
16
|
+
height: 100vh;
|
|
17
|
+
min-height: calc(100vh + 4px);
|
|
18
|
+
position: fixed;
|
|
19
|
+
z-index: 99999999999999;
|
|
7
20
|
}
|
|
8
21
|
`;
|
|
@@ -25,3 +25,13 @@ export function changeIframeSrcHandler(iframe) {
|
|
|
25
25
|
iframe.component.frame.style.height = '75vh';
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
export function displayOverlay(iframe) {
|
|
30
|
+
iframe.component.on(`${iframe.name}-change-overlay`, (showOverlay = true) => {
|
|
31
|
+
if (showOverlay) {
|
|
32
|
+
iframe.component.frame.classList.add('rebilly-instruments-iframe-overlay');
|
|
33
|
+
} else {
|
|
34
|
+
iframe.component.frame.classList.remove('rebilly-instruments-iframe-overlay');
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -2,7 +2,8 @@ import BaseIframe from './base-iframe';
|
|
|
2
2
|
import {
|
|
3
3
|
dispatchRebillyInsturmentEventHandler,
|
|
4
4
|
resizeComponentHandler,
|
|
5
|
-
stopLoaderHandler
|
|
5
|
+
stopLoaderHandler,
|
|
6
|
+
displayOverlay
|
|
6
7
|
} from './event-listeners';
|
|
7
8
|
|
|
8
9
|
export class MethodIframe extends BaseIframe {
|
|
@@ -17,5 +18,6 @@ export class MethodIframe extends BaseIframe {
|
|
|
17
18
|
loader,
|
|
18
19
|
id
|
|
19
20
|
});
|
|
21
|
+
displayOverlay(this);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { MethodIframe } from '../../common/iframe';
|
|
2
2
|
|
|
3
|
-
export default async function
|
|
3
|
+
export default async function mountExpressMethod({ state, METHOD_ID }) {
|
|
4
4
|
const container = document.querySelector(`.rebilly-instruments-${METHOD_ID}-method`);
|
|
5
5
|
|
|
6
6
|
const { paymentMethodsUrl } = state.options._computed;
|
|
7
7
|
|
|
8
8
|
const model = {
|
|
9
|
-
options: state.options
|
|
9
|
+
options: state.options,
|
|
10
|
+
data: state.data.toPostmatesModel()
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
const iframe = await new MethodIframe({
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import mountGooglePay from './express-methods/google-pay';
|
|
1
|
+
import mountExpressMethod from './express-methods';
|
|
3
2
|
import mountApplePay from './express-methods/apple-pay';
|
|
4
|
-
import mountPaypal from './express-methods/paypal';
|
|
5
3
|
import { getMethodData } from './get-method-data';
|
|
6
4
|
|
|
7
5
|
export function mountExpressMethods({
|
|
@@ -22,16 +20,9 @@ export function mountExpressMethods({
|
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
EXPRESS_METHODS.forEach((expressMethod) => {
|
|
25
|
-
const {
|
|
23
|
+
const { feature } = expressMethod;
|
|
26
24
|
const { METHOD_ID, METHOD_TYPE } = getMethodData(expressMethod);
|
|
27
25
|
|
|
28
|
-
if (feature?.name === 'Google Pay') {
|
|
29
|
-
mountGooglePay({
|
|
30
|
-
state,
|
|
31
|
-
METHOD_ID
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
if (feature?.name === 'Apple Pay') {
|
|
36
27
|
mountApplePay({
|
|
37
28
|
state,
|
|
@@ -40,14 +31,11 @@ export function mountExpressMethods({
|
|
|
40
31
|
EXPRESS_METHODS,
|
|
41
32
|
EXPRESS_METHODS_CONTAINER
|
|
42
33
|
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (method === 'paypal') {
|
|
46
|
-
mountPaypal({
|
|
34
|
+
} else {
|
|
35
|
+
mountExpressMethod({
|
|
47
36
|
state,
|
|
48
|
-
METHOD_ID
|
|
49
|
-
|
|
50
|
-
});
|
|
37
|
+
METHOD_ID
|
|
38
|
+
})
|
|
51
39
|
}
|
|
52
40
|
});
|
|
53
41
|
}
|
package/src/views/result.js
CHANGED
|
@@ -6,6 +6,7 @@ export async function mountResult({ payload, state }) {
|
|
|
6
6
|
replaceContent(state.form, `<div class="${resultContainerClassName}"></div>`);
|
|
7
7
|
|
|
8
8
|
state.loader.startLoading({ id: 'result' });
|
|
9
|
+
state.loader.stopLoading({ id: 'express-purchase' });
|
|
9
10
|
|
|
10
11
|
const container = document.querySelector(`.${resultContainerClassName}`);
|
|
11
12
|
const { paymentMethodsUrl } = state.options._computed;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import RebillyInstrumentsInstance from '@rebilly/instruments';
|
|
2
2
|
import { createFramepayMock } from 'tests/mocks/framepay-mock';
|
|
3
3
|
import { get, ok, post } from 'msw-when-then';
|
|
4
4
|
import { when } from 'tests/msw/server';
|
|
@@ -103,7 +103,7 @@ export async function RenderMockRebillyInstruments(options = {}) {
|
|
|
103
103
|
const framepayMock = createFramepayMock();
|
|
104
104
|
global.Rebilly = framepayMock;
|
|
105
105
|
|
|
106
|
-
const rebillyInstruments =
|
|
106
|
+
const rebillyInstruments = RebillyInstrumentsInstance;
|
|
107
107
|
|
|
108
108
|
document.body.innerHTML = `
|
|
109
109
|
<div class="${mergedOptions.form.replace('.', '')}"></div>
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.registeredListeners = exports.RegisteredListeners = void 0;
|
|
7
|
-
|
|
8
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
|
|
10
|
-
class RegisteredListeners {
|
|
11
|
-
constructor() {
|
|
12
|
-
_defineProperty(this, "_listeners", {});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
add(eventName, callback) {
|
|
16
|
-
document.addEventListener(eventName, callback, false);
|
|
17
|
-
|
|
18
|
-
if (!(eventName in this._listeners)) {
|
|
19
|
-
this._listeners[eventName] = [];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
this._listeners[eventName].push(callback);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
removeAll() {
|
|
26
|
-
Object.keys(this._listeners).forEach(eventName => {
|
|
27
|
-
this._listeners[eventName].forEach(callback => document.removeEventListener(eventName, callback, false));
|
|
28
|
-
});
|
|
29
|
-
this._listeners = {};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
exports.RegisteredListeners = RegisteredListeners;
|
|
35
|
-
const registeredListeners = new RegisteredListeners();
|
|
36
|
-
exports.registeredListeners = registeredListeners;
|
|
37
|
-
|
|
38
|
-
class BaseEvent {
|
|
39
|
-
/**
|
|
40
|
-
* @param {string} name
|
|
41
|
-
*/
|
|
42
|
-
constructor(name) {
|
|
43
|
-
// Using namespaced internal name as a protection mechanism
|
|
44
|
-
const PREFIX = 'rebilly-instruments-';
|
|
45
|
-
this.internalName = PREFIX + name;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
addEventListener(callback) {
|
|
49
|
-
const innerCallback = ({
|
|
50
|
-
detail
|
|
51
|
-
}) => callback(detail);
|
|
52
|
-
|
|
53
|
-
registeredListeners.add(this.internalName, innerCallback);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
dispatch(detail) {
|
|
57
|
-
const event = new CustomEvent(this.internalName, {
|
|
58
|
-
bubbles: true,
|
|
59
|
-
detail
|
|
60
|
-
});
|
|
61
|
-
document.dispatchEvent(event);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
exports.default = BaseEvent;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _lodash = _interopRequireDefault(require("lodash.kebabcase"));
|
|
4
|
-
|
|
5
|
-
var _ = _interopRequireWildcard(require("./"));
|
|
6
|
-
|
|
7
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
8
|
-
|
|
9
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
it('Should export all public event names', async () => {
|
|
14
|
-
Object.keys(_.default).forEach(internalEventName => {
|
|
15
|
-
expect(_.default[internalEventName].internalName).toEqual(`rebilly-instruments-${(0, _lodash.default)(internalEventName)}`);
|
|
16
|
-
expect((0, _lodash.default)(internalEventName) in _.publicEventNames);
|
|
17
|
-
});
|
|
18
|
-
});
|
package/dist/events/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.publicEventNames = exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash.kebabcase"));
|
|
9
|
-
|
|
10
|
-
var _baseEvent = _interopRequireDefault(require("./base-event"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const events = {
|
|
15
|
-
instrumentReady: new _baseEvent.default('instrument-ready'),
|
|
16
|
-
purchaseCompleted: new _baseEvent.default('purchase-completed'),
|
|
17
|
-
setupCompleted: new _baseEvent.default('setup-completed')
|
|
18
|
-
};
|
|
19
|
-
var _default = events;
|
|
20
|
-
exports.default = _default;
|
|
21
|
-
const publicEventNames = Object.keys(events).map(internalName => (0, _lodash.default)(internalName));
|
|
22
|
-
exports.publicEventNames = publicEventNames;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.destroy = destroy;
|
|
7
|
-
|
|
8
|
-
var _rebillyJsSdk = require("rebilly-js-sdk");
|
|
9
|
-
|
|
10
|
-
var _baseEvent = require("../events/base-event");
|
|
11
|
-
|
|
12
|
-
var _utils = require("../utils");
|
|
13
|
-
|
|
14
|
-
async function destroy({
|
|
15
|
-
state
|
|
16
|
-
}) {
|
|
17
|
-
// wait to allow for cancellation to catch any pending api requests
|
|
18
|
-
const sleepMilliseconds = 1000;
|
|
19
|
-
await (0, _utils.sleep)(sleepMilliseconds);
|
|
20
|
-
[...(state.iframeComponents || {})].forEach(iframe => {
|
|
21
|
-
iframe.destroy();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
_baseEvent.registeredListeners.removeAll(document);
|
|
25
|
-
|
|
26
|
-
state.iframeComponents = [];
|
|
27
|
-
state.hasMounted = false;
|
|
28
|
-
state.summary.textContent = '';
|
|
29
|
-
state.form.textContent = '';
|
|
30
|
-
|
|
31
|
-
_rebillyJsSdk.cancellation.cancelAll();
|
|
32
|
-
|
|
33
|
-
state.loader.clearAll();
|
|
34
|
-
}
|