@feedmepos/mf-connect 0.1.114-prod → 0.1.115-dev

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 (157) hide show
  1. package/README.md +66 -1
  2. package/dist/{App-DMYXrCc7.js → App-43mZfFAr.js} +700 -654
  3. package/dist/AuditLogs-BPpdm96t.js +2016 -0
  4. package/dist/{Bin-CHZolo56.js → Bin-CA7v180Y.js} +8 -8
  5. package/dist/Broadcast-qmdifF2Y.js +306 -0
  6. package/dist/{CampaignAnalytic-DgZvsUoF.js → CampaignAnalytic-xnrDxqaH.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C42uL_JO.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zjk-QdtX.js} +9 -9
  8. package/dist/{Card-wRFTJwJ9.js → Card-D8icsk7L.js} +25 -24
  9. package/dist/{Collections-9G-_9Etz.js → Collections--THcD-E_.js} +197 -185
  10. package/dist/{Credit-Bl7IDMCU.js → Credit-JrbtVMBp.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BVLJeofG.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DrwKtnE5.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DgdAlHU7.js +4442 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Q1f6EQW3.js → EffectSheet.vue_vue_type_style_index_0_lang-hVgqWdD0.js} +32 -32
  14. package/dist/{Experience-Cs2iViLv.js → Experience-CFeRqBoj.js} +32 -31
  15. package/dist/{FileSaver.min-B3Levdbu.js → FileSaver.min-CCXIBm58.js} +1 -1
  16. package/dist/{Game-oXURgzan.js → Game-CPxq6Ex3.js} +19 -18
  17. package/dist/{GiftCardSetup-C2Wu-dRl.js → GiftCardSetup-D0esVZDp.js} +75 -75
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Da2e89Um.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-CJ1-vL-K.js} +7 -7
  19. package/dist/{Goals-B_xEM7gf.js → Goals-DaKI6uXt.js} +4 -4
  20. package/dist/Grab-BWzdN_cd.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BRJR1heE.js → ImageInput.vue_vue_type_script_setup_true_lang-BOnL0GxM.js} +1 -1
  22. package/dist/{Index-kuT6W6R_.js → Index-2kENoaZm.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-7JqHfSk-.js → LocationPicker.vue_vue_type_script_setup_true_lang-BtWnJKU_.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CI_4S7tW.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CX_Sspu5.js} +1 -1
  25. package/dist/{LoyaltyDashboard-CqxHdZcm.js → LoyaltyDashboard-CB93Fz8u.js} +15 -15
  26. package/dist/MainLayout-DwnjGXh6.js +4 -0
  27. package/dist/{MainLayout-CAERFIms.js → MainLayout.vue_vue_type_script_setup_true_lang-Du8fw5v_.js} +5 -4
  28. package/dist/Marketing-DCco__2F.js +273 -0
  29. package/dist/MarketingMaterialEdit-BbgFtrYP.js +1037 -0
  30. package/dist/{Member-B8VZEn9t.js → Member-B--nYyr0.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-B31lVLKh.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-BBlzO7Db.js} +43 -50
  32. package/dist/{MemberImportHistory-D9tgHnTS.js → MemberImportHistory-D52Y4RTC.js} +7 -7
  33. package/dist/{MemberList-Hw_xQY1i.js → MemberList-13Owa1fj.js} +103 -105
  34. package/dist/{MemberTransactions-DiBO4plw.js → MemberTransactions-CpXEWNbq.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CbFt5X89.js → MessageInput.vue_vue_type_script_setup_true_lang-DlELjFM0.js} +4228 -4176
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-BE_-Ed4z.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-C_y0rM8c.js} +1 -1
  37. package/dist/{Mission-DpYei3aF.js → Mission-Ci-UzXSu.js} +22 -21
  38. package/dist/{Overview-CARquJCS.js → Overview-CKxSfAGF.js} +145 -144
  39. package/dist/{Overview-BFQMmyT6.js → Overview-CXen9Ram.js} +23 -22
  40. package/dist/{Point-Dd2ykwNv.js → Point-CR3YOaag.js} +22 -21
  41. package/dist/{Promotion-DXl-W7np.js → Promotion-tw3J4ul-.js} +137 -131
  42. package/dist/{Queue-Cd3N-4iB.js → Queue-BZGA5ZXt.js} +47 -46
  43. package/dist/{Record-C3HdDsh5.js → Record-BTevVXnT.js} +9 -9
  44. package/dist/{Review-Bif3Ub9Z.js → Review-BU7c8ZF0.js} +2 -2
  45. package/dist/ReviewFacebookCallback-BnMF6Arh.js +225 -0
  46. package/dist/{ReviewGoogleCallback-i-RNLlLm.js → ReviewGoogleCallback-xpdPHSdg.js} +5 -5
  47. package/dist/{Reward-DHxzrR_7.js → Reward-jlA_7cxz.js} +29 -29
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DcrFlcSo.js → RewardGroup.vue_vue_type_script_setup_true_lang-D3z_n42G.js} +16 -15
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CsHxqH9h.js +1923 -0
  50. package/dist/{Segment-Cjpxordk.js → Segment-C1Bwm--Q.js} +290 -291
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-6u21xBu6.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-B6apgWTM.js} +31 -30
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BOXVzfer.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-B7m2F9UV.js} +4 -4
  53. package/dist/Setting-CDM4RhLW.js +574 -0
  54. package/dist/{SettingAdvertisements-aog5fz32.js → SettingAdvertisements-4XEAJzlL.js} +12 -12
  55. package/dist/Settings-D-0tvZRr.js +286 -0
  56. package/dist/{Store-Bq3kw1l2.js → Store-C56dXtc4.js} +31 -30
  57. package/dist/{StoreRewards-ZGXKEM09.js → StoreRewards-DQ1Q6WS6.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-LLD91Rz6.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Bvy4NJMd.js +7007 -0
  60. package/dist/{Tier-CfgpEHY7.js → Tier-D4CPZqw7.js} +2576 -687
  61. package/dist/{Title-B2itYWeD.js → Title-DCbwhUic.js} +94 -92
  62. package/dist/{Transaction-hJ5ygIcf.js → Transaction-C5LrasXr.js} +2 -2
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-8BgGlpTh.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cl9b4mrK.js} +26 -26
  64. package/dist/{Voucher-TG47pGR3.js → Voucher-rrVbNZKR.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CjuXCTxg.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BIq227nz.js} +16 -16
  66. package/dist/WhatsappAccount-oJDo5zTr.js +159 -0
  67. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-aCQCYFYq.js +39 -0
  68. package/dist/WhatsappBot-Cl64wG_F.js +876 -0
  69. package/dist/WhatsappBotLogs-D3uT4EiB.js +372 -0
  70. package/dist/WhatsappBotSettings-Cs1lLxh-.js +705 -0
  71. package/dist/WhatsappLayout-C639d2HP.js +21 -0
  72. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DpPxWp2x.js +253 -0
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BRs-gbP0.js → ZodTextField.vue_vue_type_script_setup_true_lang-C39_95SZ.js} +2 -2
  74. package/dist/{app-tPHYkJcQ.js → app-CgimGODl.js} +10610 -8223
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-BHDVnGj2.js → base.export-D2P6HFvo.js} +2 -2
  77. package/dist/browser-BSAOEeIM.js +1478 -0
  78. package/dist/{business-HLyWfrXY.js → business-Bu5TqSA0.js} +1 -1
  79. package/dist/campaign-BFIXSgdJ.js +400 -0
  80. package/dist/{campaign-5zFgUNLw.js → campaign-zJxttSIk.js} +31 -25
  81. package/dist/{campaign.enum-BOkDnP2g.js → campaign.enum-Dx-Zo68Q.js} +3 -2
  82. package/dist/{campaign.fn-BIAoVtJj.js → campaign.fn-gvjlcEfe.js} +78 -78
  83. package/dist/{collectible.enum-BbZSAfys.js → collectible.enum-Liy2wH3s.js} +1 -1
  84. package/dist/{collection.fn-DPSgBHnz.js → collection.fn-DOm0HsSh.js} +2 -2
  85. package/dist/{currency-BVrMqU6-.js → currency-BpbQvbm8.js} +1 -1
  86. package/dist/duplicateCampaign-CvsvjRE9.js +51 -0
  87. package/dist/{effect-BBifVx76.js → effect-D-GtNB3n.js} +1 -1
  88. package/dist/{email-addresses-9C7xHTNv.js → email-addresses-BKMoAtMi.js} +2 -2
  89. package/dist/feature-flag-BJ_eyKsq.js +868 -0
  90. package/dist/feature-flag-Bo-k5sIG.js +50 -0
  91. package/dist/google-BQK68wbe.js +5 -0
  92. package/dist/{helper-C08jyQNK.js → helper-CkfjBgMM.js} +1 -1
  93. package/dist/{index-Dhyqf1s8.js → index-B6kU3PkV.js} +2700 -2613
  94. package/dist/{index-BgwZGunW.js → index-BAtUrtqM.js} +19 -6
  95. package/dist/index-BKsxIwbi.js +14571 -0
  96. package/dist/{index-DZ-q5O-V.js → index-BdEXUNoG.js} +4 -4
  97. package/dist/{index-hIUtD2eY.js → index-Bhl5IRXy.js} +11 -10
  98. package/dist/{index-kCbkOivd.js → index-BpTIulTX.js} +1 -1
  99. package/dist/index-C-iwb2Ln.js +109 -0
  100. package/dist/{index-Ciw2TZxV.js → index-CCEXSPxk.js} +8 -7
  101. package/dist/{index-CUle4c2B.js → index-CIej31pF.js} +4 -3
  102. package/dist/{index-ihw-WFCa.js → index-CQ8XFbBk.js} +2 -2
  103. package/dist/index-C_H8jFYf.js +2743 -0
  104. package/dist/{index-CEe1kJ0T.js → index-CfQuYqXn.js} +1 -1
  105. package/dist/{index-C_WoO58V.js → index-CuREApMc.js} +8 -7
  106. package/dist/{index-NJSI4wX4.js → index-D0JK99Ko.js} +693 -231
  107. package/dist/{index-DnRMNmUA.js → index-DKxN1mMS.js} +396 -232
  108. package/dist/index-DQ8JJhxs.js +74 -0
  109. package/dist/{index-D24Q28cH.js → index-DUAZOMVJ.js} +1 -1
  110. package/dist/{index-Yo0tP8KJ.js → index-DqGs6RJG.js} +683 -581
  111. package/dist/{index-B_334Y_i.js → index-DwU3fsLW.js} +29 -15
  112. package/dist/{index-hSRM1smQ.js → index-LygS9WsG.js} +8028 -10767
  113. package/dist/{index-96ZiAKj_.js → index-feCrYhi6.js} +1 -1
  114. package/dist/{index-Dk-jg0wN.js → index-zTvr2GR4.js} +2 -2
  115. package/dist/{index.esm2017-hN99SQTb.js → index.esm2017-DZi9IQPS.js} +209 -209
  116. package/dist/{loading-CVuY4vQ4.js → loading-Brid2wnu.js} +1 -1
  117. package/dist/{lodash-GFl9_FMH.js → lodash-C1epw3Kv.js} +1 -1
  118. package/dist/{member-import-CshTzabx.js → member-import-DAIxTIiu.js} +6 -5
  119. package/dist/{membership-S0KES3Ex.js → membership-BZmljFhF.js} +3 -3
  120. package/dist/{money-JxdX8ru4.js → money-cLcyGcSZ.js} +1 -1
  121. package/dist/{number-BRLwa-mB.js → number-C2jPLJr2.js} +1 -1
  122. package/dist/objectid-C-wocWKI.js +145 -0
  123. package/dist/{onboarding-BSKYeyP7.js → onboarding-oRfy_g05.js} +25 -25
  124. package/dist/{onboardingSetup-BqT52VRm.js → onboardingSetup-BLD6m8HY.js} +2 -2
  125. package/dist/{plugins-BR_wmMFJ.js → plugins-CUsr9vB0.js} +3 -3
  126. package/dist/{MarketingMaterialEdit-BvIthCHG.js → remy-icon-BhUGu2NI.js} +2 -1031
  127. package/dist/{reward-CpCGg_W2.js → reward-UOT03odb.js} +1 -1
  128. package/dist/{rule-Dbg9e8MO.js → rule-BgJnPjkI.js} +572 -492
  129. package/dist/style.css +1 -1
  130. package/dist/template-BZyFhr73.js +188 -0
  131. package/dist/{timezone-CDVa-xPr.js → timezone-BXA4wq7Y.js} +1 -1
  132. package/dist/{transaction.fn-DrTBoF9T.js → transaction.fn-CQ4fpRt3.js} +2 -2
  133. package/dist/{trigger-wqGwQfB2.js → trigger-DXJCGT0q.js} +8 -8
  134. package/dist/useMarketingMaterialActions-B-Wib5ga.js +125 -0
  135. package/dist/{usePagination-fODgpZZ8.js → usePagination-Pp4okWr8.js} +1 -1
  136. package/dist/{user-DaLUK1dk.js → user-B3gXcAIy.js} +1 -1
  137. package/dist/vue-i18n-DWGiC_vs.js +2365 -0
  138. package/dist/{xlsx-Bl4_Dtrq.js → xlsx-CCaDUTgW.js} +651 -651
  139. package/dist/{zod-CAzWyVqj.js → zod-CPwjOxvW.js} +1 -1
  140. package/package.json +12 -3
  141. package/dist/Broadcast-ByWvxVhW.js +0 -271
  142. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DGpQfV5T.js +0 -2431
  143. package/dist/Marketing-KgcwGErU.js +0 -236
  144. package/dist/ReviewFacebookCallback-mJF54-9l.js +0 -238
  145. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-39f3I4BB.js +0 -1883
  146. package/dist/Setting-Dl9MelHz.js +0 -2036
  147. package/dist/Settings-DvCCClIP.js +0 -179
  148. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DscLAF0p.js +0 -1264
  149. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-l_v4FHO0.js +0 -142
  150. package/dist/campaign-awCRccgX.js +0 -228
  151. package/dist/google-C3S8u0mT.js +0 -4
  152. package/dist/index-CoNJdOx7.js +0 -51
  153. package/dist/objectid-CEHN25HN.js +0 -145
  154. package/dist/rule-builder-BEIjxsE0.js +0 -102
  155. package/dist/template-CS-lExgI.js +0 -236
  156. package/dist/useMarketingMaterialActions-DC0gIyIZ.js +0 -96
  157. package/dist/vue-i18n-Dx-KXojZ.js +0 -2365
