@alipay/ams-checkout 0.0.1737621505-dev.2 → 0.0.1738831627-dev.4

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.
@@ -1,4 +1,24 @@
1
- import { ActionForm, ConnectErrorCode, ElementPaymentMethod } from '../../../types';
1
+ import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IPaymentMethod } from '../../../types';
2
+ export declare enum ElementPaymentEvent {
3
+ RENDER_COMPONENT = "renderComponent",
4
+ CAPTURE_ASSET = "onCaptureAsset",
5
+ SIGN_OUT = "onSignout",
6
+ BLUR = "onBlur",
7
+ VALIDATE = "submitPay",
8
+ SUBMIT_RISK = "onSubmitRisk",
9
+ AFTER_SUBMIT = "onAfterSubmit",
10
+ SIZE_CHANGE = "onSizeChange",
11
+ LAUNCH = "onLaunch",
12
+ CALLBACK = "callback",
13
+ SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
14
+ LOG = "log"
15
+ }
16
+ export declare enum ElementPaymentMethod {
17
+ CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
18
+ AUTH_ELEMENT = "AUTH_ELEMENT",
19
+ ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
20
+ PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
21
+ }
2
22
  export declare enum ThemeType {
3
23
  NostalgicGray = "nostalgicGray",
4
24
  Default = "default",
@@ -7,6 +27,20 @@ export declare enum ThemeType {
7
27
  GamingPurple = "gamingPurple",
8
28
  AgateGreen = "agateGreen"
9
29
  }
30
+ export declare enum ElementType {
31
+ auth = "auth",
32
+ address = "address",
33
+ payment = "payment"
34
+ }
35
+ export declare enum PaymentElementLayout {
36
+ Tabs = "tabs",
37
+ Accordion = "Accordion"
38
+ }
39
+ export declare enum MountElementType {
40
+ auth = "AUTH_ELEMENT",
41
+ address = "ADDRESS_ELEMENT",
42
+ payment = "PAYMENT_ELEMENT"
43
+ }
10
44
  export declare const addressTheme: {
11
45
  default: string;
12
46
  night: string;
@@ -78,22 +112,51 @@ interface AddressMountConfig {
78
112
  hideFields?: Array<HideField>;
79
113
  }
80
114
  export interface AddressMountOptions extends BaseMountOptions<AddressMountConfig> {
81
- type: 'address';
115
+ type: ElementType.address;
82
116
  prefillValue: Array<AddressSubmitData>;
83
117
  appearance?: {
84
- theme: ThemeType.Default | ThemeType.Night;
118
+ theme?: ThemeType.Default | ThemeType.Night;
85
119
  };
86
120
  }
87
121
  export interface LinkAuthMountOptions extends BaseMountOptions {
88
- type: 'auth';
122
+ type: ElementType.auth;
89
123
  appearance?: {
90
- theme: ThemeType;
124
+ theme?: ThemeType;
91
125
  };
92
126
  }
93
127
  export interface PaymentMountOptions extends BaseMountOptions {
94
- type: 'payment';
128
+ type: ElementType.payment;
95
129
  appearance?: {
96
- theme: ThemeType;
130
+ theme?: ThemeType;
131
+ layout?: {
132
+ type: PaymentElementLayout;
133
+ };
134
+ variables?: {
135
+ 'content-primary': string;
136
+ 'content-secondary': string;
137
+ 'content-tertiary': string;
138
+ 'content-quaternary': string;
139
+ 'background-primary': string;
140
+ 'background-secondary': string;
141
+ 'background-disable': string;
142
+ 'background-transparency': string;
143
+ 'border-primary': string;
144
+ 'border-secondary': string;
145
+ 'border-disable': string;
146
+ 'action-normal': string;
147
+ 'action-hover': string;
148
+ 'action-disable': string;
149
+ 'action-secondary': string;
150
+ 'state-failure': string;
151
+ 'state-warning': string;
152
+ 'state-success': string;
153
+ 'state-info': string;
154
+ 'state-marketing': string;
155
+ 'radius-backup': string;
156
+ 'radius-module': string;
157
+ 'radius-component': string;
158
+ 'radius-button': string;
159
+ };
97
160
  };
98
161
  }
99
162
  export declare enum AddressEventCallbackName {
@@ -188,4 +251,98 @@ export interface SubmitFuncResult {
188
251
  success: boolean;
189
252
  msg: string;
190
253
  }
254
+ declare enum AccountStatusEnum {
255
+ EFFECTIVE = "EFFECTIVE",
256
+ UNREGISTERED = "UNREGISTERED"
257
+ }
258
+ type IAccountInfo = {
259
+ email?: string;
260
+ verifyId?: string;
261
+ accountStatus?: AccountStatusEnum;
262
+ oneAccountId?: string;
263
+ needOtp?: boolean;
264
+ errorMsg?: string;
265
+ inputStatus?: 'success' | 'loading' | 'error' | 'focused' | '';
266
+ resendLeftTimes?: number;
267
+ };
268
+ interface ShippingsItem {
269
+ shippingName: {
270
+ firstName: string;
271
+ lastName: string;
272
+ };
273
+ prefer: '1' | '0';
274
+ shippingId: string;
275
+ shippingPhoneNo: string;
276
+ shippingAddress: {
277
+ region: string;
278
+ state: string;
279
+ city: string;
280
+ address1: string;
281
+ address2: string;
282
+ zipCode: string;
283
+ };
284
+ }
285
+ interface Estimate {
286
+ unit: string;
287
+ value: number;
288
+ }
289
+ interface DeliveryEstimate {
290
+ maximum: Estimate;
291
+ minimum: Estimate;
292
+ }
293
+ interface FixedAmount {
294
+ amount: number;
295
+ currency: string;
296
+ }
297
+ interface ShippingRateData {
298
+ displayName: string;
299
+ deliveryEstimate: DeliveryEstimate;
300
+ fixedAmount: FixedAmount;
301
+ }
302
+ interface ShippingAddress {
303
+ address1: string;
304
+ address2: string;
305
+ city: string;
306
+ region: string;
307
+ state: string;
308
+ zipCode: string;
309
+ }
310
+ interface IUserName {
311
+ firstName: string;
312
+ middleName?: string;
313
+ lastName: string;
314
+ fullName?: string;
315
+ }
316
+ type Shippings = ShippingsItem[];
317
+ type IPaymentMethods = IPaymentMethod[];
318
+ interface CKPShipping {
319
+ shippingRateId?: string;
320
+ shippingRateData?: ShippingRateData;
321
+ shippingAddress: ShippingAddress;
322
+ shippingFee?: IAmount;
323
+ shippingFeeView?: IAmountView;
324
+ shippingDescription?: string;
325
+ deliveryEstimate?: DeliveryEstimate;
326
+ shippingFeeId?: string;
327
+ shippingName?: IUserName;
328
+ shippingPhoneNo?: string;
329
+ shipToEmail?: string;
330
+ notes?: string;
331
+ }
332
+ export interface AccountQueryRequest {
333
+ paymentSessionData: string;
334
+ paymentSessionConfig: any;
335
+ accountInfo: IAccountInfo;
336
+ }
337
+ export interface AccountQueryResult {
338
+ accountInfo: IAccountInfo;
339
+ actionForm?: ActionForm;
340
+ paymentMethods: IPaymentMethods;
341
+ shippings: Shippings;
342
+ success: boolean;
343
+ errorCode?: string;
344
+ errorMessage?: string;
345
+ errorStatus?: string;
346
+ shippingInfo?: CKPShipping;
347
+ }
191
348
  export {};
@@ -2,6 +2,28 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
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
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
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 ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
6
+ ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
7
+ ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
8
+ ElementPaymentEvent["SIGN_OUT"] = "onSignout";
9
+ ElementPaymentEvent["BLUR"] = "onBlur";
10
+ ElementPaymentEvent["VALIDATE"] = "submitPay";
11
+ ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
12
+ ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
13
+ ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
14
+ ElementPaymentEvent["LAUNCH"] = "onLaunch";
15
+ ElementPaymentEvent["CALLBACK"] = "callback";
16
+ ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
17
+ ElementPaymentEvent["LOG"] = "log";
18
+ return ElementPaymentEvent;
19
+ }({});
20
+ export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
21
+ ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
22
+ ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
23
+ ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
24
+ ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
25
+ return ElementPaymentMethod;
26
+ }({});
5
27
  export var ThemeType = /*#__PURE__*/function (ThemeType) {
6
28
  ThemeType["NostalgicGray"] = "nostalgicGray";
7
29
  ThemeType["Default"] = "default";
@@ -11,6 +33,23 @@ export var ThemeType = /*#__PURE__*/function (ThemeType) {
11
33
  ThemeType["AgateGreen"] = "agateGreen";
12
34
  return ThemeType;
13
35
  }({});
36
+ export var ElementType = /*#__PURE__*/function (ElementType) {
37
+ ElementType["auth"] = "auth";
38
+ ElementType["address"] = "address";
39
+ ElementType["payment"] = "payment";
40
+ return ElementType;
41
+ }({});
42
+ export var PaymentElementLayout = /*#__PURE__*/function (PaymentElementLayout) {
43
+ PaymentElementLayout["Tabs"] = "tabs";
44
+ PaymentElementLayout["Accordion"] = "Accordion";
45
+ return PaymentElementLayout;
46
+ }({});
47
+ export var MountElementType = /*#__PURE__*/function (MountElementType) {
48
+ MountElementType["auth"] = "AUTH_ELEMENT";
49
+ MountElementType["address"] = "ADDRESS_ELEMENT";
50
+ MountElementType["payment"] = "PAYMENT_ELEMENT";
51
+ return MountElementType;
52
+ }({});
14
53
  export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
15
54
  export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
16
55
  EventCallbackCode["FAILED"] = "FAILED";
@@ -33,4 +72,9 @@ export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbac
33
72
  return AddressEventCallbackName;
34
73
  }({});
35
74
 
36
- // export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
75
+ // export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
76
+ var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
77
+ AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
78
+ AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
79
+ return AccountStatusEnum;
80
+ }(AccountStatusEnum || {}); // element 接口start
@@ -1,4 +1,4 @@
1
- import { type EventPayload, type IPaymentSessionMetaData } from '../../types';
1
+ import { EventPayloadContext, type EventPayload, type IPaymentMethod, type IPaymentSessionMetaData } from '../../types';
2
2
  import { Logger } from '../../util/logger';
