@pisell/private-materials 6.3.33 → 6.3.35

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 (175) 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 +8 -8
  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 +10 -1
  12. package/es/components/booking/components/customSelect/index.js +18 -3
  13. package/es/components/booking/forms/model.d.ts +10 -1
  14. package/es/components/booking/info/model.d.ts +10 -1
  15. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  16. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  17. package/es/components/booking/model.d.ts +9 -1
  18. package/es/components/booking/notes/model.d.ts +10 -1
  19. package/es/components/booking/payments/model.d.ts +10 -1
  20. package/es/components/index.d.ts +1 -2
  21. package/es/components/index.js +1 -2
  22. package/es/components/pay/toC/model.d.ts +9 -1
  23. package/es/components/schedules/model.d.ts +9 -1
  24. package/es/components/wallet/Detail/model.d.ts +13 -1
  25. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  26. package/es/components/wallet/PointCard/model.d.ts +13 -1
  27. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  28. package/es/components/wallet/Voucher/model.d.ts +13 -1
  29. package/es/components/wallet/model.d.ts +9 -1
  30. package/es/components/walletList/index.d.ts +0 -25
  31. package/es/components/walletList/index.js +98 -66
  32. package/es/components/walletList/serve.d.ts +4 -0
  33. package/es/components/walletList/serve.js +46 -13
  34. package/es/components/walletList/types/index.d.ts +12 -12
  35. package/es/components/walletList/types/index.js +2 -2
  36. package/es/index.d.ts +2 -1
  37. package/es/index.js +2 -1
  38. package/es/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  39. package/es/plus/productSelect/CategoryTabs/index.js +6 -3
  40. package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  41. package/es/plus/productSelect/utils.js +0 -1
  42. package/es/plus/walletEditor/WalletEditor.d.ts +5 -0
  43. package/es/plus/walletEditor/WalletEditor.js +316 -0
  44. package/es/plus/walletEditor/WalletEditor.less +129 -0
  45. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  46. package/es/plus/walletEditor/components/ImageUpload/index.js +223 -0
  47. package/es/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  48. package/es/plus/walletEditor/components/JsonEditor/index.js +68 -0
  49. package/es/plus/walletEditor/components/JsonEditor/index.less +4 -0
  50. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  51. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.js +222 -0
  52. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  53. package/es/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  54. package/es/plus/walletEditor/components/relationProduct/index.js +49 -0
  55. package/es/plus/walletEditor/components/relationProduct/index.less +15 -0
  56. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  57. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.js +193 -0
  58. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  59. package/es/plus/walletEditor/index.d.ts +3 -0
  60. package/es/plus/walletEditor/index.js +3 -0
  61. package/es/plus/walletEditor/locales.d.ts +126 -0
  62. package/es/plus/walletEditor/locales.js +143 -0
  63. package/es/plus/walletEditor/types.d.ts +52 -0
  64. package/es/plus/walletEditor/types.js +1 -0
  65. package/es/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  66. package/es/plus/walletPassGallery/components/footerButton/index.js +247 -0
  67. package/es/plus/walletPassGallery/components/footerButton/index.less +93 -0
  68. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  69. package/es/plus/walletPassGallery/components/passDetail/index.js +274 -0
  70. package/es/plus/walletPassGallery/components/passDetail/index.less +57 -0
  71. package/es/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  72. package/es/plus/walletPassGallery/components/passList/index.js +115 -0
  73. package/es/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  74. package/es/plus/walletPassGallery/components/recharge/index.js +134 -0
  75. package/es/plus/walletPassGallery/components/recharge/index.less +16 -0
  76. package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  77. package/es/plus/walletPassGallery/components/timelineSection/index.js +176 -0
  78. package/es/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  79. package/es/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  80. package/es/plus/walletPassGallery/components/usageRule/index.js +248 -0
  81. package/es/plus/walletPassGallery/components/usageRule/index.less +157 -0
  82. package/es/plus/walletPassGallery/index.d.ts +6 -0
  83. package/es/plus/walletPassGallery/index.js +602 -0
  84. package/es/plus/walletPassGallery/index.less +115 -0
  85. package/es/plus/walletPassGallery/locales.d.ts +270 -0
  86. package/es/plus/walletPassGallery/locales.js +279 -0
  87. package/es/plus/walletPassGallery/serve.d.ts +218 -0
  88. package/es/plus/walletPassGallery/serve.js +289 -0
  89. package/es/pro/Login2.0/Login2.js +8 -1
  90. package/es/pro/Login2.0/locales.js +93 -93
  91. package/lib/components/booking/addons/model.d.ts +10 -1
  92. package/lib/components/booking/components/customSelect/index.js +22 -3
  93. package/lib/components/booking/forms/model.d.ts +10 -1
  94. package/lib/components/booking/info/model.d.ts +10 -1
  95. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  96. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  97. package/lib/components/booking/model.d.ts +9 -1
  98. package/lib/components/booking/notes/model.d.ts +10 -1
  99. package/lib/components/booking/payments/model.d.ts +10 -1
  100. package/lib/components/index.d.ts +1 -2
  101. package/lib/components/index.js +0 -3
  102. package/lib/components/pay/toC/model.d.ts +9 -1
  103. package/lib/components/schedules/model.d.ts +9 -1
  104. package/lib/components/wallet/Detail/model.d.ts +13 -1
  105. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  106. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  107. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  108. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  109. package/lib/components/wallet/model.d.ts +9 -1
  110. package/lib/components/walletList/index.d.ts +0 -25
  111. package/lib/components/walletList/index.js +90 -51
  112. package/lib/components/walletList/serve.d.ts +4 -0
  113. package/lib/components/walletList/serve.js +12 -0
  114. package/lib/components/walletList/types/index.d.ts +12 -12
  115. package/lib/index.d.ts +2 -1
  116. package/lib/index.js +6 -3
  117. package/lib/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  118. package/lib/plus/productSelect/CategoryTabs/index.js +84 -69
  119. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  120. package/lib/plus/productSelect/utils.js +0 -1
  121. package/lib/plus/walletEditor/WalletEditor.d.ts +5 -0
  122. package/lib/plus/walletEditor/WalletEditor.js +354 -0
  123. package/lib/plus/walletEditor/WalletEditor.less +129 -0
  124. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  125. package/lib/plus/walletEditor/components/ImageUpload/index.js +201 -0
  126. package/lib/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  127. package/lib/plus/walletEditor/components/JsonEditor/index.js +89 -0
  128. package/lib/plus/walletEditor/components/JsonEditor/index.less +4 -0
  129. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  130. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.js +176 -0
  131. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  132. package/lib/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  133. package/lib/plus/walletEditor/components/relationProduct/index.js +73 -0
  134. package/lib/plus/walletEditor/components/relationProduct/index.less +15 -0
  135. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  136. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.js +211 -0
  137. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  138. package/lib/plus/walletEditor/index.d.ts +3 -0
  139. package/lib/plus/walletEditor/index.js +42 -0
  140. package/lib/plus/walletEditor/locales.d.ts +126 -0
  141. package/lib/plus/walletEditor/locales.js +167 -0
  142. package/lib/plus/walletEditor/types.d.ts +52 -0
  143. package/lib/plus/walletEditor/types.js +17 -0
  144. package/lib/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  145. package/lib/plus/walletPassGallery/components/footerButton/index.js +187 -0
  146. package/lib/plus/walletPassGallery/components/footerButton/index.less +93 -0
  147. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  148. package/lib/plus/walletPassGallery/components/passDetail/index.js +287 -0
  149. package/lib/plus/walletPassGallery/components/passDetail/index.less +57 -0
  150. package/lib/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  151. package/lib/plus/walletPassGallery/components/passList/index.js +136 -0
  152. package/lib/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  153. package/lib/plus/walletPassGallery/components/recharge/index.js +146 -0
  154. package/lib/plus/walletPassGallery/components/recharge/index.less +16 -0
  155. package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  156. package/lib/plus/walletPassGallery/components/timelineSection/index.js +212 -0
  157. package/lib/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  158. package/lib/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  159. package/lib/plus/walletPassGallery/components/usageRule/index.js +209 -0
  160. package/lib/plus/walletPassGallery/components/usageRule/index.less +157 -0
  161. package/lib/plus/walletPassGallery/index.d.ts +6 -0
  162. package/lib/plus/walletPassGallery/index.js +498 -0
  163. package/lib/plus/walletPassGallery/index.less +115 -0
  164. package/lib/plus/walletPassGallery/locales.d.ts +270 -0
  165. package/lib/plus/walletPassGallery/locales.js +299 -0
  166. package/lib/plus/walletPassGallery/serve.d.ts +218 -0
  167. package/lib/plus/walletPassGallery/serve.js +98 -0
  168. package/lib/pro/Login2.0/Login2.js +6 -0
  169. package/lib/pro/Login2.0/locales.js +93 -93
  170. package/lowcode/sortable-wallet-pass-types/meta.ts +267 -0
  171. package/lowcode/wallet-editor/meta.ts +57 -0
  172. package/lowcode/wallet-editor/snippets.ts +13 -0
  173. package/lowcode/wallet-pass-gallery/meta.ts +35 -0
  174. package/package.json +3 -3
  175. package/lowcode/wallet/meta.ts +0 -79
