@feedmepos/mf-connect 0.1.0-beta.25 → 0.1.0-beta.27

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 (83) hide show
  1. package/dist/{Analytic-Bw49sjWN.js → Analytic-DMLcfl4K.js} +8 -8
  2. package/dist/{App-Df3-YjKQ.js → App-gLuWbsNM.js} +6 -6
  3. package/dist/{Broadcast-B4VxU-SI.js → Broadcast-tCGOdX8O.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Ug3EPwKk.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Bw8KlwWo.js} +8 -8
  5. package/dist/{Card-C7H-8zqt.js → Card-D3JMbxw7.js} +15 -15
  6. package/dist/{Collections-WxZue3W6.js → Collections-ttXmrLkk.js} +4 -4
  7. package/dist/{Credit-Cq22pCq8.js → Credit-BpHRY05w.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-D0dnmnhA.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BfpJ1XYe.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-D3QzvFi6.js → EffectSheet.vue_vue_type_style_index_0_lang-Da7s-22r.js} +6 -6
  10. package/dist/{Experience-DiQ9mOnE.js → Experience-CDeg0imW.js} +8 -8
  11. package/dist/{Game-CVr6OrOy.js → Game-BarBKwSm.js} +8 -8
  12. package/dist/{Index-B6uiwCSg.js → Index-B5-D8dc5.js} +9 -9
  13. package/dist/{Marketing-BLaNI0wq.js → Marketing-Bz8VDhoj.js} +5 -5
  14. package/dist/{Member-0rk2BlRH.js → Member-BqetTnme.js} +4 -4
  15. package/dist/{MemberList-D-9cznIm.js → MemberList-DMqaKWV_.js} +15 -15
  16. package/dist/{MemberTransactions-C_F1cqq3.js → MemberTransactions-qdegwy1T.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DvVowiRR.js → MessageInput.vue_vue_type_script_setup_true_lang-CxuDJMul.js} +2 -2
  18. package/dist/{Mission-NSS4r47V.js → Mission-Cj-IgN35.js} +8 -8
  19. package/dist/{Overview-C3BoyFvz.js → Overview-lGdRpa6I.js} +18 -18
  20. package/dist/{Point-IwLqb2Zs.js → Point-QwyIu513.js} +8 -8
  21. package/dist/{Promotion-BXuLjsv7.js → Promotion-BE395GwA.js} +9 -9
  22. package/dist/Record-C5xf9Hex.js +209 -0
  23. package/dist/Reward-unGOFCyw.js +411 -0
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-B0NA61z4.js → RewardGroup.vue_vue_type_script_setup_true_lang-DJdhlMFJ.js} +12 -12
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BirGKJD5.js → RuleGroup.vue_vue_type_script_setup_true_lang-DYZQ9hvN.js} +14 -14
  26. package/dist/{Segment-WJSkzBWK.js → Segment-BI_4s8tG.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-CtehSCSh.js → SelectItems.vue_vue_type_script_setup_true_lang-WDUey8op.js} +2 -2
  28. package/dist/{Setting-DRIry8_Z.js → Setting-BAUhD4jc.js} +8 -8
  29. package/dist/{Store-Ddr5_VbP.js → Store-BWH9HbPz.js} +19 -19
  30. package/dist/{StoreRewards-DT09Eq-5.js → StoreRewards-DH09iyHe.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DIKIKFdP.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BNi-DQib.js} +11 -11
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-PWIkWIyk.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DhrhxxtP.js} +1 -1
  33. package/dist/{Tier-CFk9HHDc.js → Tier-EXLby49_.js} +318 -306
  34. package/dist/{Title-Gd7XkhZa.js → Title-Cv-5hbiI.js} +208 -192
  35. package/dist/{Transaction-B3Xxwj3e.js → Transaction-DZ9em67G.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BsdG--yC.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DK43Thdk.js} +6 -6
  37. package/dist/{Voucher-BLoBBCYI.js → Voucher-DYJINrTR.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-uDQCDBrW.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DmH_veHr.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-v8ldXm6Z.js → ZodTextField.vue_vue_type_script_setup_true_lang-DmAp9RCh.js} +1 -1
  40. package/dist/{app-B0Wo9zK_.js → app-B6oXj4kE.js} +1 -1
  41. package/dist/{app-CwFIflzB.js → app-BApWh_Pu.js} +28 -28
  42. package/dist/app.js +1 -1
  43. package/dist/{business-Bpe4K4IG.js → business-CwkNQpX3.js} +1 -1
  44. package/dist/{campaign-C5L3Banb.js → campaign-I6i9noxn.js} +2 -2
  45. package/dist/{collectible.enum-BwKcsFPJ.js → collectible.enum-C2T3wxes.js} +1 -1
  46. package/dist/{collection.fn-SoqZKNRB.js → collection.fn-C6x7w1_J.js} +2 -2
  47. package/dist/{dto-D2c_O0A0.js → dto-CPC4zpNc.js} +75 -75
  48. package/dist/{effect-DvB7NyMi.js → effect-Cz1i7ErO.js} +1 -1
  49. package/dist/{email-addresses-BHD3btpv.js → email-addresses-B8nd_073.js} +1 -1
  50. package/dist/{export-CzpMwiOf.js → export-zXP6IfB2.js} +3 -3
  51. package/dist/{helper-DF-sSvHq.js → helper-C3bZBttW.js} +1 -1
  52. package/dist/{index-B751j7lu.js → index-BMqxenYA.js} +4 -4
  53. package/dist/{index-CeoqYPxu.js → index-BUrDd60O.js} +4 -4
  54. package/dist/index-Bs1GmcxM.js +54 -0
  55. package/dist/{index-DGpLiSKC.js → index-CgKJ33t7.js} +1 -1
  56. package/dist/{index-CuLJGmP6.js → index-CmZvS-OJ.js} +1 -1
  57. package/dist/{index-buNf3deq.js → index-D2PcDli9.js} +8 -8
  58. package/dist/{index-B7elcoQX.js → index-DE2d5z9p.js} +3 -3
  59. package/dist/{index-CT0nrvtM.js → index-DjFtudP6.js} +1 -1
  60. package/dist/{index-IrZw6oc7.js → index-DzS80tJT.js} +2 -2
  61. package/dist/{index-DSdlmakQ.js → index-M7HcGbUR.js} +3 -3
  62. package/dist/{index-Czi9Zbfu.js → index-Ouu648YI.js} +1 -1
  63. package/dist/{index-CaNPlQfc.js → index-WCkLBzXH.js} +1 -1
  64. package/dist/{index-DU-xnNYa.js → index-yV1Y_iX0.js} +1 -1
  65. package/dist/{index.esm2017-BVSr63BQ.js → index.esm2017-BtDmZi0y.js} +1 -1
  66. package/dist/{loading-C60MHxcY.js → loading-DnOIUurW.js} +4 -4
  67. package/dist/{membership-Dl-R2y3j.js → membership-CinggB2b.js} +3 -3
  68. package/dist/{money-BlCw3A9L.js → money-B491m1hF.js} +1 -1
  69. package/dist/{number-tw2TKykE.js → number-H31aAXGx.js} +1 -1
  70. package/dist/{objectid-CQo-r2xY.js → objectid-BxvIDDKr.js} +4 -4
  71. package/dist/{reward-CYvuiwF5.js → reward-DZfEY37x.js} +1 -1
  72. package/dist/{rule-CFwr7rNP.js → rule-96lWAM_m.js} +3 -3
  73. package/dist/{rule-builder-kmfw35DF.js → rule-builder-Cpc6Ahrc.js} +1 -1
  74. package/dist/{template-CrtHUdsP.js → template-DSj09PBB.js} +4 -4
  75. package/dist/{trigger-DYUkLfDm.js → trigger-DGBb2o0r.js} +4 -4
  76. package/dist/user-CWu4w0H9.js +54 -0
  77. package/dist/{vue-i18n-6NpmRo5N.js → vue-i18n-C3CGuKMm.js} +230 -230
  78. package/dist/{xlsx-BSUcM3MJ.js → xlsx-DtLsDtB7.js} +1 -1
  79. package/package.json +1 -1
  80. package/dist/Record-D6zfDAaG.js +0 -187
  81. package/dist/Reward-Cyc3KlCY.js +0 -399
  82. package/dist/index-DMGD2o0j.js +0 -53
  83. package/dist/user-Bm4KttFq.js +0 -37
