@alipay/ams-checkout 0.0.1730107332-dev.4 → 0.0.1730107332-dev.41

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 (122) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +2 -3
  3. package/esm/component/channel.js +55 -29
  4. package/esm/component/component.inline.style.js +1 -1
  5. package/esm/component/component.popup.style.d.ts +1 -3
  6. package/esm/component/component.popup.style.js +1 -3
  7. package/esm/config/index.d.ts +7 -7
  8. package/esm/config/index.js +10 -10
  9. package/esm/constant/index.d.ts +3 -0
  10. package/esm/constant/index.js +3 -0
  11. package/esm/core/bus/ability/callback.d.ts +9 -0
  12. package/esm/core/bus/ability/callback.js +55 -0
  13. package/esm/core/bus/ability/security.d.ts +10 -0
  14. package/esm/core/bus/ability/security.js +104 -0
  15. package/esm/core/bus/ability/tracker.d.ts +9 -0
  16. package/esm/core/bus/ability/tracker.js +77 -0
  17. package/esm/core/bus/index.d.ts +125 -0
  18. package/esm/core/bus/index.js +366 -0
  19. package/esm/core/bus/interface.d.ts +36 -0
  20. package/esm/core/bus/interface.js +40 -0
  21. package/esm/core/component/address.d.ts +8 -0
  22. package/esm/core/component/address.js +72 -0
  23. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  24. package/esm/core/component/appPreloadProcessing.js +89 -0
  25. package/esm/core/component/ckp/index.d.ts +27 -0
  26. package/esm/core/component/ckp/index.js +167 -0
  27. package/esm/core/component/element/components/address.d.ts +19 -0
  28. package/esm/core/component/element/components/address.js +68 -0
  29. package/esm/core/component/element/components/auth.d.ts +17 -0
  30. package/esm/core/component/element/components/auth.js +60 -0
  31. package/esm/core/component/element/components/payment.d.ts +19 -0
  32. package/esm/core/component/element/components/payment.js +74 -0
  33. package/esm/core/component/element/index.d.ts +47 -0
  34. package/esm/core/component/element/index.js +816 -0
  35. package/esm/core/component/element/mock.d.ts +4 -0
  36. package/esm/core/component/element/mock.js +491 -0
  37. package/esm/core/component/element/type.d.ts +190 -0
  38. package/esm/core/component/element/type.js +35 -0
  39. package/esm/core/component/element/utils.d.ts +13 -0
  40. package/esm/core/component/element/utils.js +6 -0
  41. package/esm/core/component/index.d.ts +51 -0
  42. package/esm/core/component/index.js +531 -0
  43. package/esm/core/drop-in/index.d.ts +22 -0
  44. package/esm/core/drop-in/index.js +104 -0
  45. package/esm/core/instance/index.d.ts +89 -0
  46. package/esm/core/instance/index.js +499 -0
  47. package/esm/foundation/core/index.d.ts +3 -3
  48. package/esm/foundation/core/index.js +10 -8
  49. package/esm/foundation/index.d.ts +6 -5
  50. package/esm/foundation/product-processor/easysafepay/deps.d.ts +6 -6
  51. package/esm/foundation/product-processor/easysafepay/deps.js +4 -4
  52. package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -3
  53. package/esm/foundation/product-processor/easysafepay/index.js +110 -243
  54. package/esm/foundation/service/api-bus/index.d.ts +2 -2
  55. package/esm/foundation/service/container/index.d.ts +4 -2
  56. package/esm/foundation/service/container/index.js +43 -1
  57. package/esm/foundation/service/event-center.d.ts +6 -4
  58. package/esm/foundation/service/event-center.js +47 -17
  59. package/esm/foundation/service/global-data/index.d.ts +2 -2
  60. package/esm/foundation/service/index.d.ts +2 -2
  61. package/esm/foundation/service/log/index.d.ts +2 -2
  62. package/esm/foundation/service/log/index.js +1 -1
  63. package/esm/foundation/service/requester/deps.d.ts +1 -1
  64. package/esm/foundation/service/requester/requester.d.ts +2 -2
  65. package/esm/foundation/service/security/index.d.ts +2 -2
  66. package/esm/foundation/service/security/index.js +5 -20
  67. package/esm/foundation/utils/redirect_utils.d.ts +5 -0
  68. package/esm/foundation/utils/redirect_utils.js +205 -58
  69. package/esm/foundation/utils/system_events.js +0 -5
  70. package/esm/foundation/utils/web_app_url_utils.js +1 -1
  71. package/esm/index.d.ts +31 -2
  72. package/esm/index.js +146 -6
  73. package/esm/plugin/applepay/component.d.ts +50 -0
  74. package/esm/plugin/applepay/component.js +339 -0
  75. package/esm/plugin/applepay/index.d.ts +17 -0
  76. package/esm/plugin/applepay/index.js +117 -0
  77. package/esm/plugin/applepay/interface.d.ts +161 -0
  78. package/esm/plugin/applepay/interface.js +69 -0
  79. package/esm/plugin/applepay/service.d.ts +54 -0
  80. package/esm/plugin/applepay/service.js +289 -0
  81. package/esm/plugin/component/cashierApp.d.ts +36 -0
  82. package/esm/plugin/component/cashierApp.js +244 -0
  83. package/esm/plugin/component/channel.d.ts +21 -0
  84. package/esm/plugin/component/channel.js +89 -0
  85. package/esm/plugin/component/component.inline.style.d.ts +10 -0
  86. package/esm/plugin/component/component.inline.style.js +121 -0
  87. package/esm/plugin/component/component.popup.style.d.ts +16 -0
  88. package/esm/plugin/component/component.popup.style.js +174 -0
  89. package/esm/plugin/component/index.d.ts +127 -0
  90. package/esm/plugin/component/index.js +1896 -0
  91. package/esm/plugin/component/popupWindow.style.d.ts +11 -0
  92. package/esm/plugin/component/popupWindow.style.js +121 -0
  93. package/esm/plugin/const.d.ts +2 -0
  94. package/esm/plugin/const.js +33 -0
  95. package/esm/plugin/drop-in/index.d.ts +71 -0
  96. package/esm/plugin/drop-in/index.js +324 -0
  97. package/esm/plugin/payment-element/utils.d.ts +2 -0
  98. package/esm/plugin/payment-element/utils.js +6 -0
  99. package/esm/plugin/paypal/index.d.ts +20 -0
  100. package/esm/plugin/paypal/index.js +390 -0
  101. package/esm/plugin/type.d.ts +34 -0
  102. package/esm/plugin/type.js +1 -0
  103. package/esm/plugin/utils.d.ts +6 -0
  104. package/esm/plugin/utils.js +21 -0
  105. package/esm/service/element.d.ts +4 -0
  106. package/esm/service/element.js +51 -0
  107. package/esm/service/index.d.ts +1 -0
  108. package/esm/service/index.js +2 -0
  109. package/esm/types/index.d.ts +228 -26
  110. package/esm/types/index.js +54 -5
  111. package/esm/util/createIframeNode.d.ts +6 -0
  112. package/esm/util/createIframeNode.js +48 -0
  113. package/esm/util/getBackScheme.d.ts +2 -2
  114. package/esm/util/getBackScheme.js +2 -2
  115. package/esm/util/index.d.ts +11 -1
  116. package/esm/util/index.js +84 -3
  117. package/esm/util/intl-callapp/es/index.js +0 -1
  118. package/esm/util/security.d.ts +33 -0
  119. package/esm/util/security.js +182 -0
  120. package/package.json +2 -1
  121. package/esm/foundation/types/index.d.ts +0 -4
  122. package/esm/foundation/types/index.js +0 -4
