@alipay/ams-checkout 0.0.1763724075-dev.4 → 0.0.1764137859-dev.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.
Files changed (140) hide show
  1. package/LEGAL.md +6 -0
  2. package/LICENSE +6 -0
  3. package/README.md +49 -0
  4. package/dist/umd/ams-checkout.min.js +1 -1
  5. package/esm/component/channel.d.ts +21 -0
  6. package/esm/component/component.inline.style.d.ts +10 -0
  7. package/esm/component/component.popup.style.d.ts +26 -0
  8. package/esm/component/popupWindow.style.d.ts +24 -0
  9. package/esm/component/popupWindow.style.js +3 -2
  10. package/esm/config/index.d.ts +16 -0
  11. package/esm/config/request.d.ts +21 -0
  12. package/esm/constant/easysafepay.d.ts +16 -0
  13. package/esm/constant/index.d.ts +341 -0
  14. package/esm/constant/index.js +0 -3
  15. package/esm/core/bus/ability/callback.d.ts +9 -0
  16. package/esm/core/bus/ability/security.d.ts +10 -0
  17. package/esm/core/bus/ability/tracker.d.ts +9 -0
  18. package/esm/core/bus/index.d.ts +125 -0
  19. package/esm/core/bus/interface.d.ts +36 -0
  20. package/esm/core/component/address.d.ts +8 -0
  21. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  22. package/esm/core/component/ckp/index.d.ts +29 -0
  23. package/esm/core/component/element/EventCenter/index.d.ts +31 -0
  24. package/esm/core/component/element/elementContainerService/containerService.d.ts +34 -0
  25. package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
  26. package/esm/core/component/element/elementController/index.d.ts +48 -0
  27. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
  28. package/esm/core/component/element/elementProcessor/addressProcessor.js +3 -2
  29. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
  30. package/esm/core/component/element/elementProcessor/authProcessor.js +3 -2
  31. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
  32. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +22 -0
  33. package/esm/core/component/element/elementProcessor/paymentProcessor.js +28 -30
  34. package/esm/core/component/element/index.d.ts +13 -0
  35. package/esm/core/component/element/mock.d.ts +10 -0
  36. package/esm/core/component/element/type.d.ts +443 -0
  37. package/esm/core/component/element/util.d.ts +85 -0
  38. package/esm/core/component/index.d.ts +58 -0
  39. package/esm/core/drop-in/index.d.ts +22 -0
  40. package/esm/core/instance/index.d.ts +89 -0
  41. package/esm/foundation/core/index.d.ts +36 -0
  42. package/esm/foundation/core/index.js +0 -27
  43. package/esm/foundation/index.d.ts +97 -0
  44. package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
  45. package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
  46. package/esm/foundation/product-processor/easysafepay/deps.d.ts +20 -0
  47. package/esm/foundation/product-processor/easysafepay/index.d.ts +29 -0
  48. package/esm/foundation/product-processor/element/index.d.ts +7 -0
  49. package/esm/foundation/service/api-bus/ability/callback.d.ts +9 -0
  50. package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
  51. package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
  52. package/esm/foundation/service/api-bus/ability/security.d.ts +12 -0
  53. package/esm/foundation/service/api-bus/ability/tracker.d.ts +9 -0
  54. package/esm/foundation/service/api-bus/busManager.d.ts +127 -0
  55. package/esm/foundation/service/api-bus/index.d.ts +20 -0
  56. package/esm/foundation/service/api-bus/interface.d.ts +48 -0
  57. package/esm/foundation/service/container/index.d.ts +41 -0
  58. package/esm/foundation/service/container/index.js +2 -33
  59. package/esm/foundation/service/container/popup.d.ts +31 -0
  60. package/esm/foundation/service/container/utils.d.ts +7 -0
  61. package/esm/foundation/service/event-center.d.ts +82 -0
  62. package/esm/foundation/service/global-data/index.d.ts +11 -0
  63. package/esm/foundation/service/index.d.ts +19 -0
  64. package/esm/foundation/service/log/index.d.ts +43 -0
  65. package/esm/foundation/service/log/keys.d.ts +13 -0
  66. package/esm/foundation/service/log/processor.d.ts +9 -0
  67. package/esm/foundation/service/log/types.d.ts +33 -0
  68. package/esm/foundation/service/requester/deps.d.ts +17 -0
  69. package/esm/foundation/service/requester/requester.d.ts +22 -0
  70. package/esm/foundation/service/security/index.d.ts +28 -0
  71. package/esm/foundation/service/security/security.d.ts +33 -0
  72. package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
  73. package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
  74. package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
  75. package/esm/foundation/utils/preload_helper.d.ts +21 -0
  76. package/esm/foundation/utils/redirect_utils.d.ts +11 -0
  77. package/esm/foundation/utils/system_events.d.ts +4 -0
  78. package/esm/foundation/utils/web_app_url_utils.d.ts +116 -0
  79. package/esm/foundation/utils/web_app_url_utils.js +15 -10
  80. package/esm/index.d.ts +54 -0
  81. package/esm/index.js +341 -5
  82. package/esm/plugin/applepay/component.d.ts +50 -0
  83. package/esm/plugin/applepay/index.d.ts +17 -0
  84. package/esm/plugin/applepay/interface.d.ts +161 -0
  85. package/esm/plugin/applepay/service.d.ts +54 -0
  86. package/esm/plugin/component/cashierApp.d.ts +38 -0
  87. package/esm/plugin/component/cashierApp.js +4 -7
  88. package/esm/plugin/component/channel.d.ts +57 -0
  89. package/esm/plugin/component/component.inline.style.d.ts +10 -0
  90. package/esm/plugin/component/component.popup.style.d.ts +25 -0
  91. package/esm/plugin/component/index.d.ts +133 -0
  92. package/esm/plugin/component/popupWindow.style.d.ts +11 -0
  93. package/esm/plugin/component/popupWindow.style.js +4 -3
  94. package/esm/plugin/const.d.ts +2 -0
  95. package/esm/plugin/drop-in/index.d.ts +71 -0
  96. package/esm/plugin/payment-element/utils.d.ts +2 -0
  97. package/esm/plugin/paypal/index.d.ts +20 -0
  98. package/esm/plugin/type.d.ts +34 -0
  99. package/esm/plugin/utils.d.ts +6 -0
  100. package/esm/request/index.d.ts +9 -0
  101. package/esm/request/utils.d.ts +28 -0
  102. package/esm/service/index.d.ts +13 -0
  103. package/esm/types/index.d.ts +854 -0
  104. package/esm/util/createIframeNode.d.ts +6 -0
  105. package/esm/util/debug.d.ts +1 -0
  106. package/esm/util/get.d.ts +25 -0
  107. package/esm/util/getBackScheme.d.ts +5 -0
  108. package/esm/util/index.d.ts +61 -0
  109. package/esm/util/intl-callapp/es/browser.d.ts +21 -0
  110. package/esm/util/intl-callapp/es/evoke.d.ts +13 -0
  111. package/esm/util/intl-callapp/es/generate.d.ts +29 -0
  112. package/esm/util/intl-callapp/es/index.d.ts +43 -0
  113. package/esm/util/intl-callapp/es/main.d.ts +41 -0
  114. package/esm/util/intl-callapp/es/openWallet.d.ts +15 -0
  115. package/esm/util/intl-callapp/es/types.d.ts +46 -0
  116. package/esm/util/intl-callapp/es/utils/config.d.ts +24 -0
  117. package/esm/util/intl-callapp/es/utils/index.d.ts +15 -0
  118. package/esm/util/logger.d.ts +64 -0
  119. package/esm/util/logger.js +1 -1
  120. package/esm/util/mock.d.ts +1 -0
  121. package/esm/util/redirect.d.ts +6 -0
  122. package/esm/util/security.d.ts +34 -0
  123. package/esm/util/spm-map.d.ts +211 -0
  124. package/esm/util/storage.d.ts +2 -0
  125. package/esm/util/upgrade.d.ts +39 -0
  126. package/esm/util/versionCompare.d.ts +15 -0
  127. package/package.json +1 -7
  128. package/ams-checkout.js +0 -1
  129. package/esm/constant/auto-debit.js +0 -15
  130. package/esm/constant/element.js +0 -30
  131. package/esm/loader/Proxy.js +0 -364
  132. package/esm/loader/constant.js +0 -36
  133. package/esm/loader/index.js +0 -23
  134. package/esm/loader/utils/common.js +0 -63
  135. package/esm/loader/utils/debugger.js +0 -15
  136. package/esm/loader/utils/loadSDK.js +0 -92
  137. package/esm/loader/utils/logger.js +0 -59
  138. package/esm/loader/utils/proxyPerformance.js +0 -66
  139. package/esm/main.js +0 -329
  140. package/esm/util/integrationType.js +0 -48
