@alipay/ams-checkout 0.0.1691379784-dev.0 → 0.0.1691379784-dev.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.
Files changed (59) hide show
  1. package/package.json +1 -1
  2. package/dist/esm/config/index.d.ts +0 -2
  3. package/dist/esm/config/index.js +0 -17
  4. package/dist/esm/config/request.d.ts +0 -21
  5. package/dist/esm/config/request.js +0 -67
  6. package/dist/esm/constant/index.d.ts +0 -136
  7. package/dist/esm/constant/index.js +0 -136
  8. package/dist/esm/core/component/index.d.ts +0 -17
  9. package/dist/esm/core/component/index.js +0 -100
  10. package/dist/esm/core/drop-in/index.d.ts +0 -29
  11. package/dist/esm/core/drop-in/index.js +0 -104
  12. package/dist/esm/core/instance/index.d.ts +0 -59
  13. package/dist/esm/core/instance/index.js +0 -254
  14. package/dist/esm/image/cta.svg +0 -9
  15. package/dist/esm/index.d.ts +0 -22
  16. package/dist/esm/index.js +0 -63
  17. package/dist/esm/plugin/component/cashierApp.d.ts +0 -23
  18. package/dist/esm/plugin/component/cashierApp.js +0 -122
  19. package/dist/esm/plugin/component/component.style.d.ts +0 -8
  20. package/dist/esm/plugin/component/component.style.js +0 -15
  21. package/dist/esm/plugin/component/index.d.ts +0 -102
  22. package/dist/esm/plugin/component/index.js +0 -900
  23. package/dist/esm/plugin/drop-in/index.d.ts +0 -73
  24. package/dist/esm/plugin/drop-in/index.js +0 -323
  25. package/dist/esm/request/index.d.ts +0 -15
  26. package/dist/esm/request/index.js +0 -145
  27. package/dist/esm/request/utils.d.ts +0 -28
  28. package/dist/esm/request/utils.js +0 -59
  29. package/dist/esm/service/index.d.ts +0 -2
  30. package/dist/esm/service/index.js +0 -40
  31. package/dist/esm/types/index.d.ts +0 -216
  32. package/dist/esm/types/index.js +0 -97
  33. package/dist/esm/util/createIframeNode.d.ts +0 -5
  34. package/dist/esm/util/createIframeNode.js +0 -35
  35. package/dist/esm/util/get.d.ts +0 -25
  36. package/dist/esm/util/get.js +0 -145
  37. package/dist/esm/util/index.d.ts +0 -53
  38. package/dist/esm/util/index.js +0 -235
  39. package/dist/esm/util/intl-callapp/es/browser.d.ts +0 -21
  40. package/dist/esm/util/intl-callapp/es/browser.js +0 -42
  41. package/dist/esm/util/intl-callapp/es/evoke.d.ts +0 -13
  42. package/dist/esm/util/intl-callapp/es/evoke.js +0 -39
  43. package/dist/esm/util/intl-callapp/es/generate.d.ts +0 -29
  44. package/dist/esm/util/intl-callapp/es/generate.js +0 -44
  45. package/dist/esm/util/intl-callapp/es/index.d.ts +0 -43
  46. package/dist/esm/util/intl-callapp/es/index.js +0 -298
  47. package/dist/esm/util/intl-callapp/es/main.d.ts +0 -41
  48. package/dist/esm/util/intl-callapp/es/main.js +0 -305
  49. package/dist/esm/util/intl-callapp/es/openWallet.d.ts +0 -15
  50. package/dist/esm/util/intl-callapp/es/openWallet.js +0 -197
  51. package/dist/esm/util/intl-callapp/es/types.d.ts +0 -46
  52. package/dist/esm/util/intl-callapp/es/types.js +0 -1
  53. package/dist/esm/util/intl-callapp/es/utils/config.d.ts +0 -24
  54. package/dist/esm/util/intl-callapp/es/utils/config.js +0 -57
  55. package/dist/esm/util/intl-callapp/es/utils/index.d.ts +0 -15
  56. package/dist/esm/util/intl-callapp/es/utils/index.js +0 -98
  57. package/dist/esm/util/mock.d.ts +0 -1
  58. package/dist/esm/util/mock.js +0 -4
  59. package/dist/umd/ams-checkout.min.js +0 -1
