@alipay/ams-checkout 0.0.1730107332-dev.4 → 0.0.1730706734-dev.0

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 (136) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +7 -7
  3. package/esm/config/index.js +7 -7
  4. package/esm/constant/index.d.ts +6 -1
  5. package/esm/constant/index.js +80 -3
  6. package/esm/core/bus/ability/callback.d.ts +9 -0
  7. package/esm/{foundation/service/api-bus → core/bus}/ability/callback.js +1 -1
  8. package/esm/core/bus/ability/globalData.d.ts +10 -0
  9. package/esm/{foundation/service/api-bus → core/bus}/ability/globalData.js +2 -2
  10. package/esm/{foundation/service/api-bus → core/bus}/ability/request.d.ts +1 -1
  11. package/esm/{foundation/service/api-bus → core/bus}/ability/request.js +2 -2
  12. package/esm/core/bus/ability/security.d.ts +10 -0
  13. package/esm/core/bus/ability/security.js +104 -0
  14. package/esm/core/bus/ability/tracker.d.ts +9 -0
  15. package/esm/core/bus/ability/tracker.js +77 -0
  16. package/esm/core/bus/index.d.ts +125 -0
  17. package/esm/core/bus/index.js +366 -0
  18. package/esm/core/component/address.d.ts +8 -0
  19. package/esm/core/component/address.js +72 -0
  20. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  21. package/esm/core/component/appPreloadProcessing.js +91 -0
  22. package/esm/core/component/ckp/index.d.ts +27 -0
  23. package/esm/core/component/ckp/index.js +166 -0
  24. package/esm/core/component/element/components/address.d.ts +19 -0
  25. package/esm/core/component/element/components/address.js +68 -0
  26. package/esm/core/component/element/components/auth.d.ts +17 -0
  27. package/esm/core/component/element/components/auth.js +59 -0
  28. package/esm/core/component/element/components/payment.d.ts +19 -0
  29. package/esm/core/component/element/components/payment.js +74 -0
  30. package/esm/core/component/element/element-mock.d.ts +2 -0
  31. package/esm/core/component/element/element-mock.js +263 -0
  32. package/esm/core/component/element/index.d.ts +47 -0
  33. package/esm/core/component/element/index.js +776 -0
  34. package/esm/core/component/element/mock.d.ts +3 -0
  35. package/esm/core/component/element/mock.js +1156 -0
  36. package/esm/core/component/element/type.d.ts +176 -0
  37. package/esm/core/component/element/type.js +34 -0
  38. package/esm/core/component/element/utils.d.ts +13 -0
  39. package/esm/core/component/element/utils.js +6 -0
  40. package/esm/core/component/index.d.ts +51 -0
  41. package/esm/core/component/index.js +535 -0
  42. package/esm/core/drop-in/index.d.ts +22 -0
  43. package/esm/core/drop-in/index.js +104 -0
  44. package/esm/core/instance/index.d.ts +89 -0
  45. package/esm/core/instance/index.js +500 -0
  46. package/esm/foundation/core/index.d.ts +3 -3
  47. package/esm/foundation/core/index.js +51 -114
  48. package/esm/foundation/index.d.ts +3 -5
  49. package/esm/foundation/product-processor/easysafepay/deps.d.ts +4 -7
  50. package/esm/foundation/product-processor/easysafepay/deps.js +2 -5
  51. package/esm/foundation/product-processor/easysafepay/index.d.ts +4 -5
  52. package/esm/foundation/product-processor/easysafepay/index.js +114 -174
  53. package/esm/foundation/service/container/index.js +5 -5
  54. package/esm/foundation/service/container/popup.js +1 -1
  55. package/esm/foundation/service/event-bus/ability/callback.js +55 -0
  56. package/esm/foundation/service/{api-bus → event-bus}/ability/globalData.d.ts +1 -1
  57. package/esm/foundation/service/event-bus/ability/globalData.js +89 -0
  58. package/esm/foundation/service/event-bus/ability/request.d.ts +10 -0
  59. package/esm/foundation/service/event-bus/ability/request.js +151 -0
  60. package/esm/foundation/service/{api-bus → event-bus}/ability/security.js +19 -29
  61. package/esm/foundation/service/{api-bus → event-bus}/ability/tracker.js +1 -1
  62. package/esm/foundation/service/{api-bus → event-bus}/busManager.js +1 -1
  63. package/esm/foundation/service/event-center.d.ts +5 -4
  64. package/esm/foundation/service/event-center.js +39 -8
  65. package/esm/foundation/service/global-data/index.js +5 -4
  66. package/esm/foundation/service/index.js +1 -1
  67. package/esm/foundation/service/requester/requester.js +11 -14
  68. package/esm/foundation/service/security/index.d.ts +7 -9
  69. package/esm/foundation/service/security/index.js +44 -113
  70. package/esm/foundation/utils/redirect_utils.js +8 -24
  71. package/esm/foundation/utils/web_app_url_utils.d.ts +2 -11
  72. package/esm/foundation/utils/web_app_url_utils.js +2 -17
  73. package/esm/index.d.ts +30 -1
  74. package/esm/index.js +147 -7
  75. package/esm/plugin/applepay/component.d.ts +50 -0
  76. package/esm/plugin/applepay/component.js +339 -0
  77. package/esm/plugin/applepay/index.d.ts +17 -0
  78. package/esm/plugin/applepay/index.js +117 -0
  79. package/esm/plugin/applepay/interface.d.ts +161 -0
  80. package/esm/plugin/applepay/interface.js +69 -0
  81. package/esm/plugin/applepay/service.d.ts +54 -0
  82. package/esm/plugin/applepay/service.js +289 -0
  83. package/esm/plugin/component/cashierApp.d.ts +36 -0
  84. package/esm/plugin/component/cashierApp.js +245 -0
  85. package/esm/{component → plugin/component}/channel.d.ts +2 -1
  86. package/esm/{component → plugin/component}/channel.js +37 -1
  87. package/esm/{component → plugin/component}/component.inline.style.d.ts +2 -2
  88. package/esm/{component → plugin/component}/component.inline.style.js +7 -6
  89. package/esm/{component → plugin/component}/component.popup.style.d.ts +1 -1
  90. package/esm/{component → plugin/component}/component.popup.style.js +4 -4
  91. package/esm/plugin/component/index.d.ts +126 -0
  92. package/esm/plugin/component/index.js +1862 -0
  93. package/esm/{component → plugin/component}/popupWindow.style.js +2 -2
  94. package/esm/plugin/const.d.ts +2 -0
  95. package/esm/plugin/const.js +33 -0
  96. package/esm/plugin/drop-in/index.d.ts +71 -0
  97. package/esm/plugin/drop-in/index.js +324 -0
  98. package/esm/plugin/payment-element/utils.d.ts +2 -0
  99. package/esm/plugin/payment-element/utils.js +7 -0
  100. package/esm/plugin/paypal/index.d.ts +20 -0
  101. package/esm/plugin/paypal/index.js +390 -0
  102. package/esm/plugin/type.d.ts +34 -0
  103. package/esm/plugin/type.js +1 -0
  104. package/esm/plugin/utils.d.ts +6 -0
  105. package/esm/plugin/utils.js +21 -0
  106. package/esm/service/element.d.ts +4 -0
  107. package/esm/service/element.js +51 -0
  108. package/esm/service/index.d.ts +1 -0
  109. package/esm/service/index.js +2 -0
  110. package/esm/types/index.d.ts +218 -22
  111. package/esm/types/index.js +47 -4
  112. package/esm/util/createIframeNode.d.ts +6 -0
  113. package/esm/util/createIframeNode.js +48 -0
  114. package/esm/util/getBackScheme.d.ts +2 -2
  115. package/esm/util/getBackScheme.js +2 -94
  116. package/esm/util/index.d.ts +11 -1
  117. package/esm/util/index.js +84 -4
  118. package/esm/util/intl-callapp/es/index.js +0 -1
  119. package/esm/util/ua/index.d.ts +2 -0
  120. package/esm/util/ua/index.js +2 -0
  121. package/esm/util/ua/isAndroid.d.ts +4 -0
  122. package/esm/util/ua/isAndroid.js +7 -0
  123. package/esm/util/ua/isIOS.d.ts +4 -0
  124. package/esm/util/ua/isIOS.js +7 -0
  125. package/package.json +2 -1
  126. package/esm/foundation/utils/payment_product_utils.d.ts +0 -13
  127. package/esm/foundation/utils/payment_product_utils.js +0 -38
  128. /package/esm/{foundation/service/api-bus → core/bus}/interface.d.ts +0 -0
  129. /package/esm/{foundation/service/api-bus → core/bus}/interface.js +0 -0
  130. /package/esm/foundation/service/{api-bus → event-bus}/ability/callback.d.ts +0 -0
  131. /package/esm/foundation/service/{api-bus → event-bus}/ability/security.d.ts +0 -0
  132. /package/esm/foundation/service/{api-bus → event-bus}/ability/tracker.d.ts +0 -0
  133. /package/esm/foundation/service/{api-bus → event-bus}/busManager.d.ts +0 -0
  134. /package/esm/foundation/service/{api-bus → event-bus}/index.d.ts +0 -0
  135. /package/esm/foundation/service/{api-bus → event-bus}/index.js +0 -0
  136. /package/esm/{component → plugin/component}/popupWindow.style.d.ts +0 -0