3
3
  export type IChannelBehavior = {
4
4
  usePaymentSessionAsQueryResult: boolean;
@@ -19,37 +19,43 @@ type GetDoubleFaParams = {
19
19
  export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
20
20
  export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
21
21
  export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
22
- export declare class ApplePaySdk {
22
+ export declare class ApplePayService {
23
23
  private APPLESDKURL;
24
- private session;
24
+ private applePaySession;
25
25
  private paymentSessionData;
26
- private parseData;
26
+ private sessionResult;
27
27
  /**
28
28
  * @description 支付状态,pending:支付中,normal:正常
29
29
  */
30
30
  private paymentStatus;
31
+ /**
32
+ * @description paymentRequest
33
+ */
34
+ private paymentRequest;
31
35
  private logger;
32
- constructor({ paymentSessionData, parseData, logger, }: {
33
- paymentSessionData: string;
34
- parseData: IPaymentSessionMetaData;
36
+ private dispatchToApp;
37
+ private paymentMethod;
38
+ constructor({ sessionData, paymentSessionMetaData, paymentMethod, logger, dispatchToApp, }: {
39
+ sessionData: string;
40
+ paymentSessionMetaData: IPaymentSessionMetaData;
41
+ paymentMethod: IPaymentMethod;
35
42
  logger: Logger;
43
+ dispatchToApp: (payload: {
44
+ context: EventPayloadContext;
45
+ }) => void;
36
46
  });
37
- startPay(): Promise<unknown>;
38
- begin(): Promise<unknown>;
47
+ private startPay;
48
+ private setApplePayStatus;
39
49
  private submitPay;
40
- private setPayStatus;
41
- initApplePaySession(): Promise<never>;
42
- private abortSession;
43
- private get initSessionParams();
44
- private get isRequiredParameters();
50
+ submit(): Promise<void>;
51
+ private getDeviceId;
52
+ private initApplePaySession;
45
53
  private isCanMakePayments;
46
54
  private loadApplePaySdk;
47
- private get checkScriptIsLoaded();
48
- /**
49
- * @description 非标方案,sdk目前无法直接监听国内不支持弹窗的关闭操作
50
- */
55
+ private abortPaySession;
51
56
  private addEventListener;
52
- private getDeviceId;
57
+ private get initSessionParams();
58
+ private get isRequiredParameters();
59
+ private get checkScriptIsLoaded();
53
60
  }
54
- export declare const isSkipRenderPaymentMethod: (parseData: IPaymentSessionMetaData) => boolean;
55
61
  export {};