@alipay/ams-checkout 0.0.1693912790-dev.3 → 0.0.1694400497-dev.1
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 -16
- package/esm/core/component/index.js +155 -44
- package/esm/core/drop-in/index.d.ts +4 -11
- package/esm/core/drop-in/index.js +19 -19
- package/esm/core/instance/index.d.ts +6 -15
- package/esm/core/instance/index.js +32 -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 +2 -2
- 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 +165 -0
- package/esm/plugin/component/index.d.ts +26 -33
- package/esm/plugin/component/index.js +243 -396
- package/esm/plugin/drop-in/index.d.ts +7 -9
- package/esm/plugin/drop-in/index.js +4 -3
- package/esm/request/index.d.ts +2 -9
- package/esm/request/index.js +15 -28
- package/esm/request/utils.d.ts +4 -4
- package/esm/request/utils.js +6 -4
- package/esm/service/index.d.ts +2 -2
- package/esm/types/index.d.ts +78 -51
- package/esm/types/index.js +85 -48
- package/esm/util/createIframeNode.d.ts +3 -3
- package/esm/util/createIframeNode.js +15 -8
- package/esm/util/get.js +7 -0
- package/esm/util/index.d.ts +8 -6
- package/esm/util/index.js +25 -11
- package/esm/util/mock.js +1 -2
- package/package.json +1 -1
- package/esm/plugin/component/component.style.js +0 -15
- package/esm/util/security.d.ts +0 -12
- package/esm/util/security.js +0 -107
@@ -8,10 +8,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
8
8
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
9
9
|
* 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.
|
10
10
|
*/
|
11
|
-
|
11
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
12
12
|
import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
13
13
|
import CheckoutApp from "../../plugin/drop-in";
|
14
|
-
import { messageName,
|
14
|
+
import { messageName, networkModeEnum } from "../../types";
|
15
15
|
import { createIframeNode } from "../../util/createIframeNode";
|
16
16
|
export var mixinDropInConstructor = function mixinDropInConstructor(options, context) {
|
17
17
|
// Instantiate the plug-in and set render
|
@@ -28,7 +28,7 @@ export var mixinDropInConstructor = function mixinDropInConstructor(options, con
|
|
28
28
|
*/
|
29
29
|
export var createPayment = function createPayment(params) {
|
30
30
|
var _this = this;
|
31
|
-
if (this.options.networkMode ===
|
31
|
+
if (this.options.networkMode === networkModeEnum.proxy) {
|
32
32
|
return new Promise(function (resolve, reject) {
|
33
33
|
try {
|
34
34
|
var checkoutApp = _this._getPlugin(BASEPLUGINID);
|
@@ -38,7 +38,7 @@ export var createPayment = function createPayment(params) {
|
|
38
38
|
}
|
39
39
|
});
|
40
40
|
} else {
|
41
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.
|
41
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
42
42
|
return Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT);
|
43
43
|
}
|
44
44
|
};
|
@@ -49,8 +49,8 @@ export var createPayment = function createPayment(params) {
|
|
49
49
|
export var confirmPayment = function confirmPayment(result) {
|
50
50
|
var _this2 = this;
|
51
51
|
return new Promise(function (resolve, reject) {
|
52
|
-
_this2.eventCenter.once('onRedirect', function (
|
53
|
-
_this2._redirect(
|
52
|
+
_this2.eventCenter.once('onRedirect', function (payload) {
|
53
|
+
_this2._redirect(payload).then(function () {
|
54
54
|
resolve();
|
55
55
|
}).catch(function (err) {
|
56
56
|
reject(err);
|
@@ -73,21 +73,21 @@ export var confirmPayment = function confirmPayment(result) {
|
|
73
73
|
*/
|
74
74
|
export var _subscribeFromCheckoutPlugin = function _subscribeFromCheckoutPlugin() {
|
75
75
|
var _this3 = this;
|
76
|
-
var eventKeyMap = new Map([[EVENT.error.name, function (
|
77
|
-
_this3.eventCenter.emit(EVENT.error.name,
|
78
|
-
}], [EVENT.ready.name, function (
|
79
|
-
_this3.eventCenter.emit(EVENT.ready.name,
|
80
|
-
}], [EVENT.redirect.name, function (
|
81
|
-
_this3.eventCenter.emit(EVENT.redirect.name,
|
82
|
-
}], [EVENT.paymentMethodSelected.name, function (
|
83
|
-
_this3.checkoutState.paymentMethodType =
|
76
|
+
var eventKeyMap = new Map([[EVENT.error.name, function (payload) {
|
77
|
+
_this3.eventCenter.emit(EVENT.error.name, payload.context.data);
|
78
|
+
}], [EVENT.ready.name, function (payload) {
|
79
|
+
_this3.eventCenter.emit(EVENT.ready.name, payload.context.data);
|
80
|
+
}], [EVENT.redirect.name, function (payload) {
|
81
|
+
_this3.eventCenter.emit(EVENT.redirect.name, payload.context.data);
|
82
|
+
}], [EVENT.paymentMethodSelected.name, function (payload) {
|
83
|
+
_this3.checkoutState.paymentMethodType = payload.context.data.paymentMethodType;
|
84
84
|
_this3.eventCenter.emit(EVENT.paymentMethodSelected.name, {
|
85
|
-
paymentMethodType:
|
85
|
+
paymentMethodType: payload.context.data.paymentMethodType
|
86
86
|
});
|
87
|
-
}], [EVENT.sizeChanged.name, function (
|
88
|
-
_this3.eventCenter.emit(EVENT.sizeChanged.name,
|
89
|
-
}], [EVENT.log.name, function (
|
90
|
-
_this3.eventCenter.emit(EVENT.log.name,
|
87
|
+
}], [EVENT.sizeChanged.name, function (payload) {
|
88
|
+
_this3.eventCenter.emit(EVENT.sizeChanged.name, payload.context.data);
|
89
|
+
}], [EVENT.log.name, function (payload) {
|
90
|
+
_this3.eventCenter.emit(EVENT.log.name, payload.context.data);
|
91
91
|
}]]);
|
92
92
|
var _iterator = _createForOfIteratorHelper(eventKeyMap.keys()),
|
93
93
|
_step;
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import type { AMSCheckoutOptions,
|
1
|
+
import type { AMSCheckoutOptions, IcheckoutState, IoptionsParams } from '../../types/index';
|
2
2
|
import { EventCenter } from '../../util/index';
|
3
3
|
export default class AMSSDK {
|
4
4
|
options: AMSCheckoutOptions;
|
5
|
-
checkoutState:
|
6
|
-
|
5
|
+
checkoutState: IcheckoutState;
|
6
|
+
_eventCenter: EventCenter;
|
7
7
|
protected plugins: Map<string, any>;
|
8
8
|
_instanceId: string;
|
9
|
-
constructor(options:
|
9
|
+
constructor(options: IoptionsParams);
|
10
10
|
/**
|
11
11
|
* @description Destroy and process some contents of the plug-in
|
12
12
|
*/
|
13
|
-
|
13
|
+
unmount(): void;
|
14
14
|
/**
|
15
15
|
* @description Set the sdk basic configuration
|
16
16
|
*/
|
@@ -34,7 +34,7 @@ export default class AMSSDK {
|
|
34
34
|
/**
|
35
35
|
* @description Get Plug-in
|
36
36
|
*/
|
37
|
-
_getPlugin(pluginId: string): any;
|
37
|
+
protected _getPlugin(pluginId: string): any;
|
38
38
|
/**
|
39
39
|
* @description Execute to open app or jump link
|
40
40
|
*/
|
@@ -47,13 +47,4 @@ export default class AMSSDK {
|
|
47
47
|
* @description Overlay Subscription
|
48
48
|
*/
|
49
49
|
protected _overrideSubscription(name: string, func: any, funcKey: string): void;
|
50
|
-
/**
|
51
|
-
* @description Create an event handler, called when an error occurs in AMSCheckout.
|
52
|
-
*/
|
53
|
-
onError(event: callOnError): void;
|
54
|
-
/**
|
55
|
-
* @description Create an event handler
|
56
|
-
*/
|
57
|
-
onSizeChanged(event: callOnSizeChanged): void;
|
58
|
-
onLog(event: callOnLog): void;
|
59
50
|
}
|
@@ -15,9 +15,10 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
15
15
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
16
16
|
* 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.
|
17
17
|
*/
|
18
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
18
19
|
import { v4 as uuid } from 'uuid';
|
19
20
|
import { ERRORMESSAGE, EVENT } from "../../constant";
|
20
|
-
import {
|
21
|
+
import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, terminalTypeEnum } from "../../types/index";
|
21
22
|
import { device, EventCenter, getType, queryParse } from "../../util/index";
|
22
23
|
import CallApp from "../../util/intl-callapp/es/main";
|
23
24
|
var AMSSDK = /*#__PURE__*/function () {
|
@@ -25,16 +26,13 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
25
26
|
_classCallCheck(this, AMSSDK);
|
26
27
|
_defineProperty(this, "options", void 0);
|
27
28
|
_defineProperty(this, "checkoutState", void 0);
|
28
|
-
_defineProperty(this, "
|
29
|
+
_defineProperty(this, "_eventCenter", void 0);
|
29
30
|
_defineProperty(this, "plugins", void 0);
|
30
31
|
_defineProperty(this, "_instanceId", void 0);
|
31
32
|
this._instanceId = uuid();
|
32
33
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
33
34
|
this.options = {};
|
34
|
-
this.
|
35
|
-
this.checkoutState = {
|
36
|
-
paymentMethodType: ''
|
37
|
-
};
|
35
|
+
this._eventCenter = new EventCenter();
|
38
36
|
this._initEvent(options);
|
39
37
|
this._setOptions(options);
|
40
38
|
this.plugins = new Map();
|
@@ -43,8 +41,8 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
43
41
|
* @description Destroy and process some contents of the plug-in
|
44
42
|
*/
|
45
43
|
_createClass(AMSSDK, [{
|
46
|
-
key: "
|
47
|
-
value: function
|
44
|
+
key: "unmount",
|
45
|
+
value: function unmount() {
|
48
46
|
var _iterator = _createForOfIteratorHelper(this.plugins.values()),
|
49
47
|
_step;
|
50
48
|
try {
|
@@ -53,7 +51,9 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
53
51
|
try {
|
54
52
|
plugin.logoutPlugin();
|
55
53
|
// eslint-disable-next-line no-empty
|
56
|
-
} catch (error) {
|
54
|
+
} catch (error) {
|
55
|
+
console.error(error);
|
56
|
+
}
|
57
57
|
}
|
58
58
|
} catch (err) {
|
59
59
|
_iterator.e(err);
|
@@ -79,17 +79,17 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
79
79
|
value: function _setEnv(options) {
|
80
80
|
var _queryParse = queryParse(),
|
81
81
|
_moreEnv = _queryParse._moreEnv;
|
82
|
-
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in
|
83
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.
|
82
|
+
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in environmentEnum) && _moreEnv !== 'true') {
|
83
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.message);
|
84
84
|
options.environment = 'prod';
|
85
85
|
}
|
86
86
|
this.options.env = {
|
87
|
-
terminalType: device.isMobile ?
|
87
|
+
terminalType: device.isMobile ? terminalTypeEnum.WAP : terminalTypeEnum.WEB,
|
88
88
|
environment: (options === null || options === void 0 ? void 0 : options.environment) || 'prod'
|
89
89
|
};
|
90
|
-
if (this.options.env.terminalType ===
|
90
|
+
if (this.options.env.terminalType === terminalTypeEnum.WAP) {
|
91
91
|
// eslint-disable-next-line no-nested-ternary
|
92
|
-
this.options.env.osType = device.iOS ?
|
92
|
+
this.options.env.osType = device.iOS ? osTypeEnum.IOS : device.Android ? osTypeEnum.ANDROID : osTypeEnum.ELSE;
|
93
93
|
}
|
94
94
|
}
|
95
95
|
/**
|
@@ -98,15 +98,15 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
98
98
|
}, {
|
99
99
|
key: "_setMode",
|
100
100
|
value: function _setMode(options) {
|
101
|
-
this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) ||
|
102
|
-
if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in
|
103
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.
|
104
|
-
this.options.mode =
|
101
|
+
this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || modeEnum.component;
|
102
|
+
if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in modeEnum)) {
|
103
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.message);
|
104
|
+
this.options.mode = modeEnum.component;
|
105
105
|
}
|
106
|
-
this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) ||
|
107
|
-
if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in
|
108
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.
|
109
|
-
this.options.networkMode =
|
106
|
+
this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) || networkModeEnum.session;
|
107
|
+
if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in networkModeEnum)) {
|
108
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
109
|
+
this.options.networkMode = networkModeEnum.proxy;
|
110
110
|
}
|
111
111
|
}
|
112
112
|
/**
|
@@ -116,28 +116,28 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
116
116
|
key: "_initEvent",
|
117
117
|
value: function _initEvent(options) {
|
118
118
|
if (options !== null && options !== void 0 && options.onError) {
|
119
|
-
if (getType(options.onError) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.
|
119
|
+
if (getType(options.onError) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
120
120
|
this._overrideSubscription(EVENT.error.name, options.onError, EVENT.error.uniqueKey);
|
121
121
|
}
|
122
122
|
if (options !== null && options !== void 0 && options.onPaymentMethodSelected) {
|
123
|
-
if (getType(options.onPaymentMethodSelected) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.
|
123
|
+
if (getType(options.onPaymentMethodSelected) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
124
124
|
this._overrideSubscription(EVENT.paymentMethodSelected.name, options.onPaymentMethodSelected, EVENT.paymentMethodSelected.uniqueKey);
|
125
125
|
}
|
126
126
|
if (options !== null && options !== void 0 && options.onSizeChanged) {
|
127
|
-
if (getType(options.onSizeChanged) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.
|
127
|
+
if (getType(options.onSizeChanged) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
128
128
|
this._overrideSubscription(EVENT.sizeChanged.name, options.onSizeChanged, EVENT.sizeChanged.uniqueKey);
|
129
129
|
}
|
130
130
|
if (options !== null && options !== void 0 && options.onLog) {
|
131
|
-
if (getType(options.onLog) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.
|
131
|
+
if (getType(options.onLog) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
132
132
|
this._overrideSubscription(EVENT.log.name, options.onLog, EVENT.log.uniqueKey);
|
133
133
|
}
|
134
134
|
if (options !== null && options !== void 0 && options.onEventCallback) {
|
135
|
-
if (getType(options.onEventCallback) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.
|
135
|
+
if (getType(options.onEventCallback) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
136
136
|
this._overrideSubscription(EVENT.eventCallback.name, options.onEventCallback, EVENT.eventCallback.uniqueKey);
|
137
137
|
}
|
138
138
|
if (options !== null && options !== void 0 && options.onClose) {
|
139
|
-
if (getType(options.onClose) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.
|
140
|
-
this._overrideSubscription(EVENT.
|
139
|
+
if (getType(options.onClose) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
140
|
+
this._overrideSubscription(EVENT.close.name, options.onClose, EVENT.close.uniqueKey);
|
141
141
|
}
|
142
142
|
}
|
143
143
|
/**
|
@@ -175,7 +175,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
175
175
|
value: function _redirect(data) {
|
176
176
|
var _this = this;
|
177
177
|
return new Promise(function (resolve, reject) {
|
178
|
-
var isWeb = _this.options.env.terminalType ===
|
178
|
+
var isWeb = _this.options.env.terminalType === terminalTypeEnum.WEB;
|
179
179
|
var normalUrl = (data === null || data === void 0 ? void 0 : data.normalUrl) || '';
|
180
180
|
var schemeUrl = (data === null || data === void 0 ? void 0 : data.schemeUrl) || '';
|
181
181
|
var applinkUrl = (data === null || data === void 0 ? void 0 : data.applinkUrl) || '';
|
@@ -224,29 +224,8 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
224
224
|
}, {
|
225
225
|
key: "_overrideSubscription",
|
226
226
|
value: function _overrideSubscription(name, func, funcKey) {
|
227
|
-
this.
|
228
|
-
this.
|
229
|
-
}
|
230
|
-
/**
|
231
|
-
* @description Create an event handler, called when an error occurs in AMSCheckout.
|
232
|
-
*/
|
233
|
-
}, {
|
234
|
-
key: "onError",
|
235
|
-
value: function onError(event) {
|
236
|
-
this._overrideSubscription(EVENT.error.name, event, EVENT.error.uniqueKey);
|
237
|
-
}
|
238
|
-
/**
|
239
|
-
* @description Create an event handler
|
240
|
-
*/
|
241
|
-
}, {
|
242
|
-
key: "onSizeChanged",
|
243
|
-
value: function onSizeChanged(event) {
|
244
|
-
this._overrideSubscription(EVENT.sizeChanged.name, event, EVENT.sizeChanged.uniqueKey);
|
245
|
-
}
|
246
|
-
}, {
|
247
|
-
key: "onLog",
|
248
|
-
value: function onLog(event) {
|
249
|
-
this._overrideSubscription(EVENT.log.name, event, EVENT.log.uniqueKey);
|
227
|
+
this._eventCenter.off(name, func, funcKey);
|
228
|
+
this._eventCenter.on(name, func, funcKey);
|
250
229
|
}
|
251
230
|
}]);
|
252
231
|
return AMSSDK;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<svg width="740" height="360" viewBox="0 0 740 360" fill="none" xmlns="">
|
2
|
+
<rect width="740" height="360" rx="12" fill="#F6F6F6"/>
|
3
|
+
<rect opacity="0.7" x="44" y="44" width="32" height="32" rx="4" fill="#E1E6ED"/>
|
4
|
+
<rect opacity="0.7" x="94" y="44" width="32" height="32" rx="4" fill="#E1E6ED"/>
|
5
|
+
<rect opacity="0.7" x="144" y="44" width="32" height="32" rx="4" fill="#E1E6ED"/>
|
6
|
+
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
7
|
+
<path d="M136 100H48C43.5817 100 40 103.582 40 108C40 112.418 43.5817 116 48 116H136C140.418 116 144 112.418 144 108C144 103.582 140.418 100 136 100Z" fill="#E1E6ED"/>
|
8
|
+
</g>
|
9
|
+
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
10
|
+
<path d="M682 126H58C48.0589 126 40 134.059 40 144C40 153.941 48.0589 162 58 162H682C691.941 162 700 153.941 700 144C700 134.059 691.941 126 682 126Z" fill="#E1E6ED"/>
|
11
|
+
</g>
|
12
|
+
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
13
|
+
<path d="M682 182H58C48.0589 182 40 190.059 40 200C40 209.941 48.0589 218 58 218H682C691.941 218 700 209.941 700 200C700 190.059 691.941 182 682 182Z" fill="#E1E6ED"/>
|
14
|
+
</g>
|
15
|
+
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
16
|
+
<path d="M504 274H64C52.9543 274 44 282.954 44 294C44 305.046 52.9543 314 64 314H504C515.046 314 524 305.046 524 294C524 282.954 515.046 274 504 274Z" fill="#E1E6ED"/>
|
17
|
+
</g>
|
18
|
+
</svg>
|
package/esm/index.d.ts
CHANGED
@@ -5,18 +5,12 @@
|
|
5
5
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
6
6
|
* 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.
|
7
7
|
*/
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import AMSSDK from './core/instance';
|
11
|
-
import { optionsParams } from './types';
|
8
|
+
import { AMSComponent } from './core/component/index';
|
9
|
+
import { IoptionsParams } from './types';
|
12
10
|
export * from './types';
|
13
|
-
export declare class AMSCheckout extends
|
14
|
-
createComponent: IcreateComponentFunc;
|
15
|
-
createPayment: IcreatePaymentFunc;
|
16
|
-
confirmPayment: IconfirmPaymentFunc;
|
17
|
-
constructor(options: optionsParams);
|
11
|
+
export declare class AMSCheckout extends AMSComponent {
|
18
12
|
}
|
19
13
|
export declare class AMSAutoDebit extends AMSCheckout {
|
20
|
-
constructor(options:
|
14
|
+
constructor(options: IoptionsParams);
|
21
15
|
}
|
22
16
|
export default AMSCheckout;
|
package/esm/index.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
2
2
|
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); } }
|
3
3
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
5
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
4
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
5
7
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
6
8
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
@@ -9,9 +11,6 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
9
11
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
10
12
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
11
13
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
12
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
13
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
14
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
15
14
|
/**
|
16
15
|
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
17
16
|
*
|
@@ -19,38 +18,17 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
19
18
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
20
19
|
* 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.
|
21
20
|
*/
|
22
|
-
import {
|
23
|
-
import { confirmPayment, createPayment, mixinDropInConstructor, _subscribeFromCheckoutPlugin } from "./core/drop-in/index";
|
24
|
-
import AMSSDK from "./core/instance";
|
21
|
+
import { AMSComponent } from "./core/component/index";
|
25
22
|
export * from "./types";
|
26
|
-
export var AMSCheckout = /*#__PURE__*/function (
|
27
|
-
_inherits(AMSCheckout,
|
23
|
+
export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
24
|
+
_inherits(AMSCheckout, _AMSComponent);
|
28
25
|
var _super = _createSuper(AMSCheckout);
|
29
|
-
function AMSCheckout(
|
30
|
-
var _this;
|
26
|
+
function AMSCheckout() {
|
31
27
|
_classCallCheck(this, AMSCheckout);
|
32
|
-
|
33
|
-
_defineProperty(_assertThisInitialized(_this), "createComponent", void 0);
|
34
|
-
_defineProperty(_assertThisInitialized(_this), "createPayment", void 0);
|
35
|
-
_defineProperty(_assertThisInitialized(_this), "confirmPayment", void 0);
|
36
|
-
Object.defineProperty(_assertThisInitialized(_this), 'createComponent', {
|
37
|
-
value: createComponent
|
38
|
-
});
|
39
|
-
Object.defineProperty(_assertThisInitialized(_this), 'createPayment', {
|
40
|
-
value: createPayment
|
41
|
-
});
|
42
|
-
Object.defineProperty(_assertThisInitialized(_this), 'confirmPayment', {
|
43
|
-
value: confirmPayment
|
44
|
-
});
|
45
|
-
Object.defineProperty(_assertThisInitialized(_this), '_subscribeFromCheckoutPlugin', {
|
46
|
-
value: _subscribeFromCheckoutPlugin
|
47
|
-
});
|
48
|
-
mixinComponentConstructor(options, _assertThisInitialized(_this));
|
49
|
-
mixinDropInConstructor(options, _assertThisInitialized(_this));
|
50
|
-
return _this;
|
28
|
+
return _super.apply(this, arguments);
|
51
29
|
}
|
52
30
|
return _createClass(AMSCheckout);
|
53
|
-
}(
|
31
|
+
}(AMSComponent);
|
54
32
|
export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
55
33
|
_inherits(AMSAutoDebit, _AMSCheckout);
|
56
34
|
var _super2 = _createSuper(AMSAutoDebit);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { componentSignEnum, Ianalytics } from '../../types';
|
2
|
-
export declare const getAppPath: (environment: string, appVersion: string, componentSign: componentSignEnum, productSceneVersion: string, extendInfo: string) => any;
|
2
|
+
export declare const getAppPath: (environment: string | undefined, appVersion: string, componentSign: componentSignEnum, productSceneVersion: string, extendInfo: string) => any;
|
3
3
|
export declare const getAppDomain: (domainParams: {
|
4
4
|
environment: string;
|
5
5
|
appVersion: string;
|
@@ -20,4 +20,4 @@ export declare const getIframeUrl: (iframeParams: {
|
|
20
20
|
/**
|
21
21
|
* @description Create iframe
|
22
22
|
*/
|
23
|
-
export declare const createIframe: (mode: string) => HTMLIFrameElement;
|
23
|
+
export declare const createIframe: (mode: string, platform: 'mobile' | 'desktop') => HTMLIFrameElement;
|
@@ -85,38 +85,39 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
85
85
|
locale: locale,
|
86
86
|
scale: scale,
|
87
87
|
instanceId: instanceId,
|
88
|
-
sandbox: environment === 'light_sandbox' || _light_sandbox === 'true' ? 'true' : 'false',
|
89
88
|
analyticsEnabled: (analytics === null || analytics === void 0 ? void 0 : analytics.enabled) === false ? 'false' : 'true',
|
90
89
|
sdkVersion: sdkVersion,
|
91
|
-
refUrl: window.location.href
|
92
|
-
shadow: environment === 'sandbox' || _sandbox === 'true' ? 'true' : 'false',
|
93
|
-
requestHost: requestHost,
|
94
|
-
groupId: groupId,
|
95
|
-
LOCAL_MOCK: LOCAL_MOCK
|
90
|
+
refUrl: window.location.href
|
96
91
|
});
|
92
|
+
if (LOCAL_MOCK) urlParams.LOCAL_MOCK = LOCAL_MOCK;
|
93
|
+
if (requestHost) urlParams.requestHost = requestHost;
|
94
|
+
if (groupId) urlParams.groupId = groupId;
|
95
|
+
if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
|
96
|
+
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
97
97
|
var locationSearch = serialize(urlParams);
|
98
98
|
return "".concat(path, "?").concat(locationSearch);
|
99
99
|
};
|
100
|
-
var getIframeId = function getIframeId(UIMode) {
|
101
|
-
var IdMap = {
|
102
|
-
dropin: 'checkout-dropin',
|
103
|
-
component: 'checkout-component'
|
104
|
-
};
|
105
|
-
return IdMap[UIMode] || 'checkout-component';
|
106
|
-
};
|
107
100
|
|
108
101
|
/**
|
109
102
|
* @description Create iframe
|
110
103
|
*/
|
111
|
-
export var createIframe = function createIframe(mode) {
|
104
|
+
export var createIframe = function createIframe(mode, platform) {
|
105
|
+
var getIframeId = function getIframeId() {
|
106
|
+
var IdMap = {
|
107
|
+
dropin: "ams-checkout-dropin-".concat(platform),
|
108
|
+
component: "ams-checkout-component-".concat(platform)
|
109
|
+
};
|
110
|
+
return IdMap[mode] || 'ams-checkout-component';
|
111
|
+
};
|
112
112
|
var iframe = document.createElement('iframe');
|
113
|
-
var iframeId = getIframeId(
|
113
|
+
var iframeId = getIframeId();
|
114
114
|
var none = '0';
|
115
115
|
var width = '100%';
|
116
116
|
iframe.id = iframeId;
|
117
117
|
iframe.style.height = none;
|
118
118
|
iframe.style.width = width;
|
119
119
|
iframe.style.border = none;
|
120
|
+
iframe.style.opacity = none;
|
120
121
|
iframe.style.overflow = 'hidden';
|
121
122
|
return iframe;
|
122
123
|
};
|
@@ -5,4 +5,7 @@
|
|
5
5
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
6
6
|
* 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.
|
7
7
|
*/
|
8
|
-
|
8
|
+
import { platformEnum } from '../../types';
|
9
|
+
export declare const inlineComponentAddCss: () => void;
|
10
|
+
export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum) => void;
|
11
|
+
export declare const createInlineBaseElement: (selector: string) => HTMLDivElement | undefined;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
+
*
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
6
|
+
* 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.
|
7
|
+
*/
|
8
|
+
import { platformEnum } from "../../types";
|
9
|
+
import { INLINE_BASE_STYLE_ID, LOADING_ID, INLINE_IMG_CLASSNAME, COMPONENT_CONTAINER_ID, COMPONENT_IFRAME_TAG_ID } from "../../constant";
|
10
|
+
import { amsSetSize } from "../../util";
|
11
|
+
var inlineComponentCss = "#".concat(COMPONENT_IFRAME_TAG_ID, "-desktop{\n border-radius: 8px;\n position: absolute;\n top: 0;\n left: 0;\n}\n#").concat(COMPONENT_IFRAME_TAG_ID, "-mobile{\n position: absolute;\n top: 0;\n left: 0;\n}\n.").concat(COMPONENT_CONTAINER_ID, "-inline{\n width: 100%;\n height: auto;\n position: relative;\n line-height: 0;\n display: flex;\n}\n#").concat(LOADING_ID, "{\n width: 100%;\n flex: 1;\n}\n.").concat(INLINE_IMG_CLASSNAME, "{\n width: 100%;\n height: auto;\n object-fit: contain;\n box-sizing: border-box;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-mobile{\n padding: 0 0.16em;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-desktop{}\n");
|
12
|
+
export var inlineComponentAddCss = function inlineComponentAddCss() {
|
13
|
+
var style = document.createElement('style');
|
14
|
+
style.id = 'ams-inline-component-style';
|
15
|
+
style.type = 'text/css';
|
16
|
+
style.innerHTML = inlineComponentCss;
|
17
|
+
document.head.appendChild(style);
|
18
|
+
};
|
19
|
+
export var addInlineLoading = function addInlineLoading(_selector, platform) {
|
20
|
+
var loading = document.createElement('div');
|
21
|
+
loading.id = LOADING_ID;
|
22
|
+
if (platform === platformEnum.desktop) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"740\" height=\"360\" viewBox=\"0 0 740 360\" fill=\"none\" xmlns=\"\">\n <rect width=\"740\" height=\"360\" rx=\"12\" fill=\"#F6F6F6\"/>\n <rect opacity=\"0.7\" x=\"44\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"94\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"144\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M136 100H48C43.5817 100 40 103.582 40 108C40 112.418 43.5817 116 48 116H136C140.418 116 144 112.418 144 108C144 103.582 140.418 100 136 100Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 126H58C48.0589 126 40 134.059 40 144C40 153.941 48.0589 162 58 162H682C691.941 162 700 153.941 700 144C700 134.059 691.941 126 682 126Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 182H58C48.0589 182 40 190.059 40 200C40 209.941 48.0589 218 58 218H682C691.941 218 700 209.941 700 200C700 190.059 691.941 182 682 182Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M504 274H64C52.9543 274 44 282.954 44 294C44 305.046 52.9543 314 64 314H504C515.046 314 524 305.046 524 294C524 282.954 515.046 274 504 274Z\" fill=\"#E1E6ED\"/>\n </g>\n </svg>");
|
23
|
+
if (platform === platformEnum.mobile) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"358\" height=\"186\" viewBox=\"0 0 358 186\" fill=\"none\" xmlns=\"\">\n <g clip-path=\"url(#clip0_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <g clip-path=\"url(#clip1_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <rect width=\"358\" height=\"40\" fill=\"white\"/>\n <rect opacity=\"0.7\" x=\"4\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"54\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"104\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g clip-path=\"url(#clip2_2543_91192)\">\n <rect width=\"358\" height=\"120\" transform=\"translate(0 66)\" fill=\"white\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M95 66H9C4.02944 66 0 70.0294 0 75C0 79.9706 4.02943 84 9 84H95C99.9706 84 104 79.9706 104 75C104 70.0294 99.9706 66 95 66Z\" fill=\"#E1E6ED\"/>\n </g>\n <g clip-path=\"url(#clip3_2543_91192)\">\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 94H18C8.05888 94 0 102.059 0 112C0 121.941 8.05887 130 18 130H340C349.941 130 358 121.941 358 112C358 102.059 349.941 94 340 94Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 150H18C8.05888 150 0 158.059 0 168C0 177.941 8.05887 186 18 186H340C349.941 186 358 177.941 358 168C358 158.059 349.941 150 340 150Z\" fill=\"#E1E6ED\"/>\n </g>\n </g>\n </g>\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip1_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip2_2543_91192\">\n <rect width=\"358\" height=\"120\" fill=\"white\" transform=\"translate(0 66)\"/>\n </clipPath>\n <clipPath id=\"clip3_2543_91192\">\n <rect width=\"358\" height=\"92\" fill=\"white\" transform=\"translate(0 94)\"/>\n </clipPath>\n </defs>\n </svg>\n ");
|
24
|
+
if (_selector) _selector.appendChild(loading);
|
25
|
+
var loadingDom = document.getElementById(LOADING_ID);
|
26
|
+
amsSetSize(null, loadingDom);
|
27
|
+
};
|
28
|
+
export var createInlineBaseElement = function createInlineBaseElement(selector) {
|
29
|
+
var inlineBaseStyle = document.getElementById(INLINE_BASE_STYLE_ID);
|
30
|
+
if (!inlineBaseStyle) inlineComponentAddCss();
|
31
|
+
if (document.getElementById(COMPONENT_CONTAINER_ID)) return;
|
32
|
+
var amsComponentContainer = document.createElement('div');
|
33
|
+
amsComponentContainer.className = "".concat(COMPONENT_CONTAINER_ID, "-inline");
|
34
|
+
amsComponentContainer.id = COMPONENT_CONTAINER_ID;
|
35
|
+
var selectorDom = document.querySelector(selector);
|
36
|
+
if (selectorDom) selectorDom.appendChild(amsComponentContainer);
|
37
|
+
return amsComponentContainer;
|
38
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { platformEnum } from '../../types';
|
2
|
+
export declare const componentAddCSS: () => void;
|
3
|
+
export declare const createBaseElement: (platform: platformEnum, closeBtnFunc: () => void) => HTMLDivElement | undefined;
|
4
|
+
export declare const createCloseBtn: (platform: platformEnum, closeBtnFunc: () => void) => void;
|
5
|
+
export declare const createRetentionPopup: (platform: platformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
6
|
+
export declare const hideRetentionPopup: () => void;
|
7
|
+
export declare const removeRetentionPopup: (platform: platformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
8
|
+
export declare const createMockup: () => void;
|
9
|
+
export declare const addPopupLoading: () => void;
|
10
|
+
export declare const handleDeclareInfo: ({ closeDialogData }: {
|
11
|
+
closeDialogData: any;
|
12
|
+
}) => void;
|