@feedmepos/mf-connect 0.1.38-beta.9 → 0.1.38-beta.91

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 (162) hide show
  1. package/dist/{Analytic-3MN2saaU.js → Analytic-Drbkm5By.js} +31 -32
  2. package/dist/{App-Co8X5Wdy.js → App-C0cdcG5i.js} +741 -728
  3. package/dist/AuditLogs-BZZLtf2u.js +2013 -0
  4. package/dist/{Bin-8a56ZDib.js → Bin-DRV5lRmj.js} +10 -10
  5. package/dist/Broadcast-C90FN2LB.js +266 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BVXlfq31.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CsdxwjCn.js} +6 -6
  7. package/dist/{Card-B8_09LJu.js → Card-CWF84A1O.js} +145 -140
  8. package/dist/Collections-ja0gMaFf.js +540 -0
  9. package/dist/Credit-D8U2AJgq.js +260 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/DateInput.vue_vue_type_script_setup_true_lang-BN4Q5Y3l.js +54 -0
  12. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js → DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js} +1 -1
  13. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-YR62BvBG.js +3120 -0
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BVbhDMqH.js +351 -0
  15. package/dist/Experience-DDXLGizu.js +259 -0
  16. package/dist/{FileSaver.min-NlMItPOc.js → FileSaver.min-Dng61jiL.js} +1 -1
  17. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  18. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  19. package/dist/Game-CMOilzsW.js +330 -0
  20. package/dist/Grab-tPVQB39R.js +300 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-BbtEXO4b.js} +49 -48
  22. package/dist/{Index-DLF71mx_.js → Index-Ch7wiShF.js} +54 -54
  23. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-DLO0jj6Z.js +48 -0
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CplyhUFF.js} +1 -1
  25. package/dist/{MainLayout-B1aJoR95.js → MainLayout-BMqnfxHh.js} +1 -1
  26. package/dist/Marketing-C0weDg-u.js +236 -0
  27. package/dist/MarketingMaterialEdit-BD-SyXVQ.js +1036 -0
  28. package/dist/{Member-Bkw4aqtv.js → Member-Bpf0amjr.js} +38 -37
  29. package/dist/{MemberList-a3PdVYB3.js → MemberList-cWYPEpL4.js} +485 -489
  30. package/dist/{MemberTransactions-CPDBd-n3.js → MemberTransactions-vzRUVwpO.js} +1 -1
  31. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-pbN8pN1m.js → MessageInput.vue_vue_type_script_setup_true_lang-DY3L9CvB.js} +10392 -9967
  32. package/dist/Mission-HRwIp1QY.js +334 -0
  33. package/dist/{Overview-De97NDoe.js → Overview-D9cfX4Kr.js} +34 -34
  34. package/dist/Point-Dz-Z0_m9.js +262 -0
  35. package/dist/Promotion-Csb0bdI6.js +397 -0
  36. package/dist/{Queue-ISVZxCE2.js → Queue-CAVKh9bK.js} +18 -18
  37. package/dist/{Record-2FMByNC6.js → Record-bPnIoHnT.js} +15 -14
  38. package/dist/Review-D2DfvLqJ.js +621 -0
  39. package/dist/ReviewFacebookCallback-CI7V3xbp.js +243 -0
  40. package/dist/ReviewGoogleCallback-LA2S8FLZ.js +213 -0
  41. package/dist/{Reward-DPRyQ37x.js → Reward-DdHF5Pr7.js} +16 -16
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Ba7-3bL-.js → RewardGroup.vue_vue_type_script_setup_true_lang-DyZhWnI4.js} +13 -14
  43. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-B0OSLJVN.js +1912 -0
  44. package/dist/Segment-DV1zcWF7.js +1015 -0
  45. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DZbyDVid.js → SelectItems.vue_vue_type_script_setup_true_lang-Df1HE9sL.js} +23 -23
  46. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-ioMFYIwK.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-C0K9giqI.js} +12 -12
  47. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CzJL8Xl0.js +226 -0
  48. package/dist/Setting-DZiZy8A5.js +2039 -0
  49. package/dist/SettingAdvertisements-Bb9shWVJ.js +264 -0
  50. package/dist/Store-mymtMyho.js +1996 -0
  51. package/dist/StoreRewards-jcjZfSv7.js +537 -0
  52. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B-b5_TFL.js +1130 -0
  53. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-sCa1J_hq.js +7007 -0
  54. package/dist/{Tier-CwRj0oJ1.js → Tier-Ba6aHC3R.js} +562 -480
  55. package/dist/{Title-EII5OxSP.js → Title-C4uKD8E1.js} +151 -149
  56. package/dist/{Transaction-1MTkAfej.js → Transaction-Bf2uG6co.js} +2 -2
  57. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BlQVWQHJ.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C3ttU-bw.js} +7 -7
  58. package/dist/Voucher-Lsc2pKCk.js +421 -0
  59. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-MA7tsTm-.js +421 -0
  60. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CTeGK4bk.js → ZodTextField.vue_vue_type_script_setup_true_lang-DEDavbCx.js} +2 -2
  61. package/dist/app-BRrGcz9U.js +59647 -0
  62. package/dist/app.js +1 -1
  63. package/dist/{business-DjnN-J4U.js → business-TBSvPv65.js} +11 -8
  64. package/dist/campaign-CL95CZkI.js +219 -0
  65. package/dist/campaign-DxcuYXB7.js +254 -0
  66. package/dist/campaign.enum-DRydaoy9.js +26 -0
  67. package/dist/campaign.fn-BsoUwQ5N.js +776 -0
  68. package/dist/{collectible.enum-r6N115Lu.js → collectible.enum-CpTbpumt.js} +1 -1
  69. package/dist/{collection.fn-CSsfVv26.js → collection.fn-BNrPdDIr.js} +2 -2
  70. package/dist/dto-BGrkIVqX.js +222 -0
  71. package/dist/duplicateCampaign-DBaFROXd.js +51 -0
  72. package/dist/effect-fonU-1xO.js +89 -0
  73. package/dist/{email-addresses-D8uheCCF.js → email-addresses-WeV5Gvxa.js} +2 -2
  74. package/dist/{export-Ver6WiX6.js → export-DDXf8yf_.js} +4 -4
  75. package/dist/{helper-Bg4xoFbh.js → helper-DwnzJKxo.js} +22 -7
  76. package/dist/index-10x-WMiS.js +30289 -0
  77. package/dist/index-9Wt89ReU.js +3625 -0
  78. package/dist/{index-Bb0CHeNx.js → index-Brh5FXQ7.js} +3 -3
  79. package/dist/index-BxxNZQUc.js +8910 -0
  80. package/dist/{index-hJUxCNsF.js → index-CDAMmPIn.js} +1 -1
  81. package/dist/{index-CNhr0_Zx.js → index-Cg1vzNzf.js} +617 -191
  82. package/dist/{index-BZZ4iF4-.js → index-Cl7QnFc4.js} +23 -12
  83. package/dist/index-CuvNtC_M.js +61 -0
  84. package/dist/{index-BPQyQc4q.js → index-Cvw-xFek.js} +1 -1
  85. package/dist/index-DCJ_r_e2.js +85 -0
  86. package/dist/{index-Dn_bmcns.js → index-DLG8B-TK.js} +3 -3
  87. package/dist/{index-D4JOeJJJ.js → index-DWhh_u0L.js} +1 -1
  88. package/dist/index-DsQJTvKe.js +28900 -0
  89. package/dist/index-oR7xhhIt.js +48 -0
  90. package/dist/{index.esm2017-hK1Mi9yY.js → index.esm2017-CFvohTUs.js} +122 -122
  91. package/dist/{loading-kIQFOTwH.js → loading-DiD8J1Jc.js} +4 -3
  92. package/dist/{lodash-B5I3zXaY.js → lodash-BJgKlNEt.js} +1 -1
  93. package/dist/{membership--xR-HZoa.js → membership-C8HuK9_K.js} +38 -18
  94. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  95. package/dist/{money-c-ITXnlg.js → money-DXl1-c0l.js} +1 -1
  96. package/dist/{number-DfZSBLOY.js → number-C6RGu6qp.js} +1 -1
  97. package/dist/objectid-8Boc1xMT.js +145 -0
  98. package/dist/{campaign-BpJ1O6KS.js → plugins-CxBcRdUi.js} +677 -699
  99. package/dist/remy-D_Deb3ue.js +13 -0
  100. package/dist/{reward-CE0ifMHS.js → reward-CEh2CA9Z.js} +1 -1
  101. package/dist/{rule-DrjdmpaB.js → rule-DEfU8NOO.js} +505 -487
  102. package/dist/rule-builder-BZIx2IzX.js +102 -0
  103. package/dist/string-Gcy5IM_H.js +32 -0
  104. package/dist/style.css +11 -2
  105. package/dist/template-Ba8NxY41.js +188 -0
  106. package/dist/timezone-DUqMvcwo.js +1156 -0
  107. package/dist/trigger-KQ-DPHv-.js +213 -0
  108. package/dist/useMarketingMaterialActions-DSI7Fpu9.js +96 -0
  109. package/dist/usePagination-BeTADCIt.js +220 -0
  110. package/dist/{user-Cl3IotYV.js → user-DN6_QE2j.js} +15 -14
  111. package/dist/vue-i18n-B4dOYJz4.js +2365 -0
  112. package/dist/{xlsx-BDBzdOuM.js → xlsx-BDFTkXYe.js} +1 -1
  113. package/dist/{zod-Bg2FbC-D.js → zod-B8WJKIxe.js} +32 -31
  114. package/package.json +14 -6
  115. package/dist/AuditLogs-DTq6IAuc.js +0 -1887
  116. package/dist/Broadcast-UreS5Kiq.js +0 -227
  117. package/dist/Collections-B0I5ULxR.js +0 -465
  118. package/dist/Credit-B4Ad8DWP.js +0 -222
  119. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  120. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DjgACf9F.js +0 -2185
  121. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-y5JnuIev.js +0 -347
  122. package/dist/Experience-xO5KpTTm.js +0 -223
  123. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  124. package/dist/Game-ChgrVvz5.js +0 -278
  125. package/dist/Marketing-BlmRXSGl.js +0 -20073
  126. package/dist/Mission-B07wK0HX.js +0 -296
  127. package/dist/Point-Ckj9QIeH.js +0 -226
  128. package/dist/Promotion-aGNCOeRN.js +0 -289
  129. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DWj-421v.js +0 -1751
  130. package/dist/Segment-CRMNJ11X.js +0 -882
  131. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-Cfp8XXdO.js +0 -147
  132. package/dist/Setting-c0FWRZsD.js +0 -1936
  133. package/dist/Store-Bm1_15s8.js +0 -1842
  134. package/dist/StoreRewards-BCQHHfay.js +0 -423
  135. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CfTF2l-D.js +0 -1029
  136. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-rvhoxo0w.js +0 -139
  137. package/dist/Voucher-CYvjCb-v.js +0 -384
  138. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-63Jr71dJ.js +0 -419
  139. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  140. package/dist/app-BJLHk8ao.js +0 -33357
  141. package/dist/app-BzIk1ojT.js +0 -7086
  142. package/dist/campaign-BHNS5kXt.js +0 -96
  143. package/dist/campaign.enum-CJDWE_Om.js +0 -20
  144. package/dist/campaign.fn-C0HQE9uh.js +0 -758
  145. package/dist/dto-Byq51uVH.js +0 -214
  146. package/dist/effect-Do3yTM-_.js +0 -78
  147. package/dist/index-B1V9UnI9.js +0 -76
  148. package/dist/index-BM9CWjC6.js +0 -38
  149. package/dist/index-CsaQJMAR.js +0 -66
  150. package/dist/index-D6VxioBg.js +0 -30038
  151. package/dist/index-DGKlRWn3.js +0 -32260
  152. package/dist/index-DLKyOu7W.js +0 -8861
  153. package/dist/index-DyYF6HYL.js +0 -121
  154. package/dist/index-UXtH44XQ.js +0 -3120
  155. package/dist/objectid-DKbha9-x.js +0 -145
  156. package/dist/plugins-DtakupKW.js +0 -208
  157. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  158. package/dist/rule-builder-B_hCyq3x.js +0 -89
  159. package/dist/template-WI4a-lFY.js +0 -190
  160. package/dist/trigger-DieDHht3.js +0 -144
  161. package/dist/usePagination-BeF5K3M7.js +0 -223
  162. package/dist/vue-i18n-DKh0SMhL.js +0 -2365