@@ -0,0 +1,36 @@
1
+ import { IoptionsParams, ProductSceneEnum } from '../../types';
2
+ import { BizFlowStartBehavior, IElementStatus, PaymentContext, ProductProcessor, StartBizFlowOptions } from '../index';
3
+ import { ServiceProvider } from '../service';
4
+ /**
5
+ * @author 谦彧 <zhangmian.zm@alipay.com>
6
+ * @date 2024/9/17
7
+ */
8
+ export declare class AntomSDKCore {
9
+ private bizFlowStartBehavior;
10
+ private initOptions;
11
+ private paymentContext;
12
+ private instanceId;
13
+ private sdkMetaData;
14
+ private productProcessors;
15
+ private enablePopWindowEventCallback;
16
+ private eventLogging;
17
+ private status;
18
+ private logger;
19
+ constructor();
20
+ getStatus(): IElementStatus;
21
+ setStatus(status: any): void;
22
+ updatePaymentSessionData(paymentSession: string): void;
23
+ registerProcessor(productScene: string, paymentMethod: string, processor: ProductProcessor): void;
24
+ init(options: IoptionsParams, productScene: ProductSceneEnum): void;
25
+ private prepare;
26
+ startBizFlow(options: StartBizFlowOptions): Promise<void>;
27
+ getServiceProvider(): ServiceProvider;
28
+ getBizFlowBehavior(): BizFlowStartBehavior;
29
+ getPaymentContext(): PaymentContext;
30
+ destroy(): void;
31
+ private handleBehaviorRender;
32
+ private handleRemain;
33
+ private handleClose;
34
+ private cleanRender;
35
+ getInstanceId(): string;
36
+ }
@@ -22,7 +22,6 @@ import { getGrayscaleId } from "../utils/gray_scale_utils";
22
22
  import { convertPaymentSession, getWebAppVersion, saveWebAppVersion } from "../utils/payment_context_utils";
