@pisell/private-materials 6.3.33 → 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 (141) 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/index.d.ts +1 -2
  12. package/es/components/index.js +1 -2
  13. package/es/components/walletList/index.d.ts +0 -25
  14. package/es/components/walletList/index.js +98 -66
  15. package/es/components/walletList/serve.d.ts +4 -0
  16. package/es/components/walletList/serve.js +46 -13
  17. package/es/components/walletList/types/index.d.ts +12 -12
  18. package/es/components/walletList/types/index.js +2 -2
  19. package/es/index.d.ts +2 -1
  20. package/es/index.js +2 -1
  21. package/es/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  22. package/es/plus/productSelect/CategoryTabs/index.js +6 -3
  23. package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  24. package/es/plus/productSelect/utils.js +0 -1
  25. package/es/plus/walletEditor/WalletEditor.d.ts +5 -0
  26. package/es/plus/walletEditor/WalletEditor.js +316 -0
  27. package/es/plus/walletEditor/WalletEditor.less +129 -0
  28. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  29. package/es/plus/walletEditor/components/ImageUpload/index.js +223 -0
  30. package/es/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  31. package/es/plus/walletEditor/components/JsonEditor/index.js +68 -0
  32. package/es/plus/walletEditor/components/JsonEditor/index.less +4 -0
  33. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  34. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.js +222 -0
  35. package/es/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  36. package/es/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  37. package/es/plus/walletEditor/components/relationProduct/index.js +49 -0
  38. package/es/plus/walletEditor/components/relationProduct/index.less +15 -0
  39. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  40. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.js +193 -0
  41. package/es/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  42. package/es/plus/walletEditor/index.d.ts +3 -0
  43. package/es/plus/walletEditor/index.js +3 -0
  44. package/es/plus/walletEditor/locales.d.ts +126 -0
  45. package/es/plus/walletEditor/locales.js +143 -0
  46. package/es/plus/walletEditor/types.d.ts +52 -0
  47. package/es/plus/walletEditor/types.js +1 -0
  48. package/es/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  49. package/es/plus/walletPassGallery/components/footerButton/index.js +247 -0
  50. package/es/plus/walletPassGallery/components/footerButton/index.less +93 -0
  51. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  52. package/es/plus/walletPassGallery/components/passDetail/index.js +274 -0
  53. package/es/plus/walletPassGallery/components/passDetail/index.less +57 -0
  54. package/es/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  55. package/es/plus/walletPassGallery/components/passList/index.js +115 -0
  56. package/es/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  57. package/es/plus/walletPassGallery/components/recharge/index.js +134 -0
  58. package/es/plus/walletPassGallery/components/recharge/index.less +16 -0
  59. package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  60. package/es/plus/walletPassGallery/components/timelineSection/index.js +176 -0
  61. package/es/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  62. package/es/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  63. package/es/plus/walletPassGallery/components/usageRule/index.js +248 -0
  64. package/es/plus/walletPassGallery/components/usageRule/index.less +157 -0
  65. package/es/plus/walletPassGallery/index.d.ts +6 -0
  66. package/es/plus/walletPassGallery/index.js +602 -0
  67. package/es/plus/walletPassGallery/index.less +115 -0
  68. package/es/plus/walletPassGallery/locales.d.ts +270 -0
  69. package/es/plus/walletPassGallery/locales.js +279 -0
  70. package/es/plus/walletPassGallery/serve.d.ts +218 -0
  71. package/es/plus/walletPassGallery/serve.js +289 -0
  72. package/es/pro/Login2.0/Login2.js +4 -0
  73. package/es/pro/Login2.0/locales.js +93 -93
  74. package/lib/components/index.d.ts +1 -2
  75. package/lib/components/index.js +0 -3
  76. package/lib/components/walletList/index.d.ts +0 -25
  77. package/lib/components/walletList/index.js +90 -51
  78. package/lib/components/walletList/serve.d.ts +4 -0
  79. package/lib/components/walletList/serve.js +12 -0
  80. package/lib/components/walletList/types/index.d.ts +12 -12
  81. package/lib/index.d.ts +2 -1
  82. package/lib/index.js +6 -3
  83. package/lib/plus/productSelect/CategoryTabs/index.d.ts +2 -0
  84. package/lib/plus/productSelect/CategoryTabs/index.js +84 -69
  85. package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
  86. package/lib/plus/productSelect/utils.js +0 -1
  87. package/lib/plus/walletEditor/WalletEditor.d.ts +5 -0
  88. package/lib/plus/walletEditor/WalletEditor.js +354 -0
  89. package/lib/plus/walletEditor/WalletEditor.less +129 -0
  90. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
  91. package/lib/plus/walletEditor/components/ImageUpload/index.js +201 -0
  92. package/lib/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
  93. package/lib/plus/walletEditor/components/JsonEditor/index.js +89 -0
  94. package/lib/plus/walletEditor/components/JsonEditor/index.less +4 -0
  95. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
  96. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.js +176 -0
  97. package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
  98. package/lib/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
  99. package/lib/plus/walletEditor/components/relationProduct/index.js +73 -0
  100. package/lib/plus/walletEditor/components/relationProduct/index.less +15 -0
  101. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
  102. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.js +211 -0
  103. package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
  104. package/lib/plus/walletEditor/index.d.ts +3 -0
  105. package/lib/plus/walletEditor/index.js +42 -0
  106. package/lib/plus/walletEditor/locales.d.ts +126 -0
  107. package/lib/plus/walletEditor/locales.js +167 -0
  108. package/lib/plus/walletEditor/types.d.ts +52 -0
  109. package/lib/plus/walletEditor/types.js +17 -0
  110. package/lib/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
  111. package/lib/plus/walletPassGallery/components/footerButton/index.js +187 -0
  112. package/lib/plus/walletPassGallery/components/footerButton/index.less +93 -0
  113. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
  114. package/lib/plus/walletPassGallery/components/passDetail/index.js +287 -0
  115. package/lib/plus/walletPassGallery/components/passDetail/index.less +57 -0
  116. package/lib/plus/walletPassGallery/components/passList/index.d.ts +11 -0
  117. package/lib/plus/walletPassGallery/components/passList/index.js +136 -0
  118. package/lib/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
  119. package/lib/plus/walletPassGallery/components/recharge/index.js +146 -0
  120. package/lib/plus/walletPassGallery/components/recharge/index.less +16 -0
  121. package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
  122. package/lib/plus/walletPassGallery/components/timelineSection/index.js +212 -0
  123. package/lib/plus/walletPassGallery/components/timelineSection/index.less +67 -0
  124. package/lib/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
  125. package/lib/plus/walletPassGallery/components/usageRule/index.js +209 -0
  126. package/lib/plus/walletPassGallery/components/usageRule/index.less +157 -0
  127. package/lib/plus/walletPassGallery/index.d.ts +6 -0
  128. package/lib/plus/walletPassGallery/index.js +498 -0
  129. package/lib/plus/walletPassGallery/index.less +115 -0
  130. package/lib/plus/walletPassGallery/locales.d.ts +270 -0
  131. package/lib/plus/walletPassGallery/locales.js +299 -0
  132. package/lib/plus/walletPassGallery/serve.d.ts +218 -0
  133. package/lib/plus/walletPassGallery/serve.js +98 -0
  134. package/lib/pro/Login2.0/Login2.js +3 -0
  135. package/lib/pro/Login2.0/locales.js +93 -93
  136. package/lowcode/sortable-wallet-pass-types/meta.ts +267 -0
  137. package/lowcode/wallet-editor/meta.ts +57 -0
  138. package/lowcode/wallet-editor/snippets.ts +13 -0
  139. package/lowcode/wallet-pass-gallery/meta.ts +35 -0
  140. package/package.json +4 -4
  141. package/lowcode/wallet/meta.ts +0 -79
