@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.
Files changed (277) hide show
  1. package/.babelrc +23 -5
  2. package/.eslintrc.js +27 -0
  3. package/.prettierrc.js +11 -0
  4. package/CONTRIBUTING.md +4 -0
  5. package/README.md +361 -2
  6. package/dist/events/base-event.js +51 -37
  7. package/dist/events/events.spec.js +18 -0
  8. package/dist/events/index.js +11 -8
  9. package/dist/functions/destroy.js +27 -5
  10. package/dist/functions/destroy.spec.js +69 -0
  11. package/dist/functions/initialize.js +60 -41
  12. package/dist/functions/initialize.spec.js +13 -13
  13. package/dist/functions/mount/fetch-summary-data.js +46 -0
  14. package/dist/functions/mount/fetch-summary-data.spec.js +44 -0
  15. package/dist/functions/mount/index.js +346 -0
  16. package/dist/functions/mount/mount.spec.js +135 -0
  17. package/dist/functions/on.js +26 -18
  18. package/dist/functions/on.spec.js +45 -63
  19. package/dist/functions/purchase.js +41 -154
  20. package/dist/functions/purchase.spec.js +60 -76
  21. package/dist/functions/show.js +39 -43
  22. package/dist/functions/show.spec.js +57 -0
  23. package/dist/functions/update.js +60 -5
  24. package/dist/functions/update.spec.js +100 -0
  25. package/dist/i18n/en.json +19 -0
  26. package/dist/i18n/es.json +19 -0
  27. package/dist/i18n/i18n.spec.js +6 -23
  28. package/dist/i18n/index.js +44 -67
  29. package/dist/index.js +70 -71
  30. package/dist/index.spec.js +24 -44
  31. package/dist/loader/index.js +63 -62
  32. package/dist/loader/loader.spec.js +14 -11
  33. package/dist/storefront/index.js +28 -39
  34. package/dist/storefront/models/plan-model.js +37 -54
  35. package/dist/storefront/models/product-model.js +25 -36
  36. package/dist/storefront/models/ready-to-pay-model.js +38 -42
  37. package/dist/storefront/models/summary-model.js +72 -99
  38. package/dist/storefront/plans.js +37 -84
  39. package/dist/storefront/plans.spec.js +61 -151
  40. package/dist/storefront/products.js +35 -83
  41. package/dist/storefront/products.spec.js +60 -150
  42. package/dist/storefront/purchase.js +27 -64
  43. package/dist/storefront/purchase.spec.js +51 -87
  44. package/dist/storefront/ready-to-pay.js +45 -107
  45. package/dist/storefront/ready-to-pay.spec.js +72 -147
  46. package/dist/storefront/storefront.spec.js +6 -6
  47. package/dist/storefront/summary.js +37 -84
  48. package/dist/storefront/summary.spec.js +135 -240
  49. package/dist/style/base/__snapshots__/theme.spec.js.snap +52 -0
  50. package/dist/style/base/index.js +72 -0
  51. package/dist/style/base/theme.js +73 -0
  52. package/dist/style/base/theme.spec.js +30 -0
  53. package/dist/style/browserslist.js +8 -0
  54. package/dist/style/components/address.js +64 -0
  55. package/dist/style/components/button.js +61 -0
  56. package/dist/style/components/divider.js +48 -0
  57. package/dist/style/components/forms/checkbox.js +83 -0
  58. package/dist/style/components/forms/field.js +53 -0
  59. package/dist/style/components/forms/form.js +28 -0
  60. package/dist/style/components/forms/input.js +45 -0
  61. package/dist/style/components/forms/label.js +43 -0
  62. package/dist/style/components/forms/select.js +63 -0
  63. package/dist/style/components/forms/validation.js +34 -0
  64. package/dist/style/components/icons.js +22 -0
  65. package/dist/style/components/index.js +57 -0
  66. package/dist/style/components/loader.js +48 -0
  67. package/dist/style/components/methods.js +104 -0
  68. package/dist/style/components/overlay.js +33 -0
  69. package/dist/style/helpers/index.js +59 -0
  70. package/dist/style/index.js +48 -0
  71. package/dist/style/payment-instruments/content.js +17 -0
  72. package/dist/style/payment-instruments/index.js +20 -0
  73. package/dist/style/payment-instruments/payment-card.js +35 -0
  74. package/dist/style/utils/color-values.js +22 -0
  75. package/dist/style/vendor/framepay.js +34 -0
  76. package/dist/style/vendor/postmate.js +17 -0
  77. package/dist/style/views/confirmation.js +85 -0
  78. package/dist/style/views/index.js +29 -0
  79. package/dist/style/views/method-selector.js +20 -0
  80. package/dist/style/views/modal.js +93 -0
  81. package/dist/style/views/result.js +61 -0
  82. package/dist/style/views/summary.js +123 -0
  83. package/dist/utils/add-dom-element.js +12 -34
  84. package/dist/utils/format-currency.js +4 -4
  85. package/dist/utils/has-valid-css-selector.js +2 -2
  86. package/dist/utils/index.js +15 -31
  87. package/dist/utils/is-dom-element.js +1 -1
  88. package/dist/utils/process-property-as-dom-element.js +12 -17
  89. package/dist/utils/sleep.js +10 -0
  90. package/{src/components → dist/views}/__snapshots__/summary.spec.js.snap +7 -3
  91. package/dist/views/common/iframe/base-iframe.js +57 -0
  92. package/dist/views/common/iframe/event-listeners.js +50 -0
  93. package/dist/views/common/iframe/index.js +19 -0
  94. package/dist/views/common/iframe/method-iframe.js +33 -0
  95. package/dist/views/common/iframe/modal-iframe.js +38 -0
  96. package/dist/views/common/iframe/view-iframe.js +31 -0
  97. package/dist/views/common/render-utilities.js +11 -0
  98. package/dist/views/confirmation.js +82 -0
  99. package/dist/views/method-selector/__snapshots__/method-selector.spec.js.snap +3 -0
  100. package/dist/views/method-selector/express-methods/apple-pay.js +92 -0
  101. package/dist/views/method-selector/express-methods/google-pay.js +32 -0
  102. package/dist/views/method-selector/express-methods/paypal.js +19 -0
  103. package/dist/views/method-selector/generate-digital-wallet.js +59 -0
  104. package/dist/views/method-selector/generate-digital-wallet.spec.js +132 -0
  105. package/dist/views/method-selector/get-method-data.js +25 -0
  106. package/dist/views/method-selector/get-payment-methods.js +55 -0
  107. package/dist/views/method-selector/get-payment-methods.spec.js +44 -0
  108. package/dist/views/method-selector/index.js +133 -0
  109. package/dist/views/method-selector/method-selector.spec.js +139 -0
  110. package/dist/views/method-selector/mount-express-methods.js +69 -0
  111. package/dist/views/method-selector/mount-methods.js +78 -0
  112. package/dist/views/modal.js +83 -0
  113. package/dist/views/result.js +42 -0
  114. package/dist/views/summary.js +162 -0
  115. package/dist/views/summary.spec.js +148 -0
  116. package/package.json +12 -6
  117. package/src/events/base-event.js +35 -12
  118. package/src/events/events.spec.js +11 -0
  119. package/src/events/index.js +12 -6
  120. package/src/functions/destroy.js +22 -3
  121. package/src/functions/destroy.spec.js +63 -0
  122. package/src/functions/initialize.js +43 -20
  123. package/src/functions/initialize.spec.js +9 -7
  124. package/src/functions/mount/fetch-summary-data.js +29 -0
  125. package/src/functions/mount/fetch-summary-data.spec.js +41 -0
  126. package/src/functions/mount/index.js +312 -0
  127. package/src/functions/mount/mount.spec.js +171 -0
  128. package/src/functions/on.js +17 -14
  129. package/src/functions/on.spec.js +39 -29
  130. package/src/functions/purchase.js +24 -64
  131. package/src/functions/purchase.spec.js +19 -17
  132. package/src/functions/show.js +27 -7
  133. package/src/functions/show.spec.js +61 -0
  134. package/src/functions/update.js +50 -3
  135. package/src/functions/update.spec.js +107 -0
  136. package/src/i18n/i18n.spec.js +6 -4
  137. package/src/i18n/index.js +20 -12
  138. package/src/index.js +43 -49
  139. package/src/index.spec.js +11 -42
  140. package/src/loader/index.js +55 -39
  141. package/src/loader/loader.spec.js +30 -23
  142. package/src/storefront/index.js +9 -7
  143. package/src/storefront/models/plan-model.js +1 -1
  144. package/src/storefront/models/product-model.js +1 -1
  145. package/src/storefront/models/ready-to-pay-model.js +10 -4
  146. package/src/storefront/models/summary-model.js +8 -15
  147. package/src/storefront/plans.js +16 -12
  148. package/src/storefront/plans.spec.js +29 -37
  149. package/src/storefront/products.js +16 -12
  150. package/src/storefront/products.spec.js +28 -39
  151. package/src/storefront/purchase.js +8 -6
  152. package/src/storefront/purchase.spec.js +18 -17
  153. package/src/storefront/ready-to-pay.js +19 -13
  154. package/src/storefront/ready-to-pay.spec.js +41 -41
  155. package/src/storefront/storefront.spec.js +1 -1
  156. package/src/storefront/summary.js +14 -12
  157. package/src/storefront/summary.spec.js +37 -50
  158. package/src/style/base/__snapshots__/theme.spec.js.snap +52 -0
  159. package/src/style/base/index.js +63 -0
  160. package/src/style/base/theme.js +61 -0
  161. package/src/style/base/theme.spec.js +32 -0
  162. package/src/style/browserslist.js +1 -0
  163. package/src/style/components/address.js +55 -0
  164. package/src/style/components/button.js +54 -0
  165. package/src/style/components/divider.js +39 -0
  166. package/src/style/components/forms/checkbox.js +76 -0
  167. package/src/style/components/forms/field.js +44 -0
  168. package/src/style/components/forms/form.js +19 -0
  169. package/src/style/components/forms/input.js +36 -0
  170. package/src/style/components/forms/label.js +34 -0
  171. package/src/style/components/forms/select.js +54 -0
  172. package/src/style/components/forms/validation.js +25 -0
  173. package/src/style/components/icons.js +13 -0
  174. package/src/style/components/index.js +35 -0
  175. package/src/style/components/loader.js +41 -0
  176. package/src/style/components/methods.js +93 -0
  177. package/src/style/components/overlay.js +24 -0
  178. package/src/style/helpers/index.js +51 -0
  179. package/src/style/index.js +30 -0
  180. package/src/style/payment-instruments/content.js +8 -0
  181. package/src/style/payment-instruments/index.js +10 -0
  182. package/src/style/payment-instruments/payment-card.js +26 -0
  183. package/src/style/utils/color-values.js +9 -0
  184. package/src/style/vendor/framepay.js +25 -0
  185. package/src/style/vendor/postmate.js +8 -0
  186. package/src/style/views/confirmation.js +76 -0
  187. package/src/style/views/index.js +16 -0
  188. package/src/style/views/method-selector.js +11 -0
  189. package/src/style/views/modal.js +84 -0
  190. package/src/style/views/result.js +52 -0
  191. package/src/style/views/summary.js +114 -0
  192. package/src/utils/add-dom-element.js +12 -13
  193. package/src/utils/format-currency.js +4 -1
  194. package/src/utils/has-valid-css-selector.js +2 -2
  195. package/src/utils/index.js +2 -6
  196. package/src/utils/is-dom-element.js +1 -1
  197. package/src/utils/process-property-as-dom-element.js +27 -24
  198. package/src/utils/sleep.js +3 -0
  199. package/src/views/__snapshots__/summary.spec.js.snap +292 -0
  200. package/src/views/common/iframe/base-iframe.js +46 -0
  201. package/src/views/common/iframe/event-listeners.js +27 -0
  202. package/src/views/common/iframe/index.js +7 -0
  203. package/src/views/common/iframe/method-iframe.js +21 -0
  204. package/src/views/common/iframe/modal-iframe.js +27 -0
  205. package/src/views/common/iframe/view-iframe.js +18 -0
  206. package/src/views/common/render-utilities.js +4 -0
  207. package/src/views/confirmation.js +57 -0
  208. package/src/views/method-selector/__snapshots__/method-selector.spec.js.snap +3 -0
  209. package/src/views/method-selector/express-methods/apple-pay.js +78 -0
  210. package/src/views/method-selector/express-methods/google-pay.js +25 -0
  211. package/src/views/method-selector/express-methods/paypal.js +7 -0
  212. package/src/views/method-selector/generate-digital-wallet.js +44 -0
  213. package/src/views/method-selector/generate-digital-wallet.spec.js +131 -0
  214. package/src/{components/form → views/method-selector}/get-method-data.js +9 -5
  215. package/src/views/method-selector/get-payment-methods.js +40 -0
  216. package/src/views/method-selector/get-payment-methods.spec.js +40 -0
  217. package/src/views/method-selector/index.js +110 -0
  218. package/src/views/method-selector/method-selector.spec.js +146 -0
  219. package/src/views/method-selector/mount-express-methods.js +53 -0
  220. package/src/views/method-selector/mount-methods.js +71 -0
  221. package/src/views/modal.js +84 -0
  222. package/src/views/result.js +30 -0
  223. package/src/{components → views}/summary.js +90 -21
  224. package/src/views/summary.spec.js +170 -0
  225. package/tests/async-utilities.js +22 -0
  226. package/tests/mocks/rebilly-instruments-mock.js +105 -7
  227. package/dist/components/confirmation.js +0 -103
  228. package/dist/components/form/form.js +0 -110
  229. package/dist/components/form/form.spec.js +0 -135
  230. package/dist/components/form/get-method-data.js +0 -21
  231. package/dist/components/form/get-payment-methods.js +0 -42
  232. package/dist/components/form/method-selector.js +0 -61
  233. package/dist/components/form/mount-express-payment-methods.js +0 -102
  234. package/dist/components/form/process-digital-wallet-options.js +0 -20
  235. package/dist/components/form/zoid-helpers.js +0 -130
  236. package/dist/components/result.js +0 -66
  237. package/dist/components/summary.js +0 -60
  238. package/dist/components/summary.spec.js +0 -144
  239. package/dist/events/instrument-ready.js +0 -51
  240. package/dist/events/purchase-complete.js +0 -51
  241. package/dist/functions/mount.js +0 -311
  242. package/dist/functions/mount.spec.js +0 -203
  243. package/dist/styles/base-styles.js +0 -12
  244. package/dist/styles/flat-theme-object.js +0 -42
  245. package/dist/styles/framepay.js +0 -15
  246. package/dist/styles/main.js +0 -25
  247. package/dist/styles/payment-card.js +0 -12
  248. package/dist/styles/shade-tint-values-helper.js +0 -28
  249. package/dist/styles/style-variables.js +0 -43
  250. package/dist/utils/camel-case.js +0 -12
  251. package/dist/utils/kebab-case.js +0 -10
  252. package/dist/utils/un-kebab-case.js +0 -10
  253. package/src/components/confirmation.js +0 -77
  254. package/src/components/form/__snapshots__/form.spec.js.snap +0 -43
  255. package/src/components/form/form.js +0 -88
  256. package/src/components/form/form.spec.js +0 -109
  257. package/src/components/form/get-payment-methods.js +0 -32
  258. package/src/components/form/method-selector.js +0 -47
  259. package/src/components/form/mount-express-payment-methods.js +0 -84
  260. package/src/components/form/process-digital-wallet-options.js +0 -11
  261. package/src/components/form/zoid-helpers.js +0 -114
  262. package/src/components/result.js +0 -50
  263. package/src/components/summary.spec.js +0 -106
  264. package/src/events/instrument-ready.js +0 -11
  265. package/src/events/purchase-complete.js +0 -11
  266. package/src/functions/mount.js +0 -204
  267. package/src/functions/mount.spec.js +0 -172
  268. package/src/styles/base-styles.js +0 -741
  269. package/src/styles/flat-theme-object.js +0 -12
  270. package/src/styles/framepay.js +0 -30
  271. package/src/styles/main.js +0 -17
  272. package/src/styles/payment-card.js +0 -18
  273. package/src/styles/shade-tint-values-helper.js +0 -13
  274. package/src/styles/style-variables.js +0 -34
  275. package/src/utils/camel-case.js +0 -3
  276. package/src/utils/kebab-case.js +0 -3
  277. package/src/utils/un-kebab-case.js +0 -3
