@feedmepos/mf-connect 0.1.0-beta.26 → 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 (81) hide show
  1. package/dist/{Analytic-nWgaDcuj.js → Analytic-DMLcfl4K.js} +8 -8
  2. package/dist/{App-8pAVWKli.js → App-gLuWbsNM.js} +6 -6
  3. package/dist/{Broadcast-uQZZYZ3O.js → Broadcast-tCGOdX8O.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CAKASMSL.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Bw8KlwWo.js} +8 -8
  5. package/dist/{Card-eRpITqL2.js → Card-D3JMbxw7.js} +15 -15
  6. package/dist/{Collections-BJGH-TZw.js → Collections-ttXmrLkk.js} +4 -4
  7. package/dist/{Credit-QgZNA479.js → Credit-BpHRY05w.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-YtTddruX.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BfpJ1XYe.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-yth6xoBg.js → EffectSheet.vue_vue_type_style_index_0_lang-Da7s-22r.js} +6 -6
  10. package/dist/{Experience-yVM-HeM-.js → Experience-CDeg0imW.js} +8 -8
  11. package/dist/{Game-DNK6wwpG.js → Game-BarBKwSm.js} +8 -8
  12. package/dist/{Index-CSFWRv1I.js → Index-B5-D8dc5.js} +9 -9
  13. package/dist/{Marketing-DKnXzHlB.js → Marketing-Bz8VDhoj.js} +5 -5
  14. package/dist/{Member-CljN57EY.js → Member-BqetTnme.js} +4 -4
  15. package/dist/{MemberList-Bhbv7hMc.js → MemberList-DMqaKWV_.js} +15 -15
  16. package/dist/{MemberTransactions-BVDULJIp.js → MemberTransactions-qdegwy1T.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Dhpv04k8.js → MessageInput.vue_vue_type_script_setup_true_lang-CxuDJMul.js} +2 -2
  18. package/dist/{Mission-Cwcb_L2R.js → Mission-Cj-IgN35.js} +8 -8
  19. package/dist/{Overview-6chZ_0IF.js → Overview-lGdRpa6I.js} +18 -18
  20. package/dist/{Point-DXWVRGD7.js → Point-QwyIu513.js} +8 -8
  21. package/dist/{Promotion-DrEBFuE2.js → Promotion-BE395GwA.js} +9 -9
  22. package/dist/{Record-BSnTocH_.js → Record-C5xf9Hex.js} +59 -57
  23. package/dist/Reward-unGOFCyw.js +411 -0
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BmIB5ygq.js → RewardGroup.vue_vue_type_script_setup_true_lang-DJdhlMFJ.js} +12 -12
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BJVzhG5R.js → RuleGroup.vue_vue_type_script_setup_true_lang-DYZQ9hvN.js} +14 -14
  26. package/dist/{Segment-R9QCvjR2.js → Segment-BI_4s8tG.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-B_RcIhRv.js → SelectItems.vue_vue_type_script_setup_true_lang-WDUey8op.js} +2 -2
  28. package/dist/{Setting-BKDr2B8y.js → Setting-BAUhD4jc.js} +8 -8
  29. package/dist/{Store-D3VZDRrX.js → Store-BWH9HbPz.js} +19 -19
  30. package/dist/{StoreRewards-amPk4aUd.js → StoreRewards-DH09iyHe.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CFhE5jID.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-vloHGKw5.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DhrhxxtP.js} +1 -1
  33. package/dist/{Tier-DVYftWyS.js → Tier-EXLby49_.js} +20 -20
  34. package/dist/{Title-C9AjDmAq.js → Title-Cv-5hbiI.js} +20 -20
  35. package/dist/{Transaction-Bm80hP1L.js → Transaction-DZ9em67G.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Df9FcVCi.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DK43Thdk.js} +6 -6
  37. package/dist/{Voucher-Br84hxe8.js → Voucher-DYJINrTR.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-B3VxxrkI.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-BUKzA310.js → ZodTextField.vue_vue_type_script_setup_true_lang-DmAp9RCh.js} +1 -1
  40. package/dist/{app-DPneKcvY.js → app-B6oXj4kE.js} +1 -1
  41. package/dist/{app-D-y-ewHQ.js → app-BApWh_Pu.js} +28 -28
  42. package/dist/app.js +1 -1
  43. package/dist/{business-PRK3l1Bt.js → business-CwkNQpX3.js} +1 -1
  44. package/dist/{campaign-SH-TwXyF.js → campaign-I6i9noxn.js} +2 -2
  45. package/dist/{collectible.enum-BE7c7yxF.js → collectible.enum-C2T3wxes.js} +1 -1
  46. package/dist/{collection.fn-BbDEbdiO.js → collection.fn-C6x7w1_J.js} +2 -2
  47. package/dist/{dto-CVN8HLVh.js → dto-CPC4zpNc.js} +51 -51
  48. package/dist/{effect-tIGaHmn7.js → effect-Cz1i7ErO.js} +1 -1
  49. package/dist/{email-addresses-B_G_5Zui.js → email-addresses-B8nd_073.js} +1 -1
  50. package/dist/{export-BFQ_bzr9.js → export-zXP6IfB2.js} +3 -3
  51. package/dist/{helper-BYW3ASFQ.js → helper-C3bZBttW.js} +1 -1
  52. package/dist/{index-CeYEkjhZ.js → index-BMqxenYA.js} +4 -4
  53. package/dist/{index-dOp-9gH2.js → index-BUrDd60O.js} +4 -4
  54. package/dist/index-Bs1GmcxM.js +54 -0
  55. package/dist/{index-TB7Fxqg9.js → index-CgKJ33t7.js} +1 -1
  56. package/dist/{index-D4z9LW-R.js → index-CmZvS-OJ.js} +1 -1
  57. package/dist/{index-B8eQWkxC.js → index-D2PcDli9.js} +8 -8
  58. package/dist/{index-BAJzCr5v.js → index-DE2d5z9p.js} +3 -3
  59. package/dist/{index-1Gjg5cYA.js → index-DjFtudP6.js} +1 -1
  60. package/dist/{index-wEI_kJtt.js → index-DzS80tJT.js} +2 -2
  61. package/dist/{index-Cn02z0Gy.js → index-M7HcGbUR.js} +3 -3
  62. package/dist/{index-86B47Bvg.js → index-Ouu648YI.js} +1 -1
  63. package/dist/{index-BjsRlKiK.js → index-WCkLBzXH.js} +1 -1
  64. package/dist/{index-CP80MA8I.js → index-yV1Y_iX0.js} +1 -1
  65. package/dist/{index.esm2017-D6ypSj1h.js → index.esm2017-BtDmZi0y.js} +1 -1
  66. package/dist/{loading-StA80yN6.js → loading-DnOIUurW.js} +4 -4
  67. package/dist/{membership-pa0VGvsZ.js → membership-CinggB2b.js} +3 -3
  68. package/dist/{money-DcWVWcoe.js → money-B491m1hF.js} +1 -1
  69. package/dist/{number-B4nyi5Bl.js → number-H31aAXGx.js} +1 -1
  70. package/dist/{objectid-RxO3MBrq.js → objectid-BxvIDDKr.js} +1 -1
  71. package/dist/{reward-DW2nSSXq.js → reward-DZfEY37x.js} +1 -1
  72. package/dist/{rule-B5k3SOKH.js → rule-96lWAM_m.js} +3 -3
  73. package/dist/{rule-builder-7UIxqB78.js → rule-builder-Cpc6Ahrc.js} +1 -1
  74. package/dist/{template-DlTcEKSy.js → template-DSj09PBB.js} +4 -4
  75. package/dist/{trigger-BSFoFXuX.js → trigger-DGBb2o0r.js} +4 -4
  76. package/dist/{user-Cxxp-QMH.js → user-CWu4w0H9.js} +1 -1
  77. package/dist/{vue-i18n-Dz5tqlfS.js → vue-i18n-C3CGuKMm.js} +256 -256
  78. package/dist/{xlsx-B6CK4SN0.js → xlsx-DtLsDtB7.js} +1 -1
  79. package/package.json +1 -1
  80. package/dist/Reward-97BpaA4D.js +0 -399
  81. package/dist/index-D0mXXIp3.js +0 -53
