@alipay/ams-checkout 1.4.0 → 1.5.2
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/umd/ams-checkout.min.js +1 -1
- package/esm/constant/index.d.ts +53 -32
- package/esm/constant/index.js +53 -32
- package/esm/core/component/index.d.ts +23 -9
- package/esm/core/component/index.js +145 -43
- package/esm/core/drop-in/index.d.ts +4 -4
- package/esm/core/drop-in/index.js +3 -3
- package/esm/core/instance/index.d.ts +6 -15
- package/esm/core/instance/index.js +31 -53
- package/esm/image/skeleton.svg +18 -0
- package/esm/index.d.ts +4 -10
- package/esm/index.js +8 -30
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +16 -15
- package/esm/plugin/component/{component.style.d.ts → component.inline.style.d.ts} +4 -1
- package/esm/plugin/component/component.inline.style.js +38 -0
- package/esm/plugin/component/component.popup.style.d.ts +12 -0
- package/esm/plugin/component/component.popup.style.js +163 -0
- package/esm/plugin/component/index.d.ts +29 -32
- package/esm/plugin/component/index.js +225 -333
- package/esm/plugin/drop-in/index.d.ts +3 -5
- package/esm/plugin/drop-in/index.js +3 -3
- package/esm/request/index.d.ts +2 -2
- package/esm/request/index.js +3 -3
- package/esm/request/utils.d.ts +3 -3
- package/esm/request/utils.js +4 -4
- package/esm/service/index.d.ts +2 -2
- package/esm/types/index.d.ts +71 -34
- package/esm/types/index.js +84 -47
- package/esm/util/createIframeNode.d.ts +3 -3
- package/esm/util/createIframeNode.js +8 -8
- package/esm/util/index.d.ts +6 -4
- package/esm/util/index.js +22 -5
- package/esm/util/mock.js +1 -2
- package/package.json +1 -1
- package/esm/plugin/component/component.style.js +0 -15
@@ -2,8 +2,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
2
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8
6
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
9
7
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -17,41 +15,26 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
17
15
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
18
16
|
*/
|
19
17
|
/* eslint-disable no-console */
|
20
|
-
import {
|
18
|
+
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID } from "../../constant";
|
21
19
|
import { queryPaymentInfo } from "../../service";
|
22
|
-
import { componentSignEnum, messageName, productSceneEnum,
|
23
|
-
import {
|
20
|
+
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum } from "../../types";
|
21
|
+
import { getType, isJsonString, isPC } from "../../util";
|
24
22
|
import { isLocalMock } from "../../util/mock";
|
25
23
|
import { createIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
26
|
-
import {
|
24
|
+
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
25
|
+
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
27
26
|
var _window = window,
|
28
27
|
innerHeight = _window.innerHeight;
|
29
|
-
var amsSetSize = function amsSetSize(event, dom) {
|
30
|
-
try {
|
31
|
-
var _dom = dom || document.getElementById('ams-component-container');
|
32
|
-
_dom.style.fontSize = "".concat(getDesignFontSize(), "px");
|
33
|
-
innerHeight = window.innerHeight;
|
34
|
-
// eslint-disable-next-line no-empty
|
35
|
-
} catch (error) {}
|
36
|
-
};
|
37
|
-
var addEvent = function addEvent() {
|
38
|
-
window.removeEventListener('resize', amsSetSize);
|
39
|
-
window.removeEventListener('pageShow', amsSetSize);
|
40
|
-
window.removeEventListener('DOMContentLoaded', amsSetSize);
|
41
|
-
window.addEventListener('resize', amsSetSize);
|
42
|
-
window.addEventListener('pageShow', amsSetSize);
|
43
|
-
window.addEventListener('DOMContentLoaded', amsSetSize);
|
44
|
-
};
|
45
|
-
var mockupId = 'ams-component-mockup';
|
46
|
-
var loadingId = 'ams-component-loading';
|
47
|
-
var listenerPrefix = '_ams_sdk_component_listener';
|
48
28
|
var ComponentApp = /*#__PURE__*/function () {
|
49
29
|
function ComponentApp() {
|
50
30
|
_classCallCheck(this, ComponentApp);
|
51
31
|
_defineProperty(this, "app", void 0);
|
52
|
-
_defineProperty(this, "appDomain", void 0);
|
53
32
|
_defineProperty(this, "AMSSDK", void 0);
|
54
33
|
_defineProperty(this, "platform", void 0);
|
34
|
+
_defineProperty(this, "_performanceData", []);
|
35
|
+
_defineProperty(this, "_loadAppPromiseResolve", null);
|
36
|
+
_defineProperty(this, "_isInitComponent", void 0);
|
37
|
+
_defineProperty(this, "appDomain", void 0);
|
55
38
|
_defineProperty(this, "createIframeNode", void 0);
|
56
39
|
_defineProperty(this, "_selector", void 0);
|
57
40
|
_defineProperty(this, "_appVersion", void 0);
|
@@ -59,20 +42,17 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
59
42
|
_defineProperty(this, "_actionQueryPromise", null);
|
60
43
|
_defineProperty(this, "_renderParams", null);
|
61
44
|
_defineProperty(this, "_componentSign", componentSignEnum.NONE);
|
62
|
-
_defineProperty(this, "_performanceData", []);
|
63
|
-
_defineProperty(this, "_isInitComponent", void 0);
|
64
45
|
_defineProperty(this, "_clickEventName", void 0);
|
65
|
-
this
|
46
|
+
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
47
|
+
this._appVersion = '1.5.2';
|
66
48
|
this._isInitComponent = false;
|
67
|
-
this._selector =
|
49
|
+
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
68
50
|
this.createIframeNode = function () {
|
69
51
|
return Promise.resolve();
|
70
52
|
};
|
71
|
-
this.platform = isPC() ?
|
72
|
-
this._clickEventName = this.platform ===
|
53
|
+
this.platform = isPC() ? platformEnum.desktop : platformEnum.mobile;
|
54
|
+
this._clickEventName = this.platform === platformEnum.mobile ? 'touchend' : 'click';
|
73
55
|
this._isRetention = true;
|
74
|
-
addEvent();
|
75
|
-
this.createMountElement();
|
76
56
|
this._performanceData.push({
|
77
57
|
key: 'sdk_init',
|
78
58
|
value: Date.now()
|
@@ -85,7 +65,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
85
65
|
_createClass(ComponentApp, [{
|
86
66
|
key: "logoutPlugin",
|
87
67
|
value: function logoutPlugin() {
|
88
|
-
this.
|
68
|
+
this.cleanContainer(true);
|
89
69
|
}
|
90
70
|
|
91
71
|
/**
|
@@ -103,8 +83,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
103
83
|
*/
|
104
84
|
}, {
|
105
85
|
key: "setRender",
|
106
|
-
value: function setRender(
|
107
|
-
this.createIframeNode =
|
86
|
+
value: function setRender(renderFunc) {
|
87
|
+
this.createIframeNode = renderFunc;
|
108
88
|
}
|
109
89
|
|
110
90
|
/**
|
@@ -113,68 +93,114 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
113
93
|
}, {
|
114
94
|
key: "appendIframeNodes",
|
115
95
|
value: function appendIframeNodes(componentSign, renderParams) {
|
116
|
-
var
|
117
|
-
|
118
|
-
|
96
|
+
var _this = this;
|
97
|
+
if (this._isInitComponent) {
|
98
|
+
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
99
|
+
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
100
|
+
}
|
119
101
|
this._isInitComponent = true;
|
120
102
|
this._renderParams = renderParams;
|
121
103
|
this._componentSign = componentSign;
|
104
|
+
if (renderParams !== null && renderParams !== void 0 && renderParams.selector) this._selector = renderParams.selector;
|
105
|
+
this._renderDisplayType = renderParams.renderDisplayType;
|
106
|
+
var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
|
122
107
|
this._performanceData.push({
|
123
108
|
key: 'sdk_create_component',
|
124
109
|
value: Date.now()
|
125
110
|
});
|
126
|
-
this.
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
111
|
+
this.dispatchToSDK(EVENT.eventCallback.name, {
|
112
|
+
code: eventCodeEnum.SDK_START_OF_LOADING
|
113
|
+
});
|
114
|
+
if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
|
115
|
+
var container = createInlineBaseElement(this._selector);
|
116
|
+
if (container) this.renderInlineLoading(renderParams, container);
|
117
|
+
}
|
118
|
+
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
119
|
+
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
120
|
+
createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
121
|
+
createMockup();
|
122
|
+
this.renderPopupLoading(renderParams);
|
134
123
|
}
|
135
|
-
this.showCashier();
|
136
124
|
this.createApp(renderParams);
|
137
|
-
this.createActionQueryPromise()
|
138
|
-
|
139
|
-
|
140
|
-
})), this._actionQueryPromise]).catch(function () {
|
125
|
+
return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
|
126
|
+
return Promise.resolve();
|
127
|
+
}).catch(function (error) {
|
141
128
|
_this._isInitComponent = false;
|
129
|
+
_this.cleanContainer();
|
130
|
+
return Promise.reject(error);
|
142
131
|
});
|
143
132
|
}
|
133
|
+
}, {
|
134
|
+
key: "renderInlineLoading",
|
135
|
+
value: function renderInlineLoading(renderParams, selector) {
|
136
|
+
var _renderParams$appeara;
|
137
|
+
var showLoading = renderParams === null || renderParams === void 0 ? void 0 : (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
|
138
|
+
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
139
|
+
if (showLoading) addInlineLoading(selector, this.platform);
|
140
|
+
}
|
141
|
+
}, {
|
142
|
+
key: "renderPopupLoading",
|
143
|
+
value: function renderPopupLoading(renderParams) {
|
144
|
+
var _renderParams$appeara2;
|
145
|
+
var showLoading = renderParams === null || renderParams === void 0 ? void 0 : (_renderParams$appeara2 = renderParams.appearance) === null || _renderParams$appeara2 === void 0 ? void 0 : _renderParams$appeara2.showLoading;
|
146
|
+
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
147
|
+
if (!showLoading) return;
|
148
|
+
var mockup = document.getElementById(MOCKUP_ID);
|
149
|
+
if (mockup) mockup.style.display = 'block';
|
150
|
+
addPopupLoading();
|
151
|
+
}
|
152
|
+
}, {
|
153
|
+
key: "_createLoadAppPromise",
|
154
|
+
value: function _createLoadAppPromise() {
|
155
|
+
var _this2 = this;
|
156
|
+
return new Promise(function (resolve, reject) {
|
157
|
+
_this2._loadAppPromiseResolve = resolve;
|
158
|
+
setTimeout(function () {
|
159
|
+
reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
|
160
|
+
}, LOADTIME_LIMIT);
|
161
|
+
}).catch(function (error) {
|
162
|
+
_this2.dispatchToSDK(EVENT.error.name, {
|
163
|
+
code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code,
|
164
|
+
message: ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT.message
|
165
|
+
});
|
166
|
+
return Promise.reject(error);
|
167
|
+
});
|
168
|
+
}
|
169
|
+
|
144
170
|
/**
|
145
171
|
* @description Interface request
|
146
172
|
*/
|
147
173
|
}, {
|
148
174
|
key: "createActionQueryPromise",
|
149
175
|
value: function createActionQueryPromise() {
|
150
|
-
var
|
176
|
+
var _this3 = this;
|
151
177
|
this._performanceData.push({
|
152
178
|
key: 'sdk_action_query_start',
|
153
179
|
value: Date.now()
|
154
180
|
});
|
155
181
|
this._actionQueryPromise = new Promise(function (resolve, reject) {
|
156
|
-
var
|
182
|
+
var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3;
|
157
183
|
var params = {
|
158
|
-
paymentSessionData:
|
159
|
-
paymentSessionConfig: (
|
184
|
+
paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.paymentSessionData) || '',
|
185
|
+
paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 ? void 0 : (_this3$_renderParams3 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.paymentSessionConfig
|
160
186
|
};
|
161
187
|
/**
|
162
188
|
* @description card
|
163
189
|
*/
|
164
|
-
if (componentSignEnum.CASHIER_PAYMENT_CARD ===
|
190
|
+
if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign) {
|
165
191
|
params.paymentMethodType = 'CARD';
|
166
192
|
}
|
167
193
|
/**
|
168
194
|
* @description easyPay
|
169
195
|
*/
|
170
|
-
if (componentSignEnum.EASY_PAY_WALLET ===
|
171
|
-
var
|
196
|
+
if (componentSignEnum.EASY_PAY_WALLET === _this3._componentSign) {
|
197
|
+
var _this3$_renderParams4;
|
172
198
|
var _ref = params.paymentSessionConfig || {},
|
173
199
|
_ref$productSceneVers = _ref.productSceneVersion,
|
174
200
|
productSceneVersion = _ref$productSceneVers === void 0 ? '' : _ref$productSceneVers,
|
175
201
|
_ref$productScene = _ref.productScene,
|
176
202
|
productScene = _ref$productScene === void 0 ? '' : _ref$productScene;
|
177
|
-
var _ref2 = ((
|
203
|
+
var _ref2 = ((_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 ? void 0 : _this3$_renderParams4.paymentSessionMetaData) || {},
|
178
204
|
_ref2$action = _ref2.action,
|
179
205
|
_ref2$action2 = _ref2$action === void 0 ? {} : _ref2$action,
|
180
206
|
_ref2$action2$autoDeb = _ref2$action2.autoDebitWithToken,
|
@@ -191,9 +217,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
191
217
|
* @author tianqiang
|
192
218
|
* @description autoDebit
|
193
219
|
*/
|
194
|
-
if (componentSignEnum.AUTO_DEBIT_WALLET ===
|
195
|
-
var
|
196
|
-
var action = ((
|
220
|
+
if (componentSignEnum.AUTO_DEBIT_WALLET === _this3._componentSign) {
|
221
|
+
var _this3$_renderParams5, _this3$_renderParams6, _action$web, _action$wap;
|
222
|
+
var action = ((_this3$_renderParams5 = _this3._renderParams) === null || _this3$_renderParams5 === void 0 ? void 0 : (_this3$_renderParams6 = _this3$_renderParams5.paymentSessionMetaData) === null || _this3$_renderParams6 === void 0 ? void 0 : _this3$_renderParams6.action) || {};
|
197
223
|
var signType = isPC() ? action === null || action === void 0 ? void 0 : (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 ? void 0 : (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
198
224
|
if (signType === 'SMS') {
|
199
225
|
return resolve({
|
@@ -216,10 +242,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
216
242
|
});
|
217
243
|
}
|
218
244
|
queryPaymentInfo(params, {
|
219
|
-
env:
|
220
|
-
locale:
|
245
|
+
env: _this3.AMSSDK.options.env.environment,
|
246
|
+
locale: _this3.AMSSDK.options.locale
|
221
247
|
}).then(function (res) {
|
222
|
-
|
248
|
+
_this3._performanceData.push({
|
223
249
|
key: 'sdk_action_query_end',
|
224
250
|
value: Date.now()
|
225
251
|
});
|
@@ -227,26 +253,46 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
227
253
|
resolve(res);
|
228
254
|
} else {
|
229
255
|
resolve(res);
|
230
|
-
_this2.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR);
|
231
256
|
}
|
232
257
|
}).catch(function (err) {
|
258
|
+
_this3.dispatchToSDK(EVENT.error.name, {
|
259
|
+
code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
|
260
|
+
});
|
233
261
|
reject(err);
|
234
|
-
_this2.closeCashier();
|
235
262
|
});
|
236
263
|
});
|
264
|
+
return this._actionQueryPromise;
|
237
265
|
}
|
238
266
|
}, {
|
239
|
-
key: "
|
240
|
-
value: function
|
267
|
+
key: "cleanElement",
|
268
|
+
value: function cleanElement() {
|
241
269
|
try {
|
242
|
-
|
243
|
-
|
270
|
+
var _document$getElementB;
|
271
|
+
// selector and container
|
244
272
|
if (getType(this._selector) === 'string') {
|
245
|
-
var
|
246
|
-
if (
|
273
|
+
var selectorDom = document.querySelector(this._selector);
|
274
|
+
if (selectorDom) selectorDom.innerHTML = '';
|
247
275
|
}
|
248
|
-
|
249
|
-
|
276
|
+
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
277
|
+
if (container) container === null || container === void 0 ? void 0 : container.remove();
|
278
|
+
|
279
|
+
// animation
|
280
|
+
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation-style"))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
|
281
|
+
|
282
|
+
// mockup
|
283
|
+
var body = document.getElementsByTagName('body')[0];
|
284
|
+
body.style.overflow = 'auto';
|
285
|
+
var mockup = document.getElementById(MOCKUP_ID);
|
286
|
+
mockup === null || mockup === void 0 ? void 0 : mockup.remove();
|
287
|
+
|
288
|
+
// retentionPopup
|
289
|
+
this.removeRetentionPopup(this.platform);
|
290
|
+
|
291
|
+
// listener
|
292
|
+
this.removeEventListener();
|
293
|
+
} catch (error) {
|
294
|
+
console.error(error);
|
295
|
+
}
|
250
296
|
}
|
251
297
|
|
252
298
|
/**
|
@@ -275,7 +321,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
275
321
|
productSceneVersion: productSceneVersion,
|
276
322
|
extendInfo: extendInfo
|
277
323
|
});
|
278
|
-
this.app = createIframe(this.AMSSDK.options.mode);
|
324
|
+
this.app = createIframe(this.AMSSDK.options.mode, this.platform);
|
279
325
|
this.app.src = getIframeUrl({
|
280
326
|
componentSign: this._componentSign,
|
281
327
|
analytics: this.AMSSDK.options.analytics,
|
@@ -288,7 +334,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
288
334
|
});
|
289
335
|
|
290
336
|
// Subscribe to messages from iframe
|
291
|
-
this.
|
337
|
+
this.addEventListener();
|
292
338
|
} catch (error) {
|
293
339
|
this.dispatchToSDK(EVENT.error.name, Object.assign({}, ERRORMESSAGE.SDK_COMPATIBILITY_ISSUES.FAILED_TO_CREATE_IFRAME, {
|
294
340
|
stack: error
|
@@ -307,6 +353,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
307
353
|
if (data.name !== messageName.APP_TO_SDK && data.name !== messageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId) {
|
308
354
|
return;
|
309
355
|
}
|
356
|
+
// TODO
|
357
|
+
// 如果带有callback标识,则从map结构中取出callbackfunc,执行,执行后在map结构中删除
|
310
358
|
this._handleAppMessage(data);
|
311
359
|
} else {
|
312
360
|
console.warn(ERRORMESSAGE.NOT_JSON_FORMAT);
|
@@ -316,7 +364,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
316
364
|
}, {
|
317
365
|
key: "resizeListener",
|
318
366
|
value: function resizeListener() {
|
319
|
-
var cashier = document.getElementById(
|
367
|
+
var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
|
320
368
|
cashier.style.transition = 'none';
|
321
369
|
this.dispatchToApp({
|
322
370
|
context: {
|
@@ -333,19 +381,19 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
333
381
|
* @description Initialize subscription iframe message
|
334
382
|
*/
|
335
383
|
}, {
|
336
|
-
key: "
|
337
|
-
value: function
|
338
|
-
this.
|
339
|
-
window["".concat(
|
340
|
-
window["".concat(
|
341
|
-
window.addEventListener('message', window["".concat(
|
342
|
-
window.addEventListener('resize', window["".concat(
|
384
|
+
key: "addEventListener",
|
385
|
+
value: function addEventListener() {
|
386
|
+
this.removeEventListener();
|
387
|
+
window["".concat(LISTENER_PREFIX, "_").concat(this.AMSSDK._instanceId)] = this.listener.bind(this);
|
388
|
+
window["".concat(LISTENER_PREFIX, "_").concat(this.AMSSDK._instanceId, "_resize")] = this.resizeListener.bind(this);
|
389
|
+
window.addEventListener('message', window["".concat(LISTENER_PREFIX, "_").concat(this.AMSSDK._instanceId)]);
|
390
|
+
window.addEventListener('resize', window["".concat(LISTENER_PREFIX, "_").concat(this.AMSSDK._instanceId, "_resize")]);
|
343
391
|
}
|
344
392
|
}, {
|
345
|
-
key: "
|
346
|
-
value: function
|
347
|
-
window.removeEventListener('message', window["".concat(
|
348
|
-
window.removeEventListener('resize', window["".concat(
|
393
|
+
key: "removeEventListener",
|
394
|
+
value: function removeEventListener() {
|
395
|
+
window.removeEventListener('message', window["".concat(LISTENER_PREFIX, "_").concat(this.AMSSDK._instanceId)]);
|
396
|
+
window.removeEventListener('resize', window["".concat(LISTENER_PREFIX, "_").concat(this.AMSSDK._instanceId, "_resize")]);
|
349
397
|
}
|
350
398
|
|
351
399
|
/**
|
@@ -354,7 +402,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
354
402
|
}, {
|
355
403
|
key: "_handleAppMessage",
|
356
404
|
value: function _handleAppMessage(data) {
|
357
|
-
var eventKeyMap = [EVENT.launch.name, EVENT.redirect.name, EVENT.sizeChanged.name, EVENT.log.name, EVENT.
|
405
|
+
var eventKeyMap = [EVENT.launch.name, EVENT.redirect.name, EVENT.sizeChanged.name, EVENT.log.name, EVENT.close.name, EVENT.error.name, EVENT.eventCallback.name, EVENT.submitForm.name, EVENT.showCloseButton.name, EVENT.hideCloseButton.name, EVENT.setAllowRetention.name, EVENT.declareCheckoutInfo.name, EVENT.showPopup.name, EVENT.dismissLoading.name];
|
406
|
+
if (!eventKeyMap.includes(data.context.event)) {
|
407
|
+
return;
|
408
|
+
}
|
358
409
|
if (data.context.event === EVENT.dismissLoading.name) {
|
359
410
|
var _data$context$data;
|
360
411
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
@@ -363,21 +414,19 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
363
414
|
});
|
364
415
|
return;
|
365
416
|
}
|
366
|
-
if (!eventKeyMap.includes(data.context.event)) {
|
367
|
-
return;
|
368
|
-
}
|
369
417
|
if (data.context.event === EVENT.launch.name) {
|
370
418
|
this._performanceData.push({
|
371
419
|
key: 'sdk_onLaunch',
|
372
420
|
value: Date.now()
|
373
421
|
});
|
422
|
+
this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
|
374
423
|
this.sendRenderEvent();
|
375
424
|
return;
|
376
425
|
}
|
377
426
|
if (data.context.event === EVENT.sizeChanged.name) {
|
378
427
|
this.handleSizeChanged(data);
|
379
428
|
}
|
380
|
-
if (data.context.event === EVENT.
|
429
|
+
if (data.context.event === EVENT.close.name) {
|
381
430
|
return this.closeBtnFunc();
|
382
431
|
}
|
383
432
|
if (data.context.event === EVENT.redirect.name) {
|
@@ -412,29 +461,29 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
412
461
|
key: "handleSizeChanged",
|
413
462
|
value: function handleSizeChanged(data) {
|
414
463
|
var _data$context$data2;
|
415
|
-
if (((_data$context$data2 = data.context.data) === null || _data$context$data2 === void 0 ? void 0 : _data$context$data2.height)
|
416
|
-
|
417
|
-
|
464
|
+
if (((_data$context$data2 = data.context.data) === null || _data$context$data2 === void 0 ? void 0 : _data$context$data2.height) <= 1) return;
|
465
|
+
var cashier = document.getElementById(COMPONENT_CONTAINER_ID);
|
466
|
+
cashier.style.height = "".concat(data.context.data.height, "px");
|
467
|
+
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
468
|
+
var _document$getElementB2;
|
469
|
+
var mockup = document.getElementById(MOCKUP_ID);
|
418
470
|
if (mockup) {
|
419
|
-
mockup.style.background = '
|
420
|
-
mockup.style.opacity = '0.6';
|
471
|
+
mockup.style.background = 'rgb(0, 0, 0, 0.6)';
|
421
472
|
mockup.style.display = 'block';
|
422
473
|
}
|
423
|
-
(_document$
|
424
|
-
var cashier = document.getElementById('ams-component-container');
|
425
|
-
cashier.style.height = "".concat(data.context.data.height, "px");
|
474
|
+
(_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.remove();
|
426
475
|
if (this.platform === 'desktop') {
|
427
|
-
cashier.classList.add(
|
476
|
+
cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
428
477
|
if (data.context.data.width) cashier.style.width = "".concat(data.context.data.width, "px");
|
429
478
|
}
|
430
479
|
if (this.platform === 'mobile') {
|
431
|
-
cashier.classList.add(
|
432
|
-
var animationStyleId =
|
480
|
+
cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
481
|
+
var animationStyleId = "".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation-style");
|
433
482
|
var animationStyle = document.getElementById(animationStyleId);
|
434
483
|
if (animationStyle) animationStyle === null || animationStyle === void 0 ? void 0 : animationStyle.remove();
|
435
484
|
|
436
485
|
// 弹出和弹入动画
|
437
|
-
var runkeyframes = "
|
486
|
+
var runkeyframes = "@keyframes ".concat(COMPONENT_CONTAINER_ID, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(data.context.data.height, "px;\n }\n }\n @keyframes ").concat(COMPONENT_CONTAINER_ID, "-slide-out {\n 0% {\n height: ").concat(data.context.data.height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
|
438
487
|
// 创建style标签
|
439
488
|
var style = document.createElement('style');
|
440
489
|
style.id = animationStyleId;
|
@@ -450,17 +499,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
450
499
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
451
500
|
}, 500);
|
452
501
|
}
|
453
|
-
this.app.style.height = "".concat(data.context.data.height, "px");
|
454
|
-
this.app.style.width = '100%';
|
455
|
-
this.app.style.border = '0';
|
456
|
-
this.app.style.overflow = 'hidden';
|
457
502
|
}
|
503
|
+
if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
|
504
|
+
var _document$getElementB3;
|
505
|
+
(_document$getElementB3 = document.getElementById(LOADING_ID)) === null || _document$getElementB3 === void 0 ? void 0 : _document$getElementB3.remove();
|
506
|
+
}
|
507
|
+
this.app.style.height = "".concat(data.context.data.height, "px");
|
508
|
+
this.app.style.opacity = '1';
|
458
509
|
}
|
459
510
|
}, {
|
460
511
|
key: "handleRedirect",
|
461
512
|
value: function handleRedirect(data) {
|
462
|
-
var
|
463
|
-
this.closeCashier();
|
513
|
+
var _this4 = this;
|
464
514
|
var _data = typeof data === 'string' ? {
|
465
515
|
normalUrl: data
|
466
516
|
} : {
|
@@ -470,37 +520,38 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
470
520
|
target: data === null || data === void 0 ? void 0 : data.target
|
471
521
|
};
|
472
522
|
var successCallback = function successCallback(type, url) {
|
473
|
-
|
474
|
-
code:
|
523
|
+
_this4.dispatchToSDK(EVENT.eventCallback.name, {
|
524
|
+
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
475
525
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
476
526
|
});
|
477
527
|
};
|
478
528
|
var failCallback = function failCallback() {
|
479
|
-
|
480
|
-
code:
|
529
|
+
_this4.dispatchToSDK(EVENT.eventCallback.name, {
|
530
|
+
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
481
531
|
message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
|
482
532
|
});
|
483
533
|
};
|
484
534
|
|
485
535
|
// 支持 target: _blank,新开tab页打开
|
486
|
-
if (_data.target ===
|
536
|
+
if (_data.target === targetEnum.BLANK) {
|
487
537
|
if (!_data.normalUrl) return failCallback();
|
488
538
|
successCallback('normalUrl', _data.normalUrl);
|
489
539
|
window.open(_data.normalUrl);
|
490
540
|
return;
|
491
541
|
}
|
542
|
+
this.cleanContainer();
|
492
543
|
this.AMSSDK._redirect({
|
493
544
|
applinkUrl: _data === null || _data === void 0 ? void 0 : _data.applinkUrl
|
494
545
|
}).then(function () {
|
495
546
|
successCallback('applinkUrl', _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
496
547
|
}).catch(function () {
|
497
|
-
return
|
548
|
+
return _this4.AMSSDK._redirect({
|
498
549
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
499
550
|
});
|
500
551
|
}).then(function () {
|
501
552
|
successCallback('schemeUrl', _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
502
553
|
}).catch(function () {
|
503
|
-
return
|
554
|
+
return _this4.AMSSDK._redirect({
|
504
555
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
505
556
|
});
|
506
557
|
}).then(function () {
|
@@ -514,59 +565,18 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
514
565
|
value: function handleDeclareInfo(_ref3) {
|
515
566
|
var _ref3$closeDialogData = _ref3.closeDialogData,
|
516
567
|
closeDialogData = _ref3$closeDialogData === void 0 ? {} : _ref3$closeDialogData;
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
if (retentionTitle) {
|
521
|
-
var _closeDialogData$titl, _closeDialogData$titl2, _closeDialogData$titl3;
|
522
|
-
retentionTitle.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$titl = closeDialogData.title) === null || _closeDialogData$titl === void 0 ? void 0 : _closeDialogData$titl.fontSize, "px");
|
523
|
-
retentionTitle.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$titl2 = closeDialogData.title) === null || _closeDialogData$titl2 === void 0 ? void 0 : _closeDialogData$titl2.fontColor;
|
524
|
-
retentionTitle.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$titl3 = closeDialogData.title) === null || _closeDialogData$titl3 === void 0 ? void 0 : _closeDialogData$titl3.text;
|
525
|
-
}
|
526
|
-
var retentionMessage = document.getElementById('ams-component-retention-sub-title');
|
527
|
-
if (retentionMessage) {
|
528
|
-
var _closeDialogData$mess, _closeDialogData$mess2, _closeDialogData$mess3;
|
529
|
-
retentionMessage.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$mess = closeDialogData.message) === null || _closeDialogData$mess === void 0 ? void 0 : _closeDialogData$mess.fontSize, "px");
|
530
|
-
retentionMessage.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$mess2 = closeDialogData.message) === null || _closeDialogData$mess2 === void 0 ? void 0 : _closeDialogData$mess2.fontColor;
|
531
|
-
retentionMessage.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$mess3 = closeDialogData.message) === null || _closeDialogData$mess3 === void 0 ? void 0 : _closeDialogData$mess3.text;
|
532
|
-
}
|
533
|
-
var remainBtn = document.getElementById('ams-component-retention-remain');
|
534
|
-
if (remainBtn) {
|
535
|
-
var _closeDialogData$btnO, _closeDialogData$btnO2, _closeDialogData$btnO3, _closeDialogData$btnO4, _closeDialogData$btnO5, _closeDialogData$btnO7;
|
536
|
-
remainBtn.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO = closeDialogData.btnOK) === null || _closeDialogData$btnO === void 0 ? void 0 : _closeDialogData$btnO.text;
|
537
|
-
remainBtn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO2 = closeDialogData.btnOK) === null || _closeDialogData$btnO2 === void 0 ? void 0 : _closeDialogData$btnO2.fontSize, "px");
|
538
|
-
remainBtn.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO3 = closeDialogData.btnOK) === null || _closeDialogData$btnO3 === void 0 ? void 0 : _closeDialogData$btnO3.fontColor;
|
539
|
-
remainBtn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO4 = closeDialogData.btnOK) === null || _closeDialogData$btnO4 === void 0 ? void 0 : _closeDialogData$btnO4.corner, "px");
|
540
|
-
if ((closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO5 = closeDialogData.btnOK) === null || _closeDialogData$btnO5 === void 0 ? void 0 : _closeDialogData$btnO5.type) === 'stroke') {
|
541
|
-
var _closeDialogData$btnO6;
|
542
|
-
remainBtn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO6 = closeDialogData.btnOK) === null || _closeDialogData$btnO6 === void 0 ? void 0 : _closeDialogData$btnO6.bg);
|
543
|
-
} else remainBtn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO7 = closeDialogData.btnOK) === null || _closeDialogData$btnO7 === void 0 ? void 0 : _closeDialogData$btnO7.bg;
|
544
|
-
}
|
545
|
-
var leaveBrn = document.getElementById('ams-component-retention-leave');
|
546
|
-
if (leaveBrn) {
|
547
|
-
var _closeDialogData$btnC, _closeDialogData$btnC2, _closeDialogData$btnC3, _closeDialogData$btnC4, _closeDialogData$btnC5, _closeDialogData$btnC7;
|
548
|
-
leaveBrn.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC = closeDialogData.btnCancel) === null || _closeDialogData$btnC === void 0 ? void 0 : _closeDialogData$btnC.text;
|
549
|
-
leaveBrn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC2 = closeDialogData.btnCancel) === null || _closeDialogData$btnC2 === void 0 ? void 0 : _closeDialogData$btnC2.fontSize, "px");
|
550
|
-
leaveBrn.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC3 = closeDialogData.btnCancel) === null || _closeDialogData$btnC3 === void 0 ? void 0 : _closeDialogData$btnC3.fontColor;
|
551
|
-
leaveBrn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC4 = closeDialogData.btnCancel) === null || _closeDialogData$btnC4 === void 0 ? void 0 : _closeDialogData$btnC4.corner, "px");
|
552
|
-
if ((closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC5 = closeDialogData.btnCancel) === null || _closeDialogData$btnC5 === void 0 ? void 0 : _closeDialogData$btnC5.type) === 'stroke') {
|
553
|
-
var _closeDialogData$btnC6;
|
554
|
-
leaveBrn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC6 = closeDialogData.btnCancel) === null || _closeDialogData$btnC6 === void 0 ? void 0 : _closeDialogData$btnC6.bg);
|
555
|
-
} else leaveBrn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC7 = closeDialogData.btnCancel) === null || _closeDialogData$btnC7 === void 0 ? void 0 : _closeDialogData$btnC7.bg;
|
556
|
-
}
|
557
|
-
}
|
558
|
-
} catch (error) {
|
559
|
-
console.error(error);
|
560
|
-
}
|
568
|
+
_handleDeclareInfo({
|
569
|
+
closeDialogData: closeDialogData
|
570
|
+
});
|
561
571
|
}
|
562
572
|
}, {
|
563
573
|
key: "handleCloseBtnShow",
|
564
574
|
value: function handleCloseBtnShow(showClose) {
|
565
|
-
var closeBlock = document.getElementById(
|
575
|
+
var closeBlock = document.getElementById(COMPONENT_CLOSE_BLOCK_ID);
|
566
576
|
if (showClose) {
|
567
|
-
closeBlock === null || closeBlock === void 0 ? void 0 : closeBlock.classList.remove(
|
577
|
+
closeBlock === null || closeBlock === void 0 ? void 0 : closeBlock.classList.remove("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
|
568
578
|
} else if (showClose === false) {
|
569
|
-
closeBlock === null || closeBlock === void 0 ? void 0 : closeBlock.classList.add(
|
579
|
+
closeBlock === null || closeBlock === void 0 ? void 0 : closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
|
570
580
|
}
|
571
581
|
}
|
572
582
|
|
@@ -576,7 +586,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
576
586
|
}, {
|
577
587
|
key: "dispatchToSDK",
|
578
588
|
value: function dispatchToSDK(event, data) {
|
579
|
-
this.AMSSDK.
|
589
|
+
this.AMSSDK._eventCenter.emit(event, data);
|
580
590
|
}
|
581
591
|
|
582
592
|
/**
|
@@ -591,9 +601,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
591
601
|
appId: COMPONENTPLUGINID,
|
592
602
|
instanceId: this.AMSSDK._instanceId
|
593
603
|
});
|
604
|
+
// TODO 如果存在回调函数,则增加callBack标识,并存入map。map可以设置
|
594
605
|
if (this.app && this.app.contentWindow) {
|
595
|
-
this.app.contentWindow.postMessage(JSON.stringify(data), this.appDomain);
|
606
|
+
return this.app.contentWindow.postMessage(JSON.stringify(data), this.appDomain);
|
596
607
|
}
|
608
|
+
throw new Error(ERRORMESSAGE.SDK_SUBMIT_ERROR.message);
|
597
609
|
}
|
598
610
|
|
599
611
|
/**
|
@@ -606,7 +618,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
606
618
|
for (var key in eventKeyMap) {
|
607
619
|
// eslint-disable-next-line no-prototype-builtins
|
608
620
|
if (eventKeyMap.hasOwnProperty(key)) {
|
609
|
-
this.AMSSDK.
|
621
|
+
this.AMSSDK._eventCenter.on("".concat(COMPONENTPLUGINID, "-").concat(key), eventKeyMap[key].bind(this));
|
610
622
|
}
|
611
623
|
}
|
612
624
|
}
|
@@ -618,7 +630,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
618
630
|
key: "sendRenderEvent",
|
619
631
|
value: function () {
|
620
632
|
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
621
|
-
var _this$_renderParams, _this$_renderParams2, res;
|
633
|
+
var _this$_renderParams, _this$_renderParams2, _this$_renderParams3, _this$_renderParams4, res;
|
622
634
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
623
635
|
while (1) switch (_context.prev = _context.next) {
|
624
636
|
case 0:
|
@@ -645,6 +657,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
645
657
|
sessionResult: (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData,
|
646
658
|
paymentSessionData: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData,
|
647
659
|
heightOfVisible: Math.max(innerHeight, window.innerHeight),
|
660
|
+
renderDisplayType: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.renderDisplayType,
|
661
|
+
appearance: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.appearance,
|
648
662
|
envInfo: {
|
649
663
|
screenHeight: screen.height,
|
650
664
|
screenWidth: screen.width
|
@@ -677,198 +691,77 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
677
691
|
}
|
678
692
|
return sendRenderEvent;
|
679
693
|
}()
|
680
|
-
}, {
|
681
|
-
key: "showLoading",
|
682
|
-
value: function showLoading() {
|
683
|
-
var loading = document.createElement('div');
|
684
|
-
loading === null || loading === void 0 ? void 0 : loading.classList.add(loadingId);
|
685
|
-
loading.id = loadingId;
|
686
|
-
loading.innerHTML = '<div class="line"><div></div><div></div><div></div><div></div></div>';
|
687
|
-
loading.style.fontSize = "".concat(getDesignFontSize(), "px");
|
688
|
-
var body = document.getElementsByTagName('body')[0];
|
689
|
-
body === null || body === void 0 ? void 0 : body.appendChild(loading);
|
690
|
-
}
|
691
|
-
|
692
|
-
/**
|
693
|
-
* @description show cashier
|
694
|
-
*/
|
695
|
-
}, {
|
696
|
-
key: "showCashier",
|
697
|
-
value: function showCashier() {
|
698
|
-
var cashier = document.getElementById('ams-component-container');
|
699
|
-
cashier === null || cashier === void 0 ? void 0 : cashier.classList.remove("ams-component-container-hidden-".concat(this.platform));
|
700
|
-
cashier === null || cashier === void 0 ? void 0 : cashier.classList.add("ams-component-container-".concat(this.platform));
|
701
|
-
}
|
702
|
-
|
703
694
|
/**
|
704
695
|
* @description close cashier
|
705
696
|
*/
|
706
697
|
}, {
|
707
|
-
key: "
|
708
|
-
value: function
|
709
|
-
var _document$
|
698
|
+
key: "cleanContainer",
|
699
|
+
value: function cleanContainer() {
|
700
|
+
var _document$getElementB4,
|
701
|
+
_this5 = this;
|
710
702
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
703
|
+
this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
|
711
704
|
this._performanceData = [];
|
712
705
|
this._isInitComponent = false;
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
var _this4 = this;
|
720
|
-
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
721
|
-
var container = document.getElementById('ams-component-container');
|
722
|
-
// size变化动画取消
|
723
|
-
container.style.transition = '';
|
724
|
-
container === null || container === void 0 ? void 0 : container.classList.remove("ams-component-container-".concat(this.platform));
|
725
|
-
container === null || container === void 0 ? void 0 : container.classList.remove("ams-component-container-".concat(this.platform, "-animation"));
|
726
|
-
container === null || container === void 0 ? void 0 : container.classList.add("ams-component-container-hidden-".concat(this.platform));
|
727
|
-
var removeMockupAndApp = function removeMockupAndApp() {
|
728
|
-
var _document$getElementB3;
|
729
|
-
var body = document.getElementsByTagName('body')[0];
|
730
|
-
body.style.overflow = 'auto';
|
731
|
-
var mockup = document.getElementById(mockupId);
|
732
|
-
mockup === null || mockup === void 0 ? void 0 : mockup.remove();
|
733
|
-
if (container) container.style.height = '';
|
734
|
-
(_document$getElementB3 = document.getElementById('ams-component-container-mobile-animation-style')) === null || _document$getElementB3 === void 0 ? void 0 : _document$getElementB3.remove();
|
735
|
-
_this4.removeRetentionPopup();
|
736
|
-
_this4.cleanApp();
|
737
|
-
};
|
738
|
-
if (immediately) removeMockupAndApp();else {
|
706
|
+
this.app = null;
|
707
|
+
(_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 ? void 0 : _document$getElementB4.remove();
|
708
|
+
this.hideComponentAnimation();
|
709
|
+
var mockup = document.getElementById(MOCKUP_ID);
|
710
|
+
mockup === null || mockup === void 0 ? void 0 : mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
|
711
|
+
if (immediately) this.cleanElement();else {
|
739
712
|
setTimeout(function () {
|
740
|
-
|
713
|
+
_this5.cleanElement();
|
741
714
|
}, 300);
|
742
715
|
}
|
743
716
|
}
|
717
|
+
}, {
|
718
|
+
key: "hideComponentAnimation",
|
719
|
+
value: function hideComponentAnimation() {
|
720
|
+
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
721
|
+
if (container) {
|
722
|
+
// size变化动画取消
|
723
|
+
container.style.transition = '';
|
724
|
+
container === null || container === void 0 ? void 0 : container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform));
|
725
|
+
container === null || container === void 0 ? void 0 : container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
726
|
+
container === null || container === void 0 ? void 0 : container.classList.add("".concat(COMPONENT_CONTAINER_ID, "-hidden-").concat(this.platform));
|
727
|
+
}
|
728
|
+
}
|
744
729
|
}, {
|
745
730
|
key: "closeBtnFunc",
|
746
731
|
value: function closeBtnFunc() {
|
747
732
|
// element && element.removeEventListener()
|
748
733
|
if (this._isRetention) this.showRetentionPopup();else {
|
749
|
-
this.
|
750
|
-
this.dispatchToSDK(EVENT.
|
751
|
-
}
|
752
|
-
}
|
753
|
-
|
754
|
-
/**
|
755
|
-
* @description create mount node
|
756
|
-
*/
|
757
|
-
}, {
|
758
|
-
key: "createMountElement",
|
759
|
-
value: function createMountElement() {
|
760
|
-
componentAddCSS();
|
761
|
-
var amsComponentContainer = document.createElement('div');
|
762
|
-
amsComponentContainer.className = "ams-component-container-hidden-".concat(this.platform);
|
763
|
-
amsComponentContainer.id = 'ams-component-container';
|
764
|
-
amsSetSize(null, amsComponentContainer);
|
765
|
-
document.body.appendChild(amsComponentContainer);
|
766
|
-
var amsComponentSection = document.createElement('div');
|
767
|
-
amsComponentSection.className = "ams-component-section-".concat(this.platform);
|
768
|
-
amsComponentSection.id = this._selector.slice(1);
|
769
|
-
amsComponentContainer.appendChild(amsComponentSection);
|
770
|
-
this.createCloseBtn();
|
771
|
-
}
|
772
|
-
}, {
|
773
|
-
key: "createCloseBtn",
|
774
|
-
value: function createCloseBtn() {
|
775
|
-
var _this5 = this;
|
776
|
-
var container = document.getElementById('ams-component-container');
|
777
|
-
// close btn
|
778
|
-
var closeBtnHTML = "<img class='asm-component-close-btn-".concat(this.platform, "' src=\"").concat(closeImg, "\"/>");
|
779
|
-
var closeBlock = document.createElement('div');
|
780
|
-
closeBlock.classList.add("asm-component-close-block-".concat(this.platform), 'asm-component-close-block-hidden');
|
781
|
-
closeBlock.id = 'asm-component-section-close-block';
|
782
|
-
closeBlock.innerHTML = closeBtnHTML;
|
783
|
-
closeBlock.addEventListener(this._clickEventName, function () {
|
784
|
-
_this5.closeBtnFunc();
|
785
|
-
});
|
786
|
-
if (container) container.appendChild(closeBlock);
|
787
|
-
}
|
788
|
-
}, {
|
789
|
-
key: "createRetentionPopup",
|
790
|
-
value: function createRetentionPopup() {
|
791
|
-
// retention popup
|
792
|
-
var retentionPopup = document.createElement('div');
|
793
|
-
retentionPopup.id = 'ams-component-retention';
|
794
|
-
retentionPopup.classList.add("ams-component-retention-".concat(this.platform));
|
795
|
-
retentionPopup.innerHTML = "\n <span id=\"ams-component-retention-title\" class=\"ams-component-retention-title-".concat(this.platform, "\">\n Are you sure you want to leave?\n </span>\n <span\n id=\"ams-component-retention-sub-title\"\n class=\"ams-component-retention-sub-title-").concat(this.platform, "\"\n >\n If you leave this page, you'll have to start over again.\n </span>\n <div class=\"ams-component-retention-btn-block-").concat(this.platform, "\">\n <div id=\"ams-component-retention-remain\" class=\"ams-component-retention-remain-").concat(this.platform, "\">\n Continue Payment\n </div>\n <div id=\"ams-component-retention-leave\" class=\"ams-component-retention-leave-").concat(this.platform, "\">\n Leave\n </div>\n </div>");
|
796
|
-
document.body.appendChild(retentionPopup);
|
797
|
-
var remainBtn = document.getElementById('ams-component-retention-remain');
|
798
|
-
if (remainBtn) {
|
799
|
-
remainBtn.addEventListener(this._clickEventName, this.hideRetentionPopup.bind(this));
|
800
|
-
}
|
801
|
-
var leaveBtn = document.getElementById('ams-component-retention-leave');
|
802
|
-
if (leaveBtn) {
|
803
|
-
leaveBtn.addEventListener(this._clickEventName, this.retentionPopupLeaveFunc.bind(this));
|
734
|
+
this.cleanContainer();
|
735
|
+
this.dispatchToSDK(EVENT.close.name, {});
|
804
736
|
}
|
805
737
|
}
|
806
738
|
}, {
|
807
739
|
key: "retentionPopupLeaveFunc",
|
808
740
|
value: function retentionPopupLeaveFunc() {
|
809
|
-
this.dispatchToSDK(EVENT.
|
810
|
-
this.
|
811
|
-
this.
|
741
|
+
this.dispatchToSDK(EVENT.close.name, {});
|
742
|
+
this.hideRetentionPopupFunc();
|
743
|
+
this.cleanContainer();
|
812
744
|
}
|
813
745
|
}, {
|
814
746
|
key: "removeRetentionPopup",
|
815
|
-
value: function removeRetentionPopup() {
|
816
|
-
|
817
|
-
var remainBtn = document.getElementById('ams-component-retention-remain');
|
818
|
-
if (remainBtn) {
|
819
|
-
remainBtn.removeEventListener(this._clickEventName, this.hideRetentionPopup);
|
820
|
-
}
|
821
|
-
var leaveBtn = document.getElementById('ams-component-retention-leave');
|
822
|
-
if (leaveBtn) {
|
823
|
-
leaveBtn.removeEventListener(this._clickEventName, this.retentionPopupLeaveFunc);
|
824
|
-
}
|
825
|
-
(_document$getElementB4 = document.getElementById('ams-component-retention')) === null || _document$getElementB4 === void 0 ? void 0 : _document$getElementB4.remove();
|
747
|
+
value: function removeRetentionPopup(platform) {
|
748
|
+
_removeRetentionPopup(platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
826
749
|
}
|
827
750
|
}, {
|
828
751
|
key: "showRetentionPopup",
|
829
752
|
value: function showRetentionPopup() {
|
830
|
-
var retentionPopup = document.getElementById(
|
831
|
-
var container = document.getElementById(
|
832
|
-
if (retentionPopup) {
|
833
|
-
container === null || container === void 0 ? void 0 : container.classList.add('ams-component-container-opacity');
|
834
|
-
retentionPopup.classList.remove('ams-component-retention-hidden');
|
835
|
-
retentionPopup.classList.add('ams-component-retention-show');
|
836
|
-
}
|
837
|
-
}
|
838
|
-
}, {
|
839
|
-
key: "hideRetentionPopup",
|
840
|
-
value: function hideRetentionPopup() {
|
841
|
-
var retentionPopup = document.getElementById('ams-component-retention');
|
842
|
-
var container = document.getElementById('ams-component-container');
|
753
|
+
var retentionPopup = document.getElementById(COMPONENT_RETENTION_ID);
|
754
|
+
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
843
755
|
if (retentionPopup) {
|
844
|
-
|
845
|
-
retentionPopup.classList.
|
846
|
-
|
847
|
-
retentionPopup.classList.remove('ams-component-retention-hidden');
|
848
|
-
container === null || container === void 0 ? void 0 : container.classList.remove('ams-component-container-opacity');
|
849
|
-
}, 250);
|
756
|
+
container === null || container === void 0 ? void 0 : container.classList.add("".concat(COMPONENT_CONTAINER_ID, "-opacity"));
|
757
|
+
retentionPopup.classList.remove("".concat(COMPONENT_RETENTION_ID, "-hidden"));
|
758
|
+
retentionPopup.classList.add("".concat(COMPONENT_RETENTION_ID, "-show"));
|
850
759
|
}
|
851
760
|
}
|
852
|
-
/**
|
853
|
-
* @description create mockup
|
854
|
-
*/
|
855
761
|
}, {
|
856
|
-
key: "
|
857
|
-
value: function
|
858
|
-
|
859
|
-
body.style.overflow = 'hidden';
|
860
|
-
var mockup = document.createElement('div');
|
861
|
-
mockup.style.width = '100vw';
|
862
|
-
mockup.style.height = '100vh';
|
863
|
-
mockup.style.position = 'fixed';
|
864
|
-
mockup.style.top = '0';
|
865
|
-
mockup.style.left = '0';
|
866
|
-
mockup.style.zIndex = '1000';
|
867
|
-
mockup.style.background = '#ffffff';
|
868
|
-
mockup.style.opacity = '0.5';
|
869
|
-
mockup.style.display = 'none';
|
870
|
-
mockup.id = mockupId;
|
871
|
-
body.appendChild(mockup);
|
762
|
+
key: "hideRetentionPopupFunc",
|
763
|
+
value: function hideRetentionPopupFunc() {
|
764
|
+
hideRetentionPopup();
|
872
765
|
}
|
873
766
|
}, {
|
874
767
|
key: "submitForm",
|
@@ -889,7 +782,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
889
782
|
form.setAttribute('action', attributes.action);
|
890
783
|
form.setAttribute('method', 'post');
|
891
784
|
body.appendChild(form);
|
892
|
-
this.closeCashier(true);
|
893
785
|
setTimeout(function () {
|
894
786
|
form.submit();
|
895
787
|
}, 0);
|