@pisell/private-materials 6.3.32 → 6.3.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +151 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +23 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +23 -8
  11. package/es/components/booking/addons/model.d.ts +1 -10
  12. package/es/components/booking/forms/model.d.ts +1 -10
  13. package/es/components/booking/info/model.d.ts +1 -10
  14. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  15. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  16. package/es/components/booking/model.d.ts +1 -9
  17. package/es/components/booking/notes/model.d.ts +1 -10
  18. package/es/components/booking/payments/model.d.ts +1 -10
  19. package/es/components/index.d.ts +1 -2
  20. package/es/components/index.js +1 -2
  21. package/es/components/pay/toC/model.d.ts +1 -9
  22. package/es/components/schedules/model.d.ts +1 -9
  23. package/es/components/wallet/Detail/model.d.ts +1 -13
  24. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  25. package/es/components/wallet/PointCard/model.d.ts +1 -13
  26. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  27. package/es/components/wallet/Voucher/model.d.ts +1 -13
  28. package/es/components/wallet/model.d.ts +1 -9
  29. package/es/components/walletList/index.d.ts +0 -25
  30. package/es/components/walletList/index.js +98 -66
  31. package/es/components/walletList/serve.d.ts +4 -0
  32. package/es/components/walletList/serve.js +46 -13
  33. package/es/components/walletList/types/index.d.ts +12 -12
  34. package/es/components/walletList/types/index.js +2 -2
  35. package/es/index.d.ts +2 -1
  36. package/es/index.js +2 -1
  37. package/es/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  38. package/es/plus/productSelect/CategoryTabs/index.js +6 -3
  39. package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  40. package/es/plus/productSelect/utils.js +0 -1
  41. package/es/plus/walletEditor/WalletEditor.d.ts +5 -0
  42. package/es/plus/walletEditor/WalletEditor.js +316 -0
  43. package/es/plus/walletEditor/WalletEditor.less +129 -0
  44. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  45. package/es/plus/walletEditor/components/ImageUpload/index.js +223 -0
  46. package/es/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  47. package/es/plus/walletEditor/components/JsonEditor/index.js +68 -0
  48. package/es/plus/walletEditor/components/JsonEditor/index.less +4 -0
  49. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  50. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.js +222 -0
  51. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  52. package/es/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  53. package/es/plus/walletEditor/components/relationProduct/index.js +49 -0
  54. package/es/plus/walletEditor/components/relationProduct/index.less +15 -0
  55. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  56. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.js +193 -0
  57. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  58. package/es/plus/walletEditor/index.d.ts +3 -0
  59. package/es/plus/walletEditor/index.js +3 -0
  60. package/es/plus/walletEditor/locales.d.ts +126 -0
  61. package/es/plus/walletEditor/locales.js +143 -0
  62. package/es/plus/walletEditor/types.d.ts +52 -0
  63. package/es/plus/walletEditor/types.js +1 -0
  64. package/es/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  65. package/es/plus/walletPassGallery/components/footerButton/index.js +247 -0
  66. package/es/plus/walletPassGallery/components/footerButton/index.less +93 -0
  67. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  68. package/es/plus/walletPassGallery/components/passDetail/index.js +274 -0
  69. package/es/plus/walletPassGallery/components/passDetail/index.less +57 -0
  70. package/es/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  71. package/es/plus/walletPassGallery/components/passList/index.js +115 -0
  72. package/es/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  73. package/es/plus/walletPassGallery/components/recharge/index.js +134 -0
  74. package/es/plus/walletPassGallery/components/recharge/index.less +16 -0
  75. package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  76. package/es/plus/walletPassGallery/components/timelineSection/index.js +176 -0
  77. package/es/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  78. package/es/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  79. package/es/plus/walletPassGallery/components/usageRule/index.js +248 -0
  80. package/es/plus/walletPassGallery/components/usageRule/index.less +157 -0
  81. package/es/plus/walletPassGallery/index.d.ts +6 -0
  82. package/es/plus/walletPassGallery/index.js +602 -0
  83. package/es/plus/walletPassGallery/index.less +115 -0
  84. package/es/plus/walletPassGallery/locales.d.ts +270 -0
  85. package/es/plus/walletPassGallery/locales.js +279 -0
  86. package/es/plus/walletPassGallery/serve.d.ts +218 -0
  87. package/es/plus/walletPassGallery/serve.js +289 -0
  88. package/es/pro/Login2.0/AuthModal.js +14 -8
  89. package/es/pro/Login2.0/Login2.js +52 -28
  90. package/es/pro/Login2.0/Register2.js +1 -1
  91. package/es/pro/Login2.0/components/phoneValidation.js +1 -1
  92. package/es/pro/Login2.0/index.less +11 -2
  93. package/es/pro/Login2.0/locales.js +112 -112
  94. package/lib/components/booking/addons/model.d.ts +1 -10
  95. package/lib/components/booking/forms/model.d.ts +1 -10
  96. package/lib/components/booking/info/model.d.ts +1 -10
  97. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  98. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  99. package/lib/components/booking/model.d.ts +1 -9
  100. package/lib/components/booking/notes/model.d.ts +1 -10
  101. package/lib/components/booking/payments/model.d.ts +1 -10
  102. package/lib/components/index.d.ts +1 -2
  103. package/lib/components/index.js +0 -3
  104. package/lib/components/pay/toC/model.d.ts +1 -9
  105. package/lib/components/schedules/model.d.ts +1 -9
  106. package/lib/components/wallet/Detail/model.d.ts +1 -13
  107. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  108. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  109. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  110. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  111. package/lib/components/wallet/model.d.ts +1 -9
  112. package/lib/components/walletList/index.d.ts +0 -25
  113. package/lib/components/walletList/index.js +90 -51
  114. package/lib/components/walletList/serve.d.ts +4 -0
  115. package/lib/components/walletList/serve.js +12 -0
  116. package/lib/components/walletList/types/index.d.ts +12 -12
  117. package/lib/index.d.ts +2 -1
  118. package/lib/index.js +6 -3
  119. package/lib/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  120. package/lib/plus/productSelect/CategoryTabs/index.js +84 -69
  121. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  122. package/lib/plus/productSelect/utils.js +0 -1
  123. package/lib/plus/walletEditor/WalletEditor.d.ts +5 -0
  124. package/lib/plus/walletEditor/WalletEditor.js +354 -0
  125. package/lib/plus/walletEditor/WalletEditor.less +129 -0
  126. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  127. package/lib/plus/walletEditor/components/ImageUpload/index.js +201 -0
  128. package/lib/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  129. package/lib/plus/walletEditor/components/JsonEditor/index.js +89 -0
  130. package/lib/plus/walletEditor/components/JsonEditor/index.less +4 -0
  131. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  132. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.js +176 -0
  133. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  134. package/lib/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  135. package/lib/plus/walletEditor/components/relationProduct/index.js +73 -0
  136. package/lib/plus/walletEditor/components/relationProduct/index.less +15 -0
  137. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  138. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.js +211 -0
  139. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  140. package/lib/plus/walletEditor/index.d.ts +3 -0
  141. package/lib/plus/walletEditor/index.js +42 -0
  142. package/lib/plus/walletEditor/locales.d.ts +126 -0
  143. package/lib/plus/walletEditor/locales.js +167 -0
  144. package/lib/plus/walletEditor/types.d.ts +52 -0
  145. package/lib/plus/walletEditor/types.js +17 -0
  146. package/lib/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  147. package/lib/plus/walletPassGallery/components/footerButton/index.js +187 -0
  148. package/lib/plus/walletPassGallery/components/footerButton/index.less +93 -0
  149. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  150. package/lib/plus/walletPassGallery/components/passDetail/index.js +287 -0
  151. package/lib/plus/walletPassGallery/components/passDetail/index.less +57 -0
  152. package/lib/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  153. package/lib/plus/walletPassGallery/components/passList/index.js +136 -0
  154. package/lib/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  155. package/lib/plus/walletPassGallery/components/recharge/index.js +146 -0
  156. package/lib/plus/walletPassGallery/components/recharge/index.less +16 -0
  157. package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  158. package/lib/plus/walletPassGallery/components/timelineSection/index.js +212 -0
  159. package/lib/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  160. package/lib/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  161. package/lib/plus/walletPassGallery/components/usageRule/index.js +209 -0
  162. package/lib/plus/walletPassGallery/components/usageRule/index.less +157 -0
  163. package/lib/plus/walletPassGallery/index.d.ts +6 -0
  164. package/lib/plus/walletPassGallery/index.js +498 -0
  165. package/lib/plus/walletPassGallery/index.less +115 -0
  166. package/lib/plus/walletPassGallery/locales.d.ts +270 -0
  167. package/lib/plus/walletPassGallery/locales.js +299 -0
  168. package/lib/plus/walletPassGallery/serve.d.ts +218 -0
  169. package/lib/plus/walletPassGallery/serve.js +98 -0
  170. package/lib/pro/Login2.0/AuthModal.js +16 -11
  171. package/lib/pro/Login2.0/Login2.js +14 -4
  172. package/lib/pro/Login2.0/Register2.js +1 -1
  173. package/lib/pro/Login2.0/components/phoneValidation.js +1 -1
  174. package/lib/pro/Login2.0/index.less +11 -2
  175. package/lib/pro/Login2.0/locales.js +112 -112
  176. package/lowcode/sortable-wallet-pass-types/meta.ts +267 -0
  177. package/lowcode/wallet-editor/meta.ts +57 -0
  178. package/lowcode/wallet-editor/snippets.ts +13 -0
  179. package/lowcode/wallet-pass-gallery/meta.ts +35 -0
  180. package/package.json +4 -4
  181. package/lowcode/wallet/meta.ts +0 -79
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface ImageUploadProps {
3
+ value?: string;
4
+ onChange?: (val: string) => void;
5
+ }
6
+ export declare const getBaseTime: (size: number) => 1000 | 2000 | 4000 | 8000;
7
+ declare const ImageUpload: React.FC<ImageUploadProps>;
8
+ export default ImageUpload;
@@ -0,0 +1,201 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/walletEditor/components/ImageUpload/index.tsx
30
+ var ImageUpload_exports = {};
31
+ __export(ImageUpload_exports, {
32
+ default: () => ImageUpload_default,
33
+ getBaseTime: () => getBaseTime
34
+ });
35
+ module.exports = __toCommonJS(ImageUpload_exports);
36
+ var import_react = __toESM(require("react"));
37
+ var import_antd = require("antd");
38
+ var import_icons = require("@ant-design/icons");
39
+ var import_materials = require("@pisell/materials");
40
+ var import_utils = require("@pisell/utils");
41
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
42
+ var import_shopUploadServe = require("@pisell/materials/src/components/dataSourceComponents/fields/Upload/shopUploadServe");
43
+ var import_utils2 = require("@pisell/materials/src/components/table/utils");
44
+ var getBaseTime = (size) => {
45
+ const KB = 1024;
46
+ const MB = KB * 1024;
47
+ if (size < MB) return 1e3;
48
+ if (size < 5 * MB) return 2e3;
49
+ if (size < 20 * MB) return 4e3;
50
+ return 8e3;
51
+ };
52
+ var ImageUpload = ({ value, onChange }) => {
53
+ var _a, _b;
54
+ const context = (0, import_useEngineContext.default)();
55
+ import_utils2.request.setRequest((_b = (_a = context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.request);
56
+ const [uploading, setUploading] = (0, import_react.useState)(false);
57
+ const [fileList, setFileList] = (0, import_react.useState)([]);
58
+ const [previewImage, setPreviewImage] = (0, import_react.useState)("");
59
+ const [previewOpen, setPreviewOpen] = (0, import_react.useState)(false);
60
+ (0, import_react.useEffect)(() => {
61
+ if (value) {
62
+ setFileList([
63
+ {
64
+ uid: "image-0",
65
+ name: "image",
66
+ status: "done",
67
+ url: value
68
+ }
69
+ ]);
70
+ } else {
71
+ setFileList([]);
72
+ }
73
+ }, [value]);
74
+ const beforeUpload = async (file) => {
75
+ if (!file.type.startsWith("image/")) {
76
+ return import_antd.Upload.LIST_IGNORE;
77
+ }
78
+ return file;
79
+ };
80
+ const handleUpload = (options) => {
81
+ const { onSuccess, onError, onProgress, file } = options;
82
+ const fileSize = file.size;
83
+ const baseTime = getBaseTime(fileSize);
84
+ let progress = 0;
85
+ setTimeout(() => {
86
+ onProgress == null ? void 0 : onProgress({ percent: 1 });
87
+ }, 200);
88
+ const timer = setInterval(() => {
89
+ if (progress < 30) {
90
+ progress += 5;
91
+ } else if (progress < 60) {
92
+ progress += 3;
93
+ } else if (progress < 80) {
94
+ progress += 2;
95
+ } else if (progress < 90) {
96
+ progress += 0.5;
97
+ }
98
+ if (progress >= 90) {
99
+ clearInterval(timer);
100
+ }
101
+ onProgress == null ? void 0 : onProgress({ percent: Math.min(90, progress) });
102
+ }, baseTime / 30);
103
+ (0, import_shopUploadServe.uploadFile)(file).then((res) => {
104
+ clearInterval(timer);
105
+ onProgress == null ? void 0 : onProgress({ percent: 95 });
106
+ setTimeout(() => {
107
+ onProgress == null ? void 0 : onProgress({ percent: 100 });
108
+ onSuccess == null ? void 0 : onSuccess(res);
109
+ }, 200);
110
+ }).catch((err) => {
111
+ clearInterval(timer);
112
+ onError == null ? void 0 : onError(err);
113
+ });
114
+ };
115
+ const onRemove = () => {
116
+ setFileList([]);
117
+ onChange == null ? void 0 : onChange("");
118
+ setPreviewImage("");
119
+ setPreviewOpen(false);
120
+ };
121
+ const handlePreview = (file) => {
122
+ const url = file.url || file.thumbUrl || "";
123
+ if (!url) return;
124
+ setPreviewImage(url);
125
+ setPreviewOpen(true);
126
+ };
127
+ const handleChange = (info) => {
128
+ var _a2, _b2, _c, _d;
129
+ const { file, fileList: newFileList } = info;
130
+ const updated = newFileList.map((item) => {
131
+ var _a3;
132
+ return {
133
+ ...item,
134
+ status: item.status === "done" && item.response && !((_a3 = item.response) == null ? void 0 : _a3.status) ? "error" : item.status
135
+ };
136
+ });
137
+ setFileList(updated);
138
+ if (file.status === "uploading") {
139
+ setUploading(true);
140
+ }
141
+ if (file.status === "done" && (((_a2 = file.response) == null ? void 0 : _a2.status) ?? true)) {
142
+ setUploading(false);
143
+ const url = ((_c = (_b2 = file.response) == null ? void 0 : _b2.data) == null ? void 0 : _c.url) || file.url || "";
144
+ onChange == null ? void 0 : onChange(url);
145
+ }
146
+ if (file.status === "error" || file.response && ((_d = file.response) == null ? void 0 : _d.status) === false) {
147
+ setUploading(false);
148
+ }
149
+ };
150
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
151
+ import_materials.PisellUpload,
152
+ {
153
+ uploadType: "custom",
154
+ listType: "picture-card",
155
+ multiple: false,
156
+ maxCount: 1,
157
+ accept: "image/*",
158
+ beforeUpload,
159
+ onChange: handleChange,
160
+ showUploadList: {
161
+ showRemoveIcon: true,
162
+ showPreviewIcon: true,
163
+ showDownloadIcon: false
164
+ },
165
+ fileList,
166
+ onRemove,
167
+ onPreview: handlePreview,
168
+ customRequest: handleUpload
169
+ },
170
+ fileList.length >= 1 || uploading ? null : /* @__PURE__ */ import_react.default.createElement(
171
+ "button",
172
+ {
173
+ style: {
174
+ color: "inherit",
175
+ cursor: "inherit",
176
+ border: 0,
177
+ background: "none"
178
+ },
179
+ type: "button"
180
+ },
181
+ /* @__PURE__ */ import_react.default.createElement(import_icons.PlusOutlined, null),
182
+ /* @__PURE__ */ import_react.default.createElement("div", { style: { marginTop: 8 } }, import_utils.locales.getText("upload"))
183
+ )
184
+ ), previewImage && /* @__PURE__ */ import_react.default.createElement(
185
+ import_antd.Image,
186
+ {
187
+ wrapperStyle: { display: "none" },
188
+ preview: {
189
+ visible: previewOpen,
190
+ onVisibleChange: (visible) => setPreviewOpen(visible),
191
+ afterOpenChange: (visible) => !visible && setPreviewImage("")
192
+ },
193
+ src: previewImage
194
+ }
195
+ ));
196
+ };
197
+ var ImageUpload_default = ImageUpload;
198
+ // Annotate the CommonJS export names for ESM import in node:
199
+ 0 && (module.exports = {
200
+ getBaseTime
201
+ });
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface JsonEditorProps {
3
+ value?: any;
4
+ onChange?: (value: any) => void;
5
+ disabled?: boolean;
6
+ placeholder?: string;
7
+ rows?: number;
8
+ style?: React.CSSProperties;
9
+ }
10
+ declare const JsonEditor: React.FC<JsonEditorProps>;
11
+ export default JsonEditor;
@@ -0,0 +1,89 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/walletEditor/components/JsonEditor/index.tsx
30
+ var JsonEditor_exports = {};
31
+ __export(JsonEditor_exports, {
32
+ default: () => JsonEditor_default
33
+ });
34
+ module.exports = __toCommonJS(JsonEditor_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var JsonEditor = ({
38
+ value,
39
+ onChange,
40
+ disabled = false,
41
+ rows = 4,
42
+ style
43
+ }) => {
44
+ const [textValue, setTextValue] = (0, import_react.useState)("");
45
+ const [hasError, setHasError] = (0, import_react.useState)(false);
46
+ (0, import_react.useEffect)(() => {
47
+ if (value !== void 0) {
48
+ try {
49
+ setTextValue(JSON.stringify(value, null, 2));
50
+ setHasError(false);
51
+ } catch {
52
+ setTextValue("");
53
+ setHasError(false);
54
+ }
55
+ } else {
56
+ setTextValue("");
57
+ setHasError(false);
58
+ }
59
+ }, [value]);
60
+ const handleTextChange = (e) => {
61
+ const newText = e.target.value;
62
+ setTextValue(newText);
63
+ if (!newText.trim()) {
64
+ setHasError(false);
65
+ onChange == null ? void 0 : onChange(void 0);
66
+ return;
67
+ }
68
+ try {
69
+ const parsedValue = JSON.parse(newText);
70
+ setHasError(false);
71
+ onChange == null ? void 0 : onChange(parsedValue);
72
+ } catch {
73
+ setHasError(true);
74
+ }
75
+ };
76
+ return /* @__PURE__ */ import_react.default.createElement(
77
+ import_antd.Input.TextArea,
78
+ {
79
+ style,
80
+ value: textValue,
81
+ onChange: handleTextChange,
82
+ rows,
83
+ disabled,
84
+ status: hasError ? "error" : void 0,
85
+ allowClear: true
86
+ }
87
+ );
88
+ };
89
+ var JsonEditor_default = JsonEditor;
@@ -0,0 +1,4 @@
1
+ // JsonEditor组件样式
2
+ .json-editor {
3
+ // 可以在这里添加特定的样式
4
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export declare type ValidityPeriodValue = {
3
+ type: 'normal';
4
+ unit: string;
5
+ unit_type: 'day' | 'month' | 'year';
6
+ } | {
7
+ type: 'custom';
8
+ custom_date?: string;
9
+ } | {
10
+ type: 'forever';
11
+ };
12
+ export interface ValidityPeriodSelectorProps {
13
+ value?: ValidityPeriodValue;
14
+ onChange?: (value: ValidityPeriodValue) => void;
15
+ disabled?: boolean;
16
+ placeholder?: string;
17
+ options?: readonly ValidityPeriodValue[];
18
+ }
19
+ declare const ValidityPeriodSelector: React.FC<ValidityPeriodSelectorProps>;
20
+ export default ValidityPeriodSelector;
@@ -0,0 +1,176 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/walletEditor/components/ValidityPeriodSelector/index.tsx
30
+ var ValidityPeriodSelector_exports = {};
31
+ __export(ValidityPeriodSelector_exports, {
32
+ default: () => ValidityPeriodSelector_default
33
+ });
34
+ module.exports = __toCommonJS(ValidityPeriodSelector_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_dayjs = __toESM(require("dayjs"));
38
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
39
+ var import_locales = __toESM(require("../../locales"));
40
+ var import_utils = require("@pisell/utils");
41
+ var { Option } = import_antd.Select;
42
+ var DEFAULT_VALIDITY_OPTIONS = [
43
+ { unit: "1", unit_type: "day", type: "normal" },
44
+ { unit: "14", unit_type: "day", type: "normal" },
45
+ { unit: "1", unit_type: "month", type: "normal" },
46
+ { unit: "2", unit_type: "month", type: "normal" },
47
+ { unit: "3", unit_type: "month", type: "normal" },
48
+ { unit: "4", unit_type: "month", type: "normal" },
49
+ { unit: "5", unit_type: "month", type: "normal" },
50
+ { unit: "6", unit_type: "month", type: "normal" },
51
+ { unit: "1", unit_type: "year", type: "normal" },
52
+ { unit: "3", unit_type: "year", type: "normal" },
53
+ { type: "forever" },
54
+ { custom_date: "", type: "custom" }
55
+ ];
56
+ var getOptionLabel = (option) => {
57
+ if (option.type === "forever") {
58
+ return import_utils.locales.getText("forever");
59
+ }
60
+ if (option.type === "custom") {
61
+ return import_utils.locales.getText("custom");
62
+ }
63
+ const unitMap = {
64
+ day: import_utils.locales.getText("day"),
65
+ month: import_utils.locales.getText("month"),
66
+ year: import_utils.locales.getText("year"),
67
+ days: import_utils.locales.getText("days"),
68
+ months: import_utils.locales.getText("months"),
69
+ years: import_utils.locales.getText("years")
70
+ };
71
+ const { unit, unit_type } = option;
72
+ if (Number(unit) > 1) {
73
+ return `${unit} ${unitMap[unit_type + "s"]}`;
74
+ }
75
+ return `${unit} ${unitMap[unit_type]}`;
76
+ };
77
+ var transformValueToString = (option) => {
78
+ if (option.type === "forever") {
79
+ return "forever";
80
+ }
81
+ if (option.type === "custom") {
82
+ return "custom";
83
+ }
84
+ return `${option.unit}${option.unit_type}`;
85
+ };
86
+ var transformStringToValue = (stringValue) => {
87
+ if (stringValue === "forever") {
88
+ return { type: "forever" };
89
+ }
90
+ if (stringValue === "custom") {
91
+ return { type: "custom", custom_date: "" };
92
+ }
93
+ const match = stringValue.match(/^(\d+)(day|month|year)$/);
94
+ if (match) {
95
+ const [, unit, unit_type] = match;
96
+ return {
97
+ type: "normal",
98
+ unit,
99
+ unit_type
100
+ };
101
+ }
102
+ return { type: "normal", unit: "1", unit_type: "day" };
103
+ };
104
+ var ValidityPeriodSelector = ({
105
+ value,
106
+ onChange,
107
+ disabled = false,
108
+ placeholder,
109
+ options = DEFAULT_VALIDITY_OPTIONS
110
+ }) => {
111
+ var _a, _b;
112
+ const context = (0, import_useEngineContext.default)();
113
+ import_utils.locales.init(
114
+ import_locales.default,
115
+ ((_b = (_a = context.appHelper.utils) == null ? void 0 : _a.storage) == null ? void 0 : _b.get("umi_locale")) || "en"
116
+ );
117
+ const defaultPlaceholder = placeholder || import_utils.locales.getText("selectValidityPeriod");
118
+ const [showCustomDate, setShowCustomDate] = (0, import_react.useState)(false);
119
+ const [currentValue, setCurrentValue] = (0, import_react.useState)(value);
120
+ const validityOptions = (0, import_react.useMemo)(() => {
121
+ return options.map((option) => ({
122
+ label: getOptionLabel(option),
123
+ value: transformValueToString(option)
124
+ }));
125
+ }, [options]);
126
+ (0, import_react.useEffect)(() => {
127
+ setCurrentValue(value);
128
+ setShowCustomDate((value == null ? void 0 : value.type) === "custom");
129
+ }, [value]);
130
+ const handleSelectChange = (selectedValue) => {
131
+ const parsedValue = transformStringToValue(selectedValue);
132
+ setCurrentValue(parsedValue);
133
+ setShowCustomDate(parsedValue.type === "custom");
134
+ if (parsedValue.type !== "custom") {
135
+ onChange == null ? void 0 : onChange(parsedValue);
136
+ }
137
+ };
138
+ const handleDateChange = (date, dateString) => {
139
+ if (date && (currentValue == null ? void 0 : currentValue.type) === "custom") {
140
+ const newValue = {
141
+ type: "custom",
142
+ custom_date: date.format("YYYY-MM-DD")
143
+ };
144
+ setCurrentValue(newValue);
145
+ onChange == null ? void 0 : onChange(newValue);
146
+ }
147
+ };
148
+ const getSelectValue = () => {
149
+ if (!currentValue) return void 0;
150
+ return transformValueToString(currentValue);
151
+ };
152
+ const renderOptions = () => {
153
+ return validityOptions.map((option) => /* @__PURE__ */ import_react.default.createElement(Option, { key: option.label, value: option.value }, option.label));
154
+ };
155
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
156
+ import_antd.Select,
157
+ {
158
+ placeholder: defaultPlaceholder,
159
+ onChange: handleSelectChange,
160
+ value: getSelectValue(),
161
+ disabled,
162
+ style: { width: "100%" }
163
+ },
164
+ renderOptions()
165
+ ), showCustomDate && /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: import_utils.locales.getText("custom"), style: { marginBottom: 0 } }, /* @__PURE__ */ import_react.default.createElement(
166
+ import_antd.DatePicker,
167
+ {
168
+ placeholder: import_utils.locales.getText("selectCustomDate"),
169
+ onChange: handleDateChange,
170
+ value: (currentValue == null ? void 0 : currentValue.type) === "custom" && currentValue.custom_date ? (0, import_dayjs.default)(currentValue.custom_date) : void 0,
171
+ disabled,
172
+ style: { width: "100%" }
173
+ }
174
+ )));
175
+ };
176
+ var ValidityPeriodSelector_default = ValidityPeriodSelector;
@@ -0,0 +1,4 @@
1
+ // ValidityPeriodSelector组件样式
2
+ .validity-period-selector {
3
+ // 可以在这里添加特定的样式
4
+ }
@@ -0,0 +1,6 @@
1
+ import './index.less';
2
+ declare const RelationProduct: ({ value, onChange, }: {
3
+ value?: string[] | undefined;
4
+ onChange?: ((val: string[]) => void) | undefined;
5
+ }) => JSX.Element | null;
6
+ export default RelationProduct;
@@ -0,0 +1,73 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/plus/walletEditor/components/relationProduct/index.tsx
30
+ var relationProduct_exports = {};
31
+ __export(relationProduct_exports, {
32
+ default: () => relationProduct_default
33
+ });
34
+ module.exports = __toCommonJS(relationProduct_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_useComponents = __toESM(require("../../../../hooks/useComponents"));
39
+ var import_index = require("./index.less");
40
+ var RelationProduct = ({
41
+ value,
42
+ onChange
43
+ }) => {
44
+ const linkerRef = (0, import_react.useRef)(null);
45
+ const [RelationProduct2] = (0, import_useComponents.default)({
46
+ components: ["RelationProduct"]
47
+ });
48
+ if (!(RelationProduct2 == null ? void 0 : RelationProduct2.PassLinker)) return null;
49
+ const onShow = () => {
50
+ var _a, _b;
51
+ if (linkerRef.current) {
52
+ (_b = (_a = linkerRef.current).openModal) == null ? void 0 : _b.call(_a);
53
+ }
54
+ };
55
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "product-detail-card-module" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "linked-passes-empty-state" }, /* @__PURE__ */ import_react.default.createElement("p", { className: "linked-passes-description" }, import_utils.locales.getText("linkedPassesDesc")), /* @__PURE__ */ import_react.default.createElement(
56
+ import_antd.Button,
57
+ {
58
+ type: "primary",
59
+ size: "large",
60
+ onClick: onShow,
61
+ className: "select-passes-button"
62
+ },
63
+ import_utils.locales.getText("selectPasses")
64
+ ), value && value.length > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { style: { padding: 8 } }) : null, /* @__PURE__ */ import_react.default.createElement(
65
+ RelationProduct2.PassLinker,
66
+ {
67
+ ref: linkerRef,
68
+ value,
69
+ onChange
70
+ }
71
+ )));
72
+ };
73
+ var relationProduct_default = RelationProduct;
@@ -0,0 +1,15 @@
1
+ .linked-passes-empty-state {
2
+ .linked-passes-description {
3
+ font-size: 16px;
4
+ color: #6b7280;
5
+ margin: 0 0 16px 0;
6
+ line-height: 1.5;
7
+ }
8
+
9
+ .select-passes-button {
10
+ min-width: 200px;
11
+ height: 40px;
12
+ border-radius: 8px;
13
+ font-weight: 500;
14
+ }
15
+ }
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export declare type WalletPassType = 'rechargeable' | 'point' | 'voucher' | 'discount';
4
+ export interface MultiLanguageTitle {
5
+ original?: string;
6
+ en?: string;
7
+ 'zh-CN'?: string;
8
+ 'zh-HK'?: string;
9
+ }
10
+ export interface WalletPassItem {
11
+ /** 钱包通行证类型 */
12
+ type: WalletPassType;
13
+ /** 是否显示,1表示显示,0表示隐藏 */
14
+ display: 0 | 1;
15
+ /** 自定义标题,支持多语言 */
16
+ custom_title?: MultiLanguageTitle;
17
+ }
18
+ export interface SortableWalletPassTypesProps {
19
+ /** 当前值,包含各种钱包通行证类型的配置 */
20
+ value?: WalletPassItem[];
21
+ /** 值变化时的回调函数 */
22
+ onChange?: (value: WalletPassItem[]) => void;
23
+ /** 是否禁用编辑 */
24
+ disabled?: boolean;
25
+ /** 组件类名 */
26
+ className?: string;
27
+ /** 组件样式 */
28
+ style?: React.CSSProperties;
29
+ }
30
+ /** 默认的钱包通行证类型配置 */
31
+ export interface WalletPassTypeInfo {
32
+ type: WalletPassType;
33
+ custom_title: MultiLanguageTitle;
34
+ }
35
+ export declare const DEFAULT_WALLET_PASS_TYPES_CONFIG: WalletPassTypeInfo[];
36
+ declare const SortableWalletPassTypes: React.FC<SortableWalletPassTypesProps>;
37
+ export default SortableWalletPassTypes;