@feedmepos/mf-connect 0.1.98-beta.39 → 0.1.98-beta.40

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 (151) hide show
  1. package/package.json +1 -1
  2. package/dist/App-DwjQisFZ.js +0 -4785
  3. package/dist/AuditLogs-DMGqmriL.js +0 -2014
  4. package/dist/Bin-4wvIqogM.js +0 -166
  5. package/dist/Broadcast-DPpuSZ8_.js +0 -269
  6. package/dist/CampaignAnalytic-CXFDo2X_.js +0 -1826
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-SLoy1-Kd.js +0 -122
  8. package/dist/Card-C8SA6un0.js +0 -911
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-BCpSiM_4.js +0 -541
  11. package/dist/Credit-C8RTBpP7.js +0 -286
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0OI5QzpR.js +0 -3382
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CJTduNh3.js +0 -351
  16. package/dist/Experience-Bg3kFQQE.js +0 -285
  17. package/dist/FileSaver.min-DMUuMi9w.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
  20. package/dist/Game-D3DbkRUj.js +0 -356
  21. package/dist/GiftCardSetup-CxlMM4up.js +0 -542
  22. package/dist/Grab-DvEK8ixP.js +0 -301
  23. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBK-UrEe.js +0 -145
  24. package/dist/Index-Do_9DXuY.js +0 -259
  25. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  26. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-BKPGBYiU.js +0 -48
  27. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-D6wJN9Gj.js +0 -18737
  28. package/dist/LoyaltyDashboard-B4WqycGN.js +0 -1345
  29. package/dist/MainLayout-DdxLaufS.js +0 -143
  30. package/dist/Marketing-CcFEMwKB.js +0 -236
  31. package/dist/MarketingMaterialEdit-DoYFaMf7.js +0 -1036
  32. package/dist/Member-BussgBln.js +0 -281
  33. package/dist/MemberList-BXJxSsjo.js +0 -1603
  34. package/dist/MemberOverview-wL_ailso.js +0 -58
  35. package/dist/MemberTransactions-O-XY5nz3.js +0 -45
  36. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DsxrIO0r.js +0 -60957
  37. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js +0 -38
  38. package/dist/Mission-CPkM-8Ns.js +0 -360
  39. package/dist/Overview-BJjpYUJN.js +0 -1080
  40. package/dist/Overview-C5KF_Jxj.js +0 -1316
  41. package/dist/Point-FDFwR3Hk.js +0 -288
  42. package/dist/Promotion-qtucKxn0.js +0 -423
  43. package/dist/Queue-d91tocPX.js +0 -261
  44. package/dist/Record-CvkK2iLq.js +0 -342
  45. package/dist/Review-C_zLGtzU.js +0 -45
  46. package/dist/ReviewFacebookCallback-Bidg3P76.js +0 -238
  47. package/dist/ReviewGoogleCallback-DL0lxMBL.js +0 -213
  48. package/dist/Reward-BTsQaI-J.js +0 -442
  49. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BjxA4eMX.js +0 -150
  50. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D4NIDc-C.js +0 -1913
  51. package/dist/Segment-BgFyB3BK.js +0 -1017
  52. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CkhjFNvZ.js +0 -181
  53. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-HYbRyACe.js +0 -189
  54. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-7dv3cAW3.js +0 -226
  55. package/dist/Setting-BxHoCSxw.js +0 -2047
  56. package/dist/SettingAdvertisements-WfvuE4fA.js +0 -264
  57. package/dist/Settings-B42SAvEx.js +0 -179
  58. package/dist/Store-BnvWfCy-.js +0 -2413
  59. package/dist/StoreRewards-BRzAMqR-.js +0 -540
  60. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C3FJr1L5.js +0 -1075
  61. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-UZYzUcif.js +0 -7007
  62. package/dist/Tier-BrzLNat2.js +0 -972
  63. package/dist/Title-EnlaNXld.js +0 -569
  64. package/dist/Transaction-BiXNxUGX.js +0 -39
  65. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Db5_DKQ0.js +0 -130
  66. package/dist/Voucher-C2dyk-jj.js +0 -444
  67. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DPE24a-J.js +0 -421
  68. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js +0 -56
  69. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  70. package/dist/app-Bt8HrAEr.js +0 -60740
  71. package/dist/app-wDQR6dpb.js +0 -39
  72. package/dist/app.js +0 -7
  73. package/dist/business-BwtQpfUr.js +0 -82
  74. package/dist/campaign-B6U9lwKi.js +0 -255
  75. package/dist/campaign-C6Cb9s3C.js +0 -100
  76. package/dist/campaign-CpzFl8Vr.js +0 -4
  77. package/dist/campaign.enum-Dx-Zo68Q.js +0 -26
  78. package/dist/campaign.fn-B0x2EGhw.js +0 -776
  79. package/dist/collectible.enum-Liy2wH3s.js +0 -19
  80. package/dist/collection.fn-DfoA9sJV.js +0 -26
  81. package/dist/duplicateCampaign-Cnq5N-V8.js +0 -51
  82. package/dist/effect-B2REbrv8.js +0 -89
  83. package/dist/email-addresses-BzmOsxLn.js +0 -705
  84. package/dist/export-jHpRhPQu.js +0 -97
  85. package/dist/feedme.ico +0 -0
  86. package/dist/google-C3S8u0mT.js +0 -4
  87. package/dist/helper-DQAHX1kX.js +0 -86
  88. package/dist/index-4GG-yjdN.js +0 -2963
  89. package/dist/index-BWgMbKOB.js +0 -85
  90. package/dist/index-BccUpf0U.js +0 -3
  91. package/dist/index-BkgkJkVs.js +0 -8919
  92. package/dist/index-C0PKVTf9.js +0 -32
  93. package/dist/index-C8cXXcLk.js +0 -45
  94. package/dist/index-CTTGf4TM.js +0 -151
  95. package/dist/index-C_H8jFYf.js +0 -2743
  96. package/dist/index-CuvNtC_M.js +0 -61
  97. package/dist/index-DJN4auwx.js +0 -146
  98. package/dist/index-DMr9ohGV.js +0 -1139
  99. package/dist/index-DQTo_ytu.js +0 -31
  100. package/dist/index-DW7-0rf_.js +0 -53
  101. package/dist/index-Da7J83jM.js +0 -2706
  102. package/dist/index-Di1Z4vLS.js +0 -27550
  103. package/dist/index-FoKZGh7Z.js +0 -67
  104. package/dist/index-N25Px7RQ.js +0 -72
  105. package/dist/index-PgblELTo.js +0 -897
  106. package/dist/index-STBMTK1u.js +0 -28900
  107. package/dist/index-hP3Mgc0u.js +0 -55
  108. package/dist/index-vh86FiIQ.js +0 -10
  109. package/dist/index.esm2017-DV56jzfJ.js +0 -3069
  110. package/dist/loading-D__sDcq1.js +0 -72
  111. package/dist/lodash-DgkDIHoV.js +0 -3678
  112. package/dist/membership-CBjt1MGx.js +0 -255
  113. package/dist/moment-D7p2TMB-.js +0 -2583
  114. package/dist/money-BFUbPKDM.js +0 -15
  115. package/dist/number-CJb8OUa3.js +0 -12
  116. package/dist/object-BYyQ0PZp.js +0 -18
  117. package/dist/objectId-dwaoBfJX.js +0 -7
  118. package/dist/objectid-BMUFNR9T.js +0 -145
  119. package/dist/plugins-D95ZeD-9.js +0 -1788
  120. package/dist/remy-Qz_pNsUS.js +0 -13
  121. package/dist/reward-CSfV_XFK.js +0 -36
  122. package/dist/rule-DIzVHy2z.js +0 -1969
  123. package/dist/rule-builder-DF7fCvec.js +0 -126
  124. package/dist/string-Gcy5IM_H.js +0 -32
  125. package/dist/style.css +0 -4
  126. package/dist/template-r3lAQP1B.js +0 -188
  127. package/dist/tier-BJDhpH6X.js +0 -4
  128. package/dist/tiers/tier=1.png +0 -0
  129. package/dist/tiers/tier=2.png +0 -0
  130. package/dist/tiers/tier=3.png +0 -0
  131. package/dist/tiers/tier=4.png +0 -0
  132. package/dist/timezone-D40qRUoz.js +0 -20
  133. package/dist/titles/type=diamond.png +0 -0
  134. package/dist/titles/type=drinks.png +0 -0
  135. package/dist/titles/type=food.png +0 -0
  136. package/dist/titles/type=heart.png +0 -0
  137. package/dist/titles/type=medal.png +0 -0
  138. package/dist/titles/type=spend.png +0 -0
  139. package/dist/titles/type=thank-you.png +0 -0
  140. package/dist/titles/type=thumbs-up.png +0 -0
  141. package/dist/titles/type=years.png +0 -0
  142. package/dist/transaction.fn-DV-cpfOj.js +0 -64
  143. package/dist/trigger-BEJaSv5R.js +0 -213
  144. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  145. package/dist/type_drinks-D6jnpvwV.js +0 -4
  146. package/dist/useMarketingMaterialActions-Bd5BDfE1.js +0 -96
  147. package/dist/usePagination-DLIo76-X.js +0 -220
  148. package/dist/user-DtEjuhyM.js +0 -55
  149. package/dist/vue-i18n-dQ1XCaUv.js +0 -2365
  150. package/dist/xlsx-BUMZsTov.js +0 -15491
  151. package/dist/zod-B_pVZhsV.js +0 -91