23
23
  import { redirect } from "../utils/redirect_utils";
24
24
  import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
25
-
26
25
  /**
27
26
  * @author 谦彧 <zhangmian.zm@alipay.com>
28
27
  * @date 2024/9/17
@@ -232,32 +231,6 @@ export var AntomSDKCore = /*#__PURE__*/function () {
232
231
  _this.eventLogging = data.popWindowEventInfo.eventLogging;
233
232
  }
234
233
  });
235
- eventCenter.listen(EVENT.canIUse.name, function (data, payload) {
236
- var _payload$context5;
237
- // 前置校验
238
- var funcName = data === null || data === void 0 ? void 0 : data.funcName;
239
- if (!funcName || typeof funcName !== 'string') {
240
- var _payload$context4;
241
- eventCenter.dispatchToApp({
242
- event: 'appEventCallback',
243
- eventCallbackId: (_payload$context4 = payload.context) === null || _payload$context4 === void 0 ? void 0 : _payload$context4.eventCallbackId,
244
- data: {
245
- exist: false,
246
- success: false
247
- }
248
- });
249
- return;
250
- }
251
- var exist = eventCenter.isExist(funcName);
252
- eventCenter.dispatchToApp({
253
- event: 'appEventCallback',
254
- eventCallbackId: (_payload$context5 = payload.context) === null || _payload$context5 === void 0 ? void 0 : _payload$context5.eventCallbackId,
255
- data: {
256
- exist: exist,
257
- success: true
258
- }
259
- });
260
- });
261
234
 
262
235
  // execute additional logic from specified product