@@ -1,16 +1,16 @@
1
1
  import { defineComponent as H, ref as S, computed as q, h as z, onMounted as G, resolveComponent as r, openBlock as m, createElementBlock as h, Fragment as w, createVNode as i, unref as a, createElementVNode as s, withCtx as v, renderList as J, createBlock as b, resolveDynamicComponent as Q, toDisplayString as g } from "vue";
2
2
  import { _ as W } from "./campaign-CpzFl8Vr.js";
3
3
  import { useDialog as X, components as Y } from "@feedmepos/ui-library";
4
- import { c as O, p as I, u as Z } from "./loading-C60MHxcY.js";
5
- import { u as ee } from "./business-Bpe4K4IG.js";
6
- import { u as oe } from "./campaign-C5L3Banb.js";
7
- import { u as te } from "./vue-i18n-6NpmRo5N.js";
8
- import { g as V } from "./dto-D2c_O0A0.js";
9
- import { e as L } from "./effect-DvB7NyMi.js";
4
+ import { c as O, p as I, u as Z } from "./loading-DnOIUurW.js";
5
+ import { u as ee } from "./business-CwkNQpX3.js";
6
+ import { u as oe } from "./campaign-I6i9noxn.js";
7
+ import { u as te } from "./vue-i18n-C3CGuKMm.js";
8
+ import { g as V } from "./dto-CPC4zpNc.js";
9
+ import { e as L } from "./effect-Cz1i7ErO.js";
10
10
  import { _ as ne } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
