@rebilly/instruments 2.1.1-beta.0 → 3.0.0-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/functions/mount/fetch-data.js +4 -0
- package/dist/functions/mount/index.js +6 -0
- package/dist/functions/mount/mount.spec.js +2 -4
- package/dist/functions/mount/setup-framepay-theme.js +95 -0
- package/dist/functions/mount/setup-options.js +3 -0
- package/dist/i18n/en.json +1 -1
- package/dist/style/base/__snapshots__/theme.spec.js.snap +188 -45
- package/dist/style/base/default-theme.js +699 -0
- package/dist/style/base/index.js +48 -16
- package/dist/style/base/theme.js +16 -49
- package/dist/style/base/theme.spec.js +4 -15
- package/dist/style/components/address.js +3 -3
- package/dist/style/components/button.js +32 -22
- package/dist/style/components/divider.js +9 -9
- package/dist/style/components/forms/checkbox.js +12 -9
- package/dist/style/components/forms/field.js +18 -6
- package/dist/style/components/forms/form.js +2 -2
- package/dist/style/components/forms/input.js +54 -13
- package/dist/style/components/forms/label.js +44 -18
- package/dist/style/components/forms/select.js +54 -22
- package/dist/style/components/forms/validation.js +53 -6
- package/dist/style/components/icons.js +4 -4
- package/dist/style/components/loader.js +5 -3
- package/dist/style/components/methods.js +18 -15
- package/dist/style/components/overlay.js +5 -5
- package/dist/style/helpers/index.js +46 -46
- package/dist/style/index.js +3 -1
- package/dist/style/payment-instruments/payment-card.js +4 -4
- package/dist/style/utils/border.js +47 -0
- package/dist/style/utils/color-values.js +39 -3
- package/dist/style/utils/remove-empty-null.js +20 -0
- package/dist/style/vendor/framepay.js +11 -8
- package/dist/style/vendor/postmate.js +2 -2
- package/dist/style/views/confirmation.js +13 -13
- package/dist/style/views/method-selector.js +2 -2
- package/dist/style/views/modal.js +6 -6
- package/dist/style/views/result.js +4 -4
- package/dist/style/views/summary.js +23 -23
- package/dist/views/__snapshots__/summary.spec.js.snap +4 -40
- package/dist/views/common/iframe/modal-iframe.js +6 -1
- package/dist/views/summary.js +17 -11
- package/package.json +3 -1
- package/src/functions/mount/fetch-data.js +4 -0
- package/src/functions/mount/index.js +2 -0
- package/src/functions/mount/mount.spec.js +3 -5
- package/src/functions/mount/setup-framepay-theme.js +82 -0
- package/src/functions/mount/setup-options.js +3 -0
- package/src/i18n/en.json +1 -1
- package/src/style/base/__snapshots__/theme.spec.js.snap +188 -45
- package/src/style/base/default-theme.js +674 -0
- package/src/style/base/index.js +48 -16
- package/src/style/base/theme.js +17 -47
- package/src/style/base/theme.spec.js +4 -16
- package/src/style/components/address.js +3 -3
- package/src/style/components/button.js +32 -24
- package/src/style/components/divider.js +9 -9
- package/src/style/components/forms/checkbox.js +11 -11
- package/src/style/components/forms/field.js +18 -6
- package/src/style/components/forms/form.js +2 -2
- package/src/style/components/forms/input.js +54 -13
- package/src/style/components/forms/label.js +44 -18
- package/src/style/components/forms/select.js +54 -22
- package/src/style/components/forms/validation.js +53 -6
- package/src/style/components/icons.js +4 -4
- package/src/style/components/loader.js +4 -5
- package/src/style/components/methods.js +18 -15
- package/src/style/components/overlay.js +5 -5
- package/src/style/helpers/index.js +46 -46
- package/src/style/index.js +2 -1
- package/src/style/payment-instruments/payment-card.js +4 -4
- package/src/style/utils/border.js +34 -0
- package/src/style/utils/color-values.js +27 -1
- package/src/style/utils/remove-empty-null.js +10 -0
- package/src/style/vendor/framepay.js +11 -8
- package/src/style/vendor/postmate.js +2 -2
- package/src/style/views/confirmation.js +13 -13
- package/src/style/views/method-selector.js +2 -2
- package/src/style/views/modal.js +6 -6
- package/src/style/views/result.js +4 -4
- package/src/style/views/summary.js +23 -23
- package/src/views/__snapshots__/summary.spec.js.snap +4 -40
- package/src/views/common/iframe/modal-iframe.js +7 -1
- package/src/views/summary.js +17 -11
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
export const framepayStyle = (
|
|
1
|
+
export const framepayStyle = () => `
|
|
2
2
|
.rebilly-instruments-framepay .rebilly-framepay {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
border: 1px solid ${theme.getComputed.color.mutedBorder};
|
|
3
|
+
min-height: var(--rebilly-spacings-form-element-min-height);
|
|
4
|
+
border: var(--rebilly-inputBorder);
|
|
6
5
|
margin-bottom: 0;
|
|
7
|
-
background:
|
|
6
|
+
background: var(--rebilly-inputColorBackground);
|
|
7
|
+
border-radius: var(--rebilly-inputBorderRadius);
|
|
8
|
+
box-shadow: var(--rebilly-inputBoxShadow);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.rebilly-instruments-framepay .rebilly-framepay.rebilly-framepay-focus {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
background: var(--rebilly-inputFocusColorBackground);
|
|
13
|
+
border: var(--rebilly-inputFocusBorder);
|
|
14
|
+
border-radius: var(--rebilly-inputFocusBorderRadius);
|
|
15
|
+
box-shadow: var(--rebilly-inputFocusBoxShadow);
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
.rebilly-instruments-framepay .rebilly-framepay.rebilly-framepay-invalid {
|
|
16
|
-
border:
|
|
19
|
+
border-color: var(--rebilly-colorDanger);
|
|
17
20
|
box-shadow: none;
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const postmateStyle = (
|
|
1
|
+
export const postmateStyle = () => `
|
|
2
2
|
.rebilly-instruments-iframe {
|
|
3
3
|
border: none;
|
|
4
4
|
width: 100%;
|
|
5
|
-
min-height:
|
|
5
|
+
min-height: var(--rebilly-spacings-form-element-min-height);
|
|
6
6
|
transition: all 0.2s ease;
|
|
7
7
|
}
|
|
8
8
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// -----------------------------------------------------------------------------
|
|
2
2
|
// This file contains all styles related to the confirmation view.
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
-
export const confirmation = (
|
|
4
|
+
export const confirmation = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Confirmation
|
|
7
7
|
*/
|
|
@@ -11,8 +11,8 @@ export const confirmation = (theme) => `
|
|
|
11
11
|
|
|
12
12
|
.rebilly-instruments-confirmation-go-back-link {
|
|
13
13
|
display: inline-block;
|
|
14
|
-
margin-bottom:
|
|
15
|
-
margin-left:
|
|
14
|
+
margin-bottom: var(--rebilly-spacings-base);
|
|
15
|
+
margin-left: calc(var(--rebilly-spacings-xs) * -1);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.rebilly-instruments-confirmation-address-title {
|
|
@@ -21,20 +21,20 @@ export const confirmation = (theme) => `
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.rebilly-instruments-confirmation-address-title .rebilly-instruments-link {
|
|
24
|
-
margin-left:
|
|
24
|
+
margin-left: var(--rebilly-spacings-s);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.rebilly-instruments-confirmation-address-actions {
|
|
28
|
-
margin-top:
|
|
28
|
+
margin-top: var(--rebilly-spacings-base);
|
|
29
29
|
display: flex;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.rebilly-instruments-confirmation-address-actions :first-child {
|
|
33
|
-
margin: 0
|
|
33
|
+
margin: 0 var(--rebilly-spacings-xs) 0 0;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.rebilly-instruments-confirmation-address-actions :last-child {
|
|
37
|
-
margin: 0 0 0
|
|
37
|
+
margin: 0 0 0 var(--rebilly-spacings-xs);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.rebilly-instruments-confirmation-payment-method {
|
|
@@ -42,18 +42,18 @@ export const confirmation = (theme) => `
|
|
|
42
42
|
align-items: center;
|
|
43
43
|
justify-content: space-between;
|
|
44
44
|
height: 26px;
|
|
45
|
-
margin: 0 0
|
|
45
|
+
margin: 0 0 var(--rebilly-spacings-l);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.rebilly-instruments-confirmation-payment-method figure {
|
|
49
|
-
margin: 0
|
|
49
|
+
margin: 0 var(--rebilly-spacings-2xs) 0 0;
|
|
50
50
|
height: 26px;
|
|
51
51
|
padding: 0;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.rebilly-instruments-confirmation-payment-method figure img {
|
|
55
55
|
width: 42px;
|
|
56
|
-
border-radius:
|
|
56
|
+
border-radius: 4px;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
.rebilly-instruments-confirmation-payment-method-brand,
|
|
@@ -63,14 +63,14 @@ export const confirmation = (theme) => `
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.rebilly-instruments-confirmation-payment-method-brand {
|
|
66
|
-
margin: 0 0 0
|
|
66
|
+
margin: 0 0 0 var(--rebilly-spacings-s);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.rebilly-instruments-confirmation-payment-method-last4 {
|
|
70
|
-
margin: 0
|
|
70
|
+
margin: 0 var(--rebilly-spacings-s);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.rebilly-instruments-confirmation-payment-method-exp {
|
|
74
|
-
color:
|
|
74
|
+
color: var(--rebilly-colorMutedText);
|
|
75
75
|
}
|
|
76
76
|
`;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// -----------------------------------------------------------------------------
|
|
2
2
|
// This file contains all styles related to the selector view.
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
-
export const methodSelector = (
|
|
4
|
+
export const methodSelector = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Method selector
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-method-selector.has-express-compact {
|
|
9
|
-
padding-top:
|
|
9
|
+
padding-top: var(--rebilly-spacings-s);
|
|
10
10
|
}
|
|
11
11
|
`;
|
package/src/style/views/modal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// -----------------------------------------------------------------------------
|
|
2
2
|
// This file contains all styles related to the modal view.
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
-
export const modal = (
|
|
4
|
+
export const modal = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Modal
|
|
7
7
|
*/
|
|
@@ -31,10 +31,10 @@ export const modal = (theme) => `
|
|
|
31
31
|
transition: all .24s ease-in-out;
|
|
32
32
|
position: relative;
|
|
33
33
|
max-width: 800px;
|
|
34
|
-
background:
|
|
34
|
+
background: var(--rebilly-colorBackground);
|
|
35
35
|
margin: 50px auto 20px;
|
|
36
36
|
box-shadow: 0 19px 38px rgba(0,0,0,0.20), 0 15px 12px rgba(0,0,0,0.12);
|
|
37
|
-
border-radius:
|
|
37
|
+
border-radius: 4px;
|
|
38
38
|
transform: translateY(-50px);
|
|
39
39
|
opacity: 0;
|
|
40
40
|
}
|
|
@@ -53,9 +53,9 @@ export const modal = (theme) => `
|
|
|
53
53
|
transition: all .15s;
|
|
54
54
|
padding: 20px;
|
|
55
55
|
overflow: hidden;
|
|
56
|
-
background-color:
|
|
56
|
+
background-color: var(--rebilly-colorBackground);
|
|
57
57
|
text-align: center;
|
|
58
|
-
border-radius:
|
|
58
|
+
border-radius: 4px;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.rebilly-instruments-modal-content .rebilly-instruments-iframe {
|
|
@@ -74,7 +74,7 @@ export const modal = (theme) => `
|
|
|
74
74
|
height: 30px;
|
|
75
75
|
top: -40px;
|
|
76
76
|
right: 0;
|
|
77
|
-
fill: #
|
|
77
|
+
fill: #FFF;
|
|
78
78
|
cursor: pointer;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// -----------------------------------------------------------------------------
|
|
2
2
|
// This file contains all styles related to the result view.
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
-
export const result = (
|
|
4
|
+
export const result = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Result
|
|
7
7
|
*/
|
|
@@ -12,16 +12,16 @@ export const result = (theme) => `
|
|
|
12
12
|
|
|
13
13
|
.rebilly-instruments-results-icon {
|
|
14
14
|
width: 160px;
|
|
15
|
-
margin: 0 auto
|
|
15
|
+
margin: 0 auto var(--rebilly-spacings-base) auto;
|
|
16
16
|
display: block;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.rebilly-instruments-results-icon g {
|
|
20
|
-
stroke:
|
|
20
|
+
stroke: var(--rebilly-colorPrimary);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.rebilly-instruments-results-icon.is-error g {
|
|
24
|
-
stroke:
|
|
24
|
+
stroke: var(--rebilly-colorDanger);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.rebilly-instruments-results-icon path {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// -----------------------------------------------------------------------------
|
|
2
2
|
// This file contains all styles related to the summary view.
|
|
3
3
|
// -----------------------------------------------------------------------------
|
|
4
|
-
export const summary = (
|
|
4
|
+
export const summary = () => `
|
|
5
5
|
/**
|
|
6
6
|
* Summary
|
|
7
7
|
*/
|
|
8
8
|
.rebilly-instruments-summary-line-item {
|
|
9
|
-
border-bottom: 1px solid
|
|
10
|
-
padding:
|
|
9
|
+
border-bottom: 1px solid var(--rebilly-colorMutedBorder);
|
|
10
|
+
padding: var(--rebilly-spacings-s) 0;
|
|
11
11
|
display: flex;
|
|
12
12
|
align-items: center;
|
|
13
13
|
position: relative;
|
|
@@ -18,12 +18,12 @@ export const summary = (theme) => `
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.rebilly-instruments-summary-line-item-figure {
|
|
21
|
-
margin: 0
|
|
21
|
+
margin: 0 var(--rebilly-spacings-s) 0 0;
|
|
22
22
|
flex: 0 0 auto;
|
|
23
23
|
width: 48px;
|
|
24
24
|
height: 48px;
|
|
25
|
-
border-radius:
|
|
26
|
-
border: 1px solid
|
|
25
|
+
border-radius: var(--rebilly-borderRadius);
|
|
26
|
+
border: 1px solid var(--rebilly-colorMutedBorder);
|
|
27
27
|
overflow: hidden;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -41,31 +41,31 @@ export const summary = (theme) => `
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.rebilly-instruments-summary-line-item-synopsis-description {
|
|
44
|
-
color:
|
|
44
|
+
color: var(--rebilly-colorMutedText);
|
|
45
45
|
margin: 0;
|
|
46
|
-
font-size:
|
|
47
|
-
line-height:
|
|
46
|
+
font-size: calc(var(--rebilly-fontSizeBase) * 0.875);
|
|
47
|
+
line-height: 1;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.rebilly-instruments-summary-line-item-price-breakdown {
|
|
51
51
|
display: flex;
|
|
52
52
|
justify-content: center;
|
|
53
53
|
align-items: center;
|
|
54
|
-
color:
|
|
55
|
-
margin: 0 0 0
|
|
54
|
+
color: var(--rebilly-colorMutedText);
|
|
55
|
+
margin: 0 0 0 var(--rebilly-spacings-s);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
.rebilly-instruments-summary-line-item-price-breakdown .rebilly-instruments-icon {
|
|
59
|
-
fill:
|
|
59
|
+
fill: var(--rebilly-colorMutedText);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
.rebilly-instruments-summary-line-item-price-breakdown-unit-price {
|
|
63
|
-
color:
|
|
63
|
+
color: var(--rebilly-colorText);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.rebilly-instruments-summary-breakdown table {
|
|
67
67
|
width: 100%;
|
|
68
|
-
margin:
|
|
68
|
+
margin: var(--rebilly-spacings-xs) 0;
|
|
69
69
|
color: inherit;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -82,37 +82,37 @@ export const summary = (theme) => `
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
.rebilly-instruments-summary-breakdown table tr td:first-child {
|
|
85
|
-
padding-right:
|
|
85
|
+
padding-right: var(--rebilly-spacings-s);
|
|
86
86
|
font-weight: 500;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
.rebilly-instruments-summary-breakdown table {
|
|
90
|
-
border-bottom: 1px solid
|
|
91
|
-
padding-bottom:
|
|
90
|
+
border-bottom: 1px solid var(--rebilly-colorMutedBorder);
|
|
91
|
+
padding-bottom: var(--rebilly-spacings-xs);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.rebilly-instruments-summary-breakdown-total {
|
|
95
|
-
padding-top:
|
|
95
|
+
padding-top: var(--rebilly-spacings-xs);
|
|
96
96
|
display: flex;
|
|
97
97
|
align-items: center;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
.rebilly-instruments-summary-breakdown-total p {
|
|
101
|
-
margin:
|
|
101
|
+
margin: var(--rebilly-spacings-s) 0;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
.rebilly-instruments-summary-breakdown-total-amount {
|
|
105
105
|
flex: 1 2 80%;
|
|
106
|
-
font-size:
|
|
106
|
+
font-size: calc(var(--rebilly-fontSizeBase) * 1.5);
|
|
107
107
|
font-weight: 500;
|
|
108
108
|
text-align: right;
|
|
109
109
|
font-weight: bold;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
.rebilly-instruments-summary-breakdown-total-amount-currency {
|
|
113
|
-
font-size:
|
|
113
|
+
font-size: var(--rebilly-fontSizeBase);
|
|
114
114
|
font-weight: normal;
|
|
115
|
-
color:
|
|
116
|
-
margin-right:
|
|
115
|
+
color: var(--rebilly-colorMutedText);
|
|
116
|
+
margin-right: var(--rebilly-spacings-s);
|
|
117
117
|
}
|
|
118
118
|
`;
|
|
@@ -176,73 +176,37 @@ exports[`Summary component should render the summary correctly 2`] = `
|
|
|
176
176
|
class="rebilly-instruments-summary-breakdown-sub-total"
|
|
177
177
|
>
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
|
|
180
180
|
<td
|
|
181
181
|
data-rebilly-i18n="summary.subTotal"
|
|
182
182
|
>
|
|
183
183
|
Sub Total
|
|
184
184
|
</td>
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
|
|
187
187
|
<td>
|
|
188
188
|
$70.00
|
|
189
189
|
</td>
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
</tr>
|
|
193
|
-
<tr
|
|
194
|
-
class="rebilly-instruments-summary-breakdown-discounts"
|
|
195
|
-
>
|
|
196
|
-
|
|
197
191
|
|
|
198
|
-
<td
|
|
199
|
-
data-rebilly-i18n="summary.discounts"
|
|
200
|
-
>
|
|
201
|
-
Discounts
|
|
202
|
-
</td>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
<td>
|
|
206
|
-
$0.00
|
|
207
|
-
</td>
|
|
208
|
-
|
|
209
|
-
|
|
210
192
|
</tr>
|
|
211
193
|
<tr
|
|
212
194
|
class="rebilly-instruments-summary-breakdown-taxes"
|
|
213
195
|
>
|
|
214
196
|
|
|
215
|
-
|
|
197
|
+
|
|
216
198
|
<td
|
|
217
199
|
data-rebilly-i18n="summary.taxes"
|
|
218
200
|
>
|
|
219
201
|
Taxes
|
|
220
202
|
</td>
|
|
221
203
|
|
|
222
|
-
|
|
204
|
+
|
|
223
205
|
<td>
|
|
224
206
|
$0.00
|
|
225
207
|
</td>
|
|
226
208
|
|
|
227
|
-
|
|
228
|
-
</tr>
|
|
229
|
-
<tr
|
|
230
|
-
class="rebilly-instruments-summary-breakdown-shipping"
|
|
231
|
-
>
|
|
232
|
-
|
|
233
209
|
|
|
234
|
-
<td
|
|
235
|
-
data-rebilly-i18n="summary.shipping"
|
|
236
|
-
>
|
|
237
|
-
Shipping
|
|
238
|
-
</td>
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
<td>
|
|
242
|
-
$0.00
|
|
243
|
-
</td>
|
|
244
|
-
|
|
245
|
-
|
|
246
210
|
</tr>
|
|
247
211
|
</table>
|
|
248
212
|
<div
|
|
@@ -20,7 +20,13 @@ export class ModalIframe extends BaseIframe {
|
|
|
20
20
|
section: 'modal',
|
|
21
21
|
id: 'modal-content'
|
|
22
22
|
});
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
// Close modal via postmate
|
|
25
|
+
this.component.on(`${this.name}-close`, (...args) => {
|
|
26
|
+
close(...args);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Close modal via postMessage (specifically during approal url flow)
|
|
24
30
|
window.addEventListener('message', async (event) => {
|
|
25
31
|
if(event.data === 'rebilly-instruments-approval-url-close') {
|
|
26
32
|
if (this.state.options.transactionType === 'purchase') {
|
package/src/views/summary.js
CHANGED
|
@@ -76,25 +76,29 @@ export function summaryBreakdownHTML({state, element}) {
|
|
|
76
76
|
label: 'Sub Total',
|
|
77
77
|
class: 'sub-total',
|
|
78
78
|
i18n: 'summary.subTotal',
|
|
79
|
-
value: subtotalAmount
|
|
79
|
+
value: subtotalAmount,
|
|
80
|
+
show: true,
|
|
80
81
|
},
|
|
81
82
|
{
|
|
82
83
|
label: 'Discounts',
|
|
83
84
|
class: 'discounts',
|
|
84
85
|
i18n: 'summary.discounts',
|
|
85
|
-
value: discountsAmount
|
|
86
|
+
value: discountsAmount,
|
|
87
|
+
show: discountsAmount > 0
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
90
|
label: 'Taxes',
|
|
89
91
|
class: 'taxes',
|
|
90
92
|
i18n: 'summary.taxes',
|
|
91
|
-
value: taxAmount
|
|
93
|
+
value: taxAmount,
|
|
94
|
+
show: true,
|
|
92
95
|
},
|
|
93
96
|
{
|
|
94
97
|
label: 'Shipping',
|
|
95
98
|
class: 'shipping',
|
|
96
99
|
i18n: 'summary.shipping',
|
|
97
|
-
value: shippingAmount
|
|
100
|
+
value: shippingAmount,
|
|
101
|
+
show: state.data.isShippingRequired,
|
|
98
102
|
},
|
|
99
103
|
].filter(({value}) => value !== null)
|
|
100
104
|
.forEach(item => {
|
|
@@ -108,13 +112,15 @@ export function summaryBreakdownHTML({state, element}) {
|
|
|
108
112
|
`);
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
if (item.show) {
|
|
116
|
+
const row = document.createElement('tr');
|
|
117
|
+
row.setAttribute('class', `rebilly-instruments-summary-breakdown-${item.class}`)
|
|
118
|
+
row.insertAdjacentHTML('beforeend', `
|
|
119
|
+
<td data-rebilly-i18n="${item.i18n}">${item.label}</td>
|
|
120
|
+
<td>${formatCurrency(item.value, currency)}</td>
|
|
121
|
+
`);
|
|
122
|
+
table.appendChild(row);
|
|
123
|
+
}
|
|
118
124
|
});
|
|
119
125
|
if (table) {
|
|
120
126
|
element.appendChild(table);
|