@alipay/ams-checkout 0.0.1744283958-dev.5 → 0.0.1744283958-dev.9
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/constant/index.d.ts +3 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/component/element/elementContainerService/containerService.js +4 -1
- package/esm/core/component/element/elementController/index.js +5 -1
- package/esm/core/component/element/elementProcessor/addressProcessor.js +1 -1
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +31 -15
- package/esm/core/component/element/type.d.ts +13 -0
- package/esm/core/component/element/util.d.ts +2 -1
- package/esm/core/component/element/util.js +124 -0
- package/esm/foundation/core/index.js +2 -1
- package/esm/foundation/index.d.ts +7 -0
- package/esm/foundation/index.js +3 -0
- package/esm/foundation/service/container/index.js +9 -2
- package/package.json +1 -1
package/esm/constant/index.d.ts
CHANGED
@@ -216,6 +216,9 @@ export declare const EVENT: {
|
|
216
216
|
webAppReady: {
|
217
217
|
name: string;
|
218
218
|
};
|
219
|
+
showToast: {
|
220
|
+
name: string;
|
221
|
+
};
|
219
222
|
};
|
220
223
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
221
224
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
package/esm/constant/index.js
CHANGED
@@ -45,7 +45,10 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
45
45
|
platform: PlatformEnum.desktop,
|
46
46
|
isRetention: false,
|
47
47
|
selector: selector,
|
48
|
-
appendAliasContainerId: true
|
48
|
+
appendAliasContainerId: true,
|
49
|
+
iframeStyle: {
|
50
|
+
display: 'block'
|
51
|
+
}
|
49
52
|
}, processor.generateIframeSrc({
|
50
53
|
link: options === null || options === void 0 || (_options$debugProps = options.debugProps) === null || _options$debugProps === void 0 ? void 0 : _options$debugProps.localLink,
|
51
54
|
instanceId: this.instanceId
|
@@ -31,7 +31,7 @@ import { ElementContainerService } from "../elementContainerService"; // 引入
|
|
31
31
|
import { IContainerStatus } from "../elementContainerService/containerService";
|
32
32
|
import { oneAccountUpdate, sdkActionUpdate } from "../mock";
|
33
33
|
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode } from "../type";
|
34
|
-
import { checkCanMount, checkCanUpdate, handleRedirect } from "../util";
|
34
|
+
import { checkCanMount, checkCanUpdate, handleRedirect, showToast } from "../util";
|
35
35
|
var TIMEOUT_DURATION = 10000;
|
36
36
|
var ElementController = /*#__PURE__*/function () {
|
37
37
|
// 新增变量
|
@@ -302,6 +302,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
302
302
|
_this4.destroyHandle();
|
303
303
|
});
|
304
304
|
this.serviceMap.EventCenter.listen(EVENT.webAppReady.name, function (data) {
|
305
|
+
clearTimeout(_this4.initTimeout);
|
305
306
|
if (_this4.elementContainerService.getContainerService(data.source)) {
|
306
307
|
renderCallback({
|
307
308
|
success: true
|
@@ -310,6 +311,9 @@ var ElementController = /*#__PURE__*/function () {
|
|
310
311
|
}
|
311
312
|
_this4.changeLoading(false);
|
312
313
|
});
|
314
|
+
this.serviceMap.EventCenter.listen(EVENT.showToast.name, function (data) {
|
315
|
+
showToast(data);
|
316
|
+
});
|
313
317
|
}
|
314
318
|
}, {
|
315
319
|
key: "sendRequestAndWaitWebLaunch",
|
@@ -81,7 +81,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
81
81
|
analytics = _this$options.analytics,
|
82
82
|
locale = _this$options.locale;
|
83
83
|
var version = PackageJson.version;
|
84
|
-
var pageUrl = "/
|
84
|
+
var pageUrl = "/element-address/".concat(version, "/pages/address/index.html");
|
85
85
|
return _generateIframeSrc({
|
86
86
|
paymentSession: paymentSession,
|
87
87
|
paymentSessionObj: paymentSessionObj,
|
@@ -23,16 +23,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
23
23
|
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; }
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
25
25
|
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); }
|
26
|
-
import { parseSessionData } from "../../index";
|
27
26
|
import PackageJson from "../../../../../package.json";
|
28
27
|
import { EVENT } from "../../../../constant";
|
29
28
|
import { ServiceProvider } from "../../../../foundation/service";
|
30
29
|
import { ApplePaySdk, handleGooglePay, isSkipRenderPaymentMethod } from "../../../../plugin/component/channel";
|
31
|
-
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
32
|
-
import { oneAccount, sdkAction } from "../mock";
|
33
30
|
import { LogConfig, Logger } from "../../../../util/logger";
|
34
|
-
|
31
|
+
import { parseSessionData } from "../../index";
|
32
|
+
import { oneAccount, sdkAction } from "../mock";
|
33
|
+
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
35
34
|
import BaseElementProcessor from "./baseElementProcessor";
|
35
|
+
var logger = new Logger(LogConfig, true);
|
36
36
|
var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
37
37
|
_inherits(PaymentProcessor, _BaseElementProcessor);
|
38
38
|
var _super = _createSuper(PaymentProcessor);
|
@@ -51,6 +51,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
51
51
|
_createClass(PaymentProcessor, [{
|
52
52
|
key: "onReady",
|
53
53
|
value: function onReady(extraParam) {
|
54
|
+
var _this$elementContaine, _this$elementContaine2, _this$elementContaine3, _this$elementContaine4, _this$elementContaine5;
|
54
55
|
var paymentContext = this.elementContainer.getPaymentContext();
|
55
56
|
this.eventCenter.dispatchToApp({
|
56
57
|
event: 'renderComponent',
|
@@ -62,6 +63,13 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
62
63
|
screenHeight: screen.height,
|
63
64
|
screenWidth: screen.width
|
64
65
|
},
|
66
|
+
logMetaData: {
|
67
|
+
paymentMethodCategoryType: (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 ? void 0 : _this$elementContaine.getPaymentContext().paymentSessionObj.paymentSessionConfig.paymentMethodCategoryType,
|
68
|
+
productSceneVersion: (_this$elementContaine2 = this.elementContainer) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.getPaymentContext().paymentSessionObj.paymentSessionConfig.productSceneVersion,
|
69
|
+
trackId: (_this$elementContaine3 = this.elementContainer) === null || _this$elementContaine3 === void 0 ? void 0 : _this$elementContaine3.getPaymentContext().paymentSessionId,
|
70
|
+
merchantId: (_this$elementContaine4 = this.elementContainer) === null || _this$elementContaine4 === void 0 || (_this$elementContaine4 = _this$elementContaine4.getPaymentContext()) === null || _this$elementContaine4 === void 0 || (_this$elementContaine4 = _this$elementContaine4.paymentSessionObj) === null || _this$elementContaine4 === void 0 ? void 0 : _this$elementContaine4.clientId,
|
71
|
+
paymentMethodType: (_this$elementContaine5 = this.elementContainer) === null || _this$elementContaine5 === void 0 || (_this$elementContaine5 = _this$elementContaine5.getPaymentContext()) === null || _this$elementContaine5 === void 0 || (_this$elementContaine5 = _this$elementContaine5.paymentSessionObj) === null || _this$elementContaine5 === void 0 || (_this$elementContaine5 = _this$elementContaine5.paymentMethodInfoView) === null || _this$elementContaine5 === void 0 ? void 0 : _this$elementContaine5.paymentMethodType
|
72
|
+
},
|
65
73
|
appearance: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.displayInfo.appearance,
|
66
74
|
sessionResult: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSessionObj,
|
67
75
|
notRedirectAfterComplete: (extraParam === null || extraParam === void 0 ? void 0 : extraParam.notRedirectAfterComplete) === true,
|
@@ -132,12 +140,12 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
132
140
|
key: "initApplePaySdk",
|
133
141
|
value: function () {
|
134
142
|
var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
135
|
-
var _this$
|
136
|
-
var _this$
|
143
|
+
var _this$elementContaine7;
|
144
|
+
var _this$elementContaine6, paymentSessionObj, paymentSessionId;
|
137
145
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
138
146
|
while (1) switch (_context.prev = _context.next) {
|
139
147
|
case 0:
|
140
|
-
_this$
|
148
|
+
_this$elementContaine6 = (_this$elementContaine7 = this.elementContainer) === null || _this$elementContaine7 === void 0 ? void 0 : _this$elementContaine7.getPaymentContext(), paymentSessionObj = _this$elementContaine6.paymentSessionObj, paymentSessionId = _this$elementContaine6.paymentSessionId;
|
141
149
|
if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
|
142
150
|
_context.next = 13;
|
143
151
|
break;
|
@@ -230,12 +238,13 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
230
238
|
value: function () {
|
231
239
|
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
232
240
|
var _paymentSessionObj$co;
|
233
|
-
var requestService, _this$
|
241
|
+
var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo, merchantAppointParam, _this$options2, environment, locale, _ref4, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
|
234
242
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
235
243
|
while (1) switch (_context2.prev = _context2.next) {
|
236
244
|
case 0:
|
237
245
|
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
238
|
-
_this$
|
246
|
+
_this$elementContaine8 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine8.paymentSession, paymentSessionObj = _this$elementContaine8.paymentSessionObj, displayInfo = _this$elementContaine8.displayInfo;
|
247
|
+
merchantAppointParam = displayInfo.merchantAppointParam;
|
239
248
|
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
240
249
|
_ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
|
241
250
|
hostSign = paymentSession.split('&&')[1] || '';
|
@@ -243,17 +252,24 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
243
252
|
LOCAL_MOCK = window.location.href.indexOf('LOCAL_MOCK=1') !== -1;
|
244
253
|
generateActionQueryPromise = function generateActionQueryPromise() {
|
245
254
|
return new Promise(function (resolve, reject) {
|
255
|
+
var _displayInfo$merchant;
|
246
256
|
if (LOCAL_MOCK) {
|
247
257
|
setTimeout(function () {
|
248
|
-
resolve(oneAccount);
|
249
258
|
resolve(sdkAction);
|
250
259
|
}, 100);
|
251
260
|
return;
|
252
261
|
}
|
253
|
-
|
262
|
+
var sdkRequestData = {
|
254
263
|
paymentSessionConfig: paymentSessionConfig,
|
255
264
|
paymentSessionData: paymentSession
|
256
|
-
}
|
265
|
+
};
|
266
|
+
if (displayInfo !== null && displayInfo !== void 0 && (_displayInfo$merchant = displayInfo.merchantAppointParam) !== null && _displayInfo$merchant !== void 0 && _displayInfo$merchant.storedCard) {
|
267
|
+
sdkRequestData.merchantAppointParam = displayInfo.merchantAppointParam;
|
268
|
+
}
|
269
|
+
if (Object.prototype.hasOwnProperty.call(displayInfo, 'notRedirectAfterComplete')) {
|
270
|
+
sdkRequestData.notRedirectAfterComplete = displayInfo.notRedirectAfterComplete;
|
271
|
+
}
|
272
|
+
requestService.request(sdkRequestData, {
|
257
273
|
env: environment,
|
258
274
|
envInfo: {
|
259
275
|
locale: locale
|
@@ -298,9 +314,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
298
314
|
});
|
299
315
|
});
|
300
316
|
};
|
301
|
-
_context2.next =
|
317
|
+
_context2.next = 12;
|
302
318
|
return Promise.all(isConnect ? [generateActionQueryPromise(), generateOneAccountQueryPromise()] : [generateActionQueryPromise()]);
|
303
|
-
case
|
319
|
+
case 12:
|
304
320
|
_yield$Promise$all = _context2.sent;
|
305
321
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
306
322
|
originActionQueryResult = _yield$Promise$all2[0];
|
@@ -313,7 +329,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
313
329
|
originActionQueryResult: originActionQueryResult,
|
314
330
|
originOneAccountQueryResult: originOneAccountQueryResult
|
315
331
|
});
|
316
|
-
case
|
332
|
+
case 18:
|
317
333
|
case "end":
|
318
334
|
return _context2.stop();
|
319
335
|
}
|
@@ -375,4 +375,17 @@ export interface IElementProcessors {
|
|
375
375
|
[ElementType.address]: AddressProcessor;
|
376
376
|
[ElementType.payment]: PaymentProcessor;
|
377
377
|
}
|
378
|
+
export interface IToastOptions {
|
379
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
380
|
+
backgroundColor?: string;
|
381
|
+
color?: string;
|
382
|
+
padding?: string;
|
383
|
+
borderRadius?: string;
|
384
|
+
fontSize?: string;
|
385
|
+
zIndex?: number;
|
386
|
+
width?: string;
|
387
|
+
duration?: number;
|
388
|
+
icon?: 'SUCCESS' | 'FAIL';
|
389
|
+
spin?: boolean;
|
390
|
+
}
|
378
391
|
export {};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { IElementStatus } from '../../../foundation';
|
2
2
|
import { Ianalytics, IPaymentSessionMetaData } from '../../../types';
|
3
3
|
import { ContainerController } from './elementContainerService/containerService';
|
4
|
-
import { ELEMENT_ENVIRONMENT_TYPE, IElementOptions } from './type';
|
4
|
+
import { ELEMENT_ENVIRONMENT_TYPE, IElementOptions, IToastOptions } from './type';
|
5
5
|
declare const formatElementOption: (options: IElementOptions) => {
|
6
6
|
environment: ELEMENT_ENVIRONMENT_TYPE;
|
7
7
|
locale?: string;
|
@@ -56,4 +56,5 @@ export declare function redirect(data: {
|
|
56
56
|
applinkUrl?: string;
|
57
57
|
callAppJudgeTime?: number;
|
58
58
|
}): Promise<void>;
|
59
|
+
export declare function showToast(options?: IToastOptions, callback?: Function): void;
|
59
60
|
export { formatElementOption };
|
@@ -324,4 +324,128 @@ export function redirect(data) {
|
|
324
324
|
}
|
325
325
|
});
|
326
326
|
}
|
327
|
+
export function showToast() {
|
328
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
329
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
330
|
+
var createNode = function createNode() {
|
331
|
+
var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';
|
332
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
333
|
+
var children = arguments.length > 2 ? arguments[2] : undefined;
|
334
|
+
var node = document.createElement(tag);
|
335
|
+
Object.keys(props).forEach(function (key) {
|
336
|
+
if (key === 'style') {
|
337
|
+
Object.keys(props[key]).forEach(function (styleKey) {
|
338
|
+
node.style[styleKey] = props[key][styleKey];
|
339
|
+
});
|
340
|
+
} else {
|
341
|
+
node.setAttribute(key, props[key]);
|
342
|
+
}
|
343
|
+
});
|
344
|
+
if (typeof children === 'string') node.textContent = children;
|
345
|
+
return node;
|
346
|
+
};
|
347
|
+
var defaultOptions = {
|
348
|
+
position: 'bottom-right',
|
349
|
+
backgroundColor: 'rgba(0, 0, 0, 0.80)',
|
350
|
+
color: '#ffffff',
|
351
|
+
padding: '20px 16px',
|
352
|
+
borderRadius: '8px',
|
353
|
+
fontSize: '14px',
|
354
|
+
zIndex: 9999,
|
355
|
+
width: '148px',
|
356
|
+
duration: 2000
|
357
|
+
};
|
358
|
+
var defaultIcon = {
|
359
|
+
SUCCESS: 'https://cdn.marmot-cloud.com/storage/2024/07/10/10b191d6-0b0a-4bd9-96cc-310b7f2a8530.svg',
|
360
|
+
FAIL: 'https://cdn.marmot-cloud.com/storage/2024/11/08/4ae27343-61d2-4a07-b323-c951c7711b40.svg'
|
361
|
+
};
|
362
|
+
var config = _objectSpread(_objectSpread({}, defaultOptions), options);
|
363
|
+
var container = document.getElementById('antom_toast-container');
|
364
|
+
if (!container) {
|
365
|
+
container = createNode('div', {
|
366
|
+
style: {
|
367
|
+
position: 'fixed',
|
368
|
+
display: 'flex',
|
369
|
+
justifyContent: 'center',
|
370
|
+
alignItems: 'center',
|
371
|
+
pointerEvents: 'none'
|
372
|
+
},
|
373
|
+
id: 'antom_toast-container'
|
374
|
+
});
|
375
|
+
document.body.appendChild(container);
|
376
|
+
} else {
|
377
|
+
container.innerHTML = '';
|
378
|
+
}
|
379
|
+
switch (config.position) {
|
380
|
+
case 'top-left':
|
381
|
+
container.style.top = '20px';
|
382
|
+
container.style.left = '20px';
|
383
|
+
break;
|
384
|
+
case 'top-right':
|
385
|
+
container.style.top = '20px';
|
386
|
+
container.style.right = '20px';
|
387
|
+
break;
|
388
|
+
case 'bottom-left':
|
389
|
+
container.style.bottom = '20px';
|
390
|
+
container.style.left = '20px';
|
391
|
+
break;
|
392
|
+
case 'bottom-right':
|
393
|
+
default:
|
394
|
+
container.style.bottom = '0';
|
395
|
+
container.style.right = '0';
|
396
|
+
container.style.top = '0';
|
397
|
+
container.style.left = '0';
|
398
|
+
break;
|
399
|
+
}
|
400
|
+
var toast = createNode('div', {
|
401
|
+
style: {
|
402
|
+
backgroundColor: config.backgroundColor,
|
403
|
+
color: config.color,
|
404
|
+
padding: config.padding,
|
405
|
+
borderRadius: config.borderRadius,
|
406
|
+
fontSize: config.fontSize,
|
407
|
+
opacity: '0',
|
408
|
+
transition: 'opacity 0.3s ease-in-out',
|
409
|
+
display: 'flex',
|
410
|
+
alignItems: 'center',
|
411
|
+
justifyContent: 'center',
|
412
|
+
flexDirection: 'column',
|
413
|
+
width: config.width,
|
414
|
+
boxSizing: 'border-box'
|
415
|
+
}
|
416
|
+
});
|
417
|
+
if (config.icon) {
|
418
|
+
var icon = createNode('img', {
|
419
|
+
style: {
|
420
|
+
width: '40px',
|
421
|
+
height: '40px'
|
422
|
+
},
|
423
|
+
src: config.icon ? defaultIcon[config.icon] : ''
|
424
|
+
});
|
425
|
+
toast.appendChild(icon);
|
426
|
+
}
|
427
|
+
var text = createNode('span', {
|
428
|
+
style: {
|
429
|
+
textAlign: 'center',
|
430
|
+
marginTop: '12px',
|
431
|
+
lineHeight: '20px',
|
432
|
+
fontFamily: "Noto Sans",
|
433
|
+
fontWeight: 400,
|
434
|
+
fontSize: '14px'
|
435
|
+
}
|
436
|
+
}, config.message);
|
437
|
+
toast.appendChild(text);
|
438
|
+
container.appendChild(toast);
|
439
|
+
setTimeout(function () {
|
440
|
+
toast.style.opacity = '1';
|
441
|
+
}, 10);
|
442
|
+
setTimeout(function () {
|
443
|
+
toast.style.opacity = '0';
|
444
|
+
setTimeout(function () {
|
445
|
+
var _container;
|
446
|
+
(_container = container) === null || _container === void 0 || _container.remove();
|
447
|
+
callback && callback();
|
448
|
+
}, 300);
|
449
|
+
}, config.duration);
|
450
|
+
}
|
327
451
|
export { formatElementOption };
|
@@ -406,7 +406,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
406
406
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
407
407
|
var containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
|
408
408
|
var cleanElement = function cleanElement() {
|
409
|
-
|
409
|
+
var _this3$paymentContext;
|
410
|
+
containerService.cleanContainer((_this3$paymentContext = _this3.paymentContext) === null || _this3$paymentContext === void 0 ? void 0 : _this3$paymentContext.displayInfo);
|
410
411
|
cleanMockup();
|
411
412
|
removeRetentionPopup();
|
412
413
|
// TODO @/component this.removeEventListener();
|
@@ -28,6 +28,13 @@ export declare class DisplayInfo {
|
|
28
28
|
selector: string;
|
29
29
|
appearance?: Record<string, any>;
|
30
30
|
appendAliasContainerId?: boolean;
|
31
|
+
merchantAppointParam?: {
|
32
|
+
storedCard: {
|
33
|
+
needCVV: boolean;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
iframeStyle?: Partial<CSSStyleDeclaration>;
|
37
|
+
notRedirectAfterComplete?: boolean;
|
31
38
|
constructor();
|
32
39
|
}
|
33
40
|
/**
|
package/esm/foundation/index.js
CHANGED
@@ -26,6 +26,9 @@ export var DisplayInfo = /*#__PURE__*/_createClass(function DisplayInfo() {
|
|
26
26
|
_defineProperty(this, "appearance", void 0);
|
27
27
|
// append selector name to containerId
|
28
28
|
_defineProperty(this, "appendAliasContainerId", void 0);
|
29
|
+
_defineProperty(this, "merchantAppointParam", void 0);
|
30
|
+
_defineProperty(this, "iframeStyle", void 0);
|
31
|
+
_defineProperty(this, "notRedirectAfterComplete", void 0);
|
29
32
|
this.platform = isPC() ? PlatformEnum.desktop : PlatformEnum.mobile;
|
30
33
|
this.isRetention = true;
|
31
34
|
this.type = DisplayTypeEnum.popup;
|
@@ -7,6 +7,7 @@ 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";
|
@@ -64,6 +65,12 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
64
65
|
type = displayInfo.type,
|
65
66
|
platform = displayInfo.platform;
|
66
67
|
var webApp = createIframe('antom-sdk-web-app' + (displayInfo.appendAliasContainerId ? "-".concat(selector) : ''));
|
68
|
+
if (!isEmpty(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.iframeStyle)) {
|
69
|
+
Object.keys(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.iframeStyle).forEach(function (key) {
|
70
|
+
var _displayInfo$iframeSt;
|
71
|
+
webApp.style[key] = displayInfo === null || displayInfo === void 0 || (_displayInfo$iframeSt = displayInfo.iframeStyle) === null || _displayInfo$iframeSt === void 0 ? void 0 : _displayInfo$iframeSt[key];
|
72
|
+
});
|
73
|
+
}
|
67
74
|
this.webApp = webApp;
|
68
75
|
this.displayInfo = displayInfo;
|
69
76
|
webApp.src = url;
|
@@ -83,7 +90,7 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
83
90
|
value: function cleanContainer(displayInfo) {
|
84
91
|
var _document$getElementB;
|
85
92
|
// selector and container
|
86
|
-
var selector = displayInfo.type === DisplayTypeEnum.inline ? displayInfo.selector : COMPONENT_CONTAINER_ID;
|
93
|
+
var selector = (displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.type) === DisplayTypeEnum.inline ? displayInfo.selector : COMPONENT_CONTAINER_ID;
|
87
94
|
var selectorDom = document.querySelector(selector);
|
88
95
|
if (selectorDom) {
|
89
96
|
selectorDom.innerHTML = '';
|
@@ -94,7 +101,7 @@ export var ContainerService = /*#__PURE__*/function () {
|
|
94
101
|
this.eventCenter.cleanIFrames();
|
95
102
|
|
96
103
|
// animation
|
97
|
-
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(displayInfo.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
104
|
+
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
98
105
|
}
|
99
106
|
}, {
|
100
107
|
key: "showLoading",
|