@feedmepos/mf-connect 0.1.38-beta.6 → 0.1.38-beta.61

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 (148) hide show
  1. package/dist/{Analytic-NBx32reB.js → Analytic-CM7mh-iO.js} +16 -16
  2. package/dist/{App-CaK9PvMd.js → App-CeCzzsDu.js} +625 -619
  3. package/dist/AuditLogs-VWx8DFKA.js +1991 -0
  4. package/dist/{Bin-CL6o1JSs.js → Bin-vUuol_I9.js} +10 -10
  5. package/dist/Broadcast-6VXz4-IG.js +233 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BIySMYGP.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CV-zhJ15.js} +6 -6
  7. package/dist/{Card-DNdEjt6s.js → Card-CeIeGET1.js} +144 -140
  8. package/dist/Collections-CF_OcAL3.js +540 -0
  9. package/dist/Credit-BUqGOyp_.js +226 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js → DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0DMFuBoG.js +3150 -0
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BZfchHlT.js +347 -0
  14. package/dist/Experience-BxiFH_uV.js +225 -0
  15. package/dist/{FileSaver.min-NlMItPOc.js → FileSaver.min-lgg_oBvT.js} +1 -1
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  17. package/dist/Game-BzYW0LfY.js +300 -0
  18. package/dist/GenerateMaterial-B5A7mx2y.js +589 -0
  19. package/dist/Grab-BgiMqwvj.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-DZ8DHrQ_.js} +49 -48
  21. package/dist/{Index-2wokhhFB.js → Index-B85ops8K.js} +54 -54
  22. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → LottieAnimation.vue_vue_type_script_setup_true_lang-B5rIjxYd.js} +1 -1
  23. package/dist/{MainLayout-B1aJoR95.js → MainLayout-CXGVkD-W.js} +1 -1
  24. package/dist/Marketing-Bnijl7lA.js +145 -0
  25. package/dist/MarketingMaterialEdit-BlUKwSoP.js +746 -0
  26. package/dist/{Member-2xV4Izwa.js → Member-sT853g51.js} +38 -37
  27. package/dist/{MemberList-CYgBdyJt.js → MemberList-DYT5_fSP.js} +158 -159
  28. package/dist/{MemberTransactions-DWDV01N4.js → MemberTransactions-Cqce5ebe.js} +1 -1
  29. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Becsw31k.js → MessageInput.vue_vue_type_script_setup_true_lang-Dq0Hswj8.js} +5940 -5668
  30. package/dist/Mission-Q5_sGgrm.js +304 -0
  31. package/dist/{Overview-BZjto86d.js → Overview-B0rwrHR1.js} +24 -25
  32. package/dist/Point-BGYFMvev.js +228 -0
  33. package/dist/Promotion-0acd63nA.js +364 -0
  34. package/dist/{Queue-D62r2qjy.js → Queue-SVqRUlD_.js} +14 -15
  35. package/dist/{Record-0iF3dG7y.js → Record-BTjg4ihy.js} +10 -10
  36. package/dist/{Reward-C5IEJYu6.js → Reward-DW58VMRO.js} +16 -16
  37. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-S2Fd0qO8.js → RewardGroup.vue_vue_type_script_setup_true_lang-s1RI55Rc.js} +13 -14
  38. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Os17lXBX.js +1766 -0
  39. package/dist/{Segment-BknjBrUP.js → Segment-Dny8pxP1.js} +273 -274
  40. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BLQlkp-j.js → SelectItems.vue_vue_type_script_setup_true_lang-Czx7rqiq.js} +12 -12
  41. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CaPi4hYB.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-EgVxUG_N.js} +12 -12
  42. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BoZ0ZpNZ.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CO0fgI3K.js} +4 -4
  43. package/dist/Setting-CjcnxK34.js +1992 -0
  44. package/dist/SettingAdvertisements-CIyDF4C8.js +263 -0
  45. package/dist/Store-B8k5YVqU.js +1934 -0
  46. package/dist/StoreRewards-BW08rwpL.js +534 -0
  47. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BfFSfE2H.js +1034 -0
  48. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CZkKjUNQ.js +8093 -0
  49. package/dist/{Tier-B168DtFj.js → Tier-DKzu4tYw.js} +561 -480
  50. package/dist/{Title-uH0RI1N3.js → Title-BK-TXatJ.js} +149 -147
  51. package/dist/{Transaction-Bx-pmLrJ.js → Transaction-Duayg1jd.js} +2 -2
  52. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Ce_55V7l.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BAR9h1TV.js} +7 -7
  53. package/dist/{Voucher-Dzpz2AEB.js → Voucher-BEVAkNeJ.js} +140 -124
  54. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DvFy9Z6X.js +421 -0
  55. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CfLiUj9f.js → ZodTextField.vue_vue_type_script_setup_true_lang-CU_Sx2PM.js} +2 -2
  56. package/dist/app-IvbII0ql.js +45026 -0
  57. package/dist/app.js +1 -1
  58. package/dist/{business-B65OtB5B.js → business-BFIwFfkq.js} +11 -8
  59. package/dist/campaign-RuIwxc4y.js +253 -0
  60. package/dist/{campaign-qGy6uzrC.js → campaign-w9j4I4jn.js} +29 -25
  61. package/dist/{campaign.enum-CZp2DmXI.js → campaign.enum-IHLsfdik.js} +3 -2
  62. package/dist/campaign.fn-B_P1MkRV.js +776 -0
  63. package/dist/{collectible.enum-CN-lnG1m.js → collectible.enum-CUgSjO08.js} +1 -1
  64. package/dist/{collection.fn-mMwGQWce.js → collection.fn-CrfnNb41.js} +2 -2
  65. package/dist/dto-jwO_sX9I.js +222 -0
  66. package/dist/{effect-Bg3yb9T6.js → effect--0g8PNyt.js} +1 -1
  67. package/dist/{email-addresses-CQsN724N.js → email-addresses-HtsxvXw9.js} +2 -2
  68. package/dist/{export-BLf2dhFd.js → export-CFEwMRmd.js} +9 -10
  69. package/dist/{helper-CFaph16Q.js → helper-CCfb24PO.js} +22 -7
  70. package/dist/index-B-AMMFfT.js +3419 -0
  71. package/dist/{index-BPyac0fq.js → index-BR3UbZ0F.js} +1 -1
  72. package/dist/{index-Dy5p_b1S.js → index-BZEM0T2A.js} +1 -1
  73. package/dist/index-Bflu4Rft.js +8884 -0
  74. package/dist/{index-Dkmn0jmX.js → index-CR3f3BXQ.js} +2552 -2356
  75. package/dist/{index-BkySejFg.js → index-CZPcwcUo.js} +3 -3
  76. package/dist/{index-BPZtjcTm.js → index-CkuPY85X.js} +1 -1
  77. package/dist/index-CppLPpqB.js +30933 -0
  78. package/dist/index-CuvNtC_M.js +61 -0
  79. package/dist/{index-BKOgzVx6.js → index-DDYH-IEX.js} +1 -1
  80. package/dist/{index-DaEQgaiW.js → index-DdZdHioZ.js} +455 -245
  81. package/dist/{index-BBPIZjw6.js → index-Dic_WcAL.js} +3 -3
  82. package/dist/{index-CH2d_B8c.js → index-DpjYgKTN.js} +4 -1
  83. package/dist/index-wzSeRJAd.js +36 -0
  84. package/dist/{index.esm2017-B9vJTKYg.js → index.esm2017-CUnjzfU-.js} +89 -89
  85. package/dist/loading-CivgDw5C.js +215 -0
  86. package/dist/{lodash-B5I3zXaY.js → lodash-BSbv_9TG.js} +1 -1
  87. package/dist/{membership-Du79A0Pl.js → membership-j2w1YUO-.js} +3 -3
  88. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  89. package/dist/{money-DXgYs2-R.js → money-DL-x8hiT.js} +1 -1
  90. package/dist/{number-CBMkNZvH.js → number-D1yoFGEr.js} +1 -1
  91. package/dist/objectid-CHab6j3r.js +145 -0
  92. package/dist/{campaign-iKI-L84v.js → plugins-P-V4XWmW.js} +784 -777
  93. package/dist/remy-D_Deb3ue.js +13 -0
  94. package/dist/{reward-ClX_lWcQ.js → reward-BqMlBQRu.js} +1 -1
  95. package/dist/{rule-BfidJ75Y.js → rule-CztsLdki.js} +4 -4
  96. package/dist/rule-builder-DANv7Rmz.js +102 -0
  97. package/dist/style.css +11 -2
  98. package/dist/template-Dbz3FhHK.js +188 -0
  99. package/dist/timezone-BgVqObBq.js +1151 -0
  100. package/dist/trigger-CbriUibd.js +213 -0
  101. package/dist/usePagination-DtNK7W0U.js +223 -0
  102. package/dist/user-CVapqHfr.js +55 -0
  103. package/dist/vue-i18n-tpDAnnmD.js +2365 -0
  104. package/dist/{xlsx-Be4bARvl.js → xlsx-EewcN2uY.js} +1 -1
  105. package/dist/{zod-Bg2FbC-D.js → zod-D-wiCQRJ.js} +32 -31
  106. package/package.json +13 -5
  107. package/dist/AuditLogs-C-gCCPvF.js +0 -1887
  108. package/dist/Broadcast-B2-itjvZ.js +0 -227
  109. package/dist/Collections-DepGq6WJ.js +0 -465
  110. package/dist/Credit-D7K0gFwc.js +0 -222
  111. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  112. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-HMjbuy2C.js +0 -2185
  113. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DrbMJlm5.js +0 -347
  114. package/dist/Experience-FlBX3eyN.js +0 -223
  115. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  116. package/dist/Game-Cc3D7lKV.js +0 -278
  117. package/dist/Marketing-D7PXYloN.js +0 -20073
  118. package/dist/Mission-BSGc9822.js +0 -296
  119. package/dist/Point-0U4TTdPW.js +0 -226
  120. package/dist/Promotion-DiUa0GcV.js +0 -289
  121. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CxlamGFP.js +0 -1751
  122. package/dist/Setting-RLI7RgmN.js +0 -1936
  123. package/dist/Store-gxmv8hWJ.js +0 -1842
  124. package/dist/StoreRewards-C_6gY_Nk.js +0 -423
  125. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B5uzSYM4.js +0 -1029
  126. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-yjI96ZL0.js +0 -139
  127. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-dbA6_6b9.js +0 -419
  128. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  129. package/dist/app-B90wINOO.js +0 -33357
  130. package/dist/app-DuUxQ1ZP.js +0 -7086
  131. package/dist/campaign.fn-DKScnmjX.js +0 -758
  132. package/dist/dto-C5ri8Nws.js +0 -214
  133. package/dist/index-BCGDOgxb.js +0 -38
  134. package/dist/index-BCPBmANe.js +0 -3120
  135. package/dist/index-BN2Uyvj4.js +0 -30038
  136. package/dist/index-CrbnfAk8.js +0 -8861
  137. package/dist/index-CsaQJMAR.js +0 -66
  138. package/dist/index-DJwQICyC.js +0 -146
  139. package/dist/loading-MEQuW9Xa.js +0 -71
  140. package/dist/objectid-BeZTZYqi.js +0 -145
  141. package/dist/plugins-KiMuDTPp.js +0 -208
  142. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  143. package/dist/rule-builder-BTcZx77a.js +0 -89
  144. package/dist/template-DPpMK30W.js +0 -190
  145. package/dist/trigger-DLp1bkZP.js +0 -144
  146. package/dist/usePagination-BeF5K3M7.js +0 -223
  147. package/dist/user-Cq9CGBHZ.js +0 -54
  148. package/dist/vue-i18n-COzqUgQy.js +0 -2365
