@feedmepos/mf-connect 0.1.56-prod → 0.1.58-prod

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 (128) hide show
  1. package/package.json +1 -1
  2. package/dist/Analytic-XUI4rZyP.js +0 -427
  3. package/dist/App-vv5J1Ebe.js +0 -4630
  4. package/dist/Bin-D4V36uXK.js +0 -166
  5. package/dist/Broadcast-BvW27G77.js +0 -233
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D2MC6Gy1.js +0 -121
  7. package/dist/Card-C7xLv1Fb.js +0 -911
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  9. package/dist/Collections-BKfS-bGL.js +0 -458
  10. package/dist/Credit-CGmWQq0t.js +0 -228
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C2p6_R01.js +0 -2194
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BGlaqjWp.js +0 -348
  14. package/dist/Experience-CT7Yab3W.js +0 -229
  15. package/dist/FileSaver.min-NlMItPOc.js +0 -74
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  17. package/dist/Game-DtW4rtYQ.js +0 -284
  18. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +0 -144
  19. package/dist/Index-Bs5ob9Km.js +0 -259
  20. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  21. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +0 -18737
  22. package/dist/MainLayout-B1aJoR95.js +0 -41
  23. package/dist/Marketing-tA350rTd.js +0 -319
  24. package/dist/Member-CZoTXgKz.js +0 -279
  25. package/dist/MemberList-ChwyPtmW.js +0 -1607
  26. package/dist/MemberOverview-wL_ailso.js +0 -58
  27. package/dist/MemberTransactions-Cchtvxm9.js +0 -45
  28. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Bo0EnHBx.js +0 -60553
  29. package/dist/Mission-DDpelLqN.js +0 -302
  30. package/dist/Overview-Da3ewBat.js +0 -1079
  31. package/dist/Point-CggE8VUk.js +0 -232
  32. package/dist/Promotion-DxvbZhgQ.js +0 -289
  33. package/dist/Queue-fIxlHrMd.js +0 -260
  34. package/dist/Record-Bv90_VUG.js +0 -341
  35. package/dist/Reward-BWYLk7aC.js +0 -442
  36. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CjYEtENe.js +0 -150
  37. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Ak1R8Y2a.js +0 -1763
  38. package/dist/Segment-_VGdBy3a.js +0 -882
  39. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-Dm4hF1n1.js +0 -181
  40. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DWDMhmNr.js +0 -188
  41. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-Czy25PII.js +0 -147
  42. package/dist/Setting-7fTz1dJa.js +0 -1936
  43. package/dist/Store-TQHKR__B.js +0 -1842
  44. package/dist/StoreRewards-DZy1ZwiI.js +0 -423
  45. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cae25Vr6.js +0 -995
  46. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BVVEzpyP.js +0 -139
  47. package/dist/Tier-CK53vdbl.js +0 -895
  48. package/dist/Title-CGWPq_FF.js +0 -566
  49. package/dist/Transaction-DjJ03PfX.js +0 -39
  50. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-DNSdyxrF.js +0 -130
  51. package/dist/Voucher-D6RuJjNn.js +0 -384
  52. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-D4iCOq3V.js +0 -419
  53. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-BFz8RvY_.js +0 -56
  54. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  55. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  56. package/dist/app-BLlAxdVk.js +0 -57962
  57. package/dist/app-_rmIFJ8M.js +0 -7057
  58. package/dist/app-wDQR6dpb.js +0 -39
  59. package/dist/app.js +0 -6
  60. package/dist/business-gJ9fK_2b.js +0 -82
  61. package/dist/campaign-BfznfcHc.js +0 -94
  62. package/dist/campaign-C_Yq-ffV.js +0 -1810
  63. package/dist/campaign-CpzFl8Vr.js +0 -4
  64. package/dist/campaign.enum-Dsbpz7BO.js +0 -20
  65. package/dist/campaign.fn-C6vKb-lp.js +0 -758
  66. package/dist/collectible.enum-DNpj_oyC.js +0 -19
  67. package/dist/collection.fn-Cgo0sPL2.js +0 -26
  68. package/dist/dto-CaSQ4Pp9.js +0 -216
  69. package/dist/effect-DuH74x-N.js +0 -78
  70. package/dist/email-addresses-DXr-Qqt9.js +0 -705
  71. package/dist/export-tMPFlVV0.js +0 -97
  72. package/dist/feedme.ico +0 -0
  73. package/dist/helper-CJTseW10.js +0 -71
  74. package/dist/index-8RETBwYy.js +0 -8861
  75. package/dist/index-B57kxqv7.js +0 -3
  76. package/dist/index-BNUuy_4R.js +0 -44
  77. package/dist/index-BSJ-4JYy.js +0 -146
  78. package/dist/index-BTpBLMHl.js +0 -3070
  79. package/dist/index-C6Iyn1Q6.js +0 -54
  80. package/dist/index-CWI06v9e.js +0 -31
  81. package/dist/index-CdnKwJuz.js +0 -30076
  82. package/dist/index-Cr_9Bqa1.js +0 -121
  83. package/dist/index-CuvNtC_M.js +0 -61
  84. package/dist/index-DTyfvK3U.js +0 -2130
  85. package/dist/index-Dn0gJspN.js +0 -32269
  86. package/dist/index-IHKkNyxb.js +0 -38
  87. package/dist/index-J3TDCX-5.js +0 -76
  88. package/dist/index-V9kRRAB1.js +0 -32
  89. package/dist/index-vh86FiIQ.js +0 -10
  90. package/dist/index.esm2017-P2nmohVw.js +0 -3069
  91. package/dist/loading-D5ZAAdUU.js +0 -71
  92. package/dist/lodash-B5I3zXaY.js +0 -3678
  93. package/dist/membership-xl9aKOQ_.js +0 -235
  94. package/dist/moment-D7p2TMB-.js +0 -2583
  95. package/dist/money-CIHN3jJZ.js +0 -15
  96. package/dist/number-BN4-Jdog.js +0 -12
  97. package/dist/object-qECH92oz.js +0 -26
  98. package/dist/objectId-dwaoBfJX.js +0 -7
  99. package/dist/objectid-Dh6RD0Tk.js +0 -145
  100. package/dist/plugins-CJlgzIv2.js +0 -208
  101. package/dist/reward-C8mezXzs.js +0 -36
  102. package/dist/rule-9VRIJFHZ.js +0 -1951
  103. package/dist/rule-builder-CZUgrDAw.js +0 -102
  104. package/dist/style.css +0 -4
  105. package/dist/template-aPJnNGLi.js +0 -190
  106. package/dist/tier-BJDhpH6X.js +0 -4
  107. package/dist/tiers/tier=1.png +0 -0
  108. package/dist/tiers/tier=2.png +0 -0
  109. package/dist/tiers/tier=3.png +0 -0
  110. package/dist/tiers/tier=4.png +0 -0
  111. package/dist/timezone-CpvXaiqq.js +0 -1151
  112. package/dist/titles/type=diamond.png +0 -0
  113. package/dist/titles/type=drinks.png +0 -0
  114. package/dist/titles/type=food.png +0 -0
  115. package/dist/titles/type=heart.png +0 -0
  116. package/dist/titles/type=medal.png +0 -0
  117. package/dist/titles/type=spend.png +0 -0
  118. package/dist/titles/type=thank-you.png +0 -0
  119. package/dist/titles/type=thumbs-up.png +0 -0
  120. package/dist/titles/type=years.png +0 -0
  121. package/dist/trigger-BfrtcBd-.js +0 -144
  122. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  123. package/dist/type_drinks-D6jnpvwV.js +0 -4
  124. package/dist/usePagination-Ds-cuHop.js +0 -223
  125. package/dist/user-Bt1C0yV5.js +0 -54
  126. package/dist/vue-i18n-OdHHHpEE.js +0 -2365
  127. package/dist/xlsx-BgB0dYfE.js +0 -15491
  128. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -1,442 +0,0 @@
