@alipay/ams-checkout 0.0.1757298389-dev.1 → 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.js +22 -15
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +16 -10
- package/esm/core/component/element/type.d.ts +8 -3
- package/esm/core/component/element/type.js +5 -0
- 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');
|
|
@@ -217,36 +217,42 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
217
217
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
218
218
|
while (1) switch (_context.prev = _context.next) {
|
|
219
219
|
case 0:
|
|
220
|
-
if (!
|
|
221
|
-
_context.next =
|
|
220
|
+
if (!_this3.initTimeout) {
|
|
221
|
+
_context.next = 4;
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
|
-
_context.prev = 1;
|
|
225
|
-
_context.next = 4;
|
|
226
|
-
return _this3.onValidateFunc((_this3$elementProcess2 = _this3.elementProcessors[ElementType.payment]) === null || _this3$elementProcess2 === void 0 ? void 0 : _this3$elementProcess2.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT);
|
|
227
|
-
case 4:
|
|
228
|
-
validateResult = _context.sent;
|
|
229
224
|
return _context.abrupt("return", resolve({
|
|
230
|
-
isValid:
|
|
225
|
+
isValid: false
|
|
231
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);
|
|
232
235
|
case 8:
|
|
233
|
-
|
|
234
|
-
_context.
|
|
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);
|
|
235
241
|
return _context.abrupt("return", resolve({
|
|
236
242
|
isValid: false
|
|
237
243
|
}));
|
|
238
|
-
case
|
|
239
|
-
_context.next =
|
|
244
|
+
case 15:
|
|
245
|
+
_context.next = 18;
|
|
240
246
|
break;
|
|
241
|
-
case
|
|
247
|
+
case 17:
|
|
242
248
|
return _context.abrupt("return", resolve({
|
|
243
249
|
isValid: false
|
|
244
250
|
}));
|
|
245
|
-
case
|
|
251
|
+
case 18:
|
|
246
252
|
case "end":
|
|
247
253
|
return _context.stop();
|
|
248
254
|
}
|
|
249
|
-
}, _callee, null, [[
|
|
255
|
+
}, _callee, null, [[5, 12]]);
|
|
250
256
|
}));
|
|
251
257
|
return function (_x) {
|
|
252
258
|
return _ref2.apply(this, arguments);
|
|
@@ -380,6 +386,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
380
386
|
});
|
|
381
387
|
this.serviceMap.EventCenter.listen(EVENT.webAppReady.name, function (data) {
|
|
382
388
|
clearTimeout(_this5.initTimeout);
|
|
389
|
+
_this5.initTimeout = null;
|
|
383
390
|
if (_this5.elementContainerService.getContainerService(data.source)) {
|
|
384
391
|
renderCallback({
|
|
385
392
|
success: true
|
|
@@ -27,11 +27,11 @@ import PackageJson from "../../../../../package.json";
|
|
|
27
27
|
import { EVENT } from "../../../../constant";
|
|
28
28
|
import { ServiceProvider } from "../../../../foundation/service";
|
|
29
29
|
import { ApplePaySdk, handleGooglePay, isSkipRenderPaymentMethod } from "../../../../plugin/component/channel";
|
|
30
|
-
import { LogConfig, Logger } from "../../../../util/logger";
|
|
31
30
|
import { queryParse } from "../../../../util";
|
|
31
|
+
import { LogConfig, Logger } from "../../../../util/logger";
|
|
32
32
|
import { parseSessionData } from "../../index";
|
|
33
33
|
import { oneAccount, sdkAction } from "../mock";
|
|
34
|
-
import { generateIframeSrc as _generateIframeSrc,
|
|
34
|
+
import { generateIframeSrc as _generateIframeSrc, isElementPad, isElementPC } from "../util";
|
|
35
35
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
36
36
|
var logger = new Logger(LogConfig, true);
|
|
37
37
|
var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
@@ -58,7 +58,8 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
58
58
|
event: 'renderComponent',
|
|
59
59
|
data: {
|
|
60
60
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
|
61
|
-
|
|
61
|
+
// 极简架构需要全量sessionData, 服务端与谦评估没得影响
|
|
62
|
+
paymentSessionData: paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSession,
|
|
62
63
|
queryResult: extraParam === null || extraParam === void 0 ? void 0 : extraParam.originActionQueryResult,
|
|
63
64
|
envInfo: {
|
|
64
65
|
screenHeight: screen.height,
|
|
@@ -242,18 +243,19 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
242
243
|
value: function () {
|
|
243
244
|
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
244
245
|
var _paymentSessionObj$co;
|
|
245
|
-
var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo,
|
|
246
|
+
var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref4, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
|
|
246
247
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
247
248
|
while (1) switch (_context2.prev = _context2.next) {
|
|
248
249
|
case 0:
|
|
249
250
|
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
|
250
251
|
_this$elementContaine8 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine8.paymentSession, paymentSessionObj = _this$elementContaine8.paymentSessionObj, displayInfo = _this$elementContaine8.displayInfo;
|
|
251
|
-
|
|
252
|
+
_displayInfo = displayInfo;
|
|
253
|
+
debugProps = _displayInfo.debugProps;
|
|
252
254
|
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
|
253
255
|
_ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
|
|
254
256
|
hostSign = paymentSession.split('&&')[1] || '';
|
|
255
257
|
isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
|
|
256
|
-
LOCAL_MOCK =
|
|
258
|
+
LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
|
|
257
259
|
_queryParse = queryParse(this.getElementUrl()), appType = _queryParse.appType;
|
|
258
260
|
terminalType = isElementPad() ? 'WEB' : appType ? 'APP' : isElementPC() ? 'WEB' : 'WAP';
|
|
259
261
|
generateActionQueryPromise = function generateActionQueryPromise() {
|
|
@@ -267,7 +269,11 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
267
269
|
}
|
|
268
270
|
var sdkRequestData = {
|
|
269
271
|
paymentSessionConfig: paymentSessionConfig,
|
|
270
|
-
paymentSessionData: paymentSession
|
|
272
|
+
paymentSessionData: paymentSession,
|
|
273
|
+
extParams: {
|
|
274
|
+
// 必传,服务端用于根据前端传入locale判断是否使用用户偏好语言
|
|
275
|
+
isUserPreferredLocale: true
|
|
276
|
+
}
|
|
271
277
|
};
|
|
272
278
|
if (displayInfo !== null && displayInfo !== void 0 && (_displayInfo$merchant = displayInfo.merchantAppointParam) !== null && _displayInfo$merchant !== void 0 && _displayInfo$merchant.storedCard) {
|
|
273
279
|
sdkRequestData.merchantAppointParam = displayInfo.merchantAppointParam;
|
|
@@ -322,9 +328,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
322
328
|
});
|
|
323
329
|
});
|
|
324
330
|
};
|
|
325
|
-
_context2.next =
|
|
331
|
+
_context2.next = 15;
|
|
326
332
|
return Promise.all(isConnect ? [generateActionQueryPromise(), generateOneAccountQueryPromise()] : [generateActionQueryPromise()]);
|
|
327
|
-
case
|
|
333
|
+
case 15:
|
|
328
334
|
_yield$Promise$all = _context2.sent;
|
|
329
335
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
330
336
|
originActionQueryResult = _yield$Promise$all2[0];
|
|
@@ -337,7 +343,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
337
343
|
originActionQueryResult: originActionQueryResult,
|
|
338
344
|
originOneAccountQueryResult: originOneAccountQueryResult
|
|
339
345
|
});
|
|
340
|
-
case
|
|
346
|
+
case 21:
|
|
341
347
|
case "end":
|
|
342
348
|
return _context2.stop();
|
|
343
349
|
}
|
|
@@ -127,6 +127,10 @@ export interface LinkAuthMountOptions extends BaseMountOptions {
|
|
|
127
127
|
theme?: ThemeType;
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
+
type ToCamelCase<S extends string> = S extends `${infer First}-${infer Rest}` ? `${First}${Capitalize<ToCamelCase<Rest>>}` : S;
|
|
131
|
+
type CompatibleVariables<T extends Record<string, string>> = {
|
|
132
|
+
[K in keyof T as K | ToCamelCase<K & string>]: string;
|
|
133
|
+
};
|
|
130
134
|
export interface PaymentMountOptions extends BaseMountOptions {
|
|
131
135
|
type: ElementType.payment;
|
|
132
136
|
appearance?: {
|
|
@@ -134,7 +138,7 @@ export interface PaymentMountOptions extends BaseMountOptions {
|
|
|
134
138
|
layout?: {
|
|
135
139
|
type: PaymentElementLayout;
|
|
136
140
|
};
|
|
137
|
-
variables?: {
|
|
141
|
+
variables?: Partial<CompatibleVariables<{
|
|
138
142
|
'content-primary': string;
|
|
139
143
|
'content-secondary': string;
|
|
140
144
|
'content-tertiary': string;
|
|
@@ -159,7 +163,8 @@ export interface PaymentMountOptions extends BaseMountOptions {
|
|
|
159
163
|
'radius-module': string;
|
|
160
164
|
'radius-component': string;
|
|
161
165
|
'radius-button': string;
|
|
162
|
-
|
|
166
|
+
'warpper-padding': string;
|
|
167
|
+
}>>;
|
|
163
168
|
};
|
|
164
169
|
notRedirectAfterComplete?: boolean;
|
|
165
170
|
merchantAppointParam?: IMerchantAppointParam;
|
|
@@ -360,7 +365,7 @@ export interface IElementOptions {
|
|
|
360
365
|
appearance?: {
|
|
361
366
|
theme: ThemeType.Default | ThemeType.Night;
|
|
362
367
|
};
|
|
363
|
-
onEventCallback?: ({ code, message, result }: {
|
|
368
|
+
onEventCallback?: ({ code, message, result, }: {
|
|
364
369
|
code: EventCallbackCode;
|
|
365
370
|
message: string;
|
|
366
371
|
result?: any;
|
|
@@ -71,6 +71,11 @@ export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
|
|
|
71
71
|
ELEMENT_ENVIRONMENT["SANDBOX"] = "SANDBOX";
|
|
72
72
|
return ELEMENT_ENVIRONMENT;
|
|
73
73
|
}({});
|
|
74
|
+
|
|
75
|
+
// 将短横线命名转为小驼峰
|
|
76
|
+
|
|
77
|
+
// 同时兼容短横线和小驼峰两种键名
|
|
78
|
+
|
|
74
79
|
// export type IMountOptions = AddressMountOptions | LinkAuthMountOptions | PaymentMountOptions;
|
|
75
80
|
|
|
76
81
|
export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbackName) {
|
|
@@ -10,7 +10,7 @@ export declare const formatElementOption: (options: IElementOptions) => {
|
|
|
10
10
|
appearance?: {
|
|
11
11
|
theme: import("./type").ThemeType.Default | import("./type").ThemeType.Night;
|
|
12
12
|
};
|
|
13
|
-
onEventCallback?: ({ code, message, result }: {
|
|
13
|
+
onEventCallback?: ({ code, message, result, }: {
|
|
14
14
|
code: EventCallbackCode;
|
|
15
15
|
message: string;
|
|
16
16
|
result?: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ComponentApp from '../../plugin/component';
|
|
2
|
-
import { ComponentSignEnum, IappendIframeNodesParams, IcreateComponent, IoptionsParams, IPaymentSessionMetaData, Iselector, Isubmit, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum } from '../../types';
|
|
2
|
+
import { ComponentSignEnum, EventPayloadContext, IappendIframeNodesParams, IcreateComponent, IoptionsParams, IPaymentSessionMetaData, Iselector, Isubmit, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum, ValidationResult } from '../../types';
|
|
3
3
|
import CoreInstance from '../instance/index';
|
|
4
4
|
export declare const getComponentSign: (params: IPaymentSessionMetaData) => ComponentSignEnum;
|
|
5
5
|
export declare const parseSessionData: (sessionData: string) => [IPaymentSessionMetaData, string];
|
|
@@ -15,6 +15,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
|
15
15
|
channelType: ComponentSignEnum[];
|
|
16
16
|
productSceneVersion: string;
|
|
17
17
|
timer: any;
|
|
18
|
+
private _validateResolveMap;
|
|
18
19
|
constructor(options: IAMSComponentOptions);
|
|
19
20
|
private parameterInitAndCheck;
|
|
20
21
|
private pluginAppendIframe;
|
|
@@ -52,4 +53,6 @@ export declare class AMSComponent extends CoreInstance {
|
|
|
52
53
|
* @param data - Transfer information in the submission interface according to your requirements (optional)
|
|
53
54
|
*/
|
|
54
55
|
submit(data?: Isubmit): Promise<unknown>;
|
|
56
|
+
protected _validateFields(): Promise<ValidationResult>;
|
|
57
|
+
protected _sendMessageToAPP(eventContext: EventPayloadContext): void;
|
|
55
58
|
}
|
|
@@ -35,7 +35,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
35
35
|
* 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.
|
|
36
36
|
*/
|
|
37
37
|
import { v4 as uuid } from 'uuid';
|
|
38
|
-
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
|
38
|
+
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT, SENDEVENT } from "../../constant";
|
|
39
|
+
import PreloadHelper from "../../foundation/utils/preload_helper";
|
|
39
40
|
import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
|
40
41
|
import ComponentApp from "../../plugin/component";
|
|
41
42
|
import { ExtendPlugin } from "../../plugin/const";
|
|
@@ -50,7 +51,6 @@ import { SecurityBusSubscriber } from "../bus/ability/security";
|
|
|
50
51
|
import { TrackerBusSubscriber } from "../bus/ability/tracker";
|
|
51
52
|
import CoreInstance from "../instance/index";
|
|
52
53
|
import { loadChannelPneumaticControl } from "./appPreloadProcessing";
|
|
53
|
-
import PreloadHelper from "../../foundation/utils/preload_helper";
|
|
54
54
|
export var getComponentSign = function getComponentSign(params) {
|
|
55
55
|
var _params$paymentSessio = params.paymentSessionConfig,
|
|
56
56
|
_params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
|
|
@@ -140,6 +140,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
|
140
140
|
_defineProperty(_assertThisInitialized(_this2), "channelType", void 0);
|
|
141
141
|
_defineProperty(_assertThisInitialized(_this2), "productSceneVersion", void 0);
|
|
142
142
|
_defineProperty(_assertThisInitialized(_this2), "timer", void 0);
|
|
143
|
+
_defineProperty(_assertThisInitialized(_this2), "_validateResolveMap", new Map());
|
|
143
144
|
var ComponentPlugin = new ComponentApp({
|
|
144
145
|
appVersion: options.appVersion
|
|
145
146
|
});
|
|
@@ -526,6 +527,108 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
|
526
527
|
}
|
|
527
528
|
});
|
|
528
529
|
}
|
|
530
|
+
|
|
531
|
+
// 预留给AMSVaulting复用
|
|
532
|
+
}, {
|
|
533
|
+
key: "_validateFields",
|
|
534
|
+
value: function _validateFields() {
|
|
535
|
+
var _this9 = this;
|
|
536
|
+
return new Promise(function (resolve) {
|
|
537
|
+
// 收银台应用渲染表单后,才允许发送校验消息,三端约定一致
|
|
538
|
+
if (!_this9._componentApp.shouldValidateFields()) {
|
|
539
|
+
resolve({
|
|
540
|
+
isValid: false
|
|
541
|
+
});
|
|
542
|
+
_this9.logger.logInfo({
|
|
543
|
+
title: 'sdk_event_validateFields'
|
|
544
|
+
}, {
|
|
545
|
+
processResult: 'notRenderComponent'
|
|
546
|
+
});
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
var timeoutId;
|
|
550
|
+
var validationPromise = new Promise(function (validationResolve) {
|
|
551
|
+
var eventCallbackId = uuid();
|
|
552
|
+
_this9._validateResolveMap.set(eventCallbackId, validationResolve);
|
|
553
|
+
// 发送validateFields消息
|
|
554
|
+
_this9._sendMessageToAPP({
|
|
555
|
+
event: SENDEVENT.validateFields.name,
|
|
556
|
+
data: {},
|
|
557
|
+
eventCallbackId: eventCallbackId
|
|
558
|
+
});
|
|
559
|
+
var isValidationResult = function isValidationResult(data) {
|
|
560
|
+
return _typeof(data) === 'object' && data !== null && typeof data.isValid === 'boolean';
|
|
561
|
+
};
|
|
562
|
+
var callback = /*#__PURE__*/function () {
|
|
563
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload) {
|
|
564
|
+
var currentEventCallbackId, currentResolve, result;
|
|
565
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
566
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
567
|
+
case 0:
|
|
568
|
+
currentEventCallbackId = (payload === null || payload === void 0 ? void 0 : payload.eventCallbackId) || ''; // 事件一一对应,处理异步商户调用多次可能导致乱序的问题
|
|
569
|
+
currentResolve = _this9._validateResolveMap.get(currentEventCallbackId);
|
|
570
|
+
result = {
|
|
571
|
+
isValid: false
|
|
572
|
+
};
|
|
573
|
+
if (isValidationResult(payload === null || payload === void 0 ? void 0 : payload.data)) {
|
|
574
|
+
result = payload === null || payload === void 0 ? void 0 : payload.data;
|
|
575
|
+
}
|
|
576
|
+
_this9.logger.logInfo({
|
|
577
|
+
title: 'sdk_event_validateFields'
|
|
578
|
+
}, {
|
|
579
|
+
processResult: result.isValid ? 'true' : 'false'
|
|
580
|
+
});
|
|
581
|
+
// 收银台应用保证数据格式,三端SDK负责透传
|
|
582
|
+
if (!!currentResolve) {
|
|
583
|
+
currentResolve(result);
|
|
584
|
+
_this9._validateResolveMap.delete(currentEventCallbackId);
|
|
585
|
+
}
|
|
586
|
+
case 6:
|
|
587
|
+
case "end":
|
|
588
|
+
return _context2.stop();
|
|
589
|
+
}
|
|
590
|
+
}, _callee2);
|
|
591
|
+
}));
|
|
592
|
+
return function callback(_x2) {
|
|
593
|
+
return _ref5.apply(this, arguments);
|
|
594
|
+
};
|
|
595
|
+
}();
|
|
596
|
+
// 接收收银台应用的返回validateFieldsResult消息
|
|
597
|
+
// validateFieldsResultForward处理订阅eventCallbackId为空的问题
|
|
598
|
+
_this9._overrideSubscription(EVENT.validateFieldsResult.forwardName, callback, EVENT.validateFieldsResult.uniqueKey);
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// 兜底场景,三端约定超时时间15秒,兼容cpf网络校验超时场景
|
|
602
|
+
var timeoutPromise = new Promise(function (timeoutResolve) {
|
|
603
|
+
timeoutId = setTimeout(function () {
|
|
604
|
+
_this9.logger.logInfo({
|
|
605
|
+
title: 'sdk_event_validateFields'
|
|
606
|
+
}, {
|
|
607
|
+
processResult: 'timeout'
|
|
608
|
+
});
|
|
609
|
+
timeoutResolve({
|
|
610
|
+
isValid: false
|
|
611
|
+
});
|
|
612
|
+
}, 15000);
|
|
613
|
+
});
|
|
614
|
+
Promise.race([validationPromise, timeoutPromise]).then(function (result) {
|
|
615
|
+
clearTimeout(timeoutId);
|
|
616
|
+
resolve(result);
|
|
617
|
+
}).catch(function () {
|
|
618
|
+
clearTimeout(timeoutId);
|
|
619
|
+
resolve({
|
|
620
|
+
isValid: false
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
}, {
|
|
626
|
+
key: "_sendMessageToAPP",
|
|
627
|
+
value: function _sendMessageToAPP(eventContext) {
|
|
628
|
+
this._componentApp.dispatchToApp({
|
|
629
|
+
context: eventContext
|
|
630
|
+
});
|
|
631
|
+
}
|
|
529
632
|
}]);
|
|
530
633
|
return AMSComponent;
|
|
531
634
|
}(CoreInstance);
|
package/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AddressComponent } from './core/component/address';
|
|
2
2
|
import { ElementComponent } from './core/component/element';
|
|
3
3
|
import { AMSComponent } from './core/component/index';
|
|
4
|
-
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions } from './types';
|
|
4
|
+
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions, ValidationResult } from './types';
|
|
5
5
|
export { AMSCheckoutPage } from './core/component/ckp';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export declare class AMSCheckout extends AMSComponent {
|
|
@@ -14,6 +14,15 @@ export declare class AMSAutoDebitPay extends AMSCheckout {
|
|
|
14
14
|
export declare class AMSCashierPayment extends AMSCheckout {
|
|
15
15
|
constructor(options: IoptionsParams);
|
|
16
16
|
static preload(options?: IPreloadOptions): void;
|
|
17
|
+
/**
|
|
18
|
+
* Form validation function
|
|
19
|
+
* If the form is currently displayed:
|
|
20
|
+
* - Successful validation: isValid is true
|
|
21
|
+
* - Failed validation: isValid is false, and error messages are displayed on the form page
|
|
22
|
+
* If not on the form display page, isValid returns false
|
|
23
|
+
* @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
|
|
24
|
+
*/
|
|
25
|
+
validateFields(): Promise<ValidationResult>;
|
|
17
26
|
}
|
|
18
27
|
export declare class AMSVaulting extends AMSCheckout {
|
|
19
28
|
constructor(options: IoptionsParams);
|
package/esm/index.js
CHANGED
|
@@ -111,7 +111,21 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout2) {
|
|
|
111
111
|
}
|
|
112
112
|
return _super3.call(this, _options, currentChannelType);
|
|
113
113
|
}
|
|
114
|
-
_createClass(AMSCashierPayment,
|
|
114
|
+
_createClass(AMSCashierPayment, [{
|
|
115
|
+
key: "validateFields",
|
|
116
|
+
value:
|
|
117
|
+
/**
|
|
118
|
+
* Form validation function
|
|
119
|
+
* If the form is currently displayed:
|
|
120
|
+
* - Successful validation: isValid is true
|
|
121
|
+
* - Failed validation: isValid is false, and error messages are displayed on the form page
|
|
122
|
+
* If not on the form display page, isValid returns false
|
|
123
|
+
* @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
|
|
124
|
+
*/
|
|
125
|
+
function validateFields() {
|
|
126
|
+
return this._validateFields();
|
|
127
|
+
}
|
|
128
|
+
}], [{
|
|
115
129
|
key: "preload",
|
|
116
130
|
value: function preload() {
|
|
117
131
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
@@ -28,6 +28,7 @@ export default class ComponentApp {
|
|
|
28
28
|
private _isAppWebview;
|
|
29
29
|
_merchantAppointParam: IMerchantAppointParam;
|
|
30
30
|
private _webAppHeartBeatTimeoutFn;
|
|
31
|
+
private _hasRenderComponent;
|
|
31
32
|
constructor(componentOption?: {
|
|
32
33
|
appVersion?: string;
|
|
33
34
|
});
|
|
@@ -126,5 +127,6 @@ export default class ComponentApp {
|
|
|
126
127
|
private showRetentionPopup;
|
|
127
128
|
private hideRetentionPopupFunc;
|
|
128
129
|
private submitForm;
|
|
130
|
+
shouldValidateFields(): boolean;
|
|
129
131
|
}
|
|
130
132
|
export {};
|