@alipay/ams-checkout 0.0.1755258862-dev.0 → 0.0.1755681537-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 (99) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +3 -1
  3. package/esm/component/channel.js +26 -62
  4. package/esm/component/component.inline.style.js +2 -2
  5. package/esm/component/popupWindow.style.d.ts +4 -1
  6. package/esm/component/popupWindow.style.js +37 -2
  7. package/esm/config/index.d.ts +8 -8
  8. package/esm/config/index.js +8 -8
  9. package/esm/constant/easysafepay.d.ts +16 -0
  10. package/esm/constant/easysafepay.js +19 -0
  11. package/esm/constant/index.d.ts +41 -2
  12. package/esm/constant/index.js +43 -5
  13. package/esm/core/component/ckp/index.d.ts +2 -0
  14. package/esm/core/component/ckp/index.js +41 -5
  15. package/esm/core/component/element/elementContainerService/containerService.d.ts +33 -0
  16. package/esm/core/component/element/elementContainerService/containerService.js +123 -0
  17. package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
  18. package/esm/core/component/element/elementContainerService/index.js +63 -0
  19. package/esm/core/component/element/elementController/index.d.ts +27 -0
  20. package/esm/core/component/element/elementController/index.js +493 -0
  21. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
  22. package/esm/core/component/element/elementProcessor/addressProcessor.js +160 -0
  23. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
  24. package/esm/core/component/element/elementProcessor/authProcessor.js +125 -0
  25. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
  26. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +96 -0
  27. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +20 -0
  28. package/esm/core/component/element/elementProcessor/paymentProcessor.js +380 -0
  29. package/esm/core/component/element/index.d.ts +7 -46
  30. package/esm/core/component/element/index.js +31 -923
  31. package/esm/core/component/element/mock.d.ts +4 -0
  32. package/esm/core/component/element/mock.js +365 -1
  33. package/esm/core/component/element/type.d.ts +74 -34
  34. package/esm/core/component/element/type.js +20 -12
  35. package/esm/core/component/element/util.d.ts +69 -0
  36. package/esm/core/component/element/util.js +477 -0
  37. package/esm/core/component/index.d.ts +5 -1
  38. package/esm/core/component/index.js +1 -2
  39. package/esm/core/component/oldElement/index.d.ts +59 -0
  40. package/esm/core/component/oldElement/index.js +956 -0
  41. package/esm/core/component/oldElement/mock.d.ts +6 -0
  42. package/esm/core/component/oldElement/mock.js +567 -0
  43. package/esm/core/component/oldElement/type.d.ts +354 -0
  44. package/esm/core/component/oldElement/type.js +81 -0
  45. package/esm/core/instance/index.d.ts +1 -1
  46. package/esm/core/instance/index.js +1 -1
  47. package/esm/foundation/core/index.d.ts +9 -1
  48. package/esm/foundation/core/index.js +153 -49
  49. package/esm/foundation/index.d.ts +20 -0
  50. package/esm/foundation/index.js +13 -2
  51. package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
  52. package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
  53. package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
  54. package/esm/foundation/product-processor/autoDebit/index.js +466 -0
  55. package/esm/foundation/product-processor/easysafepay/deps.d.ts +3 -1
  56. package/esm/foundation/product-processor/easysafepay/deps.js +3 -1
  57. package/esm/foundation/product-processor/easysafepay/index.d.ts +5 -0
  58. package/esm/foundation/product-processor/easysafepay/index.js +266 -138
  59. package/esm/foundation/product-processor/element/index.d.ts +7 -0
  60. package/esm/foundation/product-processor/element/index.js +24 -0
  61. package/esm/foundation/service/container/index.d.ts +14 -3
  62. package/esm/foundation/service/container/index.js +178 -25
  63. package/esm/foundation/service/container/popup.d.ts +10 -7
  64. package/esm/foundation/service/container/popup.js +3 -1
  65. package/esm/foundation/service/event-center.js +1 -0
  66. package/esm/foundation/service/log/keys.js +3 -1
  67. package/esm/foundation/service/log/types.d.ts +1 -0
  68. package/esm/foundation/service/requester/requester.js +17 -37
  69. package/esm/foundation/utils/preload_helper.d.ts +2 -2
  70. package/esm/foundation/utils/preload_helper.js +8 -4
  71. package/esm/foundation/utils/redirect_utils.js +34 -18
  72. package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
  73. package/esm/foundation/utils/web_app_url_utils.js +219 -8
  74. package/esm/index.d.ts +8 -5
  75. package/esm/index.js +103 -53
  76. package/esm/plugin/component/cashierApp.d.ts +1 -1
  77. package/esm/plugin/component/cashierApp.js +5 -5
  78. package/esm/plugin/component/channel.d.ts +3 -1
  79. package/esm/plugin/component/channel.js +10 -12
  80. package/esm/plugin/component/index.js +47 -44
  81. package/esm/plugin/type.d.ts +1 -1
  82. package/esm/request/index.js +2 -2
  83. package/esm/types/index.d.ts +37 -3
  84. package/esm/types/index.js +10 -2
  85. package/esm/util/index.d.ts +12 -1
  86. package/esm/util/index.js +39 -3
  87. package/esm/util/redirect.d.ts +6 -0
  88. package/esm/util/redirect.js +54 -0
  89. package/esm/util/spm-map.d.ts +18 -4
  90. package/esm/util/spm-map.js +20 -6
  91. package/package.json +27 -4
  92. /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
  93. /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
  94. /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
  95. /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
  96. /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
  97. /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
  98. /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
  99. /package/esm/core/component/{element → oldElement}/utils.js +0 -0