@@ -0,0 +1,534 @@
1
+ import { defineComponent as W, ref as V, computed as G, onMounted as Y, resolveComponent as b, openBlock as w, createBlock as C, unref as e, isRef as Q, withCtx as F, createElementVNode as s, createVNode as u, createElementBlock as P, createTextVNode as X, resolveDynamicComponent as M, toDisplayString as B, Fragment as q, createCommentVNode as $, h as v } from "vue";
2
+ import { _ as ee } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as z, components as O } from "@feedmepos/ui-library";
4
+ import "./index-BZEM0T2A.js";
5
+ import { m as N, u as te } from "./loading-CivgDw5C.js";
6
+ import { C as J, u as oe } from "./membership-j2w1YUO-.js";
7
+ import { p as I, f as K } from "./plugins-P-V4XWmW.js";
8
+ import { u as ae } from "./vue-i18n-tpDAnnmD.js";
9
+ import { F as ne } from "./index-Bflu4Rft.js";
10
+ import { c as se } from "./object-qECH92oz.js";
11
+ import { u as Z } from "./app-wDQR6dpb.js";
12
+ import { u as re } from "./business-BFIwFfkq.js";
13
+ import { useCoreStore as ie } from "@feedmepos/mf-common";
14
+ import { Z as x } from "./zod-D-wiCQRJ.js";
15
+ import { _ as le } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CU_Sx2PM.js";
16
+ import { _ as de } from "./ImageInput.vue_vue_type_script_setup_true_lang-DZ8DHrQ_.js";
17
+ import { _ as ce } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-CZkKjUNQ.js";
18
+ import { _ as me, a as pe } from "./EffectSheet.vue_vue_type_style_index_0_lang-BZfchHlT.js";
19
+ import { i as ue, F as fe, h as j, t as ye } from "./helper-CCfb24PO.js";
20
+ import { useRouter as we } from "vue-router";
21
+ import { R as A } from "./app-IvbII0ql.js";
22
+ const ge = {
23
+ key: 0,
24
+ class: "flex flex-col space-y-16 pr-12"
25
+ }, ve = { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, be = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center justify-between" }, Re = { class: "flex items-center gap-8" }, _e = /* @__PURE__ */ W({
26
+ __name: "EditRewardSheet",
27
+ emits: ["update"],
28
+ setup(L, { expose: r, emit: E }) {
29
+ const S = E, y = re(), m = ie(), g = V(!1), a = V(), R = V(), T = V(!1), f = ne, p = G(
30
+ () => {
31
+ var l;
32
+ return J[((l = a.value) == null ? void 0 : l.type) || "VOUCHER"];
33
+ }
34
+ ), D = G(() => {
35
+ const l = f.safeParse(a.value);
36
+ return l.success ? [] : l.error.errors;
37
+ });
38
+ function H() {
39
+ const l = f.safeParse(a.value);
40
+ if (l.success) {
41
+ const n = { ...l.data };
42
+ T.value && (n.capabilities = fe), S("update", n);
43
+ }
44
+ }
45
+ function k(l, n, t = {
46
+ isStoreReward: !1,
47
+ type: "VOUCHER"
48
+ }) {
49
+ g.value = l, l && (R.value = void 0, T.value = t.isFeedvibe ?? !1, a.value = n || ue(t.type, {
50
+ business: m.currentBusiness.value._id,
51
+ noCampaign: t.isStoreReward == !0
52
+ }));
53
+ }
54
+ return Y(async () => {
55
+ await y.readLocations();
56
+ }), r({
57
+ showSheet: k,
58
+ data: a,
59
+ rewardImage: R
60
+ }), (l, n) => {
61
+ const t = b("FmTextarea"), o = b("FmHelperText"), c = b("FmButton"), _ = b("FmSideSheet");
62
+ return w(), C(_, {
63
+ "max-width": 560,
64
+ modelValue: e(g),
65
+ "onUpdate:modelValue": n[7] || (n[7] = (d) => Q(g) ? g.value = d : null),
66
+ header: "Store setting"
67
+ }, {
68
+ "side-sheet-footer": F(() => [
69
+ s("div", Re, [
70
+ u(c, {
71
+ label: "Submit",
72
+ onClick: H,
73
+ disabled: e(D).length > 0 || e(Z)().isLoading,
74
+ loading: e(Z)().isLoading
75
+ }, null, 8, ["disabled", "loading"]),
76
+ u(c, {
77
+ label: "Cancel",
78
+ onClick: n[6] || (n[6] = (d) => k(!1)),
79
+ variant: "tertiary"
80
+ })
81
+ ])
82
+ ]),
83
+ default: F(() => {
84
+ var d, h, U;
85
+ return [
86
+ e(a) ? (w(), P("div", ge, [
87
+ s("div", ve, [
88
+ n[8] || (n[8] = X(" Reward information ", -1)),
89
+ (w(), C(M(e(p).chip())))
90
+ ]),
91
+ u(le, {
92
+ modelValue: e(a).name,
93
+ "onUpdate:modelValue": n[0] || (n[0] = (i) => e(a).name = i),
94
+ label: `${e(p).name} name`,
95
+ schema: e(x).typeAtPath(e(f), "name", [e(a).type])
96
+ }, null, 8, ["modelValue", "label", "schema"]),
97
+ u(t, {
98
+ class: "!mb-[-16px]",
99
+ modelValue: e(a).description,
100
+ "onUpdate:modelValue": n[1] || (n[1] = (i) => e(a).description = i),
101
+ rules: [e(x).ruleAtPath(e(f), "description", [e(a).type])]
102
+ }, {
103
+ label: F(() => [
104
+ (w(), C(M(
105
+ e(x).toInputLabel(
106
+ e(x).typeAtPath(e(f), "description", [e(a).type]),
107
+ `${e(p).name} description`
108
+ )
109
+ )))
110
+ ]),
111
+ _: 1
112
+ }, 8, ["modelValue", "rules"]),
113
+ s("div", be, [
114
+ s("div", null, B(e(p).name) + " description should not exceed 200 characters. ", 1),
115
+ s("div", null, B(((d = e(a).description) == null ? void 0 : d.length) ?? 0) + "/200", 1)
116
+ ]),
117
+ u(de, {
118
+ class: "w-1/2 xs:w-2/3",
119
+ "aspect-ratio": "16/9",
120
+ file: e(R) ?? void 0,
121
+ thumbnail: e(a).image ?? void 0,
122
+ "onUpdate:file": n[2] || (n[2] = async (i) => {
123
+ R.value = i, i || (e(a).image = null);
124
+ })
125
+ }, {
126
+ label: F(() => [
127
+ (w(), C(M(
128
+ e(x).toInputLabel(
129
+ e(x).typeAtPath(e(f), "image", [e(a).type]),
130
+ `${e(p).name} image`
131
+ )
132
+ )))
133
+ ]),
134
+ _: 1
135
+ }, 8, ["file", "thumbnail"]),
136
+ e(a).type === "VOUCHER" ? (w(), P(q, { key: 0 }, [
137
+ n[9] || (n[9] = s("div", { class: "fm-typo-en-title-sm-800" }, "Discount", -1)),
138
+ u(me, {
139
+ "model-value": e(a).extras.effect,
140
+ "onUpdate:modelValue": n[3] || (n[3] = (i) => {
141
+ e(a).extras.effect = i;
142
+ })
143
+ }, null, 8, ["model-value"]),
144
+ e(a).extras.effect == null ? (w(), C(o, {
145
+ key: 0,
146
+ class: "!mt-8",
147
+ text: "Effect is required",
148
+ state: "error"
149
+ })) : $("", !0),
150
+ n[10] || (n[10] = s("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, " Usage configuration ", -1)),
151
+ u(pe, {
152
+ "model-value": e(a).options,
153
+ "no-campaign": e(a).noCampaign,
154
+ "onUpdate:modelValue": n[4] || (n[4] = (i) => e(a).options = i),
155
+ schema: e(x).typeAtPath(e(f), "options", ["VOUCHER"])
156
+ }, null, 8, ["model-value", "no-campaign", "schema"])
157
+ ], 64)) : $("", !0),
158
+ n[11] || (n[11] = s("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Availability", -1)),
159
+ e(a).type === "VOUCHER" ? (w(), C(ce, {
160
+ key: 1,
161
+ "model-value": ((U = (h = e(a).extras) == null ? void 0 : h.targetLocation) == null ? void 0 : U.map(String)) ?? null,
162
+ type: "select",
163
+ "onUpdate:modelValue": n[5] || (n[5] = (i) => {
164
+ e(a).extras.targetLocation = i;
165
+ }),
166
+ rules: [
167
+ e(x).ruleAtPath(e(f), "extras.targetLocation", ["VOUCHER"])
168
+ ]
169
+ }, null, 8, ["model-value", "rules"])) : $("", !0)
170
+ ])) : $("", !0)
171
+ ];
172
+ }),
173
+ _: 1
174
+ }, 8, ["modelValue"]);
175
+ };
176
+ }
177
+ }), xe = { class: "flex flex-nowrap gap-x-2 grow h-full" }, Ce = { class: "flex flex-col grow p-24" }, Fe = { class: "grow pb-16 pr-16 pt-6 w-full" }, he = { class: "gap-24 grid grid-cols-1 lg:grid-cols-2" }, Ee = /* @__PURE__ */ W({
178
+ __name: "RewardTypeDialog",
179
+ props: {
180
+ onOk: {
181
+ type: Function,
182
+ required: !0
183
+ }
184
+ },
185
+ setup(L) {
186
+ const r = z(), E = L;
187
+ function S(y) {
188
+ E.onOk(y), r.close();
189
+ }
190
+ return (y, m) => {
191
+ const g = b("FmCard");
192
+ return w(), C(g, { class: "max-w-6xl" }, {
193
+ default: F(() => [
194
+ s("div", xe, [
195
+ s("div", Ce, [
196
+ m[4] || (m[4] = s("div", { class: "space-y-4" }, [
197
+ s("div", { class: "fm-typo-en-title-sm-800" }, "Store rewards"),
198
+ s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, " Select a reward type to get started. ")
199
+ ], -1)),
200
+ s("div", Fe, [
201
+ s("div", he, [
202
+ u(g, {
203
+ variant: "outlined",
204
+ class: "box-border cursor-pointer h-full p-16 scroll-p-4 space-y-8",
205
+ onClick: m[0] || (m[0] = (a) => S("general"))
206
+ }, {
207
+ default: F(() => [...m[2] || (m[2] = [
208
+ s("div", { class: "fm-typo-en-title-sm-800" }, "General Reward", -1),
209
+ s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " A standard voucher reward that can be freely edited and managed. ", -1)
210
+ ])]),
211
+ _: 1
212
+ }),
213
+ u(g, {
214
+ variant: "outlined",
215
+ class: "box-border cursor-pointer h-full p-16 scroll-p-4 space-y-8",
216
+ onClick: m[1] || (m[1] = (a) => S("feedvibe"))
217
+ }, {
218
+ default: F(() => [...m[3] || (m[3] = [
219
+ s("div", { class: "fm-typo-en-title-sm-800" }, "FeedVibe Reward", -1),
220
+ s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " A locked reward for FeedVibe bundles. Cannot be edited or deleted after creation. ", -1)
221
+ ])]),
222
+ _: 1
223
+ })
224
+ ])
225
+ ])
226
+ ])
227
+ ])
228
+ ]),
229
+ _: 1
230
+ });
231
+ };
232
+ }
233
+ }), Se = { class: "px-24 flex flex-col gap-y-16" }, Ve = { class: "flex items-center justify-between w-full" }, Oe = { class: "flex flex-col gap-16 text-center" }, Te = { class: "fm-typo-en-title-sm-800" }, ke = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xe = /* @__PURE__ */ W({
234
+ __name: "StoreRewards",
235
+ setup(L) {
236
+ const { t: r } = ae(), E = z(), S = {
237
+ label: r("connect.storeRewards.create"),
238
+ value: "create",
239
+ isPrimary: !0,
240
+ prependIcon: "add"
241
+ }, y = oe(), { global: m, minor: g } = te, a = we(), R = V({
242
+ searchKey: "",
243
+ columnFilters: []
244
+ }), T = [
245
+ {
246
+ header: r("connect.storeRewards.table.name"),
247
+ accessorFn: (t) => t.name,
248
+ cell(t) {
249
+ const o = t.row.original, c = j(
250
+ o.capabilities,
251
+ "STORE_BUNDLE:FEEDVIBE",
252
+ "selectable",
253
+ !1
254
+ );
255
+ return v("div", { class: "flex items-center gap-8" }, [
256
+ v("span", {}, o.name),
257
+ ...c ? [
258
+ v(O.FmChip, {
259
+ label: "Feedvibe",
260
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
261
+ compact: !0
262
+ })
263
+ ] : []
264
+ ]);
265
+ }
266
+ },
267
+ {
268
+ id: "type",
269
+ header: r("connect.storeRewards.table.type"),
270
+ accessorFn: (t) => t.type,
271
+ cell(t) {
272
+ return J[t.row.original.type].chip();
273
+ }
274
+ },
275
+ {
276
+ header: r("connect.storeRewards.table.validity"),
277
+ accessorFn: (t) => ye(
278
+ "validityOption" in t.options ? t.options.validityOption || {} : {}
279
+ )
280
+ },
281
+ {
282
+ header: r("connect.storeRewards.table.used"),
283
+ meta: {
284
+ textAlign: "left"
285
+ },
286
+ accessorFn: (t) => t.currentReceive ?? 0
287
+ },
288
+ {
289
+ header: r("connect.storeRewards.table.actions"),
290
+ cell(t) {
291
+ return v("div", { class: "flex items-center justify-end gap-4" }, [
292
+ v(
293
+ O.FmMenu,
294
+ {
295
+ placement: "bottom-end",
296
+ onClick: (o) => {
297
+ o.stopPropagation();
298
+ }
299
+ },
300
+ {
301
+ "menu-button": () => v(O.FmButton, {
302
+ icon: "more_vert",
303
+ iconColor: "neutral-gray-400",
304
+ variant: "tertiary"
305
+ }),
306
+ default: () => [
307
+ v(O.FmMenuItem, {
308
+ label: "View collections",
309
+ onClick: async (o) => {
310
+ o.stopPropagation(), D(t.row.original._id);
311
+ }
312
+ }),
313
+ ...j(
314
+ t.row.original.capabilities,
315
+ "STORE_BUNDLE:FEEDVIBE",
316
+ "deletable"
317
+ ) ? [
318
+ v(
319
+ O.FmMenuItem,
320
+ {
321
+ onClick: async (o) => {
322
+ o.stopPropagation(), H(t.row.original);
323
+ }
324
+ },
325
+ {
326
+ label: v(
327
+ "div",
328
+ {
329
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
330
+ },
331
+ "Remove"
332
+ )
333
+ }
334
+ )
335
+ ] : []
336
+ ]
337
+ }
338
+ )
339
+ ]);
340
+ }
341
+ }
342
+ ], f = G(
343
+ () => y.bundleRewards.filter((t) => t.type == "VOUCHER")
344
+ ), p = V();
345
+ function D(t) {
346
+ a.push({
347
+ name: A["$connect-STORE_REWARD_COLLECTIONS"],
348
+ params: { id: t }
349
+ });
350
+ }
351
+ async function H(t) {
352
+ if (t.type === "TITLE") {
353
+ await I.confirm(
354
+ r("connect.storeRewards.remove.message"),
355
+ r("connect.storeRewards.remove.title"),
356
+ r("connect.storeRewards.remove.action")
357
+ ) && await a.push({ name: A["$connect-PROGRAM_TITLE"] });
358
+ return;
359
+ }
360
+ await I.remove(
361
+ r("connect.storeRewards.delete.confirm"),
362
+ r("connect.storeRewards.delete.title")
363
+ ) && await g(
364
+ async () => {
365
+ await N.deleteReward(t._id), await y.readMembership(), await y.readRewards();
366
+ },
367
+ {
368
+ message: r("connect.storeRewards.delete.message"),
369
+ successMessage: r("connect.storeRewards.delete.success")
370
+ }
371
+ );
372
+ }
373
+ function k() {
374
+ return new Promise((t) => {
375
+ E.open({
376
+ title: "Create reward",
377
+ dialogComponent: v(Ee, {
378
+ onOk: (o) => {
379
+ t(o);
380
+ }
381
+ })
382
+ }).onClose(() => {
383
+ t(null);
384
+ });
385
+ });
386
+ }
387
+ async function l(t) {
388
+ var c, _;
389
+ const o = t ? se(y.bundleRewards.find((d) => d._id === t)) : void 0;
390
+ if (o && !j(
391
+ o.capabilities,
392
+ "STORE_BUNDLE:FEEDVIBE",
393
+ "editable"
394
+ )) {
395
+ await I.confirm(
396
+ "This reward is managed by FeedVibe and cannot be edited.",
397
+ "Cannot edit reward",
398
+ "OK"
399
+ );
400
+ return;
401
+ }
402
+ if ((o == null ? void 0 : o.type) === "TITLE") {
403
+ await I.confirm(
404
+ "You cannot edit a title here, please edit it at the Program > Title section.",
405
+ "Update reward",
406
+ "Go to title section"
407
+ ) && await a.push({ name: A["$connect-PROGRAM_TITLE"] });
408
+ return;
409
+ }
410
+ if (!o) {
411
+ const d = await k();
412
+ if (!d) return;
413
+ (c = p.value) == null || c.showSheet(!0, void 0, {
414
+ isStoreReward: !0,
415
+ type: "VOUCHER",
416
+ isFeedvibe: d === "feedvibe"
417
+ });
418
+ return;
419
+ }
420
+ (_ = p.value) == null || _.showSheet(!0, o, {
421
+ isStoreReward: !0,
422
+ type: "VOUCHER"
423
+ });
424
+ }
425
+ async function n(t) {
426
+ let o = !1;
427
+ t._id && t.type === "VOUCHER" && await new Promise((c) => {
428
+ E.open({
429
+ title: "Confirmation",
430
+ message: r("connect.campaign.voucher.updateConfirm.message"),
431
+ primaryActions: {
432
+ text: r("connect.campaign.voucher.updateConfirm.updateAll"),
433
+ close: !0
434
+ },
435
+ secondaryActions: {
436
+ text: r("connect.campaign.voucher.updateConfirm.updateFuture"),
437
+ close: !0
438
+ }
439
+ }).onPrimary(async () => {
440
+ o = !0, c();
441
+ }).onSecondary(async () => {
442
+ c();
443
+ });
444
+ }), await g(
445
+ async () => {
446
+ var c, _, d, h;
447
+ (c = p.value) != null && c.rewardImage && t.image ? await K.delete(t.image) : (_ = p.value) != null && _.rewardImage && (t.image = await K.update(
448
+ t.image || K.collectibleImagePath(
449
+ void 0,
450
+ p.value.rewardImage
451
+ ),
452
+ (d = p.value) == null ? void 0 : d.rewardImage
453
+ )), t._id ? await N.updateReward(t._id, {
454
+ ...t,
455
+ updateCollection: o
456
+ }) : await N.createReward(t), await y.readRewards(), (h = p.value) == null || h.showSheet(!1);
457
+ },
458
+ {
459
+ message: "Updating reward",
460
+ successMessage: "Reward updated successfully"
461
+ }
462
+ );
463
+ }
464
+ return Y(async () => {
465
+ await m(async () => {
466
+ await y.readMembership(), await y.readRewards();
467
+ });
468
+ }), (t, o) => {
469
+ const c = b("FmPageHead"), _ = b("FmSearch"), d = b("FmTable"), h = b("FmButton"), U = b("FmCard");
470
+ return w(), P(q, null, [
471
+ u(c, {
472
+ title: e(r)("connect.storeRewards.title"),
473
+ description: e(r)("connect.storeRewards.description"),
474
+ actions: [S],
475
+ "back-button": !0,
476
+ "onClick:action": o[0] || (o[0] = () => l()),
477
+ "onClick:back": o[1] || (o[1] = () => e(a).push({ name: e(A)["$connect-STORE"] }))
478
+ }, null, 8, ["title", "description", "actions"]),
479
+ s("div", Se, [
480
+ e(f) && e(f).length > 0 ? (w(), P(q, { key: 0 }, [
481
+ s("div", Ve, [
482
+ o[6] || (o[6] = s("div", { class: "flex gap-8" }, null, -1)),
483
+ u(_, {
484
+ modelValue: e(R).searchKey,
485
+ "onUpdate:modelValue": o[2] || (o[2] = (i) => e(R).searchKey = i),
486
+ class: "",
487
+ placeholder: "search",
488
+ collapsible: ""
489
+ }, null, 8, ["modelValue"])
490
+ ]),
491
+ u(d, {
492
+ "row-data": e(f),
493
+ "column-defs": T,
494
+ "search-value": e(R).searchKey,
495
+ "column-filter": e(R).columnFilters,
496
+ onRowClick: o[3] || (o[3] = (i) => l(i.original._id)),
497
+ "hide-footer": e(f).length < 10
498
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
499
+ ], 64)) : (w(), C(U, {
500
+ key: 1,
501
+ variant: "outlined",
502
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
503
+ }, {
504
+ default: F(() => [
505
+ o[7] || (o[7] = s("img", {
506
+ src: ee,
507
+ class: "aspect-square w-[150px]"
508
+ }, null, -1)),
509
+ s("div", Oe, [
510
+ s("div", Te, B(e(r)("connect.storeRewards.empty.title")), 1),
511
+ s("div", ke, B(e(r)("connect.storeRewards.empty.description")), 1)
512
+ ]),
513
+ u(h, {
514
+ variant: "primary",
515
+ label: e(r)("connect.storeRewards.empty.action"),
516
+ onClick: o[4] || (o[4] = (i) => l()),
517
+ icon: "add"
518
+ }, null, 8, ["label"])
519
+ ]),
520
+ _: 1
521
+ })),
522
+ u(_e, {
523
+ ref_key: "rewardSheetRef",
524
+ ref: p,
525
+ onUpdate: o[5] || (o[5] = (i) => n(i))
526
+ }, null, 512)
527
+ ])
528
+ ], 64);
529
+ };
530
+ }
531
+ });
532
+ export {
533
+ Xe as default
534
+ };