@feedmepos/mf-connect 0.1.82-prod → 0.1.83-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 (103) hide show
  1. package/dist/{Analytic-D850nvXy.js → Analytic-1OYb8L9c.js} +11 -11
  2. package/dist/{App-Dwp2SQFt.js → App-oQ4_lEV2.js} +7 -7
  3. package/dist/{Bin-t3dMVk18.js → Bin-CQ8CYWAf.js} +8 -8
  4. package/dist/Broadcast-BLq5lca6.js +265 -0
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CFa7asTL.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-0BKgyMxn.js} +6 -6
  6. package/dist/{Card-DueuT99c.js → Card-BbcMCzvO.js} +19 -19
  7. package/dist/{Collections-D50oEyeZ.js → Collections-0LOyEUoF.js} +8 -8
  8. package/dist/Credit-Crrc3MSu.js +259 -0
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DysfUOSp.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-NtZKuPgi.js} +245 -241
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-L0-aFhRw.js → EffectSheet.vue_vue_type_style_index_0_lang-DQaMkTla.js} +6 -6
  11. package/dist/Experience-DJiUmONI.js +258 -0
  12. package/dist/{FileSaver.min-DH3eS7yi.js → FileSaver.min-CFEGc8v5.js} +1 -1
  13. package/dist/Game-ChHy4S4P.js +329 -0
  14. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BIKcbIag.js → ImageInput.vue_vue_type_script_setup_true_lang-BBavh70d.js} +1 -1
  15. package/dist/{Index-BucLJQqP.js → Index-CL5auUCN.js} +10 -10
  16. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CIoZurPE.js → LottieAnimation.vue_vue_type_script_setup_true_lang-H5IjhmOA.js} +1 -1
  17. package/dist/{MainLayout-DYGrSfgc.js → MainLayout-Bf4G5U5F.js} +1 -1
  18. package/dist/{Marketing-CsAIdNjF.js → Marketing-cNwSm-dt.js} +6 -6
  19. package/dist/{Member-D4HF_VGN.js → Member-fT7a7zFo.js} +11 -11
  20. package/dist/{MemberList-CPoA4ovd.js → MemberList-gEN36Erj.js} +27 -27
  21. package/dist/{MemberTransactions-AMv9NeIb.js → MemberTransactions-C4YgiUw-.js} +1 -1
  22. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DhhSwnK0.js → MessageInput.vue_vue_type_script_setup_true_lang-BNDrmYqp.js} +9 -9
  23. package/dist/Mission-Bz9P2pjX.js +333 -0
  24. package/dist/{Overview-ByO2p2Wx.js → Overview-BG3Z7Daz.js} +19 -19
  25. package/dist/Point-BBeSJ5p5.js +261 -0
  26. package/dist/Promotion-VmaOESn2.js +390 -0
  27. package/dist/{Queue-BD29Mmbf.js → Queue-DKtUhOBh.js} +11 -11
  28. package/dist/{Record-CNLiN6YR.js → Record-Cb45m9I8.js} +9 -9
  29. package/dist/{Reward-Ceo3M1yD.js → Reward-D_uvCEMe.js} +16 -16
  30. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CJWQEL9W.js → RewardGroup.vue_vue_type_script_setup_true_lang-yUUMGEUJ.js} +12 -12
  31. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CWuWGs6r.js → RuleGroup.vue_vue_type_script_setup_true_lang-CIb7igvo.js} +15 -15
  32. package/dist/{Segment-BOQUlP-m.js → Segment-BJ8XUyeG.js} +25 -25
  33. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BcXeiz0p.js → SelectItems.vue_vue_type_script_setup_true_lang-ht4qyiQM.js} +2 -2
  34. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CJ--FC-i.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DC6OQ7Zb.js} +12 -12
  35. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-9emjG6Nc.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-i_BRgBRC.js} +4 -4
  36. package/dist/{Setting-CWapXD31.js → Setting-CS1wSxO9.js} +14 -14
  37. package/dist/{SettingAdvertisements-QEf2eyem.js → SettingAdvertisements-CWP7VthZ.js} +12 -12
  38. package/dist/{Store-Bfm2olbH.js → Store-cy0uZfSE.js} +22 -22
  39. package/dist/{StoreRewards-DNDkyxxn.js → StoreRewards-DDAvmlEn.js} +15 -15
  40. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-zKLbY4Qb.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CevWXAb6.js} +20 -20
  41. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D3-wIOQ7.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CPJ4fCu-.js} +1 -1
  42. package/dist/{Tier-uC45o2AK.js → Tier-CUT_0eYp.js} +22 -22
  43. package/dist/{Title-zDjlDJCB.js → Title-DcelZU7H.js} +20 -20
  44. package/dist/{Transaction-Bo9FEjMQ.js → Transaction-CwcJnFIO.js} +2 -2
  45. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BR5F0bWS.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BuDS-vUd.js} +6 -6
  46. package/dist/{Voucher-B7BTa4Vt.js → Voucher-z6o5rwFx.js} +162 -141
  47. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CjrjJW7x.js → VoucherEditor.vue_vue_type_script_setup_true_lang-FVdeM5pH.js} +12 -12
  48. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DeAkLgaX.js → ZodTextField.vue_vue_type_script_setup_true_lang-BGuVeHZU.js} +2 -2
  49. package/dist/{app-CkUBXnib.js → app-BUFlIAB5.js} +73 -43
  50. package/dist/app.js +1 -1
  51. package/dist/{business-C8P05bjQ.js → business-CEL6Cxr7.js} +1 -1
  52. package/dist/{campaign-DcLhSQVQ.js → campaign-Bz3O-DFr.js} +1 -1
  53. package/dist/{campaign-CyYAvl3p.js → campaign-CfB7ZWIg.js} +8 -8
  54. package/dist/{campaign.enum-h6B-mP82.js → campaign.enum-CCKHGvL9.js} +1 -1
  55. package/dist/{campaign.fn-CStjDAoU.js → campaign.fn-Cu0sRSpP.js} +114 -114
  56. package/dist/{collectible.enum-DT-wjl-a.js → collectible.enum-DeWSJ9OK.js} +1 -1
  57. package/dist/{collection.fn-14o3RW2e.js → collection.fn-hPDt2qvz.js} +2 -2
  58. package/dist/{dto-Bv09Baex.js → dto-BKwcpb4T.js} +4 -4
  59. package/dist/{effect-CF0s7QWQ.js → effect-D070CPN_.js} +1 -1
  60. package/dist/{email-addresses-B5qrHbxg.js → email-addresses-C0fE6EMy.js} +2 -2
  61. package/dist/{export-B6nvdBmg.js → export-CG1ypExs.js} +3 -3
  62. package/dist/{helper-B4-2ut7E.js → helper-C9NBolO7.js} +1 -1
  63. package/dist/{index-B-y0UTZw.js → index-4gCsL8Hl.js} +6 -6
  64. package/dist/{index-D5xt8OjL.js → index-6rFsv3Yg.js} +1 -1
  65. package/dist/{index-BebGg-0n.js → index-B30LtrWw.js} +1 -1
  66. package/dist/{index-DVb99_67.js → index-B613auFn.js} +1 -1
  67. package/dist/{index-HhVIn4Bn.js → index-BGi7UFjn.js} +1 -1
  68. package/dist/{index-DzQjej5Y.js → index-BXSp11TE.js} +4 -4
  69. package/dist/{index-DRX9TTMn.js → index-CM-qkxMr.js} +3 -3
  70. package/dist/{index-DesSizn4.js → index-CZoTFXja.js} +3 -3
  71. package/dist/{index-DG_Ej3ec.js → index-D7AT7i0e.js} +3 -3
  72. package/dist/{index-DIQ2MyWF.js → index-DDMr6_UT.js} +4 -4
  73. package/dist/{index-XDg25M5a.js → index-DGNPGZh4.js} +1 -1
  74. package/dist/{index-CR8brl_k.js → index-DLnZyneY.js} +1 -1
  75. package/dist/{index-Ct90ybe0.js → index-DcfdUpTw.js} +1 -1
  76. package/dist/{index.esm2017-1A2eV8x_.js → index.esm2017-D0u5JnGx.js} +1 -1
  77. package/dist/{loading-B0_BwPgo.js → loading-Rn4BXFlo.js} +1 -1
  78. package/dist/{lodash-DxIglhqk.js → lodash-Ds-QoR_N.js} +1 -1
  79. package/dist/{membership-H_whlbUP.js → membership-BjklIT2n.js} +3 -3
  80. package/dist/{money-DEE8QW6m.js → money-DMyZXL-e.js} +1 -1
  81. package/dist/{number-BmN5A4Cu.js → number-Cyny8l0t.js} +1 -1
  82. package/dist/{objectid-B8LZDZOt.js → objectid-Bs1Sha1n.js} +6 -6
  83. package/dist/{plugins-DTrOHd7d.js → plugins-BdQ8LmZm.js} +3 -3
  84. package/dist/{reward-CsJhkkaT.js → reward-ZGs3fpY1.js} +1 -1
  85. package/dist/{rule-ByMxYH4c.js → rule-BH0ICJcx.js} +3 -3
  86. package/dist/{rule-builder-DwGwUlV1.js → rule-builder-D2sz7Xd9.js} +1 -1
  87. package/dist/template-_QJbP7yG.js +236 -0
  88. package/dist/{timezone-Bpe-fhwZ.js → timezone-ulqdIvC-.js} +2 -2
  89. package/dist/{trigger-CEprJYiD.js → trigger-BiXZCT3j.js} +5 -5
  90. package/dist/{usePagination-Du6qS5aj.js → usePagination-Ck7buuI_.js} +1 -1
  91. package/dist/{user-Be8HNWuo.js → user-BWTfkoD6.js} +1 -1
  92. package/dist/{vue-i18n-fg0FtbNR.js → vue-i18n-CmMTYitu.js} +158 -158
  93. package/dist/{xlsx-CSQJ3YWk.js → xlsx-BF8PJO-P.js} +1 -1
  94. package/dist/{zod-BB7zZ5ec.js → zod-C5iXeYjP.js} +1 -1
  95. package/package.json +1 -1
  96. package/dist/Broadcast-DORnkgZc.js +0 -232
  97. package/dist/Credit-CIWSRGuJ.js +0 -225
  98. package/dist/Experience-qABtjxNP.js +0 -224
  99. package/dist/Game-D67q1zKd.js +0 -299
  100. package/dist/Mission-CRinLn7e.js +0 -303
  101. package/dist/Point-4JqzbNgP.js +0 -227
  102. package/dist/Promotion-DlWVF6hF.js +0 -358
  103. package/dist/template-Bdwy6QXF.js +0 -188
