@alipay/ams-checkout 0.0.1737621505-dev.3 → 0.0.1739763028-dev.1

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.
@@ -28,7 +28,7 @@ import { isLocalMock } from "../../util/mock";
28
28
  import { matchVersion } from "../../util/versionCompare";
29
29
  import { handlePaymentSessionConfig } from "../payment-element/utils";
30
30
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
31
- import { ApplePaySdk, getChannelBehavior, handleGooglePay } from "./channel";
31
+ import { ApplePayService, getChannelBehavior, handleGooglePay } from "./channel";
32
32
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
33
33
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
34
34
  import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
@@ -1342,33 +1342,15 @@ var ComponentApp = /*#__PURE__*/function () {
1342
1342
  });
1343
1343
  }
1344
1344
  if ((data === null || data === void 0 || (_data$context3 = data.context) === null || _data$context3 === void 0 ? void 0 : _data$context3.event) === EVENT.getApplePayToken.name) {
1345
- var _this$_renderParams16, _this$_renderParams17;
1346
- var applePayService = new ApplePaySdk({
1347
- paymentSessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
1348
- parseData: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.paymentSessionMetaData,
1349
- logger: this.AMSSDK.logger
1350
- });
1351
- applePayService.startPay().then(function (res) {
1352
- _this7.dispatchToApp({
1353
- context: {
1354
- event: 'getApplePayToken',
1355
- data: {
1356
- success: true,
1357
- result: res
1358
- }
1359
- }
1360
- });
1361
- }).catch(function (err) {
1362
- _this7.dispatchToApp({
1363
- context: {
1364
- event: 'getApplePayToken',
1365
- data: {
1366
- success: false,
1367
- result: err
1368
- }
1369
- }
1370
- });
1345
+ var _data$context4, _this$_renderParams16, _this$_renderParams17;
1346
+ var applePayService = new ApplePayService({
1347
+ paymentMethod: data === null || data === void 0 || (_data$context4 = data.context) === null || _data$context4 === void 0 || (_data$context4 = _data$context4.data) === null || _data$context4 === void 0 ? void 0 : _data$context4.paymentMethod,
1348
+ sessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
1349
+ paymentSessionMetaData: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.paymentSessionMetaData,
1350
+ logger: this.AMSSDK.logger,
1351
+ dispatchToApp: this.dispatchToApp.bind(this)
1371
1352
  });
1353
+ applePayService.submit();
1372
1354
  return;
1373
1355
  }
1374
1356
  // log event before sending the callback
@@ -1386,11 +1368,11 @@ var ComponentApp = /*#__PURE__*/function () {
1386
1368
  key: "logEventCallback",
1387
1369
  value: function logEventCallback(data, title) {
1388
1370
  if (data.context.event === EVENT.eventCallback.name) {
1389
- var _data$context5;
1371
+ var _data$context6;
1390
1372
  var callbackData = '';
1391
1373
  try {
1392
- var _data$context4;
1393
- callbackData = JSON.stringify((data === null || data === void 0 || (_data$context4 = data.context) === null || _data$context4 === void 0 ? void 0 : _data$context4.data) || '');
1374
+ var _data$context5;
1375
+ callbackData = JSON.stringify((data === null || data === void 0 || (_data$context5 = data.context) === null || _data$context5 === void 0 ? void 0 : _data$context5.data) || '');
1394
1376
  } catch (e) {
1395
1377
  console.error(e);
1396
1378
  }
@@ -1398,7 +1380,7 @@ var ComponentApp = /*#__PURE__*/function () {
1398
1380
  title: title
1399
1381
  }, {
1400
1382
  callbackData: callbackData,
1401
- callbackId: (data === null || data === void 0 || (_data$context5 = data.context) === null || _data$context5 === void 0 ? void 0 : _data$context5.eventCallbackId) || ''
1383
+ callbackId: (data === null || data === void 0 || (_data$context6 = data.context) === null || _data$context6 === void 0 ? void 0 : _data$context6.eventCallbackId) || ''
1402
1384
  }).send();
1403
1385
  }
1404
1386
  }
@@ -5,7 +5,6 @@
5
5
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
6
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
7
  */
8
- import { IApplePayContactField } from '../plugin/applepay/interface';
9
8
  export * from '../core/component/element/type';
10
9
  export type onChange = () => onCnageResult;
11
10
  interface onCnageResult {
@@ -265,8 +264,6 @@ export interface IPaymentSessionMetaData {
265
264
  extendInfo?: {
266
265
  merchantCapabilities?: string[];
267
266
  supportedNetworks?: string[];
268
- requiredBillingContactFields: IApplePayContactField[];
269
- requiredShippingContactFields: IApplePayContactField[];
270
267
  };
271
268
  merchantInfo?: {
272
269
  registeredCountry?: string;
@@ -881,8 +878,7 @@ export declare enum ElementPaymentEvent {
881
878
  LAUNCH = "onLaunch",
882
879
  CALLBACK = "callback",
883
880
  SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
884
- LOG = "log",
885
- HANDLE_PAYMENT = "handlePayment"
881
+ LOG = "log"
886
882
  }
887
883
  export declare enum ConnectErrorCode {
888
884
  RISK_REJECT = "RISK_REJECT",
@@ -5,7 +5,6 @@
5
5
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
6
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
7
  */
8
-
9
8
  /* eslint-disable @typescript-eslint/no-explicit-any */
10
9
  export * from "../core/component/element/type";
11
10
 
@@ -248,7 +247,6 @@ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
248
247
  ElementPaymentEvent["CALLBACK"] = "callback";
249
248
  ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
250
249
  ElementPaymentEvent["LOG"] = "log";
251
- ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
252
250
  return ElementPaymentEvent;
253
251
  }({});
254
252
  export var ConnectErrorCode = /*#__PURE__*/function (ConnectErrorCode) {
@@ -46,5 +46,4 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
46
46
  timeOut?: number;
47
47
  loadCallback?: any;
48
48
  }, logger: any): Promise<unknown>;
49
- declare const isEmpty: (value: any) => boolean;
50
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, };
49
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
package/esm/util/index.js CHANGED
@@ -328,19 +328,4 @@ function loadSDKScript(_ref, logger) {
328
328
  document.head.appendChild(script);
329
329
  });
330
330
  }
331
- var isEmpty = function isEmpty(value) {
332
- // 判断空对象
333
- if (value && _typeof(value) === 'object' && Object.keys(value).length === 0) {
334
- return true;
335
- }
336
- // 判断空数组
337
- if (Array.isArray(value) && value.length === 0) {
338
- return true;
339
- }
340
- // 判断空值
341
- if (value === null || value === undefined || value === '') {
342
- return true;
343
- }
344
- return false;
345
- };
346
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty };
331
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
@@ -3,7 +3,7 @@
3
3
  * @param v1
4
4
  * @param v2
5
5
  */
6
- export declare function compareVersion(v1: string, v2: string): 1 | 0 | -1;
6
+ export declare function compareVersion(v1: string, v2: string): 0 | 1 | -1;
7
7
  /**
8
8
  * 判断version版本是否在range参数版本的范围内
9
9
  * @param version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1737621505-dev.3",
3
+ "version": "0.0.1739763028-dev.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",