263
236
  if (this.productProcessors[sdkMetaData.productScene]) {
@@ -0,0 +1,97 @@
1
+ import { DisplayTypeEnum, IoptionsParams, IPaymentSessionMetaData, PlatformEnum, ProductSceneEnum, TargetEnum } from '../types';
2
+ /**
3
+ * @author 谦彧 <zhangmian.zm@alipay.com>
4
+ * @date 2024/9/17
5
+ */
6
+ /**
7
+ * Represent one transaction, each transaction has its own instance.
8
+ */
9
+ export interface PaymentContext {
10
+ initOptions: IoptionsParams;
11
+ startBizFlowOptions: StartBizFlowOptions;
12
+ displayInfo: DisplayInfo;
13
+ paymentSession: string;
14
+ paymentSessionId: string;
15
+ paymentSessionObj: IPaymentSessionMetaData;
16
+ sdkMetaData: SDKMetaData;
17
+ }
18
+ export interface StartBizFlowOptions {
19
+ paymentSession: string;
20
+ displayInfo?: Partial<DisplayInfo>;
21
+ submitPayRequestExtra?: any;
22
+ isAppWebview?: boolean;
23
+ isNativeAppWebview?: boolean;
24
+ }
25
+ export declare class DisplayInfo {
26
+ type: DisplayTypeEnum;
27
+ platform: PlatformEnum;
28
+ isRetention: boolean;
29
+ selector: string;
30
+ appearance?: Record<string, any>;
31
+ appendAliasContainerId?: boolean;
32
+ merchantAppointParam?: {
33
+ storedCard: {
34
+ needCVV: boolean;
35
+ };
36
+ };
37
+ iframeStyle?: Partial<CSSStyleDeclaration>;
38
+ notRedirectAfterComplete?: boolean;
39
+ constructor();
40
+ }
41
+ /**
42
+ * Provide unique logic for specified product, or specified product and its payment method.
43
+ * Such as: EasySafePay, PayPal in Cashier
44
+ */
45
+ export interface ProductProcessor {
46
+ init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): any;
47
+ startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
48
+ }
49
+ export interface BizFlowStartBehavior {
50
+ behaviorType: 'RENDER' | 'REDIRECT' | 'NONE';
51
+ payload: RenderBehaviorPayload | RedirectBehaviorPayload;
52
+ data?: any;
53
+ }
54
+ export interface RenderBehaviorPayload {
55
+ url: string;
56
+ allowClickPopupOutsideClose?: boolean;
57
+ }
58
+ export interface RedirectBehaviorPayload {
59
+ url?: string;
60
+ schemeUrl?: string;
61
+ applinkUrl?: string;
62
+ browserLinkTarget?: TargetEnum;
63
+ isCallApp?: boolean;
64
+ callAppDetectSuccessDelay?: number;
65
+ openInApp?: boolean;
66
+ }
67
+ /**
68
+ * Provide some capability, such as MonitorService, EventBusService, SecurityService
69
+ */
70
+ export interface Service {
71
+ init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): any;
72
+ update(paymentContext: PaymentContext): any;
73
+ destroy(): any;
74
+ }
75
+ export interface SDKMetaData {
76
+ productScene: ProductSceneEnum;
77
+ sdkVersion: string;
78
+ webAppVersion: string;
79
+ greyscaleId?: number;
80
+ }
81
+ export interface EventLogging {
82
+ enableLogging?: boolean;
83
+ eventName?: string;
84
+ eventAlias?: string;
85
+ userPath?: string;
86
+ }
87
+ export interface InitContext {
88
+ initOptions: IoptionsParams;
89
+ sdkMetaData: SDKMetaData;
90
+ }
91
+ export declare enum IElementStatus {
92
+ UNINIT = "UNINIT",
93
+ INITING = "INITING",
94
+ READY = "READY",
95
+ IN_BIZ_FLOW = "IN_BIZ_FLOW",
96
+ DESTROYED = "DESTROYED"
97
+ }
@@ -0,0 +1,14 @@
1
+ export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload, SDKMetaData, } from '../..';
2
+ export { v2AppMarmotMap } from '../../../config';
3
+ export { COMPONENT_CONTAINER_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LOADTIME_LIMIT } from '../../../constant';
4
+ export { getComponentSign } from '../../../core/component';
5
+ export { ComponentSignEnum, eventCodeEnum, PlatformEnum } from '../../../types';
6
+ export type { CashierSdkActionQueryRequest, IoptionsParams } from '../../../types';
7
+ export { isPC, isTrue, queryParse } from '../../../util';
8
+ export { isLocalMock } from '../../../util/mock';
9
+ export { EventCenter } from '../..//service/event-center';
10
+ export { ServiceProvider } from '../../service';
11
+ export { LogService } from '../../service/log';
12
+ export { RequesterService } from '../../service/requester/requester';
13
+ export { SecurityService } from '../../service/security';
14
+ export { getWebAppV2Url } from '../../utils/web_app_url_utils';
@@ -0,0 +1,48 @@
1
+ import { BizFlowStartBehavior, IoptionsParams, PaymentContext, ProductProcessor, SDKMetaData } from './deps';
2
+ export declare class AutoDebitProcessor implements ProductProcessor {
3
+ private paymentContext?;
4
+ private initConfig;
5
+ private logger;
6
+ private eventCenter;
7
+ private securityService;
8
+ private instanceId;
9
+ private componentSign;
10
+ private hostSign;
11
+ private _performanceData;
12
+ private SECURITY_SDK_INIT_TIMEOUT;
13
+ init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
14
+ startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
15
+ private acquireApdidToken;
16
+ /**
17
+ * 获取SDK操作查询请求
18
+ * @returns {Promise<CashierSdkActionQueryRequest | { message?: string; success: boolean }>} 返回SDK操作查询请求或错误信息
19
+ */
20
+ private getSdkActionQuery;
21
+ /**
22
+ * webLaunchPromise方法用于返回一个Promise对象,用于异步加载Web App
23
+ * @returns {Promise} 返回一个Promise对象
24
+ */
25
+ private webLaunchPromise;
26
+ private sendRequestAndWaitWebLaunch;
27
+ private buildRedirectResult;
28
+ /**
29
+ * 构建 Web App 的 URL
30
+ * @returns {string} Web App 的 URL
31
+ */
32
+ private buildWebAppUrl;
33
+ /**
34
+ * 初始化安全SDK
35
+ * @returns {Promise}
36
+ */
37
+ private initSecuritySDK;
38
+ /**
39
+ * 设置容器宽度
40
+ * 如果是 Trustly 支付方式,并且显示平台为桌面端,则设置组件区块和容器的最大宽度为 656px
41
+ */
42
+ private setAchAutoDebitContainerWidth;
43
+ /**
44
+ * 判断是否为Trustly支付方式
45
+ * @returns {boolean} true 表示是Trustly支付方式
46
+ */
47
+ private get isTrustly();
48
+ }
@@ -0,0 +1,20 @@
1
+ export type { SDKMetaData } from "../..";
2
+ export { v4 as uuid } from 'uuid';
3
+ export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload, } from '../..';
4
+ export * as ChannelCustomize from '../../../component/channel';
5
+ export type { IChannelBehavior } from '../../../component/channel';
6
+ export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, RiskSdkInfoEnum } from '../../../types';
7
+ export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSdkActionQuerySessionResult, CashierSubmitPayRequest, CashierSubmitPayResult, IoptionsParams, } from '../../../types';
8
+ export { isPC } from '../../../util';
9
+ export { getBackScheme } from '../../utils/redirect_utils';
10
+ export { isLocalMock } from '../../../util/mock';
11
+ export { ServiceProvider } from '../../service';
12
+ export type { ContainerService } from '../../service/container';
13
+ export type { EventCenter } from '../../service/event-center';
14
+ export { LogService } from '../../service/log';
15
+ export type { RequesterService } from '../../service/requester/requester';
16
+ export type { SecurityService } from '../../service/security';
17
+ export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
18
+ export * as WebAppUrlUtil from '../../utils/web_app_url_utils';
19
+ export { eventCodeEnum } from '../../../types';
20
+ export { EVENT } from '../../../constant';
@@ -0,0 +1,29 @@
1
+ import { BizFlowStartBehavior, IoptionsParams, PaymentContext, ProductProcessor, SDKMetaData } from './deps';
2
+ export declare class EasySafePayProcessor implements ProductProcessor {
3
+ private paymentContext?;
4
+ private initConfig;
5
+ private logger;
6
+ private securityService;
7
+ private eventCenter;
8
+ private instanceId;
9
+ private hostSign;
10
+ private allowQueryCall;
11
+ private allowSubmitPayCallAhead;
12
+ private channelBehavior?;
13
+ private SECURITY_SDK_INIT_TIMEOUT;
14
+ private SDK_REQUEST_TIMEOUT;
15
+ private LOAD_APP_RESOURCES_TIMEOUT;
16
+ init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
17
+ startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
18
+ private buildWebAppUrl;
19
+ private buildRedirectResult;
20
+ /**
21
+ * 等待Web应用启动,然后发送renderComponent事件
22
+ * start waiting web launch, then send renderComponent event
23
+ * */
24
+ private sendRequestAndWaitWebLaunch;
25
+ private processQuery;
26
+ private processSubmitPay;
27
+ private acquireApdidToken;
28
+ private initSecuritySDK;
29
+ }
@@ -0,0 +1,7 @@
1
+ import { BizFlowStartBehavior, ProductProcessor } from "../..";
2
+ declare class ElementProcessor implements ProductProcessor {
3
+ constructor();
4
+ init(config: any, instanceId: string): any;
5
+ startBizFlow(): Promise<BizFlowStartBehavior>;
6
+ }
7
+ export { ElementProcessor };
@@ -0,0 +1,9 @@
1
+ import { BusContext, BusMessage, BusSubscriber } from "../busManager";
2
+ import { callOnEventCallback } from "../../../../types";
3
+ export declare class SDKCallbackBusSubscriber extends BusSubscriber {
4
+ private _onEventCallback?;
5
+ constructor(onEventCallback?: callOnEventCallback);
6
+ actionNames(): string[];
7
+ protected onEventCallback(message: BusMessage): void;
8
+ onMessage(context: BusContext, message: BusMessage): void;
9
+ }
@@ -0,0 +1,10 @@
1
+ import { BusContext, BusMessage, BusSubscriber } from '../../../../foundation/service/api-bus/busManager';
2
+ export declare class DataBusSubscriber extends BusSubscriber {
3
+ private instanceId;
4
+ constructor(instanceId: string);
5
+ actionNames(): string[];
6
+ protected getGlobalData(context: BusContext, message: BusMessage): void;
7
+ protected setGlobalData(context: BusContext, message: BusMessage): void;
8
+ protected clearGlobalData(context: BusContext, message: BusMessage): void;
9
+ onMessage(context: BusContext, message: BusMessage): void;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { BusContext, BusMessage, BusSubscriber } from "../../../../foundation/service/api-bus/busManager";
2
+ export declare class RequestBusSubscriber extends BusSubscriber {
3
+ private instanceId;
4
+ constructor(instanceId: string);
5
+ actionNames(): string[];
6
+ protected request(context: BusContext, message: BusMessage): Promise<void>;
7
+ protected getEnvInfo(context: BusContext, message: BusMessage): Promise<void>;
8
+ protected getUserAgent(context: BusContext, message: BusMessage): void;
9
+ onMessage(context: BusContext, message: BusMessage): void;
10
+ }
@@ -0,0 +1,12 @@
1
+ import { DeviceIdParameter } from "../../../../types";
2
+ import { BusContext, BusMessage, BusSubscriber } from '../busManager';
3
+ export type onDeviceIdCallback = (deviceIdParameter?: DeviceIdParameter, isPolling?: boolean) => Promise<string>;
4
+ export declare class SecurityBusSubscriber extends BusSubscriber {
5
+ private instanceId;
6
+ constructor(instanceId: string);
7
+ actionNames(): string[];
8
+ protected preInitSecurity(context: BusContext, message: BusMessage): Promise<void>;
9
+ protected initSecurity(context: BusContext, message: BusMessage): Promise<void>;
10
+ protected getSecurityDeviceId(context: BusContext, message: BusMessage): Promise<void>;
11
+ onMessage(context: BusContext, message: BusMessage): void;
12
+ }
@@ -0,0 +1,9 @@
1
+ import { BusContext, BusMessage, BusSubscriber } from '../busManager';
2
+ export declare class TrackerBusSubscriber extends BusSubscriber {
3
+ private instanceId;
4
+ private logger;
5
+ constructor(instanceId: string);
6
+ actionNames(): string[];
7
+ protected reportAnalytics(context: BusContext, message: BusMessage): Promise<void>;
8
+ onMessage(context: BusContext, message: BusMessage): void;
9
+ }
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Bus 埋点内容定义
3
+ */
4
+ export declare enum BusLogEventEnum {
5
+ /**
6
+ * 发送消息
7
+ * action:string
8
+ */
9
+ sdk_event_busPublishMessage = "sdk_event_busPublishMessage",
10
+ /**
11
+ * 发送消息时,返回事件结果(Web)
12
+ * action:string
13
+ */
14
+ sdk_event_busPublishCallback = "sdk_event_busPublishCallback",
15
+ /**
16
+ * 查询是否订阅
17
+ * action:string
18
+ * sub (processResult): bool
19
+ */
20
+ sdk_event_busIsSubscribe = "sdk_event_busIsSubscribe",
21
+ /**
22
+ * 订阅协议
23
+ * actions (actionNames): string[] , 用逗号拼接
24
+ */
25
+ sdk_event_busSubscribe = "sdk_event_busSubscribe",
26
+ /**
27
+ * 退订协议
28
+ * actions (actionNames): string[] , 用逗号拼接
29
+ */
30
+ sdk_event_busUnsubscribe = "sdk_event_busUnsubscribe",
31
+ /**
32
+ * 清除缓存(Web/Android)
33
+ */
34
+ sdk_event_busClear = "sdk_event_busClear",
35
+ /**
36
+ * 添加拦截器(Web/Android)
37
+ */
38
+ sdk_event_busAddInterceptor = "sdk_event_busAddInterceptor",
39
+ /**
40
+ * 发送消息时,对应aciton未订阅
41
+ */
42
+ sdk_error_busPublishUnsubscribeError = "sdk_error_busPublishUnsubscribeError",
43
+ /**
44
+ * 发送消息时异常
45
+ */
46
+ sdk_error_busPublishError = "sdk_error_busPublishError",
47
+ /**
48
+ * 发送消息无结果(Web)
49
+ */
50
+ sdk_error_busPublishNoResult = "sdk_error_busPublishNoResult"
51
+ }
52
+ /**
53
+ * 扩展协议可序列化的消息定义
54
+ */
55
+ export declare class BusMessage {
56
+ private action;
57
+ private data;
58
+ private jsonData;
59
+ constructor(action: string, data?: string);
60
+ getAction(): string;
61
+ getData(): string;
62
+ isJSONData(): boolean;
63
+ getJSONObject(): any;
64
+ private parseJSONData;
65
+ result(result?: any): BusMessage;
66
+ }
67
+ export type OnBusCallback = (message: BusMessage) => void;
68
+ /**
69
+ * 扩展总线可选的Context参数,在Web端用于实时回调
70
+ */
71
+ export declare class BusContext {
72
+ private callback;
73
+ constructor(callback: OnBusCallback);
74
+ onCallBack(message: BusMessage): void;
75
+ }
76
+ /**
77
+ * 扩展能力的能力定义,基于此协议实现扩展能力
78
+ */
79
+ export declare abstract class BusSubscriber {
80
+ abstract actionNames(): string[];
81
+ abstract onMessage(context: BusContext, message: BusMessage): void;
82
+ }
83
+ /**
84
+ * 拦截器,可增加扩展性
85
+ */
86
+ export interface BusInterceptor {
87
+ /**
88
+ * 未订阅场景拦截
89
+ * @param actionName
90
+ */
91
+ onUnsubscribedAction?(actionName: string): boolean;
92
+ /**
93
+ * 分发消息场景处理异常
94
+ * @param message
95
+ */
96
+ onPublishException?(message: BusMessage, e: any): void;
97
+ }
98
+ /**
99
+ * 事件总线入口,支持的关系为:
100
+ * 发送者 和 接收者的关系: 一对一,大多数场景,支持callback
101
+ * 发送者 和 接收者的关系: 多对一, 设计上多一对,但是同一时间点,只会一个发送者,支持callback
102
+ * 发送者 和 接收者的关系: 一对多,可能有,埋点多重上报?不需要callback,业务场景应该是一个广播场景
103
+ */
104
+ export declare class BusManager {
105
+ private static interceptors;
106
+ private static subscribersMap;
107
+ private static TAG;
108
+ private static _logSplit;
109
+ private isDebug;
110
+ private instanceId;
111
+ private logger;
112
+ constructor(instanceId?: string);
113
+ debugTrace(enable: boolean): void;
114
+ private traceLog;
115
+ private traceError;
116
+ private static getInstanceActionName;
117
+ clear(): void;
118
+ addInterceptor(interceptor: BusInterceptor): void;
119
+ publishForResult(message: BusMessage, config?: {
120
+ timeoutMs?: number;
121
+ fallback?: any;
122
+ }): Promise<BusMessage>;
123
+ publish(message: BusMessage, callback?: OnBusCallback): void;
124
+ subscribe(subscriber: BusSubscriber): void;
125
+ unsubscribe(subscriber: BusSubscriber): void;
126
+ isSubscribed(actionName: string): boolean;
127
+ }
@@ -0,0 +1,20 @@
1
+ import { Service } from '../../index';
2
+ import { IoptionsParams } from '../../../types';
3
+ import { LogService } from '../log';
4
+ import { BusMessage, BusSubscriber, OnBusCallback } from './busManager';
5
+ /**
6
+ * @author 谦彧 <zhangmian.zm@alipay.com>
7
+ * @date 2024/9/17
8
+ */
9
+ export declare class ApiBusManagerService implements Service {
10
+ protected logger: LogService;
11
+ protected instanceId: string;
12
+ private busManager;
13
+ init(initOptions: IoptionsParams, instanceId: string): void;
14
+ subscribe(subscriber: BusSubscriber): void;
15
+ unsubscribe(subscriber: BusSubscriber): void;
16
+ isSubscribed(actionName: string): boolean;
17
+ publish(message: BusMessage, callback?: OnBusCallback): void;
18
+ update(): void;
19
+ destroy(): void;
20
+ }
@@ -0,0 +1,48 @@
1
+ export declare enum PaymentActionEnum {
2
+ optional_init = "plugin_optional_init"
3
+ }
4
+ export declare enum ApplePayActionEnum {
5
+ canMakePayments = "plugin_CARD_APPLE_PAY_available",
6
+ createComponent = "plugin_CARD_APPLE_PAY_createComponent",
7
+ destroyComponent = "plugin_CARD_APPLE_PAY_destroyComponent"
8
+ }
9
+ export declare enum PaypalActionEnum {
10
+ mountComponent = "plugin_Paypal_mountComponent",
11
+ destroyComponent = "plugin_Paypal_destroyComponent"
12
+ }
13
+ export declare enum SDKCallbackActionEnum {
14
+ onEventCallback = "onEventCallback"
15
+ }
16
+ export declare enum RequestActiontEnum {
17
+ request = "request",
18
+ getEnvInfo = "getEnvInfo",
19
+ getUserAgent = "getUserAgent"
20
+ }
21
+ export declare enum DataActiontEnum {
22
+ getGlobalData = "getGlobalData",
23
+ setGlobalData = "setGlobalData",
24
+ clearGlobalData = "clearGlobalData"
25
+ }
26
+ export declare enum SecuritySDKActionEnum {
27
+ preInitSecurity = "preInitSecurity",
28
+ initSecurity = "initSecurity",
29
+ getSecurityDeviceId = "getSecurityDeviceId"
30
+ }
31
+ export declare enum TrackerActionEnum {
32
+ /**
33
+ * level: string info/error
34
+ * basic: json object
35
+ * extra: json object
36
+ */
37
+ reportAnalytics = "reportAnalytics"
38
+ }
39
+ export declare enum ComponentActiontEnum {
40
+ onDestory = "onDestory"
41
+ }
42
+ export declare enum RequestActiontEnum {
43
+ onDestory = "httpRequest"
44
+ }
45
+ export declare enum LoadingActiontEnum {
46
+ showLoading = "showLoading",
47
+ dismissLoading = "dismissLoading"
48
+ }
@@ -0,0 +1,41 @@
1
+ import { IoptionsParams } from '../../../types';
2
+ import { DisplayInfo, SDKMetaData, Service } from '../../index';
3
+ import { PopupManager } from './popup';
4
+ export declare class ContainerService implements Service {
5
+ private instanceId;
6
+ private sdkMetaData;
7
+ private initMessageEvent;
8
+ private clearTimerIdMapping;
9
+ popupManager: PopupManager;
10
+ private eventCenter;
11
+ private logService;
12
+ private displayInfo;
13
+ private webApp;
14
+ private _webAppHeartBeatTimeoutFn;
15
+ private clientHeight;
16
+ private boundFocusResizeChange;
17
+ private customizedLoadingListener;
18
+ destroy(): void;
19
+ init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
20
+ update(): void;
21
+ load(displayInfo: DisplayInfo, url: string, closeBtnFunc?: () => void): HTMLDivElement;
22
+ cleanContainer(displayInfo: DisplayInfo): void;
23
+ showLoading(container: HTMLDivElement, displayInfo: DisplayInfo): void;
24
+ dismissLoading(isKeepMockup?: boolean): void;
25
+ customizeLoading(listener: (event: 'SDK_START_OF_LOADING' | 'SDK_END_OF_LOADING') => void): void;
26
+ startHideAnim(): void;
27
+ private handleAccountFocus;
28
+ private addCapabilityToEventCenter;
29
+ private addCapabilityToApiBusManager;
30
+ private updateMaskCloseBtn;
31
+ private handleSizeChanged;
32
+ private focusResizeChange;
33
+ private focusScrollFixed;
34
+ private handleAppHeartBeat;
35
+ private changeCloseBtnVisibility;
36
+ private handleMaskCloseBtnShow;
37
+ private handleCloseButtonTheme;
38
+ private handlePopupWindow;
39
+ private handlePopWindow;
40
+ getWebApp(): HTMLIFrameElement;
41
+ }
@@ -7,12 +7,12 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
7
7
  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; }
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
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); }
10
+ import { isEmpty } from "../../../util";
10
11
  import { addInlineLoading, createInlineBaseElement } from "../../../component/component.inline.style";