@@ -1,6 +1,10 @@
1
+ export declare const sdkAction1: any;
2
+ export declare const sdkAction2: any;
1
3
  export declare const sdkAction: any;
2
4
  export declare const oneAccount1: any;
3
5
  export declare const oneAccount2: any;
4
6
  export declare const oneAccount: any;
5
7
  export declare const paymentResult: any;
6
8
  export declare const submitResult: any;
9
+ export declare const sdkActionUpdate: any;
10
+ export declare const oneAccountUpdate: any;
@@ -1,4 +1,4 @@
1
- export var sdkAction = {
1
+ export var sdkAction1 = {
2
2
  accountInfo: {
3
3
  accountStatus: 'EFFECTIVE',
4
4
  email: 'test10@test.com'
@@ -361,6 +361,10 @@ export var sdkAction = {
361
361
  },
362
362
  success: true
363
363
  };
364
+ export var sdkAction2 = {
365
+ success: false
366
+ };
367
+ export var sdkAction = sdkAction1;
364
368
  export var oneAccount1 = {
365
369
  accountInfo: {
366
370
  accountStatus: 'EFFECTIVE',
@@ -564,4 +568,364 @@ export var submitResult = {
564
568
  locale: 'en_US',
565
569
  preferred: true
566
570
  }]
571
+ };
572
+ export var sdkActionUpdate = {
573
+ amountConfirmRequired: false,
574
+ autoDebitWithToken: false,
575
+ checkoutSettings: '{\n "addressAutoComplete": true,\n "publicDetail": {\n "legalBusinessName": "Lazada Group",\n "businessName": "Lazada"\n },\n "paymentSettings": {\n "displayExpressCheckout": true,\n "allowPromotion": true,\n "collectCustomerEmail": true,\n "collectCustomerPhoneNo": true,\n "collectShippingPhoneNo": true,\n "collectShippingName": true,\n "displayAntomLogo": true,\n "displayLanguage": true,\n "defaultLanguage": "en_US",\n "redirectToMerchant": true,\n "paymentRedirectUrl": "https://www.baidu.com",\n "customFields": [\n {\n "labelType": "DROPDOWN",\n "labelName": "How did you hear about us?",\n "minLength": 0,\n "maxLength": 255,\n "labelCondition": "REQUIRED",\n "options": [\n "Search engine (Google, Bing, etc.)",\n "Social media",\n "Word of Mouth"\n ],\n "picLink": "http://100.88.104.107:8081/download?bucketName=ipay-ipaycrm-attachment&key=20240409009064IMHaa2545f192c99a8481deaecd9b8ea5ad_2tiZTpB3_20240402143510.jpg&expires=2028172654&accessKeyId=FM49eWrrO8EFqUO4&signature=rnLBSUx4M1I1zPWuZLqInjP79u4%3D&signatureType=OBJECT",\n "picTitle": "picTitle",\n "picTip": "picTip"\n }\n ]\n },\n "displaySettings": {\n "iconUrl": "https://cdn.marmot-cloud.com/storage/2022/8/2/bc7cb991-c8e2-4379-945f-aadae2bdf932.svg",\n "logoUrl": "https://cdn.marmot-cloud.com/storage/2022/9/26/dfd471f3-da7d-4ef1-8486-cfa4301045c6.svg",\n "useLogo": true,\n "themeType": "LIGHT",\n "backgroundColor": "#ffffff",\n "accentColor": "#ffffff",\n "font": "POPPINS",\n "shape": "ROUNDED",\n "displayLayout": "LEFT_ORDER_AND_RIGHT_PAYMENT"\n }\n }',
576
+ errorActions: {},
577
+ extendInfo: {},
578
+ goods: [{
579
+ goodsName: 'Goods No.1',
580
+ goodsQuantity: '1',
581
+ goodsTotalAmount: {
582
+ amount: '200.00',
583
+ currency: 'PEN',
584
+ currencyLabel: 'S/.',
585
+ formattedAmount: '200.00',
586
+ formattedAmountWithCurrency: 'S/. 200.00',
587
+ value: '20000'
588
+ },
589
+ goodsTotalAmountView: {
590
+ currency: 'PEN',
591
+ currencyDivider: ' ',
592
+ currencyLabel: 'S/.',
593
+ currencySymbolPosition: 'L',
594
+ formattedValue: '200.00',
595
+ value: '200.00'
596
+ },
597
+ goodsUnitAmount: {
598
+ amount: '200.00',
599
+ currency: 'PEN',
600
+ currencyLabel: 'S/.',
601
+ formattedAmount: '200.00',
602
+ formattedAmountWithCurrency: 'S/. 200.00',
603
+ value: '20000'
604
+ },
605
+ goodsUnitAmountView: {
606
+ currency: 'PEN',
607
+ currencyDivider: ' ',
608
+ currencyLabel: 'S/.',
609
+ currencySymbolPosition: 'L',
610
+ formattedValue: '200.00',
611
+ value: '200.00'
612
+ },
613
+ referenceGoodsId: 'amsdm_good_tony_c_20230227_095825_922'
614
+ }, {
615
+ goodsName: 'Goods No.2',
616
+ goodsQuantity: '2',
617
+ goodsTotalAmount: {
618
+ amount: '40000',
619
+ currency: 'KRW',
620
+ currencyLabel: '₩',
621
+ formattedAmount: '40,000',
622
+ formattedAmountWithCurrency: '₩ 40,000',
623
+ value: '40000'
624
+ },
625
+ goodsTotalAmountView: {
626
+ currency: 'KRW',
627
+ currencyDivider: ' ',
628
+ currencyLabel: '₩',
629
+ currencySymbolPosition: 'L',
630
+ formattedValue: '40,000',
631
+ value: '40000'
632
+ },
633
+ goodsUnitAmount: {
634
+ amount: '20000',
635
+ currency: 'KRW',
636
+ currencyLabel: '₩',
637
+ formattedAmount: '20,000',
638
+ formattedAmountWithCurrency: '₩ 20,000',
639
+ value: '20000'
640
+ },
641
+ goodsUnitAmountView: {
642
+ currency: 'KRW',
643
+ currencyDivider: ' ',
644
+ currencyLabel: '₩',
645
+ currencySymbolPosition: 'L',
646
+ formattedValue: '20,000',
647
+ value: '20000'
648
+ },
649
+ referenceGoodsId: 'amsdm_good_tony_c_20230227_095825_922'
650
+ }],
651
+ links: {
652
+ policyInfo: '["{\\"title\\":\\"CheckoutPaymentLegal\\",\\"content\\":[{\\"title\\":\\"CheckoutPaymentLegal\\",\\"content\\":\\"<p>hello<a href=\\\\\\"https://www.baidu.com/\\\\\\"target=\\\\\\"_blank\\\\\\">world</a></p><ol><li>123123123</li><li>123123123123</li></ol>\\"}]}"]',
653
+ privacyLink: 'https://render.alipay.com/p/c/180021490000000150/index.html?agreementId=GL00100002',
654
+ cookieLink: 'https://render.alipay.com/p/c/180021490000000147/index.html?agreementId=GL00100001'
655
+ },
656
+ needInstallmentAbility: false,
657
+ needOtherElements: true,
658
+ orderAmount: {
659
+ amount: '200.00',
660
+ currency: 'BRL',
661
+ currencyLabel: 'R$',
662
+ formattedAmount: '200,00',
663
+ formattedAmountWithCurrency: 'R$ 200,00',
664
+ value: '20000'
665
+ },
666
+ orderAmountView: {
667
+ currency: 'BRL',
668
+ currencyDivider: ' ',
669
+ currencyLabel: 'R$',
670
+ currencySymbolPosition: 'L',
671
+ formattedValue: '200.00',
672
+ value: '200.00'
673
+ },
674
+ pageStyle: {
675
+ checkoutSettings: '{"addressAutoComplete":false}'
676
+ },
677
+ paymentAmount: {
678
+ amount: '200.00',
679
+ currency: 'BRL',
680
+ currencyLabel: 'R$',
681
+ formattedAmount: '200,00',
682
+ formattedAmountWithCurrency: 'R$ 200,00',
683
+ value: '20000'
684
+ },
685
+ paymentAmountView: {
686
+ currency: 'BRL',
687
+ currencyDivider: ' ',
688
+ currencyLabel: 'R$',
689
+ currencySymbolPosition: 'L',
690
+ formattedValue: '200.00',
691
+ value: '200.00'
692
+ },
693
+ paymentMethods: [{
694
+ antomPage: 'paymentMetaPage',
695
+ category: 'CARD',
696
+ icon: 'https://gw.alipay.com/icon/medium/default/ALIPAY_GENERAL_CARD.svg',
697
+ iconName: 'Card',
698
+ links: [],
699
+ logoList: [{
700
+ cardBrand: 'GWANGJUBANK',
701
+ logoUrl: 'https: //cdn.marmot-cloud.com/storage/2024/2/21/635b04a7-1086-4184-8122-98d9c2b99f0f.svg'
702
+ }, {
703
+ cardBrand: 'SHINHYEOP',
704
+ logoUrl: 'https: //cdn.marmot-cloud.com/storage/2024/2/23/bc083008-b6ca-4b51-8767-1aa0dce48f5a.svg'
705
+ }],
706
+ paymentElements: [{
707
+ paymentElementKey: 'paymentMethodId',
708
+ elementType: 'CARD',
709
+ elementMandatory: false,
710
+ title: 'Card Information',
711
+ defaultValue: '',
712
+ extendInfo: '{"needOtherElements":false,"isTempTokenization":"true"}',
713
+ subPaymentElementView: [{
714
+ defaultText: 'Card Number',
715
+ elementMandatory: true,
716
+ elementRegx: '^\\d{15,18}$',
717
+ elementType: 'DIGIT_18',
718
+ paramIllegalText: 'cardNo error',
719
+ paymentElementKey: 'cardNo',
720
+ title: 'Card Number',
721
+ defaultValue: '',
722
+ extendInfo: '{"excludeMetaDataCodes":"null","completeKey":"cc-number"}'
723
+ }, {
724
+ defaultText: 'CVV',
725
+ defaultValue: '',
726
+ elementMandatory: true,
727
+ elementRegx: '^\\d{3,4}$',
728
+ elementType: 'DIGIT_4',
729
+ extendInfo: '{"excludeMetaDataCodes":"null"}',
730
+ paramIllegalText: 'Please enter a valid 3 or 4 digit CVV number',
731
+ paymentElementKey: 'cardCVV'
732
+ }, {
733
+ defaultText: 'Name on Card',
734
+ elementMandatory: true,
735
+ elementRegx: '',
736
+ elementType: 'TEXT',
737
+ paramIllegalText: 'Please enter a Name on Card',
738
+ paymentElementKey: 'cardHolderName',
739
+ defaultValue: '',
740
+ extendInfo: '{"excludeMetaDataCodes":"null","completeKey":"cc-name"}'
741
+ }, {
742
+ defaultText: 'Exp Date(MM/YY)',
743
+ elementMandatory: true,
744
+ elementRegx: '.{5}',
745
+ paramIllegalText: 'Please enter a Exp Date',
746
+ elementType: 'TEXT',
747
+ paymentElementKey: 'expiryYear',
748
+ title: 'Please enter a Exp Date',
749
+ defaultValue: '',
750
+ extendInfo: '{"excludeMetaDataCodes":"null","completeKey":"cc-exp"}'
751
+ }, {
752
+ defaultText: 'Exp Date(MM/YY)',
753
+ elementMandatory: true,
754
+ elementRegx: '',
755
+ elementType: 'TEXT',
756
+ paymentElementKey: 'expiryMonth',
757
+ title: 'Please enter a Exp Date',
758
+ defaultValue: '',
759
+ extendInfo: '{"excludeMetaDataCodes":"null","completeKey":"cc-exp"}'
760
+ }]
761
+ }, {
762
+ defaultText: 'Save this payment method for future use.',
763
+ elementMandatory: false,
764
+ elementType: 'CHECKBOX',
765
+ extendInfo: '{}',
766
+ paymentElementKey: 'bindPaymentMethod'
767
+ }, {
768
+ elementMandatory: false,
769
+ elementType: 'DIGIT_4',
770
+ extendInfo: '[{"currency":"BRL","installmentAmount":"21,39","interestFree":"true","interestRate":"0.12%","orderAmount":"21,39","tenor":"1"}, {"currency":"BRL","installmentAmount":"10,39","interestFree":"true","interestRate":"0.12%","orderAmount":"21,39","tenor":"2"}]',
771
+ paymentElementKey: 'tenor',
772
+ title: 'Instalment plan',
773
+ defaultValue: ''
774
+ }, {
775
+ defaultText: '_ _ _. _ _ _. _ _ _-_ _',
776
+ defaultValue: '',
777
+ elementMandatory: true,
778
+ elementRegx: '^\\d{11}$',
779
+ elementType: 'DIGIT_11',
780
+ extendInfo: '{"customerId":"r35fPjeD0IhNOJrciVqCq10AKiD/uxk8rzaySdJM4tI=","merchantId":"188r35fPjeD0IhNOJrciVqCq10AKiD/uxk8rzaySdJM4tI=","needVerify":"true"}',
781
+ paramIllegalText: 'Please enter a valid 11-digit CPF number',
782
+ paymentElementKey: 'cpf',
783
+ title: 'CPF Code'
784
+ }, {
785
+ defaultText: 'Enter your email address',
786
+ defaultValue: '',
787
+ elementMandatory: true,
788
+ elementRegx: '^(([\\w-\\+\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,18}|[0-9]{1,3})(\\]?))$',
789
+ elementType: 'TEXT',
790
+ extendInfo: '{"excludeMetaDataCodes":"null"}',
791
+ paramIllegalText: 'Email address format invalid',
792
+ paymentElementKey: 'payerEmail',
793
+ title: 'Email'
794
+ }],
795
+ paymentMethod: 'CARD',
796
+ paymentMethodName: 'Card',
797
+ paymentMethodType: 'CARD',
798
+ webRedirectType: 'PAGE_REFRESH'
799
+ }],
800
+ savedPaymentMethods: [],
801
+ storePolicies: '[\\"{\\\\\\\\\\"title\\\\\\\\\\":\\\\\\\\\\"CheckoutPaymentLegal\\\\\\\\\\",\\\\\\\\\\"content\\\\\\\\\\":[{\\\\\\\\\\"title\\\\\\\\\\":\\\\\\\\\\"CheckoutPaymentLegal\\\\\\\\\\",\\\\\\\\\\"content\\\\\\\\\\":\\\\\\\\\\"<p>hello<ahref=\\\\\\\\\\\\\\\\\\\\\\\\\\"https://www.baidu.com/\\\\\\\\\\\\\\\\\\\\\\\\\\"target=\\\\\\\\\\\\\\\\\\\\\\\\\\"_blank\\\\\\\\\\\\\\\\\\\\\\\\\\">world</a></p><ol><li>123123123</li><li>123123123123</li></ol>\\\\\\\\\\"}]}\\",\\"{\\\\\\\\\\"title\\\\\\\\\\":\\\\\\\\\\"2188120013275594MerchantLegal\\\\\\\\\\",\\\\\\\\\\"content\\\\\\\\\\":[{\\\\\\\\\\"title\\\\\\\\\\":\\\\\\\\\\"2188120013275594MerchantLegal_0\\\\\\\\\\",\\\\\\\\\\"content\\\\\\\\\\":\\\\\\\\\\"<p>hello<ahref=\\\\\\\\\\\\\\\\\\\\\\\\\\"https://www.baidu.com/\\\\\\\\\\\\\\\\\\\\\\\\\\"target=\\\\\\\\\\\\\\\\\\\\\\\\\\"_blank\\\\\\\\\\\\\\\\\\\\\\\\\\">world</a></p><ol><li>MerchantLegal_0</li><li>MerchantLegal_0</li></ol>\\\\\\\\\\"},{\\\\\\\\\\"title\\\\\\\\\\":\\\\\\\\\\"2188120013275594MerchantLegal_1\\\\\\\\\\",\\\\\\\\\\"content\\\\\\\\\\":\\\\\\\\\\"<p>hello<ahref=\\\\\\\\\\\\\\\\\\\\\\\\\\"https://www.baidu.com/\\\\\\\\\\\\\\\\\\\\\\\\\\"target=\\\\\\\\\\\\\\\\\\\\\\\\\\"_blank\\\\\\\\\\\\\\\\\\\\\\\\\\">world</a></p><ol><li>MerchantLegal_1</li><li>MerchantLegal_1</li></ol>\\\\\\\\\\"}]}\\"]',
802
+ success: true,
803
+ redirectUrl: '',
804
+ supportedLanguages: [{
805
+ locale: 'en_US',
806
+ preferred: true,
807
+ title: 'English'
808
+ }, {
809
+ locale: 'it_IT',
810
+ preferred: false,
811
+ title: 'Português'
812
+ }, {
813
+ locale: 'de_DE',
814
+ preferred: false
815
+ }, {
816
+ locale: 'fr_FR',
817
+ preferred: false
818
+ }, {
819
+ locale: 'nl_NL',
820
+ preferred: false
821
+ }, {
822
+ locale: 'es_ES',
823
+ preferred: false
824
+ }, {
825
+ locale: 'zh_CN',
826
+ preferred: false
827
+ }, {
828
+ country: 'KR',
829
+ locale: 'ko_KR',
830
+ preferred: false,
831
+ title: '한국어'
832
+ }]
833
+ };
834
+ export var oneAccountUpdate = {
835
+ accountInfo: {
836
+ email: 'xxxxx@163.com',
837
+ accountStatus: 'EFFECTIVE',
838
+ oneAccountId: 'xxxxxxkk'
839
+ },
840
+ goods: {
841
+ goodsName: 'xxxxxxx',
842
+ goodsImageUrl: '',
843
+ goodsQuantity: 100,
844
+ goodsUnitAmount: {
845
+ currency: 'EUR',
846
+ value: 100,
847
+ currencyLabel: ''
848
+ }
849
+ },
850
+ paymentMethods: [{
851
+ paymentMethodType: 'CARD',
852
+ iconName: 'VISA',
853
+ icon: 'https://cdn.marmot-cloud.com/storage/2022/8/2/bc7cb991-c8e2-4379-945f-aadae2bdf932.svg',
854
+ paymentMethodId: 'card-id',
855
+ paymentMethodDetail: {
856
+ last4: '**** 1233'
857
+ }
858
+ }, {
859
+ paymentMethodType: 'CARD',
860
+ iconName: 'VISA2',
861
+ icon: 'https://cdn.marmot-cloud.com/storage/2022/8/2/bc7cb991-c8e2-4379-945f-aadae2bdf932.svg',
862
+ paymentMethodId: 'card-id2',
863
+ paymentMethodDetail: {
864
+ last4: '**** 1235'
865
+ }
866
+ }
867
+ // {
868
+ // "paymentMethodType": "dana",
869
+ // "iconName": "DANA",
870
+ // "icon": "https://cdn.marmot-cloud.com/storage/2022/8/2/bc7cb991-c8e2-4379-945f-aadae2bdf932.svg",
871
+ // "paymentMethodElements": {},
872
+ // },
873
+ ],
874
+ links: {
875
+ privacyLink: 'https://global.alipay.com/docs/ac/Platform/bahzqeb-',
876
+ cookieLink: 'https://global.alipay.com/docs/ac/Platform/x1rhufzj'
877
+ },
878
+ shippings: [{
879
+ shippingName: {
880
+ firstName: '111111',
881
+ lastName: '11111'
882
+ },
883
+ prefer: '1',
884
+ shippingId: 'xxxx1',
885
+ shippingPhoneNo: 'xxxxxx123',
886
+ shippingAddress: {
887
+ region: 'ID',
888
+ state: 'Nusa',
889
+ city: 'Nusa Tenggara Bar.',
890
+ address1: 'Kec. Mataram, Kota Mataram',
891
+ address2: 'Jl. Bangil V No.6, Pagesangan Tim',
892
+ zipCode: '123445'
893
+ }
894
+ }],
895
+ metaData: {
896
+ countryList: [{
897
+ countryName: 'China',
898
+ default: true
899
+ }, {
900
+ countryName: 'Singapore',
901
+ default: false
902
+ }]
903
+ },
904
+ errorActions: {},
905
+ extendInfo: {},
906
+ merchantId: '111xT8bLnciQgqcy20+oOJoWUEbPMTwI0YILNBIicpASIs=',
907
+ needInstallmentAbility: false,
908
+ needOtherElements: false,
909
+ orderDescription: 'AMSDM_GIFT',
910
+ success: true,
911
+ supportedLanguages: [{
912
+ locale: 'en_US',
913
+ preferred: true,
914
+ title: 'English'
915
+ }, {
916
+ country: 'BR',
917
+ locale: 'pt_BR',
918
+ preferred: false,
919
+ title: 'Português'
920
+ }, {
921
+ country: 'KR',
922
+ locale: 'ko_KR',
923
+ preferred: false,
924
+ title: '한국어'
925
+ }, {
926
+ country: 'MX,CL,PE',
927
+ locale: 'es_ES',
928
+ preferred: false,
929
+ title: 'Español'
930
+ }]
567
931
  };
@@ -1,4 +1,10 @@
1
- import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IPaymentMethod } from '../../../types';
1
+ import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IMerchantAppointParam, IPaymentMethod } from '../../../types';
2
+ import AddressProcessor from './elementProcessor/addressProcessor';
3
+ import AuthProcessor from './elementProcessor/authProcessor';
4
+ import PaymentProcessor from './elementProcessor/paymentProcessor';
5
+ /**
6
+ * element 消息事件名
7
+ */
2
8
  export declare enum ElementPaymentEvent {
3
9
  RENDER_COMPONENT = "renderComponent",
4
10
  CAPTURE_ASSET = "onCaptureAsset",
@@ -10,9 +16,13 @@ export declare enum ElementPaymentEvent {
10
16
  SIZE_CHANGE = "onSizeChange",
11
17
  LAUNCH = "onLaunch",
12
18
  CALLBACK = "callback",
19
+ /**
20
+ * @deprecated 已废弃 请使用eventCallback
21
+ */
13
22
  SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
14
23
  LOG = "log",
15
- HANDLE_PAYMENT = "handlePayment"
24
+ HANDLE_PAYMENT = "handlePayment",
25
+ ON_EVENT_CALLBACK = "onEventCallback"
16
26
  }
17
27
  export declare enum ElementPaymentMethod {
18
28
  CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
@@ -20,6 +30,19 @@ export declare enum ElementPaymentMethod {
20
30
  ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
21
31
  PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
22
32
  }
33
+ export declare enum ElementType {
34
+ auth = "auth",
35
+ address = "address",
36
+ payment = "payment"
37
+ }
38
+ export declare const MountElementType: {
39
+ auth: ElementPaymentMethod;
40
+ address: ElementPaymentMethod;
41
+ payment: ElementPaymentMethod;
42
+ AUTH_ELEMENT: ElementType;
43
+ ADDRESS_ELEMENT: ElementType;
44
+ PAYMENT_ELEMENT: ElementType;
45
+ };
23
46
  export declare enum ThemeType {
24
47
  NostalgicGray = "nostalgicGray",
25
48
  Default = "default",
@@ -28,27 +51,22 @@ export declare enum ThemeType {
28
51
  GamingPurple = "gamingPurple",
29
52
  AgateGreen = "agateGreen"
30
53
  }
31
- export declare enum ElementType {
32
- auth = "auth",
33
- address = "address",
34
- payment = "payment"
35
- }
36
54
  export declare enum PaymentElementLayout {
37
55
  Tabs = "tabs",
38
56
  Accordion = "Accordion"
39
57
  }
40
- export declare enum MountElementType {
41
- auth = "AUTH_ELEMENT",
42
- address = "ADDRESS_ELEMENT",
43
- payment = "PAYMENT_ELEMENT"
44
- }
45
58
  export declare const addressTheme: {
46
59
  default: string;
47
60
  night: string;
48
61
  };
49
62
  export declare enum EventCallbackCode {
50
63
  SDK_CREATE_COMPONENT_ERROR = "SDK_CREATE_COMPONENT_ERROR",
51
- SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR"
64
+ SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
65
+ SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
66
+ SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
67
+ SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL",
68
+ SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
69
+ SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING"
52
70
  }
53
71
  export declare enum ELEMENT_ENVIRONMENT {
54
72
  DEV = "DEV",
@@ -59,23 +77,6 @@ export declare enum ELEMENT_ENVIRONMENT {
59
77
  SANDBOX = "SANDBOX"
60
78
  }
61
79
  export type ELEMENT_ENVIRONMENT_TYPE = keyof typeof ELEMENT_ENVIRONMENT | (typeof ELEMENT_ENVIRONMENT)[keyof typeof ELEMENT_ENVIRONMENT];
62
- export interface IElementOptions {
63
- environment?: ELEMENT_ENVIRONMENT_TYPE;
64
- locale?: string;
65
- version?: string;
66
- appearance?: {
67
- theme: ThemeType.Default | ThemeType.Night;
68
- };
69
- onEventCallback?: ({ code, message, result }: {
70
- code: EventCallbackCode;
71
- message: string;
72
- result?: any;
73
- }) => void;
74
- loading?: {
75
- onStartLoading: () => void;
76
- onEndLoading: () => void;
77
- };
78
- }
79
80
  export interface AddressMountComponentsParams {
80
81
  configParams?: AddressMountConfig;
81
82
  prefillValue: Array<AddressSubmitData>;
@@ -92,7 +93,6 @@ export interface AddressMountComponentsParams {
92
93
  }
93
94
  interface BaseMountOptions<T = void> {
94
95
  configParams?: T;
95
- sessionData: string;
96
96
  debugProps?: {
97
97
  localLink: string;
98
98
  };
@@ -160,6 +160,8 @@ export interface PaymentMountOptions extends BaseMountOptions {
160
160
  'radius-button': string;
161
161
  };
162
162
  };
163
+ notRedirectAfterComplete?: boolean;
164
+ merchantAppointParam?: IMerchantAppointParam;
163
165
  }
164
166
  export declare enum AddressEventCallbackName {
165
167
  SHIPPING_CHANGE = "SHIPPING_CHANGE"
@@ -173,12 +175,14 @@ export interface LinkAuthMountResult extends BaseMountResult {
173
175
  }
174
176
  export interface PaymentMountResult extends BaseMountResult {
175
177
  }
176
- export interface EventCallbackData<T = {}> {
178
+ /**
179
+ * connect element之间通信的类型格式
180
+ */
181
+ export interface ConnectElementMessageDataType<T = {}> {
177
182
  source?: ElementPaymentMethod;
178
183
  target?: ElementPaymentMethod;
179
- success?: boolean;
180
184
  data?: T;
181
- event?: AddressEventCallbackName;
185
+ event?: ElementPaymentEvent;
182
186
  }
183
187
  export interface ValidateResult<T = {}> {
184
188
  success: boolean;
@@ -347,4 +351,40 @@ export interface AccountQueryResult {
347
351
  errorStatus?: string;
348
352
  shippingInfo?: CKPShipping;
349
353
  }
354
+ export interface IElementOptions {
355
+ sessionData: string;
356
+ environment?: ELEMENT_ENVIRONMENT_TYPE;
357
+ locale?: string;
358
+ version?: string;
359
+ appearance?: {
360
+ theme: ThemeType.Default | ThemeType.Night;
361
+ };
362
+ onEventCallback?: ({ code, message, result }: {
363
+ code: EventCallbackCode;
364
+ message: string;
365
+ result?: any;
366
+ }) => void;
367
+ loading?: {
368
+ onStartLoading: () => void;
369
+ onEndLoading: () => void;
370
+ };
371
+ }
372
+ export interface IElementProcessors {
373
+ [ElementType.auth]: AuthProcessor;
374
+ [ElementType.address]: AddressProcessor;
375
+ [ElementType.payment]: PaymentProcessor;
376
+ }
377
+ export interface IToastOptions {
378
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
379
+ backgroundColor?: string;
380
+ color?: string;
381
+ padding?: string;
382
+ borderRadius?: string;
383
+ fontSize?: string;
384
+ zIndex?: number;
385
+ width?: string;
386
+ duration?: number;
387
+ icon?: 'SUCCESS' | 'FAIL';
388
+ spin?: boolean;
389
+ }
350
390
  export {};
@@ -2,6 +2,9 @@ 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
+ /**
6
+ * element 消息事件名
7
+ */
5
8
  export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
6
9
  ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
7
10
  ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
@@ -16,6 +19,7 @@ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
16
19
  ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
17
20
  ElementPaymentEvent["LOG"] = "log";
18
21
  ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
22
+ ElementPaymentEvent["ON_EVENT_CALLBACK"] = "onEventCallback";
19
23
  return ElementPaymentEvent;
20
24
  }({});
21
25
  export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
@@ -25,6 +29,13 @@ export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
25
29
  ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
26
30
  return ElementPaymentMethod;
27
31
  }({});
32
+ export var ElementType = /*#__PURE__*/function (ElementType) {
33
+ ElementType["auth"] = "auth";
34
+ ElementType["address"] = "address";
35
+ ElementType["payment"] = "payment";
36
+ return ElementType;
37
+ }({});
38
+ export var MountElementType = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ElementType.auth, ElementPaymentMethod.AUTH_ELEMENT), ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT), ElementType.payment, ElementPaymentMethod.PAYMENT_ELEMENT), ElementPaymentMethod.AUTH_ELEMENT, ElementType.auth), ElementPaymentMethod.ADDRESS_ELEMENT, ElementType.address), ElementPaymentMethod.PAYMENT_ELEMENT, ElementType.payment);
28
39
  export var ThemeType = /*#__PURE__*/function (ThemeType) {
29
40
  ThemeType["NostalgicGray"] = "nostalgicGray";
30
41
  ThemeType["Default"] = "default";
@@ -34,27 +45,20 @@ export var ThemeType = /*#__PURE__*/function (ThemeType) {
34
45
  ThemeType["AgateGreen"] = "agateGreen";
35
46
  return ThemeType;
36
47
  }({});
37
- export var ElementType = /*#__PURE__*/function (ElementType) {
38
- ElementType["auth"] = "auth";
39
- ElementType["address"] = "address";
40
- ElementType["payment"] = "payment";
41
- return ElementType;
42
- }({});
43
48
  export var PaymentElementLayout = /*#__PURE__*/function (PaymentElementLayout) {
44
49
  PaymentElementLayout["Tabs"] = "tabs";
45
50
  PaymentElementLayout["Accordion"] = "Accordion";
46
51
  return PaymentElementLayout;
47
52
  }({});
48
- export var MountElementType = /*#__PURE__*/function (MountElementType) {
49
- MountElementType["auth"] = "AUTH_ELEMENT";
50
- MountElementType["address"] = "ADDRESS_ELEMENT";
51
- MountElementType["payment"] = "PAYMENT_ELEMENT";
52
- return MountElementType;
53
- }({});
54
53
  export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
55
54
  export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
56
55
  EventCallbackCode["SDK_CREATE_COMPONENT_ERROR"] = "SDK_CREATE_COMPONENT_ERROR";
57
56
  EventCallbackCode["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
57
+ EventCallbackCode["SDK_PAYMENT_ERROR"] = "SDK_PAYMENT_ERROR";
58
+ EventCallbackCode["SDK_PAYMENT_FAIL"] = "SDK_PAYMENT_FAIL";
59
+ EventCallbackCode["SDK_PAYMENT_CANCEL"] = "SDK_PAYMENT_CANCEL";
60
+ EventCallbackCode["SDK_PAYMENT_SUCCESSFUL"] = "SDK_PAYMENT_SUCCESSFUL";
61
+ EventCallbackCode["SDK_PAYMENT_PROCESSING"] = "SDK_PAYMENT_PROCESSING";
58
62
  return EventCallbackCode;
59
63
  }({});
60
64
  export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
@@ -73,6 +77,10 @@ export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbac
73
77
  return AddressEventCallbackName;
74
78
  }({});
75
79
 
80
+ /**
81
+ * connect element之间通信的类型格式
82
+ */
83
+
76
84
  // export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
77
85
  var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
78
86
  AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";