@@ -0,0 +1,537 @@
1
+ import { defineComponent as Z, ref as U, computed as q, onMounted as z, resolveComponent as C, openBlock as y, createBlock as E, unref as e, isRef as ee, withCtx as S, createElementVNode as n, createVNode as c, createElementBlock as L, createTextVNode as te, resolveDynamicComponent as N, toDisplayString as D, Fragment as W, createCommentVNode as I, h as x } from "vue";
2
+ import { _ as oe } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as J, components as $ } from "@feedmepos/ui-library";
4
+ import "./index-DWhh_u0L.js";
5
+ import { u as ae } from "./loading-DiD8J1Jc.js";
6
+ import { C as Q, u as se } from "./membership-C8HuK9_K.js";
7
+ import { p as P, f as K } from "./plugins-CxBcRdUi.js";
8
+ import { useCoreStore as X } from "@feedmepos/mf-common";
9
+ import { u as ne } from "./vue-i18n-B4dOYJz4.js";
10
+ import { F as re } from "./index-BxxNZQUc.js";
11
+ import { c as ie } from "./object-qECH92oz.js";
12
+ import { u as Y } from "./app-wDQR6dpb.js";
13
+ import { u as le } from "./business-TBSvPv65.js";
14
+ import { Z as h } from "./zod-B8WJKIxe.js";
15
+ import { _ as de } from "./ZodTextField.vue_vue_type_script_setup_true_lang-DEDavbCx.js";
16
+ import { _ as ce } from "./ImageInput.vue_vue_type_script_setup_true_lang-BbtEXO4b.js";
17
+ import { _ as me } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-sCa1J_hq.js";
18
+ import { _ as pe, a as ue } from "./EffectSheet.vue_vue_type_style_index_0_lang-BVbhDMqH.js";
19
+ import { i as fe, F as ye, h as j, t as we } from "./helper-DwnzJKxo.js";
20
+ import { useRouter as ge } from "vue-router";
21
+ import { m as G } from "./index-CDAMmPIn.js";
22
+ import { R as B } from "./app-BRrGcz9U.js";
23
+ const ve = {
24
+ key: 0,
25
+ class: "flex flex-col space-y-16 pr-12"
26
+ }, be = { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, Re = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center justify-between" }, _e = { class: "flex items-center gap-8" }, xe = /* @__PURE__ */ Z({
27
+ __name: "EditRewardSheet",
28
+ emits: ["update"],
29
+ setup(H, { expose: r, emit: T }) {
30
+ const k = T, u = le(), l = X(), w = U(!1), s = U(), F = U(), V = U(!1), g = re, v = q(
31
+ () => {
32
+ var d;
33
+ return Q[((d = s.value) == null ? void 0 : d.type) || "VOUCHER"];
34
+ }
35
+ ), b = q(() => {
36
+ const d = g.safeParse(s.value);
37
+ return d.success ? [] : d.error.errors;
38
+ });
39
+ function M() {
40
+ const d = g.safeParse(s.value);
41
+ if (d.success) {
42
+ const a = { ...d.data };
43
+ V.value && (a.capabilities = ye), k("update", a);
44
+ }
45
+ }
46
+ function A(d, a, O = {
47
+ isStoreReward: !1,
48
+ type: "VOUCHER"
49
+ }) {
50
+ w.value = d, d && (F.value = void 0, V.value = O.isFeedvibe ?? !1, s.value = a || fe(O.type, {
51
+ business: l.currentBusiness.value._id,
52
+ noCampaign: O.isStoreReward == !0
53
+ }));
54
+ }
55
+ return z(async () => {
56
+ await u.readLocations();
57
+ }), r({
58
+ showSheet: A,
59
+ data: s,
60
+ rewardImage: F
61
+ }), (d, a) => {
62
+ const O = C("FmTextarea"), t = C("FmHelperText"), o = C("FmButton"), m = C("FmSideSheet");
63
+ return y(), E(m, {
64
+ "max-width": 560,
65
+ modelValue: e(w),
66
+ "onUpdate:modelValue": a[7] || (a[7] = (p) => ee(w) ? w.value = p : null),
67
+ header: "Store setting"
68
+ }, {
69
+ "side-sheet-footer": S(() => [
70
+ n("div", _e, [
71
+ c(o, {
72
+ label: "Submit",
73
+ onClick: M,
74
+ disabled: e(b).length > 0 || e(Y)().isLoading,
75
+ loading: e(Y)().isLoading
76
+ }, null, 8, ["disabled", "loading"]),
77
+ c(o, {
78
+ label: "Cancel",
79
+ onClick: a[6] || (a[6] = (p) => A(!1)),
80
+ variant: "tertiary"
81
+ })
82
+ ])
83
+ ]),
84
+ default: S(() => {
85
+ var p, R, _;
86
+ return [
87
+ e(s) ? (y(), L("div", ve, [
88
+ n("div", be, [
89
+ a[8] || (a[8] = te(" Reward information ", -1)),
90
+ (y(), E(N(e(v).chip())))
91
+ ]),
92
+ c(de, {
93
+ modelValue: e(s).name,
94
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => e(s).name = i),
95
+ label: `${e(v).name} name`,
96
+ schema: e(h).typeAtPath(e(g), "name", [e(s).type])
97
+ }, null, 8, ["modelValue", "label", "schema"]),
98
+ c(O, {
99
+ class: "!mb-[-16px]",
100
+ modelValue: e(s).description,
101
+ "onUpdate:modelValue": a[1] || (a[1] = (i) => e(s).description = i),
102
+ rules: [e(h).ruleAtPath(e(g), "description", [e(s).type])]
103
+ }, {
104
+ label: S(() => [
105
+ (y(), E(N(
106
+ e(h).toInputLabel(
107
+ e(h).typeAtPath(e(g), "description", [e(s).type]),
108
+ `${e(v).name} description`
109
+ )
110
+ )))
111
+ ]),
112
+ _: 1
113
+ }, 8, ["modelValue", "rules"]),
114
+ n("div", Re, [
115
+ n("div", null, D(e(v).name) + " description should not exceed 200 characters. ", 1),
116
+ n("div", null, D(((p = e(s).description) == null ? void 0 : p.length) ?? 0) + "/200", 1)
117
+ ]),
118
+ c(ce, {
119
+ class: "w-1/2 xs:w-2/3",
120
+ "aspect-ratio": "16/9",
121
+ file: e(F) ?? void 0,
122
+ thumbnail: e(s).image ?? void 0,
123
+ "onUpdate:file": a[2] || (a[2] = async (i) => {
124
+ F.value = i, i || (e(s).image = null);
125
+ })
126
+ }, {
127
+ label: S(() => [
128
+ (y(), E(N(
129
+ e(h).toInputLabel(
130
+ e(h).typeAtPath(e(g), "image", [e(s).type]),
131
+ `${e(v).name} image`
132
+ )
133
+ )))
134
+ ]),
135
+ _: 1
136
+ }, 8, ["file", "thumbnail"]),
137
+ e(s).type === "VOUCHER" ? (y(), L(W, { key: 0 }, [
138
+ a[9] || (a[9] = n("div", { class: "fm-typo-en-title-sm-800" }, "Discount", -1)),
139
+ c(pe, {
140
+ "model-value": e(s).extras.effect,
141
+ "onUpdate:modelValue": a[3] || (a[3] = (i) => {
142
+ e(s).extras.effect = i;
143
+ })
144
+ }, null, 8, ["model-value"]),
145
+ e(s).extras.effect == null ? (y(), E(t, {
146
+ key: 0,
147
+ class: "!mt-8",
148
+ text: "Effect is required",
149
+ state: "error"
150
+ })) : I("", !0),
151
+ a[10] || (a[10] = n("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, " Usage configuration ", -1)),
152
+ c(ue, {
153
+ "model-value": e(s).options,
154
+ "no-campaign": e(s).noCampaign,
155
+ "onUpdate:modelValue": a[4] || (a[4] = (i) => e(s).options = i),
156
+ schema: e(h).typeAtPath(e(g), "options", ["VOUCHER"])
157
+ }, null, 8, ["model-value", "no-campaign", "schema"])
158
+ ], 64)) : I("", !0),
159
+ a[11] || (a[11] = n("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Availability", -1)),
160
+ e(s).type === "VOUCHER" ? (y(), E(me, {
161
+ key: 1,
162
+ "model-value": ((_ = (R = e(s).extras) == null ? void 0 : R.targetLocation) == null ? void 0 : _.map(String)) ?? null,
163
+ type: "select",
164
+ "onUpdate:modelValue": a[5] || (a[5] = (i) => {
165
+ e(s).extras.targetLocation = i;
166
+ }),
167
+ rules: [
168
+ e(h).ruleAtPath(e(g), "extras.targetLocation", ["VOUCHER"])
169
+ ]
170
+ }, null, 8, ["model-value", "rules"])) : I("", !0)
171
+ ])) : I("", !0)
172
+ ];
173
+ }),
174
+ _: 1
175
+ }, 8, ["modelValue"]);
176
+ };
177
+ }
178
+ }), Ce = { class: "flex flex-nowrap gap-x-2 grow h-full" }, Fe = { class: "flex flex-col grow p-24" }, he = { class: "grow pb-16 pr-16 pt-6 w-full" }, Ee = { class: "gap-24 grid grid-cols-1 lg:grid-cols-2" }, Se = /* @__PURE__ */ Z({
179
+ __name: "RewardTypeDialog",
180
+ props: {
181
+ onOk: {
182
+ type: Function,
183
+ required: !0
184
+ }
185
+ },
186
+ setup(H) {
187
+ const r = J(), T = H;
188
+ function k(u) {
189
+ T.onOk(u), r.close();
190
+ }
191
+ return (u, l) => {
192
+ const w = C("FmCard");
193
+ return y(), E(w, { class: "max-w-6xl" }, {
194
+ default: S(() => [
195
+ n("div", Ce, [
196
+ n("div", Fe, [
197
+ l[4] || (l[4] = n("div", { class: "space-y-4" }, [
198
+ n("div", { class: "fm-typo-en-title-sm-800" }, "Store rewards"),
199
+ n("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, " Select a reward type to get started. ")
200
+ ], -1)),
201
+ n("div", he, [
202
+ n("div", Ee, [
203
+ c(w, {
204
+ variant: "outlined",
205
+ class: "box-border cursor-pointer h-full p-16 scroll-p-4 space-y-8",
206
+ onClick: l[0] || (l[0] = (s) => k("general"))
207
+ }, {
208
+ default: S(() => [...l[2] || (l[2] = [
209
+ n("div", { class: "fm-typo-en-title-sm-800" }, "General Reward", -1),
210
+ n("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)
211
+ ])]),
212
+ _: 1
213
+ }),
214
+ c(w, {
215
+ variant: "outlined",
216
+ class: "box-border cursor-pointer h-full p-16 scroll-p-4 space-y-8",
217
+ onClick: l[1] || (l[1] = (s) => k("feedvibe"))
218
+ }, {
219
+ default: S(() => [...l[3] || (l[3] = [
220
+ n("div", { class: "fm-typo-en-title-sm-800" }, "FeedVibe Reward", -1),
221
+ n("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)
222
+ ])]),
223
+ _: 1
224
+ })
225
+ ])
226
+ ])
227
+ ])
228
+ ])
229
+ ]),
230
+ _: 1
231
+ });
232
+ };
233
+ }
234
+ }), Ve = { class: "px-24 flex flex-col gap-y-16" }, Oe = { class: "flex items-center justify-between w-full" }, Te = { class: "flex flex-col gap-16 text-center" }, ke = { class: "fm-typo-en-title-sm-800" }, Ue = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, tt = /* @__PURE__ */ Z({
235
+ __name: "StoreRewards",
236
+ setup(H) {
237
+ const { t: r } = ne(), T = J(), k = {
238
+ label: r("connect.storeRewards.create"),
239
+ value: "create",
240
+ isPrimary: !0,
241
+ prependIcon: "add"
242
+ }, u = se(), l = X(), { global: w, minor: s } = ae, F = ge(), V = U({
243
+ searchKey: "",
244
+ columnFilters: []
245
+ }), g = [
246
+ {
247
+ header: r("connect.storeRewards.table.name"),
248
+ accessorFn: (t) => t.name,
249
+ cell(t) {
250
+ const o = t.row.original, m = j(
251
+ o.capabilities,
252
+ "STORE_BUNDLE:FEEDVIBE",
253
+ "selectable",
254
+ !1
255
+ );
256
+ return x("div", { class: "flex items-center gap-8" }, [
257
+ x("span", {}, o.name),
258
+ ...m ? [
259
+ x($.FmChip, {
260
+ label: "Feedvibe",
261
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
262
+ compact: !0
263
+ })
264
+ ] : []
265
+ ]);
266
+ }
267
+ },
268
+ {
269
+ id: "type",
270
+ header: r("connect.storeRewards.table.type"),
271
+ accessorFn: (t) => t.type,
272
+ cell(t) {
273
+ return Q[t.row.original.type].chip();
274
+ }
275
+ },
276
+ {
277
+ header: r("connect.storeRewards.table.validity"),
278
+ accessorFn: (t) => we(
279
+ "validityOption" in t.options ? t.options.validityOption || {} : {}
280
+ )
281
+ },
282
+ {
283
+ header: r("connect.storeRewards.table.used"),
284
+ meta: {
285
+ textAlign: "left"
286
+ },
287
+ accessorFn: (t) => t.currentReceive ?? 0
288
+ },
289
+ {
290
+ header: r("connect.storeRewards.table.actions"),
291
+ cell(t) {
292
+ return x("div", { class: "flex items-center justify-end gap-4" }, [
293
+ x(
294
+ $.FmMenu,
295
+ {
296
+ placement: "bottom-end",
297
+ onClick: (o) => {
298
+ o.stopPropagation();
299
+ }
300
+ },
301
+ {
302
+ "menu-button": () => x($.FmButton, {
303
+ icon: "more_vert",
304
+ iconColor: "neutral-gray-400",
305
+ variant: "tertiary"
306
+ }),
307
+ default: () => [
308
+ x($.FmMenuItem, {
309
+ label: "View collections",
310
+ onClick: async (o) => {
311
+ o.stopPropagation(), M(t.row.original._id);
312
+ }
313
+ }),
314
+ ...j(
315
+ t.row.original.capabilities,
316
+ "STORE_BUNDLE:FEEDVIBE",
317
+ "deletable"
318
+ ) ? [
319
+ x(
320
+ $.FmMenuItem,
321
+ {
322
+ onClick: async (o) => {
323
+ o.stopPropagation(), A(t.row.original);
324
+ }
325
+ },
326
+ {
327
+ label: x(
328
+ "div",
329
+ {
330
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
331
+ },
332
+ "Remove"
333
+ )
334
+ }
335
+ )
336
+ ] : []
337
+ ]
338
+ }
339
+ )
340
+ ]);
341
+ }
342
+ }
343
+ ], v = q(
344
+ () => u.bundleRewards.filter((t) => t.type == "VOUCHER")
345
+ ), b = U();
346
+ function M(t) {
347
+ F.push({
348
+ name: B["$connect-STORE_REWARD_COLLECTIONS"],
349
+ params: { id: t }
350
+ });
351
+ }
352
+ async function A(t) {
353
+ if (t.type === "TITLE") {
354
+ await P.confirm(
355
+ r("connect.storeRewards.remove.message"),
356
+ r("connect.storeRewards.remove.title"),
357
+ r("connect.storeRewards.remove.action")
358
+ ) && await F.push({ name: B["$connect-PROGRAM_TITLE"] });
359
+ return;
360
+ }
361
+ await P.remove(
362
+ r("connect.storeRewards.delete.confirm"),
363
+ r("connect.storeRewards.delete.title")
364
+ ) && await s(
365
+ async () => {
366
+ await G.deleteReward(t._id), await u.readMembership(), await u.readRewards();
367
+ },
368
+ {
369
+ message: r("connect.storeRewards.delete.message"),
370
+ successMessage: r("connect.storeRewards.delete.success")
371
+ }
372
+ );
373
+ }
374
+ function d() {
375
+ return new Promise((t) => {
376
+ T.open({
377
+ title: "Create reward",
378
+ dialogComponent: x(Se, {
379
+ onOk: (o) => {
380
+ t(o);
381
+ }
382
+ })
383
+ }).onClose(() => {
384
+ t(null);
385
+ });
386
+ });
387
+ }
388
+ async function a(t) {
389
+ var R, _, i;
390
+ const o = t ? ie(u.bundleRewards.find((f) => f._id === t)) : void 0, m = ((R = l.sessionUser.value) == null ? void 0 : R.role.isAdmin) ?? !1, p = !!o && !j(
391
+ o.capabilities,
392
+ "STORE_BUNDLE:FEEDVIBE",
393
+ "editable"
394
+ );
395
+ if (p && !m) {
396
+ await P.confirm(
397
+ "This reward is managed by FeedVibe and cannot be edited.",
398
+ "Cannot edit reward",
399
+ "OK"
400
+ );
401
+ return;
402
+ }
403
+ if ((o == null ? void 0 : o.type) === "TITLE") {
404
+ await P.confirm(
405
+ "You cannot edit a title here, please edit it at the Program > Title section.",
406
+ "Update reward",
407
+ "Go to title section"
408
+ ) && await F.push({ name: B["$connect-PROGRAM_TITLE"] });
409
+ return;
410
+ }
411
+ if (!o) {
412
+ const f = await d();
413
+ if (!f) return;
414
+ (_ = b.value) == null || _.showSheet(!0, void 0, {
415
+ isStoreReward: !0,
416
+ type: "VOUCHER",
417
+ isFeedvibe: f === "feedvibe"
418
+ });
419
+ return;
420
+ }
421
+ (i = b.value) == null || i.showSheet(!0, o, {
422
+ isStoreReward: !0,
423
+ type: "VOUCHER",
424
+ // Preserve the FeedVibe lock when an admin edits a locked reward.
425
+ isFeedvibe: p
426
+ });
427
+ }
428
+ async function O(t) {
429
+ let o = !1;
430
+ t._id && t.type === "VOUCHER" && await new Promise((m) => {
431
+ T.open({
432
+ title: "Confirmation",
433
+ message: r("connect.campaign.voucher.updateConfirm.message"),
434
+ primaryActions: {
435
+ text: r("connect.campaign.voucher.updateConfirm.updateAll"),
436
+ close: !0
437
+ },
438
+ secondaryActions: {
439
+ text: r("connect.campaign.voucher.updateConfirm.updateFuture"),
440
+ close: !0
441
+ }
442
+ }).onPrimary(async () => {
443
+ o = !0, m();
444
+ }).onSecondary(async () => {
445
+ m();
446
+ });
447
+ }), await s(
448
+ async () => {
449
+ var m, p, R, _;
450
+ (m = b.value) != null && m.rewardImage && t.image ? await K.delete(t.image) : (p = b.value) != null && p.rewardImage && (t.image = await K.update(
451
+ t.image || K.collectibleImagePath(
452
+ void 0,
453
+ b.value.rewardImage
454
+ ),
455
+ (R = b.value) == null ? void 0 : R.rewardImage
456
+ )), t._id ? await G.updateReward(t._id, {
457
+ ...t,
458
+ updateCollection: o
459
+ }) : await G.createReward(t), await u.readRewards(), (_ = b.value) == null || _.showSheet(!1);
460
+ },
461
+ {
462
+ message: "Updating reward",
463
+ successMessage: "Reward updated successfully"
464
+ }
465
+ );
466
+ }
467
+ return z(async () => {
468
+ await w(async () => {
469
+ await u.readMembership(), await u.readRewards();
470
+ });
471
+ }), (t, o) => {
472
+ const m = C("FmPageHead"), p = C("FmSearch"), R = C("FmTable"), _ = C("FmButton"), i = C("FmCard");
473
+ return y(), L(W, null, [
474
+ c(m, {
475
+ title: e(r)("connect.storeRewards.title"),
476
+ description: e(r)("connect.storeRewards.description"),
477
+ actions: [k],
478
+ "back-button": !0,
479
+ "onClick:action": o[0] || (o[0] = () => a()),
480
+ "onClick:back": o[1] || (o[1] = () => e(F).push({ name: e(B)["$connect-STORE"] }))
481
+ }, null, 8, ["title", "description", "actions"]),
482
+ n("div", Ve, [
483
+ e(v) && e(v).length > 0 ? (y(), L(W, { key: 0 }, [
484
+ n("div", Oe, [
485
+ o[6] || (o[6] = n("div", { class: "flex gap-8" }, null, -1)),
486
+ c(p, {
487
+ modelValue: e(V).searchKey,
488
+ "onUpdate:modelValue": o[2] || (o[2] = (f) => e(V).searchKey = f),
489
+ class: "",
490
+ placeholder: "search",
491
+ collapsible: ""
492
+ }, null, 8, ["modelValue"])
493
+ ]),
494
+ c(R, {
495
+ "row-data": e(v),
496
+ "column-defs": g,
497
+ "search-value": e(V).searchKey,
498
+ "column-filter": e(V).columnFilters,
499
+ onRowClick: o[3] || (o[3] = (f) => a(f.original._id)),
500
+ "hide-footer": e(v).length < 10
501
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
502
+ ], 64)) : (y(), E(i, {
503
+ key: 1,
504
+ variant: "outlined",
505
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
506
+ }, {
507
+ default: S(() => [
508
+ o[7] || (o[7] = n("img", {
509
+ src: oe,
510
+ class: "aspect-square w-[150px]"
511
+ }, null, -1)),
512
+ n("div", Te, [
513
+ n("div", ke, D(e(r)("connect.storeRewards.empty.title")), 1),
514
+ n("div", Ue, D(e(r)("connect.storeRewards.empty.description")), 1)
515
+ ]),
516
+ c(_, {
517
+ variant: "primary",
518
+ label: e(r)("connect.storeRewards.empty.action"),
519
+ onClick: o[4] || (o[4] = (f) => a()),
520
+ icon: "add"
521
+ }, null, 8, ["label"])
522
+ ]),
523
+ _: 1
524
+ })),
525
+ c(xe, {
526
+ ref_key: "rewardSheetRef",
527
+ ref: b,
528
+ onUpdate: o[5] || (o[5] = (f) => O(f))
529
+ }, null, 512)
530
+ ])
531
+ ], 64);
532
+ };
533
+ }
534
+ });
535
+ export {
536
+ tt as default
537
+ };