@pisell/private-materials 6.3.224 → 6.3.227

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.
@@ -12,6 +12,7 @@ import { getVirtualCurrencyItems } from "./serve.js";
12
12
  import ValidityPeriodSelector from "./components/ValidityPeriodSelector/index.js";
13
13
  import RelationProduct from "./components/relationProduct/index.js";
14
14
  import MobileWalletTemplate from "./components/MobileWalletTemplate/index.js";
15
+ import PassDisplayConfig from "./components/PassDisplayConfig/index.js";
15
16
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
16
17
  import { Form, InputNumber, Radio } from "antd";
17
18
  import { locales } from "@pisell/utils";
@@ -19,7 +20,7 @@ import { Icon, PisellModal, Translation, WalletCard } from "@pisell/materials";
19
20
  import "./WalletEditor.less";
20
21
  //#region src/plus/walletEditor/WalletEditor.tsx
21
22
  const WalletEditor = forwardRef((props, ref) => {
22
- var _context$appHelper, _context$appHelper$ut, _context$appHelper2, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6, _store$global, _ref, _props$walletId;
23
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper2, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6, _store$global, _context$appHelper3, _context$appHelper3$g, _ref, _props$walletId;
23
24
  const { value, onChange, disabled = false, className, style } = props;
24
25
  const propsRef = useRef(props);
25
26
  propsRef.current = props;
@@ -30,6 +31,7 @@ const WalletEditor = forwardRef((props, ref) => {
30
31
  const requestGet = requestClient === null || requestClient === void 0 ? void 0 : requestClient.get;
31
32
  const amountSymbol = ((_context$appHelper$ut2 = (_context$appHelper$ut3 = context.appHelper.utils).getData) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.call(_context$appHelper$ut3, "shop_symbol")) || "";
32
33
  const shopName = ((_store$global = (((_context$appHelper$ut4 = (_context$appHelper$ut5 = context.appHelper.utils).getStore) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.call(_context$appHelper$ut5)) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut6 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut6 === void 0 ? void 0 : _context$appHelper$ut6.call(_context$appHelper$ut4)) || {}).global) === null || _store$global === void 0 || (_store$global = _store$global.shopDetail) === null || _store$global === void 0 ? void 0 : _store$global.name) || "";
34
+ const hasFranchisor = Boolean((_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.utils) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.businessUtils) === null || _context$appHelper3 === void 0 || (_context$appHelper3$g = _context$appHelper3.getAppByModal) === null || _context$appHelper3$g === void 0 ? void 0 : _context$appHelper3$g.call(_context$appHelper3, "franchisor"));
33
35
  const [sendConfigVisible, setSendConfigVisible] = useState(true);
34
36
  const [previewVisible, setPreviewVisible] = useState(false);
35
37
  const [initialWalletId, setInitialWalletId] = useState(value === null || value === void 0 ? void 0 : value.id);
@@ -201,7 +203,19 @@ const WalletEditor = forwardRef((props, ref) => {
201
203
  }, /* @__PURE__ */ React.createElement(Translation, null)), /* @__PURE__ */ React.createElement(Form.Item, {
202
204
  label: locales.getText("validityPeriod"),
203
205
  name: "valid_for"
204
- }, /* @__PURE__ */ React.createElement(ValidityPeriodSelector, null)), /* @__PURE__ */ React.createElement(Form.Item, {
206
+ }, /* @__PURE__ */ React.createElement(ValidityPeriodSelector, null)), hasFranchisor && /* @__PURE__ */ React.createElement(Form.Item, {
207
+ label: locales.getText("passesShownInWallet"),
208
+ name: ["metadata", "pass_visibility"],
209
+ rules: [{ validator: function() {
210
+ var _ref4 = _asyncToGenerator(function* (_, value) {
211
+ var _value$shop_ids;
212
+ if ((value === null || value === void 0 ? void 0 : value.type) === "selected_franchisees" && !((_value$shop_ids = value.shop_ids) === null || _value$shop_ids === void 0 ? void 0 : _value$shop_ids.length)) throw new Error(locales.getText("passIssuerShopsRequired"));
213
+ });
214
+ return function validator(_x3, _x4) {
215
+ return _ref4.apply(this, arguments);
216
+ };
217
+ }() }]
218
+ }, /* @__PURE__ */ React.createElement(PassDisplayConfig, { disabled })), /* @__PURE__ */ React.createElement(Form.Item, {
205
219
  label: locales.getText("linkedPasses"),
206
220
  name: "relation_id",
207
221
  initialValue: []
@@ -210,7 +224,7 @@ const WalletEditor = forwardRef((props, ref) => {
210
224
  name: ["metadata", "holder"],
211
225
  initialValue: { type: "customer" },
212
226
  rules: [{ validator: function() {
213
- var _ref4 = _asyncToGenerator(function* (_, value) {
227
+ var _ref5 = _asyncToGenerator(function* (_, value) {
214
228
  if ((value === null || value === void 0 ? void 0 : value.type) === "custom") {
215
229
  var _value$custom, _holderSelectorRef$cu, _holderSelectorRef$cu2;
216
230
  if (!(value === null || value === void 0 || (_value$custom = value.custom) === null || _value$custom === void 0 ? void 0 : _value$custom.custom_id)) return Promise.reject(new Error(locales.getText("pisell2.wallet-editor.holder.required")));
@@ -222,8 +236,8 @@ const WalletEditor = forwardRef((props, ref) => {
222
236
  }
223
237
  return Promise.resolve();
224
238
  });
225
- return function validator(_x3, _x4) {
226
- return _ref4.apply(this, arguments);
239
+ return function validator(_x5, _x6) {
240
+ return _ref5.apply(this, arguments);
227
241
  };
228
242
  }() }]
229
243
  }, /* @__PURE__ */ React.createElement(HolderSelector, { ref: holderSelectorRef })), /* @__PURE__ */ React.createElement(Form.Item, {
@@ -0,0 +1,60 @@
1
+ import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
+ import { getFranchiseeShops } from "./serve.js";
3
+ import React from "react";
4
+ import { Button, Radio, Select } from "antd";
5
+ import { locales } from "@pisell/utils";
6
+ import { useRequest } from "ahooks";
7
+ import "./index.less";
8
+ //#region src/plus/walletEditor/components/PassDisplayConfig/index.tsx
9
+ const PassDisplayConfig = ({ id, value = {
10
+ type: "self",
11
+ shop_ids: []
12
+ }, onChange, disabled = false }) => {
13
+ const { data: shops = [], loading, error, refresh } = useRequest(getFranchiseeShops, { ready: value.type === "selected_franchisees" });
14
+ return /* @__PURE__ */ React.createElement("div", {
15
+ id,
16
+ className: "wallet-pass-display-config"
17
+ }, /* @__PURE__ */ React.createElement("div", { className: "wallet-pass-display-config__label" }, locales.getText("showPassesIssuedBy")), /* @__PURE__ */ React.createElement("div", {
18
+ role: "radiogroup",
19
+ "aria-label": locales.getText("showPassesIssuedBy")
20
+ }, /* @__PURE__ */ React.createElement(Radio.Group, {
21
+ className: "wallet-pass-display-config__scope",
22
+ value: value.type,
23
+ onChange: (event) => onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, { type: event.target.value })),
24
+ disabled
25
+ }, /* @__PURE__ */ React.createElement(Radio, {
26
+ value: "self",
27
+ className: "wallet-pass-display-config__option"
28
+ }, locales.getText("passIssuerCurrentShop")), /* @__PURE__ */ React.createElement(Radio, {
29
+ value: "all_franchisees",
30
+ className: "wallet-pass-display-config__option"
31
+ }, locales.getText("passIssuerAllShops")), /* @__PURE__ */ React.createElement(Radio, {
32
+ value: "selected_franchisees",
33
+ className: "wallet-pass-display-config__option"
34
+ }, locales.getText("passIssuerSpecifiedShops")))), value.type === "selected_franchisees" && /* @__PURE__ */ React.createElement("div", { className: "wallet-pass-display-config__shops" }, /* @__PURE__ */ React.createElement(Select, {
35
+ className: "wallet-pass-display-config__shop-select",
36
+ mode: "multiple",
37
+ allowClear: true,
38
+ showSearch: true,
39
+ optionFilterProp: "name",
40
+ maxTagCount: "responsive",
41
+ placeholder: locales.getText("passIssuerSelectShops"),
42
+ "aria-label": locales.getText("passIssuerSelectShops"),
43
+ options: shops,
44
+ fieldNames: {
45
+ value: "source_shop_id",
46
+ label: "name"
47
+ },
48
+ loading,
49
+ notFoundContent: error && !loading ? /* @__PURE__ */ React.createElement(Button, {
50
+ type: "link",
51
+ size: "small",
52
+ onClick: refresh
53
+ }, locales.getText("passIssuerLoadFailedRetry")) : void 0,
54
+ value: value.shop_ids,
55
+ onChange: (shop_ids) => onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, { shop_ids })),
56
+ disabled
57
+ })));
58
+ };
59
+ //#endregion
60
+ export { PassDisplayConfig as default };
@@ -0,0 +1,27 @@
1
+ .wallet-pass-display-config {
2
+ &__label {
3
+ margin-bottom: 8px;
4
+ color: var(--Gray-600, #475467);
5
+ font-size: 14px;
6
+ line-height: 22px;
7
+ }
8
+
9
+ [role='radiogroup'] .wallet-pass-display-config__scope {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 8px;
13
+
14
+ .wallet-pass-display-config__option {
15
+ margin: 0;
16
+ }
17
+ }
18
+
19
+ &__shops {
20
+ margin-top: 12px;
21
+ padding-left: 24px;
22
+
23
+ .wallet-pass-display-config__shop-select {
24
+ width: 100%;
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,18 @@
1
+ import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
2
+ import { request } from "../../../../utils/index.js";
3
+ //#region src/plus/walletEditor/components/PassDisplayConfig/serve.ts
4
+ const getFranchiseeShops = function() {
5
+ var _ref = _asyncToGenerator(function* () {
6
+ const { data } = yield request.getRequest().get("/shop/franchisor/shop", {
7
+ skip: 1,
8
+ num: 199,
9
+ status: "approved"
10
+ }, { isShopApi: true });
11
+ return data.list;
12
+ });
13
+ return function getFranchiseeShops() {
14
+ return _ref.apply(this, arguments);
15
+ };
16
+ }();
17
+ //#endregion
18
+ export { getFranchiseeShops };
@@ -1,2 +1,2 @@
1
- import { MultiLanguageTitle, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType } from "./types.js";
1
+ import { MultiLanguageTitle, PassDisplayConfigValue, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType } from "./types.js";
2
2
  import { WalletEditor } from "./WalletEditor.js";
@@ -3,6 +3,14 @@ var locales_default = {
3
3
  en: {
4
4
  walletName: "Wallet name",
5
5
  validityPeriod: "Validity Period",
6
+ passesShownInWallet: "Passes shown in this Wallet:",
7
+ showPassesIssuedBy: "Show passes issued by:",
8
+ passIssuerCurrentShop: "Current store",
9
+ passIssuerAllShops: "All stores in the chain",
10
+ passIssuerSpecifiedShops: "Specified stores",
11
+ passIssuerSelectShops: "Select stores",
12
+ passIssuerShopsRequired: "Please select at least one store",
13
+ passIssuerLoadFailedRetry: "Failed to load stores. Click to retry.",
6
14
  linkedPasses: "Linked passes",
7
15
  linkedPassesDesc: "Select the passes that will be available in this Wallet.",
8
16
  sort: "Sort",
@@ -54,6 +62,14 @@ var locales_default = {
54
62
  "zh-CN": {
55
63
  walletName: "钱包名称",
56
64
  validityPeriod: "有效期",
65
+ passesShownInWallet: "此钱包中显示的卡券:",
66
+ showPassesIssuedBy: "显示由以下门店发放的卡券:",
67
+ passIssuerCurrentShop: "当前门店",
68
+ passIssuerAllShops: "连锁内所有门店",
69
+ passIssuerSpecifiedShops: "指定门店",
70
+ passIssuerSelectShops: "选择门店",
71
+ passIssuerShopsRequired: "请至少选择一个门店",
72
+ passIssuerLoadFailedRetry: "门店加载失败,点击重试",
57
73
  linkedPasses: "包含的卡券",
58
74
  linkedPassesDesc: "选择此 Wallet 中可展示与使用的卡券。",
59
75
  sort: "排序",
@@ -105,6 +121,14 @@ var locales_default = {
105
121
  "zh-HK": {
106
122
  walletName: "錢包名稱",
107
123
  validityPeriod: "有效期",
124
+ passesShownInWallet: "此錢包中顯示的卡券:",
125
+ showPassesIssuedBy: "顯示由以下門店發放的卡券:",
126
+ passIssuerCurrentShop: "目前門店",
127
+ passIssuerAllShops: "連鎖內所有門店",
128
+ passIssuerSpecifiedShops: "指定門店",
129
+ passIssuerSelectShops: "選擇門店",
130
+ passIssuerShopsRequired: "請至少選擇一個門店",
131
+ passIssuerLoadFailedRetry: "門店載入失敗,點擊重試",
108
132
  linkedPasses: "包含的卡券",
109
133
  linkedPassesDesc: "選擇此 Wallet 中可展示與使用的卡券。",
110
134
  sort: "排序",
@@ -156,6 +180,14 @@ var locales_default = {
156
180
  ja: {
157
181
  walletName: "ウォレット名",
158
182
  validityPeriod: "有効期間",
183
+ passesShownInWallet: "このウォレットに表示するパス:",
184
+ showPassesIssuedBy: "次の店舗が発行したパスを表示:",
185
+ passIssuerCurrentShop: "現在の店舗",
186
+ passIssuerAllShops: "チェーン内のすべての店舗",
187
+ passIssuerSpecifiedShops: "指定した店舗",
188
+ passIssuerSelectShops: "店舗を選択",
189
+ passIssuerShopsRequired: "店舗を1つ以上選択してください",
190
+ passIssuerLoadFailedRetry: "店舗を読み込めませんでした。クリックして再試行。",
159
191
  linkedPasses: "リンクされたパス",
160
192
  linkedPassesDesc: "このウォレットで利用可能なパスを選択します。",
161
193
  sort: "並び替え",
@@ -207,6 +239,14 @@ var locales_default = {
207
239
  pt: {
208
240
  walletName: "Nome da carteira",
209
241
  validityPeriod: "Período de Validade",
242
+ passesShownInWallet: "Passes exibidos nesta carteira:",
243
+ showPassesIssuedBy: "Mostrar passes emitidos por:",
244
+ passIssuerCurrentShop: "Loja atual",
245
+ passIssuerAllShops: "Todas as lojas da rede",
246
+ passIssuerSpecifiedShops: "Lojas específicas",
247
+ passIssuerSelectShops: "Selecionar lojas",
248
+ passIssuerShopsRequired: "Selecione pelo menos uma loja",
249
+ passIssuerLoadFailedRetry: "Falha ao carregar lojas. Clique para tentar novamente.",
210
250
  linkedPasses: "Passes vinculados",
211
251
  linkedPassesDesc: "Selecione os passes que estarão disponíveis nesta Carteira.",
212
252
  sort: "Ordenar",
@@ -26,6 +26,12 @@ interface SendConfig {
26
26
  type: string;
27
27
  [key: string]: any;
28
28
  }
29
+ /** 在原展示范围上追加子店卡券的配置。 */
30
+ interface PassDisplayConfigValue {
31
+ type: 'self' | 'all_franchisees' | 'selected_franchisees';
32
+ /** 仅 selected_franchisees 使用,其他模式忽略。 */
33
+ shop_ids?: number[];
34
+ }
29
35
  interface WalletMetadata {
30
36
  [key: string]: unknown;
31
37
  mobile_wallet_id?: string | number;
@@ -35,6 +41,7 @@ interface WalletMetadata {
35
41
  customerName?: string;
36
42
  coverImage?: string;
37
43
  send_config?: SendConfig;
44
+ pass_visibility?: PassDisplayConfigValue;
38
45
  }
39
46
  interface WalletEditorValue {
40
47
  id?: number | string;
@@ -59,4 +66,4 @@ interface WalletEditorProps {
59
66
  style?: React.CSSProperties;
60
67
  }
61
68
  //#endregion
62
- export { MultiLanguageTitle, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType };
69
+ export { MultiLanguageTitle, PassDisplayConfigValue, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType };
@@ -40,7 +40,7 @@ const KEYS = {
40
40
  const ARow = Row;
41
41
  const ACol = Col;
42
42
  const WalletPassGallery = (props) => {
43
- var _context$appHelper, _context$appHelper2, _context$engine, _utils$translation, _getWalletDetail$data, _utils$isApp, _interaction$utils3, _interaction$utils3$i, _utils$translation2, _getWalletDetail$data2;
43
+ var _context$appHelper, _context$appHelper2, _utils$businessUtils, _utils$businessUtils$, _context$engine, _utils$translation, _getWalletDetail$data, _utils$isApp, _interaction$utils3, _interaction$utils3$i, _utils$translation2, _getWalletDetail$data2;
44
44
  const { hideAddButton, hideTitle, customer, platform: platformProp } = props;
45
45
  const [activeKey, setActiveKey] = useState("available");
46
46
  const [currentItemId, setCurrentItemId] = useState(void 0);
@@ -51,6 +51,7 @@ const WalletPassGallery = (props) => {
51
51
  const context = useEngineContext();
52
52
  const utils = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
53
53
  const { apiPrefix } = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.constants) || { apiPrefix: "/h5" };
54
+ const includeFranchiseePasses = Boolean((_utils$businessUtils = utils.businessUtils) === null || _utils$businessUtils === void 0 || (_utils$businessUtils$ = _utils$businessUtils.getAppByModal) === null || _utils$businessUtils$ === void 0 ? void 0 : _utils$businessUtils$.call(_utils$businessUtils, "franchisor"));
54
55
  const { isTerminal, isApp, interaction } = utils;
55
56
  const isTerminalEnv = (typeof isTerminal === "function" ? isTerminal() : !!isTerminal) || (isApp === null || isApp === void 0 ? void 0 : isApp());
56
57
  const platform = useMemo(() => {
@@ -76,7 +77,8 @@ const WalletPassGallery = (props) => {
76
77
  filter_holder_id: holderId || void 0,
77
78
  with: ["customScheduleSnapshot", "holder.detail"],
78
79
  customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
79
- limit_status: "enable"
80
+ limit_status: "enable",
81
+ include_franchisee_passes: includeFranchiseePasses ? 1 : void 0
80
82
  }, { apiPrefix });
81
83
  return {
82
84
  list: (res === null || res === void 0 ? void 0 : res.list) || [],
@@ -109,7 +111,8 @@ const WalletPassGallery = (props) => {
109
111
  filter_holder_id: holderId || void 0,
110
112
  with: ["customScheduleSnapshot", "holder.detail"],
111
113
  customer_id: customer === null || customer === void 0 ? void 0 : customer.id,
112
- limit_status: "enable"
114
+ limit_status: "enable",
115
+ include_franchisee_passes: includeFranchiseePasses ? 1 : void 0
113
116
  }, { apiPrefix });
114
117
  return {
115
118
  list: (res === null || res === void 0 ? void 0 : res.list) || [],
@@ -189,7 +192,11 @@ const WalletPassGallery = (props) => {
189
192
  }
190
193
  }
191
194
  });
192
- }, [customer]);
195
+ }, [
196
+ customer,
197
+ apiPrefix,
198
+ includeFranchiseePasses
199
+ ]);
193
200
  useEffect(() => {
194
201
  var _interaction$utils, _interaction$utils$mo;
195
202
  interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$mo = _interaction$utils.mountFunction) === null || _interaction$utils$mo === void 0 || _interaction$utils$mo.call(_interaction$utils, "customer", "new", () => {
@@ -13,6 +13,7 @@ const require_serve = require("./serve.js");
13
13
  const require_index$4 = require("./components/ValidityPeriodSelector/index.js");
14
14
  const require_index$5 = require("./components/relationProduct/index.js");
15
15
  const require_index$6 = require("./components/MobileWalletTemplate/index.js");
16
+ const require_index$7 = require("./components/PassDisplayConfig/index.js");
16
17
  let react = require("react");
17
18
  react = require_runtime.__toESM(react);
18
19
  let antd = require("antd");
@@ -21,7 +22,7 @@ let _pisell_materials = require("@pisell/materials");
21
22
  require("./WalletEditor.less");
22
23
  //#region src/plus/walletEditor/WalletEditor.tsx
23
24
  const WalletEditor = (0, react.forwardRef)((props, ref) => {
24
- var _context$appHelper, _context$appHelper$ut, _context$appHelper2, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6, _store$global, _ref, _props$walletId;
25
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper2, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6, _store$global, _context$appHelper3, _context$appHelper3$g, _ref, _props$walletId;
25
26
  const { value, onChange, disabled = false, className, style } = props;
26
27
  const propsRef = (0, react.useRef)(props);
27
28
  propsRef.current = props;
@@ -32,6 +33,7 @@ const WalletEditor = (0, react.forwardRef)((props, ref) => {
32
33
  const requestGet = requestClient === null || requestClient === void 0 ? void 0 : requestClient.get;
33
34
  const amountSymbol = ((_context$appHelper$ut2 = (_context$appHelper$ut3 = context.appHelper.utils).getData) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.call(_context$appHelper$ut3, "shop_symbol")) || "";
34
35
  const shopName = ((_store$global = (((_context$appHelper$ut4 = (_context$appHelper$ut5 = context.appHelper.utils).getStore) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.call(_context$appHelper$ut5)) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut6 = _context$appHelper$ut4.getState) === null || _context$appHelper$ut6 === void 0 ? void 0 : _context$appHelper$ut6.call(_context$appHelper$ut4)) || {}).global) === null || _store$global === void 0 || (_store$global = _store$global.shopDetail) === null || _store$global === void 0 ? void 0 : _store$global.name) || "";
36
+ const hasFranchisor = Boolean((_context$appHelper3 = context.appHelper) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.utils) === null || _context$appHelper3 === void 0 || (_context$appHelper3 = _context$appHelper3.businessUtils) === null || _context$appHelper3 === void 0 || (_context$appHelper3$g = _context$appHelper3.getAppByModal) === null || _context$appHelper3$g === void 0 ? void 0 : _context$appHelper3$g.call(_context$appHelper3, "franchisor"));
35
37
  const [sendConfigVisible, setSendConfigVisible] = (0, react.useState)(true);
36
38
  const [previewVisible, setPreviewVisible] = (0, react.useState)(false);
37
39
  const [initialWalletId, setInitialWalletId] = (0, react.useState)(value === null || value === void 0 ? void 0 : value.id);
@@ -203,7 +205,19 @@ const WalletEditor = (0, react.forwardRef)((props, ref) => {
203
205
  }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Translation, null)), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
204
206
  label: _pisell_utils.locales.getText("validityPeriod"),
205
207
  name: "valid_for"
206
- }, /* @__PURE__ */ react.default.createElement(require_index$4.default, null)), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
208
+ }, /* @__PURE__ */ react.default.createElement(require_index$4.default, null)), hasFranchisor && /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
209
+ label: _pisell_utils.locales.getText("passesShownInWallet"),
210
+ name: ["metadata", "pass_visibility"],
211
+ rules: [{ validator: function() {
212
+ var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (_, value) {
213
+ var _value$shop_ids;
214
+ if ((value === null || value === void 0 ? void 0 : value.type) === "selected_franchisees" && !((_value$shop_ids = value.shop_ids) === null || _value$shop_ids === void 0 ? void 0 : _value$shop_ids.length)) throw new Error(_pisell_utils.locales.getText("passIssuerShopsRequired"));
215
+ });
216
+ return function validator(_x3, _x4) {
217
+ return _ref4.apply(this, arguments);
218
+ };
219
+ }() }]
220
+ }, /* @__PURE__ */ react.default.createElement(require_index$7.default, { disabled })), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
207
221
  label: _pisell_utils.locales.getText("linkedPasses"),
208
222
  name: "relation_id",
209
223
  initialValue: []
@@ -212,7 +226,7 @@ const WalletEditor = (0, react.forwardRef)((props, ref) => {
212
226
  name: ["metadata", "holder"],
213
227
  initialValue: { type: "customer" },
214
228
  rules: [{ validator: function() {
215
- var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (_, value) {
229
+ var _ref5 = require_asyncToGenerator._asyncToGenerator(function* (_, value) {
216
230
  if ((value === null || value === void 0 ? void 0 : value.type) === "custom") {
217
231
  var _value$custom, _holderSelectorRef$cu, _holderSelectorRef$cu2;
218
232
  if (!(value === null || value === void 0 || (_value$custom = value.custom) === null || _value$custom === void 0 ? void 0 : _value$custom.custom_id)) return Promise.reject(new Error(_pisell_utils.locales.getText("pisell2.wallet-editor.holder.required")));
@@ -224,8 +238,8 @@ const WalletEditor = (0, react.forwardRef)((props, ref) => {
224
238
  }
225
239
  return Promise.resolve();
226
240
  });
227
- return function validator(_x3, _x4) {
228
- return _ref4.apply(this, arguments);
241
+ return function validator(_x5, _x6) {
242
+ return _ref5.apply(this, arguments);
229
243
  };
230
244
  }() }]
231
245
  }, /* @__PURE__ */ react.default.createElement(HolderSelector, { ref: holderSelectorRef })), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
@@ -0,0 +1,62 @@
1
+ const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
2
+ const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
+ const require_serve = require("./serve.js");
4
+ let react = require("react");
5
+ react = require_runtime.__toESM(react);
6
+ let antd = require("antd");
7
+ let _pisell_utils = require("@pisell/utils");
8
+ let ahooks = require("ahooks");
9
+ require("./index.less");
10
+ //#region src/plus/walletEditor/components/PassDisplayConfig/index.tsx
11
+ const PassDisplayConfig = ({ id, value = {
12
+ type: "self",
13
+ shop_ids: []
14
+ }, onChange, disabled = false }) => {
15
+ const { data: shops = [], loading, error, refresh } = (0, ahooks.useRequest)(require_serve.getFranchiseeShops, { ready: value.type === "selected_franchisees" });
16
+ return /* @__PURE__ */ react.default.createElement("div", {
17
+ id,
18
+ className: "wallet-pass-display-config"
19
+ }, /* @__PURE__ */ react.default.createElement("div", { className: "wallet-pass-display-config__label" }, _pisell_utils.locales.getText("showPassesIssuedBy")), /* @__PURE__ */ react.default.createElement("div", {
20
+ role: "radiogroup",
21
+ "aria-label": _pisell_utils.locales.getText("showPassesIssuedBy")
22
+ }, /* @__PURE__ */ react.default.createElement(antd.Radio.Group, {
23
+ className: "wallet-pass-display-config__scope",
24
+ value: value.type,
25
+ onChange: (event) => onChange === null || onChange === void 0 ? void 0 : onChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, value), {}, { type: event.target.value })),
26
+ disabled
27
+ }, /* @__PURE__ */ react.default.createElement(antd.Radio, {
28
+ value: "self",
29
+ className: "wallet-pass-display-config__option"
30
+ }, _pisell_utils.locales.getText("passIssuerCurrentShop")), /* @__PURE__ */ react.default.createElement(antd.Radio, {
31
+ value: "all_franchisees",
32
+ className: "wallet-pass-display-config__option"
33
+ }, _pisell_utils.locales.getText("passIssuerAllShops")), /* @__PURE__ */ react.default.createElement(antd.Radio, {
34
+ value: "selected_franchisees",
35
+ className: "wallet-pass-display-config__option"
36
+ }, _pisell_utils.locales.getText("passIssuerSpecifiedShops")))), value.type === "selected_franchisees" && /* @__PURE__ */ react.default.createElement("div", { className: "wallet-pass-display-config__shops" }, /* @__PURE__ */ react.default.createElement(antd.Select, {
37
+ className: "wallet-pass-display-config__shop-select",
38
+ mode: "multiple",
39
+ allowClear: true,
40
+ showSearch: true,
41
+ optionFilterProp: "name",
42
+ maxTagCount: "responsive",
43
+ placeholder: _pisell_utils.locales.getText("passIssuerSelectShops"),
44
+ "aria-label": _pisell_utils.locales.getText("passIssuerSelectShops"),
45
+ options: shops,
46
+ fieldNames: {
47
+ value: "source_shop_id",
48
+ label: "name"
49
+ },
50
+ loading,
51
+ notFoundContent: error && !loading ? /* @__PURE__ */ react.default.createElement(antd.Button, {
52
+ type: "link",
53
+ size: "small",
54
+ onClick: refresh
55
+ }, _pisell_utils.locales.getText("passIssuerLoadFailedRetry")) : void 0,
56
+ value: value.shop_ids,
57
+ onChange: (shop_ids) => onChange === null || onChange === void 0 ? void 0 : onChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, value), {}, { shop_ids })),
58
+ disabled
59
+ })));
60
+ };
61
+ //#endregion
62
+ exports.default = PassDisplayConfig;
@@ -0,0 +1,27 @@
1
+ .wallet-pass-display-config {
2
+ &__label {
3
+ margin-bottom: 8px;
4
+ color: var(--Gray-600, #475467);
5
+ font-size: 14px;
6
+ line-height: 22px;
7
+ }
8
+
9
+ [role='radiogroup'] .wallet-pass-display-config__scope {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 8px;
13
+
14
+ .wallet-pass-display-config__option {
15
+ margin: 0;
16
+ }
17
+ }
18
+
19
+ &__shops {
20
+ margin-top: 12px;
21
+ padding-left: 24px;
22
+
23
+ .wallet-pass-display-config__shop-select {
24
+ width: 100%;
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,18 @@
1
+ const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
2
+ const require_index = require("../../../../utils/index.js");
3
+ //#region src/plus/walletEditor/components/PassDisplayConfig/serve.ts
4
+ const getFranchiseeShops = function() {
5
+ var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
6
+ const { data } = yield require_index.request.getRequest().get("/shop/franchisor/shop", {
7
+ skip: 1,
8
+ num: 199,
9
+ status: "approved"
10
+ }, { isShopApi: true });
11
+ return data.list;
12
+ });
13
+ return function getFranchiseeShops() {
14
+ return _ref.apply(this, arguments);
15
+ };
16
+ }();
17
+ //#endregion
18
+ exports.getFranchiseeShops = getFranchiseeShops;
@@ -1,2 +1,2 @@
1
- import { MultiLanguageTitle, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType } from "./types.js";
1
+ import { MultiLanguageTitle, PassDisplayConfigValue, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType } from "./types.js";
2
2
  import { WalletEditor } from "./WalletEditor.js";
@@ -3,6 +3,14 @@ var locales_default = {
3
3
  en: {
4
4
  walletName: "Wallet name",
5
5
  validityPeriod: "Validity Period",
6
+ passesShownInWallet: "Passes shown in this Wallet:",
7
+ showPassesIssuedBy: "Show passes issued by:",
8
+ passIssuerCurrentShop: "Current store",
9
+ passIssuerAllShops: "All stores in the chain",
10
+ passIssuerSpecifiedShops: "Specified stores",
11
+ passIssuerSelectShops: "Select stores",
12
+ passIssuerShopsRequired: "Please select at least one store",
13
+ passIssuerLoadFailedRetry: "Failed to load stores. Click to retry.",
6
14
  linkedPasses: "Linked passes",
7
15
  linkedPassesDesc: "Select the passes that will be available in this Wallet.",
8
16
  sort: "Sort",
@@ -54,6 +62,14 @@ var locales_default = {
54
62
  "zh-CN": {
55
63
  walletName: "钱包名称",
56
64
  validityPeriod: "有效期",
65
+ passesShownInWallet: "此钱包中显示的卡券:",
66
+ showPassesIssuedBy: "显示由以下门店发放的卡券:",
67
+ passIssuerCurrentShop: "当前门店",
68
+ passIssuerAllShops: "连锁内所有门店",
69
+ passIssuerSpecifiedShops: "指定门店",
70
+ passIssuerSelectShops: "选择门店",
71
+ passIssuerShopsRequired: "请至少选择一个门店",
72
+ passIssuerLoadFailedRetry: "门店加载失败,点击重试",
57
73
  linkedPasses: "包含的卡券",
58
74
  linkedPassesDesc: "选择此 Wallet 中可展示与使用的卡券。",
59
75
  sort: "排序",
@@ -105,6 +121,14 @@ var locales_default = {
105
121
  "zh-HK": {
106
122
  walletName: "錢包名稱",
107
123
  validityPeriod: "有效期",
124
+ passesShownInWallet: "此錢包中顯示的卡券:",
125
+ showPassesIssuedBy: "顯示由以下門店發放的卡券:",
126
+ passIssuerCurrentShop: "目前門店",
127
+ passIssuerAllShops: "連鎖內所有門店",
128
+ passIssuerSpecifiedShops: "指定門店",
129
+ passIssuerSelectShops: "選擇門店",
130
+ passIssuerShopsRequired: "請至少選擇一個門店",
131
+ passIssuerLoadFailedRetry: "門店載入失敗,點擊重試",
108
132
  linkedPasses: "包含的卡券",
109
133
  linkedPassesDesc: "選擇此 Wallet 中可展示與使用的卡券。",
110
134
  sort: "排序",
@@ -156,6 +180,14 @@ var locales_default = {
156
180
  ja: {
157
181
  walletName: "ウォレット名",
158
182
  validityPeriod: "有効期間",
183
+ passesShownInWallet: "このウォレットに表示するパス:",
184
+ showPassesIssuedBy: "次の店舗が発行したパスを表示:",
185
+ passIssuerCurrentShop: "現在の店舗",
186
+ passIssuerAllShops: "チェーン内のすべての店舗",
187
+ passIssuerSpecifiedShops: "指定した店舗",
188
+ passIssuerSelectShops: "店舗を選択",
189
+ passIssuerShopsRequired: "店舗を1つ以上選択してください",
190
+ passIssuerLoadFailedRetry: "店舗を読み込めませんでした。クリックして再試行。",
159
191
  linkedPasses: "リンクされたパス",
160
192
  linkedPassesDesc: "このウォレットで利用可能なパスを選択します。",
161
193
  sort: "並び替え",
@@ -207,6 +239,14 @@ var locales_default = {
207
239
  pt: {
208
240
  walletName: "Nome da carteira",
209
241
  validityPeriod: "Período de Validade",
242
+ passesShownInWallet: "Passes exibidos nesta carteira:",
243
+ showPassesIssuedBy: "Mostrar passes emitidos por:",
244
+ passIssuerCurrentShop: "Loja atual",
245
+ passIssuerAllShops: "Todas as lojas da rede",
246
+ passIssuerSpecifiedShops: "Lojas específicas",
247
+ passIssuerSelectShops: "Selecionar lojas",
248
+ passIssuerShopsRequired: "Selecione pelo menos uma loja",
249
+ passIssuerLoadFailedRetry: "Falha ao carregar lojas. Clique para tentar novamente.",
210
250
  linkedPasses: "Passes vinculados",
211
251
  linkedPassesDesc: "Selecione os passes que estarão disponíveis nesta Carteira.",
212
252
  sort: "Ordenar",
@@ -26,6 +26,12 @@ interface SendConfig {
26
26
  type: string;
27
27
  [key: string]: any;
28
28
  }
29
+ /** 在原展示范围上追加子店卡券的配置。 */
30
+ interface PassDisplayConfigValue {
31
+ type: 'self' | 'all_franchisees' | 'selected_franchisees';
32
+ /** 仅 selected_franchisees 使用,其他模式忽略。 */
33
+ shop_ids?: number[];
34
+ }
29
35
  interface WalletMetadata {
30
36
  [key: string]: unknown;
31
37
  mobile_wallet_id?: string | number;
@@ -35,6 +41,7 @@ interface WalletMetadata {
35
41
  customerName?: string;
36
42
  coverImage?: string;
37
43
  send_config?: SendConfig;
44
+ pass_visibility?: PassDisplayConfigValue;
38
45
  }
39
46
  interface WalletEditorValue {
40
47
  id?: number | string;
@@ -59,4 +66,4 @@ interface WalletEditorProps {
59
66
  style?: React.CSSProperties;
60
67
  }
61
68
  //#endregion
62
- export { MultiLanguageTitle, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType };
69
+ export { MultiLanguageTitle, PassDisplayConfigValue, SendConfig, ShowcaseWalletPassItem, ValidForConfig, VirtualCurrencyInfo, WalletEditorProps, WalletEditorRef, WalletEditorValue, WalletMetadata, WalletPassType };