@rebilly/instruments 3.3.0-beta.0 → 3.3.1-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.3.0-beta.0",
3
+ "version": "3.3.1-beta.0",
4
4
  "author": "Rebilly",
5
5
  "main": "dist/index.js",
6
6
  "unpkg": "dist/index.min.js",
@@ -61,9 +61,9 @@ export function MountMethods({
61
61
  state.options._computed || 'https://www.example.com';
62
62
 
63
63
  const selector = `rebilly-instruments-${methodId}`;
64
- const isiFrame =
65
- methodId === 'payment-card' &&
66
- !state.options.paymentInstruments[methodType]?.popup;
64
+ const isPopup = [
65
+ 'payment-card'
66
+ ].includes(methodId) && state.options.paymentInstruments[methodType]?.popup;
67
67
  const model = {
68
68
  options: state.options,
69
69
  mainStyle: state.mainStyle,
@@ -91,23 +91,8 @@ export function MountMethods({
91
91
  const summary = document.querySelector(`.for-${methodId} > .rebilly-instruments-accordion-summary`);
92
92
  displayBrands({summary, method});
93
93
  }
94
-
95
94
  state.loader.stopLoading({ id: method.method });
96
- METHODS_CONTAINER.insertAdjacentHTML(
97
- 'beforeend',
98
- `<div id="${selector}" data-rebilly-instruments-type="${methodId}"></div>`
99
- );
100
- const container = document.querySelector(`#${selector}`);
101
95
 
102
- state.loader.stopLoading({ id: method.method });
103
- mountInline(state, {
104
- methodId,
105
- paymentMethodsUrl,
106
- container,
107
- model,
108
- method
109
- });
110
- } else if (isiFrame) {
111
96
  METHODS_CONTAINER.insertAdjacentHTML(
112
97
  'beforeend',
113
98
  `<div id="${selector}" data-rebilly-instruments-type="${methodId}"></div>`
@@ -122,7 +107,7 @@ export function MountMethods({
122
107
  model,
123
108
  method
124
109
  });
125
- } else {
110
+ } else if (isPopup) {
126
111
  METHODS_CONTAINER.insertAdjacentHTML(
127
112
  'beforeend',
128
113
  `<div id="${selector}" data-rebilly-instruments-type="${methodId}"></div>`
@@ -135,8 +120,8 @@ export function MountMethods({
135
120
  method.method
136
121
  }">${camelCase(method.method)}</button>`
137
122
  );
138
- const paymentCardButton = document.querySelector(`.${selector}`);
139
- paymentCardButton.addEventListener('click', async () => {
123
+ const button = document.querySelector(`.${selector}`);
124
+ button.addEventListener('click', async () => {
140
125
  const iframe = await mountModal({
141
126
  state,
142
127
  name: methodId,
@@ -145,7 +130,21 @@ export function MountMethods({
145
130
  });
146
131
  state.iframeComponents.push(iframe);
147
132
  });
133
+ } else {
134
+ METHODS_CONTAINER.insertAdjacentHTML(
135
+ 'beforeend',
136
+ `<div id="${selector}" data-rebilly-instruments-type="${methodId}"></div>`
137
+ );
138
+ const container = document.querySelector(`#${selector}`);
139
+
148
140
  state.loader.stopLoading({ id: method.method });
141
+ mountInline(state, {
142
+ methodId,
143
+ paymentMethodsUrl,
144
+ container,
145
+ model,
146
+ method
147
+ });
149
148
  }
150
149
  });
151
150