@feedmepos/mf-connect 0.1.0-beta.4 → 0.1.0-beta.40

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 (106) hide show
  1. package/dist/Analytic-DArrGnk-.js +426 -0
  2. package/dist/{App-BnQwjxIr.js → App-CxJaPSSE.js} +397 -384
  3. package/dist/{Broadcast-y1kP18mo.js → Broadcast-C5CtxHYC.js} +32 -32
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Dj0JUMOk.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DJAGRlyI.js} +6 -8
  5. package/dist/Card-ZsgNMrz5.js +894 -0
  6. package/dist/{Collections-DPfbZMg1.js → Collections-CodLm2hP.js} +28 -34
  7. package/dist/{Credit-QleM_b6q.js → Credit-8qliEPqA.js} +14 -14
  8. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DZOeB8YS.js +2209 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-2hRTF1EJ.js → EffectSheet.vue_vue_type_style_index_0_lang-Cf4nXUmp.js} +8 -8
  11. package/dist/{Experience-DGKj8ChY.js → Experience-DR0_RUqZ.js} +8 -8
  12. package/dist/{Game-BxRdzSma.js → Game-BZkQZDV_.js} +15 -15
  13. package/dist/Index-BP9YGCex.js +255 -0
  14. package/dist/Marketing-Bt-ViwTP.js +20070 -0
  15. package/dist/{Member-CteeBDi2.js → Member-DW_uVRyE.js} +4 -4
  16. package/dist/MemberList-BQcsV-Bz.js +1554 -0
  17. package/dist/MemberTransactions-xJaYPP7W.js +45 -0
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CZ2M8huU.js → MessageInput.vue_vue_type_script_setup_true_lang-Txp1lndf.js} +2 -2
  19. package/dist/{Mission-CZgXBa09.js → Mission-CQ2PlxLv.js} +98 -86
  20. package/dist/Overview-CWhTf5Tz.js +1063 -0
  21. package/dist/{Point-C2vzEfRP.js → Point-BCvUsXLl.js} +23 -23
  22. package/dist/{Promotion-337OT0sP.js → Promotion-CrROpksP.js} +53 -47
  23. package/dist/Record-B6RRMDQn.js +337 -0
  24. package/dist/Reward-CTZ3IllK.js +432 -0
  25. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-C19vRccs.js +149 -0
  26. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-C3irbjUK.js +1637 -0
  27. package/dist/Segment-h-HRoL19.js +566 -0
  28. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-D5kijSzp.js +181 -0
  29. package/dist/{Setting-DVK2594u.js → Setting-CZIFruFT.js} +8 -8
  30. package/dist/Store-CbjSMVfb.js +1743 -0
  31. package/dist/{StoreRewards-BpEmNueE.js → StoreRewards-zkEVickE.js} +12 -12
  32. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DU5v6oro.js +1099 -0
  33. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DT48bSiH.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-i_y1gFyL.js} +1 -1
  34. package/dist/{Tier-BwvOhyXR.js → Tier-BCgp2Ngt.js} +325 -317
  35. package/dist/{Title-DRPdKYRO.js → Title-CJNx0TkK.js} +197 -183
  36. package/dist/{Transaction-BnLvacwW.js → Transaction-DWvfvfsk.js} +2 -2
  37. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Dkln_L8k.js +130 -0
  38. package/dist/{Voucher-BQL8J_EA.js → Voucher-bYVNHe4l.js} +31 -31
  39. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BX0Fo_5O.js +419 -0
  40. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B316b_ta.js → ZodTextField.vue_vue_type_script_setup_true_lang-D5Idn8So.js} +1 -1
  41. package/dist/{app-BVaQwBvq.js → app-CdJSO9Ad.js} +1 -1
  42. package/dist/{app-zO552-Dl.js → app-fsxaQBSg.js} +1183 -1154
  43. package/dist/app.js +1 -1
  44. package/dist/{business-BSl6NSdS.js → business-CDeQ06qx.js} +1 -1
  45. package/dist/{campaign-CxN6mq_l.js → campaign-D8lQOOTp.js} +2 -2
  46. package/dist/campaign-Dwea7uho.js +1810 -0
  47. package/dist/campaign.enum-CF_gt52u.js +20 -0
  48. package/dist/campaign.fn-BavlaqB6.js +758 -0
  49. package/dist/collectible.enum-DVZRkRwR.js +19 -0
  50. package/dist/{collection.fn-C-2dyWp9.js → collection.fn-CIicjfIz.js} +2 -2
  51. package/dist/dto-CMkenMV_.js +214 -0
  52. package/dist/{effect-D8y0J47O.js → effect-IbJ225qB.js} +9 -9
  53. package/dist/email-addresses-LDTzLm79.js +705 -0
  54. package/dist/{export-BxTrifKO.js → export-BCSOuQ5g.js} +3 -3
  55. package/dist/{helper-bEmZlTwA.js → helper-BZxLzAuG.js} +1 -1
  56. package/dist/{index-B2qriSSk.js → index-0Lmb_8CU.js} +1 -1
  57. package/dist/{index-JBp0chol.js → index-B3r9-9qd.js} +1500 -1479
  58. package/dist/{index-BFWCbVq2.js → index-BVd0uPuT.js} +1 -1
  59. package/dist/{index-Dnv999nc.js → index-BtFnlSuJ.js} +1 -1
  60. package/dist/{index-Ckz-D_AP.js → index-BxrHVPJL.js} +2188 -931
  61. package/dist/index-C0VSGU1p.js +32 -0
  62. package/dist/{index-DuYb25dY.js → index-CYLAuP7e.js} +34 -4
  63. package/dist/index-CcpRLc8R.js +44 -0
  64. package/dist/index-CsaQJMAR.js +66 -0
  65. package/dist/index-CvW4f2DA.js +29000 -0
  66. package/dist/{index-DHTYWfTs.js → index-DG0LFjr2.js} +207 -195
  67. package/dist/index-DbmWadFy.js +54 -0
  68. package/dist/index-vh86FiIQ.js +10 -0
  69. package/dist/{index-C_WyKCqN.js → index-xoJ0Hv7u.js} +1 -1
  70. package/dist/{index.esm2017-Tw7KabwI.js → index.esm2017-CaKC72Zr.js} +33 -33
  71. package/dist/{loading-60xYxow_.js → loading-CmdIDK9W.js} +591 -597
  72. package/dist/{membership-43FU3EmV.js → membership-BKNbXD5h.js} +52 -44
  73. package/dist/money-DbuB1-Ff.js +15 -0
  74. package/dist/number-CJ4JetR2.js +12 -0
  75. package/dist/objectid-CSzIZWFn.js +145 -0
  76. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  77. package/dist/reward-BlvDqH4n.js +36 -0
  78. package/dist/{rule-DlHrKp8K.js → rule-Csn-Prz_.js} +180 -177
  79. package/dist/{rule-builder-CU8P8b8U.js → rule-builder-BKMY8R7O.js} +1 -1
  80. package/dist/style.css +1 -1
  81. package/dist/{template-9StyN-b7.js → template-DyhD97jJ.js} +5 -5
  82. package/dist/trigger-Cb8-87Qi.js +114 -0
  83. package/dist/{xlsx-CrRvm5Vs.js → usePagination-9TxpwvcN.js} +3183 -2962
  84. package/dist/user-Drjp-FP9.js +54 -0
  85. package/dist/{vue-i18n-UKlvivrG.js → vue-i18n-CDCNED_Y.js} +155 -155
  86. package/package.json +8 -7
  87. package/dist/Analytic-BtldByrt.js +0 -622
  88. package/dist/Card-kW7k8kOl.js +0 -825
  89. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BtI2rY4y.js +0 -2813
  90. package/dist/Marketing-CG4GQdax.js +0 -316
  91. package/dist/MemberList-CANkPyR0.js +0 -1733
  92. package/dist/MemberTransactions-CcCa21fY.js +0 -38
  93. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Dh3naMXv.js +0 -1753
  94. package/dist/Segment-Clstp5D-.js +0 -437
  95. package/dist/Store-PnpBvIoo.js +0 -1511
  96. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CrDhK2dt.js +0 -890
  97. package/dist/dto-B20bsdh6.js +0 -2770
  98. package/dist/index-BUCjM4jq.js +0 -29193
  99. package/dist/index-Ceu2PcnH.js +0 -206
  100. package/dist/index-CuvNtC_M.js +0 -61
  101. package/dist/index-D3DAgTFI.js +0 -762
  102. package/dist/index-Kjelmo0Y.js +0 -298
  103. package/dist/money-CmR3-qMz.js +0 -15
  104. package/dist/number-CZlrO6Sq.js +0 -12
  105. package/dist/usePagination-BeF5K3M7.js +0 -223
  106. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,432 @@