@@ -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-StA80yN6.js";
5
- import { u as ee } from "./business-PRK3l1Bt.js";
6
- import { u as oe } from "./campaign-SH-TwXyF.js";
7
- import { u as te } from "./vue-i18n-Dz5tqlfS.js";
8
- import { g as V } from "./dto-CVN8HLVh.js";
9
- import { e as L } from "./effect-tIGaHmn7.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-YtTddruX.js";
12
- import { u as se } from "./template-DlTcEKSy.js";
13
- import { c as u } from "./index-D4z9LW-R.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) {
@@ -1,64 +1,66 @@
1
- import { defineComponent as v, ref as w, resolveComponent as y, openBlock as R, createBlock as z, unref as o, isRef as I, withCtx as M, createElementVNode as F, createVNode as C, h as u, onMounted as A, createElementBlock as V, Fragment as $ } from "vue";
2
- import { u as N, _ as B } from "./usePagination-BeF5K3M7.js";
3
- import { g as b } from "./user-Cxxp-QMH.js";
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
4
  import { components as g } from "@feedmepos/ui-library";
5
- import { u as E, a as U, c as L } from "./loading-StA80yN6.js";
6
- import { u as T } from "./vue-i18n-Dz5tqlfS.js";
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
7
  import { useCoreStore as O } from "@feedmepos/mf-common";
