@rebilly/instruments 3.12.3-beta.0 → 3.13.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.
Files changed (84) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +43 -66
  3. package/dist/index.min.js +43 -66
  4. package/package.json +3 -6
  5. package/src/functions/destroy.js +8 -2
  6. package/src/functions/mount/fetch-data.js +9 -2
  7. package/src/functions/mount/index.js +15 -10
  8. package/src/functions/mount/mount.spec.js +10 -11
  9. package/src/functions/mount/setup-framepay-theme.js +30 -72
  10. package/src/functions/mount/setup-options.js +2 -2
  11. package/src/functions/mount/{setup-styles.js → setup-styles-vars.js} +9 -7
  12. package/src/functions/purchase.js +2 -5
  13. package/src/functions/setup.js +3 -6
  14. package/src/functions/show.js +2 -2
  15. package/src/functions/show.spec.js +4 -4
  16. package/src/functions/update.spec.js +4 -3
  17. package/src/instance.js +4 -1
  18. package/src/loader/index.js +57 -33
  19. package/src/storefront/index.js +2 -5
  20. package/src/storefront/payment-instruments.js +7 -0
  21. package/src/style/base/__snapshots__/theme.spec.js.snap +136 -220
  22. package/src/style/base/default-theme.js +187 -14
  23. package/src/style/base/index.js +487 -79
  24. package/src/style/base/theme.js +3 -4
  25. package/src/style/base/theme.spec.js +2 -3
  26. package/src/style/index.js +4 -24
  27. package/src/style/utils/color-values.js +1 -1
  28. package/src/style/utils/minifyCss.js +14 -0
  29. package/src/views/common/iframe/base-iframe.js +3 -2
  30. package/src/views/common/iframe/event-listeners.js +12 -9
  31. package/src/views/common/iframe/method-iframe.js +3 -1
  32. package/src/views/common/iframe/modal-iframe.js +4 -2
  33. package/src/views/common/iframe/view-iframe.js +3 -1
  34. package/src/views/confirmation.js +12 -7
  35. package/src/views/errors.js +95 -0
  36. package/src/views/method-selector/express-methods.js +51 -0
  37. package/src/views/method-selector/generate-framepay-config.js +54 -0
  38. package/src/views/method-selector/generate-framepay-config.spec.js +195 -0
  39. package/src/views/method-selector/get-payment-methods.js +0 -1
  40. package/src/views/method-selector/index.js +45 -58
  41. package/src/views/method-selector/method-selector.spec.js +1 -1
  42. package/src/views/method-selector/mount-express-methods.js +66 -26
  43. package/src/views/modal.js +1 -1
  44. package/src/views/result.js +3 -3
  45. package/src/views/summary.js +24 -190
  46. package/tests/mocks/storefront-api-mock.js +48 -27
  47. package/src/style/browserslist.js +0 -1
  48. package/src/style/components/accordion.js +0 -140
  49. package/src/style/components/address.js +0 -55
  50. package/src/style/components/button.js +0 -117
  51. package/src/style/components/divider.js +0 -39
  52. package/src/style/components/forms/checkbox.js +0 -75
  53. package/src/style/components/forms/field.js +0 -56
  54. package/src/style/components/forms/form.js +0 -18
  55. package/src/style/components/forms/input.js +0 -77
  56. package/src/style/components/forms/label.js +0 -55
  57. package/src/style/components/forms/radio.js +0 -80
  58. package/src/style/components/forms/select.js +0 -86
  59. package/src/style/components/forms/validation.js +0 -72
  60. package/src/style/components/icons.js +0 -13
  61. package/src/style/components/index.js +0 -39
  62. package/src/style/components/loader.js +0 -41
  63. package/src/style/components/methods.js +0 -97
  64. package/src/style/components/overlay.js +0 -24
  65. package/src/style/helpers/index.js +0 -54
  66. package/src/style/payment-instruments/content.js +0 -8
  67. package/src/style/payment-instruments/index.js +0 -14
  68. package/src/style/payment-instruments/payment-card.js +0 -27
  69. package/src/style/payment-instruments/payment-instrument-list.js +0 -44
  70. package/src/style/payment-instruments/payment-instrument.js +0 -55
  71. package/src/style/utils/remove-empty-null.js +0 -10
  72. package/src/style/vendor/framepay.js +0 -28
  73. package/src/style/vendor/postmate.js +0 -18
  74. package/src/style/views/confirmation.js +0 -26
  75. package/src/style/views/index.js +0 -16
  76. package/src/style/views/method-selector.js +0 -11
  77. package/src/style/views/modal.js +0 -91
  78. package/src/style/views/result.js +0 -52
  79. package/src/style/views/summary.js +0 -118
  80. package/src/views/__snapshots__/summary.spec.js.snap +0 -246
  81. package/src/views/method-selector/express-methods/apple-pay.js +0 -92
  82. package/src/views/method-selector/express-methods/index.js +0 -25
  83. package/src/views/method-selector/mount-methods.js +0 -178
  84. package/src/views/summary.spec.js +0 -145