1
- import { defineComponent as X, ref as x, computed as H, resolveComponent as w, openBlock as b, createBlock as h, unref as t, isRef as Z, withCtx as A, createElementVNode as f, createVNode as d, createCommentVNode as k, createElementBlock as M, Fragment as Y, h as O, onMounted as q, 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 { u as G } from "./loading-D5ZAAdUU.js";
5
- import { u as J, C as ee } from "./membership-xl9aKOQ_.js";
6
- import { f as j, p as te } from "./plugins-CJlgzIv2.js";
7
- import { u as oe } from "./vue-i18n-OdHHHpEE.js";
8
- import { c as ae } from "./object-qECH92oz.js";
9
- import { Z as _ } from "./zod-Bg2FbC-D.js";
10
- import "./index-8RETBwYy.js";
11
- import { F as N } from "./index-C6Iyn1Q6.js";
12
- import { useCoreStore as le } from "@feedmepos/mf-common";
13
- import { _ as ne, a as ie } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-D4iCOq3V.js";
14
- import { b as re } from "./EffectSheet.vue_vue_type_style_index_0_lang-BGlaqjWp.js";
15
- import { J as K } from "./JsonViewer-v8_C7l5N.js";
16
- import { _ as se } from "./ZodTextField.vue_vue_type_script_setup_true_lang-BFz8RvY_.js";
17
- import { i as de } from "./helper-CJTseW10.js";
18
- import { u as pe, r as P } from "./reward-C8mezXzs.js";
19
- import "./index-B57kxqv7.js";
20
- import { C as ce } from "./campaign.fn-C6vKb-lp.js";
21
- import { e as me } from "./effect-DuH74x-N.js";
22
- import { useRouter as ue } from "vue-router";
23
- import { R as ye } from "./app-_rmIFJ8M.js";
24
- const fe = { class: "flex gap-8 items-center justify-start" }, we = /* @__PURE__ */ X({
25
- __name: "EditRewardSheet",
26
- emits: ["update"],
27
- setup(W, { expose: n, emit: I }) {
28
- const p = J(), { minor: C } = G, v = x(!1), a = x({}), y = x(), R = H(() => {
29
- var l;
30
- return ((l = a.value.option) == null ? void 0 : l.collectibleType) === "CREDIT" ? N.superRefine((e, o) => {
31
- var i, m, g, r;
32
- !((m = (i = e.option) == null ? void 0 : i.validityOption) != null && m.validForDay) && !((r = (g = e.option) == null ? void 0 : g.validityOption) != null && r.validBefore) && o.addIssue({
33
- code: "custom",
34
- path: [],
35
- message: "Credit validity must be set"
36
- });
37
- }) : N;
38
- }), u = H(() => {
39
- const l = R.value.safeParse(a.value);
40
- return l.success ? [] : l.error.errors;
41
- });
42
- function F(l, e) {
43
- l && (y.value = void 0, a.value = e), v.value = l;
44
- }
45
- const D = I;
46
- async function S() {
47
- const l = R.value.safeParse(a.value);
48
- !l.success || !l.data || (await C(
49
- async () => {
50
- var e;
51
- l.data.option.type === "VOUCHER" && y.value && (l.data.option.collectibleConfig.image = await j.update(
52
- ((e = l.data.option.collectibleConfig) == null ? void 0 : e.image) || j.collectibleImagePath(void 0, y.value),
53
- y.value
54
- ));
55
- },
56
- {
57
- message: "Uploading reward image",
58
- successMessage: "Reward image updated"
59
- }
60
- ), D("update", l.data));
61
- }
62
- function T(l) {
63
- l === "VOUCHER" ? a.value.option = {
64
- collectible: null,
65
- type: "VOUCHER",
66
- collectibleConfig: de("VOUCHER", {
67
- business: le().currentBusiness.value._id
68
- }),
69
- earningOption: {
70
- amount: 1,
71
- type: "FIXED"
72
- },
73
- validityOption: {
74
- validForDay: 7
75
- }
76
- } : a.value.option = {
77
- collectible: p.loyaltyRewards.raw[0]._id,
78
- collectibleType: p.loyaltyRewards.raw[0].type,
79
- type: "LOYALTY",
80
- earningOption: {
81
- amount: 1,
82
- type: "FIXED"
83
- },
84
- validityOption: {
85
- validForDay: 7
86
- }
87
- };
88
- }
89
- function $(l) {
90
- a.value.option.collectible = l, a.value.option.collectibleType = p.loyaltyRewards.raw.find(
91
- (e) => e._id === l
92
- ).type;
93
- }
94
- const V = x();
95
- return n({
96
- showSheet: F
97
- }), (l, e) => {
98
- const o = w("FmSelect"), i = w("FmForm"), m = w("FmButton"), g = w("FmSideSheet");
99
- return b(), h(g, {
100
- "max-width": 560,
101
- modelValue: t(v),
102
- "onUpdate:modelValue": [
103
- e[8] || (e[8] = (r) => Z(v) ? v.value = r : null),
104
- e[9] || (e[9] = (r) => v.value = r)
105
- ],
106
- header: "Edit reward"
107
- }, {
108
- "side-sheet-footer": A(() => [
109
- f("div", fe, [
110
- d(m, {
111
- variant: "primary",
112
- type: "button",
113
- label: "Confirm",
114
- disabled: t(u).length > 0,
115
- onClick: e[6] || (e[6] = (r) => S())
116
- }, null, 8, ["disabled"]),
117
- d(m, {
118
- variant: "secondary",
119
- type: "button",
120
- label: "Cancel",
121
- onClick: e[7] || (e[7] = (r) => v.value = !1)
122
- })
123
- ])
124
- ]),
125
- default: A(() => [
126
- d(K, { json: t(a) }, null, 8, ["json"]),
127
- d(i, {
128
- class: "flex flex-col gap-y-24",
129
- ref_key: "formRef",
130
- ref: V,
131
- onValidationSuccess: e[5] || (e[5] = (r) => S())
132
- }, {
133
- default: A(() => {
134
- var r, E, c;
135
- return [
136
- d(se, {
137
- modelValue: t(a).name,
138
- "onUpdate:modelValue": e[0] || (e[0] = (s) => t(a).name = s),
139
- label: "Reward Name",
140
- schema: t(_).typeAtPath(t(R), "name", []),
141
- "error-text": t(_).helperText(t(u), "name")
142
- }, null, 8, ["modelValue", "schema", "error-text"]),
143
- d(o, {
144
- label: "Reward Type",
145
- disabled: !!t(a)._id,
146
- items: [
147
- { label: "Voucher", value: "VOUCHER" },
148
- { label: "Loyalty", value: "LOYALTY" }
149
- ],
150
- "model-value": t(a).option.type,
151
- "onUpdate:modelValue": T
152
- }, null, 8, ["disabled", "model-value"]),
153
- t(a).option.type == "LOYALTY" ? (b(), h(o, {
154
- key: 0,
155
- label: "Loyalty type",
156
- items: t(p).loyaltyRewards.items,
157
- "model-value": t(a).option.collectible,
158
- "onUpdate:modelValue": $
159
- }, null, 8, ["items", "model-value"])) : k("", !0),
160
- t(a).option.type === "LOYALTY" ? (b(), M(Y, { key: 1 }, [
161
- e[10] || (e[10] = f("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
162
- ((r = t(p).loyaltyRewards.items.find(
163
- (s) => {
164
- var U;
165
- return s.value === ((U = t(a)) == null ? void 0 : U.option.collectible);
166
- }
167
- )) == null ? void 0 : r.raw.type) !== "TITLE" ? (b(), h(ne, {
168
- key: 0,
169
- class: "mt-[-8px]",
170
- rules: [
171
- t(_).ruleAtPath(t(R), "option.earningOption", [
172
- t(a).option.type
173
- ])
174
- ],
175
- "helper-state": t(_).helperState(t(u), "option.earningOption"),
176
- "error-text": t(_).helperText(t(u), "option.earningOption"),
177
- "fixed-type": !0,
178
- "model-value": t(a).option.earningOption,
179
- "onUpdate:modelValue": e[1] || (e[1] = (s) => t(a).option.earningOption = s)
180
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"])) : k("", !0),
181
- d(re, {
182
- class: "!gap-24",
183
- "for-credit": t(a).option.type === "LOYALTY" && ((E = t(p).loyaltyRewards.items.find(
184
- (s) => {
185
- var U;
186
- return s.value === ((U = t(a).option) == null ? void 0 : U.collectible);
187
- }
188
- )) == null ? void 0 : E.raw.type) === "CREDIT",
189
- type: t(a).option.type === "VOUCHER" ? "range" : "custom",
190
- rules: [
191
- t(_).ruleAtPath(t(R), "option.validityOption", [
192
- t(a).option.type
193
- ])
194
- ],
195
- "model-value": t(a).option.validityOption,
196
- "onUpdate:modelValue": e[2] || (e[2] = (s) => t(a).option.validityOption = s)
197
- }, null, 8, ["for-credit", "type", "rules", "model-value"])
198
- ], 64)) : k("", !0),
199
- t(a).option.type === "VOUCHER" ? (b(), h(ie, {
200
- key: 2,
201
- "reward-image": t(y),
202
- "model-value": ((c = t(a)) == null ? void 0 : c.option.collectibleConfig) ?? void 0,
203
- "onUpdate:modelValue": e[3] || (e[3] = (s) => t(a).option.collectibleConfig = s),
204
- "onUpdate:rewardImage": e[4] || (e[4] = (s) => y.value = s)
205
- }, null, 8, ["reward-image", "model-value"])) : k("", !0),
206
- d(K, { json: t(u) }, null, 8, ["json"])
207
- ];
208
- }),
209
- _: 1
210
- }, 512)
211
- ]),
212
- _: 1
213
- }, 8, ["modelValue"]);
214
- };
215
- }
216
- }), 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" }, Ke = /* @__PURE__ */ X({
217
- __name: "Reward",
218
- setup(W) {
219
- const { t: n } = oe(), I = {
220
- label: n("connect.storeRewards.create"),
221
- value: "create",
222
- isPrimary: !0,
223
- prependIcon: "add"
224
- }, p = J(), C = pe(), { global: v, minor: a } = G, y = ue(), R = Q(), u = x({
225
- searchKey: "",
226
- columnFilters: []
227
- }), F = H(() => C.rewards);
228
- function D(e) {
229
- y.push({
230
- name: ye["$connect-STORE_REWARD_COLLECTIONS"],
231
- params: { id: e }
232
- });
233
- }
234
- const S = [
235
- {
236
- header: n("connect.storeRewards.table.name"),
237
- accessorFn: (e) => e.name
238
- },
239
- {
240
- header: n("connect.storeRewards.table.type"),
241
- cell(e) {
242
- return e.row.original.collectibleConfig ? ee[e.row.original.collectibleConfig.type].chip() : "N/A";
243
- }
244
- },
245
- {
246
- header: n("connect.storeRewards.table.summary"),
247
- accessorFn: (e) => {
248
- var o, i;
249
- if (e.option.type === "VOUCHER")
250
- return me((i = (o = e.option.collectibleConfig) == null ? void 0 : o.extras) == null ? void 0 : i.effect);
251
- if (e.option.collectibleType == "TITLE") {
252
- const m = p.sortedTitles.find(
253
- (g) => g._id == e.option.collectible
254
- );
255
- return `Get ${m == null ? void 0 : m.name} valid for ${e.option.validityOption.validForDay} days`;
256
- }
257
- return `Get ${e.option.earningOption.amount} ${ce.formattedType(e.option.collectibleType)}`;
258
- }
259
- },
260
- {
261
- header: n("connect.storeRewards.table.actions"),
262
- cell(e) {
263
- return O("div", { class: "flex items-center justify-end gap-4" }, [
264
- O(
265
- L.FmMenu,
266
- {
267
- placement: "bottom-end",
268
- onClick: (o) => {
269
- o.stopPropagation();
270
- }
271
- },
272
- {
273
- "menu-button": () => O(L.FmButton, {
274
- icon: "more_vert",
275
- iconColor: "neutral-gray-400",
276
- variant: "tertiary"
277
- }),
278
- default: () => [
279
- e.row.original.option.type === "VOUCHER" && O(L.FmMenuItem, {
280
- label: "View collections",
281
- onClick: async (o) => {
282
- o.stopPropagation(), D(
283
- e.row.original.option.collectible
284
- );
285
- }
286
- }),
287
- O(
288
- L.FmMenuItem,
289
- {
290
- onClick: async (o) => {
291
- o.stopPropagation(), $(e.row.original);
292
- }
293
- },
294
- {
295
- label: O(
296
- "div",
297
- {
298
- class: "text-fm-color-typo-error fm-typo-en-body-md-400"
299
- },
300
- "Delete"
301
- )
302
- }
303
- )
304
- ]
305
- }
306
- )
307
- ]);
308
- }
309
- }
310
- ], T = x();
311
- async function $(e) {
312
- await te.remove(
313
- n("connect.storeRewards.delete.confirm"),
314
- n("connect.storeRewards.delete.title")
315
- ) && await a(
316
- async () => {
317
- await P.deleteReward(e._id), await C.readRewards();
318
- },
319
- {
320
- message: n("connect.storeRewards.delete.message"),
321
- successMessage: n("connect.storeRewards.delete.success")
322
- }
323
- );
324
- }
325
- async function V(e) {
326
- var o;
327
- e || (e = {
328
- name: "",
329
- option: {
330
- type: "LOYALTY",
331
- collectible: p.loyaltyRewards.items[0].value,
332
- collectibleType: p.loyaltyRewards.items[0].raw.type,
333
- validityOption: {
334
- validForDay: 7
335
- },
336
- earningOption: {
337
- type: "FIXED",
338
- amount: 1
339
- }
340
- }
341
- }), (o = T.value) == null || o.showSheet(!0, ae(e));
342
- }
343
- async function l(e) {
344
- let o = !1;
345
- e._id && e.option.type === "VOUCHER" && await new Promise((i) => {
346
- R.open({
347
- title: "Confirmation",
348
- message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
349
- primaryActions: { text: "Update all", close: !0 },
350
- secondaryActions: { text: "Update future only", close: !0 }
351
- }).onPrimary(async () => {
352
- o = !0, i();
353
- }).onSecondary(async () => {
354
- i();
355
- });
356
- }), await a(
357
- async () => {
358
- var i;
359
- e.collectibleConfig = void 0, e._id ? await P.updateReward(e._id, {
360
- ...e,
361
- updateCollection: o
362
- }) : await P.createReward(e), await C.readRewards(), (i = T.value) == null || i.showSheet(!1);
363
- },
364
- {
365
- message: "Updating reward",
366
- successMessage: "Reward updated successfully"
367
- }
368
- );
369
- }
370
- return q(async () => {
371
- await v(async () => {
372
- await p.readMembership(), await p.readRewards(), await C.readRewards();
373
- });
374
- }), (e, o) => {
375
- const i = w("FmPageHead"), m = w("FmSearch"), g = w("FmTable"), r = w("FmButton"), E = w("FmCard");
376
- return b(), M(Y, null, [
377
- d(i, {
378
- title: t(n)("connect.reward.title"),
379
- actions: [I],
380
- "back-button": !0,
381
- "onClick:action": o[0] || (o[0] = () => V()),
382
- "onClick:back": o[1] || (o[1] = () => {
383
- var c;
384
- return (c = t(y)) == null ? void 0 : c.back();
385
- })
386
- }, null, 8, ["title", "actions"]),
387
- f("div", ve, [
388
- t(F) && t(F).length > 0 ? (b(), M(Y, { key: 0 }, [
389
- f("div", ge, [
390
- o[6] || (o[6] = f("div", { class: "flex gap-8" }, null, -1)),
391
- d(m, {
392
- modelValue: t(u).searchKey,
393
- "onUpdate:modelValue": o[2] || (o[2] = (c) => t(u).searchKey = c),
394
- class: "",
395
- placeholder: "search",
396
- collapsible: ""
397
- }, null, 8, ["modelValue"])
398
- ]),
399
- d(g, {
400
- "row-data": t(F),
401
- "column-defs": S,
402
- "search-value": t(u).searchKey,
403
- "column-filter": t(u).columnFilters,
404
- onRowClick: o[3] || (o[3] = (c) => V(c.original)),
405
- "hide-footer": t(F).length < 10
406
- }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
407
- ], 64)) : (b(), h(E, {
408
- key: 1,
409
- variant: "outlined",
410
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
411
- }, {
412
- default: A(() => [
413
- o[7] || (o[7] = f("img", {
414
- src: z,
415
- class: "aspect-square w-[150px]"
416
- }, null, -1)),
417
- f("div", be, [
418
- f("div", Re, B(t(n)("connect.storeRewards.empty.title")), 1),
419
- f("div", Ce, B(t(n)("connect.storeRewards.empty.description")), 1)
420
- ]),
421
- d(r, {
422
- variant: "primary",
423
- label: t(n)("connect.storeRewards.empty.action"),
424
- onClick: o[4] || (o[4] = (c) => V()),
425
- icon: "add"
426
- }, null, 8, ["label"])
427
- ]),
428
- _: 1
429
- })),
430
- d(we, {
431
- ref_key: "rewardSheetRef",
432
- ref: T,
433
- onUpdate: o[5] || (o[5] = (c) => l(c))
434
- }, null, 512)
435
- ])
436
- ], 64);
437
- };
438
- }
439
- });
440
- export {
441
- Ke as default
442
- };
@@ -1,150 +0,0 @@
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-D5ZAAdUU.js";
3
- import { J as P } from "./JsonViewer-v8_C7l5N.js";
4
- import { _ as D } from "./ZodTextField.vue_vue_type_script_setup_true_lang-BFz8RvY_.js";
5
- import { _ as I } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-DNSdyxrF.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-V9kRRAB1.js";
10
- import "./index-BTpBLMHl.js";
11
- import "./index-8RETBwYy.js";
12
- import { c as E } from "./index-DTyfvK3U.js";
13
- import "./index-IHKkNyxb.js";
14
- import "./index-C6Iyn1Q6.js";
15
- import "./index-Dn0gJspN.js";
16
- import { u as J } from "./vue-i18n-OdHHHpEE.js";
17
- import { c as C } from "./object-qECH92oz.js";
18
- import { useDialog as Z } from "@feedmepos/ui-library";
19
- const A = N("mf-connect-referral", () => {
20
- const h = p();
21
- return {
22
- readReferralProgram: async () => {
23
- const c = await k.read();
24
- h.value = c;
25
- },
26
- referralProgram: h
27
- };
28
- }), 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({
29
- __name: "EditReferralTierSheet",
30
- emits: ["update"],
31
- setup(h, { expose: _, emit: c }) {
32
- const { t: n } = J(), m = c, s = p(!1), a = p({}), i = p(-1), w = A(), o = E.superRefine((r, t) => {
33
- r.name.length >= 50 && t.addIssue({
34
- code: "custom",
35
- message: "Name must be less than 50 characters"
36
- });
37
- }), l = x(() => {
38
- const r = o.safeParse(a.value);
39
- return r.success ? [] : r.error.errors;
40
- });
41
- function R() {
42
- const r = o.safeParse(a.value);
43
- r.success && m("update", i.value, r.data);
44
- }
45
- function d(r, t) {
46
- var f;
47
- s.value = r, r && typeof t == "number" && t >= 0 ? (i.value = t, a.value = C(
48
- (f = w.referralProgram) == null ? void 0 : f.reward[t]
49
- )) : (i.value = -1, a.value = {
50
- id: (/* @__PURE__ */ new Date()).toISOString(),
51
- name: "",
52
- rewards: [],
53
- rule: void 0
54
- });
55
- }
56
- function g(r) {
57
- a.value.rule = r;
58
- }
59
- return _({
60
- showSheet: d,
61
- data: a
62
- }), (r, t) => {
63
- const f = y("FmButton"), F = y("FmSideSheet");
64
- return U(), G(F, {
65
- "max-width": 1e3,
66
- modelValue: e(s),
67
- "onUpdate:modelValue": t[2] || (t[2] = (S) => $(s) ? s.value = S : null),
68
- header: `${e(i) == -1 ? e(n)("connect.referral.editReferralTierSheet.create") : e(n)("connect.referral.editReferralTierSheet.edit")}`
69
- }, {
70
- "side-sheet-footer": b(() => [
71
- v("div", O, [
72
- u(f, {
73
- label: e(n)("connect.editTierSheet.submit"),
74
- onClick: R,
75
- disabled: e(l).length > 0 || e(V)().isLoading,
76
- loading: e(V)().isLoading
77
- }, null, 8, ["label", "disabled", "loading"]),
78
- u(f, {
79
- label: e(n)("connect.editTierSheet.cancel"),
80
- onClick: t[1] || (t[1] = (S) => d(!1)),
81
- variant: "tertiary"
82
- }, null, 8, ["label"])
83
- ])
84
- ]),
85
- default: b(() => [
86
- u(P, { json: e(a) }, null, 8, ["json"]),
87
- u(P, { json: e(l) }, null, 8, ["json"]),
88
- v("div", H, [
89
- u(D, {
90
- modelValue: e(a).name,
91
- "onUpdate:modelValue": t[0] || (t[0] = (S) => e(a).name = S),
92
- label: e(n)("connect.referral.editReferralTierSheet.name"),
93
- schema: e(L).typeAtPath(e(o), "name")
94
- }, null, 8, ["modelValue", "label", "schema"]),
95
- v("div", M, j(e(n)("connect.referral.editReferralTierSheet.target_audience")), 1),
96
- u(I, {
97
- "model-value": e(a).rule,
98
- "onUpdate:modelValue": g
99
- }, null, 8, ["model-value"])
100
- ])
101
- ]),
102
- _: 1
103
- }, 8, ["modelValue", "header"]);
104
- };
105
- }
106
- }), de = /* @__PURE__ */ T({
107
- __name: "RewardGroup",
108
- setup(h, { expose: _ }) {
109
- const { minor: c } = B, n = Z(), m = A(), s = x(() => {
110
- var o;
111
- return ((o = m.referralProgram) == null ? void 0 : o.reward) ?? [];
112
- }), a = p(null);
113
- function i(o) {
114
- var l;
115
- (l = a.value) == null || l.showSheet(!0, o);
116
- }
117
- _({
118
- onManageRewardGroup: i
119
- });
120
- async function w(o, l) {
121
- var r;
122
- const R = o == -1 ? s.value.length : o, d = C(m.referralProgram);
123
- d.reward[R] = l;
124
- let g = !1;
125
- await new Promise((t) => {
126
- n.open({
127
- title: "Confirmation",
128
- message: "This will change all referral settings? Would you like to update previous referral record?",
129
- primaryActions: { text: "Update all", close: !0 },
130
- secondaryActions: { text: "Update future only", close: !0 }
131
- }).onPrimary(async () => {
132
- g = !0, t();
133
- }).onSecondary(async () => {
134
- t();
135
- });
136
- }), await c(async () => {
137
- await k.update({ ...d, updateReferralRecord: g }), await m.readReferralProgram();
138
- }), (r = a.value) == null || r.showSheet(!1);
139
- }
140
- return (o, l) => (U(), G(W, {
141
- ref_key: "editReferralTierSheetRef",
142
- ref: a,
143
- onUpdate: w
144
- }, null, 512));
145
- }
146
- });
147
- export {
148
- de as _,
149
- A as u
150
- };