@alipay/ams-checkout 0.0.1723203704-dev.2 → 0.0.1723203704-dev.4

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.
@@ -1,8 +0,0 @@
1
- export declare const insertStyleSheet: () => void;
2
- export declare const createModal: ({ device, url, widthPadding, heightPadding }: {
3
- device: any;
4
- url: any;
5
- widthPadding: any;
6
- heightPadding: any;
7
- }) => Promise<HTMLIFrameElement>;
8
- export declare const destroyModal: () => void;
@@ -1,65 +0,0 @@
1
- import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant";
2
-
3
- // CSS样式字符串
4
- var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n");
5
-
6
- // 创建和插入样式表
7
- export var insertStyleSheet = function insertStyleSheet() {
8
- var style = document.createElement('style');
9
- style.innerHTML = modalStyles;
10
- document.head.appendChild(style);
11
- };
12
-
13
- // 插入弹窗
14
- export var createModal = function createModal(_ref) {
15
- var device = _ref.device,
16
- url = _ref.url,
17
- widthPadding = _ref.widthPadding,
18
- heightPadding = _ref.heightPadding;
19
- return new Promise(function (resolve, reject) {
20
- try {
21
- var overlay = document.createElement('div');
22
- overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
23
- var modal = document.createElement('div');
24
- modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
25
- if (device === 'desktop') {
26
- modal.style.width = '600px';
27
- modal.style.height = '464px';
28
- modal.style.borderRadius = '12px';
29
- } else {
30
- modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
31
- modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
32
- modal.style.borderRadius = '8px';
33
- }
34
- var iframe = document.createElement('iframe');
35
- iframe.src = url; // 替换为实际的 URL 地址
36
- iframe.style.border = 'none';
37
- iframe.style.width = '100%';
38
- iframe.style.height = '100%';
39
- modal.appendChild(iframe);
40
- var body = document.getElementsByTagName('body')[0];
41
- body.appendChild(overlay);
42
- body.appendChild(modal);
43
- resolve(iframe);
44
- } catch (error) {
45
- reject({
46
- title: 'sdk_error_create_pop_up',
47
- message: error === null || error === void 0 ? void 0 : error.toString()
48
- });
49
- }
50
- });
51
- };
52
-
53
- // 销毁弹窗
54
- export var destroyModal = function destroyModal() {
55
- var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
56
- var modal = document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal"));
57
- overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
58
- overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
59
- modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
60
- modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
61
- setTimeout(function () {
62
- overlay.parentNode.removeChild(overlay);
63
- modal.parentNode.removeChild(modal);
64
- }, ANIMATION_TIME);
65
- };
@@ -1,92 +0,0 @@
1
- import { componentSignEnum } from './index';
2
- /** 表单地址数据 */
3
- export interface AddressItem {
4
- shippingName: {
5
- firstName: string;
6
- lastName: string;
7
- };
8
- /** 手机号 */
9
- shippingPhoneNo: string;
10
- /** 地址 */
11
- shippingAddress: {
12
- /** 国家 */
13
- region: string;
14
- /** 地址1 */
15
- address1: string;
16
- /** 地址2 */
17
- address2: string;
18
- /** 省份 */
19
- province?: string;
20
- /** 城市 */
21
- city?: string;
22
- /** 地址级联 四层 【province,city,district,subDistrict】 */
23
- district?: string[];
24
- /** 邮政编码 */
25
- zipCode: string;
26
- /** 对应地址级联数据对象 */
27
- districtValues?: {
28
- /** 城市 */
29
- city?: string;
30
- /** 区/县 */
31
- district?: string;
32
- /** 省份 */
33
- province?: string;
34
- /** 子区域 */
35
- subDistrict?: string;
36
- };
37
- };
38
- /** 备注 */
39
- notes?: string;
40
- open?: boolean;
41
- /** 是否默认地址 */
42
- prefer?: '1' | '0';
43
- shippingId?: string;
44
- }
45
- type addressAutoSuggestDisabledType = 0 | 1;
46
- export interface addressInitOption {
47
- mode: string;
48
- appId?: string;
49
- configParams?: {
50
- hideFields?: string[];
51
- addressAutoSuggestDisabled?: addressAutoSuggestDisabledType;
52
- };
53
- prefillValue?: AddressItem[];
54
- appearance?: {
55
- [x: string]: any;
56
- themeType: string;
57
- accentColor: string;
58
- };
59
- }
60
- export declare enum renderDisplayTypeEnum {
61
- 'popup' = "popup",
62
- 'inline' = "inline"
63
- }
64
- export type Iselector = string;
65
- export interface IappendAddressIframeNodesParams extends addressInitOption {
66
- renderDisplayType: renderDisplayTypeEnum;
67
- selector?: Iselector;
68
- }
69
- export type IAppendAddressParams = {
70
- componentSign: componentSignEnum;
71
- iframeNodesParams: IappendAddressIframeNodesParams;
72
- };
73
- export type callOnSizeChanged = (state: {
74
- width: number;
75
- height: number;
76
- }) => void;
77
- export type onChange = (val: AddressItem[]) => void;
78
- export type getValue = (val: AddressItem[]) => void;
79
- export interface IoptionsAddressParams {
80
- environment?: string;
81
- locale?: string;
82
- onSizeChanged?: callOnSizeChanged;
83
- onGetValue?: getValue;
84
- onChange?: onChange;
85
- networkMode?: string;
86
- mode?: string;
87
- analytics?: {
88
- enabled: boolean;
89
- };
90
- product?: string;
91
- }
92
- export {};
@@ -1,7 +0,0 @@
1
- /** 表单地址数据 */
2
-
3
- export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum) {
4
- renderDisplayTypeEnum["popup"] = "popup";
5
- renderDisplayTypeEnum["inline"] = "inline";
6
- return renderDisplayTypeEnum;
7
- }({});