@@ -0,0 +1,35 @@
1
+ import { expressMethods, methods } from './methods';
2
+ import { form } from './forms/form';
3
+ import { checkbox } from './forms/checkbox';
4
+ import { field } from './forms/field';
5
+ import { input } from './forms/input';
6
+ import { label } from './forms/label';
7
+ import { select } from './forms/select';
8
+ import { validation } from './forms/validation';
9
+ import { button } from './button';
10
+ import { divider } from './divider';
11
+ import { loader } from './loader';
12
+ import { icons } from './icons';
13
+ import { address } from './address';
14
+ import { overlay } from './overlay';
15
+
16
+ // Order of components matters for style cascade
17
+ export const components = (theme) => `
18
+ /* Components
19
+ ------------------------------------------------------------ */
20
+ ${expressMethods(theme)}
21
+ ${methods()}
22
+ ${form(theme)}
23
+ ${field(theme)}
24
+ ${input(theme)}
25
+ ${select(theme)}
26
+ ${label(theme)}
27
+ ${checkbox(theme)}
28
+ ${validation(theme)}
29
+ ${button(theme)}
30
+ ${divider(theme)}
31
+ ${loader(theme)}
32
+ ${icons(theme)}
33
+ ${address(theme)}
34
+ ${overlay(theme)}
35
+ `;
@@ -0,0 +1,41 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the loader component.
3
+ // -----------------------------------------------------------------------------
4
+ export const loader = (theme) => `
5
+ /**
6
+ * Loader
7
+ */
8
+ .rebilly-instruments-loader {
9
+ display: none;
10
+ position: absolute;
11
+ top: 0;
12
+ bottom: 0;
13
+ left: 0;
14
+ right: 0;
15
+ justify-content: center;
16
+ align-items: center;
17
+ background-color: ${theme.color.background};
18
+ z-index: 9000;
19
+ transition: all 200ms;
20
+ }
21
+
22
+ .rebilly-instruments-loader.is-active {
23
+ display: flex;
24
+ }
25
+
26
+ .rebilly-instruments-loader-spinner {
27
+ border: 4px solid ${theme.getComputed.color.primaryValues
28
+ .tint(80)
29
+ .hexString()};
30
+ border-top: 4px solid ${theme.color.primary};
31
+ border-radius: 50%;
32
+ width: 40px;
33
+ height: 40px;
34
+ animation: spin 0.5s ease infinite;
35
+ }
36
+
37
+ @keyframes spin {
38
+ 0% { transform: rotate(0deg); }
39
+ 100% { transform: rotate(360deg); }
40
+ }
41
+ `;
@@ -0,0 +1,93 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the methods component.
3
+ // -----------------------------------------------------------------------------
4
+ export const expressMethods = (theme) => `
5
+ /**
6
+ * Express methods
7
+ */
8
+
9
+ @keyframes rebillyExpressShine {
10
+ to {
11
+ background-position-x: -200%;
12
+ }
13
+ }
14
+
15
+ .rebilly-instruments-express-methods.is-compact {
16
+ border: 1px solid ${theme.getComputed.color.mutedBorder};
17
+ padding: calc(${theme.space.xs} + ${theme.space.s}) ${theme.space.s} ${theme.space.s};
18
+ border-radius: ${theme.borderRadius};
19
+ position: relative;
20
+ }
21
+
22
+ .rebilly-instruments-express-methods iframe {
23
+ display: block;
24
+ margin-bottom: 0;
25
+ }
26
+
27
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > * {
28
+ border-radius: 6px;
29
+ margin-bottom: ${theme.space.xs};
30
+ background: linear-gradient(110deg, ${theme.getComputed.color.mutedBorder} 0%, ${theme.color.background} 25%, ${theme.getComputed.color.mutedBorder} 50%);
31
+ background-size: 200% 100%;
32
+ animation: 1.5s rebillyExpressShine linear infinite;
33
+ }
34
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-container > *:last-child {
35
+ margin: 0;
36
+ }
37
+
38
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container {
39
+ display: flex;
40
+ justify-content: center;
41
+ }
42
+
43
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
44
+ flex: 1 1 0px;
45
+ max-width: 260px;
46
+ margin: 0 ${theme.space.xs};
47
+ }
48
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:first-child {
49
+ margin-left: 0;
50
+ }
51
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
52
+ margin-right: 0;
53
+ }
54
+
55
+ .rebilly-instruments-express-methods .rebilly-instruments-express-methods-label {
56
+ display: none;
57
+ }
58
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-label {
59
+ position: absolute;
60
+ top: -12px; left: 50%;
61
+ transform: translateX(-50%);
62
+ color: ${theme.color.text};
63
+ padding: 0 ${theme.space.s};
64
+ line-height: ${theme.typography.lineHeight};
65
+ background: ${theme.color.background};
66
+ display: inline-block;
67
+ font-weight: 500;
68
+ min-height: auto;
69
+ margin: 0;
70
+ border: 1px soplid red;
71
+ }
72
+
73
+ @media (max-width: 600px) {
74
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container {
75
+ flex-direction: column;
76
+ }
77
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
78
+ max-width: 100%;
79
+ margin: 0 0 ${theme.space.xs};
80
+ }
81
+ .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
82
+ margin: 0;
83
+ }
84
+ }
85
+ `;
86
+
87
+ export const methods = () => `
88
+ /**
89
+ * Methods
90
+ */
91
+
92
+ .rebilly-instruments-methods {}
93
+ `;
@@ -0,0 +1,24 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the overlay component.
3
+ // -----------------------------------------------------------------------------
4
+ export const overlay = (theme) => `
5
+ /**
6
+ * Overlay
7
+ */
8
+ .rebilly-instruments-overlay {
9
+ position: fixed;
10
+ left: 0;
11
+ right: 0;
12
+ top: 0;
13
+ bottom: 0;
14
+ background: rgba(0,0,0,0.8);
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: center;
18
+ color: #ffffff;
19
+ font-family: ${theme.typography.fontFamily};
20
+ font-size: calc(${theme.typography.fontSize} * 1.12);
21
+ line-height: ${theme.typography.lineHeight};
22
+ z-index: 9001
23
+ }
24
+ `;
@@ -0,0 +1,51 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to helpers.
3
+ // -----------------------------------------------------------------------------
4
+
5
+ export const helpers = (theme) => `
6
+ /* Helpers
7
+ ------------------------------------------------------------ */
8
+ .rebilly-instruments-helper-visually-hidden {
9
+ border: 0;
10
+ clip: rect(0 0 0 0);
11
+ height: 1px;
12
+ margin: -1px;
13
+ overflow: hidden;
14
+ padding: 0;
15
+ position: absolute;
16
+ width: 1px;
17
+ }
18
+
19
+ .rebilly-instruments-helper-mt-xxs { margin-top: ${theme.space.xxs}!important }
20
+ .rebilly-instruments-helper-mt-xs { margin-top: ${theme.space.xs}!important }
21
+ .rebilly-instruments-helper-mt-s { margin-top: ${theme.space.s}!important }
22
+ .rebilly-instruments-helper-mt-m { margin-top: ${theme.space.m}!important }
23
+ .rebilly-instruments-helper-mt-l { margin-top: ${theme.space.l}!important }
24
+ .rebilly-instruments-helper-mt-xl { margin-top: ${theme.space.xl}!important }
25
+ .rebilly-instruments-helper-mt-xxl { margin-top: ${theme.space.xxl}!important }
26
+ .rebilly-instruments-helper-mt-0 { margin-top: 0!important }
27
+ .rebilly-instruments-helper-mr-xxs { margin-right: ${theme.space.xxs}!important }
28
+ .rebilly-instruments-helper-mr-xs { margin-right: ${theme.space.xs}!important }
29
+ .rebilly-instruments-helper-mr-s { margin-right: ${theme.space.s}!important }
30
+ .rebilly-instruments-helper-mr-m { margin-right: ${theme.space.m}!important }
31
+ .rebilly-instruments-helper-mr-l { margin-right: ${theme.space.l}!important }
32
+ .rebilly-instruments-helper-mr-xl { margin-right: ${theme.space.xl}!important }
33
+ .rebilly-instruments-helper-mr-xxl { margin-right: ${theme.space.xxl}!important }
34
+ .rebilly-instruments-helper-mr-0 { margin-right: 0!important }
35
+ .rebilly-instruments-helper-mb-xxs { margin-bottom: ${theme.space.xxs}!important }
36
+ .rebilly-instruments-helper-mb-xs { margin-bottom: ${theme.space.xs}!important }
37
+ .rebilly-instruments-helper-mb-s { margin-bottom: ${theme.space.s}!important }
38
+ .rebilly-instruments-helper-mb-m { margin-bottom: ${theme.space.m}!important }
39
+ .rebilly-instruments-helper-mb-l { margin-bottom: ${theme.space.l}!important }
40
+ .rebilly-instruments-helper-mb-xl { margin-bottom: ${theme.space.xl}!important }
41
+ .rebilly-instruments-helper-mb-xxl { margin-bottom: ${theme.space.xxl}!important }
42
+ .rebilly-instruments-helper-mb-0 { margin-bottom: 0!important }
43
+ .rebilly-instruments-helper-ml-xxs { margin-left: ${theme.space.xxs}!important }
44
+ .rebilly-instruments-helper-ml-xs { margin-left: ${theme.space.xs}!important }
45
+ .rebilly-instruments-helper-ml-s { margin-left: ${theme.space.s}!important }
46
+ .rebilly-instruments-helper-ml-m { margin-left: ${theme.space.m}!important }
47
+ .rebilly-instruments-helper-ml-l { margin-left: ${theme.space.l}!important }
48
+ .rebilly-instruments-helper-ml-xl { margin-left: ${theme.space.xl}!important }
49
+ .rebilly-instruments-helper-ml-xxl { margin-left: ${theme.space.xxl}!important }
50
+ .rebilly-instruments-helper-ml-0 { margin-left: 0!important }
51
+ `;
@@ -0,0 +1,30 @@
1
+ import postcss from 'postcss';
2
+ import autoprefixer from 'autoprefixer';
3
+ import { browserslist } from './browserslist';
4
+
5
+ import { Theme } from './base/theme';
6
+ import { base } from './base';
7
+ import { framepayStyle } from './vendor/framepay';
8
+ import { postmateStyle } from './vendor/postmate';
9
+ import { components } from './components';
10
+ import { paymentInstruments } from './payment-instruments';
11
+ import { views } from './views';
12
+ import { helpers } from './helpers';
13
+
14
+ export const mainStyle = async (themeOverride) => {
15
+ const resolvedTheme = new Theme(themeOverride).build();
16
+
17
+ const style = `
18
+ ${base(resolvedTheme)}
19
+ ${components(resolvedTheme)}
20
+ ${views(resolvedTheme)}
21
+ ${paymentInstruments(resolvedTheme)}
22
+ ${framepayStyle(resolvedTheme)}
23
+ ${postmateStyle(resolvedTheme)}
24
+ ${helpers(resolvedTheme)}
25
+ `;
26
+
27
+ return postcss([autoprefixer(browserslist)])
28
+ .process(style, { from: undefined })
29
+ .then((result) => result.css);
30
+ };
@@ -0,0 +1,8 @@
1
+ export const methodContent = () => `
2
+ /**
3
+ * Content
4
+ */
5
+ .rebilly-instruments-method-content {
6
+ padding: 2px;
7
+ }
8
+ `;
@@ -0,0 +1,10 @@
1
+ import { methodContent } from './content';
2
+ import { paymentCard } from './payment-card';
3
+
4
+ // Order of components matters for style cascade
5
+ export const paymentInstruments = (theme) => `
6
+ /* Payment instruments
7
+ ------------------------------------------------------------ */
8
+ ${methodContent()}
9
+ ${paymentCard(theme)}
10
+ `;
@@ -0,0 +1,26 @@
1
+ export const paymentCard = (theme) => `
2
+ /**
3
+ * Payment card
4
+ */
5
+ .rebilly-instruments-payment-card-brands {
6
+ display: inline-flex;
7
+ width: 100%;
8
+ justify-content: flex-end;
9
+ margin-top: ${theme.space.s}
10
+ }
11
+
12
+ .rebilly-instruments-payment-card-brands figure {
13
+ margin: 0 0 0 ${theme.space.xxs};
14
+ padding: 0;
15
+ height: 26px;
16
+ }
17
+
18
+ .rebilly-instruments-payment-card-brands figure img {
19
+ width: 42px;
20
+ border-radius: ${theme.borderRadius};
21
+ }
22
+
23
+ .rebilly-instruments-modal-container.rebilly-instruments-payment-card {
24
+ max-width: 600px;
25
+ }
26
+ `;
@@ -0,0 +1,9 @@
1
+ import Values from 'values.js';
2
+
3
+ export const colorValues = (color) => new Values(color);
4
+
5
+ export function alphaColor(color, alphaValue = 1) {
6
+ const _alphaColor = new Values(color);
7
+ _alphaColor.alpha = alphaValue;
8
+ return _alphaColor.rgbString();
9
+ }
@@ -0,0 +1,25 @@
1
+ export const framepayStyle = (theme) => `
2
+ .rebilly-instruments-framepay .rebilly-framepay {
3
+ box-shadow: none;
4
+ min-height: ${theme.space.form.minHeight};
5
+ border: 1px solid ${theme.getComputed.color.mutedBorder};
6
+ margin-bottom: 0;
7
+ background: ${theme.color.background};
8
+ }
9
+
10
+ .rebilly-instruments-framepay .rebilly-framepay.rebilly-framepay-focus {
11
+ border: 1px solid ${theme.color.primary};
12
+ box-shadow: 0 0 0 1px ${theme.color.primary};
13
+ }
14
+
15
+ .rebilly-instruments-framepay .rebilly-framepay.rebilly-framepay-invalid {
16
+ border: 1px solid ${theme.color.errorText};
17
+ box-shadow: none;
18
+ }
19
+
20
+ .rebilly-instruments-framepay .rebilly-framepay.rebilly-framepay-digital-wallet {
21
+ min-height: auto;
22
+ border: none;
23
+ margin: 0;
24
+ }
25
+ `;
@@ -0,0 +1,8 @@
1
+ export const postmateStyle = (theme) => `
2
+ .rebilly-instruments-iframe {
3
+ border: none;
4
+ width: 100%;
5
+ min-height: ${theme.space.form.minHeight};
6
+ transition: all 0.2s ease;
7
+ }
8
+ `;
@@ -0,0 +1,76 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the confirmation view.
3
+ // -----------------------------------------------------------------------------
4
+ export const confirmation = (theme) => `
5
+ /**
6
+ * Confirmation
7
+ */
8
+ .rebilly-instruments-confirmation {
9
+ padding: 2px;
10
+ }
11
+
12
+ .rebilly-instruments-confirmation-go-back-link {
13
+ display: inline-block;
14
+ margin-bottom: ${theme.space.m};
15
+ margin-left: -${theme.space.xs};
16
+ }
17
+
18
+ .rebilly-instruments-confirmation-address-title {
19
+ display: flex;
20
+ justify-content: flex-start;
21
+ }
22
+
23
+ .rebilly-instruments-confirmation-address-title .rebilly-instruments-link {
24
+ margin-left: ${theme.space.s};
25
+ }
26
+
27
+ .rebilly-instruments-confirmation-address-actions {
28
+ margin-top: ${theme.space.m};
29
+ display: flex;
30
+ }
31
+
32
+ .rebilly-instruments-confirmation-address-actions :first-child {
33
+ margin: 0 ${theme.space.xs} 0 0;
34
+ }
35
+
36
+ .rebilly-instruments-confirmation-address-actions :last-child {
37
+ margin: 0 0 0 ${theme.space.xs};
38
+ }
39
+
40
+ .rebilly-instruments-confirmation-payment-method {
41
+ display: inline-flex;
42
+ align-items: center;
43
+ justify-content: space-between;
44
+ height: 26px;
45
+ margin: 0 0 ${theme.space.l};
46
+ }
47
+
48
+ .rebilly-instruments-confirmation-payment-method figure {
49
+ margin: 0 ${theme.space.xxs} 0 0;
50
+ height: 26px;
51
+ padding: 0;
52
+ }
53
+
54
+ .rebilly-instruments-confirmation-payment-method figure img {
55
+ width: 42px;
56
+ border-radius: ${theme.borderRadius};
57
+ }
58
+
59
+ .rebilly-instruments-confirmation-payment-method-brand,
60
+ .rebilly-instruments-confirmation-payment-method-exp,
61
+ .rebilly-instruments-confirmation-payment-method-last4 {
62
+ display: inline-block;
63
+ }
64
+
65
+ .rebilly-instruments-confirmation-payment-method-brand {
66
+ margin: 0 0 0 ${theme.space.s};
67
+ }
68
+
69
+ .rebilly-instruments-confirmation-payment-method-last4 {
70
+ margin: 0 ${theme.space.s};
71
+ }
72
+
73
+ .rebilly-instruments-confirmation-payment-method-exp {
74
+ color: ${theme.getComputed.color.mutedText};
75
+ }
76
+ `;
@@ -0,0 +1,16 @@
1
+ import { summary } from './summary';
2
+ import { methodSelector } from './method-selector';
3
+ import { confirmation } from './confirmation';
4
+ import { result } from './result';
5
+ import { modal } from './modal';
6
+
7
+ // Order of components matters for style cascade
8
+ export const views = (theme) => `
9
+ /* Views
10
+ ------------------------------------------------------------ */
11
+ ${summary(theme)}
12
+ ${methodSelector(theme)}
13
+ ${confirmation(theme)}
14
+ ${result(theme)}
15
+ ${modal(theme)}
16
+ `;
@@ -0,0 +1,11 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the selector view.
3
+ // -----------------------------------------------------------------------------
4
+ export const methodSelector = (theme) => `
5
+ /**
6
+ * Method selector
7
+ */
8
+ .rebilly-instruments-method-selector {
9
+ padding-top: ${theme.space.s};
10
+ }
11
+ `;
@@ -0,0 +1,84 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the modal view.
3
+ // -----------------------------------------------------------------------------
4
+ export const modal = (theme) => `
5
+ /**
6
+ * Modal
7
+ */
8
+
9
+ .rebilly-instruments-modal-overlay {
10
+ position: fixed;
11
+ top: 0;
12
+ left: 0;
13
+ overflow-x: hidden;
14
+ overflow-y: auto;
15
+ z-index: 1055;
16
+ padding: 30px;
17
+ width: 100%;
18
+ height: 100%;
19
+ margin: 0;
20
+ padding: 0;
21
+ transition: all 0.12s ease-in-out;
22
+ background-color: rgba(0,0,0,0.7);
23
+ opacity: 0
24
+ }
25
+
26
+ .rebilly-instruments-modal-overlay.is-visible {
27
+ opacity: 1;
28
+ }
29
+
30
+ .rebilly-instruments-modal-container {
31
+ transition: all .24s ease-in-out;
32
+ position: relative;
33
+ max-width: 800px;
34
+ min-height: 240px;
35
+ background: ${theme.color.background};
36
+ margin: 50px auto 20px;
37
+ box-shadow: 0 19px 38px rgba(0,0,0,0.20), 0 15px 12px rgba(0,0,0,0.12);
38
+ border-radius: ${theme.borderRadius};
39
+ transform: translateY(-50px);
40
+ opacity: 0;
41
+ }
42
+
43
+ .rebilly-instruments-modal-container.is-visible {
44
+ transform: translateY(0);
45
+ opacity: 1;
46
+ }
47
+
48
+ .rebilly-instruments-modal-container.is-redirect {
49
+ max-width: 60vw;
50
+ width: auto;
51
+ }
52
+
53
+ .rebilly-instruments-modal-content {
54
+ transition: all .15s;
55
+ padding: 20px;
56
+ overflow: hidden;
57
+ background-color: ${theme.color.background};
58
+ text-align: center;
59
+ border-radius: ${theme.borderRadius};
60
+ }
61
+
62
+ .rebilly-instruments-modal-content .rebilly-instruments-iframe {
63
+ transition: all .15s;
64
+ height: 100%;
65
+ }
66
+
67
+ .rebilly-instruments-modal-container.is-redirect .rebilly-instruments-modal-content {
68
+ padding: 0;
69
+ }
70
+
71
+ .rebilly-instruments-modal-close {
72
+ position: absolute;
73
+ width: 30px;
74
+ height: 30px;
75
+ top: -40px;
76
+ right: 0;
77
+ fill: #ffffff;
78
+ cursor: pointer;
79
+ }
80
+
81
+ .rebilly-instruments-modal-close:hover{
82
+ color: #000;
83
+ }
84
+ `;
@@ -0,0 +1,52 @@
1
+ // -----------------------------------------------------------------------------
2
+ // This file contains all styles related to the result view.
3
+ // -----------------------------------------------------------------------------
4
+ export const result = (theme) => `
5
+ /**
6
+ * Result
7
+ */
8
+ .rebilly-instruments-results .rebilly-instruments-h1 {
9
+ text-align: center;
10
+ margin: 0;
11
+ }
12
+
13
+ .rebilly-instruments-results-icon {
14
+ width: 160px;
15
+ margin: 0 auto ${theme.space.m} auto;
16
+ display: block;
17
+ }
18
+
19
+ .rebilly-instruments-results-icon g {
20
+ stroke: ${theme.color.primary};
21
+ }
22
+
23
+ .rebilly-instruments-results-icon.is-error g {
24
+ stroke: ${theme.color.errorText};
25
+ }
26
+
27
+ .rebilly-instruments-results-icon path {
28
+ stroke-linecap: round;
29
+ stroke-linejoin: round;
30
+ }
31
+
32
+ .rebilly-instruments-results-icon path.circle {
33
+ stroke-dasharray: 350;
34
+ stroke-dashoffset: 0;
35
+ animation: 0.6s cubic-bezier(1.0, 0.5, 0.8, 1.0) 1 rebillyDashResultIcon;
36
+ }
37
+
38
+ .rebilly-instruments-results-icon path.mark {
39
+ stroke-dasharray: 350;
40
+ stroke-dashoffset: 0;
41
+ animation: 1s cubic-bezier(1.0, 0.5, 0.8, 1.0) 1 rebillyDashResultIcon;
42
+ }
43
+
44
+ @keyframes rebillyDashResultIcon {
45
+ from {
46
+ stroke-dashoffset: 350;
47
+ }
48
+ to {
49
+ stroke-dashoffset: 0;
50
+ }
51
+ }
52
+ `;