@@ -0,0 +1,187 @@
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/walletPassGallery/components/footerButton/index.tsx
30
+ var footerButton_exports = {};
31
+ __export(footerButton_exports, {
32
+ default: () => footerButton_default
33
+ });
34
+ module.exports = __toCommonJS(footerButton_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_materials = require("@pisell/materials");
38
+ var import_utils = require("@pisell/utils");
39
+ var import_index = require("./index.less");
40
+ var FooterButtons = ({
41
+ onRechargeClick,
42
+ platform = "h5",
43
+ appleWalletUrl,
44
+ googleWalletUrl
45
+ }) => {
46
+ if (platform === "pc") {
47
+ return null;
48
+ }
49
+ const [addWalletLoading, setAddWalletLoading] = (0, import_react.useState)(false);
50
+ const [wechatModalOpen, setWechatModalOpen] = (0, import_react.useState)(false);
51
+ const [copyUrl, setCopyUrl] = (0, import_react.useState)("");
52
+ const addWalletPass = async (url, type) => {
53
+ if (!url) {
54
+ (0, import_materials.PisellToast)({
55
+ content: import_utils.locales.getText("wallet-pass-gallery.urlEmpty") || "钱包链接为空",
56
+ duration: 2
57
+ });
58
+ return false;
59
+ }
60
+ if (isWechat()) {
61
+ setWechatModalOpen(true);
62
+ setCopyUrl(url);
63
+ return false;
64
+ }
65
+ setAddWalletLoading(true);
66
+ try {
67
+ if (type === "apple") {
68
+ const response = await fetch(url);
69
+ if (!response.ok) {
70
+ throw new Error(`HTTP error! status: ${response.status}`);
71
+ }
72
+ const passData = await response.arrayBuffer();
73
+ const blob = new Blob([passData], {
74
+ type: "application/vnd.apple.pkpass"
75
+ });
76
+ const downloadUrl = URL.createObjectURL(blob);
77
+ const a = document.createElement("a");
78
+ a.href = downloadUrl;
79
+ a.download = "pass.pkpass";
80
+ a.click();
81
+ URL.revokeObjectURL(downloadUrl);
82
+ } else {
83
+ window.open(url);
84
+ }
85
+ } catch (error) {
86
+ console.error("Failed to add wallet:", error);
87
+ (0, import_materials.PisellToast)({
88
+ content: import_utils.locales.getText("wallet-pass-gallery.error.addFailed"),
89
+ duration: 3
90
+ });
91
+ } finally {
92
+ setAddWalletLoading(false);
93
+ }
94
+ };
95
+ const onAppleClick = async () => {
96
+ await addWalletPass(appleWalletUrl || "", "apple");
97
+ };
98
+ const onGoogleClick = async () => {
99
+ await addWalletPass(googleWalletUrl || "", "google");
100
+ };
101
+ const isWechat = () => {
102
+ return /MicroMessenger/i.test(window.navigator.userAgent);
103
+ };
104
+ const httpCopyToClipboard = (text) => {
105
+ const textArea = document.createElement("textarea");
106
+ textArea.value = text;
107
+ textArea.style.position = "fixed";
108
+ textArea.style.top = "-10000px";
109
+ textArea.style.left = "-10000px";
110
+ document.body.appendChild(textArea);
111
+ textArea.focus();
112
+ textArea.select();
113
+ document.execCommand("copy");
114
+ document.body.removeChild(textArea);
115
+ };
116
+ const copyToClipboard = (text) => {
117
+ if (navigator.clipboard) {
118
+ return navigator.clipboard.writeText(text);
119
+ } else {
120
+ return httpCopyToClipboard(text);
121
+ }
122
+ };
123
+ const onCopyClick = () => {
124
+ copyToClipboard(copyUrl);
125
+ (0, import_materials.PisellToast)({
126
+ content: import_utils.locales.getText("wallet-pass-gallery.copySuccess"),
127
+ duration: 2
128
+ });
129
+ setWechatModalOpen(false);
130
+ };
131
+ const renderButtons = () => {
132
+ const buttons = [];
133
+ if (appleWalletUrl || googleWalletUrl) {
134
+ buttons.push(
135
+ /* @__PURE__ */ import_react.default.createElement(
136
+ import_antd.Button,
137
+ {
138
+ loading: addWalletLoading,
139
+ key: "add-wallet",
140
+ onClick: (0, import_utils.isIos)() ? onAppleClick : onGoogleClick,
141
+ size: "large",
142
+ className: "pisell-wallet-pass-gallery_footer-buttons-item pisell-wallet-pass-gallery_footer-buttons-item-secondary"
143
+ },
144
+ (0, import_utils.isIos)() ? import_utils.locales.getText("wallet-pass-gallery.button.addToAppleWallet") : import_utils.locales.getText("wallet-pass-gallery.button.addToGoogleWallet")
145
+ )
146
+ );
147
+ }
148
+ if (onRechargeClick) {
149
+ buttons.push(
150
+ /* @__PURE__ */ import_react.default.createElement(
151
+ import_antd.Button,
152
+ {
153
+ key: "recharge",
154
+ type: "primary",
155
+ onClick: onRechargeClick,
156
+ size: "large",
157
+ className: "pisell-wallet-pass-gallery_footer-buttons-item pisell-wallet-pass-gallery_footer-buttons-item-primary"
158
+ },
159
+ import_utils.locales.getText("wallet-pass-gallery.recharge")
160
+ )
161
+ );
162
+ }
163
+ const buttonCount = buttons.length;
164
+ const className = `pisell-wallet-pass-gallery_footer-buttons pisell-wallet-pass-gallery_footer-buttons-count-${buttonCount}`;
165
+ return buttons.length > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className }, buttons) : null;
166
+ };
167
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-pass-gallery_footer" }, renderButtons()), /* @__PURE__ */ import_react.default.createElement(
168
+ import_materials.PisellModal,
169
+ {
170
+ platform,
171
+ mobileModalHeight: "auto",
172
+ headerDivider: false,
173
+ closable: true,
174
+ maskClosable: true,
175
+ onCancel: () => {
176
+ setWechatModalOpen(false);
177
+ },
178
+ open: wechatModalOpen,
179
+ footer: [
180
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: onCopyClick, block: true, type: "primary", size: "large" }, import_utils.locales.getText("wallet-pass-gallery.copyButton"))
181
+ ]
182
+ },
183
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-pass-gallery_footer-copy-title" }, import_utils.locales.getText("wallet-pass-gallery.copyTitle")),
184
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-pass-gallery_footer-copy-text" }, import_utils.locales.getText("wallet-pass-gallery.copyText"))
185
+ ));
186
+ };
187
+ var footerButton_default = FooterButtons;
@@ -0,0 +1,93 @@
1
+ .pisell-wallet-pass-gallery_footer {
2
+ position: relative;
3
+ left: 0;
4
+ right: 0;
5
+ bottom: 0;
6
+ background-color: #fff;
7
+ padding: 24px;
8
+ z-index: 100;
9
+ border-top: 1px solid #d0d5de;
10
+ margin-left: -20px;
11
+ margin-right: -20px;
12
+ &-buttons {
13
+ display: flex;
14
+ gap: 12px;
15
+ width: 100%;
16
+
17
+
18
+ .pisell-wallet-pass-gallery_footer-buttons-item-secondary{
19
+ overflow: hidden;
20
+ display: flex;
21
+ >span{
22
+ display: block;
23
+ // width: 100%;
24
+ flex:1;
25
+ white-space: nowrap;
26
+ overflow: hidden;
27
+ text-overflow: ellipsis;
28
+ text-wrap: nowrap;
29
+ }
30
+ }
31
+
32
+
33
+ // 按钮数量样式
34
+ // 单个按钮占满宽度
35
+ &-count-1 {
36
+ .pisell-wallet-pass-gallery_footer-buttons-item {
37
+ flex: 1;
38
+ width: 100%;
39
+ }
40
+ }
41
+
42
+ // 两个按钮各占一半
43
+ &-count-2 {
44
+ .pisell-wallet-pass-gallery_footer-buttons-item {
45
+ flex: 1;
46
+ width: calc(50% - 6px);
47
+ }
48
+ }
49
+
50
+ // 三个按钮各占三分之一
51
+ &-count-3 {
52
+ .pisell-wallet-pass-gallery_footer-buttons-item {
53
+ flex: 1;
54
+ width: calc(33.33% - 8px);
55
+ }
56
+ }
57
+
58
+ // 四个按钮各占四分之一
59
+ &-count-4 {
60
+ .pisell-wallet-pass-gallery_footer-buttons-item {
61
+ flex: 1;
62
+ width: calc(25% - 9px);
63
+ }
64
+ }
65
+
66
+ // Ant Design按钮覆盖样式
67
+ :global(.ant-btn) {
68
+ height: 48px;
69
+ border-radius: 6px;
70
+ font-size: 16px;
71
+ font-weight: 500;
72
+ width: 100%;
73
+ }
74
+
75
+ &-item {
76
+ // 修饰符:主按钮
77
+ &-primary {
78
+ background-color: var(--theme-color, #7F56D9);
79
+ }
80
+
81
+ // 修饰符:次按钮
82
+ &-secondary {
83
+ background-color: #fff;
84
+ border-color: #d0d5de;
85
+ color: var(--Gray-700, #344054);
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+ .pisell-wallet-pass-gallery_footer:empty {
92
+ display: none;
93
+ }
@@ -0,0 +1,8 @@
1
+ import './index.less';
2
+ interface PassDetailProps {
3
+ dataSource?: any | null;
4
+ platform?: 'pc' | 'h5';
5
+ buttonGroupList?: any[][];
6
+ }
7
+ declare const PassDetail: (props: PassDetailProps) => JSX.Element | null;
8
+ export default PassDetail;
@@ -0,0 +1,287 @@
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/walletPassGallery/components/passDetail/index.tsx
30
+ var passDetail_exports = {};
31
+ __export(passDetail_exports, {
32
+ default: () => passDetail_default
33
+ });
34
+ module.exports = __toCommonJS(passDetail_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_ahooks = require("ahooks");
38
+ var import_classnames = __toESM(require("classnames"));
39
+ var import_utils = require("@pisell/utils");
40
+ var import_materials = require("@pisell/materials");
41
+ var import_utils2 = require("../../../productSelect/utils");
42
+ var import_CategoryTabs = __toESM(require("../../../productSelect/CategoryTabs"));
43
+ var import_IntersectionObserver = __toESM(require("../../../productSelect/components/IntersectionObserver"));
44
+ var import_serve = require("../../serve");
45
+ var import_usageRule = __toESM(require("../usageRule"));
46
+ var import_timelineSection = __toESM(require("../timelineSection"));
47
+ var import_recharge = __toESM(require("../recharge"));
48
+ var import_footerButton = __toESM(require("../footerButton"));
49
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
50
+ var import_index = require("./index.less");
51
+ var { Text } = import_antd.Typography;
52
+ var PassDetail = (props) => {
53
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
54
+ if (!props.dataSource) return null;
55
+ const { symbol = "$" } = (0, import_materials.usePisellConfig)();
56
+ const { dataSource, platform = "pc" } = props;
57
+ const [activeKey, setActiveKey] = (0, import_react.useState)("detail");
58
+ const [rechargeOpen, setRechargeOpen] = (0, import_react.useState)(false);
59
+ const containerRef = (0, import_react.useRef)(null);
60
+ const isIndicatorVisibleRef = (0, import_react.useRef)(false);
61
+ const context = (0, import_useEngineContext.default)();
62
+ const { store } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || { store: {} };
63
+ const timezone = ((_e = (_d = (_c = (_b = store == null ? void 0 : store.getState) == null ? void 0 : _b.call(store)) == null ? void 0 : _c.global) == null ? void 0 : _d.symbol) == null ? void 0 : _e.shop.timezone) || "Asia/Shanghai";
64
+ const {
65
+ id = "",
66
+ code = "",
67
+ tag = "",
68
+ product_title = "",
69
+ encoded = "",
70
+ balance,
71
+ expire_date = "",
72
+ product = {}
73
+ } = dataSource || {};
74
+ const {
75
+ description = "",
76
+ extension_data = [],
77
+ customer_order_behavior_count = 0
78
+ } = product || {};
79
+ const _getDetail = (0, import_ahooks.useRequest)(() => (0, import_serve.getDetailApi)({ id }), {
80
+ ready: !!id,
81
+ refreshDeps: [id]
82
+ });
83
+ (0, import_react.useEffect)(() => {
84
+ if (tag === "product_discount_card") {
85
+ setActiveKey("detail");
86
+ }
87
+ if (containerRef.current) {
88
+ containerRef.current.scrollTop = 0;
89
+ }
90
+ }, [id, tag]);
91
+ const _anchorOptions = (0, import_react.useMemo)(() => {
92
+ const options = [
93
+ {
94
+ key: "detail",
95
+ label: import_utils.locales.getText("wallet-pass-gallery.detail")
96
+ }
97
+ ];
98
+ if (tag !== "product_discount_card") {
99
+ options.push({
100
+ key: "activityLog",
101
+ label: import_utils.locales.getText("wallet-pass-gallery.activelog")
102
+ });
103
+ }
104
+ return options;
105
+ }, [dataSource == null ? void 0 : dataSource.tag]);
106
+ const debounceIndicator = (0, import_react.useCallback)((delay) => {
107
+ isIndicatorVisibleRef.current = true;
108
+ const timeoutId = setTimeout(() => {
109
+ isIndicatorVisibleRef.current = false;
110
+ }, delay);
111
+ return () => clearTimeout(timeoutId);
112
+ }, []);
113
+ const descs = (0, import_react.useMemo)(() => {
114
+ var _a2;
115
+ let data = [
116
+ {
117
+ label: import_utils.locales.getText("wallet-pass-gallery.cardName"),
118
+ value: product_title
119
+ },
120
+ {
121
+ label: import_utils.locales.getText("wallet-pass-gallery.carNumber"),
122
+ value: encoded,
123
+ isLink: false
124
+ },
125
+ {
126
+ label: import_utils.locales.getText("wallet-pass-gallery.validDate"),
127
+ value: expire_date ? expire_date : import_utils.locales.getText("wallet-pass-gallery.expireDate")
128
+ }
129
+ ];
130
+ if (tag === "product_discount_card") {
131
+ const isFixedAmount = ((_a2 = dataSource.metadata) == null ? void 0 : _a2.discount_card_type) === "fixed_amount";
132
+ data.splice(2, 0, {
133
+ label: import_utils.locales.getText("wallet-pass-gallery.discount"),
134
+ value: balance ? isFixedAmount ? `${symbol}${Number(balance)}` : `${Number(balance)}%` : ""
135
+ });
136
+ } else if (tag === "point_card") {
137
+ data.splice(2, 0, {
138
+ label: import_utils.locales.getText("wallet-pass-gallery.points"),
139
+ value: balance ? `${Number(balance)}` : ""
140
+ });
141
+ } else if (tag === "good_pass") {
142
+ data.splice(2, 0, {
143
+ label: import_utils.locales.getText("wallet-pass-gallery.goodPass"),
144
+ value: balance ? `${Number(balance)}` : ""
145
+ });
146
+ } else {
147
+ data.splice(2, 0, {
148
+ label: import_utils.locales.getText("wallet-pass-gallery.balance"),
149
+ value: balance ? `${symbol}${Number(balance)}` : ""
150
+ });
151
+ }
152
+ return data;
153
+ }, [dataSource]);
154
+ const handleItemIntersectionIn = (0, import_react.useCallback)((_key) => {
155
+ if (!isIndicatorVisibleRef.current && _key) {
156
+ setActiveKey(_key);
157
+ }
158
+ }, []);
159
+ if (!dataSource) {
160
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, null);
161
+ }
162
+ const _switchCategory = (key) => {
163
+ setActiveKey(key);
164
+ debounceIndicator(300);
165
+ const categoryIndex = _anchorOptions.findIndex((item) => item.key === key);
166
+ const _scrollParent = containerRef.current;
167
+ if (!_scrollParent) return;
168
+ const target = document.querySelector(
169
+ `[data-anchor="${key}"]`
170
+ );
171
+ if (!target) return;
172
+ const detailWrapper = document.querySelector(
173
+ `.pisell-wallet-pass-gallery_detail-content`
174
+ );
175
+ const tabsWrapper = document.querySelector(
176
+ `.pisell-wallet-pass-gallery-tabs-wrapper`
177
+ );
178
+ const tabsHeight = (tabsWrapper == null ? void 0 : tabsWrapper.offsetHeight) || 0;
179
+ if (categoryIndex === 0) {
180
+ if (detailWrapper) {
181
+ const wrapperOffsetTop = (0, import_utils2.getOffsetTopRelativeToScrollContainer)(
182
+ detailWrapper,
183
+ _scrollParent
184
+ );
185
+ _scrollParent.scrollTop = wrapperOffsetTop;
186
+ }
187
+ return;
188
+ } else {
189
+ const listOffsetTop = (0, import_utils2.getOffsetTopRelativeToScrollContainer)(
190
+ target,
191
+ _scrollParent
192
+ );
193
+ _scrollParent.scrollTop = listOffsetTop - tabsHeight;
194
+ }
195
+ };
196
+ const renderTimeLine = () => {
197
+ if (tag === "product_discount_card") return null;
198
+ return /* @__PURE__ */ import_react.default.createElement(import_timelineSection.default, { code, tag, timezone });
199
+ };
200
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
201
+ "div",
202
+ {
203
+ className: (0, import_classnames.default)(
204
+ `pisell-wallet-pass-gallery_detail`,
205
+ `pisell-wallet-pass-gallery_detail-${platform}`
206
+ )
207
+ },
208
+ /* @__PURE__ */ import_react.default.createElement(
209
+ "div",
210
+ {
211
+ className: "pisell-wallet-pass-gallery_detail-content",
212
+ ref: containerRef
213
+ },
214
+ _anchorOptions.length > 1 && /* @__PURE__ */ import_react.default.createElement(
215
+ import_CategoryTabs.default,
216
+ {
217
+ key: id,
218
+ className: "pisell-wallet-pass-gallery-tabs-wrapper",
219
+ activeKey,
220
+ items: _anchorOptions,
221
+ onChange: _switchCategory,
222
+ loading: false,
223
+ style: { padding: 0 }
224
+ }
225
+ ),
226
+ /* @__PURE__ */ import_react.default.createElement(
227
+ import_IntersectionObserver.default,
228
+ {
229
+ rootMargin: "-70px 0px -270px 0px",
230
+ priorityMode: "top"
231
+ },
232
+ /* @__PURE__ */ import_react.default.createElement(
233
+ import_IntersectionObserver.IntersectionTrigger,
234
+ {
235
+ style: { height: "1px" },
236
+ onShow: () => handleItemIntersectionIn("detail")
237
+ },
238
+ /* @__PURE__ */ import_react.default.createElement("div", { "data-anchor": "detail" })
239
+ ),
240
+ /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(Text, { className: "pisell-wallet-pass-gallery_detail-title" }, import_utils.locales.getText("wallet-pass-gallery.details")), platform === "pc" && tag === "gift_card" && ((_f = dataSource == null ? void 0 : dataSource.machinecode_config) == null ? void 0 : _f.hide_recharge) === 0 && /* @__PURE__ */ import_react.default.createElement(
241
+ import_antd.Button,
242
+ {
243
+ type: "primary",
244
+ size: "large",
245
+ onClick: () => setRechargeOpen(true)
246
+ },
247
+ import_utils.locales.getText("wallet-pass-gallery.recharge")
248
+ ), /* @__PURE__ */ import_react.default.createElement(
249
+ import_materials.PisellStatisticList,
250
+ {
251
+ data: descs,
252
+ labelColor: "#667085",
253
+ valueColor: "#101828",
254
+ backgroundColors: ["#fff"],
255
+ isHasBorder: false
256
+ }
257
+ ), description && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-pass-gallery_detail-card-content-tip" }, /* @__PURE__ */ import_react.default.createElement("div", { dangerouslySetInnerHTML: { __html: description } })), /* @__PURE__ */ import_react.default.createElement(import_usageRule.default, { dataSource: _getDetail.data })),
258
+ /* @__PURE__ */ import_react.default.createElement(
259
+ import_IntersectionObserver.IntersectionTrigger,
260
+ {
261
+ style: { height: "1px" },
262
+ onShow: () => handleItemIntersectionIn("activityLog")
263
+ },
264
+ /* @__PURE__ */ import_react.default.createElement("div", { "data-anchor": "activityLog" })
265
+ ),
266
+ /* @__PURE__ */ import_react.default.createElement("div", null, renderTimeLine())
267
+ )
268
+ )
269
+ ), platform === "h5" && tag === "gift_card" ? /* @__PURE__ */ import_react.default.createElement(
270
+ import_footerButton.default,
271
+ {
272
+ appleWalletUrl: (_g = _getDetail.data) == null ? void 0 : _g.apple_wallet_url,
273
+ googleWalletUrl: (_h = _getDetail.data) == null ? void 0 : _h.google_wallet_url,
274
+ onRechargeClick: ((_i = dataSource == null ? void 0 : dataSource.machinecode_config) == null ? void 0 : _i.hide_recharge) === 0 ? () => setRechargeOpen(true) : void 0,
275
+ platform
276
+ }
277
+ ) : null, /* @__PURE__ */ import_react.default.createElement(
278
+ import_recharge.default,
279
+ {
280
+ platform,
281
+ detailData: _getDetail.data,
282
+ open: rechargeOpen,
283
+ onClose: () => setRechargeOpen(false)
284
+ }
285
+ ));
286
+ };
287
+ var passDetail_default = PassDetail;
@@ -0,0 +1,57 @@
1
+ .pisell-wallet-pass-gallery_detail {
2
+ background-color: white;
3
+ overflow: hidden;
4
+
5
+ &-pc {
6
+ height: 800px;
7
+ max-height: calc(100vh - 128px);
8
+ border: 1px solid #d0d5de;
9
+ padding: 20px;
10
+ z-index: 1;
11
+ border-radius: 12px;
12
+ }
13
+
14
+ &-h5 {
15
+ height: 100%;
16
+ overflow: hidden;
17
+ border: none;
18
+ padding: 20px 0px;
19
+ }
20
+
21
+ .pisell-wallet-pass-gallery_detail-content {
22
+ overflow-y: auto;
23
+ height: 100%;
24
+ &::-webkit-scrollbar {
25
+ width: 0 !important;
26
+ height: 0 !important;
27
+ background: transparent !important;
28
+ display: none !important;
29
+ }
30
+ }
31
+
32
+ .pisell-wallet-pass-gallery_detail-title {
33
+ color: #101828;
34
+ font-size: 20px;
35
+ font-weight: 600;
36
+ line-height: 30px;
37
+ margin: 10px 0;
38
+ display: block;
39
+ }
40
+
41
+ // 覆盖 tab 默认样式
42
+ .pisell-tabstruct-item[aria-selected='true'] {
43
+ background-color: var(--theme-color);
44
+ }
45
+
46
+ .pisell-tabstruct-selection {
47
+ background-color: var(--theme-color);
48
+ transition: none !important;
49
+ }
50
+
51
+ .pisell-wallet-pass-gallery_detail-card-content-tip {
52
+ color: #667085;
53
+ font-size: 14px;
54
+ line-height: 22px;
55
+ margin: 12px 0;
56
+ }
57
+ }
@@ -0,0 +1,11 @@
1
+ interface IPassListProps {
2
+ dataSource: any[];
3
+ value?: string | number;
4
+ onChange?: (newId: string | number) => void;
5
+ valuePropName?: string;
6
+ hasMore?: boolean;
7
+ onLoadMore?: () => void;
8
+ loading?: boolean;
9
+ }
10
+ declare const PassList: (props: IPassListProps) => JSX.Element;
11
+ export default PassList;