@monei-js/components 1.7.6 → 1.7.7
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/components.cjs.development.js +20 -5
- package/dist/components.cjs.development.js.map +1 -1
- package/dist/components.cjs.production.min.js +1 -1
- package/dist/components.cjs.production.min.js.map +1 -1
- package/dist/components.esm.js +20 -5
- package/dist/components.esm.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/components.esm.js
CHANGED
|
@@ -826,7 +826,7 @@ var loadScript = function loadScript(src, nonce, dataset, forceReload) {
|
|
|
826
826
|
if (forceReload) {
|
|
827
827
|
existingScript.remove();
|
|
828
828
|
} else {
|
|
829
|
-
resolve();
|
|
829
|
+
resolve(existingScript);
|
|
830
830
|
return;
|
|
831
831
|
}
|
|
832
832
|
}
|
|
@@ -835,7 +835,7 @@ var loadScript = function loadScript(src, nonce, dataset, forceReload) {
|
|
|
835
835
|
script.src = src;
|
|
836
836
|
|
|
837
837
|
script.onload = function () {
|
|
838
|
-
return resolve();
|
|
838
|
+
return resolve(script);
|
|
839
839
|
};
|
|
840
840
|
|
|
841
841
|
script.onerror = function (error) {
|
|
@@ -15161,7 +15161,7 @@ var namespace = 'monei-paypal';
|
|
|
15161
15161
|
|
|
15162
15162
|
var onLoadPaypal = /*#__PURE__*/function () {
|
|
15163
15163
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(props, state, src) {
|
|
15164
|
-
var defaultStyle, token;
|
|
15164
|
+
var script, defaultStyle, token;
|
|
15165
15165
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
15166
15166
|
while (1) {
|
|
15167
15167
|
switch (_context2.prev = _context2.next) {
|
|
@@ -15173,12 +15173,14 @@ var onLoadPaypal = /*#__PURE__*/function () {
|
|
|
15173
15173
|
}, true);
|
|
15174
15174
|
|
|
15175
15175
|
case 2:
|
|
15176
|
+
script = _context2.sent;
|
|
15177
|
+
state.__scriptId = script.dataset.uidAuto;
|
|
15176
15178
|
defaultStyle = {
|
|
15177
15179
|
layout: 'horizontal',
|
|
15178
15180
|
tagline: false
|
|
15179
15181
|
};
|
|
15180
15182
|
props.onLoad == null ? void 0 : props.onLoad(true);
|
|
15181
|
-
_context2.next =
|
|
15183
|
+
_context2.next = 8;
|
|
15182
15184
|
return window[namespace].Buttons({
|
|
15183
15185
|
createOrder: function () {
|
|
15184
15186
|
var _createOrder = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
@@ -15247,7 +15249,7 @@ var onLoadPaypal = /*#__PURE__*/function () {
|
|
|
15247
15249
|
style: _extends({}, defaultStyle, props.style)
|
|
15248
15250
|
}).render(state.__container);
|
|
15249
15251
|
|
|
15250
|
-
case
|
|
15252
|
+
case 8:
|
|
15251
15253
|
case "end":
|
|
15252
15254
|
return _context2.stop();
|
|
15253
15255
|
}
|
|
@@ -15275,6 +15277,9 @@ var options$2 = {
|
|
|
15275
15277
|
return undefined;
|
|
15276
15278
|
},
|
|
15277
15279
|
containerTemplate: function containerTemplate$1(params) {
|
|
15280
|
+
console.log({
|
|
15281
|
+
params: params
|
|
15282
|
+
});
|
|
15278
15283
|
params.state.__container = params.container;
|
|
15279
15284
|
|
|
15280
15285
|
if (!params.props.accountId && !params.props.paymentId) {
|
|
@@ -15284,9 +15289,19 @@ var options$2 = {
|
|
|
15284
15289
|
var container = containerTemplate(params);
|
|
15285
15290
|
|
|
15286
15291
|
params.event.on(zoid.EVENT.DESTROY, function () {
|
|
15292
|
+
console.log('destroy');
|
|
15287
15293
|
window[namespace].Buttons.instances.forEach(function (instance) {
|
|
15288
15294
|
instance.close();
|
|
15289
15295
|
});
|
|
15296
|
+
var scriptId = params.state.__scriptId;
|
|
15297
|
+
|
|
15298
|
+
if (scriptId) {
|
|
15299
|
+
var script = document.querySelector("script[data-uid-auto=\"" + scriptId + "\"]");
|
|
15300
|
+
|
|
15301
|
+
if (script) {
|
|
15302
|
+
script.remove();
|
|
15303
|
+
}
|
|
15304
|
+
}
|
|
15290
15305
|
});
|
|
15291
15306
|
return container;
|
|
15292
15307
|
},
|