@@ -1,95 +1,503 @@
1
- export const base = (theme) => `
2
- /* Instruments 'global' variables
3
- ------------------------------------------------------------ */
4
- :root,
5
- #rebilly-instruments-app,
6
- .rebilly-instruments-content,
7
- .rebilly-instruments-loader,
8
- .rebilly-instruments-modal-overlay {
9
- ${theme.cssVars}
10
-
11
- --rebilly-spacings-base: calc(var(--rebilly-fontSizeBase) * 1.5);
12
- --rebilly-spacings-2xs: calc(var(--rebilly-spacings-base) * 0.16667);
13
- --rebilly-spacings-xs: calc(var(--rebilly-spacings-base) * 0.25);
14
- --rebilly-spacings-s: calc(var(--rebilly-spacings-base) * 0.5);
15
- --rebilly-spacings-m: var(--rebilly-spacings-base);
16
- --rebilly-spacings-l: calc(var(--rebilly-spacings-base) * 2);
17
- --rebilly-spacings-xl: calc(var(--rebilly-spacings-base) * 4);
18
- --rebilly-spacings-2xl: calc(var(--rebilly-spacings-base) * 4.6667);
19
-
20
- --rebilly-spacings-input-py: calc(var(--rebilly-spacings-2xs) * 2);
21
- --rebilly-spacings-input-px: calc(var(--rebilly-spacings-s) + var(--rebilly-spacings-2xs));
22
- --rebilly-spacings-label-offset-left: var(--rebilly-spacings-input-px);
23
- --rebilly-spacings-form-element-min-height: calc(var(--rebilly-spacings-base) * 1.83333);
24
- --rebilly-spacings-button-py: var(--rebilly-spacings-input-py);
25
- --rebilly-spacings-button-px: var(--rebilly-spacings-input-px);
26
- }
1
+ export const vars = (theme) => `
2
+ /* Instruments 'global' variables
3
+ ------------------------------------------------------------ */
4
+ :root {
5
+ ${theme.cssVars}
27
6
 
7
+ --rebilly-fontWeight400: 400;
8
+ --rebilly-fontWeight500: 500;
9
+ --rebilly-fontWeight600: 600;
10
+ --rebilly-fontScaleFactor: 1.5;
11
+ --rebilly-fontScaleFactorS: 0.875;
12
+ --rebilly-fontSizeS: calc(var(--rebilly-fontSizeBase) * var(--rebilly-fontScaleFactorS));
13
+ --rebilly-fontLineHeightS: calc(var(--rebilly-fontSizeS) * 1);
28
14
 
29
- /* Base, Typography
30
- ------------------------------------------------------------ */
31
- /* Base setup for top level elements */
32
- .rebilly-instruments-content,
33
- .rebilly-instruments-method-content,
34
- .rebilly-instruments-confirmation,
35
- .rebilly-instruments-results {
36
- color: var(--rebilly-colorText);
37
- background: var(--rebilly-colorBackground);
38
- font-size: var(--rebilly-fontSizeBase);
39
- font-weight: var(--rebilly-fontWeightBase);
40
- line-height: var(--rebilly-fontLineHeightBase, calc(var(--rebilly-fontSizeBase) * 1.5));
41
- font-family: var(--rebilly-fontFamily);
42
- -webkit-font-smoothing: antialiased;
43
- -moz-osx-font-smoothing: grayscale;
44
- text-align: left;
45
- transition: all 200ms;
46
- font-smooth: var(--rebilly-fontSmooth);
47
- }
15
+ --rebilly-fontSizeL: calc(var(--rebilly-fontSizeBase) * var(--rebilly-fontScaleFactor));
16
+ --rebilly-fontLineHeightL: calc(var(--rebilly-fontLineHeightBase) * 2);
17
+ --rebilly-fontMarginTopL: 0;
18
+ --rebilly-fontMarginBottomL: var(--rebilly-fontLineHeightBase);
48
19
 
49
- .rebilly-instruments-link {
50
- color: var(--rebilly-colorPrimary);
51
- cursor: pointer;
52
- }
20
+ --rebilly-spacing2xs: calc(var(--rebilly-fontLineHeightBase) / 6);
21
+ --rebilly-spacingXs: calc(var(--rebilly-fontLineHeightBase) / 4);
22
+ --rebilly-spacingS: calc(var(--rebilly-fontLineHeightBase) / 2);
23
+ --rebilly-spacingM: var(--rebilly-fontLineHeightBase);
24
+ --rebilly-spacingL: calc(var(--rebilly-fontLineHeightBase) * 2);
25
+ --rebilly-spacingXl: calc(var(--rebilly-fontLineHeightBase) * 4);
53
26
 
54
- .rebilly-instruments-link:hover {
55
- text-decoration: none;
56
- }
27
+ --rebilly-spacingFormElementMinHeight: calc(var(--rebilly-spacingM) * 1.83333);
57
28
 
58
- .rebilly-instruments-link .rebilly-instruments-icon {
59
- fill: var(--rebilly-colorPrimary);
60
- }
29
+ --rebilly-summaryLoaderMinHeight: var(--rebilly-fontLineHeightBase);
30
+ --rebilly-methodLoaderMinHeight: calc((4 * var(--rebilly-spacingFormElementMinHeight)) + (2 * var(--rebilly-fontLineHeightBase)) + (2 * var(--rebilly-spacingM)) + var(--rebilly-spacing2xs) + var(--rebilly-fontSizeS) + calc(2 * (var(--rebilly-spacingXs) + var(--rebilly-spacingS))) + var(--rebilly-spacingL));
31
+ }
61
32
 