package/lib/index.d.ts CHANGED
@@ -22,7 +22,6 @@ export { default as TaxSelect } from './components/taxSelect';
22
22
  export { default as EftposPay } from './components/eftposPay';
23
23
  export { default as ToCPay } from './components/pay/toC';
24
24
  export { default as Eftpos } from './components/eftpos';
25
- export { default as Wallet } from './components/wallet';
26
25
  export { default as WalletList } from './components/walletList';
27
26
  export { default as BookingDashboard } from './components/booking/dashboard';
28
27
  export { default as PisellSelectCustomerModal } from './components/pisellSelectCustomerModal';
@@ -48,6 +47,8 @@ export { default as StepController } from './components/stepController';
48
47
  export { default as SaasLogin } from './plus/saasLogin';
49
48
  export { default as SaasRegister } from './plus/saasRegister';
50
49
  export { default as SaasCreateOrganization } from './plus/saasCreateOrganization';
50
+ export { default as WalletEditor } from './plus/walletEditor';
51
+ export { default as WalletPassGallery } from './plus/walletPassGallery';
51
52
  export { default as PinModal } from './components/pinModal';
52
53
  export { default as PinVerifyModal } from './components/pinVerifyModal';
53
54
  export { default as ContactInfo } from './plus/contactInfo';