8
- import { r as P } from "./index-1Gjg5cYA.js";
8
+ import { r as P } from "./index-DjFtudP6.js";
9
9
  import { c as K, a as W } from "./object-qECH92oz.js";
10
- import { u as j } from "./membership-pa0VGvsZ.js";
11
- const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
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
12
  __name: "UpdateCriteriaProgressSheet",
13
13
  emits: ["refresh"],
14
14
  setup(k, { expose: p, emit: h }) {
15
- const c = h;
15
+ const u = h;
16
16
  T();
17
- const { minor: _ } = E, i = w(!1), a = w({}), S = O(), e = [
17
+ const { minor: _ } = B, n = w(!1), a = w({}), S = O(), e = [
18
18
  {
19
19
  header: "Criteria title",
20
- accessorFn: (s) => s.name
20
+ accessorFn: (i) => i.name
21
21
  },
22
22
  {
23
23
  header: "Status",
24
- cell(s) {
24
+ cell(i) {
25
25
  var x;
26
- const t = s.row.original, l = (x = a.value.criteria_progress) == null ? void 0 : x.some(
26
+ const t = i.row.original, l = (x = a.value.criteria_progress) == null ? void 0 : x.find(
27
27
  (D) => D.criteria === t._id
28
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 u(g.FmChip, {
30
- label: d,
31
- compact: !0,
32
- class: m
33
- });
29
+ return [
30
+ c(g.FmChip, {
31
+ label: d,
32
+ compact: !0,
33
+ class: m
34
+ })
35
+ ];
34
36
  }
35
37
  },
36
38
  {
37
39
  id: "actions",
38
- cell(s) {
40
+ cell(i) {
39
41
  var d;
40
- const t = s.row.original;
42
+ const t = i.row.original;
41
43
  return [
42
- ((d = a.value.criteria_progress) == null ? void 0 : d.some(
44
+ !((d = a.value.criteria_progress) == null ? void 0 : d.some(
43
45
  (m) => m.criteria === t._id
44
- )) ? null : u(g.FmButton, {
46
+ )) && t.type == "MANUAL" ? c(g.FmButton, {
45
47
  variant: "secondary",
46
48
  label: "Mark as completed",
47
49
  size: "md",
48
50
  onClick: (m) => {
49
51
  m.stopPropagation(), r(t._id.toString());
50
52
  }
51
- })
53
+ }) : null
52
54
  ];
53
55
  }
54
56
  }
55
57
  ];
56
- async function r(s) {
58
+ async function r(i) {
57
59
  var l;
58
60
  const t = K(W(a.value));
59
61
  t.criteria_progress = [
60
62
  {
61
- criteria: s,
63
+ criteria: i,
62
64
  ref: `ADMIN:${(l = S.user) == null ? void 0 : l.id}:${(/* @__PURE__ */ new Date()).toISOString()}`,
63
65
  completedAt: /* @__PURE__ */ new Date()
64
66
  }
@@ -67,7 +69,7 @@ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
67
69
  await P.updateCriteriaProgress(
68
70
  a.value._id,
69
71
  t
70
- ), i.value = !1, c("refresh");
72
+ ), n.value = !1, u("refresh");
71
73
  },
72
74
  {
73
75
  message: "Updating criteria progress",
@@ -75,25 +77,25 @@ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
75
77
  }
76
78
  );
77
79
  }
78
- function n(s, t) {
79
- i.value = s, a.value = t;
80
+ function s(i, t) {
81
+ n.value = i, a.value = t;
80
82
  }
81
83
  function f() {
82
- i.value = !1;
84
+ n.value = !1;
83
85
  }
84
86
  return p({
85
- showSheet: n,
87
+ showSheet: s,
86
88
  hideSheet: f,
87
89
  data: a
88
- }), (s, t) => {
90
+ }), (i, t) => {
89
91
  const l = y("FmTable"), d = y("FmSideSheet");
90
92
  return R(), z(d, {
91
93
  "max-width": 768,
92
- modelValue: o(i),
93
- "onUpdate:modelValue": t[0] || (t[0] = (m) => I(i) ? i.value = m : null),
94
+ modelValue: o(n),
95
+ "onUpdate:modelValue": t[0] || (t[0] = (m) => A(n) ? n.value = m : null),
94
96
  header: "Referee Criteria"
95
97
  }, {
96
- default: M(() => [
98
+ default: I(() => [
97
99
  F("div", q, [
98
100
  C(l, {
99
101
  "row-data": o(a).criteria,
@@ -107,7 +109,7 @@ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
107
109
  }, 8, ["modelValue"]);
108
110
  };
109
111
  }
110
- }), ae = /* @__PURE__ */ v({
112
+ }), ae = /* @__PURE__ */ b({
111
113
  __name: "Record",
112
114
  setup(k) {
113
115
  j();
@@ -118,17 +120,17 @@ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
118
120
  maxWidth: "100px"
119
121
  },
120
122
  cell(e) {
121
- return u("div", { class: "flex items-center" }, [
122
- u(g.FmIcon, {
123
+ return c("div", { class: "flex items-center" }, [
124
+ c(g.FmIcon, {
123
125
  name: "content_copy",
124
126
  outline: !0,
125
127
  size: "sm",
126
128
  class: "cursor-pointer mr-4",
127
129
  onClick: (r) => {
128
- r.preventDefault(), r.stopPropagation(), U(e.row.original._id.toString());
130
+ r.preventDefault(), r.stopPropagation(), E(e.row.original._id.toString());
129
131
  }
130
132
  }),
131
- u(
133
+ c(
132
134
  "div",
133
135
  { class: "pr-2 text-ellipsis overflow-hidden" },
134
136
  e.row.original._id.toString()
@@ -141,14 +143,14 @@ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
141
143
  header: "Referer info",
142
144
  enableSorting: !0,
143
145
  cell(e) {
144
- return e.row.original.pf_referer ? b(e.row.original.pf_referer, !0) : "N/A";
146
+ return e.row.original.pf_referer ? v(e.row.original.pf_referer, !0) : "N/A";
145
147
  }
146
148
  },
147
149
  {
148
150
  header: "Referee info",
149
151
  enableSorting: !0,
150
152
  cell(e) {
151
- return e.row.original.pf_referee ? b(e.row.original.pf_referee, !0) : "N/A";
153
+ return e.row.original.pf_referee ? v(e.row.original.pf_referee, !0) : "N/A";
152
154
  }
153
155
  },
154
156
  {
@@ -156,8 +158,8 @@ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
156
158
  accessorKey: "criteria",
157
159
  id: "criteria",
158
160
  cell(e) {
159
- const r = e.row.original.criteria_progress.length, n = e.row.original.criteria.length;
160
- return u("div", `${r}/${n} completed criteria`);
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`);
161
163
  }
162
164
  },
163
165
  {
@@ -165,32 +167,32 @@ const q = { class: "flex flex-col space-y-16 pr-12" }, G = /* @__PURE__ */ v({
165
167
  id: "status",
166
168
  cell(e) {
167
169
  const r = e.row.original.status;
168
- return u(g.FmChip, {
170
+ return c(g.FmChip, {
169
171
  label: L.title(r),
170
172
  compact: !0,
171
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"
172
174
  });
173
175
  }
174
176
  }
175
- ], { tableMeta: c, rowData: _, onSort: i, debouncedFetchData: a, onSearch: S } = N(P.readRecords);
176
- return A(async () => {
177
+ ], { tableMeta: u, rowData: _, onSort: n, debouncedFetchData: a, onSearch: S } = $(P.readRecords);
178
+ return M(async () => {
177
179
  await a();
178
- }), (e, r) => (R(), V($, null, [
180
+ }), (e, r) => (R(), N(V, null, [
179
181
  F("div", null, [
180
- C(B, {
181
- loading: o(c).isLoading,
182
+ C(U, {
183
+ loading: o(u).isLoading,
182
184
  "row-data": o(_),
183
- "row-count": o(c).totalRows,
185
+ "row-count": o(u).totalRows,
184
186
  "column-defs": h,
185
187
  "shrink-at": !1,
186
- "page-count": o(c).pageCount,
187
- "page-index": o(c).pageIndex,
188
- "page-size": o(c).pageSize,
189
- onSortChange: o(i),
190
- onPageChange: r[0] || (r[0] = (n) => o(a)({ pageSize: n.pageSize, pageIndex: n.pageIndex })),
191
- onRowClick: r[1] || (r[1] = (n) => {
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) => {
192
194
  var f;
193
- return (f = o(p)) == null ? void 0 : f.showSheet(!0, n.original);
195
+ return (f = o(p)) == null ? void 0 : f.showSheet(!0, s.original);
194
196
  })
195
197
  }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
196
198
  ]),
@@ -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
+ };