@alipay/ams-checkout 0.0.1730107332-dev.32 → 0.0.1730107332-dev.34
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/component/channel.js +18 -10
- package/esm/config/index.js +3 -3
- package/esm/core/component/ckp/index.js +3 -2
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +60 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +816 -0
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +491 -0
- package/esm/core/component/element/type.d.ts +184 -0
- package/esm/core/component/element/type.js +35 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/foundation/core/index.d.ts +1 -1
- package/esm/foundation/core/index.js +5 -5
- package/esm/foundation/index.d.ts +1 -0
- package/esm/foundation/service/container/index.js +1 -0
- package/esm/foundation/service/event-center.d.ts +2 -0
- package/esm/foundation/service/event-center.js +36 -2
- package/esm/foundation/service/security/index.js +20 -4
- package/esm/index.d.ts +5 -1
- package/esm/index.js +16 -1
- package/esm/plugin/component/cashierApp.d.ts +3 -1
- package/esm/plugin/component/cashierApp.js +12 -5
- package/esm/plugin/component/channel.d.ts +2 -2
- package/esm/plugin/component/component.inline.style.d.ts +1 -1
- package/esm/plugin/component/component.inline.style.js +6 -4
- package/esm/plugin/component/index.d.ts +1 -0
- package/esm/plugin/component/index.js +106 -55
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +2 -0
- package/esm/types/index.d.ts +194 -17
- package/esm/types/index.js +44 -4
- package/package.json +2 -1
@@ -0,0 +1,35 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
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; }
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
|
+
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); }
|
5
|
+
export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
6
|
+
ThemeType["NostalgicGray"] = "nostalgicGray";
|
7
|
+
ThemeType["Default"] = "default";
|
8
|
+
ThemeType["Night"] = "night";
|
9
|
+
ThemeType["CherryBlossomPink"] = "cherryBlossomPink";
|
10
|
+
ThemeType["GamingPurple"] = "gamingPurple";
|
11
|
+
ThemeType["AgateGreen"] = "agateGreen";
|
12
|
+
return ThemeType;
|
13
|
+
}({});
|
14
|
+
export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
|
15
|
+
export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
|
16
|
+
EventCallbackCode["Failed"] = "Failed";
|
17
|
+
EventCallbackCode["Completed"] = "Completed";
|
18
|
+
return EventCallbackCode;
|
19
|
+
}({});
|
20
|
+
export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
|
21
|
+
ELEMENT_ENVIRONMENT["DEV"] = "DEV";
|
22
|
+
ELEMENT_ENVIRONMENT["TEST"] = "TEST";
|
23
|
+
ELEMENT_ENVIRONMENT["SIT"] = "SIT";
|
24
|
+
ELEMENT_ENVIRONMENT["PRE"] = "PRE";
|
25
|
+
ELEMENT_ENVIRONMENT["PROD"] = "PROD";
|
26
|
+
return ELEMENT_ENVIRONMENT;
|
27
|
+
}({});
|
28
|
+
// export type IMountOptions = AddressMountOptions | LinkAuthMountOptions | PaymentMountOptions;
|
29
|
+
|
30
|
+
export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbackName) {
|
31
|
+
AddressEventCallbackName["SHIPPING_CHANGE"] = "SHIPPING_CHANGE";
|
32
|
+
return AddressEventCallbackName;
|
33
|
+
}({});
|
34
|
+
|
35
|
+
// export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export interface ISessionDataExtendInfo {
|
2
|
+
displayLayout: 'LEFT_ORDER_AND_RIGHT_PAYMENT' | 'LEFT_PAYMENT_AND_RIGHT_ORDER';
|
3
|
+
displayAntomLogo: string;
|
4
|
+
themeType: 'LIGHT' | 'NIGHT' | 'CUSTOMIZE';
|
5
|
+
OPEN_MULTI_PAYMENT_ABILITY: boolean;
|
6
|
+
[key: string]: any;
|
7
|
+
}
|
8
|
+
export interface LinkData {
|
9
|
+
linkId: string;
|
10
|
+
region: string;
|
11
|
+
displaySetting?: ISessionDataExtendInfo;
|
12
|
+
}
|
13
|
+
export declare const displayIframe: (selector: string) => void;
|
@@ -18,7 +18,7 @@ export declare class AntomSDKCore {
|
|
18
18
|
private prepare;
|
19
19
|
startBizFlow(options: StartBizFlowOptions): Promise<void>;
|
20
20
|
getServiceProvider(): ServiceProvider;
|
21
|
-
|
21
|
+
getBizFlowBehavior(): BizFlowStartBehavior;
|
22
22
|
getPaymentContext(): PaymentContext;
|
23
23
|
destroy(): void;
|
24
24
|
private handleBehaviorRender;
|
@@ -160,7 +160,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
160
160
|
key: "startBizFlow",
|
161
161
|
value: function () {
|
162
162
|
var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
|
163
|
-
var _this$paymentContext
|
163
|
+
var _this$paymentContext$, _this$paymentContext$2;
|
164
164
|
var paymentSession, displayInfo, _convertPaymentSessio, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
|
165
165
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
166
166
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -193,8 +193,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
193
193
|
ServiceProvider.getInstance(this.instanceId).update(this.paymentContext);
|
194
194
|
|
195
195
|
// Invoke processor
|
196
|
-
productScene = this.paymentContext.paymentSessionObj
|
197
|
-
paymentMethod = (_this$paymentContext$ = this.paymentContext.paymentSessionObj.paymentMethodInfoView) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext
|
196
|
+
productScene = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentSessionConfig) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.productScene;
|
197
|
+
paymentMethod = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentMethodInfoView) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.paymentMethodType;
|
198
198
|
_context3.prev = 13;
|
199
199
|
if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
|
200
200
|
_context3.next = 20;
|
@@ -260,8 +260,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
260
260
|
return ServiceProvider.getInstance(this.instanceId);
|
261
261
|
}
|
262
262
|
}, {
|
263
|
-
key: "
|
264
|
-
value: function
|
263
|
+
key: "getBizFlowBehavior",
|
264
|
+
value: function getBizFlowBehavior() {
|
265
265
|
return this.bizFlowStartBehavior;
|
266
266
|
}
|
267
267
|
}, {
|
@@ -41,6 +41,7 @@ export interface ProductProcessor {
|
|
41
41
|
export interface BizFlowStartBehavior {
|
42
42
|
behaviorType: 'RENDER' | 'REDIRECT' | 'NONE';
|
43
43
|
payload: RenderBehaviorPayload | RedirectBehaviorPayload;
|
44
|
+
data?: any;
|
44
45
|
}
|
45
46
|
export interface RenderBehaviorPayload {
|
46
47
|
url: string;
|
@@ -181,6 +181,7 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
181
181
|
});
|
182
182
|
this.eventCenter.listen(EVENT.popupWindow.name, function (data) {
|
183
183
|
var _this2$displayInfo;
|
184
|
+
if (data.paymentElementOldModel) return;
|
184
185
|
_this2.popupManager.popup(_objectSpread({
|
185
186
|
platform: (_this2$displayInfo = _this2.displayInfo) === null || _this2$displayInfo === void 0 ? void 0 : _this2$displayInfo.platform
|
186
187
|
}, data)).catch(function (error) {
|
@@ -27,6 +27,7 @@ export declare class EventCenter implements Service {
|
|
27
27
|
* @param domain - The domain of the app.
|
28
28
|
*/
|
29
29
|
addIFrame(iframe: HTMLIFrameElement): void;
|
30
|
+
removeIFrame(iframe: HTMLIFrameElement): void;
|
30
31
|
/**
|
31
32
|
* Handles messages received from the app.
|
32
33
|
* @param e - The message event.
|
@@ -61,6 +62,7 @@ export declare class EventCenter implements Service {
|
|
61
62
|
* @param func - The callback function to execute when the event is emitted.
|
62
63
|
*/
|
63
64
|
emitAndListen(payloadContext: EventPayloadContext, func: IListener): void;
|
65
|
+
queryParse(url?: string): Record<string, any>;
|
64
66
|
/**
|
65
67
|
* Dispatches the event payload to the app via postMessage.
|
66
68
|
* @param payloadContext - The context containing event to be dispatched.
|
@@ -1,4 +1,6 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
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
|
+
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; }
|
2
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
5
|
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); } }
|
4
6
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -70,6 +72,16 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
70
72
|
origin: getIframeOrigin(iframe)
|
71
73
|
});
|
72
74
|
}
|
75
|
+
}, {
|
76
|
+
key: "removeIFrame",
|
77
|
+
value: function removeIFrame(iframe) {
|
78
|
+
var index = this.iframes.findIndex(function (item) {
|
79
|
+
return item.origin === getIframeOrigin(iframe);
|
80
|
+
});
|
81
|
+
if (index !== -1) {
|
82
|
+
this.iframes.splice(index, 1);
|
83
|
+
}
|
84
|
+
}
|
73
85
|
|
74
86
|
/**
|
75
87
|
* Handles messages received from the app.
|
@@ -179,6 +191,23 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
179
191
|
this.listen(payloadContext.eventCallbackId, func);
|
180
192
|
this.dispatchToApp(payloadContext);
|
181
193
|
}
|
194
|
+
}, {
|
195
|
+
key: "queryParse",
|
196
|
+
value: function queryParse(url) {
|
197
|
+
var qs = {};
|
198
|
+
var urlString = url;
|
199
|
+
if (!urlString) {
|
200
|
+
urlString = window.location.href;
|
201
|
+
}
|
202
|
+
urlString.replace(/([^?=&#]+)(=([^&#]*))?/g, function (_$0, $1, _$2, $3) {
|
203
|
+
if ($3 === undefined) {
|
204
|
+
return '';
|
205
|
+
}
|
206
|
+
qs[$1] = decodeURIComponent($3);
|
207
|
+
return qs[$1];
|
208
|
+
});
|
209
|
+
return qs;
|
210
|
+
}
|
182
211
|
|
183
212
|
/**
|
184
213
|
* Dispatches the event payload to the app via postMessage.
|
@@ -187,7 +216,8 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
187
216
|
}, {
|
188
217
|
key: "dispatchToApp",
|
189
218
|
value: function dispatchToApp(payloadContext) {
|
190
|
-
var _this$iframes
|
219
|
+
var _this$iframes,
|
220
|
+
_this = this;
|
191
221
|
var data = {
|
192
222
|
name: MessageName.SDK_TO_APP,
|
193
223
|
context: payloadContext,
|
@@ -200,7 +230,11 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
200
230
|
console.warn('get app contentWindow error', iframe);
|
201
231
|
return;
|
202
232
|
}
|
203
|
-
|
233
|
+
var _ref = _this.queryParse(iframe.ref.src) || {},
|
234
|
+
instanceId = _ref.instanceId;
|
235
|
+
iframe.ref.contentWindow.postMessage(JSON.stringify(_objectSpread(_objectSpread({}, data), {}, {
|
236
|
+
instanceId: instanceId
|
237
|
+
})), (_iframe$origin = iframe.origin) !== null && _iframe$origin !== void 0 ? _iframe$origin : '*');
|
204
238
|
});
|
205
239
|
}
|
206
240
|
}, {
|
@@ -9,7 +9,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
9
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
10
10
|
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); }
|
11
11
|
import { ProductSceneEnum } from "../../../types";
|
12
|
-
import { Security, getSecurityConfigStorageKey, getSecurityHost, getSecurityScene } from "./security";
|
12
|
+
import { Security, SecurityRegionEnum, getSecurityConfigStorageKey, getSecurityHost, getSecurityScene } from "./security";
|
13
13
|
import { getOrSetStorageId, safeJson } from "../../../util";
|
14
14
|
import { ServiceProvider } from '..';
|
15
15
|
export var SecurityService = /*#__PURE__*/function () {
|
@@ -175,10 +175,26 @@ export var SecurityService = /*#__PURE__*/function () {
|
|
175
175
|
reject();
|
176
176
|
}, timeout);
|
177
177
|
}
|
178
|
-
|
179
|
-
|
178
|
+
_this2._newSecuritySDKByScene({
|
179
|
+
product: _this2.productScene,
|
180
|
+
region: isPre ? SecurityRegionEnum.SG : undefined
|
181
|
+
}, function () {
|
182
|
+
_this2.logger.logInfo({
|
183
|
+
title: "sdk_event_securitySdk".concat(sdkAction, "Success")
|
184
|
+
}, isPre ? {
|
185
|
+
product: _this2.productScene
|
186
|
+
} : undefined).send();
|
187
|
+
resolve();
|
188
|
+
}, function (msg) {
|
189
|
+
_this2.logger.logError({
|
190
|
+
title: 'sdk_error_securitySdkInitFailed',
|
191
|
+
msg: msg || undefined
|
192
|
+
}, {
|
193
|
+
product: _this2.productScene,
|
194
|
+
sign: isPre ? 'Active initialization' : 'SDK internal initialization'
|
195
|
+
}).send();
|
180
196
|
reject();
|
181
|
-
}
|
197
|
+
});
|
182
198
|
}));
|
183
199
|
case 7:
|
184
200
|
case "end":
|
package/esm/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { AddressComponent } from './core/component/address';
|
2
|
+
import { ElementComponent } from './core/component/element';
|
2
3
|
import { AMSComponent } from './core/component/index';
|
3
|
-
import { ComponentSignEnum, IoptionsAddressParams, IoptionsParams
|
4
|
+
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams } from './types';
|
4
5
|
export { AMSCheckoutPage } from './core/component/ckp';
|
5
6
|
export * from './types';
|
6
7
|
export declare class AMSCheckout extends AMSComponent {
|
@@ -24,6 +25,9 @@ export declare class AntomElement extends AMSCheckout {
|
|
24
25
|
export declare class AddressElement extends AddressComponent {
|
25
26
|
constructor(options: IoptionsAddressParams);
|
26
27
|
}
|
28
|
+
export declare class Element extends ElementComponent {
|
29
|
+
constructor(options: IElementOptions);
|
30
|
+
}
|
27
31
|
export default AMSCheckout;
|
28
32
|
export declare class AMSEasyPay {
|
29
33
|
private core;
|
package/esm/index.js
CHANGED
@@ -23,8 +23,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
23
23
|
*/
|
24
24
|
import { ADDRESSElementAppVersion, AMSAutoDebitAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
|
25
25
|
import { AddressComponent } from "./core/component/address";
|
26
|
+
import { ElementComponent } from "./core/component/element";
|
26
27
|
import { AMSComponent } from "./core/component/index";
|
27
|
-
import { ComponentSignEnum,
|
28
|
+
import { ComponentSignEnum, DisplayTypeEnum } from "./types";
|
29
|
+
import { ProductSceneEnum } from "./types/index";
|
28
30
|
import { LogConfig, Logger } from "./util/logger";
|
29
31
|
var logger = new Logger(LogConfig, true);
|
30
32
|
export { AMSCheckoutPage } from "./core/component/ckp";
|
@@ -142,6 +144,19 @@ export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
|
|
142
144
|
}
|
143
145
|
return _createClass(AddressElement);
|
144
146
|
}(AddressComponent);
|
147
|
+
export var Element = /*#__PURE__*/function (_ElementComponent) {
|
148
|
+
_inherits(Element, _ElementComponent);
|
149
|
+
var _super8 = _createSuper(Element);
|
150
|
+
function Element(options) {
|
151
|
+
_classCallCheck(this, Element);
|
152
|
+
var _options = Object.assign({}, options, {
|
153
|
+
product: ProductSceneEnum.ELEMENT_PAYMENT,
|
154
|
+
environment: options.environment
|
155
|
+
});
|
156
|
+
return _super8.call(this, _options);
|
157
|
+
}
|
158
|
+
return _createClass(Element);
|
159
|
+
}(ElementComponent);
|
145
160
|
export default AMSCheckout;
|
146
161
|
export var AMSEasyPay = /*#__PURE__*/function () {
|
147
162
|
function AMSEasyPay(options) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ComponentSignEnum, Ianalytics, DisplayTypeEnum } from '../../types';
|
2
|
-
export declare const getAppPath: (environment: string, appVersion: string, componentSign: ComponentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean) => any;
|
2
|
+
export declare const getAppPath: (environment: string, appVersion: string, componentSign: ComponentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean, localLink?: string) => any;
|
3
3
|
export declare const getAppDomain: (domainParams: {
|
4
4
|
environment: string;
|
5
5
|
appVersion: string;
|
@@ -8,6 +8,7 @@ export declare const getAppDomain: (domainParams: {
|
|
8
8
|
productSceneVersion: string;
|
9
9
|
extendInfo: string;
|
10
10
|
mid: string;
|
11
|
+
localLink: string;
|
11
12
|
}) => string;
|
12
13
|
export declare const getIframeUrl: (iframeParams: {
|
13
14
|
componentSign: ComponentSignEnum;
|
@@ -22,6 +23,7 @@ export declare const getIframeUrl: (iframeParams: {
|
|
22
23
|
renderDisplayType: DisplayTypeEnum;
|
23
24
|
isPreload?: string;
|
24
25
|
hostSign?: string;
|
26
|
+
localLink?: string;
|
25
27
|
mid?: string;
|
26
28
|
}) => {
|
27
29
|
path: string;
|
@@ -60,7 +60,7 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
|
60
60
|
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
|
61
61
|
var _signSupportMap;
|
62
62
|
var signSupportMap = (_signSupportMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_signSupportMap, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_signSupportMap, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0.0']));
|
63
|
-
var supportProductSceneVersion = signSupportMap[componentSign];
|
63
|
+
var supportProductSceneVersion = signSupportMap[componentSign] || [];
|
64
64
|
// 从左到右,从旧到新
|
65
65
|
var isSupport = supportProductSceneVersion.find(function (it) {
|
66
66
|
return it === productSceneVersion;
|
@@ -77,6 +77,7 @@ export var getAppPath = function getAppPath() {
|
|
77
77
|
var extendInfo = arguments.length > 5 ? arguments[5] : undefined;
|
78
78
|
var mid = arguments.length > 6 ? arguments[6] : undefined;
|
79
79
|
var sendLog = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
80
|
+
var localLink = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
|
80
81
|
var _ref = queryParse() || {},
|
81
82
|
urlTestHost = _ref.host;
|
82
83
|
var upgradeAppVersion = getAppVersion(extendInfo, productScene, mid, sendLog);
|
@@ -94,6 +95,9 @@ export var getAppPath = function getAppPath() {
|
|
94
95
|
}
|
95
96
|
var finalProductSceneVersion = getFinalProductSceneVersion(componentSign, productSceneVersion);
|
96
97
|
// only for test while testurl?host=https://xxxxx.test.html
|
98
|
+
if (localLink) {
|
99
|
+
return localLink;
|
100
|
+
}
|
97
101
|
if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
|
98
102
|
return urlTestHost;
|
99
103
|
}
|
@@ -127,9 +131,10 @@ export var getAppDomain = function getAppDomain(domainParams) {
|
|
127
131
|
productScene = domainParams.productScene,
|
128
132
|
productSceneVersion = domainParams.productSceneVersion,
|
129
133
|
extendInfo = domainParams.extendInfo,
|
130
|
-
mid = domainParams.mid
|
134
|
+
mid = domainParams.mid,
|
135
|
+
localLink = domainParams.localLink;
|
131
136
|
var reg = /^https?:\/\/([^/<>\s]+\.?)*/;
|
132
|
-
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo, mid));
|
137
|
+
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo, mid, false, localLink));
|
133
138
|
return macth && macth[0] || '';
|
134
139
|
};
|
135
140
|
export var getIframeUrl = function getIframeUrl(iframeParams) {
|
@@ -151,8 +156,10 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
151
156
|
_iframeParams$hostSig = iframeParams.hostSign,
|
152
157
|
hostSign = _iframeParams$hostSig === void 0 ? '' : _iframeParams$hostSig,
|
153
158
|
_iframeParams$mid = iframeParams.mid,
|
154
|
-
mid = _iframeParams$mid === void 0 ? '' : _iframeParams$mid
|
155
|
-
|
159
|
+
mid = _iframeParams$mid === void 0 ? '' : _iframeParams$mid,
|
160
|
+
_iframeParams$localLi = iframeParams.localLink,
|
161
|
+
localLink = _iframeParams$localLi === void 0 ? '' : _iframeParams$localLi;
|
162
|
+
var path = getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo || '', mid, true, localLink);
|
156
163
|
var appMatched = getMatchAppVersion(extendInfo, {
|
157
164
|
sdkVersion: sdkVersion,
|
158
165
|
productScene: productScene,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { EventPayload, IPaymentSessionMetaData } from '
|
2
|
-
type IChannelBehavior = {
|
1
|
+
import type { EventPayload, IPaymentSessionMetaData } from '../../types';
|
2
|
+
export type IChannelBehavior = {
|
3
3
|
usePaymentSessionAsQueryResult: boolean;
|
4
4
|
submitPayInSdk: boolean;
|
5
5
|
createIframeNode: boolean;
|
@@ -6,5 +6,5 @@ interface Options {
|
|
6
6
|
}
|
7
7
|
export declare const inlineComponentAddCss: () => void;
|
8
8
|
export declare const addInlineLoading: (_selector: HTMLDivElement, platform: PlatformEnum, options: Options) => void;
|
9
|
-
export declare const createInlineBaseElement: (selector: string) => HTMLDivElement;
|
9
|
+
export declare const createInlineBaseElement: (selector: string, containerId?: string, selectorId?: string) => HTMLDivElement;
|
10
10
|
export {};
|
@@ -107,13 +107,15 @@ export var addInlineLoading = function addInlineLoading(_selector, platform, opt
|
|
107
107
|
amsSetSize(null, loadingDom);
|
108
108
|
};
|
109
109
|
export var createInlineBaseElement = function createInlineBaseElement(selector) {
|
110
|
+
var containerId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : COMPONENT_CONTAINER_ID;
|
111
|
+
var selectorId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
110
112
|
var inlineBaseStyle = document.getElementById(INLINE_BASE_STYLE_ID);
|
111
113
|
if (!inlineBaseStyle) inlineComponentAddCss();
|
112
|
-
if (document.getElementById(
|
114
|
+
if (document.getElementById(selectorId ? selectorId : containerId)) return;
|
113
115
|
var amsComponentContainer = document.createElement('div');
|
114
|
-
amsComponentContainer.className = "".concat(
|
115
|
-
amsComponentContainer.id =
|
116
|
-
var selectorDom = document.querySelector(selector);
|
116
|
+
amsComponentContainer.className = "".concat(containerId, "-inline");
|
117
|
+
amsComponentContainer.id = selectorId ? selectorId : containerId;
|
118
|
+
var selectorDom = document.querySelector("".concat(selector));
|
117
119
|
if (selectorDom) selectorDom.appendChild(amsComponentContainer);
|
118
120
|
return amsComponentContainer;
|
119
121
|
};
|