@@ -1,102 +0,0 @@
1
- import { l as i } from "./index-Dhyqf1s8.js";
2
- function a(o, t) {
3
- let r = "", s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
4
- const e = s.length;
5
- for (let n = 0; n < o; n++)
6
- r += s.charAt(Math.floor(Math.random() * e));
7
- return r;
8
- }
9
- function u(o) {
10
- return !o.property && "rules" in o;
11
- }
12
- function d(o) {
13
- return "property" in o && !!o.property;
14
- }
15
- class c {
16
- static scaffoldGroup(t) {
17
- return {
18
- name: t ?? `g_${a(4)}`,
19
- rules: {},
20
- logic: ""
21
- };
22
- }
23
- static scaffoldEntry(t) {
24
- return {
25
- name: `r_${a(4)}`,
26
- property: t ?? "",
27
- conditions: {},
28
- negated: !1
29
- };
30
- }
31
- static constructEntry(t, r, s, e) {
32
- return {
33
- name: e ?? `e_${a(4)}`,
34
- property: t,
35
- conditions: {
36
- [r]: s
37
- },
38
- negated: !1
39
- };
40
- }
41
- static getLogic(t) {
42
- return (t.logic ?? "").includes("||") ? "||" : "&&";
43
- }
44
- static constructLogic(t, r) {
45
- const s = r ?? c.getLogic(t);
46
- return Object.entries(t.rules).map(([e, n]) => u(n) ? e : `${n.negated ? "!" : ""}${e}`).join(` ${s} `);
47
- }
48
- static setRuleToGroup(t, r, s) {
49
- let e = i.cloneDeep(t);
50
- return Object.keys(e.rules).length === 0 && (e = c.scaffoldGroup(e.name)), Array.isArray(r) ? r.forEach((n) => {
51
- e.rules[n.name] = n;
52
- }) : e.rules[r.name] = r, e.logic = c.constructLogic(e, s), e;
53
- }
54
- static removeEntry(t, r, s) {
55
- const e = i.cloneDeep(t);
56
- return delete e.rules[r], e.logic = c.constructLogic(e, s), e;
57
- }
58
- static constructRule(t) {
59
- switch (t.type) {
60
- case "timeframe": {
61
- const r = t.property, s = c.scaffoldGroup("timeframe"), e = [];
62
- return (t.start || t.end) && e.push(
63
- c.constructEntry(r, "_isBetween", {
64
- start: t.start || void 0,
65
- end: t.end || void 0
66
- })
67
- ), c.setRuleToGroup(s, e, "&&");
68
- }
69
- default:
70
- throw Error("invalid config type");
71
- }
72
- }
73
- static getRules(t) {
74
- return t && "rules" in t ? Object.values(t.rules) : [];
75
- }
76
- static simplify(t) {
77
- const [r] = Object.entries(t.conditions);
78
- return r[0], {
79
- property: t.property,
80
- operator: r[0],
81
- equator: r[1]
82
- };
83
- }
84
- static isRuleExceed(t, r) {
85
- const e = Object.keys(t.rules).length + (Array.isArray(r) ? r.length : 1);
86
- if (e > 10)
87
- throw new l(10, e);
88
- return !0;
89
- }
90
- }
91
- class l extends Error {
92
- constructor(t, r) {
93
- super(
94
- `Maximum of ${t} rules allowed per group. Attempted to add ${r} rules.`
95
- ), this.name = "MaxRulesExceededError";
96
- }
97
- }
98
- export {
99
- c as R,
100
- d as a,
101
- u as i
102
- };
@@ -1,236 +0,0 @@
1
- import { p as B, i as w } from "./plugins-BR_wmMFJ.js";
2
- import { _ as O } from "./lodash-GFl9_FMH.js";
3
- import { defineComponent as I, openBlock as d, createBlock as b, resolveDynamicComponent as $, unref as o, ref as z, computed as M, onMounted as Y, resolveComponent as f, withCtx as _, createElementVNode as s, createElementBlock as D, createVNode as r, normalizeClass as T, createTextVNode as F, toDisplayString as g, Fragment as R, renderList as L, createCommentVNode as j } from "vue";
4
- import { u as W } from "./campaign-5zFgUNLw.js";
5
- import { useDialog as q } from "@feedmepos/ui-library";
6
- import { F as G } from "./index-NJSI4wX4.js";
7
- import { C as H } from "./campaign-awCRccgX.js";
8
- import { J } from "./JsonViewer-v8_C7l5N.js";
9
- import { u as U } from "./vue-i18n-Dx-KXojZ.js";
10
- import { u as K } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-DGpQfV5T.js";
11
- function Se(e) {
12
- return B.confirm(
13
- w.global.t("connect.common.duplicate.confirmMessage", { name: e }),
14
- w.global.t("connect.common.duplicate.title"),
15
- w.global.t("connect.common.duplicate.proceed")
16
- );
17
- }
18
- const Q = ["LOYALTY", "NO_REWARD"], X = {
19
- GAME: [(e) => {
20
- var t;
21
- return (t = e == null ? void 0 : e.game) == null ? void 0 : t.rewards;
22
- }],
23
- MISSION: [
24
- (e) => e == null ? void 0 : e.rewards,
25
- (e) => {
26
- var t;
27
- return (t = e == null ? void 0 : e.mission) == null ? void 0 : t.rewards;
28
- }
29
- ],
30
- REWARD_POOL: [(e) => e == null ? void 0 : e.rewards]
31
- };
32
- function Z(e, t) {
33
- e && e.forEach((n) => {
34
- t.includes(n.type ?? "") || (n.collectible = null, n.type === "VOUCHER" && n.collectibleConfig && (n.collectibleConfig._id = void 0));
35
- });
36
- }
37
- function ee(e) {
38
- e._id = void 0;
39
- }
40
- function te(e, t) {
41
- e.campaign && (e.campaign._id = void 0, e.campaign.currentReceive = void 0, e.campaign.notifyCampaign = void 0, t || (e.campaign.collectible = void 0));
42
- }
43
- function oe(e, t) {
44
- e.configs && (e.configs.currentReceive = void 0, t || (e.configs._id = void 0));
45
- }
46
- function ne(e) {
47
- const t = X[(e == null ? void 0 : e.type) ?? ""];
48
- t && t.forEach((n) => {
49
- Z(n(e), Q);
50
- });
51
- }
52
- function Fe(e, t = {}) {
53
- const n = O.cloneDeep(e), { keepCollectible: c = !1 } = t, p = n.campaign;
54
- return ee(n), te(n, c), oe(n, c), ne(p), n;
55
- }
56
- const le = /* @__PURE__ */ I({
57
- __name: "CampaignChip",
58
- props: {
59
- type: { type: String, required: !0 }
60
- },
61
- setup(e) {
62
- const n = H[e.type];
63
- return (c, p) => (d(), b($(o(n).chip())));
64
- }
65
- }), ie = { class: "flex flex-nowrap gap-x-2 grow h-full" }, se = {
66
- key: 0,
67
- class: "p-8 w-1/4"
68
- }, ce = { class: "flex flex-col grow p-24" }, ae = { class: "space-y-4" }, re = { class: "fm-typo-en-title-sm-800" }, pe = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, me = { class: "grow pb-16 pr-16 pt-6 w-full max-h-[400px] overflow-y-auto" }, de = { class: "gap-24 grid grid-cols-1 lg:grid-cols-2" }, ue = { class: "gap-4 h-[22px] inline-flex items-center justify-center min-w-min rounded-md" }, fe = { class: "fm-typo-en-title-sm-800" }, _e = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ge = { class: "flex gap-4 items-end justify-end py-8" }, ye = /* @__PURE__ */ I({
69
- __name: "TemplateDialog",
70
- props: {
71
- campaignType: {
72
- type: String,
73
- default: () => {
74
- }
75
- },
76
- onOk: {
77
- type: Function,
78
- required: !0
79
- }
80
- },
81
- setup(e) {
82
- const { t } = U(), { getLocaleText: n } = K(), c = q(), p = W(), m = e, i = z({
83
- intention: null,
84
- template: null
85
- }), k = M(() => {
86
- const u = (p.templates ?? []).filter(
87
- () => !0
88
- //t.intention && t.intention.length > 0
89
- );
90
- return m.campaignType ? u.filter(
91
- (a) => {
92
- var C, y;
93
- return ((y = (C = a.defaultValue) == null ? void 0 : C.campaign) == null ? void 0 : y.type) === m.campaignType;
94
- }
95
- ) : i.value.intention === null ? O.sampleSize(u, 7) : u.filter(
96
- (a) => a.intention.includes(i.value.intention)
97
- );
98
- });
99
- Y(async () => {
100
- await p.readTemplates();
101
- });
102
- function A() {
103
- m.onOk(void 0), c.close();
104
- }
105
- function N() {
106
- const u = i.value.template;
107
- m.onOk(p.templates.find((a) => a._id === u)), c.close();
108
- }
109
- return (u, a) => {
110
- const C = f("FmChip"), y = f("FmListItem"), P = f("FmList"), E = f("FmCard"), x = f("FmButton"), V = f("FmSpacer");
111
- return d(), b(E, { class: "h-[534px] max-w-6xl" }, {
112
- default: _(() => [
113
- s("div", ie, [
114
- m.campaignType ? j("", !0) : (d(), D("div", se, [
115
- r(P, null, {
116
- default: _(() => [
117
- r(y, {
118
- class: T([{
119
- "bg-fm-color-system-warning-100": o(i).intention === null
120
- }, "rounded-sm"]),
121
- onClick: a[0] || (a[0] = (l) => {
122
- o(i).intention = null, o(i).template = null;
123
- })
124
- }, {
125
- append: _(() => [
126
- r(C, {
127
- label: o(t)("connect.templateDialog.hot"),
128
- variant: "critical"
129
- }, null, 8, ["label"])
130
- ]),
131
- default: _(() => [
132
- F(g(o(t)("connect.templateDialog.mostPopular")) + " ", 1)
133
- ]),
134
- _: 1
135
- }, 8, ["class"]),
136
- (d(!0), D(R, null, L(o(G).options, (l, h) => (d(), b(y, {
137
- key: h,
138
- class: T(["rounded-sm", {
139
- "bg-fm-color-system-warning-100": o(i).intention === l
140
- }]),
141
- style: { padding: "8px 16px" },
142
- onClick: (v) => {
143
- o(i).intention = l, o(i).template = null;
144
- }
145
- }, {
146
- default: _(() => [
147
- F(g(o(t)(`connect.templateDialog.intention.${l}`)), 1)
148
- ]),
149
- _: 2
150
- }, 1032, ["class", "onClick"]))), 128))
151
- ]),
152
- _: 1
153
- })
154
- ])),
155
- s("div", ce, [
156
- s("div", ae, [
157
- s("div", re, g(m.campaignType ? o(t)(`connect.templateDialog.campaignType.${m.campaignType}`) : o(t)("connect.templateDialog.templateList")), 1),
158
- s("div", pe, g(o(t)("connect.templateDialog.subtitle")), 1)
159
- ]),
160
- s("div", me, [
161
- r(J, { json: o(k) }, null, 8, ["json"]),
162
- s("div", de, [
163
- (d(!0), D(R, null, L(o(k), (l, h) => (d(), b(E, {
164
- key: h,
165
- variant: "outlined",
166
- class: T(["box-border cursor-pointer h-full p-16 scroll-p-4 space-y-8", {
167
- "bg-fm-color-system-warning-100 border-fm-color-primary border-2": o(i).template === l._id.toString()
168
- }]),
169
- onClick: (v) => o(i).template = l._id.toString()
170
- }, {
171
- default: _(() => {
172
- var v, S;
173
- return [
174
- s("div", ue, [
175
- r(le, {
176
- type: (S = (v = l.defaultValue) == null ? void 0 : v.campaign) == null ? void 0 : S.type
177
- }, null, 8, ["type"])
178
- ]),
179
- s("div", fe, g(o(n)(l.name_locale, l.name)), 1),
180
- s("p", _e, g(o(n)(l.description_locale, l.description ?? "")), 1)
181
- ];
182
- }),
183
- _: 2
184
- }, 1032, ["class", "onClick"]))), 128))
185
- ])
186
- ]),
187
- s("div", ge, [
188
- r(x, {
189
- class: "sm:w-full xs:w-full",
190
- variant: "plain",
191
- label: o(t)("connect.templateDialog.customCampaign"),
192
- size: "md",
193
- onClick: A
194
- }, null, 8, ["label"]),
195
- r(V, { class: "sm:hidden xs:hidden" }),
196
- r(x, {
197
- class: "sm:w-full xs:w-full",
198
- variant: "tertiary",
199
- label: o(t)("connect.templateDialog.cancel"),
200
- size: "md",
201
- onClick: a[1] || (a[1] = (l) => o(c).close())
202
- }, null, 8, ["label"]),
203
- r(x, {
204
- class: "sm:w-full xs:w-full",
205
- variant: "primary",
206
- label: o(t)("connect.templateDialog.start"),
207
- size: "md",
208
- disabled: !o(i).template,
209
- onClick: N
210
- }, null, 8, ["label", "disabled"])
211
- ])
212
- ])
213
- ])
214
- ]),
215
- _: 1
216
- });
217
- };
218
- }
219
- }), Re = (e, t) => ({
220
- open: async (n) => {
221
- t.open({
222
- title: "",
223
- dialogComponent: ye,
224
- dialogComponentProps: {
225
- campaignType: e,
226
- onOk: async (c) => (console.debug(c, "selected template"), await n(c))
227
- },
228
- overlay: !0
229
- });
230
- }
231
- });
232
- export {
233
- Se as c,
234
- Fe as p,
235
- Re as u
236
- };
@@ -1,96 +0,0 @@
1
- import { S as o, g as c, b } from "./index-Ciw2TZxV.js";
2
- import { u as w } from "./vue-i18n-Dx-KXojZ.js";
3
- import { useSnackbar as h } from "@feedmepos/ui-library";
4
- import { c as k } from "./plugins-BR_wmMFJ.js";
5
- const l = (e) => b(`businesses/${e}/marketing-materials`), D = {
6
- async createMarketingMaterial(e) {
7
- const a = o.getBusinessId();
8
- if (!a) throw new Error("Invalid business ID");
9
- return c(
10
- await l(a).post("", e)
11
- );
12
- },
13
- async getMarketingMaterial(e) {
14
- const a = o.getBusinessId();
15
- if (!a) throw new Error("Invalid business ID");
16
- return c(
17
- await l(a).get(`/${e}`)
18
- );
19
- },
20
- async listMarketingMaterials(e = null, a = 20) {
21
- const s = o.getBusinessId();
22
- if (!s) throw new Error("Invalid business ID");
23
- return c(
24
- await l(s).get("", {
25
- params: { ...e ? { cursor: e } : {}, limit: a }
26
- })
27
- );
28
- },
29
- async updateMarketingMaterial(e, a) {
30
- const s = o.getBusinessId();
31
- if (!s) throw new Error("Invalid business ID");
32
- return c(
33
- await l(s).patch(`/${e}`, a)
34
- );
35
- }
36
- };
37
- function E() {
38
- const { t: e } = w(), a = h();
39
- async function s(n) {
40
- if (!(n != null && n.imageUrl)) return;
41
- const { headline: i, caption: g, imageUrl: r } = n;
42
- if (!navigator.share) {
43
- a.open({
44
- message: e("connect.marketing.actions.webShareNotSupported"),
45
- type: "error"
46
- });
47
- return;
48
- }
49
- try {
50
- const t = {
51
- title: i ?? void 0,
52
- text: g ?? void 0
53
- };
54
- if (navigator.canShare)
55
- try {
56
- const d = await (await fetch(r, { mode: "cors", cache: "no-store" })).blob(), f = [new File([d], "marketing-material.jpg", {
57
- type: d.type || "image/jpeg"
58
- })];
59
- navigator.canShare({ files: f }) ? t.files = f : t.url = r;
60
- } catch (u) {
61
- console.error("Failed to fetch image for sharing:", u), t.url = r;
62
- }
63
- else
64
- t.url = r;
65
- await navigator.share(t);
66
- } catch (t) {
67
- t.name !== "AbortError" && a.open({
68
- message: e("connect.marketing.actions.failedToShare", { message: t.message }),
69
- type: "error"
70
- });
71
- }
72
- }
73
- async function p(n) {
74
- if (n)
75
- try {
76
- const g = await (await fetch(n, { mode: "cors", cache: "no-store" })).blob(), r = URL.createObjectURL(g), t = document.createElement("a");
77
- t.href = r, t.download = "marketing-material", t.click(), URL.revokeObjectURL(r);
78
- } catch (i) {
79
- console.error("Failed to download image:", i), window.open(n, "_blank");
80
- }
81
- }
82
- async function m(n) {
83
- n && await k(n, {
84
- successMessage: e("connect.marketing.actions.imageLinkCopied")
85
- });
86
- }
87
- return {
88
- shareMaterial: s,
89
- downloadMaterialImage: p,
90
- copyMaterialLink: m
91
- };
92
- }
93
- export {
94
- D as m,
95
- E as u
96
- };