62
- .rebilly-instruments-link.has-icon-left,
63
- .rebilly-instruments-link.has-icon-right {
64
- display: inline-flex;
65
- }
33
+ /* Views. Method Selector
34
+ ------------------------------------------------------------ */
35
+ .rebilly-instruments-method-selector.has-express-compact {
36
+ padding-top: var(--rebilly-spacingS);
37
+ }
66
38
 
67
- .rebilly-instruments-link.has-icon-left .rebilly-instruments-icon {
68
- margin-right: var(--rebilly-spacings-xs);
39
+ /* Express Methods
40
+ ------------------------------------------------------------ */
41
+ @-webkit-keyframes rebillyExpressShine {
42
+ to {
43
+ background-position-x: -200%;
69
44
  }
70
-
71
- .rebilly-instruments-link.has-icon-right .rebilly-instruments-icon {
72
- margin-left: var(--rebilly-spacings-xs);
45
+ }
46
+ @keyframes rebillyExpressShine {
47
+ to {
48
+ background-position-x: -200%;
73
49
  }
50
+ }
51
+
52
+ .rebilly-instruments-express-methods { padding: 2px; }
53
+
54
+ .rebilly-instruments-express-methods.is-compact {
55
+ border: 1px solid var(--rebilly-colorMutedBorder);
56
+ padding: var(--rebilly-spacingS);
57
+ padding-top: calc(var(--rebilly-spacingXs) + var(--rebilly-spacingS));
58
+ padding-top: calc(var(--rebilly-fontSizeBase) + var(--rebilly-spacing2xs));
59
+ border-radius: var(--rebilly-borderRadius);
60
+ position: relative;
61
+ }
62
+
63
+ .rebilly-instruments-express-methods .rebilly-instruments-iframe {
64
+ display: block;
65
+ margin-bottom: 0;
66
+ height: var(--rebilly-spacingFormElementMinHeight);
67
+ }
68
+
69
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > * {
70
+ border-radius: 6px;
71
+ margin-bottom: var(--rebilly-spacingS);
72
+ background: linear-gradient(110deg, var(--rebilly-colorMutedBorder) 0%, var(--rebilly-colorBackground) 25%, var(--rebilly-colorMutedBorder) 50%);
73
+ background-size: 200% 100%;
74
+ -webkit-animation: 1.5s rebillyExpressShine linear infinite;
75
+ animation: 1.5s rebillyExpressShine linear infinite;
76
+ height: 44px;
77
+ }
78
+
79
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > *:last-child {
80
+ margin: 0;
81
+ }
82
+
83
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container {
84
+ display: -webkit-box;
85
+ display: -ms-flexbox;
86
+ display: flex;
87
+ -webkit-box-pack: center;
88
+ -ms-flex-pack: center;
89
+ justify-content: center;
90
+ }
91
+
92
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
93
+ -webkit-box-flex: 1;
94
+ -ms-flex: 1 1 0px;
95
+ flex: 1 1 0px;
96
+ max-width: 260px;
97
+ margin: 0 var(--rebilly-spacingXs);
98
+ }
99
+
100
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:first-child {
101
+ margin-left: 0;
102
+ }
74
103
 
75
- /* Typography */
76
- .rebilly-instruments-h1,
77
- .rebilly-instruments-h2 {
78
- font-weight: var(--rebilly-headingFontWeight);
79
- font-family: var(--rebilly-headingFontFamily);
80
- color: var(--rebilly-headingColorText);
104
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
105
+ margin-right: 0;
106
+ }
107
+
108
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-label {
109
+ display: none;
110
+ }
111
+
112
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-label {
113
+ position: absolute;
114
+ font-family: var(--rebilly-fontFamily);
115
+ top: 0; left: 50%;
116
+ -webkit-transform: translateX(-50%) translateY(-50%);
117
+ transform: translateX(-50%) translateY(-50%);
118
+ color: var(--rebilly-colorText);
119
+ padding: var(--rebilly-spacing2xs) var(--rebilly-spacingM);
120
+ line-height: 1;
121
+ background: var(--rebilly-colorBackground);
122
+ display: inline-block;
123
+ font-weight: var(--rebilly-fontWeightBase);
124
+ min-height: auto;
125
+ margin: 0;
126
+ white-space: nowrap;
127
+ }
128
+
129
+ @media (max-width: 600px) {
130
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container {
131
+ -webkit-box-orient: vertical;
132
+ -webkit-box-direction: normal;
133
+ -ms-flex-direction: column;
134
+ flex-direction: column;
81
135
  }
82
136
 
83
- .rebilly-instruments-h1 {
84
- font-size: calc(var(--rebilly-fontSizeBase) * 1.5);
85
- line-height: 1.5;
86
- line-height: calc(${theme.fontLineHeightBase} * 1.5);
87
- margin: 0 0 calc(var(--rebilly-spacings-base) * 1.5) 0;
137
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
138
+ max-width: 100%;
139
+ margin: 0 0 var(--rebilly-spacingS);
140
+ }
141
+
142
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
143
+ margin: 0;
88
144
  }
145
+ }
146
+
147
+ /* Components. Divider
148
+ ------------------------------------------------------------ */
149
+ .rebilly-instruments-divider {
150
+ line-height: var(--rebilly-fontLineHeightBase);
151
+ padding: var(--rebilly-spacingM) 0;
152
+ margin: 0;
153
+ position: relative;
154
+ outline: 0;
155
+ border: 0;
156
+ text-align: center;
157
+ font-family: var(--rebilly-fontFamily);
158
+ }
159
+
160
+ .rebilly-instruments-divider-s { padding: var(--rebilly-spacingS) 0; }
161
+ .rebilly-instruments-divider-xs { padding: var(--rebilly-spacingXs) 0; }
162
+
163
+ .rebilly-instruments-divider::before {
164
+ background: var(--rebilly-colorMutedBorder);
165
+ content: '';
166
+ position: absolute;
167
+ left: 0;
168
+ top: 50%;
169
+ width: 100%;
170
+ height: 1px;
171
+ }
172
+
173
+ .rebilly-instruments-divider .rebilly-instruments-divider-label {
174
+ color: var(--rebilly-colorMutedText);
175
+ font-weight: var(--rebilly-fontWeightBase);
176
+ padding: 0 var(--rebilly-spacingM);
177
+ line-height: var(--rebilly-fontLineHeightS);
178
+ background-color: var(--rebilly-colorBackground);
179
+ font-size: var(--rebilly-fontSizeS);
180
+ position: relative;
181
+ display: inline-block;
182
+ }
183
+
184
+ /* Vendor, Postmate
185
+ ------------------------------------------------------------ */
186
+ .rebilly-instruments-iframe {
187
+ border: none;
188
+ width: 100%;
189
+ height: 0;
190
+ padding: 0;
191
+ }
192
+
193
+ .rebilly-instruments-iframe-overlay {
194
+ top: -2px;
195
+ left: -2px;
196
+ width: calc(100vw + 2px);
197
+ height: 100vh;
198
+ min-height: calc(100vh + 4px);
199
+ position: fixed;
200
+ z-index: 99999999999999;
201
+ }
202
+
203
+ /* Views. Modal
204
+ ------------------------------------------------------------ */
205
+ .rebilly-instruments-modal-overlay {
206
+ position: fixed;
207
+ top: 0;
208
+ left: 0;
209
+ overflow-x: hidden;
210
+ overflow-y: auto;
211
+ z-index: 1055;
212
+ padding: 30px;
213
+ width: 100%;
214
+ height: 100%;
215
+ margin: 0;
216
+ padding: 0;
217
+ -webkit-transition: all 0.12s ease-in-out;
218
+ transition: all 0.12s ease-in-out;
219
+ background-color: rgba(0,0,0,0.7);
220
+ opacity: 0
221
+ }
222
+
223
+ .rebilly-instruments-modal-overlay.is-visible {
224
+ opacity: 1;
225
+ }
226
+
227
+ .rebilly-instruments-modal-container {
228
+ -webkit-transition: all .24s ease-in-out;
229
+ transition: all .24s ease-in-out;
230
+ position: relative;
231
+ max-width: 750px;
232
+ background: var(--rebilly-colorBackground);
233
+ margin: 50px auto 20px;
234
+ -webkit-box-shadow: 0 19px 38px rgba(0,0,0,0.20), 0 15px 12px rgba(0,0,0,0.12);
235
+ box-shadow: 0 19px 38px rgba(0,0,0,0.20), 0 15px 12px rgba(0,0,0,0.12);
236
+ border-radius: 4px;
237
+ -webkit-transform: translateY(-50px);
238
+ transform: translateY(-50px);
239
+ opacity: 0;
240
+ }
241
+
242
+ .rebilly-instruments-modal-container.is-visible {
243
+ -webkit-transform: translateY(0);
244
+ transform: translateY(0);
245
+ opacity: 1;
246
+ }
247
+
248
+ .rebilly-instruments-modal-container.is-redirect {
249
+ max-width: 60vw;
250
+ width: auto;
251
+ }
89
252
 
