@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
package/dist/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "vue";
2
- import { F as e, i as o, r as p } from "./app-BzIk1ojT.js";
2
+ import { d as e, i as o, r as p } from "./app-BRrGcz9U.js";
3
3
  export {
4
4
  e as FmApp,
5
5
  o as i18nMessages,
@@ -1,8 +1,8 @@
1
1
  import { ref as i, computed as u } from "vue";
2
2
  import { defineStore as w } from "pinia";
3
3
  import { useCoreStore as y } from "@feedmepos/mf-common";
4
- import { a as I, g as r, A as b, S, b as D } from "./index-D6VxioBg.js";
5
- const A = {
4
+ import { a as I, g as r, A as b, S, b as D } from "./index-DsQJTvKe.js";
5
+ const $ = {
6
6
  async readSettings(e) {
7
7
  try {
8
8
  return r(await I(`marketing-v2/${e}/setting`).get(""));
@@ -38,13 +38,13 @@ const A = {
38
38
  }, h = w("mf-connect-business", () => {
39
39
  const e = i("v2"), t = i(!1), a = i([]), c = i([]);
40
40
  async function v() {
41
- const n = y().currentBusiness.value, s = await A.readSettings(n == null ? void 0 : n.id);
41
+ const n = y().currentBusiness.value, s = await $.readSettings(n == null ? void 0 : n.id);
42
42
  return t.value = s && "business" in s && s.premium == !0 || !1, e.value = (s == null ? void 0 : s.apiVersion) || "v1", t.value;
43
43
  }
44
- async function p() {
44
+ async function d() {
45
45
  return a.value = await l.read(), a.value;
46
46
  }
47
- async function d() {
47
+ async function p() {
48
48
  return c.value = await l.readDevices(), c.value;
49
49
  }
50
50
  function m(n) {
@@ -56,7 +56,10 @@ const A = {
56
56
  label: n.name,
57
57
  value: n._id
58
58
  }))
59
- ]), g = u(() => a.value.map((n) => ({ label: n.name, value: n._id })));
59
+ ]), g = u(() => a.value.map((n) => ({
60
+ label: `${n.code ? `${n.code} - ` : ""} ${n.name}`,
61
+ value: n._id
62
+ })));
60
63
  return {
61
64
  // state
62
65
  version: e,
@@ -65,8 +68,8 @@ const A = {
65
68
  locationDevices: c,
66
69
  // actions
67
70
  readPremium: v,
68
- readLocations: p,
69
- readLocationDevices: d,
71
+ readLocations: d,
72
+ readLocationDevices: p,
70
73
  locationById: m,
71
74
  // getters
72
75
  locationItems: f,
@@ -0,0 +1,219 @@
1
+ import { defineStore as w } from "pinia";
2
+ import { reactive as I, onMounted as b, ref as o } from "vue";
3
+ import { g as a, S as l, b as d } from "./index-DsQJTvKe.js";
4
+ const s = () => {
5
+ const e = l.getBusinessId();
6
+ if (!e) throw new Error("Invalid business ID");
7
+ return d(`businesses/${e}/campaigns`, {
8
+ // url: 'http://localhost:3000/portal/',
9
+ });
10
+ }, u = {
11
+ async readAllGrouped(e) {
12
+ const t = a(
13
+ await s().get("grouped", { params: e })
14
+ );
15
+ return {
16
+ meta: t.meta,
17
+ resources: t.resources
18
+ };
19
+ },
20
+ async readAll(e, t) {
21
+ const n = a(
22
+ await s().get("", {
23
+ params: { ...e, ...t }
24
+ })
25
+ );
26
+ return {
27
+ meta: n.meta,
28
+ resources: n.resources
29
+ };
30
+ },
31
+ async readById(e) {
32
+ return a(await s().get(`/${e}`));
33
+ },
34
+ async create(e) {
35
+ return a(await s().post("", e));
36
+ },
37
+ async update(e, t) {
38
+ return a(await s().put(e, t));
39
+ },
40
+ async delete(e) {
41
+ return a(await s().delete(e));
42
+ },
43
+ async readCollectionsByCampaignId(e, t) {
44
+ const n = a(
45
+ await s().get(`/${e}/collections`, {
46
+ params: t
47
+ })
48
+ );
49
+ return {
50
+ meta: n.meta,
51
+ resources: n.resources
52
+ };
53
+ },
54
+ async readTransactions(e) {
55
+ return a(
56
+ await s().get(
57
+ `/${e}/collections/transactions`
58
+ )
59
+ );
60
+ },
61
+ async createCollectionByCampaignId(e, t) {
62
+ return a(
63
+ await s().post(`/${e}/collections`, t)
64
+ );
65
+ },
66
+ async readGroups() {
67
+ return a(await s().get("/groups")) ?? [];
68
+ },
69
+ async readStats(e) {
70
+ return a(
71
+ await s().get("/stats", { params: e })
72
+ );
73
+ },
74
+ async createGroup(e) {
75
+ return a(await s().post("/groups", e));
76
+ },
77
+ async updateGroup(e, t) {
78
+ return a(
79
+ await s().put(`/groups/${e}`, t)
80
+ );
81
+ },
82
+ async deleteGroup(e) {
83
+ return a(await s().delete(`/groups/${e}`));
84
+ },
85
+ async sendCollection(e, t) {
86
+ return a(
87
+ await s().post(
88
+ `/${e}/collections/send`,
89
+ t
90
+ )
91
+ );
92
+ },
93
+ async sendStamp(e, t) {
94
+ return a(
95
+ await s().post(
96
+ `/${e}/collections/send-stamp`,
97
+ t
98
+ )
99
+ );
100
+ },
101
+ async syncAllPromotion() {
102
+ return a(await s().post("/promotion/sync"));
103
+ },
104
+ async readAllDeleted(e, t) {
105
+ const n = a(
106
+ await s().get("/bin", {
107
+ params: { ...e, ...t }
108
+ })
109
+ );
110
+ return {
111
+ meta: n.meta,
112
+ resources: n.resources
113
+ };
114
+ },
115
+ async restore(e) {
116
+ return a(
117
+ await s().post(`/${e}/restore`)
118
+ );
119
+ },
120
+ async getPromotionQueue() {
121
+ return a(await s().get("/promotion/queue"));
122
+ }
123
+ }, p = () => {
124
+ const e = l.getBusinessId();
125
+ if (!e) throw new Error("Invalid business ID");
126
+ return d(`businesses/${e}/campaigns`, {
127
+ noIdRequired: !0
128
+ });
129
+ }, f = {
130
+ async readAll() {
131
+ return a(await p().get("templates"));
132
+ },
133
+ async readById(e) {
134
+ return a(
135
+ await p().get(`templates/${e}`)
136
+ );
137
+ }
138
+ }, E = w("mf-connect-campaign", () => {
139
+ const e = I({
140
+ promotion: [],
141
+ voucher: [],
142
+ broadcast: [],
143
+ experience: [],
144
+ point: [],
145
+ credit: [],
146
+ token: [],
147
+ mission: [],
148
+ grab: [],
149
+ all: []
150
+ });
151
+ b(() => {
152
+ console.log("🔧 CampaignStore Installed");
153
+ });
154
+ const t = o([]), n = o([]), c = o([]);
155
+ async function m(h) {
156
+ const i = await u.readAll({
157
+ limit: 1e3,
158
+ skip: 0,
159
+ sortBy: "_id",
160
+ descending: !0
161
+ });
162
+ Object.keys(e).forEach((r) => {
163
+ e[r] = [];
164
+ }), e.all = i.resources.filter(
165
+ (r) => r.type !== "MEMBERSHIP"
166
+ );
167
+ for (const r of i.resources)
168
+ switch (r.type) {
169
+ case "PROMOTION":
170
+ e.promotion.push(r);
171
+ break;
172
+ case "VOUCHER":
173
+ e.voucher.push(r), c.value.push(r);
174
+ break;
175
+ case "BROADCAST":
176
+ ["SCHEDULE", "FEEDBACK"].includes(r.event.type) && e.broadcast.push(r);
177
+ break;
178
+ case "POINT":
179
+ e.experience.push(r);
180
+ break;
181
+ case "COIN":
182
+ e.point.push(r);
183
+ break;
184
+ case "CREDIT":
185
+ e.credit.push(r);
186
+ break;
187
+ case "GAME":
188
+ e.token.push(r);
189
+ break;
190
+ case "MISSION":
191
+ e.mission.push(r);
192
+ break;
193
+ case "GRAB":
194
+ e.grab.push(r);
195
+ break;
196
+ }
197
+ }
198
+ async function g() {
199
+ n.value = await u.readGroups();
200
+ }
201
+ async function y() {
202
+ t.value = await f.readAll();
203
+ }
204
+ return {
205
+ // State
206
+ campaigns: e,
207
+ templates: t,
208
+ groups: n,
209
+ voucher: c,
210
+ // Actions
211
+ read: m,
212
+ readGroups: g,
213
+ readTemplates: y
214
+ };
215
+ });
216
+ export {
217
+ u as c,
218
+ E as u
219
+ };
@@ -0,0 +1,254 @@
1
+ import { h as s } from "./moment-D7p2TMB-.js";
2
+ import "./index-9Wt89ReU.js";
3
+ import { e as f } from "./effect-fonU-1xO.js";
4
+ import { components as l } from "@feedmepos/ui-library";
5
+ import { i as h } from "./rule-builder-BZIx2IzX.js";
6
+ import { c as O } from "./rule-DEfU8NOO.js";
7
+ import { u as C } from "./business-TBSvPv65.js";
8
+ import { C as m } from "./campaign.fn-BsoUwQ5N.js";
9
+ import { c as g } from "./string-Gcy5IM_H.js";
10
+ import { i as d } from "./plugins-CxBcRdUi.js";
11
+ import { h as p } from "vue";
12
+ import { F as a } from "./campaign.enum-DRydaoy9.js";
13
+ const o = d.global.t;
14
+ function E() {
15
+ const e = d.global.locale;
16
+ return typeof e == "string" ? e : e.value;
17
+ }
18
+ function u(e) {
19
+ return new Intl.DateTimeFormat(E(), {
20
+ day: "2-digit",
21
+ month: "short",
22
+ year: "numeric"
23
+ }).format(new Date(e));
24
+ }
25
+ function c(e) {
26
+ return p(
27
+ "div",
28
+ {
29
+ class: `${e.chipClass} gap-4 h-[22px] inline-flex items-center justify-center min-w-min px-8 rounded-md`
30
+ },
31
+ [
32
+ p(l.FmIcon, { size: "sm", name: e.icon, outline: !0 }),
33
+ p("span", { class: "fm-typo-en-body-md-600" }, e.name)
34
+ ]
35
+ );
36
+ }
37
+ const P = {
38
+ [a.enum.CREDIT]: {
39
+ chipClass: "!text-fm-color-secondary-plum !bg-[#f2ebfe]",
40
+ icon: "local_activity",
41
+ get name() {
42
+ return o("connect.campaign.common.typeName.CREDIT");
43
+ },
44
+ chip() {
45
+ return c(this);
46
+ }
47
+ },
48
+ [a.enum.PROMOTION]: {
49
+ chipClass: "!text-fm-color-secondary-citrus !bg-fm-color-system-warning-100",
50
+ icon: "loyalty",
51
+ get name() {
52
+ return o("connect.campaign.common.typeName.PROMOTION");
53
+ },
54
+ chip() {
55
+ return c(this);
56
+ }
57
+ },
58
+ [a.enum.VOUCHER]: {
59
+ chipClass: "!text-fm-color-secondary-halite !bg-[#fff0f6]",
60
+ icon: "sell",
61
+ get name() {
62
+ return o("connect.campaign.common.typeName.VOUCHER");
63
+ },
64
+ chip() {
65
+ return c(this);
66
+ }
67
+ },
68
+ [a.enum.POINT]: {
69
+ chipClass: "!text-fm-color-secondary-cocoa !bg-[#fff9e6]",
70
+ icon: "award_star",
71
+ get name() {
72
+ return o("connect.campaign.common.typeName.POINT");
73
+ },
74
+ chip() {
75
+ return c(this);
76
+ }
77
+ },
78
+ [a.enum.BROADCAST]: {
79
+ chipClass: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
80
+ icon: "campaign",
81
+ get name() {
82
+ return o("connect.campaign.common.typeName.BROADCAST");
83
+ },
84
+ chip() {
85
+ return c(this);
86
+ }
87
+ },
88
+ [a.enum.GAME]: {
89
+ chipClass: "!text-fm-color-secondary-mint !bg-fm-color-system-success-100",
90
+ icon: "database",
91
+ get name() {
92
+ return o("connect.campaign.common.typeName.GAME");
93
+ },
94
+ chip() {
95
+ return c(this);
96
+ }
97
+ },
98
+ [a.enum.REWARD_POOL]: {
99
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
100
+ icon: "editor_choice",
101
+ get name() {
102
+ return o("connect.campaign.common.typeName.REWARD_POOL");
103
+ },
104
+ chip() {
105
+ return c(this);
106
+ }
107
+ },
108
+ [a.enum.COIN]: {
109
+ chipClass: "!text-fm-color-system-success-400 !bg-fm-color-system-success-100",
110
+ icon: "monetization_on",
111
+ get name() {
112
+ return o("connect.campaign.common.typeName.COIN");
113
+ },
114
+ chip() {
115
+ return c(this);
116
+ }
117
+ },
118
+ [a.enum.MEMBERSHIP]: {
119
+ chipClass: "",
120
+ icon: "",
121
+ get name() {
122
+ return o("connect.campaign.common.typeName.MEMBERSHIP");
123
+ },
124
+ chip() {
125
+ return c(this);
126
+ }
127
+ },
128
+ [a.enum.MISSION]: {
129
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
130
+ icon: "editor_choice",
131
+ get name() {
132
+ return o("connect.campaign.common.typeName.MISSION");
133
+ },
134
+ chip() {
135
+ return c(this);
136
+ }
137
+ },
138
+ [a.enum.GRAB]: {
139
+ chipClass: "!text-fm-color-secondary-tuna !bg-[#e3f4f9]",
140
+ icon: "editor_choice",
141
+ name: "Grab",
142
+ chip() {
143
+ return c(this);
144
+ }
145
+ }
146
+ };
147
+ function L(e) {
148
+ const t = b(e), r = {
149
+ active: "text-fm-color-typo-success bg-fm-color-system-success-100",
150
+ upcoming: "text-fm-color-typo-info bg-fm-color-system-info-100",
151
+ expired: "text-fm-color-typo-error bg-fm-color-system-error-100"
152
+ };
153
+ return e.type == "VOUCHER" ? p(l.FmChip, {
154
+ class: r[t],
155
+ label: g.title(o(`connect.campaign.common.status.${t}`)),
156
+ compact: !0
157
+ }) : p(l.FmChip, {
158
+ class: r[t],
159
+ label: g.title(o(`connect.campaign.common.status.${t}`)),
160
+ compact: !0
161
+ });
162
+ }
163
+ function w(e) {
164
+ const t = e.timeframeOptions;
165
+ if (!t || !t.start && !t.end)
166
+ return o("connect.campaign.common.always_active");
167
+ if (!t.start && t.end)
168
+ return o("connect.campaign.common.valid_until", {
169
+ date: u(t.end)
170
+ });
171
+ const r = u(t.start), n = t.end ? u(t.end) : o("connect.campaign.common.unlimited");
172
+ return `${r} -> ${n}`;
173
+ }
174
+ function B(e) {
175
+ const { campaign: t } = e;
176
+ function r(n) {
177
+ if (!n || !n.start && !n.end)
178
+ return "connect.campaign.common.always";
179
+ const i = n.start ? u(n.start) : "From campaign creation", y = n.end ? u(n.end) : "Never ends";
180
+ return `${i} - ${y}`;
181
+ }
182
+ return {
183
+ "connect.campaign.common.campaign_name": t.name,
184
+ "connect.campaign.common.campaign_period": r(
185
+ t.timeframeOptions
186
+ ),
187
+ get "connect.campaign.common.next_schedule_at"() {
188
+ if ((t == null ? void 0 : t.event.type) != "SCHEDULE" || !t.event.rule || !h(t.event.rule))
189
+ return;
190
+ const n = O(
191
+ t.event.rule.rules.g_schedule
192
+ );
193
+ return n ? s(n).format("ddd, DD MMM YYYY, hh:mmA") : void 0;
194
+ },
195
+ get "connect.campaign.common.discount_type"() {
196
+ if (t.type == "PROMOTION") return f(t.effect);
197
+ if ("configs" in e && e.configs.type == "VOUCHER")
198
+ return f(e.configs.extras.effect);
199
+ },
200
+ get "connect.campaign.common.available_at"() {
201
+ return t.targetLocation ? t.targetLocation.length > 0 ? t.targetLocation.map(
202
+ (n) => C().locationItems.find((i) => i.value == n).label
203
+ ).join(",") : "connect.campaign.common.no_location" : "connect.campaign.common.all_locations";
204
+ }
205
+ };
206
+ }
207
+ function b(e) {
208
+ return e.timeframeOptions && e.timeframeOptions.type == "timeframe" ? s().isBetween(
209
+ e.timeframeOptions.start ?? s().subtract(1, "d"),
210
+ e.timeframeOptions.end ?? s().add(1, "d")
211
+ ) ? "active" : s().isAfter(e.timeframeOptions.end) ? "expired" : "upcoming" : "active";
212
+ }
213
+ function F(e) {
214
+ var t, r;
215
+ switch (e.event.type) {
216
+ case "BILL_COMPLETED":
217
+ const n = `Spend to get ${m.formattedType(e.type)}`;
218
+ switch (e.type) {
219
+ case "POINT":
220
+ case "CREDIT":
221
+ case "COIN":
222
+ return e.earningOption.type == "FIXED" ? `Spend to get ${e.earningOption.amount} ${m.formattedType(e.type)}` : `Every ${e.earningOption.every} amount spent get ${e.earningOption.amount} ${m.formattedType(e.type)}`;
223
+ case "VOUCHER":
224
+ const i = (r = (t = e == null ? void 0 : e.pf_collectible) == null ? void 0 : t.extras) == null ? void 0 : r.effect;
225
+ return i ? `${n} - ${f(i)}` : n;
226
+ default:
227
+ return n;
228
+ }
229
+ case "FEEDBACK":
230
+ return `Give feedback to receive ${m.formattedType(e.type)}`;
231
+ case "SCHEDULE":
232
+ return `Receive ${m.formattedType(e.type)} on scheduled time`;
233
+ case "SIMPLE_CLAIM":
234
+ return "Simple claim voucher";
235
+ case "TIER_UPGRADED":
236
+ return `Receive ${m.formattedType(e.type)} when member tier upgraded`;
237
+ case "MEMBERSHIP_JOINED":
238
+ return `Receive ${m.formattedType(e.type)} when member joined`;
239
+ case "MAKING_ORDER":
240
+ return e.type !== "PROMOTION" ? void 0 : f(e.effect);
241
+ default:
242
+ throw new Error(
243
+ `Not implemented ${JSON.stringify({ cause: e.event.type })}`
244
+ );
245
+ }
246
+ }
247
+ export {
248
+ P as C,
249
+ b as a,
250
+ L as b,
251
+ F as c,
252
+ B as d,
253
+ w as g
254
+ };
@@ -0,0 +1,26 @@
1
+ import { z as E } from "./index-10x-WMiS.js";
2
+ const M = E.enum([
3
+ "VOUCHER",
4
+ "PROMOTION",
5
+ "POINT",
6
+ "CREDIT",
7
+ "MEMBERSHIP",
8
+ "BROADCAST",
9
+ "COIN",
10
+ "REWARD_POOL",
11
+ "GAME",
12
+ "MISSION",
13
+ "GRAB"
14
+ ]), O = E.enum([
15
+ "TIME_BASED_PROMOTION",
16
+ "GAME_PROMOTION",
17
+ "PRICE_CHANGE_PROMOTION"
18
+ ]), R = {
19
+ [O.enum.TIME_BASED_PROMOTION]: "7.7.4",
20
+ [O.enum.GAME_PROMOTION]: "7.7.4",
21
+ [O.enum.PRICE_CHANGE_PROMOTION]: "7.12.18"
22
+ };
23
+ export {
24
+ M as F,
25
+ R as f
26
+ };