@feedmepos/mf-connect 0.1.122-prod → 0.1.123-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 (148) hide show
  1. package/dist/{App-BKnL7b6M.js → App-BHqbxq_5.js} +502 -493
  2. package/dist/AuditLogs-FB5BGl_F.js +2016 -0
  3. package/dist/{Bin-BqqQF1h_.js → Bin-Bc5C_yvE.js} +8 -8
  4. package/dist/{Broadcast-U5rJmhdd.js → Broadcast-CEJc8daU.js} +22 -21
  5. package/dist/{CampaignAnalytic-ClwXxxzE.js → CampaignAnalytic-wUhISw-Z.js} +7 -7
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DyeoWFcd.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BlLw8Tb5.js} +8 -9
  7. package/dist/{Card-DKikDYES.js → Card-uviAfIRX.js} +22 -22
  8. package/dist/{Collections-CD0xjFqI.js → Collections-COA2uZGw.js} +197 -185
  9. package/dist/{Credit-BWcvFlb2.js → Credit-Dh4GleW1.js} +21 -20
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-B2RizWP8.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DM-uzm4_.js} +1 -1
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-9fDPd8x9.js +4439 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Hr10pgqD.js → EffectSheet.vue_vue_type_style_index_0_lang-DorkQcT5.js} +16 -16
  13. package/dist/{Experience-dqXYj1Fv.js → Experience-oOmPXIh-.js} +32 -31
  14. package/dist/{FileSaver.min-DdJMn696.js → FileSaver.min-_q7Dx4wn.js} +1 -1
  15. package/dist/{Game-BGQXqzck.js → Game-BTfpDAXf.js} +19 -18
  16. package/dist/{GiftCardSetup-C3MR25fp.js → GiftCardSetup-FhOKl3OA.js} +31 -31
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-9dL1kVPG.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-BWP_vdpd.js} +7 -7
  18. package/dist/{Goals-DA2jHEZa.js → Goals-A5qHITPJ.js} +4 -4
  19. package/dist/Grab-D7BOmVRB.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-_rlsNocb.js → ImageInput.vue_vue_type_script_setup_true_lang-CqkwVS2r.js} +1 -1
  21. package/dist/{Index-WOvryalE.js → Index-CuSQjKgG.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-Bu1DjV9M.js → LocationPicker.vue_vue_type_script_setup_true_lang-D6bURd7V.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DiLtSIXt.js → LottieAnimation.vue_vue_type_script_setup_true_lang-C3Nt5VLS.js} +1 -1
  24. package/dist/{LoyaltyDashboard-BKN2vBqc.js → LoyaltyDashboard-B66W2agI.js} +15 -15
  25. package/dist/{MainLayout-DizL-dxl.js → MainLayout-CguQ_XOG.js} +1 -1
  26. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-El0YeLnE.js → MainLayout.vue_vue_type_script_setup_true_lang-ByHEOOgE.js} +3 -3
  27. package/dist/{Marketing-B77EoiCf.js → Marketing-DsRvHFfJ.js} +4 -4
  28. package/dist/{MarketingMaterialEdit-C_qFEur7.js → MarketingMaterialEdit-DLqupGle.js} +214 -211
  29. package/dist/{Member-TYDrU3Tk.js → Member-BlRWRmf7.js} +7 -7
  30. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-BuzMeXR9.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-GZ5gUgb8.js} +39 -47
  31. package/dist/{MemberImportHistory-l7dVJdEH.js → MemberImportHistory-DxpuDRx4.js} +7 -7
  32. package/dist/{MemberList-DiuyeJx_.js → MemberList-DnKQ0nCm.js} +103 -105
  33. package/dist/{MemberTransactions-BJ27Gd5P.js → MemberTransactions-bs3canOe.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-so7LWtlv.js → MessageInput.vue_vue_type_script_setup_true_lang-DRU6aeH8.js} +12 -12
  35. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DgE7HPsT.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-BYH3qzyb.js} +1 -1
  36. package/dist/{Mission-C63hh8Ra.js → Mission-DHXh7T93.js} +22 -21
  37. package/dist/{Overview-DP-4Kpuj.js → Overview-CVQBgphM.js} +145 -144
  38. package/dist/{Overview-CVdvQK6q.js → Overview-UAF9JSio.js} +20 -20
  39. package/dist/{Point-DXH4kJNQ.js → Point-C6wv1uzT.js} +22 -21
  40. package/dist/{Promotion-Cn-wAx6m.js → Promotion-CeZRHUed.js} +137 -131
  41. package/dist/{Queue-CEEUE-UT.js → Queue-BxTSJ6LA.js} +45 -45
  42. package/dist/{Record-BFIjLKJD.js → Record-DoOyOT7I.js} +9 -9
  43. package/dist/{Review-BMRfKri0.js → Review-BSpjwVxg.js} +2 -2
  44. package/dist/ReviewFacebookCallback-CMAQ_PXJ.js +225 -0
  45. package/dist/{ReviewGoogleCallback-Cflqv5Z5.js → ReviewGoogleCallback-D---BE3G.js} +5 -5
  46. package/dist/{Reward-C-qGtzpu.js → Reward-BC2PCxwA.js} +16 -16
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-kxJ5i8xe.js → RewardGroup.vue_vue_type_script_setup_true_lang-VV8I4Pnl.js} +13 -13
  48. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DmOKmXkP.js +1923 -0
  49. package/dist/{Segment-Bx1pfw4Q.js → Segment-CcRapIdF.js} +303 -306
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-vuH9xdOi.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-D9Ino3uS.js} +14 -14
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-CZHpyimI.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-C42YDmfw.js} +4 -4
  52. package/dist/Setting-CTWV-j-u.js +574 -0
  53. package/dist/{SettingAdvertisements-CZlIQ5m_.js → SettingAdvertisements-1WCqp0FF.js} +12 -12
  54. package/dist/Settings-BxgqmIBl.js +286 -0
  55. package/dist/{Store-BhZulzuc.js → Store-uhCU5WYY.js} +28 -28
  56. package/dist/{StoreRewards-CvYgJVFU.js → StoreRewards-DjgbbZsB.js} +15 -15
  57. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BgT5nChN.js +1319 -0
  58. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BAUBxdV2.js +7007 -0
  59. package/dist/{Tier-BPPSaEe0.js → Tier-B6sp_dj5.js} +2575 -687
  60. package/dist/{Title-CccRUVZV.js → Title-Dew9vKN4.js} +95 -94
  61. package/dist/{Transaction-ULzAt-u7.js → Transaction-ITefNWob.js} +2 -2
  62. package/dist/Upselling-AMpfgEvH.js +1042 -0
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CoqrSuWu.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-B4LP8LZ-.js} +26 -26
  64. package/dist/{Voucher-Cz7IMRNl.js → Voucher-CRP6KY1f.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BaxHZN76.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BZEJecca.js} +12 -12
  66. package/dist/{WhatsappAccount-BsxVHiZZ.js → WhatsappAccount-MkutDvBs.js} +6 -6
  67. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-DJnkGMF1.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-vDLl0J7v.js} +1 -1
  68. package/dist/{WhatsappBot-sd6erVZk.js → WhatsappBot-B0m21qPb.js} +6 -6
  69. package/dist/{WhatsappBotLogs-DNbGWyOY.js → WhatsappBotLogs-BHyoUuef.js} +6 -6
  70. package/dist/{WhatsappBotSettings-DXa_e7-a.js → WhatsappBotSettings-BbiHQ3Qb.js} +4 -4
  71. package/dist/{WhatsappLayout-DvBPIB5f.js → WhatsappLayout-yq05I3IA.js} +3 -3
  72. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-CRDouGvj.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BrjbWgKf.js} +3 -3
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B6BvSACt.js → ZodTextField.vue_vue_type_script_setup_true_lang-CLiZ6jd6.js} +2 -2
  74. package/dist/{app-4x06ItoL.js → app-Ce3Q-VS4.js} +14861 -15017
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-DS0xThWi.js → base.export-Ds3PiiHA.js} +2 -2
  77. package/dist/{business-D0I7G-5H.js → business-CfxfaERu.js} +1 -1
  78. package/dist/{campaign-BuJCjEH-.js → campaign-COuKKIRA.js} +121 -94
  79. package/dist/{campaign-CC9U7rkr.js → campaign-CtX-q7KI.js} +34 -28
  80. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-Dx-Zo68Q.js} +2 -1
  81. package/dist/campaign.fn-oUqhH0SU.js +776 -0
  82. package/dist/{collection.fn-CUifllLR.js → collection.fn-PhjmENfo.js} +2 -2
  83. package/dist/{currency-BPhBDOpt.js → currency-DmSaw6iQ.js} +1 -1
  84. package/dist/duplicateCampaign-DzF45eaZ.js +51 -0
  85. package/dist/{effect-DKHOR-B3.js → effect-sAKjjlrO.js} +1 -1
  86. package/dist/{email-addresses-B-VEReRV.js → email-addresses-jSqlPLwS.js} +25 -25
  87. package/dist/{feature-flag-Cjl6gaO5.js → feature-flag-Dvz3D7kC.js} +171 -185
  88. package/dist/google-BQK68wbe.js +5 -0
  89. package/dist/{helper-CBLh1PWR.js → helper-Dn6pU0yd.js} +1 -1
  90. package/dist/{index-DL_UYO4J.js → index--A062GN8.js} +380 -234
  91. package/dist/{index-DenQ8DV4.js → index-2B_HRy_7.js} +1 -1
  92. package/dist/{index-umYXnOWc.js → index-8wWIydMw.js} +608 -251
  93. package/dist/{index-C1QA2M4I.js → index-Aqx0Hc_6.js} +10 -10
  94. package/dist/{index-kClA31M9.js → index-B_GA0PSb.js} +10 -10
  95. package/dist/{index-bc7bIIVP.js → index-B_aWWeg9.js} +197 -197
  96. package/dist/{index-Djf4TpYV.js → index-BiBBY6Sk.js} +23 -23
  97. package/dist/{index-vqUiCeKb.js → index-BoFxBf97.js} +1 -1
  98. package/dist/{index-B_iKSOXp.js → index-BrqespAR.js} +1 -1
  99. package/dist/{index-BwgjSrwa.js → index-Bu2uqM4e.js} +2 -2
  100. package/dist/{index-BzKKNuLc.js → index-C4O-Fym0.js} +2 -2
  101. package/dist/{index-BBsqcXfJ.js → index-C8fp9YtA.js} +1 -1
  102. package/dist/{index-Ob5I-Sex.js → index-CRFiQOrt.js} +1 -1
  103. package/dist/{index-RMsQnHez.js → index-CUaL0i4I.js} +1 -1
  104. package/dist/{index-EpqQFMu2.js → index-Cgg1NNfN.js} +2699 -2614
  105. package/dist/{index-ZTC5k9Jb.js → index-CjAhwLNW.js} +19 -6
  106. package/dist/{index-CWJi_hw-.js → index-D6wQPKHc.js} +2 -2
  107. package/dist/{index-nnmfOPuw.js → index-DFAceV6T.js} +4 -4
  108. package/dist/{index-CGcWs8B5.js → index-bGITzW-d.js} +533 -462
  109. package/dist/{index-D3B392A3.js → index-pCmNLjIj.js} +3 -3
  110. package/dist/{index.esm2017-DMKkHR06.js → index.esm2017-ChJMTCyQ.js} +93 -93
  111. package/dist/{loading-Cb4RgEo7.js → loading-DhiMqWJA.js} +1 -1
  112. package/dist/{lodash-CMazTe9d.js → lodash-CCBK4pXz.js} +1 -1
  113. package/dist/{member-import-Df1y7FvX.js → member-import-BUvsg-Lu.js} +1 -1
  114. package/dist/{membership-yvDb2HS8.js → membership-7X3Uc50t.js} +2 -2
  115. package/dist/{money-rs9shyUy.js → money-D5EIeVr_.js} +1 -1
  116. package/dist/{number-Ecq6MjRx.js → number-Bj7X6VoA.js} +1 -1
  117. package/dist/objectid-CzFM8vy5.js +145 -0
  118. package/dist/{onboarding-DugmLfNG.js → onboarding-0mA1gXrv.js} +36 -36
  119. package/dist/{onboardingSetup-DMzNxJC4.js → onboardingSetup-BBPg-cAT.js} +2 -2
  120. package/dist/{plugins-CvhBJQEK.js → plugins-bprg7ahs.js} +3 -3
  121. package/dist/{reward-BGUOUKZn.js → reward-WTxymIQH.js} +1 -1
  122. package/dist/{rule-C87YbT3F.js → rule-hJuK8Yqw.js} +572 -492
  123. package/dist/style.css +1 -1
  124. package/dist/template-wt4Q2S3f.js +227 -0
  125. package/dist/{timezone-uP_heouv.js → timezone-BWkDzpwA.js} +1 -1
  126. package/dist/{transaction.fn-CiGhIgzP.js → transaction.fn-DzwtEBIZ.js} +2 -2
  127. package/dist/{trigger-dOOSh-Yp.js → trigger-D6hitqvM.js} +9 -9
  128. package/dist/{useMarketingMaterialActions-BRenBblP.js → useMarketingMaterialActions-ByWwvQRt.js} +4 -4
  129. package/dist/{usePagination-DNOc8GFS.js → usePagination-Mr6qWVOa.js} +1 -1
  130. package/dist/{user-DTAGYy-F.js → user-Dpl2lhox.js} +1 -1
  131. package/dist/vue-i18n-BEFR04bc.js +2365 -0
  132. package/dist/{xlsx-BU0bDwTF.js → xlsx-Cu5ybiy4.js} +1 -1
  133. package/dist/{zod-mPFqdty8.js → zod-CcKqtEqX.js} +1 -1
  134. package/package.json +6 -2
  135. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D38JB0FV.js +0 -3493
  136. package/dist/ReviewFacebookCallback-CPYIC3RS.js +0 -238
  137. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BlRmshrE.js +0 -1884
  138. package/dist/Setting-CEcpuE_O.js +0 -578
  139. package/dist/Settings-CPLibjQy.js +0 -179
  140. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Dqj5zIgi.js +0 -1297
  141. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang--Ii9ejFG.js +0 -142
  142. package/dist/Upselling-D2tSUTkE.js +0 -200
  143. package/dist/campaign.fn-CLUOgMgc.js +0 -776
  144. package/dist/google-C3S8u0mT.js +0 -4
  145. package/dist/objectid-BVri-Vim.js +0 -145
  146. package/dist/rule-builder-lzMi7irV.js +0 -102
  147. package/dist/template-BfFSbH04.js +0 -275
  148. package/dist/vue-i18n-D8wuxuA4.js +0 -2365