11
- import { _ as ae } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-D0dnmnhA.js";
12
- import { u as se } from "./template-CrtHUdsP.js";
13
- import { c as u } from "./index-CuLJGmP6.js";
11
+ import { _ as ae } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-BfpJ1XYe.js";
12
+ import { u as se } from "./template-DSj09PBB.js";
13
+ import { c as u } from "./index-CmZvS-OJ.js";
14
14
  const ce = { class: "px-24 flex flex-col gap-y-16" }, ie = { class: "flex items-center justify-between w-full" }, re = { class: "flex gap-8 overflow-x-auto" }, le = { class: "space-y-8" }, me = { class: "flex w-full gap-4 items-center" }, pe = { class: "space-y-4" }, de = { class: "fm-typo-en-body-lg-600" }, ue = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, fe = { class: "flex flex-col gap-16 text-center" }, ye = { class: "fm-typo-en-title-sm-800" }, ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Le = /* @__PURE__ */ H({
15
15
  __name: "Promotion",
16
16
  setup(_e) {
@@ -0,0 +1,209 @@
1
+ import { defineComponent as b, ref as w, resolveComponent as y, openBlock as R, createBlock as z, unref as o, isRef as A, withCtx as I, createElementVNode as F, createVNode as C, h as c, onMounted as M, createElementBlock as N, Fragment as V } from "vue";
2
+ import { u as $, _ as U } from "./usePagination-BeF5K3M7.js";
3
+ import { g as v } from "./user-CWu4w0H9.js";
4
+ import { components as g } from "@feedmepos/ui-library";
5
+ import { u as B, a as E, c as L } from "./loading-DnOIUurW.js";
6
+ import { u as T } from "./vue-i18n-C3CGuKMm.js";
7
+ import { useCoreStore as O } from "@feedmepos/mf-common";
8
+ import { r as P } from "./index-DjFtudP6.js";
9
+ import { c as K, a as W } from "./object-qECH92oz.js";
10
+ import { u as j } from "./membership-CinggB2b.js";
11
+ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ b({
12
+ __name: "UpdateCriteriaProgressSheet",
13
+ emits: ["refresh"],
14
+ setup(k, { expose: p, emit: h }) {
15
+ const u = h;
16
+ T();
17
+ const { minor: _ } = B, n = w(!1), a = w({}), S = O(), e = [
18
+ {
19
+ header: "Criteria title",
20
+ accessorFn: (i) => i.name
21
+ },
22
+ {
23
+ header: "Status",
24
+ cell(i) {
25
+ var x;
26
+ const t = i.row.original, l = (x = a.value.criteria_progress) == null ? void 0 : x.find(
27
+ (D) => D.criteria === t._id
28
+ ), d = l ? "Completed" : "Pending", m = l ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-warning bg-fm-color-system-warning-100";
29
+ return [
30
+ c(g.FmChip, {
31
+ label: d,
32
+ compact: !0,
33
+ class: m
34
+ })
35
+ ];
36
+ }
37
+ },
38
+ {
39
+ id: "actions",
40
+ cell(i) {
41
+ var d;
42
+ const t = i.row.original;
43
+ return [
44
+ !((d = a.value.criteria_progress) == null ? void 0 : d.some(
45
+ (m) => m.criteria === t._id
46
+ )) && t.type == "MANUAL" ? c(g.FmButton, {
47
+ variant: "secondary",
48
+ label: "Mark as completed",
49
+ size: "md",
50
+ onClick: (m) => {
51
+ m.stopPropagation(), r(t._id.toString());
52
+ }
53
+ }) : null
54
+ ];
55
+ }
56
+ }
57
+ ];
58
+ async function r(i) {
59
+ var l;
60
+ const t = K(W(a.value));
61
+ t.criteria_progress = [
62
+ {
63
+ criteria: i,
64
+ ref: `ADMIN:${(l = S.user) == null ? void 0 : l.id}:${(/* @__PURE__ */ new Date()).toISOString()}`,
65
+ completedAt: /* @__PURE__ */ new Date()
66
+ }
67
+ ], _(
68
+ async () => {
69
+ await P.updateCriteriaProgress(
70
+ a.value._id,
71
+ t
72
+ ), n.value = !1, u("refresh");
73
+ },
74
+ {
75
+ message: "Updating criteria progress",
76
+ successMessage: "Criteria progress updated successfully"
77
+ }
78
+ );
79
+ }
80
+ function s(i, t) {
81
+ n.value = i, a.value = t;
82
+ }
83
+ function f() {
84
+ n.value = !1;
85
+ }
86
+ return p({
87
+ showSheet: s,
88
+ hideSheet: f,
89
+ data: a
90
+ }), (i, t) => {
91
+ const l = y("FmTable"), d = y("FmSideSheet");
92
+ return R(), z(d, {
93
+ "max-width": 768,
94
+ modelValue: o(n),
95
+ "onUpdate:modelValue": t[0] || (t[0] = (m) => A(n) ? n.value = m : null),
96
+ header: "Referee Criteria"
97
+ }, {
98
+ default: I(() => [
99
+ F("div", q, [
100
+ C(l, {
101
+ "row-data": o(a).criteria,
102
+ "hide-footer": !0,
103
+ "page-size": 100,
104
+ "column-defs": e
105
+ }, null, 8, ["row-data"])
106
+ ])
107
+ ]),
108
+ _: 1
109
+ }, 8, ["modelValue"]);
110
+ };
111
+ }
112
+ }), ae = /* @__PURE__ */ b({
113
+ __name: "Record",
114
+ setup(k) {
115
+ j();
116
+ const p = w(null), h = [
117
+ {
118
+ header: "ID",
119
+ meta: {
120
+ maxWidth: "100px"
121
+ },
122
+ cell(e) {
123
+ return c("div", { class: "flex items-center" }, [
124
+ c(g.FmIcon, {
125
+ name: "content_copy",
126
+ outline: !0,
127
+ size: "sm",
128
+ class: "cursor-pointer mr-4",
129
+ onClick: (r) => {
130
+ r.preventDefault(), r.stopPropagation(), E(e.row.original._id.toString());
131
+ }
132
+ }),
133
+ c(
134
+ "div",
135
+ { class: "pr-2 text-ellipsis overflow-hidden" },
136
+ e.row.original._id.toString()
137
+ )
138
+ ]);
139
+ },
140
+ enableSorting: !1
141
+ },
142
+ {
143
+ header: "Referer info",
144
+ enableSorting: !0,
145
+ cell(e) {
146
+ return e.row.original.pf_referer ? v(e.row.original.pf_referer, !0) : "N/A";
147
+ }
148
+ },
149
+ {
150
+ header: "Referee info",
151
+ enableSorting: !0,
152
+ cell(e) {
153
+ return e.row.original.pf_referee ? v(e.row.original.pf_referee, !0) : "N/A";
154
+ }
155
+ },
156
+ {
157
+ header: "Referee criteria",
158
+ accessorKey: "criteria",
159
+ id: "criteria",
160
+ cell(e) {
161
+ const r = e.row.original.criteria_progress.length, s = e.row.original.criteria.length;
162
+ return s === 0 ? c("div", "No criteria") : c("div", `${r}/${s} completed criteria`);
163
+ }
164
+ },
165
+ {
166
+ header: "Status",
167
+ id: "status",
168
+ cell(e) {
169
+ const r = e.row.original.status;
170
+ return c(g.FmChip, {
171
+ label: L.title(r),
172
+ compact: !0,
173
+ class: r == "COMPLETED" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-primary bg-fm-color-system-primary-100"
174
+ });
175
+ }
176
+ }
177
+ ], { tableMeta: u, rowData: _, onSort: n, debouncedFetchData: a, onSearch: S } = $(P.readRecords);
178
+ return M(async () => {
179
+ await a();
180
+ }), (e, r) => (R(), N(V, null, [
181
+ F("div", null, [
182
+ C(U, {
183
+ loading: o(u).isLoading,
184
+ "row-data": o(_),
185
+ "row-count": o(u).totalRows,
186
+ "column-defs": h,
187
+ "shrink-at": !1,
188
+ "page-count": o(u).pageCount,
189
+ "page-index": o(u).pageIndex,
190
+ "page-size": o(u).pageSize,
191
+ onSortChange: o(n),
192
+ onPageChange: r[0] || (r[0] = (s) => o(a)({ pageSize: s.pageSize, pageIndex: s.pageIndex })),
193
+ onRowClick: r[1] || (r[1] = (s) => {
194
+ var f;
195
+ return (f = o(p)) == null ? void 0 : f.showSheet(!0, s.original);
196
+ })
197
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
198
+ ]),
199
+ C(G, {
200
+ ref_key: "updateCriteriaProgressSheetRef",
201
+ ref: p,
202
+ onRefresh: o(a)
203
+ }, null, 8, ["onRefresh"])
204
+ ], 64));
205
+ }
206
+ });
207
+ export {
208
+ ae as default
209
+ };
@@ -0,0 +1,411 @@
1
+ import { defineComponent as N, ref as F, computed as K, resolveComponent as y, openBlock as v, createBlock as S, unref as t, isRef as Z, withCtx as L, createElementVNode as u, createVNode as r, createCommentVNode as E, createElementBlock as Y, Fragment as H, h as C, onMounted as q, toDisplayString as $ } from "vue";
2
+ import { _ as z } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as G, components as T } from "@feedmepos/ui-library";
4
+ import { f as B, u as X, p as Q } from "./loading-DnOIUurW.js";
5
+ import { u as J, C as ee } from "./membership-CinggB2b.js";
6
+ import { u as te } from "./vue-i18n-C3CGuKMm.js";
7
+ import { c as oe } from "./object-qECH92oz.js";
8
+ import { Z as _ } from "./zod-Bg2FbC-D.js";
9
+ import "./index-DzS80tJT.js";
10
+ import { a as ae } from "./index-Bs1GmcxM.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-DmH_veHr.js";
13
+ import { _ as re } from "./EffectSheet.vue_vue_type_style_index_0_lang-Da7s-22r.js";
14
+ import { J as j } from "./JsonViewer-v8_C7l5N.js";
15
+ import { _ as se } from "./ZodTextField.vue_vue_type_script_setup_true_lang-DmAp9RCh.js";
16
+ import { i as de } from "./helper-C3bZBttW.js";
17
+ import { u as me, r as M } from "./reward-DZfEY37x.js";
18
+ import "./index-CgKJ33t7.js";
19
+ import { useRouter as ce } from "vue-router";
20
+ import { R as pe } from "./app-BApWh_Pu.js";
21
+ const ue = { class: "flex gap-8 items-center justify-start" }, ye = /* @__PURE__ */ N({
22
+ __name: "EditRewardSheet",
23
+ emits: ["update"],
24
+ setup(W, { expose: n, emit: A }) {
25
+ const c = J(), { minor: b } = X, f = F(!1), a = F({}), w = F(), g = ae, m = K(() => {
26
+ const l = g.safeParse(a.value);
27
+ return l.success ? [] : l.error.errors;
28
+ });
29
+ function R(l, e) {
30
+ l && (a.value = e), f.value = l;
31
+ }
32
+ const P = A;
33
+ async function U() {
34
+ const l = g.safeParse(a.value);
35
+ !l.success || !l.data || (await b(
36
+ async () => {
37
+ var e;
38
+ l.data.option.type === "VOUCHER" && w.value && (l.data.option.collectibleConfig.image = await B.update(
39
+ ((e = l.data.option.collectibleConfig) == null ? void 0 : e.image) || B.collectibleImagePath(void 0, w.value),
40
+ w.value
41
+ ));
42
+ },
43
+ {
44
+ message: "Uploading reward image",
45
+ successMessage: "Reward image updated"
46
+ }
47
+ ), P("update", l.data));
48
+ }
49
+ function x(l) {
50
+ l === "VOUCHER" ? a.value.option = {
51
+ collectible: null,
52
+ type: "VOUCHER",
53
+ collectibleConfig: de("VOUCHER", {
54
+ business: le().currentBusiness.value._id
55
+ }),
56
+ earningOption: {
57
+ amount: 1,
58
+ type: "FIXED"
59
+ },
60
+ validityOption: {
61
+ validForDay: 7
62
+ }
63
+ } : a.value.option = {
64
+ collectible: c.loyaltyRewards.raw[0]._id,
65
+ collecitbleType: c.loyaltyRewards.raw[0].type,
66
+ type: "LOYALTY",
67
+ earningOption: {
68
+ amount: 1,
69
+ type: "FIXED"
70
+ },
71
+ validityOption: {
72
+ validForDay: 7
73
+ }
74
+ };
75
+ }
76
+ function I(l) {
77
+ a.value.option.collectible = l;
78
+ }
79
+ const O = F();
80
+ return n({
81
+ showSheet: R
82
+ }), (l, e) => {
83
+ const o = y("FmSelect"), p = y("FmForm"), h = y("FmButton"), D = y("FmSideSheet");
84
+ return v(), S(D, {
85
+ "max-width": 560,
86
+ modelValue: t(f),
87
+ "onUpdate:modelValue": [
88
+ e[8] || (e[8] = (d) => Z(f) ? f.value = d : null),
89
+ e[9] || (e[9] = (d) => f.value = d)
90
+ ],
91
+ header: "Edit reward"
92
+ }, {
93
+ "side-sheet-footer": L(() => [
94
+ u("div", ue, [
95
+ r(h, {
96
+ variant: "primary",
97
+ type: "button",
98
+ label: "Confirm",
99
+ disabled: t(m).length > 0,
100
+ onClick: e[6] || (e[6] = (d) => U())
101
+ }, null, 8, ["disabled"]),
102
+ r(h, {
103
+ variant: "secondary",
104
+ type: "button",
105
+ label: "Cancel",
106
+ onClick: e[7] || (e[7] = (d) => f.value = !1)
107
+ })
108
+ ])
109
+ ]),
110
+ default: L(() => [
111
+ r(j, { json: t(a) }, null, 8, ["json"]),
112
+ r(p, {
113
+ class: "flex flex-col gap-y-24",
114
+ ref_key: "formRef",
115
+ ref: O,
116
+ onValidationSuccess: e[5] || (e[5] = (d) => U())
117
+ }, {
118
+ default: L(() => {
119
+ var d, k, s;
120
+ return [
121
+ r(se, {
122
+ modelValue: t(a).name,
123
+ "onUpdate:modelValue": e[0] || (e[0] = (i) => t(a).name = i),
124
+ label: "Reward Name",
125
+ schema: t(_).typeAtPath(t(g), "name", []),
126
+ "error-text": t(_).helperText(t(m), "name")
127
+ }, null, 8, ["modelValue", "schema", "error-text"]),
128
+ r(o, {
129
+ label: "Reward Type",
130
+ disabled: !!t(a)._id,
131
+ items: [
132
+ { label: "Voucher", value: "VOUCHER" },
133
+ { label: "Loyalty", value: "LOYALTY" }
134
+ ],
135
+ "model-value": t(a).option.type,
136
+ "onUpdate:modelValue": x
137
+ }, null, 8, ["disabled", "model-value"]),
138
+ t(a).option.type == "LOYALTY" ? (v(), S(o, {
139
+ key: 0,
140
+ label: "Loyalty type",
141
+ items: t(c).loyaltyRewards.items,
142
+ "model-value": t(a).option.collectible,
143
+ "onUpdate:modelValue": I
144
+ }, null, 8, ["items", "model-value"])) : E("", !0),
145
+ t(a).option.type === "LOYALTY" ? (v(), Y(H, { key: 1 }, [
146
+ e[10] || (e[10] = u("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
147
+ ((d = t(c).loyaltyRewards.items.find(
148
+ (i) => {
149
+ var V;
150
+ return i.value === ((V = t(a)) == null ? void 0 : V.option.collectible);
151
+ }
152
+ )) == null ? void 0 : d.raw.type) !== "TITLE" ? (v(), S(ne, {
153
+ key: 0,
154
+ class: "mt-[-8px]",
155
+ rules: [
156
+ t(_).ruleAtPath(t(g), "option.earningOption", [
157
+ t(a).option.type
158
+ ])
159
+ ],
160
+ "helper-state": t(_).helperState(t(m), "option.earningOption"),
161
+ "error-text": t(_).helperText(t(m), "option.earningOption"),
162
+ "fixed-type": !0,
163
+ "model-value": t(a).option.earningOption,
164
+ "onUpdate:modelValue": e[1] || (e[1] = (i) => t(a).option.earningOption = i)
165
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"])) : E("", !0),
166
+ r(re, {
167
+ class: "!gap-24",
168
+ "for-credit": t(a).option.type === "LOYALTY" && ((k = t(c).loyaltyRewards.items.find(
169
+ (i) => {
170
+ var V;
171
+ return i.value === ((V = t(a).option) == null ? void 0 : V.collectible);
172
+ }
173
+ )) == null ? void 0 : k.raw.type) === "CREDIT",
174
+ rules: [
175
+ t(_).ruleAtPath(t(g), "option.validityOption", [
176
+ t(a).option.type
177
+ ])
178
+ ],
179
+ "model-value": t(a).option.validityOption,
180
+ "onUpdate:modelValue": e[2] || (e[2] = (i) => t(a).option.validityOption = i)
181
+ }, null, 8, ["for-credit", "rules", "model-value"])
182
+ ], 64)) : E("", !0),
183
+ t(a).option.type === "VOUCHER" ? (v(), S(ie, {
184
+ key: 2,
185
+ "reward-image": t(w),
186
+ "model-value": ((s = t(a)) == null ? void 0 : s.option.collectibleConfig) ?? void 0,
187
+ "onUpdate:modelValue": e[3] || (e[3] = (i) => t(a).option.collectibleConfig = i),
188
+ "onUpdate:rewardImage": e[4] || (e[4] = (i) => w.value = i)
189
+ }, null, 8, ["reward-image", "model-value"])) : E("", !0),
190
+ r(j, { json: t(m) }, null, 8, ["json"])
191
+ ];
192
+ }),
193
+ _: 1
194
+ }, 512)
195
+ ]),
196
+ _: 1
197
+ }, 8, ["modelValue"]);
198
+ };
199
+ }
200
+ }), fe = { class: "px-24 flex flex-col gap-y-16" }, we = { class: "flex items-center justify-between w-full" }, ve = { class: "flex flex-col gap-16 text-center" }, ge = { class: "fm-typo-en-title-sm-800" }, be = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, He = /* @__PURE__ */ N({
201
+ __name: "Reward",
202
+ setup(W) {
203
+ const { t: n } = te(), A = {
204
+ label: n("connect.storeRewards.create"),
205
+ value: "create",
206
+ isPrimary: !0,
207
+ prependIcon: "add"
208
+ }, c = J(), b = me(), { global: f, minor: a } = X, w = ce(), g = G(), m = F({
209
+ searchKey: "",
210
+ columnFilters: []
211
+ }), R = K(() => b.rewards);
212
+ function P(e) {
213
+ w.push({
214
+ name: pe["$connect-STORE_REWARD_COLLECTIONS"],
215
+ params: { id: e }
216
+ });
217
+ }
218
+ const U = [
219
+ {
220
+ header: n("connect.storeRewards.table.name"),
221
+ accessorFn: (e) => e.name
222
+ },
223
+ {
224
+ header: n("connect.storeRewards.table.type"),
225
+ cell(e) {
226
+ return e.row.original.collectibleConfig ? ee[e.row.original.collectibleConfig.type].chip() : "N/A";
227
+ }
228
+ },
229
+ {
230
+ header: n("connect.storeRewards.table.actions"),
231
+ cell(e) {
232
+ return C("div", { class: "flex items-center justify-end gap-4" }, [
233
+ C(
234
+ T.FmMenu,
235
+ {
236
+ placement: "bottom-end",
237
+ onClick: (o) => {
238
+ o.stopPropagation();
239
+ }
240
+ },
241
+ {
242
+ "menu-button": () => C(T.FmButton, {
243
+ icon: "more_vert",
244
+ iconColor: "neutral-gray-400",
245
+ variant: "tertiary"
246
+ }),
247
+ default: () => [
248
+ e.row.original.option.type === "VOUCHER" && C(T.FmMenuItem, {
249
+ label: "View collections",
250
+ onClick: async (o) => {
251
+ o.stopPropagation(), P(
252
+ e.row.original.option.collectible
253
+ );
254
+ }
255
+ }),
256
+ C(
257
+ T.FmMenuItem,
258
+ {
259
+ onClick: async (o) => {
260
+ o.stopPropagation(), I(e.row.original);
261
+ }
262
+ },
263
+ {
264
+ label: C(
265
+ "div",
266
+ {
267
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
268
+ },
269
+ "Delete"
270
+ )
271
+ }
272
+ )
273
+ ]
274
+ }
275
+ )
276
+ ]);
277
+ }
278
+ }
279
+ ], x = F();
280
+ async function I(e) {
281
+ await Q.remove(
282
+ n("connect.storeRewards.delete.confirm"),
283
+ n("connect.storeRewards.delete.title")
284
+ ) && await a(
285
+ async () => {
286
+ await M.deleteReward(e._id), await b.readRewards();
287
+ },
288
+ {
289
+ message: n("connect.storeRewards.delete.message"),
290
+ successMessage: n("connect.storeRewards.delete.success")
291
+ }
292
+ );
293
+ }
294
+ async function O(e) {
295
+ var o;
296
+ e || (e = {
297
+ name: "",
298
+ option: {
299
+ type: "LOYALTY",
300
+ collectible: c.loyaltyRewards.items[0].value,
301
+ collecitbleType: c.loyaltyRewards.items[0].raw.type,
302
+ validityOption: {
303
+ validForDay: 7
304
+ },
305
+ earningOption: {
306
+ type: "FIXED",
307
+ amount: 1
308
+ }
309
+ }
310
+ }), (o = x.value) == null || o.showSheet(!0, oe(e));
311
+ }
312
+ async function l(e) {
313
+ let o = !1;
314
+ e._id && e.option.type === "VOUCHER" && await new Promise((p) => {
315
+ g.open({
316
+ title: "Confirmation",
317
+ message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
318
+ primaryActions: { text: "Update all", close: !0 },
319
+ secondaryActions: { text: "Update future only", close: !0 }
320
+ }).onPrimary(async () => {
321
+ o = !0, p();
322
+ }).onSecondary(async () => {
323
+ p();
324
+ });
325
+ }), await a(
326
+ async () => {
327
+ var p;
328
+ e.collectibleConfig = void 0, e._id ? await M.updateReward(e._id, {
329
+ ...e,
330
+ updateCollection: o
331
+ }) : await M.createReward(e), await b.readRewards(), (p = x.value) == null || p.showSheet(!1);
332
+ },
333
+ {
334
+ message: "Updating reward",
335
+ successMessage: "Reward updated successfully"
336
+ }
337
+ );
338
+ }
339
+ return q(async () => {
340
+ await f(async () => {
341
+ await c.readRewards(), await b.readRewards();
342
+ });
343
+ }), (e, o) => {
344
+ const p = y("FmPageHead"), h = y("FmSearch"), D = y("FmTable"), d = y("FmButton"), k = y("FmCard");
345
+ return v(), Y(H, null, [
346
+ r(p, {
347
+ title: t(n)("connect.reward.title"),
348
+ actions: [A],
349
+ "back-button": !0,
350
+ "onClick:action": o[0] || (o[0] = () => O()),
351
+ "onClick:back": o[1] || (o[1] = () => {
352
+ var s;
353
+ return (s = t(w)) == null ? void 0 : s.back();
354
+ })
355
+ }, null, 8, ["title", "actions"]),
356
+ u("div", fe, [
357
+ t(R) && t(R).length > 0 ? (v(), Y(H, { key: 0 }, [
358
+ u("div", we, [
359
+ o[6] || (o[6] = u("div", { class: "flex gap-8" }, null, -1)),
360
+ r(h, {
361
+ modelValue: t(m).searchKey,
362
+ "onUpdate:modelValue": o[2] || (o[2] = (s) => t(m).searchKey = s),
363
+ class: "",
364
+ placeholder: "search",
365
+ collapsible: ""
366
+ }, null, 8, ["modelValue"])
367
+ ]),
368
+ r(D, {
369
+ "row-data": t(R),
370
+ "column-defs": U,
371
+ "search-value": t(m).searchKey,
372
+ "column-filter": t(m).columnFilters,
373
+ onRowClick: o[3] || (o[3] = (s) => O(s.original)),
374
+ "hide-footer": t(R).length < 10
375
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
376
+ ], 64)) : (v(), S(k, {
377
+ key: 1,
378
+ variant: "outlined",
379
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
380
+ }, {
381
+ default: L(() => [
382
+ o[7] || (o[7] = u("img", {
383
+ src: z,
384
+ class: "aspect-square w-[150px]"
385
+ }, null, -1)),
386
+ u("div", ve, [
387
+ u("div", ge, $(t(n)("connect.storeRewards.empty.title")), 1),
388
+ u("div", be, $(t(n)("connect.storeRewards.empty.description")), 1)
389
+ ]),
390
+ r(d, {
391
+ variant: "primary",
392
+ label: t(n)("connect.storeRewards.empty.action"),
393
+ onClick: o[4] || (o[4] = (s) => O()),
394
+ icon: "add"
395
+ }, null, 8, ["label"])
396
+ ]),
397
+ _: 1
398
+ })),
399
+ r(ye, {
400
+ ref_key: "rewardSheetRef",
401
+ ref: x,
402
+ onUpdate: o[5] || (o[5] = (s) => l(s))
403
+ }, null, 512)
404
+ ])
405
+ ], 64);
406
+ };
407
+ }
408
+ });
409
+ export {
410
+ He as default
411
+ };
@@ -1,20 +1,20 @@
1
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-C60MHxcY.js";
2
+ import { u as B } from "./loading-DnOIUurW.js";
3
3
  import { J as P } from "./JsonViewer-v8_C7l5N.js";
4
- import { _ as D } from "./ZodTextField.vue_vue_type_script_setup_true_lang-v8ldXm6Z.js";
5
- import { _ as I } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-BsdG--yC.js";
4
+ import { _ as D } from "./ZodTextField.vue_vue_type_script_setup_true_lang-DmAp9RCh.js";
5
+ import { _ as I } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-DK43Thdk.js";
6
6
  import { Z as L } from "./zod-Bg2FbC-D.js";
7
7
  import { u as V } from "./app-wDQR6dpb.js";
8
8
  import { defineStore as N } from "pinia";
9
- import { r as k } from "./index-CT0nrvtM.js";
10
- import "./index-DSdlmakQ.js";
11
- import "./index-IrZw6oc7.js";
12
- import "./index-CeoqYPxu.js";
13
- import "./index-B751j7lu.js";
14
- import { c as E } from "./index-buNf3deq.js";
15
- import "./index-CaNPlQfc.js";
16
- import "./index-DMGD2o0j.js";
17
- import { u as J } from "./vue-i18n-6NpmRo5N.js";
9
+ import { r as k } from "./index-DjFtudP6.js";
10
+ import "./index-M7HcGbUR.js";
11
+ import "./index-DzS80tJT.js";
12
+ import "./index-BUrDd60O.js";
13
+ import "./index-BMqxenYA.js";
14
+ import { c as E } from "./index-D2PcDli9.js";
15
+ import "./index-WCkLBzXH.js";
16
+ import "./index-Bs1GmcxM.js";
17
+ import { u as J } from "./vue-i18n-C3CGuKMm.js";
18
18
  import { c as C } from "./object-qECH92oz.js";
19
19
  import { useDialog as Z } from "@feedmepos/ui-library";
20
20
  const A = N("mf-connect-referral", () => {