@@ -0,0 +1,261 @@
1
+ import { defineComponent as H, ref as I, computed as q, h as x, onMounted as z, resolveComponent as m, openBlock as p, createElementBlock as v, Fragment as k, createVNode as s, unref as o, withCtx as h, createElementVNode as n, toDisplayString as u, renderList as G, createBlock as F, resolveDynamicComponent as J } from "vue";
2
+ import { _ as Q } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as W, components as V } from "@feedmepos/ui-library";
4
+ import { p as X } from "./plugins-BdQ8LmZm.js";
5
+ import { u as Y } from "./loading-Rn4BXFlo.js";
6
+ import { u as Z } from "./business-CEL6Cxr7.js";
7
+ import { u as ee, c as f } from "./campaign-Bz3O-DFr.js";
8
+ import { g as te, a as $, b as N } from "./campaign-CfB7ZWIg.js";
9
+ import { u as oe, c as ae, p as ne } from "./template-_QJbP7yG.js";
10
+ import { _ as ie } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
11
+ import { _ as se } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-NtZKuPgi.js";
12
+ import { u as re } from "./vue-i18n-CmMTYitu.js";
13
+ const le = { class: "flex items-center" }, ce = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, me = { class: "px-24 flex flex-col gap-y-16" }, de = { class: "flex items-center justify-between w-full" }, pe = { class: "flex gap-8 overflow-x-auto" }, ue = { class: "space-y-8" }, fe = { class: "flex w-full gap-4 items-center" }, ge = { class: "space-y-4" }, ye = { class: "fm-typo-en-body-lg-600" }, _e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, he = { class: "flex items-center gap-8" }, Ce = { class: "flex flex-col gap-16 text-center" }, we = { class: "fm-typo-en-title-sm-800" }, be = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ke = /* @__PURE__ */ H({
14
+ __name: "Point",
15
+ setup(xe) {
16
+ const { t: i } = re(), D = {
17
+ label: i("connect.program.common.actions.create", {
18
+ type: i("connect.program.point.title").toLowerCase()
19
+ }),
20
+ value: "create",
21
+ isPrimary: !0,
22
+ prependIcon: "add"
23
+ }, K = oe("COIN", W()), C = Z(), d = ee(), { global: O, minor: S } = Y, l = I({
24
+ searchKey: "",
25
+ location: []
26
+ });
27
+ function A(e) {
28
+ const t = l.value.location;
29
+ return !t || t.length === 0 || !e.targetLocation ? !0 : Array.isArray(t) ? t.some((c) => {
30
+ var r;
31
+ return (r = e == null ? void 0 : e.targetLocation) == null ? void 0 : r.includes(c);
32
+ }) : e.targetLocation.includes(t);
33
+ }
34
+ const g = q(
35
+ () => d.campaigns.point.filter((e) => A(e))
36
+ ), R = [
37
+ {
38
+ header: i("connect.program.common.table.title"),
39
+ accessorFn: (e) => e.name
40
+ },
41
+ {
42
+ header: i("connect.program.common.table.status"),
43
+ accessorFn: (e) => te(e),
44
+ cell(e) {
45
+ return $(e.row.original);
46
+ }
47
+ },
48
+ {
49
+ header: i("connect.program.common.table.summary"),
50
+ accessorFn: (e) => N(e)
51
+ },
52
+ {
53
+ header: i("connect.program.common.table.actions"),
54
+ cell(e) {
55
+ return x("div", { class: "flex items-center gap-8 justify-end" }, [
56
+ x(V.FmButton, {
57
+ variant: "tertiary",
58
+ icon: "content_copy",
59
+ iconColor: "neutral-gray-400",
60
+ onClick: async (t) => {
61
+ t.stopPropagation(), await P(e.row.original);
62
+ }
63
+ }),
64
+ x(V.FmButton, {
65
+ variant: "tertiary",
66
+ icon: "delete",
67
+ iconColor: "neutral-gray-400",
68
+ onClick: (t) => {
69
+ t.stopPropagation(), L(e.row.original);
70
+ }
71
+ })
72
+ ]);
73
+ }
74
+ }
75
+ ], w = I();
76
+ async function L(e) {
77
+ await X.remove(`Are you sure you want to remove ${e.name}?`) && await S(
78
+ async () => {
79
+ await f.delete(e._id), await d.read("COIN");
80
+ },
81
+ {
82
+ message: `Removing ${e.name}`,
83
+ successMessage: `Removed ${e.name} successfully`
84
+ }
85
+ );
86
+ }
87
+ async function y(e) {
88
+ e ? await t() : K.open(async (c) => {
89
+ await t(c);
90
+ });
91
+ async function t(c) {
92
+ var r;
93
+ (r = w.value) == null || r.showSheet(
94
+ !0,
95
+ "COIN",
96
+ e ? await f.readById(e._id) : void 0,
97
+ c
98
+ );
99
+ }
100
+ }
101
+ async function P(e) {
102
+ var r;
103
+ if (!await ae(e.name))
104
+ return;
105
+ const t = await f.readById(e._id), c = ne(t, {
106
+ keepCollectible: !0
107
+ });
108
+ (r = w.value) == null || r.showSheet(
109
+ !0,
110
+ "COIN",
111
+ c,
112
+ t.template
113
+ );
114
+ }
115
+ async function U(e) {
116
+ await S(
117
+ async () => {
118
+ e.campaign._id ? await f.update(e.campaign._id, e) : await f.create(e), await d.read("COIN");
119
+ },
120
+ {
121
+ message: `${e.campaign._id ? "Updating" : "Creating"} point program`,
122
+ successMessage: `Point program ${e.campaign._id ? "updated" : "created"} successfully`
123
+ }
124
+ );
125
+ }
126
+ return z(async () => {
127
+ await O(async () => {
128
+ await d.read("COIN");
129
+ });
130
+ }), (e, t) => {
131
+ const c = m("FmPill"), r = m("FmPageHead"), B = m("FmSearch"), j = m("FmTable"), b = m("FmButton"), T = m("FmListItem"), E = m("FmList"), M = m("FmCard");
132
+ return p(), v(k, null, [
133
+ s(r, {
134
+ title: o(i)("connect.program.point.title"),
135
+ actions: o(g).length > 0 && o(C).isPremium ? [D] : [],
136
+ "onClick:action": t[0] || (t[0] = () => y())
137
+ }, {
138
+ title: h(() => [
139
+ n("div", le, [
140
+ n("span", ce, u(o(i)("connect.program.point.title")), 1),
141
+ s(c, { variant: "premium" })
142
+ ])
143
+ ]),
144
+ _: 1
145
+ }, 8, ["title", "actions"]),
146
+ n("div", me, [
147
+ s(B, {
148
+ modelValue: o(l).searchKey,
149
+ "onUpdate:modelValue": t[1] || (t[1] = (a) => o(l).searchKey = a),
150
+ class: "hidden xs:!block sm:!block border-b-2 border-fm-color-neutral-gray-100",
151
+ placeholder: "search",
152
+ collapsible: ""
153
+ }, null, 8, ["modelValue"]),
154
+ o(d).campaigns.point && o(d).campaigns.point.length > 0 ? (p(), v(k, { key: 0 }, [
155
+ n("div", de, [
156
+ n("div", pe, [
157
+ s(ie, {
158
+ label: `${o(i)("connect.common.location")}: `,
159
+ "right-icon": "keyboard_arrow_down",
160
+ modelValue: o(l).location,
161
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => o(l).location = a),
162
+ icon: "storefront",
163
+ "show-item-label": !0,
164
+ items: o(C).locationOptions
165
+ }, null, 8, ["label", "modelValue", "items"])
166
+ ]),
167
+ s(B, {
168
+ modelValue: o(l).searchKey,
169
+ "onUpdate:modelValue": t[3] || (t[3] = (a) => o(l).searchKey = a),
170
+ class: "xs:hidden sm:hidden",
171
+ placeholder: "search",
172
+ collapsible: ""
173
+ }, null, 8, ["modelValue"])
174
+ ]),
175
+ s(j, {
176
+ class: "xs:hidden sm:hidden",
177
+ "row-data": o(g),
178
+ "column-defs": R,
179
+ "search-value": o(l).searchKey,
180
+ "column-filter": [],
181
+ onRowClick: t[4] || (t[4] = (a) => y(a.original)),
182
+ "hide-footer": o(g).length < 10
183
+ }, null, 8, ["row-data", "search-value", "hide-footer"]),
184
+ s(E, { class: "hidden xs:!flex sm:!flex flex-col mx-[-24px]" }, {
185
+ default: h(() => [
186
+ (p(!0), v(k, null, G(o(g).filter(
187
+ (a) => a.name.toLowerCase().includes(o(l).searchKey.toLowerCase())
188
+ ), (a) => (p(), F(T, {
189
+ key: a._id.toString(),
190
+ onClick: (_) => y(a),
191
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
192
+ }, {
193
+ default: h(() => [
194
+ n("div", ue, [
195
+ n("div", fe, [
196
+ (p(), F(J(o($)(a))))
197
+ ]),
198
+ n("div", ge, [
199
+ n("div", ye, u(a.name), 1),
200
+ n("div", _e, u(o(N)(a)), 1)
201
+ ])
202
+ ]),
203
+ n("div", he, [
204
+ s(b, {
205
+ icon: "content_copy",
206
+ "icon-color": "neutral-gray-400",
207
+ variant: "tertiary",
208
+ onClick: async (_) => {
209
+ _.stopPropagation(), await P(a);
210
+ }
211
+ }, null, 8, ["onClick"]),
212
+ s(b, {
213
+ icon: "delete",
214
+ "icon-color": "neutral-gray-400",
215
+ variant: "tertiary",
216
+ onClick: (_) => (_.stopPropagation(), L(a))
217
+ }, null, 8, ["onClick"])
218
+ ])
219
+ ]),
220
+ _: 2
221
+ }, 1032, ["onClick"]))), 128))
222
+ ]),
223
+ _: 1
224
+ })
225
+ ], 64)) : (p(), F(M, {
226
+ key: 1,
227
+ variant: "outlined",
228
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
229
+ }, {
230
+ default: h(() => [
231
+ t[6] || (t[6] = n("img", {
232
+ src: Q,
233
+ class: "aspect-square w-[150px]"
234
+ }, null, -1)),
235
+ n("div", Ce, [
236
+ n("div", we, u(o(i)("connect.program.point.empty_state.title")), 1),
237
+ n("div", be, u(o(i)("connect.program.point.empty_state.description")), 1)
238
+ ]),
239
+ s(b, {
240
+ variant: "primary",
241
+ label: "Create point program",
242
+ disabled: !o(C).isPremium,
243
+ icon: "add",
244
+ onClick: t[5] || (t[5] = (a) => y())
245
+ }, null, 8, ["disabled"])
246
+ ]),
247
+ _: 1
248
+ })),
249
+ s(se, {
250
+ ref_key: "sheetRef",
251
+ ref: w,
252
+ "onSubmit:modelValue": U
253
+ }, null, 512)
254
+ ])
255
+ ], 64);
256
+ };
257
+ }
258
+ });
259
+ export {
260
+ Ke as default
261
+ };
@@ -0,0 +1,390 @@
1
+ import { defineComponent as E, ref as w, resolveComponent as d, openBlock as f, createBlock as S, unref as a, isRef as oe, withCtx as k, createElementVNode as r, createVNode as c, computed as te, h as I, onMounted as ne, createElementBlock as L, Fragment as B, renderList as ae, resolveDynamicComponent as se, toDisplayString as F } from "vue";
2
+ import { _ as ie } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as re, components as $ } from "@feedmepos/ui-library";
4
+ import { c as j, p as D } from "./plugins-BdQ8LmZm.js";
5
+ import { u as le } from "./loading-Rn4BXFlo.js";
6
+ import { u as ce } from "./business-CEL6Cxr7.js";
7
+ import { c as y, u as me } from "./campaign-Bz3O-DFr.js";
8
+ import { u as ue } from "./vue-i18n-CmMTYitu.js";
9
+ import { g as de, a as q } from "./campaign-CfB7ZWIg.js";
10
+ import { u as pe, c as fe, p as ye } from "./template-_QJbP7yG.js";
11
+ import { e as K } from "./effect-D070CPN_.js";
12
+ import { _ as ge } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-NtZKuPgi.js";
13
+ import { _ as U } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
14
+ const he = { class: "space-y-8" }, _e = /* @__PURE__ */ E({
15
+ __name: "QueueSheet",
16
+ emits: ["update:model-value"],
17
+ setup(Q, { expose: n, emit: R }) {
18
+ const p = w(!1), h = w([]);
19
+ async function P() {
20
+ p.value = !0;
21
+ const i = await y.getPromotionQueue();
22
+ console.log(i, "jobs"), h.value = i;
23
+ }
24
+ const v = [
25
+ {
26
+ header: "Started At",
27
+ accessorFn: (i) => i.createdAt,
28
+ enableSorting: !0
29
+ },
30
+ {
31
+ header: "Campaigns",
32
+ accessorFn: (i) => i.campaigns
33
+ // cell(props) {
34
+ // const r = props.row.original;
35
+ // return h('div', {
36
+ // innerHTML: r.campaigns.map((c: any) => c.name).join(', '),
37
+ // });
38
+ // },
39
+ }
40
+ ];
41
+ return n({
42
+ showSheet: P
43
+ }), (i, u) => {
44
+ const _ = d("FmTable"), T = d("FmSideSheet");
45
+ return f(), S(T, {
46
+ "max-width": 550,
47
+ header: "Promotion Sync Queue",
48
+ modelValue: a(p),
49
+ "onUpdate:modelValue": [
50
+ u[1] || (u[1] = (s) => oe(p) ? p.value = s : null),
51
+ u[2] || (u[2] = (s) => p.value = s)
52
+ ]
53
+ }, {
54
+ default: k(() => [
55
+ r("div", he, [
56
+ u[3] || (u[3] = r("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Promotion synchronizing to your restaurant(s) is queued here. Depending on the number of campaigns and restaurants, this process may take several minutes. No task displayed here means there are no pending promotions to sync. ", -1)),
57
+ c(_, {
58
+ modelValue: i.tableRef,
59
+ "onUpdate:modelValue": u[0] || (u[0] = (s) => i.tableRef = s),
60
+ "column-filter": i.jobFilters,
61
+ "column-defs": v,
62
+ "row-data": a(h),
63
+ "hide-footer": a(h).length <= 10
64
+ }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"])
65
+ ])
66
+ ]),
67
+ _: 1
68
+ }, 8, ["modelValue"]);
69
+ };
70
+ }
71
+ }), we = { class: "px-24 flex flex-col gap-y-16" }, ve = { class: "flex items-center justify-between w-full" }, be = { class: "flex gap-8 overflow-x-auto" }, Ce = { class: "space-y-8" }, xe = { class: "flex w-full gap-4 items-center" }, Fe = { class: "space-y-4" }, Se = { class: "fm-typo-en-body-lg-600" }, ke = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pe = { class: "flex items-center gap-8" }, Te = { class: "flex flex-col gap-16 text-center" }, Ve = { class: "fm-typo-en-title-sm-800" }, Oe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ee = /* @__PURE__ */ E({
72
+ __name: "Promotion",
73
+ setup(Q) {
74
+ const { t: n } = ue(), R = {
75
+ label: n("connect.promotion.createCampaign"),
76
+ value: "create",
77
+ isPrimary: !0,
78
+ prependIcon: "add"
79
+ }, p = {
80
+ label: "Force sync",
81
+ value: "sync",
82
+ isPrimary: !1,
83
+ prependIcon: "refresh"
84
+ }, h = {
85
+ label: "Queue",
86
+ value: "queue",
87
+ isPrimary: !1,
88
+ prependIcon: "work_history"
89
+ }, P = pe("PROMOTION", re()), v = ce(), i = me(), { global: u, minor: _ } = le, T = [
90
+ {
91
+ label: "Bill promotion",
92
+ value: "BILL"
93
+ },
94
+ {
95
+ label: "Item promotion",
96
+ value: "ITEM"
97
+ }
98
+ ], s = w({
99
+ searchKey: "",
100
+ location: [],
101
+ effectType: []
102
+ });
103
+ function H(e) {
104
+ const o = s.value.location;
105
+ return !o || o.length === 0 || !e.targetLocation ? !0 : Array.isArray(o) ? o.some((m) => {
106
+ var l;
107
+ return (l = e == null ? void 0 : e.targetLocation) == null ? void 0 : l.includes(m);
108
+ }) : e.targetLocation.includes(o);
109
+ }
110
+ function z(e) {
111
+ var l, C;
112
+ const o = s.value.effectType;
113
+ if (!o || o.length === 0) return !0;
114
+ const m = (C = (l = e.effect) == null ? void 0 : l.options) == null ? void 0 : C.target;
115
+ return o.includes(m);
116
+ }
117
+ const g = te(
118
+ () => i.campaigns.promotion.filter(
119
+ (e) => H(e) && z(e)
120
+ )
121
+ ), G = [
122
+ {
123
+ header: n("connect.promotion.promotionTitle"),
124
+ accessorFn: (e) => e.name
125
+ },
126
+ {
127
+ header: n("connect.promotion.status"),
128
+ accessorFn: (e) => de(e),
129
+ cell(e) {
130
+ return q(e.row.original);
131
+ }
132
+ },
133
+ {
134
+ header: n("connect.promotion.type"),
135
+ accessorFn: (e) => `${j.title(e.effect.options.target)} promotion`
136
+ },
137
+ {
138
+ header: n("connect.promotion.summary"),
139
+ accessorFn: (e) => K(e.effect)
140
+ },
141
+ {
142
+ header: n("connect.promotion.actions"),
143
+ cell(e) {
144
+ return I("div", { class: "flex items-center gap-8 justify-end" }, [
145
+ I($.FmButton, {
146
+ variant: "tertiary",
147
+ icon: "content_copy",
148
+ iconColor: "neutral-gray-400",
149
+ onClick: async (o) => {
150
+ o.stopPropagation(), await N(e.row.original);
151
+ }
152
+ }),
153
+ I($.FmButton, {
154
+ variant: "tertiary",
155
+ icon: "delete",
156
+ iconColor: "neutral-gray-400",
157
+ onClick: (o) => {
158
+ o.stopPropagation(), M(e.row.original);
159
+ }
160
+ })
161
+ ]);
162
+ }
163
+ }
164
+ ], V = w(), A = w();
165
+ async function M(e) {
166
+ await D.remove(
167
+ n("connect.promotion.confirmRemove", { name: e.name })
168
+ ) && await _(
169
+ async () => {
170
+ await y.delete(e._id), await i.read("PROMOTION");
171
+ },
172
+ {
173
+ message: n("connect.promotion.removing", { name: e.name }),
174
+ successMessage: n("connect.promotion.removedSuccessfully", {
175
+ name: e.name
176
+ })
177
+ }
178
+ );
179
+ }
180
+ async function b(e) {
181
+ e ? await o() : P.open(async (m) => {
182
+ await o(m);
183
+ });
184
+ async function o(m) {
185
+ var l;
186
+ (l = V.value) == null || l.showSheet(
187
+ !0,
188
+ "PROMOTION",
189
+ e ? await y.readById(e._id) : void 0,
190
+ m
191
+ );
192
+ }
193
+ }
194
+ async function N(e) {
195
+ var l;
196
+ if (!await fe(e.name))
197
+ return;
198
+ const o = await y.readById(e._id), m = ye(o);
199
+ (l = V.value) == null || l.showSheet(
200
+ !0,
201
+ "PROMOTION",
202
+ m,
203
+ o.template
204
+ );
205
+ }
206
+ async function J(e) {
207
+ await _(
208
+ async () => {
209
+ e.campaign._id ? await y.update(e.campaign._id, e) : await y.create(e), await i.read("PROMOTION");
210
+ },
211
+ {
212
+ message: n(
213
+ e.campaign._id ? "connect.promotion.updating" : "connect.promotion.creating"
214
+ ),
215
+ successMessage: n(
216
+ e.campaign._id ? "connect.promotion.updatedSuccessfully" : "connect.promotion.createdSuccessfully"
217
+ )
218
+ }
219
+ );
220
+ }
221
+ async function W(e) {
222
+ var o;
223
+ switch (e) {
224
+ case "create":
225
+ b();
226
+ break;
227
+ case "sync":
228
+ await D.confirm(
229
+ "Are you sure you want to synchronize all promotions to POS?",
230
+ "Force sync"
231
+ ) && _(
232
+ async () => {
233
+ await y.syncAllPromotion();
234
+ },
235
+ {
236
+ message: "Syncing promotions...",
237
+ successMessage: "All promotions synced"
238
+ }
239
+ );
240
+ break;
241
+ case "queue":
242
+ (o = A.value) == null || o.showSheet();
243
+ break;
244
+ }
245
+ }
246
+ return ne(async () => {
247
+ await u(async () => {
248
+ await v.readLocations(), await i.read("PROMOTION");
249
+ });
250
+ }), (e, o) => {
251
+ const m = d("FmPageHead"), l = d("FmSearch"), C = d("FmTable"), X = d("FmChip"), O = d("FmButton"), Y = d("FmListItem"), Z = d("FmList"), ee = d("FmCard");
252
+ return f(), L(B, null, [
253
+ c(m, {
254
+ title: a(n)("connect.promotion.title"),
255
+ actions: a(g).length > 0 ? [R, p, h] : [],
256
+ "onClick:action": W
257
+ }, null, 8, ["title", "actions"]),
258
+ r("div", we, [
259
+ c(l, {
260
+ modelValue: s.value.searchKey,
261
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => s.value.searchKey = t),
262
+ class: "hidden xs:!block sm:!block border-b-2 border-fm-color-neutral-gray-100",
263
+ placeholder: a(n)("connect.promotion.search"),
264
+ collapsible: ""
265
+ }, null, 8, ["modelValue", "placeholder"]),
266
+ a(g) && a(g).length > 0 ? (f(), L(B, { key: 0 }, [
267
+ r("div", ve, [
268
+ r("div", be, [
269
+ c(U, {
270
+ label: `${a(n)("connect.common.location")}: `,
271
+ "right-icon": "keyboard_arrow_down",
272
+ modelValue: s.value.location,
273
+ "onUpdate:modelValue": o[1] || (o[1] = (t) => s.value.location = t),
274
+ icon: "storefront",
275
+ "show-item-label": !0,
276
+ items: a(v).locationOptions
277
+ }, null, 8, ["label", "modelValue", "items"]),
278
+ c(U, {
279
+ label: "Type:",
280
+ "right-icon": "keyboard_arrow_down",
281
+ modelValue: s.value.effectType,
282
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => s.value.effectType = t),
283
+ icon: "filter_list",
284
+ "show-item-label": !0,
285
+ items: T
286
+ }, null, 8, ["modelValue"])
287
+ ]),
288
+ c(l, {
289
+ modelValue: s.value.searchKey,
290
+ "onUpdate:modelValue": o[3] || (o[3] = (t) => s.value.searchKey = t),
291
+ class: "xs:hidden sm:hidden",
292
+ placeholder: "search",
293
+ collapsible: ""
294
+ }, null, 8, ["modelValue"])
295
+ ]),
296
+ c(C, {
297
+ class: "xs:hidden sm:hidden",
298
+ "row-data": a(g),
299
+ "column-defs": G,
300
+ "search-value": s.value.searchKey,
301
+ "column-filter": [],
302
+ onRowClick: o[4] || (o[4] = (t) => b(t.original)),
303
+ "hide-footer": a(g).length < 10
304
+ }, null, 8, ["row-data", "search-value", "hide-footer"]),
305
+ c(Z, { class: "hidden xs:!flex sm:!flex flex-col mx-[-24px]" }, {
306
+ default: k(() => [
307
+ (f(!0), L(B, null, ae(a(g).filter(
308
+ (t) => t.name.toLowerCase().includes(s.value.searchKey.toLowerCase())
309
+ ), (t) => (f(), S(Y, {
310
+ key: t._id.toString(),
311
+ onClick: (x) => b(t),
312
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
313
+ }, {
314
+ default: k(() => [
315
+ r("div", Ce, [
316
+ r("div", xe, [
317
+ (f(), S(se(a(q)(t)))),
318
+ c(X, {
319
+ class: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
320
+ compact: !0,
321
+ label: `${a(j).title(t.effect.options.target)} promotion`
322
+ }, null, 8, ["label"])
323
+ ]),
324
+ r("div", Fe, [
325
+ r("div", Se, F(t.name), 1),
326
+ r("div", ke, F(a(K)(t.effect)), 1)
327
+ ])
328
+ ]),
329
+ r("div", Pe, [
330
+ c(O, {
331
+ icon: "content_copy",
332
+ "icon-color": "neutral-gray-400",
333
+ variant: "tertiary",
334
+ onClick: async (x) => {
335
+ x.stopPropagation(), await N(t);
336
+ }
337
+ }, null, 8, ["onClick"]),
338
+ c(O, {
339
+ icon: "delete",
340
+ "icon-color": "neutral-gray-400",
341
+ variant: "tertiary",
342
+ onClick: (x) => (x.stopPropagation(), M(t))
343
+ }, null, 8, ["onClick"])
344
+ ])
345
+ ]),
346
+ _: 2
347
+ }, 1032, ["onClick"]))), 128))
348
+ ]),
349
+ _: 1
350
+ })
351
+ ], 64)) : (f(), S(ee, {
352
+ key: 1,
353
+ variant: "outlined",
354
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
355
+ }, {
356
+ default: k(() => [
357
+ o[6] || (o[6] = r("img", {
358
+ src: ie,
359
+ class: "aspect-square w-[150px]"
360
+ }, null, -1)),
361
+ r("div", Te, [
362
+ r("div", Ve, F(a(n)("connect.promotion.createPromotionCampaign")), 1),
363
+ r("div", Oe, F(a(n)("connect.promotion.description")), 1)
364
+ ]),
365
+ c(O, {
366
+ variant: "primary",
367
+ label: a(n)("connect.promotion.createPromotionCampaign"),
368
+ icon: "add",
369
+ onClick: o[5] || (o[5] = (t) => b())
370
+ }, null, 8, ["label"])
371
+ ]),
372
+ _: 1
373
+ }))
374
+ ]),
375
+ c(ge, {
376
+ ref_key: "sheetRef",
377
+ ref: V,
378
+ "onSubmit:modelValue": J
379
+ }, null, 512),
380
+ c(_e, {
381
+ ref_key: "queueSheetRef",
382
+ ref: A
383
+ }, null, 512)
384
+ ], 64);
385
+ };
386
+ }
387
+ });
388
+ export {
389
+ Ee as default
390
+ };
@@ -1,19 +1,19 @@
1
1
  import { defineComponent as h, h as n, ref as A, watch as B, onBeforeMount as U, resolveComponent as V, openBlock as z, createElementBlock as O, Fragment as q, createVNode as m, unref as o, createElementVNode as f } from "vue";