@@ -5,6 +5,7 @@
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
+ export * from '../core/component/element/type';
8
9
  export type onChange = () => onCnageResult;
9
10
  interface onCnageResult {
10
11
  complete: boolean;
@@ -19,7 +20,7 @@ interface AddressValueResult {
19
20
  /**
20
21
  * SDK options
21
22
  */
22
- export interface IOptionsParams {
23
+ export interface IoptionsParams {
23
24
  environment?: string;
24
25
  locale?: string;
25
26
  onError?: callOnError;
@@ -29,15 +30,15 @@ export interface IOptionsParams {
29
30
  onEventCallback?: callOnEventCallback;
30
31
  onClose?: callOnClose;
31
32
  onChange?: onChange;
32
- networkMode?: string;
33
- mode?: string;
34
33
  analytics?: {
35
34
  enabled: boolean;
36
35
  };
37
- product?: string;
38
36
  onBeforeSubmit?: callOnBeforeSubmit;
37
+ product?: string;
38
+ networkMode?: string;
39
+ mode?: string;
39
40
  }
40
- export interface IApplePayOptionsParams extends Pick<IOptionsParams, 'locale' | 'environment' | 'onEventCallback' | 'analytics'> {
41
+ export interface IApplePayOptionsParams extends Pick<IoptionsParams, 'locale' | 'environment' | 'onEventCallback' | 'analytics'> {
41
42
  }
42
43
  export type Iselector = string;
43
44
  export declare enum DisplayTypeEnum {
@@ -67,6 +68,7 @@ export declare enum ComponentSignEnum {
67
68
  'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
68
69
  'NONE' = "NONE",
69
70
  'VAULTING_CARD' = "VAULTING_CARD",
71
+ 'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT",
70
72
  'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
71
73
  'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
72
74
  }
@@ -99,15 +101,34 @@ export interface DeviceIdParameter {
99
101
  export interface IcreateComponent {
100
102
  sessionData: string;
101
103
  paymentSessionData?: string;
104
+ elementProps?: {
105
+ elementLink: string;
106
+ };
107
+ appendAliasContainerId?: boolean;
102
108
  notRedirectAfterComplete?: boolean;
103
109
  appearance?: {
104
110
  [x: string]: any;
105
111
  themeType?: string;
106
112
  accentColor?: string;
107
113
  };
108
- merchantAppointParam?: IMerchantAppointParam;
109
114
  isAppWebview?: boolean;
115
+ merchantAppointParam?: IMerchantAppointParam;
116
+ }
117
+ export interface IappendIframeNodesParams extends IcreateComponent {
118
+ paymentSessionMetaData: IPaymentSessionMetaData;
119
+ renderDisplayType: DisplayTypeEnum;
120
+ selector?: Iselector;
121
+ paypalConfiguration?: IPaypalConfiguration;
122
+ /** 将address-element参数定义合入原参数定义 */
123
+ configParams?: {
124
+ hideFields?: string[];
125
+ addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
126
+ };
127
+ prefillValue?: AddressItem[];
128
+ componentSession?: string;
129
+ loca?: string;
110
130
  }
131
+ /** 表单地址数据 */
111
132
  export interface AddressItem {
112
133
  shippingName: {
113
134
  firstName: string;
@@ -150,6 +171,7 @@ export interface AddressItem {
150
171
  prefer?: '1' | '0';
151
172
  shippingId?: string;
152
173
  }
174
+ type addressAutoSuggestDisabledType = 0 | 1;
153
175
  export interface IPaypalConfiguration {
154
176
  style?: object;
155
177
  blockPayPalCreditButton?: boolean;
@@ -181,7 +203,7 @@ export interface Isubmit {
181
203
  }
182
204
  export interface IpaymentSessionConfig {
183
205
  productScene: ProductSceneEnum;
184
- paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
206
+ paymentMethodCategoryType?: PaymentMethodCategoryTypeEnum;
185
207
  productSceneVersion: string;
186
208
  }
187
209
  export interface IpaymentSecurityConfig {
@@ -213,6 +235,7 @@ export interface PaymentSessionActionData {
213
235
  skipSdkQuery: boolean;
214
236
  requireFastSdk: boolean;
215
237
  nonCompliant?: boolean;
238
+ nonInitSecuritySDK?: boolean;
216
239
  skipSdkQueryForm?: {
217
240
  value: boolean;
218
241
  version: string;
@@ -227,6 +250,7 @@ export interface IPaymentSessionMetaData {
227
250
  moneyView?: any;
228
251
  extendInfo?: string;
229
252
  paymentMethodInfoView?: any;
253
+ paymentView?: any;
230
254
  action?: PaymentSessionActionData;
231
255
  authUrlInfo?: {
232
256
  appIdentifier?: string;
@@ -519,7 +543,6 @@ export interface CashierSubmitPayRequest {
519
543
  verifyFactors?: Record<string, string>;
520
544
  paymentSessionData: string;
521
545
  paymentSessionConfig?: any;
522
- traceId?: string;
523
546
  extParams?: any;
524
547
  }
525
548
  export interface CashierSdkActionQueryResult {
@@ -537,7 +560,6 @@ export interface CashierSdkActionQueryResult {
537
560
  normalUrl?: string;
538
561
  applinkUrl?: string;
539
562
  schemeUrl?: string;
540
- traceId?: string;
541
563
  authUrl?: string;
542
564
  extendInfo?: {
543
565
  channelOrderId?: string;
@@ -637,25 +659,202 @@ export declare enum ProductSceneVersion {
637
659
  V1 = "1.0",
638
660
  V2 = "2.0"
639
661
  }
640
- export declare enum EventCallbackCode {
641
- Failed = "Failed",
642
- Completed = "Completed"
662
+ export type IAppendParams = {
663
+ componentSign: ComponentSignEnum;
664
+ iframeNodesParams: IappendIframeNodesParams;
665
+ };
666
+ export declare enum AccountStatusEnum {
667
+ EFFECTIVE = "EFFECTIVE",
668
+ UNREGISTERED = "UNREGISTERED"
669
+ }
670
+ export type IAccountInfo = {
671
+ email?: string;
672
+ verifyId?: string;
673
+ accountStatus?: AccountStatusEnum;
674
+ oneAccountId?: string;
675
+ needOtp?: boolean;
676
+ errorMsg?: string;
677
+ inputStatus?: 'success' | 'loading' | 'error' | 'focused' | '';
678
+ resendLeftTimes?: number;
679
+ };
680
+ export interface AccountQueryRequest {
681
+ paymentSessionData: string;
682
+ paymentSessionConfig: any;
683
+ accountInfo: IAccountInfo;
643
684
  }
644
- export interface IElementOptions {
645
- sessionData: string;
646
- environment?: string;
647
- locale?: string;
648
- mode?: string;
649
- onEventCallback?: ({ code, message }: {
650
- code: EventCallbackCode;
651
- message: string;
652
- }) => void;
653
- loading?: {
654
- showLoading: boolean;
655
- onStartLoading?: () => void;
656
- onEndLoading?: () => void;
685
+ export interface ShippingsItem {
686
+ shippingName: {
687
+ firstName: string;
688
+ lastName: string;
689
+ };
690
+ prefer: '1' | '0';
691
+ shippingId: string;
692
+ shippingPhoneNo: string;
693
+ shippingAddress: {
694
+ region: string;
695
+ state: string;
696
+ city: string;
697
+ address1: string;
698
+ address2: string;
699
+ zipCode: string;
657
700
  };
658
701
  }
702
+ export interface ISubPaymentElementView {
703
+ defaultText: string;
704
+ defaultValue: string;
705
+ elementMandatory: boolean;
706
+ elementRegx?: string;
707
+ elementType: string;
708
+ extendInfo: string;
709
+ paramIllegalText: string;
710
+ paymentElementKey: string;
711
+ title: string;
712
+ validateFunction?: string;
713
+ isPart?: boolean;
714
+ isPartEnd?: boolean;
715
+ }
716
+ export interface IPaymentElement {
717
+ defaultValue: string;
718
+ elementMandatory: boolean;
719
+ elementType: string;
720
+ extendInfo: string;
721
+ paymentElementKey: string;
722
+ subPaymentElementView: ISubPaymentElementView[];
723
+ title: string;
724
+ }
725
+ export declare enum InterActionTypeEnum {
726
+ COLLECT_REDIRECT = "COLLECT_REDIRECT",
727
+ SHOW_CODE = "SHOW_CODE",
728
+ COLLECT_SHOW_CODE = "COLLECT_SHOW_CODE",
729
+ REDIRECT = "REDIRECT"
730
+ }
731
+ export interface IAmount {
732
+ amount?: string;
733
+ currency: string;
734
+ currencyLabel: string;
735
+ formattedAmount?: string;
736
+ formattedAmountWithCurrency?: string;
737
+ value: string;
738
+ }
739
+ export interface IAmountView {
740
+ currency: string;
741
+ currencyDivider: string;
742
+ currencyLabel: string;
743
+ currencySymbolPosition: 'L' | 'R';
744
+ formattedValue: string;
745
+ value: string;
746
+ }
747
+ export interface IPaymentMethod {
748
+ paymentMethodKey?: string;
749
+ antomPage?: string;
750
+ redirectUrl?: string;
751
+ icon?: string;
752
+ iconName?: string;
753
+ logoList?: Array<{
754
+ cardBrand: string;
755
+ logoUrl: string;
756
+ }>;
757
+ paymentMethod?: string;
758
+ paymentMethodName: string;
759
+ paymentMethodType: string;
760
+ category?: string;
761
+ paymentElements?: IPaymentElement[];
762
+ paymentMethodId?: string;
763
+ paymentMethodDetail?: {
764
+ last4?: string;
765
+ requireIssuerAuthentication?: string;
766
+ };
767
+ interActionType?: InterActionTypeEnum;
768
+ recommend?: boolean;
769
+ expressCheckout?: boolean;
770
+ webRedirectType?: string;
771
+ paymentCurrencyList?: string[];
772
+ paymentAmount?: IAmount;
773
+ paymentAmountView?: IAmountView;
774
+ paymentQuoteId?: string;
775
+ }
776
+ interface Estimate {
777
+ unit: string;
778
+ value: number;
779
+ }
780
+ interface DeliveryEstimate {
781
+ maximum: Estimate;
782
+ minimum: Estimate;
783
+ }
784
+ interface FixedAmount {
785
+ amount: number;
786
+ currency: string;
787
+ }
788
+ interface ShippingRateData {
789
+ displayName: string;
790
+ deliveryEstimate: DeliveryEstimate;
791
+ fixedAmount: FixedAmount;
792
+ }
793
+ export interface ShippingAddress {
794
+ address1: string;
795
+ address2: string;
796
+ city: string;
797
+ region: string;
798
+ state: string;
799
+ zipCode: string;
800
+ }
801
+ export interface IUserName {
802
+ firstName: string;
803
+ middleName?: string;
804
+ lastName: string;
805
+ fullName?: string;
806
+ }
807
+ export type Shippings = ShippingsItem[];
808
+ export type IPaymentMethods = IPaymentMethod[];
809
+ export interface CKPShipping {
810
+ shippingRateId?: string;
811
+ shippingRateData?: ShippingRateData;
812
+ shippingAddress: ShippingAddress;
813
+ shippingFee?: IAmount;
814
+ shippingFeeView?: IAmountView;
815
+ shippingDescription?: string;
816
+ deliveryEstimate?: DeliveryEstimate;
817
+ shippingFeeId?: string;
818
+ shippingName?: IUserName;
819
+ shippingPhoneNo?: string;
820
+ shipToEmail?: string;
821
+ notes?: string;
822
+ }
823
+ export interface AccountQueryResult {
824
+ accountInfo: IAccountInfo;
825
+ actionForm?: ActionForm;
826
+ paymentMethods: IPaymentMethods;
827
+ shippings: Shippings;
828
+ success: boolean;
829
+ errorCode?: string;
830
+ errorMessage?: string;
831
+ errorStatus?: string;
832
+ shippingInfo?: CKPShipping;
833
+ }
834
+ export declare enum ElementPaymentMethod {
835
+ CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
836
+ AUTH_ELEMENT = "AUTH_ELEMENT",
837
+ ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
838
+ PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
839
+ }
840
+ export declare enum ElementPaymentEvent {
841
+ INITIAL_DATA_READY = "initialDataReady",
842
+ CAPTURE_ASSET = "onCaptureAsset",
843
+ SIGN_OUT = "onSignout",
844
+ BLUR = "onBlur",
845
+ VALIDATE = "validate",
846
+ SUBMIT_RISK = "onSubmitRisk",
847
+ AFTER_SUBMIT = "onAfterSubmit",
848
+ SIZE_CHANGE = "onSizeChange",
849
+ LAUNCH = "onLaunch",
850
+ CALLBACK = "callback",
851
+ LOG = "log"
852
+ }
853
+ export declare enum ConnectErrorCode {
854
+ RISK_REJECT = "RISK_REJECT",
855
+ USER_AUTH_VERIFICATION_FAILED = "USER_AUTH_VERIFICATION_FAILED",
856
+ USER_NOT_EXISTS = "USER_NOT_EXISTS"
857
+ }
659
858
  export interface IoptionsAddressParams {
660
859
  environment?: string;
661
860
  locale?: string;
@@ -666,4 +865,7 @@ export interface IoptionsAddressParams {
666
865
  };
667
866
  product?: string;
668
867
  }
669
- export {};
868
+ export declare enum RiskSdkInfoEnum {
869
+ NEED = "need",
870
+ NO_NEED = "noneed"
871
+ }
@@ -6,6 +6,7 @@
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
8
  /* eslint-disable @typescript-eslint/no-explicit-any */
9
+ export * from "../core/component/element/type";
9
10
 
10
11
  /**
11
12
  * SDK options
@@ -31,10 +32,11 @@ export var ComponentSignEnum = /*#__PURE__*/function (ComponentSignEnum) {
31
32
  ComponentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
32
33
  ComponentSignEnum["NONE"] = "NONE";
33
34
  ComponentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
35
+ ComponentSignEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
34
36
  ComponentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
35
37
  ComponentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
36
38
  return ComponentSignEnum;
37
- }({}); // 'CHECKOUT_PAYMENT' = 'CHECKOUT_PAYMENT',
39
+ }({});
38
40
  export var ProductSceneEnum = /*#__PURE__*/function (ProductSceneEnum) {
39
41
  ProductSceneEnum["EASY_PAY"] = "EASY_PAY";
40
42
  ProductSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
@@ -56,6 +58,9 @@ export var PaymentMethodCategoryTypeEnum = /*#__PURE__*/function (PaymentMethodC
56
58
  PaymentMethodCategoryTypeEnum["ALL"] = "ALL";
57
59
  return PaymentMethodCategoryTypeEnum;
58
60
  }({});
61
+
62
+ /** 表单地址数据 */
63
+
59
64
  export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
60
65
  payPalConfigurationIntentEnum["intent"] = "intent";
61
66
  payPalConfigurationIntentEnum["capture"] = "capture";
@@ -205,8 +210,52 @@ export var ProductSceneVersion = /*#__PURE__*/function (ProductSceneVersion) {
205
210
  ProductSceneVersion["V2"] = "2.0";
206
211
  return ProductSceneVersion;
207
212
  }({});
208
- export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
209
- EventCallbackCode["Failed"] = "Failed";
210
- EventCallbackCode["Completed"] = "Completed";
211
- return EventCallbackCode;
213
+ export var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
214
+ AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
215
+ AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
216
+ return AccountStatusEnum;
217
+ }({});
218
+
219
+ // element 接口start
220
+
221
+ export var InterActionTypeEnum = /*#__PURE__*/function (InterActionTypeEnum) {
222
+ InterActionTypeEnum["COLLECT_REDIRECT"] = "COLLECT_REDIRECT";
223
+ InterActionTypeEnum["SHOW_CODE"] = "SHOW_CODE";
224
+ InterActionTypeEnum["COLLECT_SHOW_CODE"] = "COLLECT_SHOW_CODE";
225
+ InterActionTypeEnum["REDIRECT"] = "REDIRECT";
226
+ return InterActionTypeEnum;
227
+ }({});
228
+ // element 接口end
229
+
230
+ export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
231
+ ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
232
+ ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
233
+ ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
234
+ ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
235
+ return ElementPaymentMethod;
236
+ }({});
237
+ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
238
+ ElementPaymentEvent["INITIAL_DATA_READY"] = "initialDataReady";
239
+ ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
240
+ ElementPaymentEvent["SIGN_OUT"] = "onSignout";
241
+ ElementPaymentEvent["BLUR"] = "onBlur";
242
+ ElementPaymentEvent["VALIDATE"] = "validate";
243
+ ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
244
+ ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
245
+ ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
246
+ ElementPaymentEvent["LAUNCH"] = "onLaunch";
247
+ ElementPaymentEvent["CALLBACK"] = "callback";
248
+ ElementPaymentEvent["LOG"] = "log";
249
+ return ElementPaymentEvent;
250
+ }({});
251
+ export var ConnectErrorCode = /*#__PURE__*/function (ConnectErrorCode) {
252
+ ConnectErrorCode["RISK_REJECT"] = "RISK_REJECT";
253
+ ConnectErrorCode["USER_AUTH_VERIFICATION_FAILED"] = "USER_AUTH_VERIFICATION_FAILED";
254
+ ConnectErrorCode["USER_NOT_EXISTS"] = "USER_NOT_EXISTS";
255
+ return ConnectErrorCode;
256
+ }({});
257
+ export var RiskSdkInfoEnum = /*#__PURE__*/function (RiskSdkInfoEnum) {
258
+ RiskSdkInfoEnum["NEED"] = "need";
259
+ RiskSdkInfoEnum["NO_NEED"] = "noneed";
260
+ return RiskSdkInfoEnum;
212
261
  }({});
@@ -0,0 +1,6 @@
1
+ import { Iselector, DisplayTypeEnum } from '../types';
2
+ /**
3
+ * @description context中需要包含app节点,用于插入selector中
4
+ */
5
+ export declare const createIframeNode: (context: any, selector: Iselector, renderDisplayType: DisplayTypeEnum) => Promise<void>;
6
+ export declare const createPreloadIframeNode: (virtualPreloadIframe: any) => void;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+ * 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
5
+ * 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.
6
+ */
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { getType } from '.';
9
+ import { ERRORMESSAGE, EVENT } from "../constant";
10
+ import { MessageName, DisplayTypeEnum } from "../types";
11
+ /**
12
+ * @description context中需要包含app节点,用于插入selector中
13
+ */
14
+ export var createIframeNode = function createIframeNode(context, selector, renderDisplayType) {
15
+ return new Promise(function (resolve, reject) {
16
+ var dorpinDom = null;
17
+ if (getType(selector) === 'string') {
18
+ dorpinDom = document.querySelector(selector);
19
+ }
20
+ if (dorpinDom === null) {
21
+ var error = {
22
+ code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
23
+ message: "Failed to execute 'querySelector' on 'Document': ".concat(selector, " is not a valid selector")
24
+ };
25
+ reject(error);
26
+ context._dispatchToSDK({
27
+ name: MessageName.APP_TO_SDK,
28
+ instanceId: context.AMSSDK._instanceId,
29
+ context: {
30
+ event: EVENT.error.name,
31
+ data: error
32
+ }
33
+ });
34
+ return;
35
+ }
36
+ if (renderDisplayType === DisplayTypeEnum.popup) dorpinDom.innerHTML = '';
37
+ if (context.app) {
38
+ dorpinDom.appendChild(context.app);
39
+ }
40
+ resolve();
41
+ });
42
+ };
43
+ export var createPreloadIframeNode = function createPreloadIframeNode(virtualPreloadIframe) {
44
+ var body = document.body || null;
45
+ if (body) {
46
+ body.appendChild(virtualPreloadIframe);
47
+ }
48
+ };
@@ -1,5 +1,5 @@
1
- import { LogService } from "../foundation/service/log";
1
+ import { Logger } from './logger';
2
2
  /**
3
3
  * 通过配置规则检测 UA 和获得回跳 scheme
4
4
  */
5
- export declare function getBackScheme(mockUa?: string, logger?: LogService): any;
5
+ export declare function getBackScheme(mockUa?: string, logger?: Logger): any;
@@ -1,4 +1,4 @@
1
- var RULES = [{
1
+ var UA_MATCH_RULES = [{
2
2
  matchRule: 'AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z]+) Safari\\/([0-9\\._]+)$',
3
3
  iosScheme: 'https',
4
4
  andScheme: ''
@@ -82,7 +82,7 @@ var RULES = [{
82
82
  export function getBackScheme(mockUa, logger) {
83
83
  var ua = mockUa || window.navigator.userAgent || '';
84
84
  // 获取规则
85
- var uaMatchedRule = RULES;
85
+ var uaMatchedRule = UA_MATCH_RULES;
86
86
  var matchedRule;
87
87
  var matched = null;
88
88
  for (var i = 0; i < uaMatchedRule.length; i++) {
@@ -5,6 +5,16 @@
5
5
  * 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.
6
6
  */
7
7
  declare const getType: (target: any) => string;
8
+ declare class EventCenter {
9
+ private events;
10
+ private eventsKey;
11
+ constructor();
12
+ on(name: string, func: any, key?: string): void;
13
+ off(name: string, func: any, key?: string): void;
14
+ emit(name: string, ...rest: any): void;
15
+ once(name: string, func: any, key?: string): void;
16
+ isExist(name: string): boolean;
17
+ }
8
18
  declare const getViewPort: (key: string) => any;
9
19
  declare const getOrigin: () => string;
10
20
  declare const serialize: (obj: Record<string, string>) => string;
@@ -36,4 +46,4 @@ declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
36
46
  timeOut?: number;
37
47
  loadCallback?: any;
38
48
  }, logger: any): Promise<unknown>;
39
- export { getType, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, };
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
@@ -1,4 +1,10 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ 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
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
2
8
  /**
3
9
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
4
10
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -10,6 +16,81 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
10
16
  var getType = function getType(target) {
11
17
  return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
12
18
  };
19
+ var EventCenter = /*#__PURE__*/function () {
20
+ function EventCenter() {
21
+ _classCallCheck(this, EventCenter);
22
+ _defineProperty(this, "events", void 0);
23
+ _defineProperty(this, "eventsKey", void 0);
24
+ this.events = new Map();
25
+ this.eventsKey = new Map();
26
+ }
27
+ _createClass(EventCenter, [{
28
+ key: "on",
29
+ value: function on(name, func) {
30
+ var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
31
+ if (key) {
32
+ if (this.eventsKey.has("".concat(name, "-").concat(key))) {
33
+ // eslint-disable-next-line no-console
34
+ console.warn("".concat(key, "\uFF1AHas been registered. Please use another key or do not pass the key"));
35
+ return;
36
+ }
37
+ this.eventsKey.set("".concat(name, "-").concat(key), true);
38
+ }
39
+ var eventList = this.events.get(name) || [];
40
+ eventList.push({
41
+ func: func,
42
+ key: key || ''
43
+ });
44
+ this.events.set(name, eventList);
45
+ }
46
+ }, {
47
+ key: "off",
48
+ value: function off(name, func) {
49
+ var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
50
+ if (key && this.eventsKey.has("".concat(name, "-").concat(key))) {
51
+ this.eventsKey.delete("".concat(name, "-").concat(key));
52
+ }
53
+ if (this.events.has(name)) {
54
+ var eventList = this.events.get(name);
55
+ eventList = eventList.filter(function (item) {
56
+ if (func === item.func && item.key === key) return false;
57
+ if (item.key && item.key === key) return false;
58
+ return true;
59
+ });
60
+ this.events.set(name, eventList);
61
+ }
62
+ }
63
+ }, {
64
+ key: "emit",
65
+ value: function emit(name) {
66
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
67
+ rest[_key - 1] = arguments[_key];
68
+ }
69
+ if (this.events.has(name)) {
70
+ var eventList = this.events.get(name);
71
+ eventList.forEach(function (item) {
72
+ item.func.apply(item, rest);
73
+ });
74
+ }
75
+ }
76
+ }, {
77
+ key: "once",
78
+ value: function once(name, func, key) {
79
+ var _this = this;
80
+ var onceF = function onceF() {
81
+ func.apply(void 0, arguments);
82
+ _this.off(name, onceF, key);
83
+ };
84
+ this.on(name, onceF, key);
85
+ }
86
+ }, {
87
+ key: "isExist",
88
+ value: function isExist(name) {
89
+ return this.events.has(name);
90
+ }
91
+ }]);
92
+ return EventCenter;
93
+ }();
13
94
  var getViewPort = function getViewPort(key) {
14
95
  var meta = document.getElementsByTagName('meta');
15
96
  // HTMLMetaElement
@@ -186,7 +267,7 @@ function parseBase64ToString(base64) {
186
267
  }
187
268
  }
188
269
  function loadSDKScript(_ref, logger) {
189
- var _this = this;
270
+ var _this2 = this;
190
271
  var src = _ref.src,
191
272
  _ref$attrOptions = _ref.attrOptions,
192
273
  attrOptions = _ref$attrOptions === void 0 ? {} : _ref$attrOptions,
@@ -235,7 +316,7 @@ function loadSDKScript(_ref, logger) {
235
316
  reject(false);
236
317
  };
237
318
  timer = setTimeout(function () {
238
- _this.logger.logError({
319
+ _this2.logger.logError({
239
320
  title: 'load_item_sdk_timeout'
240
321
  }, {
241
322
  src: src,
@@ -251,4 +332,4 @@ function loadSDKScript(_ref, logger) {
251
332
  document.head.appendChild(script);
252
333
  });
253
334
  }
254
- export { getType, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
335
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
@@ -138,7 +138,6 @@ var CallApp = /*#__PURE__*/function () {
138
138
  fallback = _this$options.fallback;
139
139
  if (!scheme && !link && !intent) {
140
140
  console.error('请至少填一个链接');
141
- if (fallback) fallback();
142
141
  return;
143
142
  }
144
143
  if (link && checkIsHttpUrl(link)) {