@rebilly/instruments 3.7.2-beta.0 → 3.7.3-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/instruments",
3
- "version": "3.7.2-beta.0",
3
+ "version": "3.7.3-beta.0",
4
4
  "author": "Rebilly",
5
5
  "main": "dist/index.js",
6
6
  "unpkg": "dist/index.min.js",
@@ -1,17 +1,19 @@
1
1
  import isDOMElement from '../utils/is-dom-element';
2
2
 
3
+ export const loaderHTML = `
4
+ <div class="rebilly-instruments-loader is-active">
5
+ <div class="rebilly-instruments-loader-spinner"></div>
6
+ <span class="rebilly-instuments-loader-message"></span>
7
+ </div>
8
+ `
9
+
3
10
  export class Loader {
4
11
  constructor() {
5
12
  this.summary = [];
6
13
  this.form = [];
7
14
  this.modal = [];
8
15
  this.DOM = {
9
- loading: `
10
- <div class="rebilly-instruments-loader is-active">
11
- <div class="rebilly-instruments-loader-spinner"></div>
12
- <span class="rebilly-instuments-loader-message"><span>
13
- </div>
14
- `
16
+ loading: loaderHTML
15
17
  };
16
18
  }
17
19
 
@@ -96,4 +96,22 @@ export const button = () => `
96
96
  .rebilly-instruments-button-group .rebilly-instruments-button:last-of-type {
97
97
  margin-right: 0;
98
98
  }
99
+
100
+ @media screen and (max-width: 480px) {
101
+ .rebilly-instruments-button-group {
102
+ flex-direction: column-reverse;
103
+ }
104
+
105
+ .rebilly-instruments-button-group .rebilly-instruments-button:first-of-type {
106
+ margin: 0;
107
+ }
108
+
109
+ .rebilly-instruments-button-group .rebilly-instruments-button:last-of-type {
110
+ margin: 0;
111
+ }
112
+
113
+ .rebilly-instruments-button-group .rebilly-instruments-button + .rebilly-instruments-button {
114
+ margin-bottom: var(--rebilly-spacings-s);
115
+ }
116
+ }
99
117
  `;
@@ -80,7 +80,7 @@ export const expressMethods = () => `
80
80
  }
81
81
  .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > * {
82
82
  max-width: 100%;
83
- margin: 0 0 var(--rebilly-spacings-xs);
83
+ margin: 0 0 var(--rebilly-spacings-s);
84
84
  }
85
85
  .rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container > *:last-child {
86
86
  margin: 0;
@@ -2,11 +2,8 @@ export const postmateStyle = () => `
2
2
  .rebilly-instruments-iframe {
3
3
  border: none;
4
4
  width: 100%;
5
+ padding: 0;
5
6
  min-height: var(--rebilly-spacings-form-element-min-height);
6
- transition: all 0.2s ease;
7
- transition: width 0s ease;
8
- transition: height 0s ease;
9
- transition: position 0s ease;
10
7
  }
11
8
 
12
9
  .rebilly-instruments-iframe-overlay {
@@ -1,4 +1,6 @@
1
1
  import Postmate from 'popostmate';
2
+ import { SUPPORTED_METHODS } from '../../method-selector/get-payment-methods';
3
+ import { loaderHTML } from '../../../loader';
2
4
 
3
5
  export default class BaseIframe {
4
6
  constructor({
@@ -48,6 +50,10 @@ export default class BaseIframe {
48
50
  },
49
51
  };
50
52
 
53
+ if (SUPPORTED_METHODS.includes(this.name)) {
54
+ this.container.insertAdjacentHTML('beforeend', loaderHTML);
55
+ }
56
+
51
57
  const component = await new Postmate({
52
58
  name: this.name,
53
59
  url: this.url,
@@ -14,6 +14,12 @@ export function resizeComponentHandler(iframe) {
14
14
  }
15
15
 
16
16
  export function stopLoaderHandler(iframe, data = { section: 'form' }) {
17
+ const iframeLoader = iframe.container.querySelectorAll('.rebilly-instruments-loader.is-active');
18
+
19
+ if (iframeLoader && iframeLoader.length) {
20
+ iframeLoader.forEach(loader => loader.classList.remove('is-active'));
21
+ }
22
+
17
23
  iframe.component.on(`${iframe.name}-stop-loading`, (id = null) => {
18
24
  data.loader?.stopLoading({ section: data.section, id: id || data.id });
19
25
  });
@@ -1,20 +1,13 @@
1
- /* eslint-disable no-unused-expressions, arrow-body-style */
2
- import { getMethodData } from './get-method-data';
3
-
4
1
  const SUPPORTED_EXPRESS_METHODS = ['Google Pay', 'Apple Pay', 'paypal'];
5
2
 
6
- const SUPPORTED_METHODS = ['payment-card', 'ach'];
3
+ export const SUPPORTED_METHODS = ['payment-card', 'ach'];
7
4
 
8
- const isExpressMethod = ({ method, feature }) => {
9
- return (
5
+ const isExpressMethod = ({ method, feature }) => (
10
6
  SUPPORTED_EXPRESS_METHODS.includes(method) ||
11
7
  SUPPORTED_EXPRESS_METHODS.includes(feature?.name)
12
8
  );
13
- };
14
9
 
15
- const isSupportedMethod = ({ method }) => {
16
- return SUPPORTED_METHODS.includes(method);
17
- };
10
+ const isSupportedMethod = ({ method }) => SUPPORTED_METHODS.includes(method);
18
11
 
19
12
  // TODO: just loader is used. We could simplify signature
20
13
  export function getPaymentMethods({ state }) {
@@ -25,13 +18,8 @@ export function getPaymentMethods({ state }) {
25
18
 
26
19
  state.data.readyToPay?.forEach((method) => {
27
20
  if (isExpressMethod(method)) {
28
- const { METHOD_TYPE } = getMethodData(method);
29
- // Add loader entry per express method
30
- state.loader.startLoading({ id: `${METHOD_TYPE}-express` });
31
21
  result.EXPRESS_METHODS.push(method);
32
22
  } else if (isSupportedMethod(method)) {
33
- // Add loader entry per method
34
- state.loader.startLoading({ id: method.method });
35
23
  result.METHODS.push(method);
36
24
  }
37
25
  });
@@ -82,7 +82,7 @@ export function MountMethods({
82
82
  <span class="rebilly-instruments-accordion-title" data-rebilly-i18n="paymentMethods.${method.method}">${method.metadata.name}</span>
83
83
  <span class="rebilly-instruments-accordion-summary-checkmark"></span>
84
84
  </summary>
85
- <div id="${selector}" data-rebilly-instruments-type="${methodId}"></div>
85
+ <div id="${selector}" data-rebilly-instruments-type="${methodId}" style="position: relative"></div>
86
86
  </details>`
87
87
  );
88
88