@feedmepos/mf-connect 0.1.0-beta.7 → 0.1.0-beta.71

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 (126) hide show
  1. package/dist/Analytic-CnF_WeRZ.js +427 -0
  2. package/dist/{App-DalxIjTu.js → App-DJwSTuRa.js} +445 -420
  3. package/dist/AuditLogs-RarW2PHL.js +1886 -0
  4. package/dist/Bin-BaixTvHW.js +166 -0
  5. package/dist/{Broadcast-uMAvsC--.js → Broadcast-8DEAMhyM.js} +56 -54
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-JxbENan8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DPXoOupI.js} +6 -8
  7. package/dist/Card-DRwLZ-Mn.js +896 -0
  8. package/dist/Collections-WsPM9v03.js +459 -0
  9. package/dist/{Credit-QlnatflM.js → Credit-DMxRdTzt.js} +36 -34
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bcj6o4Xi.js +2181 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BE07lc4M.js → EffectSheet.vue_vue_type_style_index_0_lang-CuJ8curT.js} +49 -49
  14. package/dist/{Experience-Czy41ifp.js → Experience-B0BV4Tc_.js} +32 -30
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
  16. package/dist/Game-Bu6kJJHx.js +278 -0
  17. package/dist/Index-CX-aPFQt.js +259 -0
  18. package/dist/Marketing-CiVFwl6S.js +20071 -0
  19. package/dist/Member-DZfTtt13.js +333 -0
  20. package/dist/MemberList-CscwsZnv.js +1598 -0
  21. package/dist/MemberTransactions-BWNs6bUm.js +45 -0
  22. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CtM73bcN.js → MessageInput.vue_vue_type_script_setup_true_lang-BrbRudIU.js} +134 -122
  23. package/dist/Mission-CyJ-9Qfl.js +296 -0
  24. package/dist/Overview-DLyt6VId.js +1078 -0
  25. package/dist/{Point-By6ogYy_.js → Point-Cc_0-RKm.js} +55 -53
  26. package/dist/Promotion-KqA8nev2.js +289 -0
  27. package/dist/Queue-i8--zps9.js +249 -0
  28. package/dist/Record-CLUO1JVc.js +340 -0
  29. package/dist/Reward-BEdUKQ3M.js +442 -0
  30. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-B9vnSbWj.js +150 -0
  31. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-B8zw1TmO.js +1727 -0
  32. package/dist/Segment-B8sYajZG.js +568 -0
  33. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CmmI5Vwl.js +181 -0
  34. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-CIcXjbJG.js +186 -0
  35. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DY3FMuIf.js +147 -0
  36. package/dist/Setting-DT8dRb2A.js +1931 -0
  37. package/dist/Store-BhsPWRkR.js +1841 -0
  38. package/dist/StoreRewards-Cx2WDZ3p.js +423 -0
  39. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Byb7GOoh.js +1028 -0
  40. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-nEdCD6la.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Cb-FGTO9.js} +1 -1
  41. package/dist/{Tier-DvAs0-yx.js → Tier-kQy1vGwo.js} +327 -318
  42. package/dist/{Title-B_Trr39o.js → Title-DKv8FqpX.js} +224 -209
  43. package/dist/{Transaction-DCJw-b3H.js → Transaction-CSLllOgl.js} +2 -2
  44. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-CvpBdNBn.js +130 -0
  45. package/dist/Voucher-BP6fmSwu.js +354 -0
  46. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-CxQEg_HW.js +419 -0
  47. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DXkhu8e9.js → ZodTextField.vue_vue_type_script_setup_true_lang-aurdXO2X.js} +1 -1
  48. package/dist/app-B3qgrQOd.js +7079 -0
  49. package/dist/app-s3iL79De.js +33357 -0
  50. package/dist/app.js +1 -1
  51. package/dist/business-DG2w8U-i.js +79 -0
  52. package/dist/campaign-BP6Rz-AH.js +1810 -0
  53. package/dist/{campaign--0_yMbMV.js → campaign-WPRZ4BRF.js} +2 -2
  54. package/dist/campaign.enum-CoqrWNTZ.js +20 -0
  55. package/dist/campaign.fn-BRPigTOA.js +758 -0
  56. package/dist/collectible.enum-Dy4sxF43.js +19 -0
  57. package/dist/{collection.fn-3TwPe7aF.js → collection.fn-DGnLyYgV.js} +2 -2
  58. package/dist/dto-xZ9I6-Jr.js +214 -0
  59. package/dist/{effect-BeR0LK61.js → effect-C0XoYTus.js} +33 -16
  60. package/dist/email-addresses-CJ87c7W1.js +705 -0
  61. package/dist/{export-xeLLhqvh.js → export-qlV-AbEl.js} +5 -5
  62. package/dist/{helper-B5iqfKh8.js → helper-DzYe8aNx.js} +1 -1
  63. package/dist/{index-BOdtpNkP.js → index-4vdSri7m.js} +266 -173
  64. package/dist/{index-CU_d8jjU.js → index-BfSj7cUl.js} +1 -1
  65. package/dist/index-Bj0ULpXi.js +29556 -0
  66. package/dist/index-BnZ4yaMH.js +115 -0
  67. package/dist/index-Bo5DJXxs.js +54 -0
  68. package/dist/{index-Ct_wR519.js → index-BuvJH6SU.js} +24 -21
  69. package/dist/index-C2GEs8di.js +32 -0
  70. package/dist/{index-CyKZ-SsN.js → index-CJuOTcCE.js} +1 -1
  71. package/dist/index-CsaQJMAR.js +66 -0
  72. package/dist/{index-DP-dGMJC.js → index-DReysUPw.js} +2230 -871
  73. package/dist/{index-CAn5heDe.js → index-DgCjRb3o.js} +48 -4
  74. package/dist/index-IwITtvVu.js +56 -0
  75. package/dist/{index-Bh-uaaBG.js → index-n3wiQlbk.js} +1506 -1480
  76. package/dist/index-vh86FiIQ.js +10 -0
  77. package/dist/{index.esm2017-5jeDA5Zo.js → index.esm2017-CkJhTmme.js} +154 -154
  78. package/dist/loading-DwJdwl4G.js +71 -0
  79. package/dist/{membership-D0nqqWNZ.js → membership-DvPK3h8f.js} +54 -46
  80. package/dist/money-C_WIbr_x.js +15 -0
  81. package/dist/number-ZeVoGhzP.js +12 -0
  82. package/dist/objectid-8lkX6otO.js +145 -0
  83. package/dist/{loading-C-JDVajU.js → plugins-D20keyDW.js} +2990 -3062
  84. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  85. package/dist/reward-CqnMEq_w.js +36 -0
  86. package/dist/{rule-Dn_GgBCe.js → rule-D7htGgWz.js} +185 -178
  87. package/dist/{rule-builder-BXt29Es4.js → rule-builder-BbJpYQ0n.js} +1 -1
  88. package/dist/style.css +1 -1
  89. package/dist/{template-D2Oi3dxP.js → template-BWQCVHm7.js} +5 -5
  90. package/dist/trigger-DMuv0_O7.js +144 -0
  91. package/dist/user-C_v2C0qN.js +54 -0
  92. package/dist/vue-i18n-N8_TEEd0.js +2365 -0
  93. package/dist/{xlsx-CCRCidY2.js → xlsx-CsPDNSTo.js} +1 -1
  94. package/package.json +11 -7
  95. package/dist/Analytic-BMpS6jWb.js +0 -622
  96. package/dist/Card-DV8-g69L.js +0 -825
  97. package/dist/Collections-DRafEHT1.js +0 -453
  98. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-TDoMehSB.js +0 -2813
  99. package/dist/Game-CD3zSitz.js +0 -255
  100. package/dist/Marketing-NNes8z6Q.js +0 -316
  101. package/dist/Member-CTqBgYuV.js +0 -69
  102. package/dist/MemberList-B99tS5ce.js +0 -1733
  103. package/dist/MemberTransactions-D1YCXPOg.js +0 -38
  104. package/dist/Mission-XbBVKBiE.js +0 -261
  105. package/dist/Promotion-DKcBr-RI.js +0 -247
  106. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D1ESqEFO.js +0 -1753
  107. package/dist/Segment-B8cszL-F.js +0 -437
  108. package/dist/Setting-aZYABlMW.js +0 -1901
  109. package/dist/Store-Bx2tyJwe.js +0 -1511
  110. package/dist/StoreRewards-DTp9G6gw.js +0 -401
  111. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B2W7ly5Z.js +0 -890
  112. package/dist/Voucher-jqv3ji90.js +0 -490
  113. package/dist/app-WlcUVbFb.js +0 -5764
  114. package/dist/app-_w0hjM7u.js +0 -53428
  115. package/dist/business-BC4-i1cU.js +0 -78
  116. package/dist/dto-Ns2dLn1B.js +0 -2770
  117. package/dist/index-BWb9vRCi.js +0 -29193
  118. package/dist/index-CpU9aqyW.js +0 -206
  119. package/dist/index-CqO_ZvtD.js +0 -99
  120. package/dist/index-CuvNtC_M.js +0 -61
  121. package/dist/index-DsNsA2uX.js +0 -298
  122. package/dist/index-WAMr3npT.js +0 -762
  123. package/dist/money-hdbrblud.js +0 -15
  124. package/dist/number-CRWGOZaW.js +0 -12
  125. package/dist/user-Bm4KttFq.js +0 -37
  126. package/dist/vue-i18n-Dud8fvmw.js +0 -2365