2
- import { u as L, _ as Y } from "./usePagination-Du6qS5aj.js";
2
+ import { u as L, _ as Y } from "./usePagination-Ck7buuI_.js";
3
3
  import { _ as S } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
4
- import { c as u, a as G } from "./plugins-DTrOHd7d.js";
4
+ import { c as u, a as G } from "./plugins-BdQ8LmZm.js";
5
5
  import { useDialog as K, components as b } from "@feedmepos/ui-library";
6
- import { I as c, c as d } from "./index-DzQjej5Y.js";
7
- import "./index-DesSizn4.js";
8
- import "./index-B-y0UTZw.js";
9
- import "./index-Ct90ybe0.js";
10
- import "./index-DG_Ej3ec.js";
11
- import "./index-DIQ2MyWF.js";
6
+ import { I as c, c as d } from "./index-BXSp11TE.js";
7
+ import "./index-CZoTFXja.js";
8
+ import "./index-4gCsL8Hl.js";
9
+ import "./index-DcfdUpTw.js";
10
+ import "./index-D7AT7i0e.js";
11
+ import "./index-DDMr6_UT.js";
12
12
  import { h as y } from "./moment-D7p2TMB-.js";
13
- import { u as j } from "./vue-i18n-fg0FtbNR.js";
14
- import { u as H, v as W, w as $ } from "./index.esm2017-1A2eV8x_.js";
13
+ import { u as j } from "./vue-i18n-CmMTYitu.js";
14
+ import { u as H, v as W, w as $ } from "./index.esm2017-D0u5JnGx.js";
15
15
  import { useRoute as Q } from "vue-router";
16
- import { g as J, S as X, u as Z } from "./index-DRX9TTMn.js";
16
+ import { g as J, S as X, u as Z } from "./index-CM-qkxMr.js";
17
17
  import { o as ee } from "./objectId-dwaoBfJX.js";
18
18
  const te = () => {
19
19
  if (!X.getBusinessId()) throw new Error("Invalid business ID");