@@ -1,104 +0,0 @@
1
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
- 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); }
3
- 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; }
4
- /**
5
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
6
- *
7
- * 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:
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
- * 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
- */
11
-
12
- import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
13
- import CheckoutApp from "../../plugin/drop-in";
14
- import { messageName, networkMode } from "../../types";
15
- import { createIframeNode } from "../../util/createIframeNode";
16
- export var mixinDropInConstructor = function mixinDropInConstructor(options, context) {
17
- // Instantiate the plug-in and set render
18
- var checkoutPlugin = new CheckoutApp();
19
- checkoutPlugin.setRender(createIframeNode);
20
- // Register Cashier Application Plug in
21
- context._registerPlugin(BASEPLUGINID, checkoutPlugin);
22
- context._subscribeFromCheckoutPlugin();
23
- };
24
-
25
- /**
26
- * @description Create checkout application
27
- * @description drop-in
28
- */
29
- export var createPayment = function createPayment(params) {
30
- var _this = this;
31
- if (this.options.networkMode === networkMode.proxy) {
32
- return new Promise(function (resolve, reject) {
33
- try {
34
- var checkoutApp = _this._getPlugin(BASEPLUGINID);
35
- resolve(checkoutApp.render(params));
36
- } catch (error) {
37
- reject(error);
38
- }
39
- });
40
- } else {
41
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.errorMessage);
42
- return Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT);
43
- }
44
- };
45
- /**
46
- * @description Take action on the interface result of payment submission
47
- * @description drop-in
48
- */
49
- export var confirmPayment = function confirmPayment(result) {
50
- var _this2 = this;
51
- return new Promise(function (resolve, reject) {
52
- _this2.eventCenter.once('onRedirect', function (playload) {
53
- _this2._redirect(playload).then(function () {
54
- resolve();
55
- }).catch(function (err) {
56
- reject(err);
57
- });
58
- });
59
- _this2.eventCenter.emit("".concat(BASEPLUGINID, "-handleRequestPayment"), {
60
- name: messageName.SDK_TO_APP,
61
- mode: _this2.options.mode,
62
- appId: BASEPLUGINID,
63
- instanceId: _this2._instanceId,
64
- context: {
65
- event: 'handleRequestPayment',
66
- data: result
67
- }
68
- });
69
- });
70
- };
71
- /**
72
- * @description Subscribe to the message of the cashier application plug-in
73
- */
74
- export var _subscribeFromCheckoutPlugin = function _subscribeFromCheckoutPlugin() {
75
- var _this3 = this;
76
- var eventKeyMap = new Map([[EVENT.error.name, function (playload) {
77
- _this3.eventCenter.emit(EVENT.error.name, playload.context.data);
78
- }], [EVENT.ready.name, function (playload) {
79
- _this3.eventCenter.emit(EVENT.ready.name, playload.context.data);
80
- }], [EVENT.redirect.name, function (playload) {
81
- _this3.eventCenter.emit(EVENT.redirect.name, playload.context.data);
82
- }], [EVENT.paymentMethodSelected.name, function (playload) {
83
- _this3.checkoutState.paymentMethodType = playload.context.data.paymentMethodType;
84
- _this3.eventCenter.emit(EVENT.paymentMethodSelected.name, {
85
- paymentMethodType: playload.context.data.paymentMethodType
86
- });
87
- }], [EVENT.sizeChanged.name, function (playload) {
88
- _this3.eventCenter.emit(EVENT.sizeChanged.name, playload.context.data);
89
- }], [EVENT.log.name, function (playload) {
90
- _this3.eventCenter.emit(EVENT.log.name, playload.context.data);
91
- }]]);
92
- var _iterator = _createForOfIteratorHelper(eventKeyMap.keys()),
93
- _step;
94
- try {
95
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
96
- var key = _step.value;
97
- this.eventCenter.on("".concat(BASEPLUGINID, "-").concat(key), eventKeyMap.get(key));
98
- }
99
- } catch (err) {
100
- _iterator.e(err);
101
- } finally {
102
- _iterator.f();
103
- }
104
- };
@@ -1,59 +0,0 @@
1
- import type { AMSCheckoutOptions, callOnError, callOnLog, callOnSizeChanged, checkoutState, optionsParams } from '../../types/index';
2
- import { EventCenter } from '../../util/index';
3
- export default class AMSSDK {
4
- options: AMSCheckoutOptions;
5
- checkoutState: checkoutState;
6
- eventCenter: EventCenter;
7
- protected plugins: Map<string, any>;
8
- _instanceId: string;
9
- constructor(options: optionsParams);
10
- /**
11
- * @description Destroy and process some contents of the plug-in
12
- */
13
- destroy(): void;
14
- /**
15
- * @description Set the sdk basic configuration
16
- */
17
- private _setOptions;
18
- /**
19
- * @description Set environment variables
20
- */
21
- private _setEnv;
22
- /**
23
- * @description Set UI and Network Mode
24
- */
25
- private _setMode;
26
- /**
27
- * @description Initialize event related tasks
28
- */
29
- private _initEvent;
30
- /**
31
- * @description Register plug-in
32
- */
33
- protected _registerPlugin(pluginId: string, plugin: any): void;
34
- /**
35
- * @description Get Plug-in
36
- */
37
- _getPlugin(pluginId: string): any;
38
- /**
39
- * @description Execute to open app or jump link
40
- */
41
- _redirect(data: {
42
- normalUrl?: string;
43
- schemeUrl?: string;
44
- applinkUrl?: string;
45
- }): Promise<void>;
46
- /**
47
- * @description Overlay Subscription
48
- */
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
- }
@@ -1,254 +0,0 @@
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
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); }
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; }
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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); } }
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; }
8
- 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; }
9
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
- 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); }
11
- /**
12
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
13
- *
14
- * 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:
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
- * 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
- */
18
- import { v4 as uuid } from 'uuid';
19
- import { ERRORMESSAGE, EVENT } from "../../constant";
20
- import { environment, mode, networkMode, osType, terminalType } from "../../types/index";
21
- import { device, EventCenter, getType, queryParse } from "../../util/index";
22
- import CallApp from "../../util/intl-callapp/es/main";
23
- var AMSSDK = /*#__PURE__*/function () {
24
- function AMSSDK(options) {
25
- _classCallCheck(this, AMSSDK);
26
- _defineProperty(this, "options", void 0);
27
- _defineProperty(this, "checkoutState", void 0);
28
- _defineProperty(this, "eventCenter", void 0);
29
- _defineProperty(this, "plugins", void 0);
30
- _defineProperty(this, "_instanceId", void 0);
31
- this._instanceId = uuid();
32
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
33
- this.options = {};
34
- this.eventCenter = new EventCenter();
35
- this.checkoutState = {
36
- paymentMethodType: ''
37
- };
38
- this._initEvent(options);
39
- this._setOptions(options);
40
- this.plugins = new Map();
41
- }
42
- /**
43
- * @description Destroy and process some contents of the plug-in
44
- */
45
- _createClass(AMSSDK, [{
46
- key: "destroy",
47
- value: function destroy() {
48
- var _iterator = _createForOfIteratorHelper(this.plugins.values()),
49
- _step;
50
- try {
51
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
52
- var plugin = _step.value;
53
- try {
54
- plugin.logoutPlugin();
55
- // eslint-disable-next-line no-empty
56
- } catch (error) {}
57
- }
58
- } catch (err) {
59
- _iterator.e(err);
60
- } finally {
61
- _iterator.f();
62
- }
63
- }
64
- /**
65
- * @description Set the sdk basic configuration
66
- */
67
- }, {
68
- key: "_setOptions",
69
- value: function _setOptions(options) {
70
- this._setMode(options);
71
- this._setEnv(options);
72
- this.options.locale = (options === null || options === void 0 ? void 0 : options.locale) || '';
73
- }
74
- /**
75
- * @description Set environment variables
76
- */
77
- }, {
78
- key: "_setEnv",
79
- value: function _setEnv(options) {
80
- var _queryParse = queryParse(),
81
- _moreEnv = _queryParse._moreEnv;
82
- if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in environment) && _moreEnv !== 'true') {
83
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.errorMessage);
84
- options.environment = 'prod';
85
- }
86
- this.options.env = {
87
- terminalType: device.isMobile ? terminalType.WAP : terminalType.WEB,
88
- environment: (options === null || options === void 0 ? void 0 : options.environment) || 'prod'
89
- };
90
- if (this.options.env.terminalType === terminalType.WAP) {
91
- // eslint-disable-next-line no-nested-ternary
92
- this.options.env.osType = device.iOS ? osType.IOS : device.Android ? osType.ANDROID : osType.ELSE;
93
- }
94
- }
95
- /**
96
- * @description Set UI and Network Mode
97
- */
98
- }, {
99
- key: "_setMode",
100
- value: function _setMode(options) {
101
- this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || mode.dropin;
102
- if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in mode)) {
103
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.errorMessage);
104
- this.options.mode = mode.component;
105
- }
106
- this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) || networkMode.session;
107
- if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in networkMode)) {
108
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.errorMessage);
109
- this.options.networkMode = networkMode.proxy;
110
- }
111
- }
112
- /**
113
- * @description Initialize event related tasks
114
- */
115
- }, {
116
- key: "_initEvent",
117
- value: function _initEvent(options) {
118
- if (options !== null && options !== void 0 && options.onError) {
119
- if (getType(options.onError) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
120
- this._overrideSubscription(EVENT.error.name, options.onError, EVENT.error.uniqueKey);
121
- }
122
- if (options !== null && options !== void 0 && options.onPaymentMethodSelected) {
123
- if (getType(options.onPaymentMethodSelected) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
124
- this._overrideSubscription(EVENT.paymentMethodSelected.name, options.onPaymentMethodSelected, EVENT.paymentMethodSelected.uniqueKey);
125
- }
126
- if (options !== null && options !== void 0 && options.onSizeChanged) {
127
- if (getType(options.onSizeChanged) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
128
- this._overrideSubscription(EVENT.sizeChanged.name, options.onSizeChanged, EVENT.sizeChanged.uniqueKey);
129
- }
130
- if (options !== null && options !== void 0 && options.onLog) {
131
- if (getType(options.onLog) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
132
- this._overrideSubscription(EVENT.log.name, options.onLog, EVENT.log.uniqueKey);
133
- }
134
- if (options !== null && options !== void 0 && options.onEventCallback) {
135
- if (getType(options.onEventCallback) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
136
- this._overrideSubscription(EVENT.eventCallback.name, options.onEventCallback, EVENT.eventCallback.uniqueKey);
137
- }
138
- if (options !== null && options !== void 0 && options.onClose) {
139
- if (getType(options.onClose) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
140
- this._overrideSubscription(EVENT.onClose.name, options.onClose, EVENT.onClose.uniqueKey);
141
- }
142
- }
143
- /**
144
- * @description Register plug-in
145
- */
146
- }, {
147
- key: "_registerPlugin",
148
- value: function _registerPlugin(pluginId, plugin) {
149
- this.plugins.set(pluginId, plugin);
150
- try {
151
- plugin.applyPlugin(this);
152
- } catch (error) {
153
- this.plugins.delete(pluginId);
154
- if (getType(error) === 'error') throw error;
155
- throw new Error("Failed to register plug-in\uFF1A".concat(pluginId, " Exception in the apply function of the plug-in"));
156
- }
157
- }
158
- /**
159
- * @description Get Plug-in
160
- */
161
- }, {
162
- key: "_getPlugin",
163
- value: function _getPlugin(pluginId) {
164
- if (!this.plugins.has(pluginId)) {
165
- console.warn("".concat(pluginId, "Plugin unregistered"));
166
- return null;
167
- }
168
- return this.plugins.get(pluginId);
169
- }
170
- /**
171
- * @description Execute to open app or jump link
172
- */
173
- }, {
174
- key: "_redirect",
175
- value: function _redirect(data) {
176
- var _this = this;
177
- return new Promise(function (resolve, reject) {
178
- var isWeb = _this.options.env.terminalType === terminalType.WEB;
179
- var normalUrl = (data === null || data === void 0 ? void 0 : data.normalUrl) || '';
180
- var schemeUrl = (data === null || data === void 0 ? void 0 : data.schemeUrl) || '';
181
- var applinkUrl = (data === null || data === void 0 ? void 0 : data.applinkUrl) || '';
182
- var jumpFunc = function jumpFunc() {
183
- if (normalUrl) {
184
- resolve();
185
- window.location.href = normalUrl;
186
- return;
187
- }
188
- reject(ERRORMESSAGE.SDK_CALL_URL_ERROR.REDIRECT_ERROR);
189
- };
190
- var callAppFunc = function callAppFunc() {
191
- if (!schemeUrl && !applinkUrl) {
192
- jumpFunc();
193
- return;
194
- }
195
- var config = {
196
- fallback: function fallback() {
197
- jumpFunc();
198
- },
199
- successCb: function successCb() {
200
- resolve();
201
- },
202
- delay: 0
203
- };
204
- try {
205
- var callLib = new CallApp(config);
206
- callLib.open({
207
- scheme: schemeUrl,
208
- link: applinkUrl
209
- });
210
- } catch (error) {
211
- jumpFunc();
212
- }
213
- };
214
- if (isWeb) {
215
- jumpFunc();
216
- } else {
217
- callAppFunc();
218
- }
219
- });
220
- }
221
- /**
222
- * @description Overlay Subscription
223
- */
224
- }, {
225
- key: "_overrideSubscription",
226
- value: function _overrideSubscription(name, func, funcKey) {
227
- this.eventCenter.off(name, func, funcKey);
228
- this.eventCenter.on(name, func, funcKey);
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);
250
- }
251
- }]);
252
- return AMSSDK;
253
- }();
254
- export { AMSSDK as default };
@@ -1,9 +0,0 @@
1
- <svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="">
2
- <path d="M-9.61651e-07 22C-1.49276e-06 9.84974 9.84973 -4.30546e-07 22 -9.61651e-07C34.1503 -1.49276e-06 44 9.84973 44 22C44 34.1503 34.1503 44 22 44C9.84974 44 -4.30546e-07 34.1503 -9.61651e-07 22ZM4 22C4 31.9411 12.0589 40 22 40C31.9411 40 40 31.9411 40 22C40 12.0589 31.9411 4 22 4C12.0589 4 4 12.0589 4 22Z" fill="url(#paint0_angular_2884_126722)"/>
3
- <defs>
4
- <radialGradient id="paint0_angular_2884_126722" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(22 22) rotate(180) scale(22)">
5
- <stop stop-color="#889CB8"/>
6
- <stop offset="1" stop-color="#CFD8E5" stop-opacity="0"/>
7
- </radialGradient>
8
- </defs>
9
- </svg>
@@ -1,22 +0,0 @@
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 { IcreateComponentFunc } from './core/component/index';
9
- import { IconfirmPaymentFunc, IcreatePaymentFunc } from './core/drop-in/index';
10
- import AMSSDK from './core/instance';
11
- import { optionsParams } from './types';
12
- export * from './types';
13
- export declare class AMSCheckout extends AMSSDK {
14
- createComponent: IcreateComponentFunc;
15
- createPayment: IcreatePaymentFunc;
16
- confirmPayment: IconfirmPaymentFunc;
17
- constructor(options: optionsParams);
18
- }
19
- export declare class AMSAutoDebit extends AMSCheckout {
20
- constructor(options: optionsParams);
21
- }
22
- export default AMSCheckout;
package/dist/esm/index.js DELETED
@@ -1,63 +0,0 @@
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 _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
- 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- 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
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
7
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
9
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
10
- 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
- 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
- /**
16
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
17
- *
18
- * 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:
19
- * 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
- * 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
- */
22
- import { createComponent, mixinComponentConstructor } from "./core/component/index";
23
- import { confirmPayment, createPayment, mixinDropInConstructor, _subscribeFromCheckoutPlugin } from "./core/drop-in/index";
24
- import AMSSDK from "./core/instance";
25
- export * from "./types";
26
- export var AMSCheckout = /*#__PURE__*/function (_AMSSDK) {
27
- _inherits(AMSCheckout, _AMSSDK);
28
- var _super = _createSuper(AMSCheckout);
29
- function AMSCheckout(options) {
30
- var _this;
31
- _classCallCheck(this, AMSCheckout);
32
- _this = _super.call(this, options);
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;
51
- }
52
- return _createClass(AMSCheckout);
53
- }(AMSSDK);
54
- export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
55
- _inherits(AMSAutoDebit, _AMSCheckout);
56
- var _super2 = _createSuper(AMSAutoDebit);
57
- function AMSAutoDebit(options) {
58
- _classCallCheck(this, AMSAutoDebit);
59
- return _super2.call(this, options);
60
- }
61
- return _createClass(AMSAutoDebit);
62
- }(AMSCheckout);
63
- export default AMSCheckout;
@@ -1,23 +0,0 @@
1
- import { componentSignEnum, Ianalytics } from '../../types';
2
- export declare const getAppPath: (environment: string | undefined, appVersion: string, componentSign: componentSignEnum, productSceneVersion: string, extendInfo: string) => any;
3
- export declare const getAppDomain: (domainParams: {
4
- environment: string;
5
- appVersion: string;
6
- componentSign: componentSignEnum;
7
- productSceneVersion: string;
8
- extendInfo: string;
9
- }) => string;
10
- export declare const getIframeUrl: (iframeParams: {
11
- componentSign: componentSignEnum;
12
- analytics?: Ianalytics;
13
- productSceneVersion: string;
14
- environment: string;
15
- appVersion: string;
16
- extendInfo: string;
17
- locale: string;
18
- instanceId: string;
19
- }) => string;
20
- /**
21
- * @description Create iframe
22
- */
23
- export declare const createIframe: (mode: string) => HTMLIFrameElement;