package/lib/index.js CHANGED
@@ -81,8 +81,9 @@ __export(src_exports, {
81
81
  ToCPay: () => import_toC.default,
82
82
  VerticalAddService: () => import_addServiceVariant.default,
83
83
  VerticalClient: () => import_clientVariant.VerticalClient,
84
- Wallet: () => import_wallet.default,
84
+ WalletEditor: () => import_walletEditor.default,
85
85
  WalletList: () => import_walletList.default,
86
+ WalletPassGallery: () => import_walletPassGallery.default,
86
87
  WorkspaceList: () => import_workSpaceList.default,
87
88
  WorkspaceListDetail: () => import_workSpaceListDetail.default
88
89
  });
@@ -113,7 +114,6 @@ var import_taxSelect = __toESM(require("./components/taxSelect"));
113
114
  var import_eftposPay = __toESM(require("./components/eftposPay"));
114
115
  var import_toC = __toESM(require("./components/pay/toC"));
115
116
  var import_eftpos = __toESM(require("./components/eftpos"));
116
- var import_wallet = __toESM(require("./components/wallet"));
117
117
  var import_walletList = __toESM(require("./components/walletList"));
118
118
  var import_dashboard = __toESM(require("./components/booking/dashboard"));
119
119
  var import_pisellSelectCustomerModal = __toESM(require("./components/pisellSelectCustomerModal"));
@@ -139,6 +139,8 @@ var import_stepController = __toESM(require("./components/stepController"));
139
139
  var import_saasLogin = __toESM(require("./plus/saasLogin"));
140
140
  var import_saasRegister = __toESM(require("./plus/saasRegister"));
141
141
  var import_saasCreateOrganization = __toESM(require("./plus/saasCreateOrganization"));
142
+ var import_walletEditor = __toESM(require("./plus/walletEditor"));
143
+ var import_walletPassGallery = __toESM(require("./plus/walletPassGallery"));
142
144
  var import_pinModal = __toESM(require("./components/pinModal"));
143
145
  var import_pinVerifyModal = __toESM(require("./components/pinVerifyModal"));
144
146
  var import_contactInfo = __toESM(require("./plus/contactInfo"));
@@ -200,8 +202,9 @@ import_dayjs.default.extend(import_localeData.default);
200
202
  ToCPay,
201
203
  VerticalAddService,
202
204
  VerticalClient,
203
- Wallet,
205
+ WalletEditor,
204
206
  WalletList,
207
+ WalletPassGallery,
205
208
  WorkspaceList,
206
209
  WorkspaceListDetail
207
210
  });
@@ -7,11 +7,13 @@ declare type TabItem = {
7
7
  icon?: React.ReactNode;
8
8
  };
9
9
  interface IProps {
10
+ className?: string;
10
11
  items: TabItem[];
11
12
  activeKey: string;
12
13
  onChange: (key: string) => void;
13
14
  loading?: boolean;
14
15
  skeleton?: React.ReactNode;
16
+ style?: React.CSSProperties;
15
17
  }
16
18
  declare const CategoryTabs: React.ForwardRefExoticComponent<IProps & React.RefAttributes<unknown>>;
17
19
  export default CategoryTabs;