11
12
  import { addPopupLoading, createBaseElement } from "../../../component/component.popup.style";
12
13
  import { insertStyleSheet } from "../../../component/popupWindow.style";
13
- import { closeImg, closeImgLight, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../../constant";
14
+ import { COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, ERRORMESSAGE, EVENT, LOADING_ID, MOCKUP_ID, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT, closeImg, closeImgLight } from "../../../constant";
14
15
  import { DisplayTypeEnum, ProductSceneEnum } from "../../../types";
15
- import { isEmpty } from "../../../util";
16
16
  import { ServiceProvider } from "../index";
17
17
  import { PopupManager } from "./popup";
18
18
  import { createIframe, startSizeChangeAnim } from "./utils";
@@ -217,9 +217,6 @@ export var ContainerService = /*#__PURE__*/function () {
217
217
  this.eventCenter.listen(EVENT.appHeartBeat.name, function () {
218
218
  _this.handleAppHeartBeat();
219
219
  });
220
- this.eventCenter.listen(EVENT.canIUse.name, function (data, payload) {
221
- _this.handleCanIUse(data, payload);
222
- });
223
220
  /**
224
221
  * 目前仅用于ESP V2的 web sdk
225
222
  * 原因: 在账户输入页和OTP页面的h5场景下键盘弹起页面会有问题,iframe有固定高度,键盘弹起时应用层不会触发大小变化
@@ -449,34 +446,6 @@ export var ContainerService = /*#__PURE__*/function () {
449
446
  data: data
450
447
  });
451
448
  }
452
- }, {
453
- key: "handleCanIUse",
454
- value: function handleCanIUse(data, payload) {
455
- var _payload$context3;
456
- // 前置校验
457
- var funcName = data === null || data === void 0 ? void 0 : data.funcName;
458
- if (!funcName || typeof funcName !== 'string') {
459
- var _payload$context2;
460
- this.eventCenter.dispatchToApp({
461
- event: 'appEventCallback',
462
- eventCallbackId: (_payload$context2 = payload.context) === null || _payload$context2 === void 0 ? void 0 : _payload$context2.eventCallbackId,
463
- data: {
464
- exist: false,
465
- success: false
466
- }
467
- });
468
- return;
469
- }
470
- var exist = this.eventCenter.isExist(funcName);
471
- this.eventCenter.dispatchToApp({
472
- event: 'appEventCallback',
473
- eventCallbackId: (_payload$context3 = payload.context) === null || _payload$context3 === void 0 ? void 0 : _payload$context3.eventCallbackId,
474
- data: {
475
- exist: exist,
476
- success: true
477
- }
478
- });
479
- }
480
449
  }, {
481
450
  key: "getWebApp",
482
451
  value: function getWebApp() {