@@ -1,142 +0,0 @@
1
- import { defineComponent as N, ref as U, computed as w, watch as M, resolveComponent as v, openBlock as a, createElementBlock as i, Fragment as p, toDisplayString as F, createCommentVNode as T, createElementVNode as j, createVNode as h, unref as n, renderList as S, createBlock as k, isRef as $, withCtx as C } from "vue";
2
- import { u as q } from "./business-D0I7G-5H.js";
3
- import { u as D } from "./vue-i18n-D8wuxuA4.js";
4
- function K(l, s, o) {
5
- return l.some(
6
- o instanceof Function ? o : (u) => u === s
7
- ) || l.push(s), l;
8
- }
9
- function O(l, s, o) {
10
- return l.filter(
11
- o instanceof Function ? (u) => !o(u) : (u) => u !== s
12
- );
13
- }
14
- const R = {
15
- key: 0,
16
- class: "fm-typo-en-body-lg-400"
17
- }, z = {
18
- key: 1,
19
- class: "space-y-4"
20
- }, A = { key: 0 }, G = { key: 1 }, H = { key: 2 }, W = /* @__PURE__ */ N({
21
- __name: "TargetLocationInput",
22
- props: {
23
- label: {
24
- type: String
25
- },
26
- type: {
27
- type: String,
28
- default: "select"
29
- },
30
- modelValue: {
31
- type: Object,
32
- required: !0
33
- }
34
- },
35
- emits: ["update:model-value"],
36
- setup(l, { emit: s }) {
37
- const o = q(), { t: u } = D(), c = l, r = U(""), B = w(() => o.locations.filter(
38
- (d) => {
39
- var t;
40
- return d.name.toLowerCase().includes(r.value.toLowerCase()) || ((t = d == null ? void 0 : d.code) == null ? void 0 : t.toLowerCase().includes(r.value.toLowerCase()));
41
- }
42
- )), b = s;
43
- function L(d, t) {
44
- const m = d ? K(c.modelValue || [], t.toString()) : O(
45
- c.modelValue || o.locations.map((g) => g._id.toString()),
46
- t.toString()
47
- );
48
- return b("update:model-value", m);
49
- }
50
- const V = U(!1), I = w(() => {
51
- var m, g;
52
- const t = ((m = c.modelValue) == null ? void 0 : m.slice(0, 5).map((f) => {
53
- var y;
54
- return ((y = o.locationById(f)) == null ? void 0 : y.name) || f;
55
- })) || [];
56
- return c.modelValue && ((g = c.modelValue) == null ? void 0 : g.length) > 5 && t.push(`+${c.modelValue.length - 5} more`), t;
57
- });
58
- return M(V, (d) => {
59
- d && (r.value = "");
60
- }), (d, t) => {
61
- const m = v("FmCheckbox"), g = v("FmChip"), f = v("FmField"), y = v("FmTextField"), E = v("FmMenu");
62
- return a(), i(p, null, [
63
- l.label ? (a(), i("div", R, F(l.label), 1)) : T("", !0),
64
- l.type === "checkbox" ? (a(), i("div", z, [
65
- j("div", null, [
66
- h(m, {
67
- value: null,
68
- indeterminate: l.modelValue != null && l.modelValue.length > 0 && l.modelValue.length < n(o).locations.length,
69
- label: n(u)("connect.setting.location.allLocations"),
70
- "model-value": l.modelValue == null || l.modelValue.length === n(o).locations.length,
71
- "onUpdate:modelValue": t[0] || (t[0] = (e) => b("update:model-value", e ? null : []))
72
- }, null, 8, ["indeterminate", "label", "model-value"])
73
- ]),
74
- (a(!0), i(p, null, S(n(o).locations, (e) => (a(), i("div", {
75
- key: e._id.toString()
76
- }, [
77
- h(m, {
78
- value: e._id.toString(),
79
- label: `${e.code ? `${e.code} - ` : ""} ${e.name}`,
80
- "model-value": !l.modelValue || l.modelValue.includes(e._id.toString()),
81
- "onUpdate:modelValue": (x) => L(x, e._id.toString())
82
- }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"])
83
- ]))), 128))
84
- ])) : (a(), k(E, {
85
- key: 2,
86
- modelValue: n(V),
87
- "onUpdate:modelValue": t[3] || (t[3] = (e) => $(V) ? V.value = e : null),
88
- onMenuChanged: t[4] || (t[4] = (e) => V.value = e),
89
- placement: "top-end"
90
- }, {
91
- "menu-button": C(() => [
92
- h(f, {
93
- "append-icon": n(V) ? "expand_more" : "expand_less",
94
- class: "!h-auto"
95
- }, {
96
- default: C(() => [
97
- !l.modelValue || l.modelValue.length == n(o).locations.length ? (a(), i("div", A, F(n(u)("connect.setting.location.allLocations")), 1)) : l.modelValue.length ? (a(), i("div", H, [
98
- (a(!0), i(p, null, S(n(I), (e) => (a(), k(g, {
99
- key: e,
100
- label: e,
101
- class: "max-w-[130px] text-ellipsis"
102
- }, null, 8, ["label"]))), 128))
103
- ])) : (a(), i("div", G, F(n(u)("connect.setting.location.noLocations")), 1))
104
- ]),
105
- _: 1
106
- }, 8, ["append-icon"])
107
- ]),
108
- default: C(() => [
109
- h(y, {
110
- modelValue: n(r),
111
- "onUpdate:modelValue": t[1] || (t[1] = (e) => $(r) ? r.value = e : null),
112
- placeholder: n(u)("connect.setting.location.searchLocations"),
113
- class: "my-8"
114
- }, null, 8, ["modelValue", "placeholder"]),
115
- h(m, {
116
- class: "my-8",
117
- value: null,
118
- indeterminate: l.modelValue != null && l.modelValue.length > 0 && l.modelValue.length < n(o).locations.length,
119
- label: n(u)("connect.setting.location.allLocations"),
120
- "model-value": l.modelValue == null || l.modelValue.length === n(o).locations.length,
121
- "onUpdate:modelValue": t[2] || (t[2] = (e) => b("update:model-value", e ? null : []))
122
- }, null, 8, ["indeterminate", "label", "model-value"]),
123
- (a(!0), i(p, null, S(n(B), (e) => (a(), k(m, {
124
- class: "my-8",
125
- key: e._id.toString(),
126
- value: e._id.toString(),
127
- label: `${e.code ? `${e.code} - ` : ""} ${e.name}`,
128
- "model-value": !l.modelValue || l.modelValue.includes(e._id.toString()),
129
- "onUpdate:modelValue": (x) => L(x, e._id.toString())
130
- }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"]))), 128))
131
- ]),
132
- _: 1
133
- }, 8, ["modelValue"]))
134
- ], 64);
135
- };
136
- }
137
- });
138
- export {
139
- W as _,
140
- K as p,
141
- O as r
142
- };
@@ -1,200 +0,0 @@
1
- import { defineComponent as P, ref as y, computed as w, openBlock as B, createBlock as L, unref as m, createCommentVNode as F } from "vue";
2
- import { onBeforeRouteLeave as A } from "vue-router";
3
- import { useCoreStore as v } from "@feedmepos/mf-common";
4
- import { z as e, l as U, g as j, J as E } from "./app-4x06ItoL.js";
5
- import { b as M } from "./index-C1QA2M4I.js";
6
- import { f as N } from "./currency-BPhBDOpt.js";
7
- const I = e.object({
8
- catalog: e.array(
9
- e.object({
10
- _id: e.string(),
11
- override: e.object({
12
- items: e.record(
13
- e.array(
14
- e.object({
15
- combinationKey: e.string().nullish(),
16
- orderFrom: e.string().nullish(),
17
- category: e.string().nullish()
18
- })
19
- )
20
- ).optional()
21
- }).passthrough()
22
- })
23
- ).default([]),
24
- category: e.array(e.object({ _id: e.string(), name: e.string() })),
25
- item: e.array(
26
- e.object({
27
- _id: e.string().min(1),
28
- name: e.string(),
29
- orderFrom: e.string().nullish(),
30
- unit: e.string().nullish(),
31
- perXUnit: e.coerce.number().nullish(),
32
- isOutOfStocked: e.boolean().optional(),
33
- thumbnail: e.string().nullish(),
34
- category: e.string().nullish(),
35
- price: e.object({
36
- currency: e.string(),
37
- amount: e.number(),
38
- precision: e.number()
39
- }).nullish()
40
- })
41
- )
42
- }), C = e.object({
43
- _id: e.string().min(1),
44
- menuMode: e.enum(["businessLevel", "restaurantLevel"]).optional(),
45
- modules: I.nullish(),
46
- restaurants: e.array(
47
- e.object({
48
- restaurantId: e.string(),
49
- modules: I.nullish()
50
- })
51
- ).nullish()
52
- });
53
- function f() {
54
- const o = j();
55
- if (!o)
56
- throw new Error("Upselling is unavailable in this country or namespace.");
57
- return o;
58
- }
59
- function X() {
60
- const { api: o } = U(v(), { loadProducts: b });
61
- return {
62
- get: (...n) => (f(), o.get(...n)),
63
- save: (...n) => (f(), o.save(...n)),
64
- reset: (...n) => (f(), o.reset(...n))
65
- };
66
- }
67
- function $() {
68
- const { loadPreview: o } = U(v(), { loadProducts: b });
69
- return (...n) => (f(), o(...n));
70
- }
71
- function _(o, n) {
72
- var s, i;
73
- const r = C.parse(o), a = r.restaurants || r.menuMode === "restaurantLevel" ? (i = (s = r.restaurants) == null ? void 0 : s.find((t) => t.restaurantId === n)) == null ? void 0 : i.modules : r.modules;
74
- if (!a) return [];
75
- const l = new Map(
76
- a.category.map((t) => [t._id, t.name])
77
- );
78
- return a.item.map((t) => ({
79
- productId: t._id,
80
- name: t.name,
81
- ...t.unit != null ? { unit: t.unit } : {},
82
- ...t.perXUnit != null ? { perXUnit: t.perXUnit } : {},
83
- ...t.isOutOfStocked != null ? { isOutOfStocked: t.isOutOfStocked } : {},
84
- imageUrl: t.thumbnail ?? void 0,
85
- category: l.get(t.category ?? ""),
86
- priceLabel: t.price ? N(t.price) : void 0
87
- }));
88
- }
89
- const b = async ({
90
- businessId: o,
91
- restaurantId: n
92
- }) => {
93
- const a = (await k(o)).find((l) => l.scope.restaurantId === n);
94
- if (!a)
95
- throw new Error("This outlet is not available in the current business.");
96
- if (a.unavailableReason) throw new Error(a.unavailableReason);
97
- return a.products;
98
- }, D = e.array(
99
- e.object({
100
- _id: e.string(),
101
- businessId: e.string(),
102
- profile: e.object({ name: e.string().optional() }).passthrough().optional(),
103
- catalogId: e.string().nullish(),
104
- additionalCatalogs: e.array(e.string()).nullish(),
105
- takeaway: e.object({ catalogId: e.string().nullish() }).passthrough().nullish(),
106
- pickup: e.object({ catalogId: e.string().nullish() }).passthrough().nullish()
107
- }).passthrough()
108
- );
109
- function K(o, n, r, a) {
110
- var l, s;
111
- for (const i of o.item) {
112
- const t = (s = (l = n == null ? void 0 : n.override.items) == null ? void 0 : l[i._id]) == null ? void 0 : s.find(
113
- (u) => !u.combinationKey
114
- );
115
- ((t == null ? void 0 : t.orderFrom) ?? i.orderFrom) !== "NONE" && (r === "v4" || (t == null ? void 0 : t.category) !== "") && a.add(i._id);
116
- }
117
- }
118
- function T(o, n, r) {
119
- var s, i;
120
- const a = /* @__PURE__ */ new Set();
121
- if (!o)
122
- return { productIds: a, unavailableReason: "No menu is available for this outlet." };
123
- if (r !== "v3" && r !== "v4")
124
- return { productIds: a, unavailableReason: "Menu version could not be verified. Nothing will be applied." };
125
- const l = [
126
- n.catalogId ?? null,
127
- ...n.additionalCatalogs ?? [],
128
- (s = n.takeaway) == null ? void 0 : s.catalogId,
129
- (i = n.pickup) == null ? void 0 : i.catalogId
130
- ].filter((t) => t !== void 0);
131
- for (const t of l) {
132
- const c = t ? o.catalog.find((u) => u._id === t) : void 0;
133
- if (t && !c)
134
- return { productIds: a, unavailableReason: "An assigned catalog is unavailable. Reload this outlet’s menu before applying." };
135
- K(o, c, r, a);
136
- }
137
- return { productIds: a };
138
- }
139
- const k = async (o) => {
140
- var u, g, p;
141
- const n = f(), r = v(), a = D.parse(r.restaurants.value).filter((d) => d.businessId === o), l = e.object({ menuVersion: e.enum(["v3", "v4"]).nullish() }).parse(r.currentBusiness.value).menuVersion, s = await M(
142
- `/menu-v4/businesses/${encodeURIComponent(
143
- o
144
- )}/menu-v4/effective-menu?modules=item,category,catalog`,
145
- { url: n === "dev" ? "https://portal-v2-dev.feedmeapi.com" : "https://portal-v2.feedmeapi.com" }
146
- ).get(""), i = C.parse(s.data), t = i.menuMode === "restaurantLevel", c = [
147
- {
148
- name: "Business default",
149
- scope: { businessId: o },
150
- products: t ? [] : _(s.data),
151
- ...t ? {
152
- unavailableReason: "This business uses separate outlet menus. Apply to selected outlets instead; product IDs cannot be combined into one shared catalog."
153
- } : {}
154
- }
155
- ];
156
- for (const d of a) {
157
- const R = t ? (g = (u = i.restaurants) == null ? void 0 : u.find((h) => h.restaurantId === d._id)) == null ? void 0 : g.modules : i.modules, { productIds: S, unavailableReason: O } = T(
158
- R,
159
- d,
160
- l
161
- );
162
- c.push({
163
- name: ((p = d.profile) == null ? void 0 : p.name) ?? d._id,
164
- scope: { businessId: o, restaurantId: d._id },
165
- products: _(s.data, d._id).filter(
166
- (h) => S.has(h.productId)
167
- ),
168
- unavailableReason: O
169
- });
170
- }
171
- return c;
172
- }, H = /* @__PURE__ */ P({
173
- __name: "Upselling",
174
- setup(o) {
175
- const n = v(), r = X(), a = $(), l = y(!1), s = y(!1), i = w(() => j() !== void 0), t = w(
176
- () => {
177
- var c;
178
- return `${n.namespace.value}:${n.currentCountry.value}:${(c = n.sessionUser.value) == null ? void 0 : c.id}`;
179
- }
180
- );
181
- return A(
182
- () => !s.value && (!l.value || window.confirm("Discard unsaved changes?"))
183
- ), (c, u) => {
184
- var g;
185
- return i.value ? (B(), L(m(E), {
186
- key: t.value,
187
- "business-id": ((g = m(n).currentBusiness.value) == null ? void 0 : g._id) ?? "",
188
- api: m(r),
189
- "load-products": m(b),
190
- "load-apply-targets": m(k),
191
- "load-preview": m(a),
192
- onDirtyChange: u[0] || (u[0] = (p) => l.value = p),
193
- onBusyChange: u[1] || (u[1] = (p) => s.value = p)
194
- }, null, 8, ["business-id", "api", "load-products", "load-apply-targets", "load-preview"])) : F("", !0);
195
- };
196
- }
197
- });
198
- export {
199
- H as default
200
- };