@@ -0,0 +1,181 @@
1
+ import { defineComponent as N, computed as f, ref as V, onMounted as H, resolveComponent as _, openBlock as c, createElementBlock as u, createVNode as i, withCtx as S, createElementVNode as p, toDisplayString as q, normalizeClass as A, Fragment as x, renderList as j, createCommentVNode as B } from "vue";
2
+ import { J as D } from "./app-s3iL79De.js";
3
+ import "./plugins-D20keyDW.js";
4
+ import { c as E } from "./object-qECH92oz.js";
5
+ const J = { class: "flex flex-col flex-nowrap" }, M = { class: "flex gap-16 items-center w-full" }, T = { class: "flex grow items-center" }, $ = { class: "grow text-fm-color-typo-secondary" }, z = { key: 0 }, K = { class: "px-16" }, X = /* @__PURE__ */ N({
6
+ __name: "SelectItems",
7
+ props: {
8
+ initialValue: {
9
+ type: Array,
10
+ default: () => []
11
+ },
12
+ filterItems: {
13
+ type: Function,
14
+ default: void 0
15
+ },
16
+ onComplete: {
17
+ type: Function,
18
+ required: !0
19
+ },
20
+ maxHeight: {
21
+ type: [String, Number],
22
+ default: 380
23
+ }
24
+ },
25
+ setup(F, { expose: O }) {
26
+ const m = F, b = D(), w = f(() => b.menu.value || {
27
+ _id: "",
28
+ modules: {
29
+ catalog: [],
30
+ category: [],
31
+ item: [],
32
+ variant: [],
33
+ group: [],
34
+ takeaway: [],
35
+ scheduler: [],
36
+ printDepartment: [],
37
+ recipe: [],
38
+ sku: [],
39
+ unit: [],
40
+ cookingGuide: [],
41
+ serveSequence: []
42
+ }
43
+ }), k = f(() => {
44
+ const n = m.filterItems ?? ((t) => !!t.category);
45
+ return w.value.modules.item.filter(n).reduce((t, l) => {
46
+ const a = {
47
+ id: l._id,
48
+ category: l.category,
49
+ name: (l.name2 || l.name).trim()
50
+ };
51
+ return t = [...t, a], t;
52
+ }, []);
53
+ }), C = f(() => {
54
+ const n = w.value.modules.category.reduce((e, t) => (e[t._id] = {
55
+ id: t._id,
56
+ name: t.name,
57
+ items: {}
58
+ }, e), {});
59
+ return k.value.reduce(
60
+ (e, t) => {
61
+ const l = t.category ?? "";
62
+ return e[l].items = {
63
+ ...e[l].items,
64
+ [t.id]: t
65
+ }, e;
66
+ },
67
+ {
68
+ ...n,
69
+ "": {
70
+ id: "",
71
+ name: "Addons",
72
+ items: {}
73
+ }
74
+ }
75
+ );
76
+ }), v = f(() => {
77
+ const n = y.value.toLowerCase();
78
+ return n ? Object.entries(C.value).reduce((e, [t, l]) => {
79
+ if (l.name.toLowerCase().includes(n))
80
+ return e[t] = l, e;
81
+ const a = Object.entries(l.items).reduce((d, [h, o]) => (o.name.toLowerCase().includes(n) && (d[h] = o), d), {});
82
+ return Object.keys(a).length > 0 && (e[t] = { ...l, items: a }), e;
83
+ }, {}) : C.value;
84
+ }), s = V({}), y = V(""), G = f(() => Object.values(s.value).filter((n) => !!n).length);
85
+ function I(n) {
86
+ s.value = k.value.reduce((e, t) => (e[t.id] = n.includes(t.id), e), {});
87
+ }
88
+ H(async () => {
89
+ await b.store.getMenu(), I(m.initialValue);
90
+ });
91
+ function g(n) {
92
+ const e = Object.keys(v.value[n].items), t = e.filter((l) => s.value[l]);
93
+ return t.length ? t.length === e.length ? !0 : null : !1;
94
+ }
95
+ function U(n) {
96
+ const e = Object.keys(v.value[n].items), t = g(n), l = E(s.value);
97
+ for (const a of e)
98
+ l[a] = t !== !0;
99
+ s.value = l;
100
+ }
101
+ function L(n) {
102
+ s.value[n] = !s.value[n];
103
+ }
104
+ return O({
105
+ onConfirm: () => {
106
+ const n = Object.entries(s.value).filter(([, e]) => !!e).map(([e]) => e);
107
+ m.onComplete(n);
108
+ }
109
+ }), (n, e) => {
110
+ const t = _("fm-button"), l = _("FmTextField"), a = _("fm-list-item"), d = _("fm-checkbox"), h = _("fm-list");
111
+ return c(), u("div", J, [
112
+ i(a, {
113
+ tag: "div",
114
+ clickable: !1
115
+ }, {
116
+ default: S(() => [
117
+ p("div", M, [
118
+ p("div", T, [
119
+ i(t, {
120
+ icon: "sync",
121
+ variant: "tertiary",
122
+ onClick: e[0] || (e[0] = () => I([]))
123
+ }),
124
+ p("span", $, q(G.value) + " product(s) selected ", 1)
125
+ ]),
126
+ i(l, {
127
+ modelValue: y.value,
128
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => y.value = o),
129
+ placeholder: "Search",
130
+ "leading-icon": { name: "search", color: "" },
131
+ style: { width: "200px", "min-width": "200px" }
132
+ }, null, 8, ["modelValue"])
133
+ ])
134
+ ]),
135
+ _: 1
136
+ }),
137
+ i(h, {
138
+ class: A(["grow overflow-y-auto", `max-h-${m.maxHeight ? `[${m.maxHeight}px]` : "full"}`])
139
+ }, {
140
+ default: S(() => [
141
+ (c(!0), u(x, null, j(v.value, (o) => (c(), u(x, {
142
+ key: o.id
143
+ }, [
144
+ Object.keys(o.items).length > 0 ? (c(), u("div", z, [
145
+ p("div", K, [
146
+ i(d, {
147
+ "model-value": g(o.id) ?? !1,
148
+ indeterminate: g(o.id) === null,
149
+ label: o.name,
150
+ value: "",
151
+ name: "",
152
+ sublabel: "",
153
+ class: "w-full",
154
+ "onUpdate:modelValue": () => U(o.id)
155
+ }, null, 8, ["model-value", "indeterminate", "label", "onUpdate:modelValue"])
156
+ ]),
157
+ (c(!0), u(x, null, j(o.items, (r) => (c(), u("div", {
158
+ key: r.id,
159
+ class: "pl-48"
160
+ }, [
161
+ i(d, {
162
+ "model-value": s.value[r.id],
163
+ label: r.name,
164
+ value: r.id,
165
+ name: r.name,
166
+ class: "w-full",
167
+ "onUpdate:modelValue": () => L(r.id)
168
+ }, null, 8, ["model-value", "label", "value", "name", "onUpdate:modelValue"])
169
+ ]))), 128))
170
+ ])) : B("", !0)
171
+ ], 64))), 128))
172
+ ]),
173
+ _: 1
174
+ }, 8, ["class"])
175
+ ]);
176
+ };
177
+ }
178
+ });
179
+ export {
180
+ X as _
181
+ };
@@ -0,0 +1,186 @@
1
+ import { defineComponent as E, ref as u, computed as x, onMounted as L, resolveComponent as s, openBlock as O, createBlock as P, unref as e, isRef as Z, withCtx as h, createElementVNode as v, createVNode as i, toDisplayString as C } from "vue";
2
+ import { u as q } from "./loading-DwJdwl4G.js";
3
+ import { p as z } from "./plugins-D20keyDW.js";
4
+ import { u as D } from "./app-wDQR6dpb.js";
5
+ import { m as G } from "./index-BuvJH6SU.js";
6
+ import "./index-4vdSri7m.js";
7
+ import { b as H } from "./index-DReysUPw.js";
8
+ import "./index-n3wiQlbk.js";
9
+ import "./index-BfSj7cUl.js";
10
+ import "./index-Bo5DJXxs.js";
11
+ import { Z as p } from "./zod-Bg2FbC-D.js";
12
+ import { z as j } from "./app-B3qgrQOd.js";
13
+ import { u as J } from "./vue-i18n-N8_TEEd0.js";
14
+ import { c as K } from "./index-BnZ4yaMH.js";
15
+ const Q = { class: "fm-typo-en-body-lg-600" }, W = { class: "fm-typo-en-body-lg-400" }, X = { class: "flex items-center gap-8" }, fe = /* @__PURE__ */ E({
16
+ __name: "SendCollectionSheet",
17
+ emits: ["success"],
18
+ setup(Y, { expose: w, emit: V }) {
19
+ const { t: m } = J(), { minor: I } = q, k = V, a = u({
20
+ memberId: [],
21
+ amount: 1,
22
+ ref: ""
23
+ }), f = u(null), d = u(), b = u([]), r = u(!1), S = u(), T = H.extend({
24
+ ref: j.string().max(50, "Reference must be at most 50 characters").optional()
25
+ }), _ = x(() => {
26
+ var l;
27
+ switch ((l = f.value) == null ? void 0 : l.type) {
28
+ case "MISSION":
29
+ return m("connect.sendCollectionSheet.stamp");
30
+ case "GAME":
31
+ return m("connect.sendCollectionSheet.game_token");
32
+ default:
33
+ return "Unknown";
34
+ }
35
+ }), c = x(() => {
36
+ const l = T.safeParse(a.value);
37
+ return l.success ? [] : l.error.errors;
38
+ });
39
+ function M(l) {
40
+ r.value = !0, f.value = l.campaign, d.value = null, a.value = {
41
+ memberId: [],
42
+ amount: 1,
43
+ ref: ""
44
+ };
45
+ }
46
+ function F() {
47
+ r.value = !1;
48
+ }
49
+ async function g(l) {
50
+ const t = await G.read({
51
+ limit: 25,
52
+ skip: 0,
53
+ sortBy: "_id",
54
+ search: l,
55
+ descending: !1
56
+ });
57
+ b.value = t.resources.map((n) => ({
58
+ label: `${n.name} (${n.phoneNumber})`,
59
+ value: n._id
60
+ })), await new Promise((n) => setTimeout(n, 100));
61
+ }
62
+ async function U() {
63
+ var t;
64
+ await z.confirm(
65
+ m("connect.sendCollectionSheet.confirmation_message", {
66
+ amount: a.value.amount,
67
+ type: _.value,
68
+ memberName: d.value ? (t = b.value.find((n) => n.value === d.value)) == null ? void 0 : t.label : "Unknown Member"
69
+ }),
70
+ m("connect.common.confirm"),
71
+ m("connect.common.confirm"),
72
+ m("connect.common.cancel")
73
+ ) && await I(
74
+ async () => {
75
+ var n;
76
+ await K.sendCollection((n = f.value) == null ? void 0 : n._id.toString(), {
77
+ memberId: a.value.memberId,
78
+ amount: a.value.amount,
79
+ ref: a.value.ref
80
+ }), await k("success"), F();
81
+ },
82
+ {
83
+ message: "Sending claim(s)",
84
+ successMessage: "Claim(s) created"
85
+ }
86
+ );
87
+ }
88
+ return w({
89
+ showSheet: M,
90
+ hideSheet: F
91
+ }), L(async () => {
92
+ await g("");
93
+ }), (l, t) => {
94
+ const n = s("FmCard"), A = s("FmSelect"), B = s("FmStepperField"), N = s("FmTextField"), R = s("FmForm"), y = s("FmButton"), $ = s("FmSideSheet");
95
+ return O(), P($, {
96
+ "max-width": 560,
97
+ "dismiss-away": !0,
98
+ header: e(m)("connect.sendCollectionSheet.title", {
99
+ type: e(_)
100
+ }),
101
+ modelValue: e(r),
102
+ "onUpdate:modelValue": [
103
+ t[5] || (t[5] = (o) => Z(r) ? r.value = o : null),
104
+ t[6] || (t[6] = (o) => r.value = o)
105
+ ]
106
+ }, {
107
+ "side-sheet-footer": h(() => [
108
+ v("div", X, [
109
+ i(y, {
110
+ label: "Send",
111
+ loading: e(D)().isLoading,
112
+ onClick: t[3] || (t[3] = async () => {
113
+ var o;
114
+ return (o = e(S)) == null ? void 0 : o.validateInputs();
115
+ })
116
+ }, null, 8, ["loading"]),
117
+ i(y, {
118
+ label: "Cancel",
119
+ type: "button",
120
+ variant: "tertiary",
121
+ onClick: t[4] || (t[4] = (o) => r.value = !1)
122
+ })
123
+ ])
124
+ ]),
125
+ default: h(() => [
126
+ i(R, {
127
+ class: "space-y-16",
128
+ ref_key: "form",
129
+ ref: S,
130
+ onValidationSuccess: U,
131
+ blameFormChildOnValidationFailed: ""
132
+ }, {
133
+ default: h(() => [
134
+ i(n, {
135
+ variant: "outlined",
136
+ class: "p-16"
137
+ }, {
138
+ default: h(() => {
139
+ var o;
140
+ return [
141
+ v("div", Q, C(e(m)("connect.campaign.common.campaign")), 1),
142
+ v("div", W, C((o = e(f)) == null ? void 0 : o.name), 1)
143
+ ];
144
+ }),
145
+ _: 1
146
+ }),
147
+ i(A, {
148
+ "model-value": e(d),
149
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => {
150
+ e(a).memberId = [o], d.value = o;
151
+ }),
152
+ label: "Select member",
153
+ searchable: "",
154
+ items: e(b),
155
+ onSearch: g,
156
+ rules: [(o) => !!o > 0 || "Member is required"],
157
+ "helper-text": "Type to search member",
158
+ "helper-state": e(p).helperState(e(c), "memberId"),
159
+ "error-text": e(p).helperText(e(c), "memberId")
160
+ }, null, 8, ["model-value", "items", "rules", "helper-state", "error-text"]),
161
+ i(B, {
162
+ modelValue: e(a).amount,
163
+ "onUpdate:modelValue": t[1] || (t[1] = (o) => e(a).amount = o),
164
+ label: "Amount",
165
+ "helper-state": e(p).helperState(e(c), "amount"),
166
+ "helper-text": e(p).helperText(e(c), "amount")
167
+ }, null, 8, ["modelValue", "helper-state", "helper-text"]),
168
+ i(N, {
169
+ modelValue: e(a).ref,
170
+ "onUpdate:modelValue": t[2] || (t[2] = (o) => e(a).ref = o),
171
+ label: "Reference (optional)",
172
+ "helper-state": e(p).helperState(e(c), "ref"),
173
+ "helper-text": e(p).helperText(e(c), "ref")
174
+ }, null, 8, ["modelValue", "helper-state", "helper-text"])
175
+ ]),
176
+ _: 1
177
+ }, 512)
178
+ ]),
179
+ _: 1
180
+ }, 8, ["header", "modelValue"]);
181
+ };
182
+ }
183
+ });
184
+ export {
185
+ fe as _
186
+ };
@@ -0,0 +1,147 @@
1
+ import { defineComponent as L, ref as c, watch as S, onMounted as R, resolveComponent as f, openBlock as j, createBlock as B, unref as t, isRef as _, withCtx as V, createElementVNode as v, createVNode as m, toDisplayString as N } from "vue";
2
+ import { J as A } from "./JsonViewer-v8_C7l5N.js";
3
+ import { u as E } from "./loading-DwJdwl4G.js";
4
+ import { u as P } from "./app-wDQR6dpb.js";
5
+ import { l as U } from "./lodash-B5I3zXaY.js";
6
+ import { m as D } from "./index-BuvJH6SU.js";
7
+ import { c as J } from "./index-BnZ4yaMH.js";
8
+ const O = { class: "space-y-16" }, T = { class: "fm-typo-en-body-md-600" }, $ = { class: "flex items-center justify-end" }, q = { class: "flex items-center gap-8" }, ee = /* @__PURE__ */ L({
9
+ __name: "SendVoucherSheet",
10
+ emits: ["success"],
11
+ setup(G, { expose: w, emit: y }) {
12
+ const { minor: x } = E, h = c(""), l = c({}), C = y, r = c(!1), s = c([]);
13
+ function F(a) {
14
+ r.value = !0, h.value = a.campaignId, s.value = [];
15
+ }
16
+ function b() {
17
+ r.value = !1;
18
+ }
19
+ const I = [
20
+ {
21
+ header: "Name",
22
+ accessorFn: (a) => a.name || "No Profile"
23
+ },
24
+ {
25
+ header: "Phone",
26
+ accessorFn: (a) => a.phoneNumber || "-"
27
+ }
28
+ ], o = c({
29
+ searchValue: "",
30
+ pageSize: 10,
31
+ pageCount: 0,
32
+ pageIndex: 0,
33
+ totalRows: 0,
34
+ isLoading: !1
35
+ }), n = c([]), g = async (a) => {
36
+ o.value.isLoading = !0, n.value = [];
37
+ const e = await D.read({
38
+ limit: a.pageSize,
39
+ skip: a.pageIndex,
40
+ sortBy: "_id",
41
+ search: o.value.searchValue,
42
+ descending: !1
43
+ });
44
+ n.value = e.resources, o.value.totalRows = e.meta.totalResources ?? 0, o.value.pageCount = e.meta.totalPages ?? 0, o.value.isLoading = !1, l.value = {}, s.value.forEach((i) => {
45
+ const d = n.value.findIndex((p) => p._id == i);
46
+ d > -1 && (console.log(d, "fetch member index"), l.value[d] = !0);
47
+ });
48
+ };
49
+ function z() {
50
+ n.value.length > 0 && (s.value = s.value.filter(
51
+ (a) => !n.value.some((e) => e._id === a) || // Keep if not in current page
52
+ Object.entries(l.value).some(
53
+ ([e, i]) => i && n.value[e]._id === a
54
+ // Keep if selected in current page
55
+ )
56
+ ));
57
+ for (const [a, e] of Object.entries(l.value))
58
+ if (e) {
59
+ const i = n.value[a]._id;
60
+ s.value.includes(i) || s.value.push(i);
61
+ }
62
+ }
63
+ async function M(a) {
64
+ s.value.length < 1 || await x(
65
+ async () => {
66
+ await J.sendCollection(h.value, {
67
+ memberId: s.value
68
+ }), await C("success"), b();
69
+ },
70
+ {
71
+ message: "Sending claim(s)",
72
+ successMessage: "Claim(s) created"
73
+ }
74
+ );
75
+ }
76
+ return S(l, z, { deep: !0 }), S(
77
+ () => o.value.searchValue,
78
+ U.debounce(async () => {
79
+ await g({ pageSize: 10, pageIndex: 0 });
80
+ }, 500)
81
+ ), w({
82
+ showSheet: F,
83
+ hideSheet: b
84
+ }), R(async () => {
85
+ await g(o.value);
86
+ }), (a, e) => {
87
+ const i = f("FmSearch"), d = f("FmTable"), p = f("FmButton"), k = f("FmSideSheet");
88
+ return j(), B(k, {
89
+ "max-width": 560,
90
+ "dismiss-away": !0,
91
+ header: "Send voucher to",
92
+ modelValue: t(r),
93
+ "onUpdate:modelValue": [
94
+ e[3] || (e[3] = (u) => _(r) ? r.value = u : null),
95
+ e[4] || (e[4] = (u) => r.value = u)
96
+ ]
97
+ }, {
98
+ "side-sheet-footer": V(() => [
99
+ v("div", q, [
100
+ m(p, {
101
+ label: "Send",
102
+ loading: t(P)().isLoading,
103
+ onClick: M
104
+ }, null, 8, ["loading"]),
105
+ m(p, {
106
+ label: "Cancel",
107
+ type: "button",
108
+ variant: "tertiary",
109
+ onClick: e[2] || (e[2] = (u) => r.value = !1)
110
+ })
111
+ ])
112
+ ]),
113
+ default: V(() => [
114
+ m(A, { json: t(s) }, null, 8, ["json"]),
115
+ v("div", O, [
116
+ v("div", T, N(t(s).length) + " members selected ", 1),
117
+ v("div", $, [
118
+ m(i, {
119
+ class: "mt-4",
120
+ modelValue: t(o).searchValue,
121
+ "onUpdate:modelValue": e[0] || (e[0] = (u) => t(o).searchValue = u),
122
+ placeholder: "Search Member",
123
+ collapsible: ""
124
+ }, null, 8, ["modelValue"])
125
+ ]),
126
+ m(d, {
127
+ modelValue: t(l),
128
+ "onUpdate:modelValue": e[1] || (e[1] = (u) => _(l) ? l.value = u : null),
129
+ selection: "multiple",
130
+ loading: t(o).isLoading,
131
+ "row-data": t(n),
132
+ "column-defs": I,
133
+ "page-size": t(o).pageSize,
134
+ "page-count": t(o).pageCount,
135
+ "hide-footer": t(o).totalRows <= t(o).pageSize,
136
+ "fetch-fn": g
137
+ }, null, 8, ["modelValue", "loading", "row-data", "page-size", "page-count", "hide-footer"])
138
+ ])
139
+ ]),
140
+ _: 1
141
+ }, 8, ["modelValue"]);
142
+ };
143
+ }
144
+ });
145
+ export {
146
+ ee as _
147
+ };