@@ -1,1345 +0,0 @@
1
- import { defineComponent as I, resolveComponent as _, openBlock as l, createBlock as L, withCtx as D, createElementVNode as t, createVNode as u, unref as f, createTextVNode as te, createElementBlock as p, Fragment as F, renderList as B, normalizeClass as A, toDisplayString as d, createCommentVNode as U, normalizeStyle as He, computed as w, ref as x, watch as ge, onMounted as ze, nextTick as Ye } from "vue";
2
- import { h as he } from "./moment-D7p2TMB-.js";
3
- import { g as R, S as je, b as Ge, c as Je } from "./index-STBMTK1u.js";
4
- import { RouterLink as Me, useRouter as Ke } from "vue-router";
5
- import { c as We } from "./index-DJN4auwx.js";
6
- import { _ as T } from "./MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js";
7
- import { _ as Qe } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
8
- import { _ as xe } from "./DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js";
9
- import { u as Xe } from "./loading-D__sDcq1.js";
10
- import { u as Ze } from "./business-BwtQpfUr.js";
11
- import { C as _e } from "./timezone-D40qRUoz.js";
12
- import { useCoreStore as et } from "@feedmepos/mf-common";
13
- import { m as V } from "./index-DMr9ohGV.js";
14
- import { t as tt } from "./money-BFUbPKDM.js";
15
- const rt = { class: "flex items-center mb-14" }, st = {
16
- key: 0,
17
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary py-10"
18
- }, ot = {
19
- key: 1,
20
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary py-10"
21
- }, at = {
22
- key: 2,
23
- class: "flex flex-col"
24
- }, nt = { class: "flex-1 min-w-0" }, it = { class: "fm-typo-en-body-sm-600 whitespace-nowrap overflow-hidden text-ellipsis" }, lt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-2" }, dt = { class: "text-right flex-shrink-0" }, ct = { class: "fm-typo-en-body-lg-600" }, mt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-2" }, pt = {
25
- key: 3,
26
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary py-10"
27
- }, ut = /* @__PURE__ */ I({
28
- __name: "CampaignActivityList",
29
- props: {
30
- campaigns: {},
31
- loading: { type: Boolean },
32
- error: { type: Boolean }
33
- },
34
- setup(e) {
35
- return (s, r) => {
36
- const n = _("FmCard");
37
- return l(), L(n, {
38
- variant: "outlined",
39
- class: "p-24"
40
- }, {
41
- default: D(() => [
42
- t("div", rt, [
43
- r[1] || (r[1] = t("div", { class: "flex-1 fm-typo-en-body-md-600" }, "Recent campaigns", -1)),
44
- u(f(Me), {
45
- to: "/campaign",
46
- class: "fm-typo-en-body-sm-600 text-fm-color-primary no-underline"
47
- }, {
48
- default: D(() => [...r[0] || (r[0] = [
49
- te(" All campaigns ", -1)
50
- ])]),
51
- _: 1
52
- })
53
- ]),
54
- e.loading ? (l(), p("div", st, " Loading campaigns. ")) : e.error ? (l(), p("div", ot, " Unable to load campaigns. ")) : e.campaigns.length ? (l(), p("div", at, [
55
- (l(!0), p(F, null, B(e.campaigns, (o) => (l(), p("div", {
56
- key: o.id,
57
- class: "flex items-start gap-10 py-10 border-b border-fm-color-neutral-gray-100 last:border-b-0"
58
- }, [
59
- t("div", {
60
- class: A(["w-7 h-7 rounded-full bg-current flex-shrink-0 mt-5", o.statusClass])
61
- }, null, 2),
62
- t("div", nt, [
63
- t("div", it, d(o.name), 1),
64
- t("div", lt, d(o.type), 1)
65
- ]),
66
- t("div", dt, [
67
- t("div", ct, d(o.metric), 1),
68
- t("div", mt, d(o.metricLabel), 1)
69
- ])
70
- ]))), 128))
71
- ])) : (l(), p("div", pt, " No campaigns are available for this location. "))
72
- ]),
73
- _: 1
74
- });
75
- };
76
- }
77
- }), ft = { class: "flex items-center gap-8" }, bt = { class: "w-[30px] h-[30px] bg-fm-color-primary-oats flex items-center justify-center flex-shrink-0 fm-corner-radius-md" }, yt = { class: "bg-fm-color-primary-oats p-14 fm-corner-radius-md" }, vt = { class: "fm-typo-en-body-md-600 mb-6" }, gt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ht = { class: "flex flex-col gap-6" }, xt = { class: "border-t border-fm-color-neutral-gray-100 pt-12 flex flex-col gap-3" }, _t = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, wt = {
78
- key: 1,
79
- class: "bg-fm-color-neutral-gray-100 rounded-10 p-14 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
80
- }, Mt = /* @__PURE__ */ I({
81
- __name: "InsightPanel",
82
- props: {
83
- insight: {}
84
- },
85
- emits: ["navigate"],
86
- setup(e, { emit: s }) {
87
- const r = s;
88
- return (n, o) => {
89
- const i = _("FmIcon"), m = _("FmButton"), b = _("FmCard");
90
- return l(), L(b, {
91
- variant: "outlined",
92
- class: "p-24 flex flex-col gap-14"
93
- }, {
94
- default: D(() => [
95
- t("div", ft, [
96
- t("div", bt, [
97
- u(i, {
98
- name: "info",
99
- outline: "",
100
- size: "sm",
101
- class: "!text-fm-color-primary"
102
- })
103
- ]),
104
- o[1] || (o[1] = t("div", { class: "fm-typo-en-body-md-600" }, "Action insight", -1))
105
- ]),
106
- e.insight ? (l(), p(F, { key: 0 }, [
107
- t("div", yt, [
108
- t("div", vt, d(e.insight.title), 1),
109
- t("div", gt, d(e.insight.body), 1)
110
- ]),
111
- t("div", ht, [
112
- o[2] || (o[2] = t("div", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-tertiary uppercase tracking-wide mb-1" }, " Suggested action ", -1)),
113
- u(m, {
114
- label: e.insight.action.label,
115
- "append-icon": "arrow_forward",
116
- class: "!justify-between",
117
- onClick: o[0] || (o[0] = (y) => r("navigate", e.insight.action.path))
118
- }, null, 8, ["label"])
119
- ]),
120
- t("div", xt, [
121
- o[3] || (o[3] = t("div", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-tertiary uppercase tracking-wide mb-1" }, " Supporting signal ", -1)),
122
- (l(!0), p(F, null, B(e.insight.signals, (y) => (l(), p("li", {
123
- key: y.text,
124
- class: "flex items-start gap-7"
125
- }, [
126
- t("ul", _t, d(y.text), 1)
127
- ]))), 128))
128
- ])
129
- ], 64)) : (l(), p("div", wt, " More member activity is needed before a clear action can be suggested. "))
130
- ]),
131
- _: 1
132
- });
133
- };
134
- }
135
- }), St = { class: "grid grid-cols-5 xs:grid-cols-2 gap-12" }, Rt = { class: "flex items-center gap-8" }, Ct = { class: "w-[30px] h-[30px] rounded-8 bg-[#FFF6EE] flex items-center justify-center flex-shrink-0" }, $t = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary flex-1 min-w-0" }, Ft = { class: "fm-typo-en-title-sm-800 text-fm-color-typo-primary whitespace-nowrap overflow-hidden text-ellipsis" }, Dt = {
136
- key: 0,
137
- class: "text-fm-color-typo-success fm-typo-en-body-sm-600 -mt-4"
138
- }, kt = { class: "flex items-center gap-4 flex-wrap" }, Pt = /* @__PURE__ */ I({
139
- __name: "KpiStrip",
140
- props: {
141
- kpis: {}
142
- },
143
- setup(e) {
144
- return (s, r) => {
145
- const n = _("FmIcon"), o = _("FmCard");
146
- return l(), p("section", St, [
147
- (l(!0), p(F, null, B(e.kpis, (i) => (l(), L(o, {
148
- key: i.label,
149
- variant: "outlined",
150
- class: "flex flex-col gap-8 p-16 min-w-0 overflow-hidden"
151
- }, {
152
- default: D(() => [
153
- t("div", Rt, [
154
- t("div", Ct, [
155
- u(n, {
156
- name: i.icon,
157
- outline: "",
158
- size: "sm",
159
- class: "!text-fm-color-primary"
160
- }, null, 8, ["name"])
161
- ]),
162
- t("span", $t, d(i.label), 1),
163
- u(T, {
164
- description: i.description
165
- }, null, 8, ["description"])
166
- ]),
167
- t("div", Ft, d(i.value), 1),
168
- i.sub ? (l(), p("div", Dt, d(i.sub), 1)) : U("", !0),
169
- t("div", kt, [
170
- i.delta !== "0%" && i.delta !== "0pp" ? (l(), L(n, {
171
- key: 0,
172
- name: i.trendUp ? "trending_up" : "trending_down",
173
- size: "xs",
174
- class: A(i.deltaClass)
175
- }, null, 8, ["name", "class"])) : U("", !0),
176
- t("span", {
177
- class: A(["fm-typo-en-body-sm-600", i.deltaClass])
178
- }, d(i.delta), 3),
179
- r[0] || (r[0] = t("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, "vs prev", -1))
180
- ])
181
- ]),
182
- _: 2
183
- }, 1024))), 128))
184
- ]);
185
- };
186
- }
187
- }), Lt = { class: "flex flex-col gap-4" }, At = ["onClick"], It = { class: "fm-typo-en-body-sm-600" }, Ot = { class: "fm-typo-en-body-md-600 min-w-[38px] text-right" }, Bt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary min-w-[34px] text-right" }, Tt = { class: "mt-14 pt-12 border-t border-fm-color-neutral-gray-100 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Et = /* @__PURE__ */ I({
188
- __name: "LifecycleSegments",
189
- props: {
190
- segments: {},
191
- summary: {},
192
- interactive: { type: Boolean, default: !0 }
193
- },
194
- emits: ["select"],
195
- setup(e, { emit: s }) {
196
- const r = e, n = s;
197
- return (o, i) => {
198
- const m = _("FmProgressBar"), b = _("FmCard");
199
- return l(), L(b, {
200
- variant: "outlined",
201
- class: "p-24"
202
- }, {
203
- default: D(() => [
204
- i[0] || (i[0] = t("div", { class: "flex items-center mb-16" }, [
205
- t("div", { class: "flex-1 fm-typo-en-body-md-600" }, "Member lifecycle")
206
- ], -1)),
207
- t("div", Lt, [
208
- (l(!0), p(F, null, B(r.segments, (y) => (l(), p("div", {
209
- key: y.id,
210
- class: A([
211
- "flex items-center gap-9 px-6 py-3 -mx-6 rounded-8",
212
- r.interactive ? "cursor-pointer hover:bg-fm-color-neutral-gray-100/50" : "cursor-default"
213
- ]),
214
- onClick: (v) => r.interactive && n("select", y.id)
215
- }, [
216
- t("div", {
217
- class: A(["flex w-[90px] flex-shrink-0 items-center gap-3", y.labelClass])
218
- }, [
219
- t("span", It, d(y.label), 1),
220
- u(T, {
221
- description: y.description
222
- }, null, 8, ["description"])
223
- ], 2),
224
- u(m, {
225
- class: "flex-1",
226
- value: y.barPct,
227
- color: y.barColor,
228
- size: "lg"
229
- }, null, 8, ["value", "color"]),
230
- t("span", Ot, d(y.countStr), 1),
231
- t("span", Bt, d(y.pctStr), 1)
232
- ], 10, At))), 128))
233
- ]),
234
- t("div", Tt, d(r.summary), 1)
235
- ]),
236
- _: 1
237
- });
238
- };
239
- }
240
- }), Nt = { class: "flex items-start gap-8 mb-12" }, Ut = { class: "flex-1" }, Vt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, qt = {
241
- key: 0,
242
- class: "flex items-start pl-[152px] xs:pl-0 xs:justify-center"
243
- }, Ht = { class: "flex flex-col items-start" }, zt = { class: "flex items-center gap-8" }, Yt = {
244
- key: 0,
245
- class: "fm-typo-en-body-sm-600 text-fm-color-typo-warning bg-fm-color-system-warning-100 px-8 py-[2px] rounded-xxxl whitespace-nowrap"
246
- }, jt = ["onClick"], Gt = { class: "min-w-0" }, Jt = { class: "flex items-center gap-3 fm-typo-en-body-sm-600" }, Kt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, Wt = { class: "min-w-0 text-right" }, Qt = { class: "fm-typo-en-body-lg-600" }, Xt = {
247
- key: 0,
248
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary"
249
- }, Zt = { class: "mt-12 pt-12 border-t border-fm-color-neutral-gray-100" }, er = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary text-right" }, tr = /* @__PURE__ */ I({
250
- __name: "MemberFunnel",
251
- props: {
252
- stages: {},
253
- footnote: {},
254
- interactive: { type: Boolean, default: !0 }
255
- },
256
- emits: ["select"],
257
- setup(e, { emit: s }) {
258
- const r = e, n = s;
259
- function o(i) {
260
- r.interactive && n("select", i);
261
- }
262
- return (i, m) => {
263
- const b = _("FmProgressBar"), y = _("FmCard");
264
- return l(), L(y, {
265
- variant: "outlined",
266
- class: "p-24"
267
- }, {
268
- default: D(() => [
269
- t("div", Nt, [
270
- t("div", Ut, [
271
- m[0] || (m[0] = t("div", { class: "fm-typo-en-body-md-600" }, "Member funnel", -1)),
272
- t("div", Vt, d(r.interactive ? "Strict member-only · visitors excluded · click any stage to drill down" : "Strict member-only · visitors excluded"), 1)
273
- ])
274
- ]),
275
- (l(!0), p(F, null, B(e.stages, (v, M) => (l(), p("div", {
276
- key: v.id
277
- }, [
278
- v.hasDropLine ? (l(), p("div", qt, [
279
- t("div", Ht, [
280
- m[1] || (m[1] = t("div", { class: "w-[1px] h-[4px] bg-fm-color-neutral-gray-100 ml-[9px]" }, null, -1)),
281
- t("div", zt, [
282
- t("span", {
283
- class: A(["fm-typo-en-body-sm-600 px-8 py-[2px] rounded-xxxl whitespace-nowrap", v.dropClass])
284
- }, d(v.conversionStr), 3),
285
- v.isBiggestDrop ? (l(), p("span", Yt, " biggest drop ")) : U("", !0)
286
- ]),
287
- m[2] || (m[2] = t("div", { class: "w-[1px] h-[4px] bg-fm-color-neutral-gray-100 ml-[9px]" }, null, -1))
288
- ])
289
- ])) : U("", !0),
290
- t("div", {
291
- class: A([
292
- "grid grid-cols-[140px_minmax(0,1fr)_72px] xs:grid-cols-[minmax(0,1fr)_auto] items-center gap-x-12 gap-y-8 py-4 px-8 -mx-8 rounded-md",
293
- r.interactive ? "cursor-pointer hover:bg-fm-color-neutral-gray-100/50" : ""
294
- ]),
295
- onClick: (S) => o(v.id)
296
- }, [
297
- t("div", Gt, [
298
- t("div", Jt, [
299
- t("span", null, d(v.label), 1),
300
- u(T, {
301
- description: v.description
302
- }, null, 8, ["description"])
303
- ]),
304
- t("div", Kt, d(v.desc), 1)
305
- ]),
306
- u(b, {
307
- class: "min-w-0 xs:col-span-2 xs:row-start-2",
308
- value: v.barWidthPct,
309
- color: v.barColor,
310
- size: "lg"
311
- }, null, 8, ["value", "color"]),
312
- t("div", Wt, [
313
- t("div", Qt, d(v.countStr), 1),
314
- v.hasConvRate ? (l(), p("div", Xt, d(v.convRateLabel), 1)) : U("", !0)
315
- ])
316
- ], 10, jt)
317
- ]))), 128)),
318
- t("div", Zt, [
319
- t("div", er, d(e.footnote), 1)
320
- ])
321
- ]),
322
- _: 1
323
- });
324
- };
325
- }
326
- }), rr = { class: "flex items-center gap-3 fm-typo-en-body-md-600 mb-4" }, sr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mb-16" }, or = { class: "grid grid-cols-2 xs:grid-cols-1 gap-16" }, ar = { class: "fm-typo-en-title-sm-800" }, nr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, ir = { class: "fm-typo-en-title-sm-800" }, lr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-4" }, dr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary mt-8" }, cr = { class: "mt-16 pt-12 border-t border-fm-color-neutral-gray-100 fm-typo-en-body-sm-400" }, mr = /* @__PURE__ */ I({
327
- __name: "MemberSpendComparison",
328
- props: {
329
- spend: {}
330
- },
331
- setup(e) {
332
- return (s, r) => {
333
- const n = _("FmProgressBar"), o = _("FmCard");
334
- return l(), L(o, {
335
- variant: "outlined",
336
- class: "p-24"
337
- }, {
338
- default: D(() => [
339
- t("div", rr, [
340
- r[0] || (r[0] = t("span", null, "Member vs. non-member spend", -1)),
341
- u(T, {
342
- description: e.spend.description
343
- }, null, 8, ["description"])
344
- ]),
345
- t("div", sr, d(e.spend.description), 1),
346
- t("div", or, [
347
- t("div", null, [
348
- r[1] || (r[1] = t("div", { class: "flex items-center gap-8 mb-8" }, [
349
- t("div", { class: "w-8 h-8 rounded-sm bg-fm-color-primary" }),
350
- t("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, "Member sales")
351
- ], -1)),
352
- t("div", ar, d(e.spend.memberSalesFmt), 1),
353
- t("div", nr, " avg " + d(e.spend.avgMemberSaleFmt) + " / order ", 1)
354
- ]),
355
- t("div", null, [
356
- r[2] || (r[2] = t("div", { class: "flex items-center gap-8 mb-8" }, [
357
- t("div", { class: "w-8 h-8 rounded-sm bg-fm-color-neutral-gray-200" }),
358
- t("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, "Non-member sales")
359
- ], -1)),
360
- t("div", ir, d(e.spend.nonMemberSalesFmt), 1),
361
- t("div", lr, " avg " + d(e.spend.avgNonMemberSaleFmt) + " / order ", 1)
362
- ])
363
- ]),
364
- u(n, {
365
- class: "mt-16",
366
- value: e.spend.memberSharePct,
367
- color: "primary",
368
- size: "md"
369
- }, null, 8, ["value"]),
370
- t("div", dr, " Members drive " + d(e.spend.memberSharePct) + "% of tracked sales ", 1),
371
- t("div", cr, d(e.spend.summary), 1)
372
- ]),
373
- _: 1
374
- });
375
- };
376
- }
377
- }), pr = { class: "flex items-center mb-16" }, ur = {
378
- key: 0,
379
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
380
- }, fr = {
381
- key: 1,
382
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
383
- }, br = { class: "grid grid-cols-3 gap-10 mb-16" }, yr = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mb-4 flex items-center gap-3" }, vr = { class: "fm-typo-en-title-sm-800" }, gr = { class: "flex flex-col gap-9" }, hr = { class: "flex-1 fm-typo-en-body-sm-400 whitespace-nowrap overflow-hidden text-ellipsis" }, xr = { class: "flex flex-shrink-0 items-center gap-3 fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, _r = { class: "w-[48px] h-4 bg-fm-color-neutral-gray-100 rounded-2 overflow-hidden flex-shrink-0" }, wr = {
384
- key: 3,
385
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
386
- }, Mr = /* @__PURE__ */ I({
387
- __name: "RewardPerformance",
388
- props: {
389
- kpis: {},
390
- topRewards: {},
391
- hasData: { type: Boolean },
392
- loading: { type: Boolean },
393
- error: { type: Boolean }
394
- },
395
- setup(e) {
396
- return (s, r) => {
397
- const n = _("FmCard");
398
- return l(), L(n, {
399
- variant: "outlined",
400
- class: "p-24"
401
- }, {
402
- default: D(() => [
403
- t("div", pr, [
404
- r[1] || (r[1] = t("div", { class: "flex-1 fm-typo-en-body-md-600" }, "Reward usage health", -1)),
405
- u(f(Me), {
406
- to: "/reward",
407
- class: "fm-typo-en-body-sm-600 text-fm-color-primary no-underline"
408
- }, {
409
- default: D(() => [...r[0] || (r[0] = [
410
- te(" All rewards ", -1)
411
- ])]),
412
- _: 1
413
- })
414
- ]),
415
- e.loading ? (l(), p("div", ur, " Loading reward usage data. ")) : e.error ? (l(), p("div", fr, " Unable to load reward usage data. ")) : e.hasData ? (l(), p(F, { key: 2 }, [
416
- t("div", br, [
417
- (l(!0), p(F, null, B(e.kpis, (o) => (l(), p("div", {
418
- key: o.label,
419
- class: "bg-[#FAFAFA] rounded-10 p-12"
420
- }, [
421
- t("div", yr, [
422
- t("span", null, d(o.label), 1),
423
- u(T, {
424
- description: o.description
425
- }, null, 8, ["description"])
426
- ]),
427
- t("div", vr, d(o.value), 1),
428
- o.delta ? (l(), p("div", {
429
- key: 0,
430
- class: A(["fm-typo-en-body-sm-600 mt-3", o.deltaClass])
431
- }, d(o.delta), 3)) : U("", !0)
432
- ]))), 128))
433
- ]),
434
- r[3] || (r[3] = t("div", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-tertiary uppercase tracking-wide mb-10" }, " Top used rewards ", -1)),
435
- t("div", gr, [
436
- (l(!0), p(F, null, B(e.topRewards, (o) => (l(), p("div", {
437
- key: o.name,
438
- class: "flex items-center gap-9"
439
- }, [
440
- r[2] || (r[2] = t("div", { class: "w-6 h-6 rounded-2 bg-fm-color-primary flex-shrink-0" }, null, -1)),
441
- t("span", hr, d(o.name), 1),
442
- t("span", xr, [
443
- te(d(o.count) + " ", 1),
444
- u(T, {
445
- description: o.description
446
- }, null, 8, ["description"])
447
- ]),
448
- t("div", _r, [
449
- t("div", {
450
- class: "h-full bg-fm-color-primary rounded-2",
451
- style: He({ width: o.barPct + "%" })
452
- }, null, 4)
453
- ])
454
- ]))), 128))
455
- ])
456
- ], 64)) : (l(), p("div", wr, " No reward usage data is available for this period. "))
457
- ]),
458
- _: 1
459
- });
460
- };
461
- }
462
- }), Sr = { class: "mb-6 flex items-center gap-3 fm-typo-en-body-md-600" }, Rr = { class: "flex items-baseline gap-10 mb-14 flex-wrap" }, Cr = { class: "fm-typo-en-title-lg-800" }, $r = /* @__PURE__ */ I({
463
- __name: "SalesTrendChart",
464
- props: {
465
- sales: {}
466
- },
467
- setup(e) {
468
- const s = e, r = w(() => [
469
- {
470
- label: "This period",
471
- data: s.sales.series,
472
- color: "#FF7823",
473
- fill: !0
474
- },
475
- {
476
- label: "Prev. period",
477
- data: s.sales.prevSeries,
478
- color: "#B2B3B6",
479
- dash: !0
480
- }
481
- ]), n = { display: !1 };
482
- return (o, i) => {
483
- const m = _("FmLineChart"), b = _("FmCard");
484
- return l(), L(b, {
485
- variant: "outlined",
486
- class: "p-24"
487
- }, {
488
- default: D(() => [
489
- t("div", Sr, [
490
- i[0] || (i[0] = t("span", null, "Member sales trend", -1)),
491
- u(T, {
492
- description: e.sales.description
493
- }, null, 8, ["description"])
494
- ]),
495
- t("div", Rr, [
496
- t("span", Cr, d(e.sales.totalFmt), 1),
497
- t("span", {
498
- class: A(["fm-typo-en-body-sm-600 px-9 py-3 rounded-full whitespace-nowrap", e.sales.deltaClass])
499
- }, d(e.sales.deltaStr), 3),
500
- i[1] || (i[1] = t("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, "vs prev. period", -1))
501
- ]),
502
- u(m, {
503
- datasets: f(r),
504
- "x-axis": { categories: e.sales.comparisonCategories },
505
- "x-cfg": n,
506
- "y-cfg": n,
507
- legend: { display: !1 },
508
- height: "80px"
509
- }, null, 8, ["datasets", "x-axis"]),
510
- i[2] || (i[2] = t("div", { class: "flex items-center gap-14 mt-10" }, [
511
- t("div", { class: "flex items-center gap-5" }, [
512
- t("div", { class: "w-14 h-2 bg-fm-color-primary rounded-1" }),
513
- t("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, "This period")
514
- ]),
515
- t("div", { class: "flex items-center gap-5" }, [
516
- t("div", { class: "w-14 border-t-[1.5px] border-dashed border-fm-color-neutral-gray-200" }),
517
- t("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, "Prev. period")
518
- ])
519
- ], -1))
520
- ]),
521
- _: 1
522
- });
523
- };
524
- }
525
- }), C = () => {
526
- const e = je.getBusinessId();
527
- if (!e) throw new Error("Invalid business ID");
528
- return Ge(`businesses/${e}/loyalty-dashboard`, {
529
- noIdRequired: !0
530
- });
531
- }, $ = {
532
- async readTotalMembers(e) {
533
- return R(
534
- await C().post(
535
- "metrics/total-members",
536
- e
537
- )
538
- );
539
- },
540
- async readActiveMembers(e) {
541
- return R(
542
- await C().post(
543
- "metrics/active-members",
544
- e
545
- )
546
- );
547
- },
548
- async readMemberSales(e) {
549
- return R(
550
- await C().post("metrics/member-sales", e)
551
- );
552
- },
553
- async readMemberSpendComparison(e) {
554
- return R(
555
- await C().post(
556
- "metrics/member-spend-comparison",
557
- e
558
- )
559
- );
560
- },
561
- async readMemberSalesTrend(e) {
562
- return R(
563
- await C().post(
564
- "metrics/member-sales-trend",
565
- e
566
- )
567
- );
568
- },
569
- async readRepeatRate(e) {
570
- return R(
571
- await C().post("metrics/repeat-rate", e)
572
- );
573
- },
574
- async readVoucherRedemptionRate(e) {
575
- return R(
576
- await C().post(
577
- "metrics/voucher-redemption-rate",
578
- e
579
- )
580
- );
581
- },
582
- async readMemberFunnel(e) {
583
- return R(
584
- await C().post(
585
- "metrics/member-funnel",
586
- e
587
- )
588
- );
589
- },
590
- async readMemberLifecycle(e) {
591
- return R(
592
- await C().post(
593
- "metrics/member-lifecycle",
594
- e
595
- )
596
- );
597
- },
598
- async readRewardUsageHealth(e) {
599
- return R(
600
- await C().post(
601
- "metrics/reward-usage-health",
602
- e
603
- )
604
- );
605
- }
606
- }, h = {
607
- totalMembers: "Distinct members recorded through the end of the selected period; the start date does not reduce this total.",
608
- activeMembers: "Distinct members with a completed member purchase or voucher redemption during the selected period.",
609
- memberSales: "Sum of nettTotal from member-linked bills included in the selected period.",
610
- repeatRate: "Repeat members divided by purchase members. Repeat members have purchase history before the selected period.",
611
- voucherRedemptionRate: "Repeat members who redeemed a voucher divided by repeat members.",
612
- purchasingMembers: "Distinct members with at least one completed member bill in the selected period.",
613
- repeatMembers: "Purchase members who also had purchase history before the selected period.",
614
- funnelRewardRedeemers: "Repeat members with counted reward activity in the selected period.",
615
- newlyJoined: "Members whose join date falls within the selected period.",
616
- frequent: "Existing members with repeated completed member bills in the selected period.",
617
- infrequent: "Existing members with limited completed member bills in the selected period.",
618
- atRisk: "Existing members with no selected-period purchase but a recent completed purchase.",
619
- dormant: "Existing members with no selected-period purchase and no recent completed purchase.",
620
- memberSalesTrend: "Daily member nett sales for the selected period compared with the selected comparison period.",
621
- rewardRedeemers: "Distinct members who used a counted VOUCHER, CREDIT, or POINT reward during the selected period; anonymous usage is excluded from the member count.",
622
- redemptionRate: "Reward redeemers divided by active members, where active members are members with purchase or reward activity during the selected period.",
623
- averageRewardUses: "Counted reward-use transactions divided by distinct reward redeemers.",
624
- memberSpendComparison: "Shows the value members bring — use it to make the case for growing membership"
625
- };
626
- function Fr(e, s, r = /* @__PURE__ */ new Date()) {
627
- const n = V.tz(r, s).endOf("day"), o = n.clone().startOf("day");
628
- return o.startOf("month"), [o.toISOString(), n.toISOString()];
629
- }
630
- function Dr(e, s) {
631
- return e.length ? e : s;
632
- }
633
- function kr(e) {
634
- return {
635
- dateRange: e.dateRange,
636
- compareDateRange: e.compareDateRange,
637
- restaurantIds: Dr(
638
- e.selectedLocationIds,
639
- e.locationIds
640
- ),
641
- timezone: e.timezone
642
- };
643
- }
644
- function we(e) {
645
- const [s, r] = e, n = V(r).diff(V(s)), o = V(s).subtract(1, "millisecond");
646
- return [o.clone().subtract(n, "milliseconds").toISOString(), o.toISOString()];
647
- }
648
- const J = (e) => ({
649
- total: 0,
650
- totalNew: 0,
651
- totalPrev: 0,
652
- active: 0,
653
- activePrev: 0,
654
- purchasing: 0,
655
- purchasingPrev: 0,
656
- repeat: 0,
657
- repeatPrev: 0,
658
- redeemers: 0,
659
- redeemersPrev: 0,
660
- memberSales: 0,
661
- memberSalesPrev: 0,
662
- series: Array(e).fill(0),
663
- prev: Array(e).fill(0)
664
- });
665
- J(20), J(7), J(30), J(12);
666
- const re = (e, s) => s ? Math.round(e / s * 1e3) / 10 : 0, Pr = (e, s) => s ? Math.round((e - s) / s * 1e3) / 10 : 0, q = (e) => e >= 1e3 ? (e / 1e3).toFixed(1).replace(/\.0$/, "") + "k" : String(e), O = (e, s) => tt(e).set({ currency: s }).toFormat(!0), Lr = [
667
- "neutral-black",
668
- "primary",
669
- "#FF9C52",
670
- "#FFB577",
671
- "#FFD0A3"
672
- ], se = {
673
- text: "text-fm-color-typo-success",
674
- bg: "bg-fm-color-system-success-100"
675
- }, Se = {
676
- text: "text-fm-color-typo-error",
677
- bg: "bg-fm-color-system-error-100"
678
- }, oe = {
679
- text: "text-fm-color-typo-warning",
680
- bg: "bg-fm-color-system-warning-100"
681
- };
682
- function Ar(e) {
683
- return e === 0 ? "text-fm-color-typo-secondary" : e > 0 ? se.text : Se.text;
684
- }
685
- function Ir(e) {
686
- const s = [
687
- {
688
- id: "total",
689
- label: "Total members",
690
- count: e.totalMembers,
691
- desc: "All members through period end",
692
- description: h.totalMembers,
693
- denom: null
694
- },
695
- {
696
- id: "active",
697
- label: "Active members",
698
- count: e.activeMembers,
699
- desc: "Purchase or reward activity",
700
- description: h.activeMembers,
701
- denom: e.totalMembers
702
- },
703
- {
704
- id: "purchasing",
705
- label: "Purchase members",
706
- count: e.purchasingMembers,
707
- desc: "At least 1 completed order",
708
- description: h.purchasingMembers,
709
- denom: e.activeMembers
710
- },
711
- {
712
- id: "repeat",
713
- label: "Repeat members",
714
- count: e.repeatMembers,
715
- desc: "Had prior order history",
716
- description: h.repeatMembers,
717
- denom: e.purchasingMembers
718
- },
719
- {
720
- id: "redeemers",
721
- label: "Reward redeemers",
722
- count: e.rewardRedeemers,
723
- desc: "Repeat member used reward",
724
- description: h.funnelRewardRedeemers,
725
- denom: e.repeatMembers
726
- }
727
- ], r = s.map(
728
- (m, b) => b === 0 || !m.denom ? null : re(m.count, m.denom)
729
- );
730
- let n = null, o = 100;
731
- return e.totalMembers > 0 && r.forEach((m, b) => {
732
- b > 0 && m !== null && m < o && (o = m, n = b);
733
- }), {
734
- funnelStages: s.map((m, b) => {
735
- const y = r[b], v = b === n;
736
- return {
737
- id: m.id,
738
- label: m.label,
739
- desc: m.desc,
740
- description: m.description,
741
- countStr: q(m.count),
742
- conversionStr: y != null ? `${y}% convert` : "",
743
- convRateLabel: y != null ? `${y}% of prev` : "",
744
- hasConvRate: b > 0,
745
- hasDropLine: b > 0,
746
- isBiggestDrop: v,
747
- barColor: Lr[b] ?? "#FFD0A3",
748
- barWidthPct: e.totalMembers > 0 && m.count > 0 ? Math.max(re(m.count, e.totalMembers), 1) : 0,
749
- dropClass: v ? `${oe.text} bg-[#FFF0E2]` : "text-fm-color-typo-secondary bg-fm-color-neutral-gray-100"
750
- };
751
- }),
752
- funnelFootnote: `${e.totalMembers.toLocaleString()} total members`,
753
- convRates: r,
754
- biggestDropIdx: n
755
- };
756
- }
757
- function Or(e) {
758
- const { funnelStages: s, funnelFootnote: r } = Ir(e);
759
- return { funnelStages: s, funnelFootnote: r };
760
- }
761
- const Br = 10;
762
- function Tr(e) {
763
- const s = [
764
- {
765
- source: e.totalMembers,
766
- target: e.activeMembers,
767
- title: "Many members are not active",
768
- body: "Members who joined may benefit from a reactivation campaign.",
769
- action: {
770
- label: "Create reactivation campaign",
771
- path: "/campaign/promotion"
772
- }
773
- },
774
- {
775
- source: e.activeMembers,
776
- target: e.purchasingMembers,
777
- title: "Active members are not purchasing",
778
- body: "Active members may benefit from a review of purchase incentives.",
779
- action: {
780
- label: "Review purchase incentives",
781
- path: "/campaign/promotion"
782
- }
783
- },
784
- {
785
- source: e.purchasingMembers,
786
- target: e.repeatMembers,
787
- title: "Members are not returning after a purchase",
788
- body: "Members who purchase once may benefit from a retention campaign.",
789
- action: {
790
- label: "Create retention campaign",
791
- path: "/campaign/promotion"
792
- }
793
- },
794
- {
795
- source: e.repeatMembers,
796
- target: e.rewardRedeemers,
797
- title: "Repeat members are not using rewards",
798
- body: "Repeat members may benefit from a review of reward setup.",
799
- action: {
800
- label: "Review reward setup",
801
- path: "/reward"
802
- }
803
- }
804
- ];
805
- let r = null;
806
- for (const o of s)
807
- o.source < Br || o.target >= o.source || (!r || o.target / o.source < r.target / r.source) && (r = o);
808
- if (!r) return null;
809
- const n = Math.round(r.target / r.source * 1e3) / 10;
810
- return {
811
- title: r.title,
812
- body: `${n}% of this stage progressed in the selected period. ${r.body}`,
813
- action: r.action,
814
- signals: [
815
- {
816
- text: `${r.target.toLocaleString()} of ${r.source.toLocaleString()} members progressed`
817
- }
818
- ]
819
- };
820
- }
821
- const Er = {
822
- VOUCHER: "Voucher",
823
- PROMOTION: "Promotion",
824
- POINT: "Experience",
825
- CREDIT: "Credit",
826
- BROADCAST: "Broadcast",
827
- COIN: "Point",
828
- REWARD_POOL: "Reward pool",
829
- GAME: "Game",
830
- MISSION: "Mission"
831
- }, Nr = {
832
- active: { label: "Active", class: se.text },
833
- expired: { label: "Ended", class: "text-fm-color-typo-tertiary" },
834
- upcoming: { label: "Upcoming", class: oe.text }
835
- };
836
- function Ur(e) {
837
- return e.type !== "MEMBERSHIP";
838
- }
839
- function Vr(e, s) {
840
- var r;
841
- return !s.length || !((r = e.targetLocation) != null && r.length) ? !0 : e.targetLocation.some(
842
- (n) => s.includes(n.toString())
843
- );
844
- }
845
- function qr(e) {
846
- var s;
847
- if (((s = e.timeframeOptions) == null ? void 0 : s.type) === "timeframe") {
848
- const r = V();
849
- return r.isBetween(
850
- e.timeframeOptions.start ?? r.clone().subtract(1, "d"),
851
- e.timeframeOptions.end ?? r.clone().add(1, "d")
852
- ) ? "active" : r.isAfter(e.timeframeOptions.end) ? "expired" : "upcoming";
853
- }
854
- return "active";
855
- }
856
- function Hr(e, s) {
857
- return e.filter(Ur).filter(
858
- (r) => Vr(r, s)
859
- ).map((r) => {
860
- const n = qr(r), o = Nr[n], i = r.type === "BROADCAST";
861
- return {
862
- id: r._id.toString(),
863
- name: r.name,
864
- type: Er[r.type] ?? r.type,
865
- status: o.label,
866
- metric: i ? String(r.currentReceive ?? 0) : o.label,
867
- metricLabel: i ? "Messages sent" : "Status",
868
- statusClass: o.class
869
- };
870
- }).sort(
871
- (r, n) => +(n.status === "Active") - +(r.status === "Active")
872
- ).slice(0, 4);
873
- }
874
- function zr(e, s) {
875
- return {
876
- categories: e.categories,
877
- prevCategories: e.prevCategories,
878
- comparisonCategories: e.categories.map(
879
- (r, n) => [r, e.prevCategories[n]].filter(Boolean).map((o) => V(o).format("DD/MM/YYYY")).join(" vs ")
880
- ),
881
- series: e.series,
882
- prevSeries: e.prevSeries,
883
- description: h.memberSalesTrend,
884
- totalFmt: O(e.memberSales, s),
885
- deltaStr: `${e.deltaPct > 0 ? "+" : ""}${e.deltaPct}%`,
886
- deltaClass: Ar(e.deltaPct)
887
- };
888
- }
889
- function Yr(e, s, r, n) {
890
- return !e.memberOrders && !e.nonMemberOrders ? "No completed orders were recorded in this period." : r === 0 && s > 0 ? "Members account for all tracked spend in this period." : s === 0 && r > 0 ? "Non-members account for all tracked spend in this period." : n > 0 ? `Members spend ${n}% more per order than non-members. Converting more walk-ins to members is a direct lever on sales.` : n < 0 ? `Non-members spend ${Math.abs(n)}% more per order than members. Converting more walk-ins to members can increase member-linked sales.` : "Members and non-members have the same average order value in this period.";
891
- }
892
- function jr(e, s) {
893
- const r = e.memberOrders ? e.memberSales / e.memberOrders : 0, n = e.nonMemberOrders ? e.nonMemberSales / e.nonMemberOrders : 0, o = e.memberSales + e.nonMemberSales, i = Pr(r, n);
894
- return {
895
- description: h.memberSpendComparison,
896
- memberSalesFmt: O(e.memberSales, s),
897
- nonMemberSalesFmt: O(e.nonMemberSales, s),
898
- avgMemberSaleFmt: O(r, s),
899
- avgNonMemberSaleFmt: O(n, s),
900
- memberSharePct: re(e.memberSales, o),
901
- avgGapPct: i,
902
- summary: Yr(
903
- e,
904
- r,
905
- n,
906
- i
907
- )
908
- };
909
- }
910
- function Gr(e) {
911
- const s = e.criteria ? {
912
- ...h,
913
- frequent: `Existing members with at least ${e.criteria.frequentMinBills} completed member bills in the selected period.`,
914
- infrequent: `Existing members with 1 to ${e.criteria.frequentMinBills - 1} completed member bills in the selected period.`,
915
- atRisk: `Existing members with no selected-period purchase but a completed purchase in the prior ${e.criteria.atRiskLookbackDays} calendar days.`,
916
- dormant: `Existing members with no selected-period purchase and no completed purchase in the prior ${e.criteria.atRiskLookbackDays} calendar days.`
917
- } : h, r = [
918
- {
919
- id: "new",
920
- label: "Newly joined",
921
- count: e.newlyJoined,
922
- description: h.newlyJoined,
923
- labelClass: se.text,
924
- barColor: "typo-success"
925
- },
926
- {
927
- id: "frequent",
928
- label: "Frequent",
929
- count: e.frequent,
930
- description: s.frequent,
931
- labelClass: "text-fm-color-primary",
932
- barColor: "primary"
933
- },
934
- {
935
- id: "infrequent",
936
- label: "Infrequent",
937
- count: e.infrequent,
938
- description: s.infrequent,
939
- labelClass: "text-fm-color-typo-secondary",
940
- barColor: "neutral-gray-300"
941
- },
942
- {
943
- id: "at-risk",
944
- label: "At-risk",
945
- count: e.atRisk,
946
- description: s.atRisk,
947
- labelClass: oe.text,
948
- barColor: "#FFC746"
949
- },
950
- {
951
- id: "dormant",
952
- label: "Dormant",
953
- count: e.dormant,
954
- description: s.dormant,
955
- labelClass: Se.text,
956
- barColor: "#FFCFCC"
957
- }
958
- ], n = Math.max(...r.map((i) => i.count), 1);
959
- return {
960
- lifecycleSegs: r.map((i) => ({
961
- ...i,
962
- barPct: Math.round(i.count / n * 100),
963
- pctStr: `${e.totalMembers ? Math.round(i.count / e.totalMembers * 100) : 0}%`,
964
- countStr: q(i.count)
965
- })),
966
- lifecycleSummary: `${q(
967
- e.atRisk + e.dormant
968
- )} members are at-risk or dormant`
969
- };
970
- }
971
- function Jr(e) {
972
- return Gr(e);
973
- }
974
- function Kr(e, s) {
975
- return e.displayUnit === "uses" ? `${q(e.displayValue)} ${e.displayValue === 1 ? "use" : "uses"}` : e.type === "COIN" ? `${q(e.displayValue)} pts` : O(e.displayValue, s);
976
- }
977
- function Wr(e) {
978
- return e.displayUnit === "uses" ? "Counted voucher-use transactions for this reward during the selected period." : `Total ${e.type === "COIN" ? "point" : e.type.toLowerCase()} amount used for this reward during the selected period.`;
979
- }
980
- function Qr(e, s) {
981
- const r = Math.max(
982
- ...e.topRewards.map((n) => n.usageCount),
983
- 1
984
- );
985
- return {
986
- rewardKpis: [
987
- {
988
- label: "Reward redeemers",
989
- value: q(e.rewardRedeemers),
990
- description: h.rewardRedeemers
991
- },
992
- {
993
- label: "Redemption rate",
994
- value: `${e.redemptionRatePct}%`,
995
- description: h.redemptionRate
996
- },
997
- {
998
- label: "Avg reward uses",
999
- value: `${e.averageRewardUsesPerRedeemer}x`,
1000
- description: h.averageRewardUses
1001
- }
1002
- ],
1003
- topRewards: e.topRewards.map((n) => ({
1004
- name: n.name,
1005
- count: Kr(n, s),
1006
- description: Wr(n),
1007
- barPct: n.usageCount ? Math.round(n.usageCount / r * 100) : 0
1008
- }))
1009
- };
1010
- }
1011
- const Xr = { class: "px-24 flex flex-col gap-16 pb-24" }, Zr = { class: "flex items-center justify-between gap-8 flex-wrap" }, es = { class: "flex items-center gap-8 flex-wrap" }, ts = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary -mt-8 text-right" }, rs = { class: "grid grid-cols-[3fr_2fr] xs:grid-cols-1 gap-16 items-start" }, ss = { class: "grid grid-cols-2 xs:grid-cols-1 gap-16" }, gs = /* @__PURE__ */ I({
1012
- __name: "LoyaltyDashboard",
1013
- setup(e) {
1014
- const s = Ze(), r = et(), n = Ke(), { global: o, minor: i } = Xe, m = w(
1015
- () => _e[r.currentCountry.value || "MY"] ?? _e.MY
1016
- ), b = w(
1017
- () => Je.Country.getCountry(r.currentCountry.value || "MY").currency.code
1018
- ), [y, v] = Fr(
1019
- "this-month",
1020
- m.value
1021
- ), M = x({
1022
- startDate: y,
1023
- endDate: v
1024
- }), S = x(
1025
- me(we([y, v]))
1026
- ), H = x({ location: [] }), K = x(s.locations.length > 0), ae = x(!1), ne = x(0), ie = x({}), z = x(null), le = x(null), de = x(null), ce = x(null), W = x(null), Y = x(!1), j = x(!1), Q = x([]), X = x(!1), Z = x(!1);
1027
- function me([a, c]) {
1028
- return { startDate: a, endDate: c };
1029
- }
1030
- ge(M, (a) => {
1031
- a.startDate && a.endDate && (S.value = me(
1032
- we([a.startDate, a.endDate])
1033
- ));
1034
- });
1035
- const pe = w(
1036
- () => Or(
1037
- z.value ?? {
1038
- totalMembers: 0,
1039
- activeMembers: 0,
1040
- purchasingMembers: 0,
1041
- repeatMembers: 0,
1042
- rewardRedeemers: 0
1043
- }
1044
- )
1045
- ), ue = w(
1046
- () => Jr(
1047
- le.value ?? {
1048
- totalMembers: 0,
1049
- newlyJoined: 0,
1050
- frequent: 0,
1051
- infrequent: 0,
1052
- atRisk: 0,
1053
- dormant: 0
1054
- }
1055
- )
1056
- ), Re = w(
1057
- () => zr(
1058
- de.value ?? {
1059
- categories: [""],
1060
- prevCategories: [""],
1061
- series: [0],
1062
- prevSeries: [0],
1063
- description: h.memberSalesTrend,
1064
- memberSales: 0,
1065
- deltaPct: 0
1066
- },
1067
- b.value
1068
- )
1069
- ), Ce = w(
1070
- () => z.value ? Tr(z.value) : null
1071
- ), ee = w(
1072
- () => W.value ? Qr(W.value, b.value) : null
1073
- ), $e = w(
1074
- () => jr(
1075
- ce.value ?? {
1076
- memberSales: 0,
1077
- memberOrders: 0,
1078
- nonMemberSales: 0,
1079
- nonMemberOrders: 0
1080
- },
1081
- b.value
1082
- )
1083
- ), Fe = w(
1084
- () => Hr(Q.value, H.value.location)
1085
- ), De = w(() => {
1086
- const a = ie.value;
1087
- return [
1088
- {
1089
- label: "Total members",
1090
- value: be(a.totalMembers ?? 0),
1091
- description: h.totalMembers,
1092
- icon: "group",
1093
- delta: "0%"
1094
- },
1095
- {
1096
- label: "Active members",
1097
- value: be(a.activeMembers ?? 0),
1098
- description: h.activeMembers,
1099
- icon: "bolt",
1100
- delta: "0%"
1101
- },
1102
- {
1103
- label: "Member sales",
1104
- value: O(a.memberSales ?? 0, b.value),
1105
- description: h.memberSales,
1106
- icon: "payments",
1107
- delta: "0%"
1108
- },
1109
- {
1110
- label: "Repeat rate",
1111
- value: ye(a.repeatRatePct ?? 0),
1112
- description: h.repeatRate,
1113
- icon: "repeat",
1114
- delta: "0pp"
1115
- },
1116
- {
1117
- label: "Voucher redemption rate",
1118
- value: ye(a.voucherRedemptionRatePct ?? 0),
1119
- description: h.voucherRedemptionRate,
1120
- icon: "redeem",
1121
- delta: "0pp"
1122
- }
1123
- ].map(
1124
- (g) => ({
1125
- ...g,
1126
- sub: null,
1127
- deltaClass: "text-fm-color-typo-secondary",
1128
- trendUp: !0
1129
- })
1130
- );
1131
- }), ke = w(
1132
- () => s.locations.map((a) => a._id.toString())
1133
- );
1134
- function fe(a) {
1135
- return !a.startDate || !a.endDate ? "" : `${he(a.startDate).format("D MMM")} – ${he(a.endDate).format("D MMM YYYY")}`;
1136
- }
1137
- const Pe = w(() => fe(M.value)), Le = w(
1138
- () => fe(S.value)
1139
- );
1140
- function be(a) {
1141
- return a >= 1e3 ? `${(a / 1e3).toFixed(1).replace(/\.0$/, "")}k` : String(a);
1142
- }
1143
- function ye(a) {
1144
- return `${Math.round(a * 10) / 10}%`;
1145
- }
1146
- function Ae(a) {
1147
- if (a && typeof a == "object" && "value" in a && Number.isFinite(Number(a.value)))
1148
- return Number(a.value);
1149
- }
1150
- function Ie() {
1151
- return !M.value.startDate || !M.value.endDate || !S.value.startDate || !S.value.endDate || !K.value ? null : kr({
1152
- dateRange: [M.value.startDate, M.value.endDate],
1153
- compareDateRange: [
1154
- S.value.startDate,
1155
- S.value.endDate
1156
- ],
1157
- selectedLocationIds: H.value.location,
1158
- locationIds: ke.value,
1159
- timezone: m.value
1160
- });
1161
- }
1162
- function k(a) {
1163
- return a === ne.value;
1164
- }
1165
- async function E(a, c, g) {
1166
- try {
1167
- await a(c, g);
1168
- } catch (N) {
1169
- if (k(g)) throw N;
1170
- }
1171
- }
1172
- async function Oe(a, c) {
1173
- const [
1174
- g,
1175
- N,
1176
- G,
1177
- P,
1178
- qe
1179
- ] = await Promise.all([
1180
- $.readTotalMembers(a),
1181
- $.readActiveMembers(a),
1182
- $.readMemberSales(a),
1183
- $.readRepeatRate(a),
1184
- $.readVoucherRedemptionRate(a)
1185
- ]);
1186
- k(c) && (ie.value = {
1187
- totalMembers: Ae(g),
1188
- activeMembers: N.activeMembers,
1189
- memberSales: G.memberSales,
1190
- repeatRatePct: P.repeatRatePct,
1191
- voucherRedemptionRatePct: qe.voucherRedemptionRatePct
1192
- });
1193
- }
1194
- async function Be(a, c) {
1195
- const g = await $.readMemberFunnel(a);
1196
- k(c) && (z.value = g);
1197
- }
1198
- async function Te(a, c) {
1199
- const g = await $.readMemberLifecycle(a);
1200
- k(c) && (le.value = g);
1201
- }
1202
- async function Ee(a, c) {
1203
- const g = await $.readMemberSalesTrend(a);
1204
- k(c) && (de.value = g);
1205
- }
1206
- async function Ne(a, c) {
1207
- const g = await $.readMemberSpendComparison(a);
1208
- k(c) && (ce.value = g);
1209
- }
1210
- async function Ue(a, c) {
1211
- Y.value = !0, j.value = !1;
1212
- try {
1213
- const g = await $.readRewardUsageHealth(a);
1214
- if (!k(c)) return;
1215
- W.value = g;
1216
- } catch (g) {
1217
- throw k(c) && (j.value = !0), g;
1218
- } finally {
1219
- k(c) && (Y.value = !1);
1220
- }
1221
- }
1222
- async function Ve() {
1223
- X.value = !0, Z.value = !1;
1224
- try {
1225
- const { resources: a } = await We.readAll({
1226
- limit: 1e3,
1227
- skip: 0,
1228
- sortBy: "_id",
1229
- descending: !0
1230
- });
1231
- Q.value = a;
1232
- } catch (a) {
1233
- throw Z.value = !0, a;
1234
- } finally {
1235
- X.value = !1;
1236
- }
1237
- }
1238
- function ve() {
1239
- const a = ++ne.value, c = Ie();
1240
- if (!c) {
1241
- Y.value = !1, j.value = !1;
1242
- return;
1243
- }
1244
- i(
1245
- () => E(Oe, c, a)
1246
- ).catch(() => {
1247
- }), i(
1248
- () => E(Be, c, a)
1249
- ).catch(() => {
1250
- }), i(
1251
- () => E(Te, c, a)
1252
- ).catch(() => {
1253
- }), i(
1254
- () => E(Ee, c, a)
1255
- ).catch(() => {
1256
- }), i(
1257
- () => E(
1258
- Ne,
1259
- c,
1260
- a
1261
- )
1262
- ).catch(() => {
1263
- }), i(
1264
- () => E(Ue, c, a)
1265
- ).catch(() => {
1266
- });
1267
- }
1268
- return ge([M, S, () => H.value.location], () => {
1269
- ae.value && ve();
1270
- }), ze(async () => {
1271
- await o(async () => {
1272
- K.value || await s.readLocations(), K.value = !0;
1273
- }), await Ye(), ae.value = !0, ve(), Ve().catch(() => {
1274
- Q.value = [];
1275
- });
1276
- }), (a, c) => {
1277
- var N, G;
1278
- const g = _("FmPageHead");
1279
- return l(), p(F, null, [
1280
- u(g, { title: "Analytic" }),
1281
- t("div", Xr, [
1282
- t("div", Zr, [
1283
- u(Qe, {
1284
- label: "Location: ",
1285
- "right-icon": "keyboard_arrow_down",
1286
- modelValue: f(H).location,
1287
- "onUpdate:modelValue": c[0] || (c[0] = (P) => f(H).location = P),
1288
- icon: "storefront",
1289
- "show-item-label": !0,
1290
- items: f(s).locationOptions
1291
- }, null, 8, ["modelValue", "items"]),
1292
- t("div", es, [
1293
- u(xe, {
1294
- "model-value": f(M),
1295
- "onUpdate:modelValue": c[1] || (c[1] = (P) => M.value = P)
1296
- }, null, 8, ["model-value"]),
1297
- c[4] || (c[4] = t("span", { class: "fm-typo-en-body-sm-600 text-fm-color-typo-tertiary" }, "vs", -1)),
1298
- u(xe, {
1299
- "model-value": f(S),
1300
- "onUpdate:modelValue": c[2] || (c[2] = (P) => S.value = P)
1301
- }, null, 8, ["model-value"])
1302
- ])
1303
- ]),
1304
- t("div", ts, d(f(Pe)) + " · vs. " + d(f(Le)), 1),
1305
- u(Pt, { kpis: f(De) }, null, 8, ["kpis"]),
1306
- t("section", rs, [
1307
- u(tr, {
1308
- stages: f(pe).funnelStages,
1309
- footnote: f(pe).funnelFootnote,
1310
- interactive: !1
1311
- }, null, 8, ["stages", "footnote"]),
1312
- u(Mt, {
1313
- insight: f(Ce),
1314
- onNavigate: c[3] || (c[3] = (P) => f(n).push(P))
1315
- }, null, 8, ["insight"])
1316
- ]),
1317
- t("section", ss, [
1318
- u(Et, {
1319
- segments: f(ue).lifecycleSegs,
1320
- summary: f(ue).lifecycleSummary,
1321
- interactive: !1
1322
- }, null, 8, ["segments", "summary"]),
1323
- u(Mr, {
1324
- kpis: ((N = f(ee)) == null ? void 0 : N.rewardKpis) ?? [],
1325
- "top-rewards": ((G = f(ee)) == null ? void 0 : G.topRewards) ?? [],
1326
- "has-data": !!f(ee),
1327
- loading: f(Y),
1328
- error: f(j)
1329
- }, null, 8, ["kpis", "top-rewards", "has-data", "loading", "error"]),
1330
- u($r, { sales: f(Re) }, null, 8, ["sales"]),
1331
- u(ut, {
1332
- campaigns: f(Fe),
1333
- loading: f(X),
1334
- error: f(Z)
1335
- }, null, 8, ["campaigns", "loading", "error"]),
1336
- u(mr, { spend: f($e) }, null, 8, ["spend"])
1337
- ])
1338
- ])
1339
- ], 64);
1340
- };
1341
- }
1342
- });
1343
- export {
1344
- gs as default
1345
- };