@alipay/ams-checkout 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +1 -15
- package/esm/config/index.js +9 -62
- package/esm/config/request.d.ts +21 -0
- package/esm/config/request.js +67 -0
- package/esm/constant/index.d.ts +1 -0
- package/esm/constant/index.js +1 -0
- package/esm/core/component/index.d.ts +3 -3
- package/esm/core/component/index.js +51 -90
- package/esm/core/instance/index.d.ts +2 -10
- package/esm/core/instance/index.js +0 -22
- package/esm/plugin/component/cashierApp.d.ts +4 -5
- package/esm/plugin/component/cashierApp.js +32 -49
- package/esm/plugin/component/component.style.js +1 -1
- package/esm/plugin/component/index.d.ts +3 -3
- package/esm/plugin/component/index.js +31 -24
- package/esm/request/index.d.ts +1 -1
- package/esm/request/index.js +5 -4
- package/esm/service/index.d.ts +2 -2
- package/esm/types/index.d.ts +29 -7
- package/esm/types/index.js +8 -5
- package/package.json +1 -1
package/esm/config/index.d.ts
CHANGED
@@ -1,16 +1,2 @@
|
|
1
|
-
export declare const
|
2
|
-
[key: string]: string;
|
3
|
-
};
|
4
|
-
export declare const clientId = "5J5Y8X4E2Y25GR00690";
|
5
|
-
export declare const tntInstId = "ALIPW3SG";
|
6
|
-
export declare const appId = "ANTOM_PAYMENT_WEB";
|
7
|
-
export declare const sofaId: any;
|
8
|
-
export declare const closeImg = "https://file.page.alipay.net/resource/2023/3/21/3235f64c-84a6-4e33-9567-4cedf0960229.svg";
|
9
|
-
export declare const hostSignMap: (hostSign: string | undefined, env: string) => string;
|
10
|
-
export declare const lightSandboxMap: (operationType: string | undefined, env: string) => {
|
11
|
-
appId: string;
|
12
|
-
sofaId: any;
|
13
|
-
baseURL: string;
|
14
|
-
'Operation-Type': string;
|
15
|
-
};
|
1
|
+
export declare const marmptMap: Record<string, string>;
|
16
2
|
export declare const sdkVersion: string;
|
package/esm/config/index.js
CHANGED
@@ -5,66 +5,13 @@
|
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
dev: host || 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
|
17
|
-
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
18
|
-
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
19
|
-
prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
20
|
-
sandbox: 'https://imgs-sea-global.alipay.com/mgw.htm'
|
8
|
+
import json from "../../package.json";
|
9
|
+
export var marmptMap = {
|
10
|
+
dev: 'http://page.alipay.net/page/antom-web-checkout/src/component-app',
|
11
|
+
sit: 'http://page.test.alipay.net/page/antom-web-checkout/src/component-app',
|
12
|
+
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app',
|
13
|
+
sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
|
14
|
+
light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
|
15
|
+
prod: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app'
|
21
16
|
};
|
22
|
-
export var
|
23
|
-
export var tntInstId = 'ALIPW3SG';
|
24
|
-
export var appId = 'ANTOM_PAYMENT_WEB';
|
25
|
-
export var sofaId = groupId || 'GROUP_20230523202227'; // 2.0
|
26
|
-
|
27
|
-
export var closeImg = 'https://file.page.alipay.net/resource/2023/3/21/3235f64c-84a6-4e33-9567-4cedf0960229.svg';
|
28
|
-
export var hostSignMap = function hostSignMap(hostSign, env) {
|
29
|
-
var map = {
|
30
|
-
SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
31
|
-
US: 'https://imgs-na-global.alipay.com/mgw.htm',
|
32
|
-
DE: 'https://imgs-de-global.alipay.com/mgw.htm'
|
33
|
-
};
|
34
|
-
var preMap = {
|
35
|
-
SG: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
36
|
-
US: 'https://imgs-pre.alipay.com/mgw.htm',
|
37
|
-
DE: 'https://imgs-de-pre.alipay.com/mgw.htm'
|
38
|
-
};
|
39
|
-
if (env === 'prod' || env === 'sandbox' || env === 'light_sandbox') {
|
40
|
-
return map[hostSign || 'SG'];
|
41
|
-
} else if (env === 'pre') {
|
42
|
-
return preMap[hostSign || 'SG'];
|
43
|
-
} else return '';
|
44
|
-
};
|
45
|
-
export var lightSandboxMap = function lightSandboxMap() {
|
46
|
-
var operationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
47
|
-
var env = arguments.length > 1 ? arguments[1] : undefined;
|
48
|
-
var map = {
|
49
|
-
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
50
|
-
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
51
|
-
dev: host || 'http://imgs-13.sggz00b.stable.alipay.net/mgw.htm'
|
52
|
-
};
|
53
|
-
var typeMap = {
|
54
|
-
'com.ipay.iexpcashier.sdkAction.query': 'com.ipay.iopensandbox.sdk.paymentSession.query'
|
55
|
-
};
|
56
|
-
var appId = 'SDK_MOCK_SANDBOX';
|
57
|
-
var sofaId = groupId || 'GROUP_20230315210531';
|
58
|
-
if (typeMap[operationType] && env === 'light_sandbox' || _light_sandbox === 'true') return {
|
59
|
-
appId: appId,
|
60
|
-
sofaId: sofaId,
|
61
|
-
baseURL: map[env],
|
62
|
-
'Operation-Type': typeMap[operationType]
|
63
|
-
};else return {
|
64
|
-
appId: '',
|
65
|
-
sofaId: '',
|
66
|
-
baseURL: '',
|
67
|
-
'Operation-Type': ''
|
68
|
-
};
|
69
|
-
};
|
70
|
-
export var sdkVersion = packageJSON.version;
|
17
|
+
export var sdkVersion = json.version;
|
@@ -0,0 +1,21 @@
|
|
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
|
+
export declare const requestHost: {
|
9
|
+
[key: string]: string;
|
10
|
+
};
|
11
|
+
export declare const clientId = "5J5Y8X4E2Y25GR00690";
|
12
|
+
export declare const tntInstId = "ALIPW3SG";
|
13
|
+
export declare const appId = "ANTOM_PAYMENT_WEB";
|
14
|
+
export declare const sofaId: any;
|
15
|
+
export declare const hostSignMap: (hostSign: string | undefined, env: string) => string;
|
16
|
+
export declare const lightSandboxMap: (operationType: string | undefined, env: string) => {
|
17
|
+
appId: string;
|
18
|
+
sofaId: any;
|
19
|
+
baseURL: string;
|
20
|
+
'Operation-Type': string;
|
21
|
+
};
|
@@ -0,0 +1,67 @@
|
|
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
|
+
|
9
|
+
import { queryParse } from "../util";
|
10
|
+
var _queryParse = queryParse(),
|
11
|
+
_light_sandbox = _queryParse._light_sandbox,
|
12
|
+
groupId = _queryParse.groupId,
|
13
|
+
host = _queryParse.requestHost;
|
14
|
+
export var requestHost = {
|
15
|
+
local: 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
|
16
|
+
dev: host || 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
|
17
|
+
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
18
|
+
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
19
|
+
prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
20
|
+
sandbox: 'https://imgs-sea-global.alipay.com/mgw.htm'
|
21
|
+
};
|
22
|
+
export var clientId = '5J5Y8X4E2Y25GR00690';
|
23
|
+
export var tntInstId = 'ALIPW3SG';
|
24
|
+
export var appId = 'ANTOM_PAYMENT_WEB';
|
25
|
+
export var sofaId = groupId || 'GROUP_20230523202227';
|
26
|
+
export var hostSignMap = function hostSignMap(hostSign, env) {
|
27
|
+
var map = {
|
28
|
+
SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
29
|
+
US: 'https://imgs-na-global.alipay.com/mgw.htm',
|
30
|
+
DE: 'https://imgs-de-global.alipay.com/mgw.htm'
|
31
|
+
};
|
32
|
+
var preMap = {
|
33
|
+
SG: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
34
|
+
US: 'https://imgs-pre.alipay.com/mgw.htm',
|
35
|
+
DE: 'https://imgs-de-pre.alipay.com/mgw.htm'
|
36
|
+
};
|
37
|
+
if (env === 'prod' || env === 'sandbox' || env === 'light_sandbox') {
|
38
|
+
return map[hostSign || 'SG'];
|
39
|
+
} else if (env === 'pre') {
|
40
|
+
return preMap[hostSign || 'SG'];
|
41
|
+
} else return '';
|
42
|
+
};
|
43
|
+
export var lightSandboxMap = function lightSandboxMap() {
|
44
|
+
var operationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
45
|
+
var env = arguments.length > 1 ? arguments[1] : undefined;
|
46
|
+
var map = {
|
47
|
+
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
48
|
+
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
49
|
+
dev: host || 'http://imgs-13.sggz00b.stable.alipay.net/mgw.htm'
|
50
|
+
};
|
51
|
+
var typeMap = {
|
52
|
+
'com.ipay.iexpcashier.sdkAction.query': 'com.ipay.iopensandbox.sdk.paymentSession.query'
|
53
|
+
};
|
54
|
+
var appId = 'SDK_MOCK_SANDBOX';
|
55
|
+
var sofaId = groupId || 'GROUP_20230315210531';
|
56
|
+
if (typeMap[operationType] && env === 'light_sandbox' || _light_sandbox === 'true') return {
|
57
|
+
appId: appId,
|
58
|
+
sofaId: sofaId,
|
59
|
+
baseURL: map[env],
|
60
|
+
'Operation-Type': typeMap[operationType]
|
61
|
+
};else return {
|
62
|
+
appId: '',
|
63
|
+
sofaId: '',
|
64
|
+
baseURL: '',
|
65
|
+
'Operation-Type': ''
|
66
|
+
};
|
67
|
+
};
|
package/esm/constant/index.d.ts
CHANGED
@@ -132,4 +132,5 @@ export declare const EVENT: {
|
|
132
132
|
name: string;
|
133
133
|
};
|
134
134
|
};
|
135
|
+
export declare const closeImg = "https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg";
|
135
136
|
export declare const LOADINGIMG = "data:image/png;base64,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";
|
package/esm/constant/index.js
CHANGED
@@ -132,4 +132,5 @@ export var EVENT = {
|
|
132
132
|
name: 'dismissLoading'
|
133
133
|
}
|
134
134
|
};
|
135
|
+
export var closeImg = 'https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg';
|
135
136
|
export var LOADINGIMG = 'data:image/png;base64,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';
|
@@ -5,13 +5,13 @@
|
|
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 {
|
8
|
+
import { IcreateComponent, optionsParams } from '../../types';
|
9
9
|
export declare const mixinComponentConstructor: (options: optionsParams, context: any) => void;
|
10
10
|
/**
|
11
11
|
* @description Create component application
|
12
12
|
* @description component
|
13
13
|
*/
|
14
|
-
export declare const createComponent: (
|
14
|
+
export declare const createComponent: (params: IcreateComponent) => Promise<void>;
|
15
15
|
export interface IcreateComponentFunc {
|
16
|
-
(
|
16
|
+
(params: IcreateComponent): Promise<void>;
|
17
17
|
}
|
@@ -1,13 +1,9 @@
|
|
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
|
-
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
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
5
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
6
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
7
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
8
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
9
|
-
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); } }
|
10
|
-
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); }); }; }
|
11
7
|
/**
|
12
8
|
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
13
9
|
*
|
@@ -18,23 +14,17 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
18
14
|
|
19
15
|
import { COMPONENTPLUGINID, ERRORMESSAGE } from "../../constant";
|
20
16
|
import ComponentApp from "../../plugin/component";
|
21
|
-
import {
|
17
|
+
import { componentSignEnum, mode, networkMode, productSceneEnum } from "../../types";
|
22
18
|
import { isPC } from "../../util";
|
23
19
|
import { createIframeNode } from "../../util/createIframeNode";
|
24
20
|
var getComponentSign = function getComponentSign(params) {
|
25
|
-
var
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
if (productScene === productSceneEnum.EASY_PAY) return componentNameEnum.easyPay;
|
33
|
-
if (productScene === productSceneEnum.CASHIER_PAYMENT && paymentMethodCategoryType === paymentMethodCategoryTypeEnum.CARD) return componentNameEnum.card;
|
34
|
-
if (productScene === productSceneEnum.AUTO_DEBIT) {
|
35
|
-
return componentNameEnum.autoDebit;
|
36
|
-
}
|
37
|
-
return '';
|
21
|
+
var _params$paymentSessio = params.paymentSessionConfig,
|
22
|
+
_params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
|
23
|
+
_params$paymentSessio3 = _params$paymentSessio2.productScene,
|
24
|
+
productScene = _params$paymentSessio3 === void 0 ? '' : _params$paymentSessio3,
|
25
|
+
_params$paymentSessio4 = _params$paymentSessio2.paymentMethodCategoryType,
|
26
|
+
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
|
27
|
+
return productScene && paymentMethodCategoryType ? "".concat(productScene, "_").concat(paymentMethodCategoryType) : componentSignEnum.NONE;
|
38
28
|
};
|
39
29
|
var parsePaymentSessionData = function parsePaymentSessionData(paymentSessionData) {
|
40
30
|
try {
|
@@ -45,7 +35,7 @@ var parsePaymentSessionData = function parsePaymentSessionData(paymentSessionDat
|
|
45
35
|
}
|
46
36
|
};
|
47
37
|
|
48
|
-
// pc easy-pay
|
38
|
+
// pc easy-pay execute 1.0 Process
|
49
39
|
var resetEasyPaySceneVersion = function resetEasyPaySceneVersion(parseData) {
|
50
40
|
if (isPC() && parseData !== null && parseData !== void 0 && parseData.paymentSessionConfig) {
|
51
41
|
var productScene = parseData.paymentSessionConfig.productScene;
|
@@ -54,6 +44,14 @@ var resetEasyPaySceneVersion = function resetEasyPaySceneVersion(parseData) {
|
|
54
44
|
}
|
55
45
|
}
|
56
46
|
};
|
47
|
+
var handlePaymentSessionData = function handlePaymentSessionData(originPaymentSessionData) {
|
48
|
+
var _parsePaymentSessionD = parsePaymentSessionData(originPaymentSessionData),
|
49
|
+
_parsePaymentSessionD2 = _slicedToArray(_parsePaymentSessionD, 2),
|
50
|
+
parseData = _parsePaymentSessionD2[0],
|
51
|
+
paymentSessionData = _parsePaymentSessionD2[1];
|
52
|
+
resetEasyPaySceneVersion(parseData);
|
53
|
+
return [parseData, paymentSessionData];
|
54
|
+
};
|
57
55
|
export var mixinComponentConstructor = function mixinComponentConstructor(options, context) {
|
58
56
|
// Instantiate the plug-in and set render
|
59
57
|
var ComponentPlugin = new ComponentApp();
|
@@ -66,74 +64,37 @@ export var mixinComponentConstructor = function mixinComponentConstructor(option
|
|
66
64
|
* @description Create component application
|
67
65
|
* @description component
|
68
66
|
*/
|
69
|
-
export var createComponent =
|
70
|
-
var
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
}
|
104
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.errorMessage);
|
105
|
-
return _context.abrupt("return", Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT));
|
106
|
-
case 16:
|
107
|
-
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
108
|
-
var _parsePaymentSessionD = parsePaymentSessionData(_params.paymentSessionData),
|
109
|
-
_parsePaymentSessionD2 = _slicedToArray(_parsePaymentSessionD, 2),
|
110
|
-
parseData = _parsePaymentSessionD2[0],
|
111
|
-
paymentSessionData = _parsePaymentSessionD2[1];
|
112
|
-
resetEasyPaySceneVersion(parseData);
|
113
|
-
var componentName = typeof componentNameOrParams === 'string' ? componentNameOrParams : getComponentSign(parseData);
|
114
|
-
if (componentName === '') {
|
115
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
116
|
-
reject("".concat(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.errorCode, "\uFF1AAbnormal response data, interface failure, or unsupported payment method"));
|
117
|
-
return;
|
118
|
-
}
|
119
|
-
_params.paymentSessionData = paymentSessionData;
|
120
|
-
_params.paymentSessionMetaData = parseData;
|
121
|
-
try {
|
122
|
-
var componentApp = _this._getPlugin(COMPONENTPLUGINID);
|
123
|
-
componentApp.appendIframeNodes(componentName, _params).then(function () {
|
124
|
-
resolve();
|
125
|
-
});
|
126
|
-
} catch (error) {
|
127
|
-
reject(error);
|
128
|
-
}
|
129
|
-
}));
|
130
|
-
case 17:
|
131
|
-
case "end":
|
132
|
-
return _context.stop();
|
133
|
-
}
|
134
|
-
}, _callee, this);
|
135
|
-
}));
|
136
|
-
return function createComponent(_x, _x2) {
|
137
|
-
return _ref2.apply(this, arguments);
|
138
|
-
};
|
139
|
-
}();
|
67
|
+
export var createComponent = function createComponent(params) {
|
68
|
+
var _this = this;
|
69
|
+
this.options.mode = mode.component;
|
70
|
+
this.options.networkMode = this.options.networkMode || networkMode.session;
|
71
|
+
var _params = params;
|
72
|
+
if (_params && !_params.paymentSessionData) {
|
73
|
+
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR);
|
74
|
+
}
|
75
|
+
if (this.options.networkMode === networkMode.proxy) {
|
76
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.errorMessage);
|
77
|
+
return Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT);
|
78
|
+
}
|
79
|
+
return new Promise(function (resolve, reject) {
|
80
|
+
var _handlePaymentSession = handlePaymentSessionData(_params.paymentSessionData),
|
81
|
+
_handlePaymentSession2 = _slicedToArray(_handlePaymentSession, 2),
|
82
|
+
parseData = _handlePaymentSession2[0],
|
83
|
+
paymentSessionData = _handlePaymentSession2[1];
|
84
|
+
var componentSign = getComponentSign(parseData);
|
85
|
+
if (componentSign === componentSignEnum.NONE) {
|
86
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
87
|
+
return reject("".concat(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.errorCode, "\uFF1AAbnormal response data, interface failure, or unsupported payment method"));
|
88
|
+
}
|
89
|
+
_params.paymentSessionData = paymentSessionData;
|
90
|
+
_params.paymentSessionMetaData = parseData;
|
91
|
+
try {
|
92
|
+
var componentApp = _this._getPlugin(COMPONENTPLUGINID);
|
93
|
+
componentApp.appendIframeNodes(componentSign, _params).then(function () {
|
94
|
+
resolve();
|
95
|
+
});
|
96
|
+
} catch (error) {
|
97
|
+
reject(error);
|
98
|
+
}
|
99
|
+
});
|
100
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { AMSCheckoutOptions, callOnError, callOnSizeChanged, checkoutState, optionsParams } from '../../types/index';
|
1
|
+
import type { AMSCheckoutOptions, callOnError, callOnLog, callOnSizeChanged, checkoutState, optionsParams } from '../../types/index';
|
2
2
|
import { EventCenter } from '../../util/index';
|
3
3
|
export default class AMSSDK {
|
4
4
|
options: AMSCheckoutOptions;
|
@@ -51,17 +51,9 @@ export default class AMSSDK {
|
|
51
51
|
* @description Create an event handler, called when an error occurs in AMSCheckout.
|
52
52
|
*/
|
53
53
|
onError(event: callOnError): void;
|
54
|
-
/**
|
55
|
-
* @description Create an event handler, called when the checkout view is available for interaction.
|
56
|
-
* mode: dropin
|
57
|
-
*/
|
58
|
-
/**
|
59
|
-
* @description Create an event handler, called after the user selects the payment method
|
60
|
-
* mode: dropin
|
61
|
-
*/
|
62
54
|
/**
|
63
55
|
* @description Create an event handler
|
64
56
|
*/
|
65
57
|
onSizeChanged(event: callOnSizeChanged): void;
|
66
|
-
onLog(event:
|
58
|
+
onLog(event: callOnLog): void;
|
67
59
|
}
|
@@ -123,10 +123,6 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
123
123
|
if (getType(options.onPaymentMethodSelected) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
|
124
124
|
this._overrideSubscription(EVENT.paymentMethodSelected.name, options.onPaymentMethodSelected, EVENT.paymentMethodSelected.uniqueKey);
|
125
125
|
}
|
126
|
-
if (options !== null && options !== void 0 && options.onReady) {
|
127
|
-
if (getType(options.onReady) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
|
128
|
-
this._overrideSubscription(EVENT.ready.name, options.onReady, EVENT.ready.uniqueKey);
|
129
|
-
}
|
130
126
|
if (options !== null && options !== void 0 && options.onSizeChanged) {
|
131
127
|
if (getType(options.onSizeChanged) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
|
132
128
|
this._overrideSubscription(EVENT.sizeChanged.name, options.onSizeChanged, EVENT.sizeChanged.uniqueKey);
|
@@ -239,24 +235,6 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
239
235
|
value: function onError(event) {
|
240
236
|
this._overrideSubscription(EVENT.error.name, event, EVENT.error.uniqueKey);
|
241
237
|
}
|
242
|
-
/**
|
243
|
-
* @description Create an event handler, called when the checkout view is available for interaction.
|
244
|
-
* mode: dropin
|
245
|
-
*/
|
246
|
-
// onReady(event: () => void) {
|
247
|
-
// this._overrideSubscription(EVENT.ready.name, event, EVENT.ready.uniqueKey);
|
248
|
-
// }
|
249
|
-
/**
|
250
|
-
* @description Create an event handler, called after the user selects the payment method
|
251
|
-
* mode: dropin
|
252
|
-
*/
|
253
|
-
// onPaymentMethodSelected(event: callonPaymentMethodSelected) {
|
254
|
-
// this._overrideSubscription(
|
255
|
-
// EVENT.paymentMethodSelected.name,
|
256
|
-
// event,
|
257
|
-
// EVENT.paymentMethodSelected.uniqueKey,
|
258
|
-
// );
|
259
|
-
// }
|
260
238
|
/**
|
261
239
|
* @description Create an event handler
|
262
240
|
*/
|
@@ -1,15 +1,14 @@
|
|
1
|
-
import { Ianalytics } from '../../types';
|
2
|
-
export declare const getAppPath: (environment: string | undefined, appVersion: string,
|
1
|
+
import { componentSignEnum, Ianalytics } from '../../types';
|
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;
|
6
|
-
|
6
|
+
componentSign: componentSignEnum;
|
7
7
|
productSceneVersion: string;
|
8
8
|
extendInfo: string;
|
9
9
|
}) => string;
|
10
10
|
export declare const getIframeUrl: (iframeParams: {
|
11
|
-
|
12
|
-
appearance: Record<string, string>;
|
11
|
+
componentSign: componentSignEnum;
|
13
12
|
analytics?: Ianalytics;
|
14
13
|
productSceneVersion: string;
|
15
14
|
environment: string;
|