@@ -40,7 +40,15 @@ var import_TabsStructure2 = require("../components/TabsStructure/TabsStructure.l
40
40
  var import_CategorySkeleton = __toESM(require("./CategorySkeleton"));
41
41
  var import__ = require("../index");
42
42
  var CategoryTabs = (0, import_react.forwardRef)((props, ref) => {
43
- const { items, activeKey, onChange, loading = false, skeleton } = props;
43
+ const {
44
+ className,
45
+ items,
46
+ activeKey,
47
+ onChange,
48
+ loading = false,
49
+ skeleton,
50
+ style
51
+ } = props;
44
52
  const railRef = (0, import_react.useRef)(null);
45
53
  const [isAtStart, setIsAtStart] = (0, import_react.useState)(true);
46
54
  const [isAtEnd, setIsAtEnd] = (0, import_react.useState)(false);
@@ -100,81 +108,88 @@ var CategoryTabs = (0, import_react.forwardRef)((props, ref) => {
100
108
  if (loading && skeleton) {
101
109
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, skeleton);
102
110
  }
103
- return /* @__PURE__ */ import_react.default.createElement(import_IntersectionObserver.default, null, items.length > 0 && /* @__PURE__ */ import_react.default.createElement("div", { className: `${import__.PREFIX}__tabs-wrapper` }, /* @__PURE__ */ import_react.default.createElement(
104
- import_TabsStructure.TabsStructure,
111
+ return /* @__PURE__ */ import_react.default.createElement(import_IntersectionObserver.default, null, items.length > 0 && /* @__PURE__ */ import_react.default.createElement(
112
+ "div",
105
113
  {
106
- variant: "pill",
107
- backgroundVariant: "onPage",
108
- selectedTab: activeKey
114
+ className: `${import__.PREFIX}__tabs-wrapper ${className || ""}`,
115
+ style
109
116
  },
110
- needsScrollButtons && /* @__PURE__ */ import_react.default.createElement(
111
- import_TabsStructure.TabsStructure.ChevronButton,
117
+ /* @__PURE__ */ import_react.default.createElement(
118
+ import_TabsStructure.TabsStructure,
112
119
  {
113
- direction: "prev",
114
- disabled: isAtStart,
115
- onClick: scrollLeft,
116
- style: { marginRight: "8px" }
117
- }
118
- ),
119
- /* @__PURE__ */ import_react.default.createElement(import_TabsStructure.TabsStructure.Rail, { ref: railRef }, /* @__PURE__ */ import_react.default.createElement(
120
- import_IntersectionObserver.IntersectionTrigger,
121
- {
122
- onShow: () => {
123
- console.log("is start");
124
- setIsAtStart(true);
125
- },
126
- onHide: () => {
127
- console.log("is start false");
128
- setIsAtStart(false);
129
- },
130
- style: {
131
- width: 1,
132
- height: 1,
133
- flexShrink: 0,
134
- background: "rgba(0,0,0,0)"
135
- },
136
- className: "visibility-detector start-detector"
137
- }
138
- ), /* @__PURE__ */ import_react.default.createElement(import_TabsStructure.TabsStructure.SelectionIndicator, { ...selectionIndicatorProps }), /* @__PURE__ */ import_react.default.createElement(import_TabsStructure.TabsStructure.ListContainer, { ...listContainerProps }, items.map((item) => /* @__PURE__ */ import_react.default.createElement(
139
- import_TabsStructure.TabsStructure.Item,
140
- {
141
- key: item.key,
142
- tabId: item.key,
143
- "aria-selected": activeKey === item.key,
144
- onClick: () => onChange(item.key),
145
- className: "tab-item"
120
+ variant: "pill",
121
+ backgroundVariant: "onPage",
122
+ selectedTab: activeKey
146
123
  },
147
- item.label
148
- ))), /* @__PURE__ */ import_react.default.createElement(
149
- import_IntersectionObserver.IntersectionTrigger,
150
- {
151
- className: "visibility-detector end-detector",
152
- onShow: () => {
153
- console.log("is end");
154
- setIsAtEnd(true);
155
- },
156
- onHide: () => {
157
- console.log("is end false");
158
- setIsAtEnd(false);
124
+ needsScrollButtons && /* @__PURE__ */ import_react.default.createElement(
125
+ import_TabsStructure.TabsStructure.ChevronButton,
126
+ {
127
+ direction: "prev",
128
+ disabled: isAtStart,
129
+ onClick: scrollLeft,
130
+ style: { marginRight: "8px" }
131
+ }
132
+ ),
133
+ /* @__PURE__ */ import_react.default.createElement(import_TabsStructure.TabsStructure.Rail, { ref: railRef }, /* @__PURE__ */ import_react.default.createElement(
134
+ import_IntersectionObserver.IntersectionTrigger,
135
+ {
136
+ onShow: () => {
137
+ console.log("is start");
138
+ setIsAtStart(true);
139
+ },
140
+ onHide: () => {
141
+ console.log("is start false");
142
+ setIsAtStart(false);
143
+ },
144
+ style: {
145
+ width: 1,
146
+ height: 1,
147
+ flexShrink: 0,
148
+ background: "rgba(0,0,0,0)"
149
+ },
150
+ className: "visibility-detector start-detector"
151
+ }
152
+ ), /* @__PURE__ */ import_react.default.createElement(import_TabsStructure.TabsStructure.SelectionIndicator, { ...selectionIndicatorProps }), /* @__PURE__ */ import_react.default.createElement(import_TabsStructure.TabsStructure.ListContainer, { ...listContainerProps }, items.map((item) => /* @__PURE__ */ import_react.default.createElement(
153
+ import_TabsStructure.TabsStructure.Item,
154
+ {
155
+ key: item.key,
156
+ tabId: item.key,
157
+ "aria-selected": activeKey === item.key,
158
+ onClick: () => onChange(item.key),
159
+ className: "tab-item"
159
160
  },
160
- style: {
161
- width: 1,
162
- height: 1,
163
- flexShrink: 0,
164
- background: "rgba(0,0,0,0)"
161
+ item.label
162
+ ))), /* @__PURE__ */ import_react.default.createElement(
163
+ import_IntersectionObserver.IntersectionTrigger,
164
+ {
165
+ className: "visibility-detector end-detector",
166
+ onShow: () => {
167
+ console.log("is end");
168
+ setIsAtEnd(true);
169
+ },
170
+ onHide: () => {
171
+ console.log("is end false");
172
+ setIsAtEnd(false);
173
+ },
174
+ style: {
175
+ width: 1,
176
+ height: 1,
177
+ flexShrink: 0,
178
+ background: "rgba(0,0,0,0)"
179
+ }
165
180
  }
166
- }
167
- )),
168
- needsScrollButtons && /* @__PURE__ */ import_react.default.createElement(
169
- import_TabsStructure.TabsStructure.ChevronButton,
170
- {
171
- direction: "next",
172
- disabled: isAtEnd,
173
- onClick: scrollRight,
174
- style: { marginLeft: "8px" }
175
- }
181
+ )),
182
+ needsScrollButtons && /* @__PURE__ */ import_react.default.createElement(
183
+ import_TabsStructure.TabsStructure.ChevronButton,
184
+ {
185
+ direction: "next",
186
+ disabled: isAtEnd,
187
+ onClick: scrollRight,
188
+ style: { marginLeft: "8px" }
189
+ }
190
+ )
176
191
  )
177
- )));
192
+ ));
178
193
  });
179
194
  var CategoryTabs_default = CategoryTabs;
180
195
  // Annotate the CommonJS export names for ESM import in node:
@@ -129,17 +129,6 @@
129
129
  border-radius: calc(20px - 2px);
130
130
  }
131
131
 
132
- &::after {
133
- content: '';
134
- position: absolute;
135
- inset-block-start: 1px;
136
- inset-inline-start: 1px;
137
- inset-inline-end: 1px;
138
- block-size: 50%;
139
- background-color: var(--ps-color-primary, #7f56d9);
140
- border-radius: 20px 20px 0 0;
141
- }
142
-
143
132
  &--focused {
144
133
  .pisell-tabstruct-focus-ring();
145
134
  }
@@ -94,7 +94,6 @@ function groupProductsByCategory(products) {
94
94
  });
95
95
  result.push(...sortedUncategorizedProducts);
96
96
  }
97
- console.log("xxxxxx", result);
98
97
  return result;
99
98
  }
100
99
  function getElementByIdentifier(elementIdentifier) {
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { WalletEditorProps, WalletEditorRef } from './types';
3
+ import './WalletEditor.less';
4
+ declare const WalletEditor: React.ForwardRefExoticComponent<WalletEditorProps & React.RefAttributes<WalletEditorRef>>;
5
+ export default WalletEditor;
@@ -0,0 +1,354 @@
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/WalletEditor.tsx
30
+ var WalletEditor_exports = {};
31
+ __export(WalletEditor_exports, {
32
+ default: () => WalletEditor_default
33
+ });
34
+ module.exports = __toCommonJS(WalletEditor_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_utils = require("@pisell/utils");
37
+ var import_antd = require("antd");
38
+ var import_materials = require("@pisell/materials");
39
+ var import_ImageUpload = __toESM(require("./components/ImageUpload"));
40
+ var import_JsonEditor = __toESM(require("./components/JsonEditor"));
41
+ var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
42
+ var import_locales = __toESM(require("./locales"));
43
+ var import_sortableWalletPassTypes = __toESM(require("./components/sortableWalletPassTypes"));
44
+ var import_ValidityPeriodSelector = __toESM(require("./components/ValidityPeriodSelector"));
45
+ var import_relationProduct = __toESM(require("./components/relationProduct"));
46
+ var import_WalletEditor = require("./WalletEditor.less");
47
+ var WalletEditor = (0, import_react.forwardRef)(
48
+ (props, ref) => {
49
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
50
+ const { value, onChange, disabled = false, className, style } = props;
51
+ const context = (0, import_useEngineContext.default)();
52
+ import_utils.locales.init(
53
+ import_locales.default,
54
+ ((_b = (_a = context.appHelper.utils) == null ? void 0 : _a.storage) == null ? void 0 : _b.get("umi_locale")) || "en"
55
+ );
56
+ const amountSymbol = ((_d = (_c = context.appHelper.utils).getData) == null ? void 0 : _d.call(_c, "shop_symbol")) || "";
57
+ const store = ((_h = (_g = (_f = (_e = context.appHelper.utils).getStore) == null ? void 0 : _f.call(_e)) == null ? void 0 : _g.getState) == null ? void 0 : _h.call(_g)) || {};
58
+ const shopName = ((_j = (_i = store.global) == null ? void 0 : _i.shopDetail) == null ? void 0 : _j.name) || "";
59
+ const [sendConfigVisible, setSendConfigVisible] = (0, import_react.useState)(true);
60
+ const [previewVisible, setPreviewVisible] = (0, import_react.useState)(false);
61
+ const [form] = import_antd.Form.useForm();
62
+ const isControlled = value !== void 0;
63
+ const defaultValue = (0, import_react.useMemo)(
64
+ () => ({
65
+ status: "enable",
66
+ valid_for: {
67
+ unit: "1",
68
+ unit_type: "year",
69
+ type: "normal"
70
+ },
71
+ metadata: {
72
+ showcaseWalletPassNew: import_sortableWalletPassTypes.DEFAULT_WALLET_PASS_TYPES_CONFIG.map(
73
+ (item) => ({
74
+ ...item,
75
+ display: 1
76
+ })
77
+ ),
78
+ coverImage: "",
79
+ send_config: { type: "register" }
80
+ }
81
+ }),
82
+ []
83
+ );
84
+ const currentValue = (0, import_react.useMemo)(() => {
85
+ return { ...defaultValue, ...value };
86
+ }, [value, defaultValue]);
87
+ (0, import_react.useImperativeHandle)(
88
+ ref,
89
+ () => ({
90
+ form,
91
+ setInitialValues: (values) => {
92
+ form.setFieldsValue({ ...defaultValue, ...values });
93
+ },
94
+ getValues: () => {
95
+ var _a2;
96
+ const formValues = form.getFieldsValue();
97
+ const processedValues = {
98
+ ...formValues,
99
+ metadata: {
100
+ ...formValues.metadata,
101
+ showcaseWalletPass: convertShowcaseWalletPass(
102
+ (_a2 = formValues.metadata) == null ? void 0 : _a2.showcaseWalletPassNew
103
+ )
104
+ }
105
+ };
106
+ return processedValues;
107
+ }
108
+ }),
109
+ [form, defaultValue]
110
+ );
111
+ (0, import_react.useEffect)(() => {
112
+ if (isControlled && currentValue) {
113
+ form.setFieldsValue(currentValue);
114
+ }
115
+ }, [currentValue, form, isControlled]);
116
+ const convertShowcaseWalletPass = (showcaseWalletPassNew) => {
117
+ if (!showcaseWalletPassNew) return [];
118
+ return showcaseWalletPassNew.filter((item) => item.display === 1).map((item) => item.type);
119
+ };
120
+ const toggleSendConfig = (0, import_react.useCallback)(() => {
121
+ setSendConfigVisible((prev) => !prev);
122
+ }, []);
123
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: `wallet-editor ${className || ""}`, style }, /* @__PURE__ */ import_react.default.createElement(
124
+ import_antd.Form,
125
+ {
126
+ size: "large",
127
+ form,
128
+ layout: "vertical",
129
+ initialValues: isControlled ? currentValue : { ...defaultValue },
130
+ onValuesChange: (...args) => {
131
+ var _a2;
132
+ (_a2 = props.onValuesChange) == null ? void 0 : _a2.call(props, ...args);
133
+ },
134
+ onFinish: (values) => {
135
+ var _a2;
136
+ if (onChange) {
137
+ const processedValues = {
138
+ ...values,
139
+ metadata: {
140
+ ...values.metadata,
141
+ showcaseWalletPass: convertShowcaseWalletPass(
142
+ (_a2 = values.metadata) == null ? void 0 : _a2.showcaseWalletPassNew
143
+ )
144
+ }
145
+ };
146
+ onChange(processedValues);
147
+ }
148
+ },
149
+ disabled
150
+ },
151
+ /* @__PURE__ */ import_react.default.createElement(
152
+ "div",
153
+ {
154
+ style: {
155
+ padding: "20px 20px 0px 20px",
156
+ borderRadius: 10,
157
+ marginTop: 24,
158
+ border: "1px solid var(--Gray-300,#d0d5dd)"
159
+ }
160
+ },
161
+ /* @__PURE__ */ import_react.default.createElement(
162
+ import_antd.Form.Item,
163
+ {
164
+ label: import_utils.locales.getText("walletName"),
165
+ name: "name",
166
+ rules: [
167
+ {
168
+ validator: async (_, value2) => {
169
+ const msg = import_utils.locales.getText("pleaseInputWalletName");
170
+ if (value2 == null || typeof value2 !== "object") {
171
+ return Promise.reject(new Error(msg));
172
+ }
173
+ const keys = Object.keys(value2);
174
+ if (keys.length === 0) {
175
+ return Promise.reject(new Error(msg));
176
+ }
177
+ const hasNonEmpty = keys.some((k) => {
178
+ const v = value2[k];
179
+ return typeof v === "string" && v.trim() !== "";
180
+ });
181
+ return hasNonEmpty ? Promise.resolve() : Promise.reject(new Error(msg));
182
+ }
183
+ }
184
+ ]
185
+ },
186
+ /* @__PURE__ */ import_react.default.createElement(import_materials.Translation, null)
187
+ ),
188
+ /* @__PURE__ */ import_react.default.createElement(
189
+ import_antd.Form.Item,
190
+ {
191
+ label: import_utils.locales.getText("validityPeriod"),
192
+ name: "valid_for"
193
+ },
194
+ /* @__PURE__ */ import_react.default.createElement(import_ValidityPeriodSelector.default, null)
195
+ ),
196
+ /* @__PURE__ */ import_react.default.createElement(
197
+ import_antd.Form.Item,
198
+ {
199
+ label: import_utils.locales.getText("linkedPasses"),
200
+ name: "relation_id",
201
+ initialValue: []
202
+ },
203
+ /* @__PURE__ */ import_react.default.createElement(import_relationProduct.default, null)
204
+ ),
205
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: import_utils.locales.getText("sort"), name: "sort" }, /* @__PURE__ */ import_react.default.createElement(import_antd.InputNumber, { style: { width: "100%" } })),
206
+ /* @__PURE__ */ import_react.default.createElement(
207
+ import_antd.Form.Item,
208
+ {
209
+ label: import_utils.locales.getText("status"),
210
+ name: "status",
211
+ initialValue: "enable"
212
+ },
213
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Radio.Group, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { value: "enable" }, import_utils.locales.getText("enable")), /* @__PURE__ */ import_react.default.createElement(import_antd.Radio, { value: "disable" }, import_utils.locales.getText("disable")))
214
+ ),
215
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label: import_utils.locales.getText("distributionConditions") }, /* @__PURE__ */ import_react.default.createElement(
216
+ "div",
217
+ {
218
+ style: {
219
+ color: "#8c5cff",
220
+ cursor: "pointer",
221
+ height: 40,
222
+ display: "flex",
223
+ alignItems: "center",
224
+ border: "none",
225
+ background: "transparent",
226
+ padding: 0
227
+ },
228
+ onClick: toggleSendConfig
229
+ },
230
+ import_utils.locales.getText("advancedSettings"),
231
+ " ",
232
+ /* @__PURE__ */ import_react.default.createElement(
233
+ import_materials.Icon,
234
+ {
235
+ type: "pisell2-chevron-down",
236
+ size: 18,
237
+ style: {
238
+ transform: sendConfigVisible ? "rotate(0deg)" : "rotate(180deg)"
239
+ }
240
+ }
241
+ )
242
+ ), /* @__PURE__ */ import_react.default.createElement(
243
+ import_antd.Form.Item,
244
+ {
245
+ noStyle: true,
246
+ name: ["metadata", "send_config"],
247
+ initialValue: {
248
+ type: "register"
249
+ }
250
+ },
251
+ /* @__PURE__ */ import_react.default.createElement(
252
+ import_JsonEditor.default,
253
+ {
254
+ placeholder: import_utils.locales.getText("enterJSONConfig"),
255
+ rows: 4,
256
+ disabled,
257
+ style: { display: sendConfigVisible ? "block" : "none" }
258
+ }
259
+ )
260
+ ))
261
+ ),
262
+ /* @__PURE__ */ import_react.default.createElement(
263
+ "div",
264
+ {
265
+ style: {
266
+ padding: "20px 20px 0px 20px",
267
+ borderRadius: 10,
268
+ margin: "24px 0",
269
+ border: "1px solid var(--Gray-300,#d0d5dd)"
270
+ }
271
+ },
272
+ /* @__PURE__ */ import_react.default.createElement(
273
+ "div",
274
+ {
275
+ style: {
276
+ marginBottom: "8px",
277
+ display: "flex",
278
+ justifyContent: "space-between",
279
+ alignItems: "center"
280
+ }
281
+ },
282
+ /* @__PURE__ */ import_react.default.createElement("span", { style: { fontWeight: "bold", fontSize: 16 } }, import_utils.locales.getText("displaySettings")),
283
+ /* @__PURE__ */ import_react.default.createElement(
284
+ "span",
285
+ {
286
+ style: { color: "#8c5cff", cursor: "pointer" },
287
+ onClick: () => setPreviewVisible(true)
288
+ },
289
+ import_utils.locales.getText("viewPreview")
290
+ )
291
+ ),
292
+ /* @__PURE__ */ import_react.default.createElement(
293
+ import_antd.Form.Item,
294
+ {
295
+ label: "",
296
+ name: ["metadata", "showcaseWalletPassNew"],
297
+ initialValue: import_sortableWalletPassTypes.DEFAULT_WALLET_PASS_TYPES_CONFIG.map((item) => ({
298
+ ...item,
299
+ display: 1
300
+ }))
301
+ },
302
+ /* @__PURE__ */ import_react.default.createElement(import_sortableWalletPassTypes.default, null)
303
+ ),
304
+ /* @__PURE__ */ import_react.default.createElement(
305
+ import_antd.Form.Item,
306
+ {
307
+ label: import_utils.locales.getText("icon"),
308
+ name: ["metadata", "icon"]
309
+ },
310
+ /* @__PURE__ */ import_react.default.createElement(import_ImageUpload.default, null)
311
+ ),
312
+ /* @__PURE__ */ import_react.default.createElement(
313
+ import_antd.Form.Item,
314
+ {
315
+ label: import_utils.locales.getText("coverImage"),
316
+ name: ["metadata", "coverImage"]
317
+ },
318
+ /* @__PURE__ */ import_react.default.createElement(import_ImageUpload.default, null)
319
+ )
320
+ )
321
+ )), /* @__PURE__ */ import_react.default.createElement(
322
+ import_materials.PisellModal,
323
+ {
324
+ open: previewVisible,
325
+ onCancel: () => setPreviewVisible(false),
326
+ title: import_utils.locales.getText("preview"),
327
+ width: "auto",
328
+ footer: false,
329
+ header: false,
330
+ className: "pisell-wallet-editor_preview-modal"
331
+ },
332
+ /* @__PURE__ */ import_react.default.createElement(
333
+ import_materials.WalletCard,
334
+ {
335
+ mode: "dark",
336
+ shopName,
337
+ cardStyle: "normal",
338
+ codeType: "qrCode",
339
+ symbol: amountSymbol,
340
+ items: form.getFieldValue(["metadata", "showcaseWalletPassNew"]),
341
+ customBackgroundImage: form.getFieldValue([
342
+ "metadata",
343
+ "coverImage"
344
+ ]),
345
+ iconImg: form.getFieldValue(["metadata", "icon"]),
346
+ style: {
347
+ minWidth: 368
348
+ }
349
+ }
350
+ )
351
+ ));
352
+ }
353
+ );
354
+ var WalletEditor_default = WalletEditor;