90
- .rebilly-instruments-h2 {
91
- font-size: calc(var(--rebilly-fontSizeBase) * 1.125);
92
- line-height: var(--rebilly-fontLineHeightBase, 1.33);
93
- margin: 0 0 var(--rebilly-spacings-base) 0;
253
+ .rebilly-instruments-modal-content {
254
+ -webkit-transition: all .15s;
255
+ transition: all .15s;
256
+ padding: 20px;
257
+ overflow: hidden;
258
+ background-color: var(--rebilly-colorBackground);
259
+ text-align: center;
260
+ border-radius: 4px;
261
+ }
262
+
263
+ .rebilly-instruments-modal-content .rebilly-instruments-iframe {
264
+ -webkit-transition: all .15s;
265
+ transition: all .15s;
266
+ height: auto;
267
+ min-height: 360px;
268
+ }
269
+
270
+ .rebilly-instruments-modal-container.is-redirect .rebilly-instruments-modal-content {
271
+ padding: 0;
272
+ }
273
+
274
+ .rebilly-instruments-modal-close {
275
+ position: absolute;
276
+ width: 30px;
277
+ height: 30px;
278
+ top: -40px;
279
+ right: 0;
280
+ fill: #FFF;
281
+ cursor: pointer;
282
+ }
283
+
284
+ .rebilly-instruments-modal-close:hover{
285
+ color: #000;
286
+ }
287
+
288
+ @media screen and (max-width: 480px) {
289
+ .rebilly-instruments-modal-container.is-redirect {
290
+ max-width: 96vw;
291
+ margin: 20px auto 20px;
94
292
  }
293
+ }
294
+
295
+ /* Components. Loader
296
+ ------------------------------------------------------------ */
297
+ .rebilly-instruments-loader {
298
+ text-align: left;
299
+ position: absolute;
300
+ top: 0;
301
+ bottom: 0;
302
+ left: 0;
303
+ right: 0;
304
+ display: none;
305
+ background-color: var(--rebilly-colorBackground);
306
+ z-index: 1000;
307
+ -webkit-transition: all 200ms;
308
+ transition: all 200ms;
309
+ border-radius: var(--rebilly-borderRadius);
310
+ }
311
+
312
+ .rebilly-instruments-loader.is-active {
313
+ display: block;
314
+ }
315
+
316
+ /* Type */
317
+ .rebilly-instruments-loader p {
318
+ color: var(--rebilly-colorText);
319
+ display: inline-block;
320
+ margin: 0;
321
+ font-weight: var(--rebilly-fontWeightBase);
322
+ font-size: var(--rebilly-fontSizeBase);
323
+ line-height: var(--rebilly-fontLineHeightBase);
324
+ }
325
+
326
+ .rebilly-instruments-loader small {
327
+ color: var(--rebilly-colorText);
328
+ display: inline-block;
329
+ margin: 0;
330
+ font-size: var(--rebilly-fontSizeS);
331
+ line-height: 1;
332
+ }
333
+
334
+ /* Summary */
335
+ .rebilly-instruments-summary-loader-total p.total {
336
+ font-family: var(--rebilly-fontFamily);
337
+ font-size: var(--rebilly-fontSizeL);
338
+ font-weight: var(--rebilly-headingFontWeight);
339
+ }
340
+
341
+ /* Methods */
342
+ .rebilly-instruments-methods-loader-card-icon {
343
+ width: 32px;
344
+ height: 22px;
345
+ margin-left: var(--rebilly-spacing2xs);
346
+ margin-bottom: var(--rebilly-spacing2xs);
347
+ }
348
+
349
+ .rebilly-instruments-methods-loader-form-fields { margin: calc(var(--rebilly-spacingXs) + var(--rebilly-spacingS)) 0; }
350
+
351
+ /* Spinner */
352
+ .rebilly-instruments-loader-spinner {
353
+ top: 50%;
354
+ left: 50%;
355
+ position: absolute;
356
+ -webkit-transform: translate(-50%, -50%);
357
+ transform: translate(-50%, -50%);
358
+ border: 2px solid transparent;
359
+ border-top: 2px solid var(--rebilly-colorPrimary);
360
+ border-radius: 50%;
361
+ width: var(--rebilly-fontLineHeightBase);
362
+ height: var(--rebilly-fontLineHeightBase);
363
+ margin-top: calc(-1 * var(--rebilly-fontLineHeightBase) / 2);
364
+ margin-left: calc(-1 * var(--rebilly-fontLineHeightBase) / 2);
365
+ -webkit-animation: spin 0.5s ease infinite;
366
+ animation: spin 0.5s ease infinite;
367
+ }
368
+
369
+ @-webkit-keyframes spin {
370
+ 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
371
+ 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
372
+ }
373
+
374
+ @keyframes spin {
375
+ 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
376
+ 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
377
+ }
378
+
379
+ /* Utils */
380
+ .rebilly-instruments-loader-display-flex { display: -webkit-box; display: -ms-flexbox; display: flex; }
381
+ .rebilly-instruments-loader-align-center { -webkit-box-align: center; -ms-flex-align: center; align-items: center; }
382
+ .rebilly-instruments-loader-justify-space-between { -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; }
383
+ .rebilly-instruments-loader-justify-end { -webkit-box-pack: end; -ms-flex-pack: end; justify-content: flex-end; }
384
+
385
+ .is-el-loading {
386
+ position: relative;
387
+ color: transparent!important;
388
+ }
389
+
390
+ .is-el-loading::before {
391
+ position: absolute;
392
+ content: '';
393
+ top: 0;
394
+ bottom: 0;
395
+ left: 0;
396
+ right: 0;
397
+ background: linear-gradient(110deg, var(--rebilly-colorMutedBorder) 0%, var(--rebilly-colorBackground) 25%, var(--rebilly-colorMutedBorder) 50%);
398
+ background-size: 200% 100%;
399
+ -webkit-animation: 1.5s rebillyExpressShine linear infinite;
400
+ animation: 1.5s rebillyExpressShine linear infinite;
401
+ border-radius: var(--rebilly-borderRadius);
402
+ }
403
+
404
+ .rebilly-instruments-loader-form-el {
405
+ width: 100%;
406
+ min-height: var(--rebilly-spacingFormElementMinHeight);
407
+ }
408
+
409
+ .rebilly-instruments-loader-form-label {
410
+ display: -webkit-box;
411
+ display: -ms-flexbox;
412
+ display: flex;
413
+ margin-bottom: var(--rebilly-spacing2xs);
414
+ }
415
+
416
+ .rebilly-instruments-loader-form-el.is-button {
417
+ margin-top: var(--rebilly-spacingL);
418
+ text-align: center;
419
+ font-size: var(--rebilly-buttonFontSize);
420
+ font-family: var(--rebilly-buttonFontFamily);
421
+ line-height: var(--rebilly-buttonFontLineHeight);
422
+ padding: var(--rebilly-spacingS);
423
+ -webkit-box-sizing: border-box;
424
+ box-sizing: border-box;
425
+ background: var(--rebilly-buttonColorBackground);
426
+ color: transparent;
427
+ border-radius: var(--rebilly-buttonBorderRadius);
428
+ font-weight: var(--rebilly-buttonFontWeight);
429
+ border: var(--rebilly-buttonBorder);
430
+ -webkit-box-shadow: var(--rebilly-buttonBoxShadow);
431
+ box-shadow: var(--rebilly-buttonBoxShadow);
432
+ outline: none;
433
+ cursor: not-allowed;
434
+ opacity: 0.6;
435
+ }
436
+
437
+ .rebilly-instruments-methods-loader-card-icon.is-el-loading::before {
438
+ border-radius: calc(var(--rebilly-borderRadius) / 2);
439
+ }
440
+
441
+ /* Error
442
+ ------------------------------------------------------------ */
443
+ .rebilly-instruments-error-card {
444
+ border: 1px solid var(--rebilly-colorDanger);
445
+ border-radius: var(--rebilly-borderRadius);
446
+ text-align: left;
447
+ padding: var(--rebilly-spacingS);
448
+ margin-bottom: var(--rebilly-spacingL);
449
+ }
450
+
451
+ .rebilly-instruments-error-card-header {
452
+ display: -webkit-box;
453
+ display: -ms-flexbox;
454
+ display: flex;
455
+ -webkit-box-align: center;
456
+ -ms-flex-align: center;
457
+ align-items: center;
458
+ -webkit-box-pack: justify;
459
+ -ms-flex-pack: justify;
460
+ justify-content: space-between;
461
+ width: 100%;
462
+ -webkit-box-align: start;
463
+ -ms-flex-align: start;
464
+ align-items: flex-start;
465
+ }
466
+
467
+ .rebilly-instruments-error-card-title {
468
+ font-weight: var(--rebilly-fontWeightBase);
469
+ font-size: var(--rebilly-fontSizeBase);
470
+ line-height: var(--rebilly-fontLineHeightBase);
471
+ font-family: var(--rebilly-headingFontFamily);
472
+ margin: 0 0 var(--rebilly-spacingS);
473
+ color: var(--rebilly-colorDanger);
474
+ }
475
+
476
+ .rebilly-instruments-error-card-close-button {
477
+ cursor: pointer;
478
+ background: transparent;
479
+ border: none;
480
+ padding: 0;
481
+ }
482
+
483
+ .rebilly-instruments-error-card-close-button svg {
484
+ width: var(--rebilly-fontLineHeightBase);
485
+ height: var(--rebilly-fontLineHeightBase);
486
+ fill: var(--rebilly-colorText);
487
+ }
488
+
489
+ .rebilly-instruments-error-card-details {
490
+ padding: 0;
491
+ margin: 0;
492
+ list-style: none;
493
+ }
494
+
495
+ .rebilly-instruments-error-card-details li,
496
+ .rebilly-instruments-error-card-message {
497
+ color: var(--rebilly-colorText);
498
+ margin: 0;
499
+ font-weight: var(--rebilly-fontWeightBase);
500
+ font-size: var(--rebilly-fontSizeBase);
501
+ line-height: var(--rebilly-fontLineHeightBase);
502
+ }
95
503
  `;
@@ -16,15 +16,14 @@ export class Theme {
16
16
 
17
17
  get cssVars() {
18
18
  return Object.keys(this.theme)
19
- .filter(v => !Theme.nonCssProperties.includes(v))
20
- .map(p => `--rebilly-${p}: ${this.theme[p]};`)
21
- .join('\n');
19
+ .filter(v => !Theme.nonCssProperties.includes(v))
20
+ .map((p, i) => `${!i ? '' : ' '}--rebilly-${p}: ${this.theme[p]};`)
21
+ .join('\n');
22
22
  }
23
23
 
24
24
  build() {
25
25
  this.overrideTheme();
26
26
  return {
27
- ...this.theme,
28
27
  cssVars: this.cssVars
29
28
  }
30
29
  }
@@ -13,8 +13,7 @@ describe('RebillyInstruments theme', () => {
13
13
  buttonBorderRadius: '30px'
14
14
  };
15
15
  const theme = new Theme(overrides).build();
16
-
17
- expect(theme.colorPrimary).toEqual('red');
18
- expect(theme.buttonBorderRadius).toEqual('30px');
16
+ expect(theme.cssVars).toMatch('--rebilly-colorPrimary: red;');
17
+ expect(theme.cssVars).toMatch('--rebilly-buttonBorderRadius: 30px;');
19
18
  });
20
19
  });
@@ -1,31 +1,11 @@
1
- import postcss from 'postcss';
2
- import autoprefixer from 'autoprefixer';
3
- import { browserslist } from './browserslist';
4
- import removeEmptyAndNull from './utils/remove-empty-null';
5
-
6
1
  import { Theme } from './base/theme';
7
- import { base } from './base';
8
- import { framepayStyle } from './vendor/framepay';
9
- import { postmateStyle } from './vendor/postmate';
10
- import { components } from './components';
11
- import { paymentInstruments } from './payment-instruments';
12
- import { views } from './views';
13
- import { helpers } from './helpers';
2
+ import { vars } from './base';
14
3
 
15
- export const mainStyle = async (themeOverride) => {
4
+ export const mainStyleVars = (themeOverride) => {
16
5
  const resolvedTheme = new Theme(themeOverride).build();
17
-
18
6
  const style = `
19
- ${base(resolvedTheme)}
20
- ${components(resolvedTheme)}
21
- ${views(resolvedTheme)}
22
- ${paymentInstruments(resolvedTheme)}
23
- ${framepayStyle(resolvedTheme)}
24
- ${postmateStyle(resolvedTheme)}
25
- ${helpers(resolvedTheme)}
7
+ ${vars(resolvedTheme)}
26
8
  `;
27
9
 
28
- return postcss([removeEmptyAndNull, autoprefixer(browserslist)])
29
- .process(style, { from: undefined })
30
- .then((result) => result.css);
10
+ return style;
31
11
  };
@@ -12,7 +12,7 @@ export function alphaColor(color, alphaValue = 1) {
12
12
  return _alphaColor.rgbString();
13
13
  }
14
14
 
15
- export const mutedTextColor = (color) => alphaColor(color, 0.6);
15
+ export const mutedTextColor = (color) => alphaColor(color, 0.5);
16
16
 
17
17
  export const mutedBorderColor = (color) => alphaColor(color, 0.25);
18
18
 
@@ -0,0 +1,14 @@
1
+ export function minifyCss(_content) {
2
+ let content = _content;
3
+ // Remove all comments and new lines
4
+ content = content.replace( /\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, '' );
5
+ // Remove spaces between selectors
6
+ content = content.replace( /\s{2,}/g, ' ' );
7
+ // Remove spaces of nested { }
8
+ content = content.replace( /\s([{:}])\s/g, '$1' );
9
+ // Remove spaces between , and ;
10
+ content = content.replace( /([;,])\s/g, '$1' );
11
+ // Remove important! spaces
12
+ content = content.replace( /\s!/g, '!' );
13
+ return content;
14
+ }
@@ -1,6 +1,6 @@
1
1
  import Postmate from 'popostmate';
2
2
  import { SUPPORTED_METHODS } from '../../method-selector/get-payment-methods';
3
- import { loaderHTML } from '../../../loader';
3
+ import { basicLoaderHTML } from '../../../loader';
4
4
 
5
5
  export default class BaseIframe {
6
6
  constructor({
@@ -45,13 +45,14 @@ export default class BaseIframe {
45
45
  appendChild: (iframe) => {
46
46
  iframe.setAttribute('loading', 'lazy');
47
47
  iframe.setAttribute('allow', 'payment');
48
+ iframe.setAttribute('scrolling', 'no');
48
49
  iframe.allowPaymentRequest = true;
49
50
  this.container.appendChild(iframe);
50
51
  },
51
52
  };
52
53
 
53
54
  if (SUPPORTED_METHODS.includes(this.name)) {
54
- this.container.insertAdjacentHTML('beforeend', loaderHTML);
55
+ this.container.insertAdjacentHTML('beforeend', basicLoaderHTML);
55
56
  }
56
57
 
57
58
  const component = await new Postmate({