1
+ import { defineComponent as X, ref as x, computed as $, resolveComponent as f, openBlock as v, createBlock as U, unref as t, isRef as q, withCtx as A, createElementVNode as u, createVNode as d, createCommentVNode as k, createElementBlock as H, Fragment as Y, h as F, onMounted as G, toDisplayString as B } from "vue";
2
+ import { _ as z } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as Q, components as L } from "@feedmepos/ui-library";
4
+ import { f as j, u as J, p as ee } from "./loading-CmdIDK9W.js";
5
+ import { u as W, C as te } from "./membership-BKNbXD5h.js";
6
+ import { u as oe } from "./vue-i18n-CDCNED_Y.js";
7
+ import { c as ae } from "./object-qECH92oz.js";
8
+ import { Z as O } from "./zod-Bg2FbC-D.js";
9
+ import "./index-B3r9-9qd.js";
10
+ import { a as N } from "./index-DbmWadFy.js";
11
+ import { useCoreStore as le } from "@feedmepos/mf-common";
12
+ import { _ as ne, a as ie } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-BX0Fo_5O.js";
13
+ import { _ as re } from "./EffectSheet.vue_vue_type_style_index_0_lang-Cf4nXUmp.js";
14
+ import { J as K } from "./JsonViewer-v8_C7l5N.js";
15
+ import { _ as se } from "./ZodTextField.vue_vue_type_script_setup_true_lang-D5Idn8So.js";
16
+ import { i as de } from "./helper-BZxLzAuG.js";
17
+ import { u as ce, r as M } from "./reward-BlvDqH4n.js";
18
+ import "./index-BVd0uPuT.js";
19
+ import { C as pe } from "./campaign.fn-BavlaqB6.js";
20
+ import { e as me } from "./effect-IbJ225qB.js";
21
+ import { useRouter as ue } from "vue-router";
22
+ import { R as fe } from "./app-fsxaQBSg.js";
23
+ const ye = { class: "flex gap-8 items-center justify-start" }, we = /* @__PURE__ */ X({
24
+ __name: "EditRewardSheet",
25
+ emits: ["update"],
26
+ setup(Z, { expose: n, emit: I }) {
27
+ const p = W(), { minor: R } = J, y = x(!1), a = x({}), w = x(), g = $(() => {
28
+ var l;
29
+ return ((l = a.value.option) == null ? void 0 : l.collectibleType) === "CREDIT" ? N.superRefine((e, o) => {
30
+ var i, b, _, r;
31
+ !((b = (i = e.option) == null ? void 0 : i.validityOption) != null && b.validForDay) && !((r = (_ = e.option) == null ? void 0 : _.validityOption) != null && r.validBefore) && o.addIssue({
32
+ code: "custom",
33
+ path: [],
34
+ message: "Credit validity must be set"
35
+ });
36
+ }) : N;
37
+ }), m = $(() => {
38
+ const l = g.value.safeParse(a.value);
39
+ return l.success ? [] : l.error.errors;
40
+ });
41
+ function C(l, e) {
42
+ l && (a.value = e), y.value = l;
43
+ }
44
+ const D = I;
45
+ async function S() {
46
+ const l = g.value.safeParse(a.value);
47
+ !l.success || !l.data || (await R(
48
+ async () => {
49
+ var e;
50
+ l.data.option.type === "VOUCHER" && w.value && (l.data.option.collectibleConfig.image = await j.update(
51
+ ((e = l.data.option.collectibleConfig) == null ? void 0 : e.image) || j.collectibleImagePath(void 0, w.value),
52
+ w.value
53
+ ));
54
+ },
55
+ {
56
+ message: "Uploading reward image",
57
+ successMessage: "Reward image updated"
58
+ }
59
+ ), D("update", l.data));
60
+ }
61
+ function V(l) {
62
+ l === "VOUCHER" ? a.value.option = {
63
+ collectible: null,
64
+ type: "VOUCHER",
65
+ collectibleConfig: de("VOUCHER", {
66
+ business: le().currentBusiness.value._id
67
+ }),
68
+ earningOption: {
69
+ amount: 1,
70
+ type: "FIXED"
71
+ },
72
+ validityOption: {
73
+ validForDay: 7
74
+ }
75
+ } : a.value.option = {
76
+ collectible: p.loyaltyRewards.raw[0]._id,
77
+ collectibleType: p.loyaltyRewards.raw[0].type,
78
+ type: "LOYALTY",
79
+ earningOption: {
80
+ amount: 1,
81
+ type: "FIXED"
82
+ },
83
+ validityOption: {
84
+ validForDay: 7
85
+ }
86
+ };
87
+ }
88
+ function P(l) {
89
+ a.value.option.collectible = l, a.value.option.collectibleType = p.loyaltyRewards.raw.find(
90
+ (e) => e._id === l
91
+ ).type;
92
+ }
93
+ const h = x();
94
+ return n({
95
+ showSheet: C
96
+ }), (l, e) => {
97
+ const o = f("FmSelect"), i = f("FmForm"), b = f("FmButton"), _ = f("FmSideSheet");
98
+ return v(), U(_, {
99
+ "max-width": 560,
100
+ modelValue: t(y),
101
+ "onUpdate:modelValue": [
102
+ e[8] || (e[8] = (r) => q(y) ? y.value = r : null),
103
+ e[9] || (e[9] = (r) => y.value = r)
104
+ ],
105
+ header: "Edit reward"
106
+ }, {
107
+ "side-sheet-footer": A(() => [
108
+ u("div", ye, [
109
+ d(b, {
110
+ variant: "primary",
111
+ type: "button",
112
+ label: "Confirm",
113
+ disabled: t(m).length > 0,
114
+ onClick: e[6] || (e[6] = (r) => S())
115
+ }, null, 8, ["disabled"]),
116
+ d(b, {
117
+ variant: "secondary",
118
+ type: "button",
119
+ label: "Cancel",
120
+ onClick: e[7] || (e[7] = (r) => y.value = !1)
121
+ })
122
+ ])
123
+ ]),
124
+ default: A(() => [
125
+ d(K, { json: t(a) }, null, 8, ["json"]),
126
+ d(i, {
127
+ class: "flex flex-col gap-y-24",
128
+ ref_key: "formRef",
129
+ ref: h,
130
+ onValidationSuccess: e[5] || (e[5] = (r) => S())
131
+ }, {
132
+ default: A(() => {
133
+ var r, E, c;
134
+ return [
135
+ d(se, {
136
+ modelValue: t(a).name,
137
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => t(a).name = s),
138
+ label: "Reward Name",
139
+ schema: t(O).typeAtPath(t(g), "name", []),
140
+ "error-text": t(O).helperText(t(m), "name")
141
+ }, null, 8, ["modelValue", "schema", "error-text"]),
142
+ d(o, {
143
+ label: "Reward Type",
144
+ disabled: !!t(a)._id,
145
+ items: [
146
+ { label: "Voucher", value: "VOUCHER" },
147
+ { label: "Loyalty", value: "LOYALTY" }
148
+ ],
149
+ "model-value": t(a).option.type,
150
+ "onUpdate:modelValue": V
151
+ }, null, 8, ["disabled", "model-value"]),
152
+ t(a).option.type == "LOYALTY" ? (v(), U(o, {
153
+ key: 0,
154
+ label: "Loyalty type",
155
+ items: t(p).loyaltyRewards.items,
156
+ "model-value": t(a).option.collectible,
157
+ "onUpdate:modelValue": P
158
+ }, null, 8, ["items", "model-value"])) : k("", !0),
159
+ t(a).option.type === "LOYALTY" ? (v(), H(Y, { key: 1 }, [
160
+ e[10] || (e[10] = u("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
161
+ ((r = t(p).loyaltyRewards.items.find(
162
+ (s) => {
163
+ var T;
164
+ return s.value === ((T = t(a)) == null ? void 0 : T.option.collectible);
165
+ }
166
+ )) == null ? void 0 : r.raw.type) !== "TITLE" ? (v(), U(ne, {
167
+ key: 0,
168
+ class: "mt-[-8px]",
169
+ rules: [
170
+ t(O).ruleAtPath(t(g), "option.earningOption", [
171
+ t(a).option.type
172
+ ])
173
+ ],
174
+ "helper-state": t(O).helperState(t(m), "option.earningOption"),
175
+ "error-text": t(O).helperText(t(m), "option.earningOption"),
176
+ "fixed-type": !0,
177
+ "model-value": t(a).option.earningOption,
178
+ "onUpdate:modelValue": e[1] || (e[1] = (s) => t(a).option.earningOption = s)
179
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"])) : k("", !0),
180
+ d(re, {
181
+ class: "!gap-24",
182
+ "for-credit": t(a).option.type === "LOYALTY" && ((E = t(p).loyaltyRewards.items.find(
183
+ (s) => {
184
+ var T;
185
+ return s.value === ((T = t(a).option) == null ? void 0 : T.collectible);
186
+ }
187
+ )) == null ? void 0 : E.raw.type) === "CREDIT",
188
+ rules: [
189
+ t(O).ruleAtPath(t(g), "option.validityOption", [
190
+ t(a).option.type
191
+ ])
192
+ ],
193
+ "model-value": t(a).option.validityOption,
194
+ "onUpdate:modelValue": e[2] || (e[2] = (s) => t(a).option.validityOption = s)
195
+ }, null, 8, ["for-credit", "rules", "model-value"])
196
+ ], 64)) : k("", !0),
197
+ t(a).option.type === "VOUCHER" ? (v(), U(ie, {
198
+ key: 2,
199
+ "reward-image": t(w),
200
+ "model-value": ((c = t(a)) == null ? void 0 : c.option.collectibleConfig) ?? void 0,
201
+ "onUpdate:modelValue": e[3] || (e[3] = (s) => t(a).option.collectibleConfig = s),
202
+ "onUpdate:rewardImage": e[4] || (e[4] = (s) => w.value = s)
203
+ }, null, 8, ["reward-image", "model-value"])) : k("", !0),
204
+ d(K, { json: t(m) }, null, 8, ["json"])
205
+ ];
206
+ }),
207
+ _: 1
208
+ }, 512)
209
+ ]),
210
+ _: 1
211
+ }, 8, ["modelValue"]);
212
+ };
213
+ }
214
+ }), ve = { class: "px-24 flex flex-col gap-y-16" }, ge = { class: "flex items-center justify-between w-full" }, be = { class: "flex flex-col gap-16 text-center" }, Re = { class: "fm-typo-en-title-sm-800" }, Ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ne = /* @__PURE__ */ X({
215
+ __name: "Reward",
216
+ setup(Z) {
217
+ const { t: n } = oe(), I = {
218
+ label: n("connect.storeRewards.create"),
219
+ value: "create",
220
+ isPrimary: !0,
221
+ prependIcon: "add"
222
+ }, p = W(), R = ce(), { global: y, minor: a } = J, w = ue(), g = Q(), m = x({
223
+ searchKey: "",
224
+ columnFilters: []
225
+ }), C = $(() => R.rewards);
226
+ function D(e) {
227
+ w.push({
228
+ name: fe["$connect-STORE_REWARD_COLLECTIONS"],
229
+ params: { id: e }
230
+ });
231
+ }
232
+ const S = [
233
+ {
234
+ header: n("connect.storeRewards.table.name"),
235
+ accessorFn: (e) => e.name
236
+ },
237
+ {
238
+ header: n("connect.storeRewards.table.type"),
239
+ cell(e) {
240
+ return e.row.original.collectibleConfig ? te[e.row.original.collectibleConfig.type].chip() : "N/A";
241
+ }
242
+ },
243
+ {
244
+ header: n("connect.storeRewards.table.summary"),
245
+ accessorFn: (e) => {
246
+ var o, i;
247
+ return e.option.type === "VOUCHER" ? me((i = (o = e.option.collectibleConfig) == null ? void 0 : o.extras) == null ? void 0 : i.effect) : `Get ${e.option.earningOption.amount} ${pe.formattedType(e.option.collectibleType)}`;
248
+ }
249
+ },
250
+ {
251
+ header: n("connect.storeRewards.table.actions"),
252
+ cell(e) {
253
+ return F("div", { class: "flex items-center justify-end gap-4" }, [
254
+ F(
255
+ L.FmMenu,
256
+ {
257
+ placement: "bottom-end",
258
+ onClick: (o) => {
259
+ o.stopPropagation();
260
+ }
261
+ },
262
+ {
263
+ "menu-button": () => F(L.FmButton, {
264
+ icon: "more_vert",
265
+ iconColor: "neutral-gray-400",
266
+ variant: "tertiary"
267
+ }),
268
+ default: () => [
269
+ e.row.original.option.type === "VOUCHER" && F(L.FmMenuItem, {
270
+ label: "View collections",
271
+ onClick: async (o) => {
272
+ o.stopPropagation(), D(
273
+ e.row.original.option.collectible
274
+ );
275
+ }
276
+ }),
277
+ F(
278
+ L.FmMenuItem,
279
+ {
280
+ onClick: async (o) => {
281
+ o.stopPropagation(), P(e.row.original);
282
+ }
283
+ },
284
+ {
285
+ label: F(
286
+ "div",
287
+ {
288
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
289
+ },
290
+ "Delete"
291
+ )
292
+ }
293
+ )
294
+ ]
295
+ }
296
+ )
297
+ ]);
298
+ }
299
+ }
300
+ ], V = x();
301
+ async function P(e) {
302
+ await ee.remove(
303
+ n("connect.storeRewards.delete.confirm"),
304
+ n("connect.storeRewards.delete.title")
305
+ ) && await a(
306
+ async () => {
307
+ await M.deleteReward(e._id), await R.readRewards();
308
+ },
309
+ {
310
+ message: n("connect.storeRewards.delete.message"),
311
+ successMessage: n("connect.storeRewards.delete.success")
312
+ }
313
+ );
314
+ }
315
+ async function h(e) {
316
+ var o;
317
+ e || (e = {
318
+ name: "",
319
+ option: {
320
+ type: "LOYALTY",
321
+ collectible: p.loyaltyRewards.items[0].value,
322
+ collectibleType: p.loyaltyRewards.items[0].raw.type,
323
+ validityOption: {
324
+ validForDay: 7
325
+ },
326
+ earningOption: {
327
+ type: "FIXED",
328
+ amount: 1
329
+ }
330
+ }
331
+ }), (o = V.value) == null || o.showSheet(!0, ae(e));
332
+ }
333
+ async function l(e) {
334
+ let o = !1;
335
+ e._id && e.option.type === "VOUCHER" && await new Promise((i) => {
336
+ g.open({
337
+ title: "Confirmation",
338
+ message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
339
+ primaryActions: { text: "Update all", close: !0 },
340
+ secondaryActions: { text: "Update future only", close: !0 }
341
+ }).onPrimary(async () => {
342
+ o = !0, i();
343
+ }).onSecondary(async () => {
344
+ i();
345
+ });
346
+ }), await a(
347
+ async () => {
348
+ var i;
349
+ e.collectibleConfig = void 0, e._id ? await M.updateReward(e._id, {
350
+ ...e,
351
+ updateCollection: o
352
+ }) : await M.createReward(e), await R.readRewards(), (i = V.value) == null || i.showSheet(!1);
353
+ },
354
+ {
355
+ message: "Updating reward",
356
+ successMessage: "Reward updated successfully"
357
+ }
358
+ );
359
+ }
360
+ return G(async () => {
361
+ await y(async () => {
362
+ await p.readMembership(), await p.readRewards(), await R.readRewards();
363
+ });
364
+ }), (e, o) => {
365
+ const i = f("FmPageHead"), b = f("FmSearch"), _ = f("FmTable"), r = f("FmButton"), E = f("FmCard");
366
+ return v(), H(Y, null, [
367
+ d(i, {
368
+ title: t(n)("connect.reward.title"),
369
+ actions: [I],
370
+ "back-button": !0,
371
+ "onClick:action": o[0] || (o[0] = () => h()),
372
+ "onClick:back": o[1] || (o[1] = () => {
373
+ var c;
374
+ return (c = t(w)) == null ? void 0 : c.back();
375
+ })
376
+ }, null, 8, ["title", "actions"]),
377
+ u("div", ve, [
378
+ t(C) && t(C).length > 0 ? (v(), H(Y, { key: 0 }, [
379
+ u("div", ge, [
380
+ o[6] || (o[6] = u("div", { class: "flex gap-8" }, null, -1)),
381
+ d(b, {
382
+ modelValue: t(m).searchKey,
383
+ "onUpdate:modelValue": o[2] || (o[2] = (c) => t(m).searchKey = c),
384
+ class: "",
385
+ placeholder: "search",
386
+ collapsible: ""
387
+ }, null, 8, ["modelValue"])
388
+ ]),
389
+ d(_, {
390
+ "row-data": t(C),
391
+ "column-defs": S,
392
+ "search-value": t(m).searchKey,
393
+ "column-filter": t(m).columnFilters,
394
+ onRowClick: o[3] || (o[3] = (c) => h(c.original)),
395
+ "hide-footer": t(C).length < 10
396
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
397
+ ], 64)) : (v(), U(E, {
398
+ key: 1,
399
+ variant: "outlined",
400
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
401
+ }, {
402
+ default: A(() => [
403
+ o[7] || (o[7] = u("img", {
404
+ src: z,
405
+ class: "aspect-square w-[150px]"
406
+ }, null, -1)),
407
+ u("div", be, [
408
+ u("div", Re, B(t(n)("connect.storeRewards.empty.title")), 1),
409
+ u("div", Ce, B(t(n)("connect.storeRewards.empty.description")), 1)
410
+ ]),
411
+ d(r, {
412
+ variant: "primary",
413
+ label: t(n)("connect.storeRewards.empty.action"),
414
+ onClick: o[4] || (o[4] = (c) => h()),
415
+ icon: "add"
416
+ }, null, 8, ["label"])
417
+ ]),
418
+ _: 1
419
+ })),
420
+ d(we, {
421
+ ref_key: "rewardSheetRef",
422
+ ref: V,
423
+ onUpdate: o[5] || (o[5] = (c) => l(c))
424
+ }, null, 512)
425
+ ])
426
+ ], 64);
427
+ };
428
+ }
429
+ });
430
+ export {
431
+ Ne as default
432
+ };
@@ -0,0 +1,149 @@
1
+ import { ref as p, defineComponent as T, computed as x, resolveComponent as y, openBlock as U, createBlock as G, unref as e, isRef as $, withCtx as b, createElementVNode as v, createVNode as u, toDisplayString as j } from "vue";
2
+ import { u as B } from "./loading-CmdIDK9W.js";
3
+ import { J as P } from "./JsonViewer-v8_C7l5N.js";
4
+ import { _ as D } from "./ZodTextField.vue_vue_type_script_setup_true_lang-D5Idn8So.js";
5
+ import { _ as I } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-Dkln_L8k.js";
6
+ import { Z as L } from "./zod-Bg2FbC-D.js";
7
+ import { u as V } from "./app-wDQR6dpb.js";
8
+ import { defineStore as N } from "pinia";
9
+ import { r as k } from "./index-C0VSGU1p.js";
10
+ import "./index-BxrHVPJL.js";
11
+ import "./index-B3r9-9qd.js";
12
+ import { c as E } from "./index-DG0LFjr2.js";
13
+ import "./index-0Lmb_8CU.js";
14
+ import "./index-DbmWadFy.js";
15
+ import { u as J } from "./vue-i18n-CDCNED_Y.js";
16
+ import { c as C } from "./object-qECH92oz.js";
17
+ import { useDialog as Z } from "@feedmepos/ui-library";
18
+ const A = N("mf-connect-referral", () => {
19
+ const h = p();
20
+ return {
21
+ readReferralProgram: async () => {
22
+ const c = await k.read();
23
+ h.value = c;
24
+ },
25
+ referralProgram: h
26
+ };
27
+ }), H = { class: "flex flex-col space-y-16 pr-12" }, M = { class: "fm-typo-en-title-sm-800" }, O = { class: "flex items-center gap-8" }, W = /* @__PURE__ */ T({
28
+ __name: "EditReferralTierSheet",
29
+ emits: ["update"],
30
+ setup(h, { expose: _, emit: c }) {
31
+ const { t: n } = J(), m = c, s = p(!1), a = p({}), i = p(-1), w = A(), o = E.superRefine((r, t) => {
32
+ r.name.length >= 50 && t.addIssue({
33
+ code: "custom",
34
+ message: "Name must be less than 50 characters"
35
+ });
36
+ }), l = x(() => {
37
+ const r = o.safeParse(a.value);
38
+ return r.success ? [] : r.error.errors;
39
+ });
40
+ function R() {
41
+ const r = o.safeParse(a.value);
42
+ r.success && m("update", i.value, r.data);
43
+ }
44
+ function d(r, t) {
45
+ var f;
46
+ s.value = r, r && typeof t == "number" && t >= 0 ? (i.value = t, a.value = C(
47
+ (f = w.referralProgram) == null ? void 0 : f.reward[t]
48
+ )) : (i.value = -1, a.value = {
49
+ id: (/* @__PURE__ */ new Date()).toISOString(),
50
+ name: "",
51
+ rewards: [],
52
+ rule: void 0
53
+ });
54
+ }
55
+ function g(r) {
56
+ a.value.rule = r;
57
+ }
58
+ return _({
59
+ showSheet: d,
60
+ data: a
61
+ }), (r, t) => {
62
+ const f = y("FmButton"), F = y("FmSideSheet");
63
+ return U(), G(F, {
64
+ "max-width": 1e3,
65
+ modelValue: e(s),
66
+ "onUpdate:modelValue": t[2] || (t[2] = (S) => $(s) ? s.value = S : null),
67
+ header: `${e(i) == -1 ? e(n)("connect.referral.editReferralTierSheet.create") : e(n)("connect.referral.editReferralTierSheet.edit")}`
68
+ }, {
69
+ "side-sheet-footer": b(() => [
70
+ v("div", O, [
71
+ u(f, {
72
+ label: e(n)("connect.editTierSheet.submit"),
73
+ onClick: R,
74
+ disabled: e(l).length > 0 || e(V)().isLoading,
75
+ loading: e(V)().isLoading
76
+ }, null, 8, ["label", "disabled", "loading"]),
77
+ u(f, {
78
+ label: e(n)("connect.editTierSheet.cancel"),
79
+ onClick: t[1] || (t[1] = (S) => d(!1)),
80
+ variant: "tertiary"
81
+ }, null, 8, ["label"])
82
+ ])
83
+ ]),
84
+ default: b(() => [
85
+ u(P, { json: e(a) }, null, 8, ["json"]),
86
+ u(P, { json: e(l) }, null, 8, ["json"]),
87
+ v("div", H, [
88
+ u(D, {
89
+ modelValue: e(a).name,
90
+ "onUpdate:modelValue": t[0] || (t[0] = (S) => e(a).name = S),
91
+ label: e(n)("connect.referral.editReferralTierSheet.name"),
92
+ schema: e(L).typeAtPath(e(o), "name")
93
+ }, null, 8, ["modelValue", "label", "schema"]),
94
+ v("div", M, j(e(n)("connect.referral.editReferralTierSheet.target_audience")), 1),
95
+ u(I, {
96
+ "model-value": e(a).rule,
97
+ "onUpdate:modelValue": g
98
+ }, null, 8, ["model-value"])
99
+ ])
100
+ ]),
101
+ _: 1
102
+ }, 8, ["modelValue", "header"]);
103
+ };
104
+ }
105
+ }), me = /* @__PURE__ */ T({
106
+ __name: "RewardGroup",
107
+ setup(h, { expose: _ }) {
108
+ const { minor: c } = B, n = Z(), m = A(), s = x(() => {
109
+ var o;
110
+ return ((o = m.referralProgram) == null ? void 0 : o.reward) ?? [];
111
+ }), a = p(null);
112
+ function i(o) {
113
+ var l;
114
+ (l = a.value) == null || l.showSheet(!0, o);
115
+ }
116
+ _({
117
+ onManageRewardGroup: i
118
+ });
119
+ async function w(o, l) {
120
+ var r;
121
+ const R = o == -1 ? s.value.length : o, d = C(m.referralProgram);
122
+ d.reward[R] = l;
123
+ let g = !1;
124
+ await new Promise((t) => {
125
+ n.open({
126
+ title: "Confirmation",
127
+ message: "This will change all referral settings? Would you like to update previous referral record?",
128
+ primaryActions: { text: "Update all", close: !0 },
129
+ secondaryActions: { text: "Update future only", close: !0 }
130
+ }).onPrimary(async () => {
131
+ g = !0, t();
132
+ }).onSecondary(async () => {
133
+ t();
134
+ });
135
+ }), await c(async () => {
136
+ await k.update({ ...d, updateReferralRecord: g }), await m.readReferralProgram();
137
+ }), (r = a.value) == null || r.showSheet(!1);
138
+ }
139
+ return (o, l) => (U(), G(W, {
140
+ ref_key: "editReferralTierSheetRef",
141
+ ref: a,
142
+ onUpdate: w
143
+ }, null, 512));
144
+ }
145
+ });
146
+ export {
147
+ me as _,
148
+ A as u
149
+ };