@alipay/ams-checkout 0.0.1726734012-dev.10 → 0.0.1726734012-dev.12
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/core/component/index.d.ts +5 -2
- package/esm/core/component/index.js +19 -40
- package/esm/core/instance/index.js +1 -1
- package/esm/foundation/core/index.d.ts +6 -0
- package/esm/foundation/core/index.js +11 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +1 -0
- package/esm/foundation/product-processor/easysafepay/index.js +7 -0
- package/esm/index.d.ts +6 -2
- package/esm/index.js +20 -11
- package/package.json +1 -1
@@ -34,7 +34,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
34
34
|
*/
|
35
35
|
createComponent(params: IcreateComponent): Promise<void>;
|
36
36
|
private createComponentProcess;
|
37
|
-
preloadComponent(): void;
|
37
|
+
preloadComponent(channelType: any, productSceneVersion: any): void;
|
38
38
|
private clearPreloadIframe;
|
39
39
|
/**
|
40
40
|
* @description Create and render components in the specified element area
|
@@ -49,7 +49,10 @@ export declare class AMSComponent extends CoreInstance {
|
|
49
49
|
* @param data - Transfer information in the submission interface according to your requirements (optional)
|
50
50
|
*/
|
51
51
|
submit(data?: Isubmit): Promise<unknown>;
|
52
|
-
preload(_options: {
|
52
|
+
static preload(_options: {
|
53
|
+
appVersion: string;
|
53
54
|
securityRegion?: 'US' | 'SG' | 'DE';
|
55
|
+
channelType: ComponentSignEnum[];
|
56
|
+
productSceneVersion: string;
|
54
57
|
}): void;
|
55
58
|
}
|
@@ -346,10 +346,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
346
346
|
key: "createComponent",
|
347
347
|
value: function createComponent(params) {
|
348
348
|
var _this5 = this;
|
349
|
-
if (!this.isSuccessfullyPreloaded) {
|
350
|
-
this.preloadComponent();
|
351
|
-
}
|
352
|
-
;
|
353
349
|
this.clearPreloadIframe();
|
354
350
|
this.logger.setComponentStartTime(Date.now());
|
355
351
|
return this.parameterInitAndCheck({
|
@@ -390,41 +386,26 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
390
386
|
return this.pluginAppendIframe(appendParams);
|
391
387
|
}
|
392
388
|
|
393
|
-
//
|
394
|
-
// this.channelType = channelType;
|
395
|
-
// this.productSceneVersion = productSceneVersion;
|
396
|
-
// const MAX_CLEAR_TIME = 10000;
|
397
|
-
|
398
|
-
// if (Array.isArray(channelType)) {
|
399
|
-
// for (let i = 0; i < channelType.length; i++) {
|
400
|
-
// this._componentApp.appendPreloadIframeNodes(channelType[i], productSceneVersion);
|
401
|
-
// }
|
402
|
-
// } else {
|
403
|
-
// this.logger.logError(
|
404
|
-
// { title: 'performance_optimization_channelType_error' },
|
405
|
-
// { eventMessage: channelType }
|
406
|
-
// );
|
407
|
-
// }
|
408
|
-
// this.timer = setTimeout(() => {
|
409
|
-
// this.clearPreloadIframe(true);
|
410
|
-
// }, MAX_CLEAR_TIME);
|
411
|
-
// }
|
389
|
+
// TODO 老逻辑predload
|
412
390
|
}, {
|
413
391
|
key: "preloadComponent",
|
414
|
-
value: function preloadComponent() {
|
392
|
+
value: function preloadComponent(channelType, productSceneVersion) {
|
415
393
|
var _this6 = this;
|
416
|
-
console.log('
|
394
|
+
console.log('isSuccessfullyPreloaded', this.isSuccessfullyPreloaded);
|
395
|
+
if (this.isSuccessfullyPreloaded) return;
|
396
|
+
this.channelType = channelType;
|
397
|
+
this.productSceneVersion = productSceneVersion;
|
417
398
|
var MAX_CLEAR_TIME = 10000;
|
418
|
-
if (Array.isArray(
|
419
|
-
for (var i = 0; i <
|
420
|
-
this._componentApp.appendPreloadIframeNodes(
|
399
|
+
if (Array.isArray(channelType)) {
|
400
|
+
for (var i = 0; i < channelType.length; i++) {
|
401
|
+
this._componentApp.appendPreloadIframeNodes(channelType[i], productSceneVersion);
|
402
|
+
this.isSuccessfullyPreloaded = true;
|
421
403
|
}
|
422
|
-
this.isSuccessfullyPreloaded = true;
|
423
404
|
} else {
|
424
405
|
this.logger.logError({
|
425
406
|
title: 'performance_optimization_channelType_error'
|
426
407
|
}, {
|
427
|
-
eventMessage:
|
408
|
+
eventMessage: channelType
|
428
409
|
});
|
429
410
|
}
|
430
411
|
this.timer = setTimeout(function () {
|
@@ -462,10 +443,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
462
443
|
value: function mountComponent(params, selector) {
|
463
444
|
var _this7 = this;
|
464
445
|
this.clearPreloadIframe();
|
465
|
-
if (!this.isSuccessfullyPreloaded) {
|
466
|
-
this.preloadComponent();
|
467
|
-
}
|
468
|
-
;
|
469
446
|
this.logger.setComponentStartTime(Date.now());
|
470
447
|
return this.parameterInitAndCheck({
|
471
448
|
params: params,
|
@@ -553,17 +530,19 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
553
530
|
}
|
554
531
|
|
555
532
|
// 预加载
|
556
|
-
}, {
|
533
|
+
}], [{
|
557
534
|
key: "preload",
|
558
535
|
value: function preload(_options) {
|
559
536
|
try {
|
560
|
-
var
|
561
|
-
|
562
|
-
|
537
|
+
var _currentCompoentApp$c;
|
538
|
+
var currentCompoentApp = new AMSComponent(_options);
|
539
|
+
currentCompoentApp.preloadComponent(_options.channelType, _options.productSceneVersion);
|
540
|
+
currentCompoentApp.isSuccessfullyPreloaded = true;
|
541
|
+
if (currentCompoentApp.channelType && (_currentCompoentApp$c = currentCompoentApp.channelType) !== null && _currentCompoentApp$c !== void 0 && _currentCompoentApp$c.some(function (val) {
|
563
542
|
return val === ComponentSignEnum.EASY_PAY_WALLET || val === ComponentSignEnum.EASY_PAY_APM;
|
564
543
|
})) return;
|
565
|
-
|
566
|
-
product:
|
544
|
+
currentCompoentApp._componentApp.AMSSDK.initSecurity({
|
545
|
+
product: currentCompoentApp.options.product,
|
567
546
|
securityRegion: _options.securityRegion
|
568
547
|
});
|
569
548
|
} catch (err) {
|
@@ -167,11 +167,11 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
167
167
|
}, {
|
168
168
|
productScene: product
|
169
169
|
}).send();
|
170
|
+
console.log('web-preloadsdk initSecurity securityRegion', securityRegion);
|
170
171
|
var sdk = this._getSecuritySDKByProductScene({
|
171
172
|
product: product || scene
|
172
173
|
});
|
173
174
|
if (sdk) return;
|
174
|
-
console.log('web-preloadsdk initSecurity securityRegion', securityRegion);
|
175
175
|
this._newSecuritySDKByScene({
|
176
176
|
product: product || scene,
|
177
177
|
region: securityRegion || SecurityRegionEnum.SG
|
@@ -16,6 +16,12 @@ export declare class AntomSDKCore {
|
|
16
16
|
constructor();
|
17
17
|
registerProcessor(productScene: string, paymentMethod: string, processor: ProductProcessor): void;
|
18
18
|
init(options: IoptionsParams, productScene: ProductSceneEnum): void;
|
19
|
+
transferEasyPaySdkVersion(): {
|
20
|
+
webAppVersion: string;
|
21
|
+
greyscaleId: number;
|
22
|
+
productScene: ProductSceneEnum.EASY_PAY;
|
23
|
+
sdkVersion: string;
|
24
|
+
};
|
19
25
|
private prepare;
|
20
26
|
startBizFlow(options: StartBizFlowOptions): Promise<void>;
|
21
27
|
getServiceProvider(): ServiceProvider;
|
@@ -10,7 +10,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
10
10
|
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; }
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
12
12
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
13
|
-
import { DisplayTypeEnum, eventCodeEnum } from "../../types";
|
13
|
+
import { DisplayTypeEnum, ProductSceneEnum, eventCodeEnum } from "../../types";
|
14
14
|
import { DisplayInfo } from "../index";
|
15
15
|
import { v4 as uuid } from 'uuid';
|
16
16
|
import { ServiceProvider } from "../service";
|
@@ -59,6 +59,16 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
59
59
|
ServiceProvider.getInstance(this.instanceId).init(options, this.sdkMetaData);
|
60
60
|
this.prepare(options, this.sdkMetaData);
|
61
61
|
}
|
62
|
+
}, {
|
63
|
+
key: "transferEasyPaySdkVersion",
|
64
|
+
value: function transferEasyPaySdkVersion() {
|
65
|
+
return this.sdkMetaData = {
|
66
|
+
webAppVersion: '',
|
67
|
+
greyscaleId: getGrayscaleId(),
|
68
|
+
productScene: ProductSceneEnum.EASY_PAY,
|
69
|
+
sdkVersion: sdkVersion
|
70
|
+
};
|
71
|
+
}
|
62
72
|
}, {
|
63
73
|
key: "prepare",
|
64
74
|
value: function prepare(options, sdkMetaData) {
|
@@ -12,6 +12,7 @@ export declare class EasySafePayProcessor implements ProductProcessor {
|
|
12
12
|
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
13
13
|
startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
|
14
14
|
private preloadWebApp;
|
15
|
+
static preload(options: IoptionsParams, sdkVersion: SDKMetaData): void;
|
15
16
|
private buildWebAppPreloadUrl;
|
16
17
|
private buildWebAppUrl;
|
17
18
|
private buildRedirectResult;
|
@@ -459,6 +459,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
|
|
459
459
|
}
|
460
460
|
return initSecuritySDK;
|
461
461
|
}()
|
462
|
+
}], [{
|
463
|
+
key: "preload",
|
464
|
+
value: function preload(options, sdkVersion) {
|
465
|
+
var instanceId = uuid();
|
466
|
+
var currentEasyPay = new EasySafePayProcessor();
|
467
|
+
currentEasyPay.init(options, instanceId, sdkVersion);
|
468
|
+
}
|
462
469
|
}]);
|
463
470
|
return EasySafePayProcessor;
|
464
471
|
}();
|
package/esm/index.d.ts
CHANGED
@@ -6,6 +6,11 @@ export { AMSCheckoutPage } from './core/component/ckp';
|
|
6
6
|
export * from './types';
|
7
7
|
export declare class AMSCheckout extends AMSComponent {
|
8
8
|
constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
9
|
+
static preload(_options: {
|
10
|
+
channelType: ComponentSignEnum[];
|
11
|
+
productSceneVersion: string;
|
12
|
+
securityRegion?: 'US' | 'SG' | 'DE';
|
13
|
+
}): void;
|
9
14
|
}
|
10
15
|
export declare class AMSAutoDebit extends AMSCheckout {
|
11
16
|
constructor(options: IoptionsParams);
|
@@ -31,9 +36,8 @@ export declare class Element extends ElementComponent {
|
|
31
36
|
export default AMSCheckout;
|
32
37
|
export declare class AMSEasyPay {
|
33
38
|
private core;
|
34
|
-
private easySafePayProcessor;
|
35
39
|
constructor(options: IoptionsParams);
|
40
|
+
static preload(options: IoptionsParams): void;
|
36
41
|
createComponent(params: IcreateComponent): void;
|
37
|
-
preload(): void;
|
38
42
|
unmount(): void;
|
39
43
|
}
|
package/esm/index.js
CHANGED
@@ -2,11 +2,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
4
|
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; }
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
5
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); } }
|
6
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; }
|
7
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
8
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
10
10
|
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); }
|
11
11
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
12
12
|
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); }; }
|
@@ -43,12 +43,20 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
|
43
43
|
_this = _super.call(this, _objectSpread({
|
44
44
|
appVersion: AMSCheckoutAppVersion
|
45
45
|
}, _options));
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
_this.preloadComponent(channelType, productSceneVersion);
|
47
|
+
// this.channelType = channelType;
|
48
|
+
// this.productSceneVersion = productSceneVersion;
|
49
49
|
return _this;
|
50
50
|
}
|
51
|
-
|
51
|
+
_createClass(AMSCheckout, null, [{
|
52
|
+
key: "preload",
|
53
|
+
value: function preload(_options) {
|
54
|
+
AMSComponent.preload(_objectSpread(_objectSpread({}, _options), {}, {
|
55
|
+
appVersion: AMSCheckoutAppVersion
|
56
|
+
}));
|
57
|
+
}
|
58
|
+
}]);
|
59
|
+
return AMSCheckout;
|
52
60
|
}(AMSComponent);
|
53
61
|
export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
54
62
|
_inherits(AMSAutoDebit, _AMSCheckout);
|
@@ -164,7 +172,6 @@ export var AMSEasyPay = /*#__PURE__*/function () {
|
|
164
172
|
function AMSEasyPay(options) {
|
165
173
|
_classCallCheck(this, AMSEasyPay);
|
166
174
|
_defineProperty(this, "core", void 0);
|
167
|
-
_defineProperty(this, "easySafePayProcessor", void 0);
|
168
175
|
this.core = new AntomSDKCore();
|
169
176
|
this.core.registerProcessor(ProductSceneEnum.EASY_PAY, '', new EasySafePayProcessor());
|
170
177
|
this.core.init(options, ProductSceneEnum.EASY_PAY);
|
@@ -184,16 +191,18 @@ export var AMSEasyPay = /*#__PURE__*/function () {
|
|
184
191
|
isAppWebview: params.isAppWebview
|
185
192
|
});
|
186
193
|
}
|
187
|
-
}, {
|
188
|
-
key: "preload",
|
189
|
-
value: function preload() {
|
190
|
-
this.core.init({}, ProductSceneEnum.EASY_PAY);
|
191
|
-
}
|
192
194
|
}, {
|
193
195
|
key: "unmount",
|
194
196
|
value: function unmount() {
|
195
197
|
this.core.destroy();
|
196
198
|
}
|
199
|
+
}], [{
|
200
|
+
key: "preload",
|
201
|
+
value: function preload(options) {
|
202
|
+
var core = new AntomSDKCore();
|
203
|
+
var SDkMetaData = core.transferEasyPaySdkVersion();
|
204
|
+
EasySafePayProcessor.preload(options, SDkMetaData);
|
205
|
+
}
|
197
206
|
}]);
|
198
207
|
return AMSEasyPay;
|
199
208
|
}();
|