@@ -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;
@@ -99,15 +100,37 @@ export interface DeviceIdParameter {
99
100
  export interface IcreateComponent {
100
101
  sessionData: string;
101
102
  paymentSessionData?: string;
103
+ debugProps?: {
104
+ localLink: string;
105
+ };
106
+ appendAliasContainerId?: boolean;
102
107
  notRedirectAfterComplete?: boolean;
103
108
  appearance?: {
104
109
  [x: string]: any;
105
110
  themeType?: string;
106
111
  accentColor?: string;
107
112
  };
108
- merchantAppointParam?: IMerchantAppointParam;
109
113
  isAppWebview?: boolean;
114
+ merchantAppointParam?: IMerchantAppointParam;
110
115
  }
116
+ export interface IappendIframeNodesParams extends IcreateComponent {
117
+ paymentSessionMetaData: IPaymentSessionMetaData;
118
+ renderDisplayType: DisplayTypeEnum;
119
+ selector?: Iselector;
120
+ paypalConfiguration?: IPaypalConfiguration;
121
+ connectFactor?: {
122
+ enableConnect: boolean;
123
+ };
124
+ /** 将address-element参数定义合入原参数定义 */
125
+ configParams?: {
126
+ hideFields?: string[];
127
+ addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
128
+ };
129
+ prefillValue?: AddressItem[];
130
+ componentSession?: string;
131
+ loca?: string;
132
+ }
133
+ /** 表单地址数据 */
111
134
  export interface AddressItem {
112
135
  shippingName: {
113
136
  firstName: string;
@@ -150,6 +173,7 @@ export interface AddressItem {
150
173
  prefer?: '1' | '0';
151
174
  shippingId?: string;
152
175
  }
176
+ type addressAutoSuggestDisabledType = 0 | 1;
153
177
  export interface IPaypalConfiguration {
154
178
  style?: object;
155
179
  blockPayPalCreditButton?: boolean;
@@ -212,7 +236,6 @@ export interface PaymentSessionActionData {
212
236
  enableSignAgreement?: boolean;
213
237
  skipSdkQuery: boolean;
214
238
  requireFastSdk: boolean;
215
- nonCompliant?: boolean;
216
239
  skipSdkQueryForm?: {
217
240
  value: boolean;
218
241
  version: string;
@@ -519,7 +542,6 @@ export interface CashierSubmitPayRequest {
519
542
  verifyFactors?: Record<string, string>;
520
543
  paymentSessionData: string;
521
544
  paymentSessionConfig?: any;
522
- traceId?: string;
523
545
  extParams?: any;
524
546
  }
525
547
  export interface CashierSdkActionQueryResult {
@@ -537,7 +559,6 @@ export interface CashierSdkActionQueryResult {
537
559
  normalUrl?: string;
538
560
  applinkUrl?: string;
539
561
  schemeUrl?: string;
540
- traceId?: string;
541
562
  authUrl?: string;
542
563
  extendInfo?: {
543
564
  channelOrderId?: string;
@@ -583,7 +604,6 @@ export interface CashierSubmitPayResult {
583
604
  normalUrl?: string;
584
605
  errorStatus?: string;
585
606
  message?: string;
586
- traceId?: string;
587
607
  }
588
608
  export declare enum eventCodeEnum {
589
609
  SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
@@ -637,24 +657,201 @@ export declare enum ProductSceneVersion {
637
657
  V1 = "1.0",
638
658
  V2 = "2.0"
639
659
  }
640
- export declare enum EventCallbackCode {
641
- Failed = "Failed",
642
- Completed = "Completed"
660
+ export type IAppendParams = {
661
+ componentSign: ComponentSignEnum;
662
+ iframeNodesParams: IappendIframeNodesParams;
663
+ };
664
+ export declare enum AccountStatusEnum {
665
+ EFFECTIVE = "EFFECTIVE",
666
+ UNREGISTERED = "UNREGISTERED"
667
+ }
668
+ export type IAccountInfo = {
669
+ email?: string;
670
+ verifyId?: string;
671
+ accountStatus?: AccountStatusEnum;
672
+ oneAccountId?: string;
673
+ needOtp?: boolean;
674
+ errorMsg?: string;
675
+ inputStatus?: 'success' | 'loading' | 'error' | 'focused' | '';
676
+ resendLeftTimes?: number;
677
+ };
678
+ export interface AccountQueryRequest {
679
+ paymentSessionData: string;
680
+ paymentSessionConfig: any;
681
+ accountInfo: IAccountInfo;
643
682
  }
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;
683
+ export interface ShippingsItem {
684
+ shippingName: {
685
+ firstName: string;
686
+ lastName: string;
657
687
  };
688
+ prefer: '1' | '0';
689
+ shippingId: string;
690
+ shippingPhoneNo: string;
691
+ shippingAddress: {
692
+ region: string;
693
+ state: string;
694
+ city: string;
695
+ address1: string;
696
+ address2: string;
697
+ zipCode: string;
698
+ };
699
+ }
700
+ export interface ISubPaymentElementView {
701
+ defaultText: string;
702
+ defaultValue: string;
703
+ elementMandatory: boolean;
704
+ elementRegx?: string;
705
+ elementType: string;
706
+ extendInfo: string;
707
+ paramIllegalText: string;
708
+ paymentElementKey: string;
709
+ title: string;
710
+ validateFunction?: string;
711
+ isPart?: boolean;
712
+ isPartEnd?: boolean;
713
+ }
714
+ export interface IPaymentElement {
715
+ defaultValue: string;
716
+ elementMandatory: boolean;
717
+ elementType: string;
718
+ extendInfo: string;
719
+ paymentElementKey: string;
720
+ subPaymentElementView: ISubPaymentElementView[];
721
+ title: string;
722
+ }
723
+ export declare enum InterActionTypeEnum {
724
+ COLLECT_REDIRECT = "COLLECT_REDIRECT",
725
+ SHOW_CODE = "SHOW_CODE",
726
+ COLLECT_SHOW_CODE = "COLLECT_SHOW_CODE",
727
+ REDIRECT = "REDIRECT"
728
+ }
729
+ export interface IAmount {
730
+ amount?: string;
731
+ currency: string;
732
+ currencyLabel: string;
733
+ formattedAmount?: string;
734
+ formattedAmountWithCurrency?: string;
735
+ value: string;
736
+ }
737
+ export interface IAmountView {
738
+ currency: string;
739
+ currencyDivider: string;
740
+ currencyLabel: string;
741
+ currencySymbolPosition: 'L' | 'R';
742
+ formattedValue: string;
743
+ value: string;
744
+ }
745
+ export interface IPaymentMethod {
746
+ paymentMethodKey?: string;
747
+ antomPage?: string;
748
+ redirectUrl?: string;
749
+ icon?: string;
750
+ iconName?: string;
751
+ logoList?: Array<{
752
+ cardBrand: string;
753
+ logoUrl: string;
754
+ }>;
755
+ paymentMethod?: string;
756
+ paymentMethodName: string;
757
+ paymentMethodType: string;
758
+ category?: string;
759
+ paymentElements?: IPaymentElement[];
760
+ paymentMethodId?: string;
761
+ paymentMethodDetail?: {
762
+ last4?: string;
763
+ requireIssuerAuthentication?: string;
764
+ };
765
+ interActionType?: InterActionTypeEnum;
766
+ recommend?: boolean;
767
+ expressCheckout?: boolean;
768
+ webRedirectType?: string;
769
+ paymentCurrencyList?: string[];
770
+ paymentAmount?: IAmount;
771
+ paymentAmountView?: IAmountView;
772
+ paymentQuoteId?: string;
773
+ }
774
+ interface Estimate {
775
+ unit: string;
776
+ value: number;
777
+ }
778
+ interface DeliveryEstimate {
779
+ maximum: Estimate;
780
+ minimum: Estimate;
781
+ }
782
+ interface FixedAmount {
783
+ amount: number;
784
+ currency: string;
785
+ }
786
+ interface ShippingRateData {
787
+ displayName: string;
788
+ deliveryEstimate: DeliveryEstimate;
789
+ fixedAmount: FixedAmount;
790
+ }
791
+ export interface ShippingAddress {
792
+ address1: string;
793
+ address2: string;
794
+ city: string;
795
+ region: string;
796
+ state: string;
797
+ zipCode: string;
798
+ }
799
+ export interface IUserName {
800
+ firstName: string;
801
+ middleName?: string;
802
+ lastName: string;
803
+ fullName?: string;
804
+ }
805
+ export type Shippings = ShippingsItem[];
806
+ export type IPaymentMethods = IPaymentMethod[];
807
+ export interface CKPShipping {
808
+ shippingRateId?: string;
809
+ shippingRateData?: ShippingRateData;
810
+ shippingAddress: ShippingAddress;
811
+ shippingFee?: IAmount;
812
+ shippingFeeView?: IAmountView;
813
+ shippingDescription?: string;
814
+ deliveryEstimate?: DeliveryEstimate;
815
+ shippingFeeId?: string;
816
+ shippingName?: IUserName;
817
+ shippingPhoneNo?: string;
818
+ shipToEmail?: string;
819
+ notes?: string;
820
+ }
821
+ export interface AccountQueryResult {
822
+ accountInfo: IAccountInfo;
823
+ actionForm?: ActionForm;
824
+ paymentMethods: IPaymentMethods;
825
+ shippings: Shippings;
826
+ success: boolean;
827
+ errorCode?: string;
828
+ errorMessage?: string;
829
+ errorStatus?: string;
830
+ shippingInfo?: CKPShipping;
831
+ }
832
+ export declare enum ElementPaymentMethod {
833
+ CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
834
+ AUTH_ELEMENT = "AUTH_ELEMENT",
835
+ ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
836
+ PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
837
+ }
838
+ export declare enum ElementPaymentEvent {
839
+ INITIAL_DATA_READY = "initialDataReady",
840
+ CAPTURE_ASSET = "onCaptureAsset",
841
+ SIGN_OUT = "onSignout",
842
+ BLUR = "onBlur",
843
+ VALIDATE = "validate",
844
+ SUBMIT_RISK = "onSubmitRisk",
845
+ AFTER_SUBMIT = "onAfterSubmit",
846
+ SIZE_CHANGE = "onSizeChange",
847
+ LAUNCH = "onLaunch",
848
+ CALLBACK = "callback",
849
+ LOG = "log"
850
+ }
851
+ export declare enum ConnectErrorCode {
852
+ RISK_REJECT = "RISK_REJECT",
853
+ USER_AUTH_VERIFICATION_FAILED = "USER_AUTH_VERIFICATION_FAILED",
854
+ USER_NOT_EXISTS = "USER_NOT_EXISTS"
658
855
  }
659
856
  export interface IoptionsAddressParams {
660
857
  environment?: string;
@@ -666,4 +863,3 @@ export interface IoptionsAddressParams {
666
863
  };
667
864
  product?: string;
668
865
  }
669
- export {};
@@ -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
@@ -56,6 +57,9 @@ export var PaymentMethodCategoryTypeEnum = /*#__PURE__*/function (PaymentMethodC
56
57
  PaymentMethodCategoryTypeEnum["ALL"] = "ALL";
57
58
  return PaymentMethodCategoryTypeEnum;
58
59
  }({});
60
+
61
+ /** 表单地址数据 */
62
+
59
63
  export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
60
64
  payPalConfigurationIntentEnum["intent"] = "intent";
61
65
  payPalConfigurationIntentEnum["capture"] = "capture";
@@ -205,8 +209,47 @@ export var ProductSceneVersion = /*#__PURE__*/function (ProductSceneVersion) {
205
209
  ProductSceneVersion["V2"] = "2.0";
206
210
  return ProductSceneVersion;
207
211
  }({});
208
- export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
209
- EventCallbackCode["Failed"] = "Failed";
210
- EventCallbackCode["Completed"] = "Completed";
211
- return EventCallbackCode;
212
+ export var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
213
+ AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
214
+ AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
215
+ return AccountStatusEnum;
216
+ }({});
217
+
218
+ // element 接口start
219
+
220
+ export var InterActionTypeEnum = /*#__PURE__*/function (InterActionTypeEnum) {
221
+ InterActionTypeEnum["COLLECT_REDIRECT"] = "COLLECT_REDIRECT";
222
+ InterActionTypeEnum["SHOW_CODE"] = "SHOW_CODE";
223
+ InterActionTypeEnum["COLLECT_SHOW_CODE"] = "COLLECT_SHOW_CODE";
224
+ InterActionTypeEnum["REDIRECT"] = "REDIRECT";
225
+ return InterActionTypeEnum;
226
+ }({});
227
+ // element 接口end
228
+
229
+ export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
230
+ ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
231
+ ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
232
+ ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
233
+ ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
234
+ return ElementPaymentMethod;
235
+ }({});
236
+ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
237
+ ElementPaymentEvent["INITIAL_DATA_READY"] = "initialDataReady";
238
+ ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
239
+ ElementPaymentEvent["SIGN_OUT"] = "onSignout";
240
+ ElementPaymentEvent["BLUR"] = "onBlur";
241
+ ElementPaymentEvent["VALIDATE"] = "validate";
242
+ ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
243
+ ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
244
+ ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
245
+ ElementPaymentEvent["LAUNCH"] = "onLaunch";
246
+ ElementPaymentEvent["CALLBACK"] = "callback";
247
+ ElementPaymentEvent["LOG"] = "log";
248
+ return ElementPaymentEvent;
249
+ }({});
250
+ export var ConnectErrorCode = /*#__PURE__*/function (ConnectErrorCode) {
251
+ ConnectErrorCode["RISK_REJECT"] = "RISK_REJECT";
252
+ ConnectErrorCode["USER_AUTH_VERIFICATION_FAILED"] = "USER_AUTH_VERIFICATION_FAILED";
253
+ ConnectErrorCode["USER_NOT_EXISTS"] = "USER_NOT_EXISTS";
254
+ return ConnectErrorCode;
212
255
  }({});
@@ -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,81 +1,5 @@
1
- var RULES = [{
2
- matchRule: 'AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z]+) Safari\\/([0-9\\._]+)$',
3
- iosScheme: 'https',
4
- andScheme: ''
5
- }, {
6
- matchRule: 'HeyTapBrowser',
7
- iosScheme: '',
8
- andScheme: ''
9
- }, {
10
- matchRule: 'HuaweiBrowser',
11
- iosScheme: '',
12
- andScheme: ''
13
- }, {
14
- matchRule: 'Kwai',
15
- iosScheme: 'kwai',
16
- andScheme: ''
17
- }, {
18
- matchRule: 'MQQBrowser',
19
- iosScheme: 'mttbrowser',
20
- andScheme: ''
21
- }, {
22
- matchRule: 'MicroMessenger',
23
- iosScheme: '',
24
- andScheme: ''
25
- }, {
26
- matchRule: 'MiuiBrowser',
27
- iosScheme: '',
28
- andScheme: ''
29
- }, {
30
- matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* CriOS\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z\\._a-z]+) Safari\\/([0-9\\._]+)$',
31
- iosScheme: 'googlechrome',
32
- andScheme: ''
33
- }, {
34
- matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile Safari\\/([0-9\\._]+)$',
35
- iosScheme: 'googlechrome',
36
- andScheme: ''
37
- }, {
38
- matchRule: 'NewsArticle',
39
- iosScheme: 'snssdk141',
40
- andScheme: ''
41
- }, {
42
- matchRule: 'UCBrowser',
43
- iosScheme: 'ucbrowser',
44
- andScheme: ''
45
- }, {
46
- matchRule: 'VideoArticle',
47
- iosScheme: 'snssdk32',
48
- andScheme: ''
49
- }, {
50
- matchRule: 'VivoBrowser',
51
- iosScheme: '',
52
- andScheme: ''
53
- }, {
54
- matchRule: 'ZhongAnWebView',
55
- iosScheme: 'zaapp',
56
- andScheme: ''
57
- }, {
58
- matchRule: 'aweme',
59
- iosScheme: 'snssdk1128',
60
- andScheme: ''
61
- }, {
62
- matchRule: 'aweme_lite',
63
- iosScheme: 'snssdk2329',
64
- andScheme: ''
65
- }, {
66
- matchRule: 'com.xs.fm',
67
- iosScheme: 'novelfm3040',
68
- andScheme: ''
69
- }, {
70
- matchRule: 'netdisk',
71
- iosScheme: '',
72
- andScheme: ''
73
- }, {
74
- matchRule: 'qqnews',
75
- iosScheme: 'qqnews',
76
- andScheme: ''
77
- }];
78
-
1
+ import { isAndroid, isIOS } from "./ua";
2
+ import { RULES } from "../constant/index";
79
3
  /**
80
4
  * 通过配置规则检测 UA 和获得回跳 scheme
81
5
  */
@@ -115,20 +39,4 @@ function logBackScheme(logger, userAgent, scheme) {
115
39
  backScheme: scheme
116
40
  });
117
41
  }
118
- }
119
-
120
- /**
121
- * 当前运行环境是否 Android
122
- */
123
- function isAndroid(mockUA) {
124
- var ua = (mockUA || navigator.userAgent).toLowerCase();
125
- return /android|adr|linux/.test(ua);
126
- }
127
-
128
- /**
129
- * 当前运行环境是否 IOS
130
- */
131
- function isIOS(mockUA) {
132
- var ua = (mockUA || navigator.userAgent).toLowerCase();
133
- return /iphone|ipad|ipod|ios|macintosh/.test(ua);
134
42
  }
@@ -4,6 +4,16 @@
4
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
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
+ declare class EventCenter {
8
+ private events;
9
+ private eventsKey;
10
+ constructor();
11
+ on(name: string, func: any, key?: string): void;
12
+ off(name: string, func: any, key?: string): void;
13
+ emit(name: string, ...rest: any): void;
14
+ once(name: string, func: any, key?: string): void;
15
+ isExist(name: string): boolean;
16
+ }
7
17
  declare const getType: (target: any) => string;
8
18
  declare const getViewPort: (key: string) => any;
9
19
  declare const getOrigin: () => 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:
@@ -6,7 +12,81 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6
12
  * 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
13
  */
8
14
  /* eslint-disable @typescript-eslint/no-explicit-any */
9
-
15
+ var EventCenter = /*#__PURE__*/function () {
16
+ function EventCenter() {
17
+ _classCallCheck(this, EventCenter);
18
+ _defineProperty(this, "events", void 0);
19
+ _defineProperty(this, "eventsKey", void 0);
20
+ this.events = new Map();
21
+ this.eventsKey = new Map();
22
+ }
23
+ _createClass(EventCenter, [{
24
+ key: "on",
25
+ value: function on(name, func) {
26
+ var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
27
+ if (key) {
28
+ if (this.eventsKey.has("".concat(name, "-").concat(key))) {
29
+ // eslint-disable-next-line no-console
30
+ console.warn("".concat(key, "\uFF1AHas been registered. Please use another key or do not pass the key"));
31
+ return;
32
+ }
33
+ this.eventsKey.set("".concat(name, "-").concat(key), true);
34
+ }
35
+ var eventList = this.events.get(name) || [];
36
+ eventList.push({
37
+ func: func,
38
+ key: key || ''
39
+ });
40
+ this.events.set(name, eventList);
41
+ }
42
+ }, {
43
+ key: "off",
44
+ value: function off(name, func) {
45
+ var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
46
+ if (key && this.eventsKey.has("".concat(name, "-").concat(key))) {
47
+ this.eventsKey.delete("".concat(name, "-").concat(key));
48
+ }
49
+ if (this.events.has(name)) {
50
+ var eventList = this.events.get(name);
51
+ eventList = eventList.filter(function (item) {
52
+ if (func === item.func && item.key === key) return false;
53
+ if (item.key && item.key === key) return false;
54
+ return true;
55
+ });
56
+ this.events.set(name, eventList);
57
+ }
58
+ }
59
+ }, {
60
+ key: "emit",
61
+ value: function emit(name) {
62
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
63
+ rest[_key - 1] = arguments[_key];
64
+ }
65
+ if (this.events.has(name)) {
66
+ var eventList = this.events.get(name);
67
+ eventList.forEach(function (item) {
68
+ item.func.apply(item, rest);
69
+ });
70
+ }
71
+ }
72
+ }, {
73
+ key: "once",
74
+ value: function once(name, func, key) {
75
+ var _this = this;
76
+ var onceF = function onceF() {
77
+ func.apply(void 0, arguments);
78
+ _this.off(name, onceF, key);
79
+ };
80
+ this.on(name, onceF, key);
81
+ }
82
+ }, {
83
+ key: "isExist",
84
+ value: function isExist(name) {
85
+ return this.events.has(name);
86
+ }
87
+ }]);
88
+ return EventCenter;
89
+ }();
10
90
  var getType = function getType(target) {
11
91
  return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
12
92
  };
@@ -186,7 +266,7 @@ function parseBase64ToString(base64) {
186
266
  }
187
267
  }
188
268
  function loadSDKScript(_ref, logger) {
189
- var _this = this;
269
+ var _this2 = this;
190
270
  var src = _ref.src,
191
271
  _ref$attrOptions = _ref.attrOptions,
192
272
  attrOptions = _ref$attrOptions === void 0 ? {} : _ref$attrOptions,
@@ -235,7 +315,7 @@ function loadSDKScript(_ref, logger) {
235
315
  reject(false);
236
316
  };
237
317
  timer = setTimeout(function () {
238
- _this.logger.logError({
318
+ _this2.logger.logError({
239
319
  title: 'load_item_sdk_timeout'
240
320
  }, {
241
321
  src: src,
@@ -251,4 +331,4 @@ function loadSDKScript(_ref, logger) {
251
331
  document.head.appendChild(script);
252
332
  });
253
333
  }
254
- export { getType, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
334
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };