@alipay/ams-checkout 0.0.1757298389-dev.0 → 0.0.1757298389-dev.10
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.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/component.popup.style.d.ts +1 -0
- package/esm/component/component.popup.style.js +1 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +10 -0
- package/esm/constant/index.js +12 -0
- package/esm/core/component/element/elementContainerService/containerService.js +3 -2
- package/esm/core/component/element/elementController/index.d.ts +8 -0
- package/esm/core/component/element/elementController/index.js +163 -90
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +16 -10
- package/esm/core/component/element/index.d.ts +3 -0
- package/esm/core/component/element/index.js +5 -0
- package/esm/core/component/element/type.d.ts +10 -4
- package/esm/core/component/element/type.js +7 -1
- package/esm/core/component/element/util.d.ts +1 -1
- package/esm/core/component/index.d.ts +4 -1
- package/esm/core/component/index.js +105 -2
- package/esm/index.d.ts +10 -1
- package/esm/index.js +15 -1
- package/esm/plugin/component/index.d.ts +2 -0
- package/esm/plugin/component/index.js +23 -7
- package/esm/plugin/paypal/index.js +5 -2
- package/esm/types/index.d.ts +3 -0
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PlatformEnum } from '../types';
|
|
2
|
+
export declare const componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n.ams-component-container-hidden-desktop {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 8px;\n overflow: hidden;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n width: 0.8em;\n height:0.8em;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-loading .line div:before,\n.ams-component-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: #fcfcfc;\n border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n\n.asm-component-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 0;\n top: 0;\n cursor: pointer;\n}\n.asm-component-close-block-btn-desktop {\n width: 11px;\n height: 11px;\n object-fit: fill;\n position: absolute;\n right: 18.7px;\n top: 26.7px;\n}\n.asm-component-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n.asm-component-close-block-mobile {\n position: absolute;\n width: 0.4em;\n height: 0.4em;\n right: 0;\n top: 0;\n cursor: pointer;\n z-index: 1009;\n}\n\n.asm-component-close-block-btn-mobile {\n width: 0.11em;\n height: 0.11em;\n object-fit: fill;\n position: absolute;\n right: 0.147em;\n top: 0.167em;\n}\n.ams-component-mask-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n top: 10px;\n cursor: pointer;\n z-index: 1013;\n}\n \n.ams-component-mask-close-block-mobile {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n cursor: pointer;\n z-index: 1012;\n}\n\n.ams-component-mask-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n\n.ams-component-mask-close-block-btn {\n width: 24px;\n height: 24px;\n object-fit: fill;\n position: absolute;\n right: 8px;\n top: 8px;\n}\n\n.ams-component-container-opacity{\n opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n content: \"\";\n z-index: 1010;\n background-color: rgba(0, 0, 0, 0.35);\n border-radius: 12px 12px 0 0;\n}\n\n#ams-component-retention {\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: 50%;\n height: auto;\n display: none;\n z-index: 1009;\n}\n\n.ams-component-retention-show {\n display: flex !important;\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n display: flex !important;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n -webkit-animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n -webkit-animation-fill-mode: forwards;\n}\n\n.ams-component-retention-mobile {\n width: 294px;\n border-radius: 12px;\n padding: 24px 0;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n width: 544px;\n border-radius: 12px;\n padding: 32px;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n .ams-component-retention-mobile {\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n.ams-component-retention-title-mobile {\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n text-align: left;\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 8px;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n text-align: left;\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n margin-top: 24px;\n padding: 0 24px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n width: 100%;\n margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n background: #0079FF;\n border-radius: 100px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n color: #FFFFFF;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-remain-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n padding: 0 6px;\n}\n\n.ams-component-retention-remain-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n display: inline-block;\n padding: 0 24px;\n float: right;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 159px;\n}\n\n#ams-component-retention-leave {\n border-radius: 100px;\n border: 1px solid #0079FF;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-leave-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n margin-top: 12px;\n padding: 0 6px;\n}\n\n.ams-component-retention-leave-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n display: inline-block;\n padding: 0 24px;\n float: right;\n margin-right: 16px;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 144px;\n}\n.ams-component-mockup-hidden{\nanimation: ams-component-mockup-opacity 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes ams-component-mockup-opacity {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n}\n";
|
|
2
3
|
export declare const componentAddCSS: () => void;
|
|
3
4
|
export declare const createBaseElement: (platform: PlatformEnum, closeBtnFunc: () => void) => HTMLDivElement;
|
|
4
5
|
export declare const createCloseBtn: (platform: PlatformEnum, closeBtnFunc: () => void) => void;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { ANIMATION_TIME, closeImg, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, LOADING_ID, MOCKUP_ID } from "../constant";
|
|
9
9
|
import { PlatformEnum } from "../types";
|
|
10
10
|
import { addSetFontSizeEvent, amsSetSize, getDesignFontSize } from "../util";
|
|
11
|
-
var componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n.ams-component-container-hidden-desktop {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 8px;\n overflow: hidden;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n width: 0.8em;\n height:0.8em;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-loading .line div:before,\n.ams-component-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: #fcfcfc;\n border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n\n.asm-component-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 0;\n top: 0;\n cursor: pointer;\n}\n.asm-component-close-block-btn-desktop {\n width: 11px;\n height: 11px;\n object-fit: fill;\n position: absolute;\n right: 18.7px;\n top: 26.7px;\n}\n.asm-component-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n.asm-component-close-block-mobile {\n position: absolute;\n width: 0.4em;\n height: 0.4em;\n right: 0;\n top: 0;\n cursor: pointer;\n z-index: 1009;\n}\n\n.asm-component-close-block-btn-mobile {\n width: 0.11em;\n height: 0.11em;\n object-fit: fill;\n position: absolute;\n right: 0.147em;\n top: 0.167em;\n}\n.ams-component-mask-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n top: 10px;\n cursor: pointer;\n z-index: 1013;\n}\n \n.ams-component-mask-close-block-mobile {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n cursor: pointer;\n z-index: 1012;\n}\n\n.ams-component-mask-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n\n.ams-component-mask-close-block-btn {\n width: 24px;\n height: 24px;\n object-fit: fill;\n position: absolute;\n right: 8px;\n top: 8px;\n}\n\n.ams-component-container-opacity{\n opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n content: \"\";\n z-index: 1010;\n background-color: rgba(0, 0, 0, 0.35);\n border-radius: 12px 12px 0 0;\n}\n\n#ams-component-retention {\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: 50%;\n height: auto;\n display: none;\n z-index: 1009;\n}\n\n.ams-component-retention-show {\n display: flex !important;\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n display: flex !important;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n -webkit-animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n -webkit-animation-fill-mode: forwards;\n}\n\n.ams-component-retention-mobile {\n width: 294px;\n border-radius: 12px;\n padding: 24px 0;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n width: 544px;\n border-radius: 12px;\n padding: 32px;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n .ams-component-retention-mobile {\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n.ams-component-retention-title-mobile {\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n text-align: left;\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 8px;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n text-align: left;\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n margin-top: 24px;\n padding: 0 24px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n width: 100%;\n margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n background: #0079FF;\n border-radius: 100px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n color: #FFFFFF;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-remain-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n padding: 0 6px;\n}\n\n.ams-component-retention-remain-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n display: inline-block;\n padding: 0 24px;\n float: right;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 159px;\n}\n\n#ams-component-retention-leave {\n border-radius: 100px;\n border: 1px solid #0079FF;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-leave-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n margin-top: 12px;\n padding: 0 6px;\n}\n\n.ams-component-retention-leave-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n display: inline-block;\n padding: 0 24px;\n float: right;\n margin-right: 16px;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 144px;\n}\n.".concat(MOCKUP_ID, "-hidden{\nanimation: ").concat(MOCKUP_ID, "-opacity 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes ").concat(MOCKUP_ID, "-opacity {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n}\n");
|
|
11
|
+
export var componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n.ams-component-container-hidden-desktop {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 8px;\n overflow: hidden;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n width: 0.8em;\n height:0.8em;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-loading .line div:before,\n.ams-component-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: #fcfcfc;\n border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n\n.asm-component-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 0;\n top: 0;\n cursor: pointer;\n}\n.asm-component-close-block-btn-desktop {\n width: 11px;\n height: 11px;\n object-fit: fill;\n position: absolute;\n right: 18.7px;\n top: 26.7px;\n}\n.asm-component-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n.asm-component-close-block-mobile {\n position: absolute;\n width: 0.4em;\n height: 0.4em;\n right: 0;\n top: 0;\n cursor: pointer;\n z-index: 1009;\n}\n\n.asm-component-close-block-btn-mobile {\n width: 0.11em;\n height: 0.11em;\n object-fit: fill;\n position: absolute;\n right: 0.147em;\n top: 0.167em;\n}\n.ams-component-mask-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n top: 10px;\n cursor: pointer;\n z-index: 1013;\n}\n \n.ams-component-mask-close-block-mobile {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n cursor: pointer;\n z-index: 1012;\n}\n\n.ams-component-mask-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n\n.ams-component-mask-close-block-btn {\n width: 24px;\n height: 24px;\n object-fit: fill;\n position: absolute;\n right: 8px;\n top: 8px;\n}\n\n.ams-component-container-opacity{\n opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n content: \"\";\n z-index: 1010;\n background-color: rgba(0, 0, 0, 0.35);\n border-radius: 12px 12px 0 0;\n}\n\n#ams-component-retention {\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: 50%;\n height: auto;\n display: none;\n z-index: 1009;\n}\n\n.ams-component-retention-show {\n display: flex !important;\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n display: flex !important;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n -webkit-animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n -webkit-animation-fill-mode: forwards;\n}\n\n.ams-component-retention-mobile {\n width: 294px;\n border-radius: 12px;\n padding: 24px 0;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n width: 544px;\n border-radius: 12px;\n padding: 32px;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n .ams-component-retention-mobile {\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n.ams-component-retention-title-mobile {\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n text-align: left;\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 8px;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n text-align: left;\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n margin-top: 24px;\n padding: 0 24px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n width: 100%;\n margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n background: #0079FF;\n border-radius: 100px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n color: #FFFFFF;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-remain-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n padding: 0 6px;\n}\n\n.ams-component-retention-remain-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n display: inline-block;\n padding: 0 24px;\n float: right;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 159px;\n}\n\n#ams-component-retention-leave {\n border-radius: 100px;\n border: 1px solid #0079FF;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-leave-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n margin-top: 12px;\n padding: 0 6px;\n}\n\n.ams-component-retention-leave-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n display: inline-block;\n padding: 0 24px;\n float: right;\n margin-right: 16px;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 144px;\n}\n.".concat(MOCKUP_ID, "-hidden{\nanimation: ").concat(MOCKUP_ID, "-opacity 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes ").concat(MOCKUP_ID, "-opacity {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n}\n");
|
|
12
12
|
export var componentAddCSS = function componentAddCSS() {
|
|
13
13
|
var style = document.createElement('style');
|
|
14
14
|
style.type = 'text/css';
|
package/esm/config/index.d.ts
CHANGED
|
@@ -6,10 +6,10 @@ export declare const sdkVersion: string;
|
|
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
|
7
7
|
* TODO 这里考虑直接换成packagejson.version
|
|
8
8
|
*/
|
|
9
|
-
export declare const AMSCheckoutAppVersion = "1.
|
|
10
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
|
11
|
-
export declare const AMSEasyPayAppVersion = "1.
|
|
12
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
|
13
|
-
export declare const AMSVaultingAppVersion = "1.
|
|
14
|
-
export declare const AMSPaymentElementAppVersion = "1.
|
|
15
|
-
export declare const ADDRESSElementAppVersion = "1.
|
|
9
|
+
export declare const AMSCheckoutAppVersion = "1.45.0";
|
|
10
|
+
export declare const AMSAutoDebitAppVersion = "1.45.0";
|
|
11
|
+
export declare const AMSEasyPayAppVersion = "1.45.0";
|
|
12
|
+
export declare const AMSCashierPaymentAppVersion = "1.45.0";
|
|
13
|
+
export declare const AMSVaultingAppVersion = "1.45.0";
|
|
14
|
+
export declare const AMSPaymentElementAppVersion = "1.45.0";
|
|
15
|
+
export declare const ADDRESSElementAppVersion = "1.45.0";
|
package/esm/config/index.js
CHANGED
|
@@ -36,10 +36,10 @@ export var sdkVersion = json.version;
|
|
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
|
37
37
|
* TODO 这里考虑直接换成packagejson.version
|
|
38
38
|
*/
|
|
39
|
-
export var AMSCheckoutAppVersion = '1.
|
|
40
|
-
export var AMSAutoDebitAppVersion = '1.
|
|
41
|
-
export var AMSEasyPayAppVersion = '1.
|
|
42
|
-
export var AMSCashierPaymentAppVersion = '1.
|
|
43
|
-
export var AMSVaultingAppVersion = '1.
|
|
44
|
-
export var AMSPaymentElementAppVersion = '1.
|
|
45
|
-
export var ADDRESSElementAppVersion = '1.
|
|
39
|
+
export var AMSCheckoutAppVersion = '1.45.0'; // 兜底版本号
|
|
40
|
+
export var AMSAutoDebitAppVersion = '1.45.0'; // 代扣
|
|
41
|
+
export var AMSEasyPayAppVersion = '1.45.0'; // easypay
|
|
42
|
+
export var AMSCashierPaymentAppVersion = '1.45.0'; // 收银台(卡、apm)
|
|
43
|
+
export var AMSVaultingAppVersion = '1.45.0'; // 绑卡
|
|
44
|
+
export var AMSPaymentElementAppVersion = '1.45.0'; // payment element
|
|
45
|
+
export var ADDRESSElementAppVersion = '1.45.0'; // address element
|
package/esm/constant/index.d.ts
CHANGED
|
@@ -249,6 +249,16 @@ export declare const EVENT: {
|
|
|
249
249
|
messageForward: {
|
|
250
250
|
name: string;
|
|
251
251
|
};
|
|
252
|
+
validateFieldsResult: {
|
|
253
|
+
name: string;
|
|
254
|
+
forwardName: string;
|
|
255
|
+
uniqueKey: string;
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
export declare const SENDEVENT: {
|
|
259
|
+
validateFields: {
|
|
260
|
+
name: string;
|
|
261
|
+
};
|
|
252
262
|
};
|
|
253
263
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
|
254
264
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
package/esm/constant/index.js
CHANGED
|
@@ -250,6 +250,18 @@ export var EVENT = {
|
|
|
250
250
|
*/
|
|
251
251
|
messageForward: {
|
|
252
252
|
name: 'onMessageForward'
|
|
253
|
+
},
|
|
254
|
+
validateFieldsResult: {
|
|
255
|
+
name: 'validateFieldsResult',
|
|
256
|
+
forwardName: 'validateFieldsResultForward',
|
|
257
|
+
uniqueKey: 'uservalidateFieldsResult'
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// 2025.09新增,非全量SDK发送事件码
|
|
262
|
+
export var SENDEVENT = {
|
|
263
|
+
validateFields: {
|
|
264
|
+
name: 'validateFields'
|
|
253
265
|
}
|
|
254
266
|
};
|
|
255
267
|
export var COMPONENT_CONTAINER_ID = 'ams-component-container';
|
|
@@ -19,7 +19,7 @@ export var IContainerStatus = /*#__PURE__*/function (IContainerStatus) {
|
|
|
19
19
|
}({});
|
|
20
20
|
export var ContainerController = /*#__PURE__*/function () {
|
|
21
21
|
function ContainerController(_ref) {
|
|
22
|
-
var _options$debugProps;
|
|
22
|
+
var _options$debugProps, _options$debugProps2;
|
|
23
23
|
var type = _ref.type,
|
|
24
24
|
instanceId = _ref.instanceId,
|
|
25
25
|
selector = _ref.selector,
|
|
@@ -41,6 +41,7 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
|
41
41
|
sdkVersion: '',
|
|
42
42
|
webAppVersion: ''
|
|
43
43
|
});
|
|
44
|
+
var iframesSrcLink = options !== null && options !== void 0 && (_options$debugProps = options.debugProps) !== null && _options$debugProps !== void 0 && _options$debugProps.isDebug ? (options === null || options === void 0 || (_options$debugProps2 = options.debugProps) === null || _options$debugProps2 === void 0 ? void 0 : _options$debugProps2.localLink) || '' : '';
|
|
44
45
|
this.containerElement = this.containerService.load({
|
|
45
46
|
type: DisplayTypeEnum.inline,
|
|
46
47
|
platform: isElementPad() ? PlatformEnum.desktop : isElementPC() ? PlatformEnum.desktop : PlatformEnum.mobile,
|
|
@@ -51,7 +52,7 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
|
51
52
|
display: 'block'
|
|
52
53
|
}
|
|
53
54
|
}, processor.generateIframeSrc({
|
|
54
|
-
link:
|
|
55
|
+
link: iframesSrcLink,
|
|
55
56
|
instanceId: this.instanceId
|
|
56
57
|
}));
|
|
57
58
|
this.eventService = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
|
@@ -14,6 +14,14 @@ declare class ElementController {
|
|
|
14
14
|
private onEventCallback;
|
|
15
15
|
mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string): any;
|
|
16
16
|
private onValidateFunc;
|
|
17
|
+
private onValidateAndSubmitPay;
|
|
18
|
+
/**
|
|
19
|
+
* 25/09/08 新增商户主动校验api
|
|
20
|
+
* @returns {Promise<{isValid: boolean}>}
|
|
21
|
+
*/
|
|
22
|
+
validateFields(): Promise<{
|
|
23
|
+
isValid: boolean;
|
|
24
|
+
}>;
|
|
17
25
|
submitPayment(): void;
|
|
18
26
|
private changeLoading;
|
|
19
27
|
private addEventListener;
|
|
@@ -49,10 +49,24 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
49
49
|
_defineProperty(this, "elementContainerService", void 0);
|
|
50
50
|
// 新增变量
|
|
51
51
|
_defineProperty(this, "onStatusChangeCallback", void 0);
|
|
52
|
-
_defineProperty(this, "onValidateFunc", function (event, target
|
|
52
|
+
_defineProperty(this, "onValidateFunc", function (event, target) {
|
|
53
53
|
return new Promise(function (resolve) {
|
|
54
54
|
event.emitAndListen({
|
|
55
55
|
event: ElementPaymentEvent.VALIDATE,
|
|
56
|
+
data: {
|
|
57
|
+
params: {},
|
|
58
|
+
target: target,
|
|
59
|
+
source: ElementPaymentMethod.CONTAINER_ELEMENT
|
|
60
|
+
}
|
|
61
|
+
}, function (result) {
|
|
62
|
+
resolve(result);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
_defineProperty(this, "onValidateAndSubmitPay", function (event, target, params) {
|
|
67
|
+
return new Promise(function (resolve) {
|
|
68
|
+
event.emitAndListen({
|
|
69
|
+
event: ElementPaymentEvent.SUBMIT_PAY,
|
|
56
70
|
data: {
|
|
57
71
|
params: _objectSpread({}, params),
|
|
58
72
|
target: target,
|
|
@@ -188,75 +202,133 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
188
202
|
});
|
|
189
203
|
}
|
|
190
204
|
}, {
|
|
191
|
-
key: "
|
|
192
|
-
value:
|
|
205
|
+
key: "validateFields",
|
|
206
|
+
value:
|
|
207
|
+
/**
|
|
208
|
+
* 25/09/08 新增商户主动校验api
|
|
209
|
+
* @returns {Promise<{isValid: boolean}>}
|
|
210
|
+
*/
|
|
211
|
+
function validateFields() {
|
|
193
212
|
var _this3 = this;
|
|
194
|
-
|
|
195
|
-
new Promise( /*#__PURE__*/function () {
|
|
213
|
+
return new Promise( /*#__PURE__*/function () {
|
|
196
214
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) {
|
|
197
|
-
var
|
|
215
|
+
var _this3$elementProcess;
|
|
216
|
+
var _this3$elementProcess2, validateResult;
|
|
198
217
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
199
218
|
while (1) switch (_context.prev = _context.next) {
|
|
219
|
+
case 0:
|
|
220
|
+
if (!_this3.initTimeout) {
|
|
221
|
+
_context.next = 4;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
return _context.abrupt("return", resolve({
|
|
225
|
+
isValid: false
|
|
226
|
+
}));
|
|
227
|
+
case 4:
|
|
228
|
+
if (!((_this3$elementProcess = _this3.elementProcessors) !== null && _this3$elementProcess !== void 0 && _this3$elementProcess[ElementType.payment])) {
|
|
229
|
+
_context.next = 17;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
_context.prev = 5;
|
|
233
|
+
_context.next = 8;
|
|
234
|
+
return _this3.onValidateFunc((_this3$elementProcess2 = _this3.elementProcessors[ElementType.payment]) === null || _this3$elementProcess2 === void 0 ? void 0 : _this3$elementProcess2.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT);
|
|
235
|
+
case 8:
|
|
236
|
+
validateResult = _context.sent;
|
|
237
|
+
return _context.abrupt("return", resolve(validateResult.data));
|
|
238
|
+
case 12:
|
|
239
|
+
_context.prev = 12;
|
|
240
|
+
_context.t0 = _context["catch"](5);
|
|
241
|
+
return _context.abrupt("return", resolve({
|
|
242
|
+
isValid: false
|
|
243
|
+
}));
|
|
244
|
+
case 15:
|
|
245
|
+
_context.next = 18;
|
|
246
|
+
break;
|
|
247
|
+
case 17:
|
|
248
|
+
return _context.abrupt("return", resolve({
|
|
249
|
+
isValid: false
|
|
250
|
+
}));
|
|
251
|
+
case 18:
|
|
252
|
+
case "end":
|
|
253
|
+
return _context.stop();
|
|
254
|
+
}
|
|
255
|
+
}, _callee, null, [[5, 12]]);
|
|
256
|
+
}));
|
|
257
|
+
return function (_x) {
|
|
258
|
+
return _ref2.apply(this, arguments);
|
|
259
|
+
};
|
|
260
|
+
}());
|
|
261
|
+
}
|
|
262
|
+
}, {
|
|
263
|
+
key: "submitPayment",
|
|
264
|
+
value: function submitPayment() {
|
|
265
|
+
var _this4 = this;
|
|
266
|
+
this.changeLoading(true);
|
|
267
|
+
new Promise( /*#__PURE__*/function () {
|
|
268
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve) {
|
|
269
|
+
var params, _this4$elementProcess, _result$data, _result$data2, result, _this4$elementProcess2, _result$data3, _result$data4, _result, _this4$elementProcess3;
|
|
270
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
271
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
200
272
|
case 0:
|
|
201
273
|
params = {};
|
|
202
|
-
if (!
|
|
203
|
-
|
|
274
|
+
if (!_this4.elementProcessors[ElementType.auth]) {
|
|
275
|
+
_context2.next = 8;
|
|
204
276
|
break;
|
|
205
277
|
}
|
|
206
|
-
|
|
207
|
-
return
|
|
278
|
+
_context2.next = 4;
|
|
279
|
+
return _this4.onValidateAndSubmitPay((_this4$elementProcess = _this4.elementProcessors[ElementType.auth]) === null || _this4$elementProcess === void 0 ? void 0 : _this4$elementProcess.eventCenter, ElementPaymentMethod.AUTH_ELEMENT);
|
|
208
280
|
case 4:
|
|
209
|
-
result =
|
|
281
|
+
result = _context2.sent;
|
|
210
282
|
params.accountInfo = (_result$data = result.data) === null || _result$data === void 0 || (_result$data = _result$data.data) === null || _result$data === void 0 ? void 0 : _result$data.accountInfo;
|
|
211
283
|
if (result !== null && result !== void 0 && (_result$data2 = result.data) !== null && _result$data2 !== void 0 && _result$data2.success) {
|
|
212
|
-
|
|
284
|
+
_context2.next = 8;
|
|
213
285
|
break;
|
|
214
286
|
}
|
|
215
|
-
return
|
|
287
|
+
return _context2.abrupt("return", resolve(undefined));
|
|
216
288
|
case 8:
|
|
217
|
-
if (!
|
|
218
|
-
|
|
289
|
+
if (!_this4.elementProcessors[ElementType.address]) {
|
|
290
|
+
_context2.next = 15;
|
|
219
291
|
break;
|
|
220
292
|
}
|
|
221
|
-
|
|
222
|
-
return
|
|
293
|
+
_context2.next = 11;
|
|
294
|
+
return _this4.onValidateAndSubmitPay((_this4$elementProcess2 = _this4.elementProcessors[ElementType.address]) === null || _this4$elementProcess2 === void 0 ? void 0 : _this4$elementProcess2.eventCenter, ElementPaymentMethod.ADDRESS_ELEMENT);
|
|
223
295
|
case 11:
|
|
224
|
-
_result =
|
|
296
|
+
_result = _context2.sent;
|
|
225
297
|
params.shipping = (_result$data3 = _result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.data;
|
|
226
298
|
if (_result !== null && _result !== void 0 && (_result$data4 = _result.data) !== null && _result$data4 !== void 0 && _result$data4.success) {
|
|
227
|
-
|
|
299
|
+
_context2.next = 15;
|
|
228
300
|
break;
|
|
229
301
|
}
|
|
230
|
-
return
|
|
302
|
+
return _context2.abrupt("return", resolve(undefined));
|
|
231
303
|
case 15:
|
|
232
|
-
if (!
|
|
233
|
-
|
|
304
|
+
if (!_this4.elementProcessors[ElementType.payment]) {
|
|
305
|
+
_context2.next = 25;
|
|
234
306
|
break;
|
|
235
307
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return
|
|
308
|
+
_context2.prev = 16;
|
|
309
|
+
_context2.next = 19;
|
|
310
|
+
return _this4.onValidateAndSubmitPay((_this4$elementProcess3 = _this4.elementProcessors[ElementType.payment]) === null || _this4$elementProcess3 === void 0 ? void 0 : _this4$elementProcess3.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT, params);
|
|
239
311
|
case 19:
|
|
240
|
-
return
|
|
312
|
+
return _context2.abrupt("return", resolve(undefined));
|
|
241
313
|
case 22:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
return
|
|
314
|
+
_context2.prev = 22;
|
|
315
|
+
_context2.t0 = _context2["catch"](16);
|
|
316
|
+
return _context2.abrupt("return", resolve(undefined));
|
|
245
317
|
case 25:
|
|
246
318
|
resolve(params);
|
|
247
319
|
case 26:
|
|
248
320
|
case "end":
|
|
249
|
-
return
|
|
321
|
+
return _context2.stop();
|
|
250
322
|
}
|
|
251
|
-
},
|
|
323
|
+
}, _callee2, null, [[16, 22]]);
|
|
252
324
|
}));
|
|
253
|
-
return function (
|
|
254
|
-
return
|
|
325
|
+
return function (_x2) {
|
|
326
|
+
return _ref3.apply(this, arguments);
|
|
255
327
|
};
|
|
256
328
|
}()).then(function () {
|
|
257
|
-
|
|
329
|
+
_this4.changeLoading(false);
|
|
258
330
|
}, function () {
|
|
259
|
-
|
|
331
|
+
_this4.changeLoading(false);
|
|
260
332
|
});
|
|
261
333
|
}
|
|
262
334
|
}, {
|
|
@@ -281,21 +353,21 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
281
353
|
}, {
|
|
282
354
|
key: "addEventListener",
|
|
283
355
|
value: function addEventListener(renderCallback) {
|
|
284
|
-
var
|
|
356
|
+
var _this5 = this;
|
|
285
357
|
this.serviceMap.EventCenter.listen(ElementPaymentEvent.ON_EVENT_CALLBACK, function (data) {
|
|
286
|
-
var
|
|
287
|
-
(
|
|
358
|
+
var _this5$onEventCallbac;
|
|
359
|
+
(_this5$onEventCallbac = _this5.onEventCallback) === null || _this5$onEventCallbac === void 0 || _this5$onEventCallbac.call(_this5, data);
|
|
288
360
|
});
|
|
289
361
|
this.serviceMap.EventCenter.listen(EVENT.sizeChanged.name, function (data) {
|
|
290
|
-
clearTimeout(
|
|
291
|
-
|
|
292
|
-
if (
|
|
362
|
+
clearTimeout(_this5.initTimeout);
|
|
363
|
+
_this5.initTimeout = null;
|
|
364
|
+
if (_this5.elementContainerService.getContainerService(data.source)) {
|
|
293
365
|
renderCallback({
|
|
294
366
|
success: true
|
|
295
367
|
});
|
|
296
|
-
|
|
368
|
+
_this5.elementContainerService.getContainerService(data.source).switchContainerStatus(IContainerStatus.IN_BIZ_FLOW);
|
|
297
369
|
}
|
|
298
|
-
|
|
370
|
+
_this5.changeLoading(false);
|
|
299
371
|
// 遍历containerService中的所有container查看是否所有状态都是IN_BIZ_FLOW
|
|
300
372
|
// const allContainersInBizFlow = Object.values(this.elementContainerService.getContainerServices()).every(
|
|
301
373
|
// (containerService) => containerService.getContainerStatus() === IContainerStatus.IN_BIZ_FLOW,
|
|
@@ -305,22 +377,23 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
305
377
|
// }
|
|
306
378
|
});
|
|
307
379
|
this.serviceMap.EventCenter.listen(EVENT.redirect.name, function (data) {
|
|
308
|
-
var onEventCallback =
|
|
380
|
+
var onEventCallback = _this5.onEventCallback.bind(_this5);
|
|
309
381
|
handleRedirect(data, false, onEventCallback);
|
|
310
382
|
});
|
|
311
383
|
this.serviceMap.EventCenter.listen(EVENT.destroy.name, function () {
|
|
312
|
-
|
|
313
|
-
|
|
384
|
+
_this5.setControllerStatusOrView(IElementStatus.READY);
|
|
385
|
+
_this5.destroyHandle();
|
|
314
386
|
});
|
|
315
387
|
this.serviceMap.EventCenter.listen(EVENT.webAppReady.name, function (data) {
|
|
316
|
-
clearTimeout(
|
|
317
|
-
|
|
388
|
+
clearTimeout(_this5.initTimeout);
|
|
389
|
+
_this5.initTimeout = null;
|
|
390
|
+
if (_this5.elementContainerService.getContainerService(data.source)) {
|
|
318
391
|
renderCallback({
|
|
319
392
|
success: true
|
|
320
393
|
});
|
|
321
|
-
|
|
394
|
+
_this5.elementContainerService.getContainerService(data.source).switchContainerStatus(IContainerStatus.IN_BIZ_FLOW);
|
|
322
395
|
}
|
|
323
|
-
|
|
396
|
+
_this5.changeLoading(false);
|
|
324
397
|
});
|
|
325
398
|
this.serviceMap.EventCenter.listen(EVENT.showToast.name, function (data) {
|
|
326
399
|
showToast(data);
|
|
@@ -328,8 +401,8 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
328
401
|
this.serviceMap.EventCenter.listen(EVENT.messageForward.name, function (data) {
|
|
329
402
|
var source = MountElementType[data.source];
|
|
330
403
|
var target = MountElementType[data.target];
|
|
331
|
-
if (
|
|
332
|
-
|
|
404
|
+
if (_this5.elementProcessors[source] && _this5.elementProcessors[target]) {
|
|
405
|
+
_this5.elementProcessors[target].eventCenter.dispatchToApp({
|
|
333
406
|
event: data.event,
|
|
334
407
|
data: data
|
|
335
408
|
});
|
|
@@ -339,24 +412,24 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
339
412
|
}, {
|
|
340
413
|
key: "sendRequestAndWaitWebLaunch",
|
|
341
414
|
value: function sendRequestAndWaitWebLaunch(renderOptions) {
|
|
342
|
-
var
|
|
415
|
+
var _this6 = this;
|
|
343
416
|
var type = renderOptions.type,
|
|
344
417
|
options = _objectWithoutProperties(renderOptions, _excluded);
|
|
345
418
|
var webLaunchPromise = this.elementContainerService.getContainerService(type).createWebLaunchPromise();
|
|
346
|
-
Promise.all([webLaunchPromise, this.elementProcessors[type].obtainData()]).then(function (
|
|
347
|
-
var
|
|
348
|
-
var
|
|
349
|
-
_webLaunchRes =
|
|
350
|
-
_obtainDataRes =
|
|
351
|
-
(
|
|
419
|
+
Promise.all([webLaunchPromise, this.elementProcessors[type].obtainData()]).then(function (_ref4) {
|
|
420
|
+
var _this6$elementContain;
|
|
421
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
422
|
+
_webLaunchRes = _ref5[0],
|
|
423
|
+
_obtainDataRes = _ref5[1];
|
|
424
|
+
(_this6$elementContain = _this6.elementContainerService.getContainerService(type)) === null || _this6$elementContain === void 0 || _this6$elementContain.switchContainerStatus(IContainerStatus.READY);
|
|
352
425
|
var allReady = true;
|
|
353
|
-
|
|
426
|
+
_this6.elementContainerService.getContainerServices().forEach(function (item) {
|
|
354
427
|
if (!allReady) return;
|
|
355
428
|
allReady = item.getContainerStatus() === IContainerStatus.READY;
|
|
356
429
|
});
|
|
357
430
|
if (allReady) {
|
|
358
|
-
|
|
359
|
-
|
|
431
|
+
_this6.elementContainerService.getContainerServices().forEach(function (value, key) {
|
|
432
|
+
_this6.sendReady(key, options);
|
|
360
433
|
});
|
|
361
434
|
}
|
|
362
435
|
});
|
|
@@ -392,37 +465,37 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
392
465
|
}, {
|
|
393
466
|
key: "updatePayment",
|
|
394
467
|
value: function () {
|
|
395
|
-
var _updatePayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
396
|
-
var
|
|
397
|
-
return _regeneratorRuntime().wrap(function
|
|
398
|
-
while (1) switch (
|
|
468
|
+
var _updatePayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(paymentSessionData) {
|
|
469
|
+
var _this7 = this;
|
|
470
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
471
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
399
472
|
case 0:
|
|
400
|
-
return
|
|
401
|
-
var
|
|
473
|
+
return _context4.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
474
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
|
402
475
|
var prePaymentSessionData, data, LOCAL_MOCK;
|
|
403
|
-
return _regeneratorRuntime().wrap(function
|
|
404
|
-
while (1) switch (
|
|
476
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
477
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
405
478
|
case 0:
|
|
406
479
|
if (checkCanUpdate({
|
|
407
|
-
status:
|
|
408
|
-
paymentContainerService:
|
|
480
|
+
status: _this7.elementContainer.getStatus(),
|
|
481
|
+
paymentContainerService: _this7.elementContainerService.getContainerService(ElementType.payment),
|
|
409
482
|
newPaymentSessionData: paymentSessionData,
|
|
410
|
-
oldPaymentSessionData:
|
|
483
|
+
oldPaymentSessionData: _this7.options.sessionData
|
|
411
484
|
})) {
|
|
412
|
-
|
|
485
|
+
_context3.next = 2;
|
|
413
486
|
break;
|
|
414
487
|
}
|
|
415
|
-
return
|
|
488
|
+
return _context3.abrupt("return", resolve(false));
|
|
416
489
|
case 2:
|
|
417
|
-
prePaymentSessionData =
|
|
418
|
-
|
|
490
|
+
prePaymentSessionData = _this7.elementContainer.getPaymentContext().paymentSession;
|
|
491
|
+
_this7.elementContainer.updatePaymentSessionData(paymentSessionData);
|
|
419
492
|
// 1、数据获取
|
|
420
|
-
|
|
421
|
-
return
|
|
493
|
+
_context3.next = 6;
|
|
494
|
+
return _this7.elementProcessors[ElementType.payment].obtainData();
|
|
422
495
|
case 6:
|
|
423
|
-
data =
|
|
496
|
+
data = _context3.sent;
|
|
424
497
|
LOCAL_MOCK = window.location.href.indexOf('LOCAL_MOCK=1') !== -1; // 2、发送update消息
|
|
425
|
-
Object.values(
|
|
498
|
+
Object.values(_this7.elementProcessors).forEach(function (processor) {
|
|
426
499
|
processor.update({
|
|
427
500
|
data: {
|
|
428
501
|
originActionQueryResult: LOCAL_MOCK ? sdkActionUpdate : data.originActionQueryResult,
|
|
@@ -432,30 +505,30 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
432
505
|
});
|
|
433
506
|
});
|
|
434
507
|
// 3、返回更新结果
|
|
435
|
-
|
|
508
|
+
_this7.serviceMap.EventCenter.listen(EVENT.updated.name, function (data) {
|
|
436
509
|
// 若更新不成功,还原core.paymentContext信息
|
|
437
510
|
if (!data.success) {
|
|
438
|
-
|
|
511
|
+
_this7.elementContainer.updatePaymentSessionData(prePaymentSessionData);
|
|
439
512
|
}
|
|
440
513
|
return resolve(data.success || false);
|
|
441
514
|
});
|
|
442
515
|
case 10:
|
|
443
516
|
case "end":
|
|
444
|
-
return
|
|
517
|
+
return _context3.stop();
|
|
445
518
|
}
|
|
446
|
-
},
|
|
519
|
+
}, _callee3);
|
|
447
520
|
}));
|
|
448
|
-
return function (
|
|
449
|
-
return
|
|
521
|
+
return function (_x4) {
|
|
522
|
+
return _ref6.apply(this, arguments);
|
|
450
523
|
};
|
|
451
524
|
}()));
|
|
452
525
|
case 1:
|
|
453
526
|
case "end":
|
|
454
|
-
return
|
|
527
|
+
return _context4.stop();
|
|
455
528
|
}
|
|
456
|
-
},
|
|
529
|
+
}, _callee4);
|
|
457
530
|
}));
|
|
458
|
-
function updatePayment(
|
|
531
|
+
function updatePayment(_x3) {
|
|
459
532
|
return _updatePayment.apply(this, arguments);
|
|
460
533
|
}
|
|
461
534
|
return updatePayment;
|