@rebilly/instruments 1.0.1-beta → 1.0.2-beta.10
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/.babelrc +23 -5
- package/.eslintrc.js +27 -0
- package/.prettierrc.js +11 -0
- package/CONTRIBUTING.md +4 -0
- package/README.md +361 -2
- package/dist/events/base-event.js +51 -37
- package/dist/events/events.spec.js +18 -0
- package/dist/events/index.js +11 -8
- package/dist/functions/destroy.js +27 -5
- package/dist/functions/destroy.spec.js +69 -0
- package/dist/functions/initialize.js +60 -41
- package/dist/functions/initialize.spec.js +13 -13
- package/dist/functions/mount/fetch-summary-data.js +46 -0
- package/dist/functions/mount/fetch-summary-data.spec.js +44 -0
- package/dist/functions/mount/index.js +346 -0
- package/dist/functions/mount/mount.spec.js +135 -0
- package/dist/functions/on.js +26 -18
- package/dist/functions/on.spec.js +45 -63
- package/dist/functions/purchase.js +41 -154
- package/dist/functions/purchase.spec.js +60 -76
- package/dist/functions/show.js +39 -43
- package/dist/functions/show.spec.js +57 -0
- package/dist/functions/update.js +60 -5
- package/dist/functions/update.spec.js +100 -0
- package/dist/i18n/en.json +19 -0
- package/dist/i18n/es.json +19 -0
- package/dist/i18n/i18n.spec.js +6 -23
- package/dist/i18n/index.js +44 -67
- package/dist/index.js +70 -71
- package/dist/index.spec.js +24 -44
- package/dist/loader/index.js +63 -62
- package/dist/loader/loader.spec.js +14 -11
- package/dist/storefront/index.js +28 -39
- package/dist/storefront/models/plan-model.js +37 -54
- package/dist/storefront/models/product-model.js +25 -36
- package/dist/storefront/models/ready-to-pay-model.js +38 -42
- package/dist/storefront/models/summary-model.js +72 -99
- package/dist/storefront/plans.js +37 -84
- package/dist/storefront/plans.spec.js +61 -151
- package/dist/storefront/products.js +35 -83
- package/dist/storefront/products.spec.js +60 -150
- package/dist/storefront/purchase.js +27 -64
- package/dist/storefront/purchase.spec.js +51 -87
- package/dist/storefront/ready-to-pay.js +45 -107
- package/dist/storefront/ready-to-pay.spec.js +72 -147
- package/dist/storefront/storefront.spec.js +6 -6
- package/dist/storefront/summary.js +37 -84
- package/dist/storefront/summary.spec.js +135 -240
- package/dist/style/base/__snapshots__/theme.spec.js.snap +52 -0
- package/dist/style/base/index.js +72 -0
- package/dist/style/base/theme.js +73 -0
- package/dist/style/base/theme.spec.js +30 -0
- package/dist/style/browserslist.js +8 -0
- package/dist/style/components/address.js +64 -0
- package/dist/style/components/button.js +61 -0
- package/dist/style/components/divider.js +48 -0
- package/dist/style/components/forms/checkbox.js +83 -0
- package/dist/style/components/forms/field.js +53 -0
- package/dist/style/components/forms/form.js +28 -0
- package/dist/style/components/forms/input.js +45 -0
- package/dist/style/components/forms/label.js +43 -0
- package/dist/style/components/forms/select.js +63 -0
- package/dist/style/components/forms/validation.js +34 -0
- package/dist/style/components/icons.js +22 -0
- package/dist/style/components/index.js +57 -0
- package/dist/style/components/loader.js +48 -0
- package/dist/style/components/methods.js +104 -0
- package/dist/style/components/overlay.js +33 -0
- package/dist/style/helpers/index.js +59 -0
- package/dist/style/index.js +48 -0
- package/dist/style/payment-instruments/content.js +17 -0
- package/dist/style/payment-instruments/index.js +20 -0
- package/dist/style/payment-instruments/payment-card.js +35 -0
- package/dist/style/utils/color-values.js +22 -0
- package/dist/style/vendor/framepay.js +34 -0
- package/dist/style/vendor/postmate.js +17 -0
- package/dist/style/views/confirmation.js +85 -0
- package/dist/style/views/index.js +29 -0
- package/dist/style/views/method-selector.js +20 -0
- package/dist/style/views/modal.js +93 -0
- package/dist/style/views/result.js +61 -0
- package/dist/style/views/summary.js +123 -0
- package/dist/utils/add-dom-element.js +12 -34
- package/dist/utils/format-currency.js +4 -4
- package/dist/utils/has-valid-css-selector.js +2 -2
- package/dist/utils/index.js +15 -31
- package/dist/utils/is-dom-element.js +1 -1
- package/dist/utils/process-property-as-dom-element.js +12 -17
- package/dist/utils/sleep.js +10 -0
- package/{src/components → dist/views}/__snapshots__/summary.spec.js.snap +7 -3
- package/dist/views/common/iframe/base-iframe.js +57 -0
- package/dist/views/common/iframe/event-listeners.js +50 -0
- package/dist/views/common/iframe/index.js +19 -0
- package/dist/views/common/iframe/method-iframe.js +33 -0
- package/dist/views/common/iframe/modal-iframe.js +38 -0
- package/dist/views/common/iframe/view-iframe.js +31 -0
- package/dist/views/common/render-utilities.js +11 -0
- package/dist/views/confirmation.js +82 -0
- package/dist/views/method-selector/__snapshots__/method-selector.spec.js.snap +3 -0
- package/dist/views/method-selector/express-methods/apple-pay.js +92 -0
- package/dist/views/method-selector/express-methods/google-pay.js +32 -0
- package/dist/views/method-selector/express-methods/paypal.js +19 -0
- package/dist/views/method-selector/generate-digital-wallet.js +59 -0
- package/dist/views/method-selector/generate-digital-wallet.spec.js +132 -0
- package/dist/views/method-selector/get-method-data.js +25 -0
- package/dist/views/method-selector/get-payment-methods.js +55 -0
- package/dist/views/method-selector/get-payment-methods.spec.js +44 -0
- package/dist/views/method-selector/index.js +133 -0
- package/dist/views/method-selector/method-selector.spec.js +139 -0
- package/dist/views/method-selector/mount-express-methods.js +69 -0
- package/dist/views/method-selector/mount-methods.js +78 -0
- package/dist/views/modal.js +83 -0
- package/dist/views/result.js +42 -0
- package/dist/views/summary.js +162 -0
- package/dist/views/summary.spec.js +148 -0
- package/package.json +12 -6
- package/src/events/base-event.js +35 -12
- package/src/events/events.spec.js +11 -0
- package/src/events/index.js +12 -6
- package/src/functions/destroy.js +22 -3
- package/src/functions/destroy.spec.js +63 -0
- package/src/functions/initialize.js +43 -20
- package/src/functions/initialize.spec.js +9 -7
- package/src/functions/mount/fetch-summary-data.js +29 -0
- package/src/functions/mount/fetch-summary-data.spec.js +41 -0
- package/src/functions/mount/index.js +312 -0
- package/src/functions/mount/mount.spec.js +171 -0
- package/src/functions/on.js +17 -14
- package/src/functions/on.spec.js +39 -29
- package/src/functions/purchase.js +24 -64
- package/src/functions/purchase.spec.js +19 -17
- package/src/functions/show.js +27 -7
- package/src/functions/show.spec.js +61 -0
- package/src/functions/update.js +50 -3
- package/src/functions/update.spec.js +107 -0
- package/src/i18n/i18n.spec.js +6 -4
- package/src/i18n/index.js +20 -12
- package/src/index.js +43 -49
- package/src/index.spec.js +11 -42
- package/src/loader/index.js +55 -39
- package/src/loader/loader.spec.js +30 -23
- package/src/storefront/index.js +9 -7
- package/src/storefront/models/plan-model.js +1 -1
- package/src/storefront/models/product-model.js +1 -1
- package/src/storefront/models/ready-to-pay-model.js +10 -4
- package/src/storefront/models/summary-model.js +8 -15
- package/src/storefront/plans.js +16 -12
- package/src/storefront/plans.spec.js +29 -37
- package/src/storefront/products.js +16 -12
- package/src/storefront/products.spec.js +28 -39
- package/src/storefront/purchase.js +8 -6
- package/src/storefront/purchase.spec.js +18 -17
- package/src/storefront/ready-to-pay.js +19 -13
- package/src/storefront/ready-to-pay.spec.js +41 -41
- package/src/storefront/storefront.spec.js +1 -1
- package/src/storefront/summary.js +14 -12
- package/src/storefront/summary.spec.js +37 -50
- package/src/style/base/__snapshots__/theme.spec.js.snap +52 -0
- package/src/style/base/index.js +63 -0
- package/src/style/base/theme.js +61 -0
- package/src/style/base/theme.spec.js +32 -0
- package/src/style/browserslist.js +1 -0
- package/src/style/components/address.js +55 -0
- package/src/style/components/button.js +54 -0
- package/src/style/components/divider.js +39 -0
- package/src/style/components/forms/checkbox.js +76 -0
- package/src/style/components/forms/field.js +44 -0
- package/src/style/components/forms/form.js +19 -0
- package/src/style/components/forms/input.js +36 -0
- package/src/style/components/forms/label.js +34 -0
- package/src/style/components/forms/select.js +54 -0
- package/src/style/components/forms/validation.js +25 -0
- package/src/style/components/icons.js +13 -0
- package/src/style/components/index.js +35 -0
- package/src/style/components/loader.js +41 -0
- package/src/style/components/methods.js +93 -0
- package/src/style/components/overlay.js +24 -0
- package/src/style/helpers/index.js +51 -0
- package/src/style/index.js +30 -0
- package/src/style/payment-instruments/content.js +8 -0
- package/src/style/payment-instruments/index.js +10 -0
- package/src/style/payment-instruments/payment-card.js +26 -0
- package/src/style/utils/color-values.js +9 -0
- package/src/style/vendor/framepay.js +25 -0
- package/src/style/vendor/postmate.js +8 -0
- package/src/style/views/confirmation.js +76 -0
- package/src/style/views/index.js +16 -0
- package/src/style/views/method-selector.js +11 -0
- package/src/style/views/modal.js +84 -0
- package/src/style/views/result.js +52 -0
- package/src/style/views/summary.js +114 -0
- package/src/utils/add-dom-element.js +12 -13
- package/src/utils/format-currency.js +4 -1
- package/src/utils/has-valid-css-selector.js +2 -2
- package/src/utils/index.js +2 -6
- package/src/utils/is-dom-element.js +1 -1
- package/src/utils/process-property-as-dom-element.js +27 -24
- package/src/utils/sleep.js +3 -0
- package/src/views/__snapshots__/summary.spec.js.snap +292 -0
- package/src/views/common/iframe/base-iframe.js +46 -0
- package/src/views/common/iframe/event-listeners.js +27 -0
- package/src/views/common/iframe/index.js +7 -0
- package/src/views/common/iframe/method-iframe.js +21 -0
- package/src/views/common/iframe/modal-iframe.js +27 -0
- package/src/views/common/iframe/view-iframe.js +18 -0
- package/src/views/common/render-utilities.js +4 -0
- package/src/views/confirmation.js +57 -0
- package/src/views/method-selector/__snapshots__/method-selector.spec.js.snap +3 -0
- package/src/views/method-selector/express-methods/apple-pay.js +78 -0
- package/src/views/method-selector/express-methods/google-pay.js +25 -0
- package/src/views/method-selector/express-methods/paypal.js +7 -0
- package/src/views/method-selector/generate-digital-wallet.js +44 -0
- package/src/views/method-selector/generate-digital-wallet.spec.js +131 -0
- package/src/{components/form → views/method-selector}/get-method-data.js +9 -5
- package/src/views/method-selector/get-payment-methods.js +40 -0
- package/src/views/method-selector/get-payment-methods.spec.js +40 -0
- package/src/views/method-selector/index.js +110 -0
- package/src/views/method-selector/method-selector.spec.js +146 -0
- package/src/views/method-selector/mount-express-methods.js +53 -0
- package/src/views/method-selector/mount-methods.js +71 -0
- package/src/views/modal.js +84 -0
- package/src/views/result.js +30 -0
- package/src/{components → views}/summary.js +90 -21
- package/src/views/summary.spec.js +170 -0
- package/tests/async-utilities.js +22 -0
- package/tests/mocks/rebilly-instruments-mock.js +105 -7
- package/dist/components/confirmation.js +0 -103
- package/dist/components/form/form.js +0 -110
- package/dist/components/form/form.spec.js +0 -135
- package/dist/components/form/get-method-data.js +0 -21
- package/dist/components/form/get-payment-methods.js +0 -42
- package/dist/components/form/method-selector.js +0 -61
- package/dist/components/form/mount-express-payment-methods.js +0 -102
- package/dist/components/form/process-digital-wallet-options.js +0 -20
- package/dist/components/form/zoid-helpers.js +0 -130
- package/dist/components/result.js +0 -66
- package/dist/components/summary.js +0 -60
- package/dist/components/summary.spec.js +0 -144
- package/dist/events/instrument-ready.js +0 -51
- package/dist/events/purchase-complete.js +0 -51
- package/dist/functions/mount.js +0 -311
- package/dist/functions/mount.spec.js +0 -203
- package/dist/styles/base-styles.js +0 -12
- package/dist/styles/flat-theme-object.js +0 -42
- package/dist/styles/framepay.js +0 -15
- package/dist/styles/main.js +0 -25
- package/dist/styles/payment-card.js +0 -12
- package/dist/styles/shade-tint-values-helper.js +0 -28
- package/dist/styles/style-variables.js +0 -43
- package/dist/utils/camel-case.js +0 -12
- package/dist/utils/kebab-case.js +0 -10
- package/dist/utils/un-kebab-case.js +0 -10
- package/src/components/confirmation.js +0 -77
- package/src/components/form/__snapshots__/form.spec.js.snap +0 -43
- package/src/components/form/form.js +0 -88
- package/src/components/form/form.spec.js +0 -109
- package/src/components/form/get-payment-methods.js +0 -32
- package/src/components/form/method-selector.js +0 -47
- package/src/components/form/mount-express-payment-methods.js +0 -84
- package/src/components/form/process-digital-wallet-options.js +0 -11
- package/src/components/form/zoid-helpers.js +0 -114
- package/src/components/result.js +0 -50
- package/src/components/summary.spec.js +0 -106
- package/src/events/instrument-ready.js +0 -11
- package/src/events/purchase-complete.js +0 -11
- package/src/functions/mount.js +0 -204
- package/src/functions/mount.spec.js +0 -172
- package/src/styles/base-styles.js +0 -741
- package/src/styles/flat-theme-object.js +0 -12
- package/src/styles/framepay.js +0 -30
- package/src/styles/main.js +0 -17
- package/src/styles/payment-card.js +0 -18
- package/src/styles/shade-tint-values-helper.js +0 -13
- package/src/styles/style-variables.js +0 -34
- package/src/utils/camel-case.js +0 -3
- package/src/utils/kebab-case.js +0 -3
- package/src/utils/un-kebab-case.js +0 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.methodSelector = void 0;
|
|
7
|
+
|
|
8
|
+
// -----------------------------------------------------------------------------
|
|
9
|
+
// This file contains all styles related to the selector view.
|
|
10
|
+
// -----------------------------------------------------------------------------
|
|
11
|
+
const methodSelector = theme => `
|
|
12
|
+
/**
|
|
13
|
+
* Method selector
|
|
14
|
+
*/
|
|
15
|
+
.rebilly-instruments-method-selector {
|
|
16
|
+
padding-top: ${theme.space.s};
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
exports.methodSelector = methodSelector;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.modal = void 0;
|
|
7
|
+
|
|
8
|
+
// -----------------------------------------------------------------------------
|
|
9
|
+
// This file contains all styles related to the modal view.
|
|
10
|
+
// -----------------------------------------------------------------------------
|
|
11
|
+
const modal = theme => `
|
|
12
|
+
/**
|
|
13
|
+
* Modal
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
.rebilly-instruments-modal-overlay {
|
|
17
|
+
position: fixed;
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
overflow-x: hidden;
|
|
21
|
+
overflow-y: auto;
|
|
22
|
+
z-index: 1055;
|
|
23
|
+
padding: 30px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
transition: all 0.12s ease-in-out;
|
|
29
|
+
background-color: rgba(0,0,0,0.7);
|
|
30
|
+
opacity: 0
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.rebilly-instruments-modal-overlay.is-visible {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.rebilly-instruments-modal-container {
|
|
38
|
+
transition: all .24s ease-in-out;
|
|
39
|
+
position: relative;
|
|
40
|
+
max-width: 800px;
|
|
41
|
+
min-height: 240px;
|
|
42
|
+
background: ${theme.color.background};
|
|
43
|
+
margin: 50px auto 20px;
|
|
44
|
+
box-shadow: 0 19px 38px rgba(0,0,0,0.20), 0 15px 12px rgba(0,0,0,0.12);
|
|
45
|
+
border-radius: ${theme.borderRadius};
|
|
46
|
+
transform: translateY(-50px);
|
|
47
|
+
opacity: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.rebilly-instruments-modal-container.is-visible {
|
|
51
|
+
transform: translateY(0);
|
|
52
|
+
opacity: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.rebilly-instruments-modal-container.is-redirect {
|
|
56
|
+
max-width: 60vw;
|
|
57
|
+
width: auto;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.rebilly-instruments-modal-content {
|
|
61
|
+
transition: all .15s;
|
|
62
|
+
padding: 20px;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
background-color: ${theme.color.background};
|
|
65
|
+
text-align: center;
|
|
66
|
+
border-radius: ${theme.borderRadius};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.rebilly-instruments-modal-content .rebilly-instruments-iframe {
|
|
70
|
+
transition: all .15s;
|
|
71
|
+
height: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.rebilly-instruments-modal-container.is-redirect .rebilly-instruments-modal-content {
|
|
75
|
+
padding: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.rebilly-instruments-modal-close {
|
|
79
|
+
position: absolute;
|
|
80
|
+
width: 30px;
|
|
81
|
+
height: 30px;
|
|
82
|
+
top: -40px;
|
|
83
|
+
right: 0;
|
|
84
|
+
fill: #ffffff;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.rebilly-instruments-modal-close:hover{
|
|
89
|
+
color: #000;
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
exports.modal = modal;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.result = void 0;
|
|
7
|
+
|
|
8
|
+
// -----------------------------------------------------------------------------
|
|
9
|
+
// This file contains all styles related to the result view.
|
|
10
|
+
// -----------------------------------------------------------------------------
|
|
11
|
+
const result = theme => `
|
|
12
|
+
/**
|
|
13
|
+
* Result
|
|
14
|
+
*/
|
|
15
|
+
.rebilly-instruments-results .rebilly-instruments-h1 {
|
|
16
|
+
text-align: center;
|
|
17
|
+
margin: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.rebilly-instruments-results-icon {
|
|
21
|
+
width: 160px;
|
|
22
|
+
margin: 0 auto ${theme.space.m} auto;
|
|
23
|
+
display: block;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rebilly-instruments-results-icon g {
|
|
27
|
+
stroke: ${theme.color.primary};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rebilly-instruments-results-icon.is-error g {
|
|
31
|
+
stroke: ${theme.color.errorText};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rebilly-instruments-results-icon path {
|
|
35
|
+
stroke-linecap: round;
|
|
36
|
+
stroke-linejoin: round;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.rebilly-instruments-results-icon path.circle {
|
|
40
|
+
stroke-dasharray: 350;
|
|
41
|
+
stroke-dashoffset: 0;
|
|
42
|
+
animation: 0.6s cubic-bezier(1.0, 0.5, 0.8, 1.0) 1 rebillyDashResultIcon;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.rebilly-instruments-results-icon path.mark {
|
|
46
|
+
stroke-dasharray: 350;
|
|
47
|
+
stroke-dashoffset: 0;
|
|
48
|
+
animation: 1s cubic-bezier(1.0, 0.5, 0.8, 1.0) 1 rebillyDashResultIcon;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@keyframes rebillyDashResultIcon {
|
|
52
|
+
from {
|
|
53
|
+
stroke-dashoffset: 350;
|
|
54
|
+
}
|
|
55
|
+
to {
|
|
56
|
+
stroke-dashoffset: 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
exports.result = result;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.summary = void 0;
|
|
7
|
+
|
|
8
|
+
// -----------------------------------------------------------------------------
|
|
9
|
+
// This file contains all styles related to the summary view.
|
|
10
|
+
// -----------------------------------------------------------------------------
|
|
11
|
+
const summary = theme => `
|
|
12
|
+
/**
|
|
13
|
+
* Summary
|
|
14
|
+
*/
|
|
15
|
+
.rebilly-instruments-summary-line-item {
|
|
16
|
+
border-bottom: 1px solid ${theme.getComputed.color.mutedBorder};
|
|
17
|
+
padding: ${theme.space.s} 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.rebilly-instruments-summary-line-item:first-child {
|
|
24
|
+
padding-top: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.rebilly-instruments-summary-line-item-figure {
|
|
28
|
+
margin: 0 ${theme.space.s} 0 0;
|
|
29
|
+
flex: 0 0 auto;
|
|
30
|
+
width: 48px;
|
|
31
|
+
height: 48px;
|
|
32
|
+
border-radius: ${theme.borderRadius};
|
|
33
|
+
border: 1px solid ${theme.getComputed.color.mutedBorder};
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.rebilly-instruments-summary-line-item-figure img {
|
|
38
|
+
width: 100%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.rebilly-instruments-summary-line-item-synopsis {
|
|
42
|
+
flex: 1 2 auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.rebilly-instruments-summary-line-item-synopsis-title {
|
|
46
|
+
margin: 0;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.rebilly-instruments-summary-line-item-synopsis-description {
|
|
51
|
+
color: ${theme.getComputed.color.mutedText};
|
|
52
|
+
margin: 0;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
line-height: 14px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.rebilly-instruments-summary-line-item-price-breakdown {
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
align-items: center;
|
|
61
|
+
color: ${theme.getComputed.color.mutedText};
|
|
62
|
+
margin: 0 0 0 ${theme.spaceS};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.rebilly-instruments-summary-line-item-price-breakdown .rebilly-instruments-icon {
|
|
66
|
+
fill: ${theme.getComputed.color.mutedText};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.rebilly-instruments-summary-line-item-price-breakdown-unit-price {
|
|
70
|
+
color: ${theme.color.text};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.rebilly-instruments-summary-breakdown table {
|
|
74
|
+
width: 100%;
|
|
75
|
+
margin: ${theme.space.xs} 0;
|
|
76
|
+
color: inherit;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.rebilly-instruments-summary-breakdown table colgroup col:first-child {
|
|
80
|
+
width: 85%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.rebilly-instruments-summary-breakdown table colgroup col {
|
|
84
|
+
width: 15%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.rebilly-instruments-summary-breakdown table tr td {
|
|
88
|
+
text-align: right;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.rebilly-instruments-summary-breakdown table tr td:first-child {
|
|
92
|
+
padding-right: ${theme.space.s};
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.rebilly-instruments-summary-breakdown-total {
|
|
97
|
+
padding-top: ${theme.space.xs};
|
|
98
|
+
display: flex;
|
|
99
|
+
border-top: 1px solid ${theme.getComputed.color.mutedBorder};
|
|
100
|
+
align-items: center;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.rebilly-instruments-summary-breakdown-total p {
|
|
104
|
+
margin: ${theme.space.s} 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.rebilly-instruments-summary-breakdown-total-amount {
|
|
108
|
+
flex: 1 2 80%;
|
|
109
|
+
font-size: 24px;
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
text-align: right;
|
|
112
|
+
font-weight: bold;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.rebilly-instruments-summary-breakdown-total-amount-currency {
|
|
116
|
+
font-size: ${theme.typography.fontSize};
|
|
117
|
+
font-weight: normal;
|
|
118
|
+
color: ${theme.getComputed.color.mutedText};
|
|
119
|
+
margin-right: ${theme.space.s};
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
exports.summary = summary;
|
|
@@ -3,40 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
|
-
function addDOMElement() {
|
|
21
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
22
|
-
_ref$element = _ref.element,
|
|
23
|
-
element = _ref$element === void 0 ? 'div' : _ref$element,
|
|
24
|
-
_ref$attributes = _ref.attributes,
|
|
25
|
-
attributes = _ref$attributes === void 0 ? {} : _ref$attributes,
|
|
26
|
-
_ref$content = _ref.content,
|
|
27
|
-
content = _ref$content === void 0 ? null : _ref$content,
|
|
28
|
-
_ref$target = _ref.target,
|
|
29
|
-
target = _ref$target === void 0 ? 'body' : _ref$target,
|
|
30
|
-
_ref$insertMethod = _ref.insertMethod,
|
|
31
|
-
insertMethod = _ref$insertMethod === void 0 ? 'append' : _ref$insertMethod;
|
|
32
|
-
|
|
33
|
-
var ELEMENT = document.createElement(element);
|
|
34
|
-
var ELEMENT_ATTRIBUTES = Object.entries(attributes);
|
|
35
|
-
ELEMENT_ATTRIBUTES.forEach(function (_ref2) {
|
|
36
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
37
|
-
attribute = _ref3[0],
|
|
38
|
-
value = _ref3[1];
|
|
39
|
-
|
|
6
|
+
exports.default = addDOMElement;
|
|
7
|
+
|
|
8
|
+
function addDOMElement({
|
|
9
|
+
element = 'div',
|
|
10
|
+
attributes = {},
|
|
11
|
+
content = null,
|
|
12
|
+
target = 'body',
|
|
13
|
+
insertMethod = 'append'
|
|
14
|
+
} = {}) {
|
|
15
|
+
const ELEMENT = document.createElement(element);
|
|
16
|
+
const ELEMENT_ATTRIBUTES = Object.entries(attributes);
|
|
17
|
+
ELEMENT_ATTRIBUTES.forEach(([attribute, value]) => {
|
|
40
18
|
ELEMENT.setAttribute(attribute, value);
|
|
41
19
|
});
|
|
42
20
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = formatCurrency;
|
|
7
7
|
|
|
8
|
-
function formatCurrency(number) {
|
|
9
|
-
|
|
8
|
+
function formatCurrency(number, currency = 'USD') {
|
|
9
|
+
if (!number) return '-';
|
|
10
10
|
return new Intl.NumberFormat('en-US', {
|
|
11
11
|
style: 'currency',
|
|
12
|
-
currency
|
|
12
|
+
currency
|
|
13
13
|
}).format(number);
|
|
14
14
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = hasValidCSSSelector;
|
|
7
7
|
|
|
8
8
|
function hasValidCSSSelector(selector) {
|
|
9
|
-
|
|
9
|
+
const REGEX_CSS_SELECTOR = /([.#][_a-z]+[_a-z0-9-:\\]*)/gi;
|
|
10
10
|
return typeof selector === 'string' && selector.match(REGEX_CSS_SELECTOR);
|
|
11
11
|
}
|
package/dist/utils/index.js
CHANGED
|
@@ -5,50 +5,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "addDOMElement", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
9
|
-
return _addDomElement
|
|
8
|
+
get: function () {
|
|
9
|
+
return _addDomElement.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "processPropertyAsDOMElement", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
15
|
-
return _processPropertyAsDomElement
|
|
14
|
+
get: function () {
|
|
15
|
+
return _processPropertyAsDomElement.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "isDOMElement", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function
|
|
21
|
-
return _isDomElement
|
|
20
|
+
get: function () {
|
|
21
|
+
return _isDomElement.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "hasValidCSSSelector", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function
|
|
27
|
-
return _hasValidCssSelector
|
|
26
|
+
get: function () {
|
|
27
|
+
return _hasValidCssSelector.default;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "formatCurrency", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function
|
|
33
|
-
return _formatCurrency
|
|
32
|
+
get: function () {
|
|
33
|
+
return _formatCurrency.default;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "sleep", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "unKebabCase", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _unKebabCase["default"];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "camelCase", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _camelCase["default"];
|
|
38
|
+
get: function () {
|
|
39
|
+
return _sleep.default;
|
|
52
40
|
}
|
|
53
41
|
});
|
|
54
42
|
|
|
@@ -62,10 +50,6 @@ var _hasValidCssSelector = _interopRequireDefault(require("./has-valid-css-selec
|
|
|
62
50
|
|
|
63
51
|
var _formatCurrency = _interopRequireDefault(require("./format-currency"));
|
|
64
52
|
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
var _unKebabCase = _interopRequireDefault(require("./un-kebab-case"));
|
|
68
|
-
|
|
69
|
-
var _camelCase = _interopRequireDefault(require("./camel-case"));
|
|
53
|
+
var _sleep = _interopRequireDefault(require("./sleep"));
|
|
70
54
|
|
|
71
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
55
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -3,40 +3,35 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = processPropertyAsDOMElement;
|
|
7
7
|
|
|
8
8
|
var _hasValidCssSelector = _interopRequireDefault(require("./has-valid-css-selector"));
|
|
9
9
|
|
|
10
10
|
var _isDomElement = _interopRequireDefault(require("./is-dom-element"));
|
|
11
11
|
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
function processPropertyAsDOMElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired;
|
|
21
|
-
|
|
22
|
-
var DOMElement;
|
|
14
|
+
function processPropertyAsDOMElement({
|
|
15
|
+
prop,
|
|
16
|
+
propName = 'Mounting',
|
|
17
|
+
isRequired = true
|
|
18
|
+
} = {}) {
|
|
19
|
+
let DOMElement;
|
|
23
20
|
|
|
24
21
|
if (typeof prop === 'undefined') {
|
|
25
22
|
throw new Error('processPropertyDOMElement: Missing argument "prop"');
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if ((0, _hasValidCssSelector["default"])(prop)) {
|
|
25
|
+
if ((0, _hasValidCssSelector.default)(prop)) {
|
|
31
26
|
DOMElement = document.querySelector(prop);
|
|
32
|
-
} else if ((0, _isDomElement
|
|
27
|
+
} else if ((0, _isDomElement.default)(prop)) {
|
|
33
28
|
DOMElement = prop;
|
|
34
29
|
} else {
|
|
35
|
-
throw new Error(
|
|
30
|
+
throw new Error(`Please provide a valid CSS class, id or DOM element for "${propName}" property`);
|
|
36
31
|
}
|
|
37
32
|
|
|
38
33
|
if (!DOMElement && isRequired) {
|
|
39
|
-
throw new Error(
|
|
34
|
+
throw new Error(`Could not find DOM element with CSS class or id "${prop}" to mount ${propName}`);
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
return DOMElement;
|
|
@@ -24,12 +24,14 @@ exports[`Summary component should render the summary correctly 1`] = `
|
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
|
|
27
28
|
<p
|
|
28
29
|
class="rebilly-instruments-summary-line-item-synopsis-description"
|
|
29
30
|
>
|
|
30
31
|
My Awesome Product
|
|
31
32
|
</p>
|
|
32
33
|
|
|
34
|
+
|
|
33
35
|
|
|
34
36
|
</div>
|
|
35
37
|
|
|
@@ -94,12 +96,14 @@ exports[`Summary component should render the summary correctly 1`] = `
|
|
|
94
96
|
</p>
|
|
95
97
|
|
|
96
98
|
|
|
99
|
+
|
|
97
100
|
<p
|
|
98
101
|
class="rebilly-instruments-summary-line-item-synopsis-description"
|
|
99
102
|
>
|
|
100
103
|
My Awesome T-Shirt
|
|
101
104
|
</p>
|
|
102
105
|
|
|
106
|
+
|
|
103
107
|
|
|
104
108
|
</div>
|
|
105
109
|
|
|
@@ -203,7 +207,7 @@ exports[`Summary component should render the summary correctly 2`] = `
|
|
|
203
207
|
|
|
204
208
|
|
|
205
209
|
<td>
|
|
206
|
-
|
|
210
|
+
-
|
|
207
211
|
</td>
|
|
208
212
|
|
|
209
213
|
|
|
@@ -223,7 +227,7 @@ exports[`Summary component should render the summary correctly 2`] = `
|
|
|
223
227
|
|
|
224
228
|
|
|
225
229
|
<td>
|
|
226
|
-
|
|
230
|
+
-
|
|
227
231
|
</td>
|
|
228
232
|
|
|
229
233
|
|
|
@@ -243,7 +247,7 @@ exports[`Summary component should render the summary correctly 2`] = `
|
|
|
243
247
|
|
|
244
248
|
|
|
245
249
|
<td>
|
|
246
|
-
|
|
250
|
+
-
|
|
247
251
|
</td>
|
|
248
252
|
|
|
249
253
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _postmate = _interopRequireDefault(require("postmate"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
class BaseIframe {
|
|
13
|
+
constructor({
|
|
14
|
+
name = '',
|
|
15
|
+
url = '',
|
|
16
|
+
model = {},
|
|
17
|
+
container = null,
|
|
18
|
+
classListArray = []
|
|
19
|
+
} = {}) {
|
|
20
|
+
classListArray = Array.isArray(classListArray) ? classListArray : [];
|
|
21
|
+
|
|
22
|
+
if (!classListArray.includes('rebilly-instruments-iframe')) {
|
|
23
|
+
classListArray.push('rebilly-instruments-iframe');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.container = container;
|
|
27
|
+
this.classListArray = classListArray;
|
|
28
|
+
this.name = name;
|
|
29
|
+
this.url = url;
|
|
30
|
+
this.model = model;
|
|
31
|
+
this.component = null;
|
|
32
|
+
return (async () => {
|
|
33
|
+
this.component = await this.createComponent();
|
|
34
|
+
return this;
|
|
35
|
+
})();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async destroy() {
|
|
39
|
+
if (this.component.frame.parentNode) {
|
|
40
|
+
await this.component.destroy();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async createComponent() {
|
|
45
|
+
const component = await new _postmate.default({
|
|
46
|
+
name: this.name,
|
|
47
|
+
url: this.url,
|
|
48
|
+
container: this.container,
|
|
49
|
+
classListArray: this.classListArray,
|
|
50
|
+
model: this.model
|
|
51
|
+
});
|
|
52
|
+
return component;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.default = BaseIframe;
|