@feedmepos/mf-connect 0.1.0-beta.6 → 0.1.0-beta.60
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.
- package/dist/Analytic-CXegtSEd.js +427 -0
- package/dist/{App-C2616cfr.js → App-m9A9s3wd.js} +445 -420
- package/dist/AuditLogs-CpUOkyXq.js +1886 -0
- package/dist/Bin-m6mPl3FE.js +166 -0
- package/dist/{Broadcast-CqSwLTAq.js → Broadcast-DNjHnlPp.js} +56 -54
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DrR9Pmtb.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-cjdNZLkE.js} +6 -8
- package/dist/Card-CAvS5aaN.js +896 -0
- package/dist/Collections-3C9I2byH.js +459 -0
- package/dist/{Credit-CPcLgnsq.js → Credit-DcAmLeMb.js} +36 -34
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-wGFMCV-y.js +2181 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-D2buK6Dj.js → EffectSheet.vue_vue_type_style_index_0_lang-CIEn1N24.js} +6 -6
- package/dist/{Experience-BoBikt-x.js → Experience-GF9yOrlE.js} +32 -30
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
- package/dist/{Game-DR8PyYZa.js → Game-CzBn_Li3.js} +39 -37
- package/dist/Index-Bhmkdb4n.js +259 -0
- package/dist/Marketing-DlbcOoiN.js +20071 -0
- package/dist/Member-CdXG5uEN.js +317 -0
- package/dist/MemberList-xIOXAHJf.js +1598 -0
- package/dist/MemberTransactions-CsW9vso0.js +45 -0
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DhtIZCjT.js → MessageInput.vue_vue_type_script_setup_true_lang-jtjk9NjI.js} +83 -71
- package/dist/{Mission-CMpvz9zN.js → Mission-2UjKrmGe.js} +101 -87
- package/dist/Overview-ClittdS6.js +1078 -0
- package/dist/{Point-DkZn6p9s.js → Point-BON4g7zE.js} +55 -53
- package/dist/{Promotion-B7YzwPc_.js → Promotion-qUEZmmm8.js} +65 -57
- package/dist/Queue-DA4glGdE.js +244 -0
- package/dist/Record-EUAnp1--.js +340 -0
- package/dist/Reward-ChbsdQuW.js +442 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CUFw56sf.js +150 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BKesht7Y.js +1637 -0
- package/dist/Segment-DbwFx6vD.js +568 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-lwpYOWMR.js +181 -0
- package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-BbuOPEGY.js +147 -0
- package/dist/Setting-FMTftvlU.js +1931 -0
- package/dist/Store-BkUwiBUq.js +1751 -0
- package/dist/{StoreRewards-6BzVwZqr.js → StoreRewards-Z8uhK0v1.js} +33 -32
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DwFYJ1Iz.js +943 -0
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-B6cAveco.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D6mrJp05.js} +1 -1
- package/dist/{Tier-CW-46oJS.js → Tier-COCmcJJF.js} +327 -318
- package/dist/{Title-CE9rWVdi.js → Title-7qCjbur9.js} +199 -184
- package/dist/{Transaction-B21RrC4M.js → Transaction-9FS_K2hv.js} +2 -2
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Fx-J2gcK.js +130 -0
- package/dist/Voucher-Dx70JAgw.js +354 -0
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-CECJsKRJ.js +419 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BiVZwBuG.js → ZodTextField.vue_vue_type_script_setup_true_lang-Bne_nxYS.js} +1 -1
- package/dist/{app-CjhXHUQv.js → app-CWKpKW78.js} +1 -1
- package/dist/app-q6W6-faT.js +7059 -0
- package/dist/app.js +1 -1
- package/dist/{business-aHhRUXc0.js → business-D5AQBRGS.js} +1 -1
- package/dist/campaign-BGiM8ccX.js +1810 -0
- package/dist/{campaign-DH9NUNf_.js → campaign-v8MAkDo-.js} +2 -2
- package/dist/campaign.enum-Dro6UEcE.js +20 -0
- package/dist/campaign.fn-DsJUr-gE.js +758 -0
- package/dist/collectible.enum-BH9pX7PE.js +19 -0
- package/dist/{collection.fn-CYlsA-kW.js → collection.fn-CHiRShK_.js} +2 -2
- package/dist/dto-CeX9egUp.js +214 -0
- package/dist/{effect-LSc9YanX.js → effect-DtJQE1cD.js} +9 -9
- package/dist/email-addresses-DKOsgzML.js +705 -0
- package/dist/{export-Cf0-C5Ly.js → export-Daiv_zH9.js} +5 -5
- package/dist/{helper-CiZpeMCM.js → helper-B5Emawnj.js} +1 -1
- package/dist/index-9WBy0L7U.js +54 -0
- package/dist/{index-D6cEOHP4.js → index-BSHuLDD0.js} +1501 -1480
- package/dist/{index-BVb5-Ht8.js → index-CUl_8M_c.js} +259 -173
- package/dist/{index-gxwjKu3-.js → index-CgCcvX_L.js} +2212 -871
- package/dist/index-CsaQJMAR.js +66 -0
- package/dist/{index-D_83JP2i.js → index-DrWrGAHJ.js} +48 -4
- package/dist/index-DteeKoFo.js +115 -0
- package/dist/{index-DW3PRjPL.js → index-Dw2RtHKR.js} +1 -1
- package/dist/{index-kPhrD63q.js → index-ICbXrXiP.js} +1 -1
- package/dist/index-Xwc07I54.js +29000 -0
- package/dist/{index-DtsDOuDx.js → index-ZBSI6ViG.js} +24 -21
- package/dist/index-g9NNHS8s.js +32 -0
- package/dist/index-p6F08hhh.js +44 -0
- package/dist/index-vh86FiIQ.js +10 -0
- package/dist/{index.esm2017-B7oVYIbY.js → index.esm2017-B-SDA6Y2.js} +121 -121
- package/dist/loading-CDbkBsRr.js +71 -0
- package/dist/{membership-Dw1ylJ9Y.js → membership-B8uwuntJ.js} +54 -46
- package/dist/money-DRKB3Rpe.js +15 -0
- package/dist/number-DtyC1DJU.js +12 -0
- package/dist/objectid-wGrq9P1h.js +145 -0
- package/dist/{loading-7yq1tinq.js → plugins-DKNh-lBz.js} +3871 -3943
- package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
- package/dist/reward-C2jv5dmJ.js +36 -0
- package/dist/{rule-C0Q_SHow.js → rule-C5AMTchR.js} +180 -177
- package/dist/{rule-builder-iu17XIof.js → rule-builder-DLOGHT1l.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{template-CyOanTMu.js → template-C-fz1DXI.js} +5 -5
- package/dist/trigger-DTErX60D.js +144 -0
- package/dist/user-CVRoQGCF.js +54 -0
- package/dist/{vue-i18n-B0fLJH7a.js → vue-i18n-CxMxiW_u.js} +366 -366
- package/dist/{xlsx-BYO_bB9J.js → xlsx-CARvMJN_.js} +1 -1
- package/package.json +10 -6
- package/dist/Analytic-muDf0oMG.js +0 -622
- package/dist/Card-bhLoK0ZV.js +0 -825
- package/dist/Collections-DjtsAiol.js +0 -453
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-U_QZneS6.js +0 -2813
- package/dist/Marketing-Dny2nMUl.js +0 -316
- package/dist/Member-CP_smyk8.js +0 -69
- package/dist/MemberList-CR3eYI9p.js +0 -1733
- package/dist/MemberTransactions-RTx_lKFb.js +0 -38
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cs67_GLE.js +0 -1753
- package/dist/Segment-Bb4gHt5V.js +0 -437
- package/dist/Setting-Xj0AVzh3.js +0 -1901
- package/dist/Store-BWRHQ6Ie.js +0 -1511
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BsFnT8BS.js +0 -890
- package/dist/Voucher-KK9fBI0u.js +0 -490
- package/dist/app-Dvf_JNMf.js +0 -5764
- package/dist/dto-DArfyZAI.js +0 -2770
- package/dist/index-Bi_LGEtY.js +0 -99
- package/dist/index-CiQDG7Cm.js +0 -762
- package/dist/index-CuvNtC_M.js +0 -61
- package/dist/index-DQfjSSMF.js +0 -206
- package/dist/index-DcxssxPi.js +0 -29193
- package/dist/index-DqJVH2kv.js +0 -298
- package/dist/money-CPd0XTNv.js +0 -15
- package/dist/number-BgXY4un8.js +0 -12
- package/dist/user-Bm4KttFq.js +0 -37
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { defineComponent as X, ref as x, computed as H, resolveComponent as w, openBlock as b, createBlock as h, unref as t, isRef as Z, withCtx as A, createElementVNode as f, createVNode as d, createCommentVNode as k, createElementBlock as M, Fragment as Y, h as O, onMounted as q, toDisplayString as B } from "vue";
|
|
2
|
+
import { _ as z } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { useDialog as Q, components as L } from "@feedmepos/ui-library";
|
|
4
|
+
import { u as G } from "./loading-CDbkBsRr.js";
|
|
5
|
+
import { u as J, C as ee } from "./membership-B8uwuntJ.js";
|
|
6
|
+
import { f as j, p as te } from "./plugins-DKNh-lBz.js";
|
|
7
|
+
import { u as oe } from "./vue-i18n-CxMxiW_u.js";
|
|
8
|
+
import { c as ae } from "./object-qECH92oz.js";
|
|
9
|
+
import { Z as _ } from "./zod-Bg2FbC-D.js";
|
|
10
|
+
import "./index-BSHuLDD0.js";
|
|
11
|
+
import { F as N } from "./index-9WBy0L7U.js";
|
|
12
|
+
import { useCoreStore as le } from "@feedmepos/mf-common";
|
|
13
|
+
import { _ as ne, a as ie } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-CECJsKRJ.js";
|
|
14
|
+
import { b as re } from "./EffectSheet.vue_vue_type_style_index_0_lang-CIEn1N24.js";
|
|
15
|
+
import { J as K } from "./JsonViewer-v8_C7l5N.js";
|
|
16
|
+
import { _ as se } from "./ZodTextField.vue_vue_type_script_setup_true_lang-Bne_nxYS.js";
|
|
17
|
+
import { i as de } from "./helper-B5Emawnj.js";
|
|
18
|
+
import { u as pe, r as P } from "./reward-C2jv5dmJ.js";
|
|
19
|
+
import "./index-ICbXrXiP.js";
|
|
20
|
+
import { C as ce } from "./campaign.fn-DsJUr-gE.js";
|
|
21
|
+
import { e as me } from "./effect-DtJQE1cD.js";
|
|
22
|
+
import { useRouter as ue } from "vue-router";
|
|
23
|
+
import { R as ye } from "./app-q6W6-faT.js";
|
|
24
|
+
const fe = { class: "flex gap-8 items-center justify-start" }, we = /* @__PURE__ */ X({
|
|
25
|
+
__name: "EditRewardSheet",
|
|
26
|
+
emits: ["update"],
|
|
27
|
+
setup(W, { expose: n, emit: I }) {
|
|
28
|
+
const p = J(), { minor: C } = G, v = x(!1), a = x({}), y = x(), R = H(() => {
|
|
29
|
+
var l;
|
|
30
|
+
return ((l = a.value.option) == null ? void 0 : l.collectibleType) === "CREDIT" ? N.superRefine((e, o) => {
|
|
31
|
+
var i, m, g, r;
|
|
32
|
+
!((m = (i = e.option) == null ? void 0 : i.validityOption) != null && m.validForDay) && !((r = (g = e.option) == null ? void 0 : g.validityOption) != null && r.validBefore) && o.addIssue({
|
|
33
|
+
code: "custom",
|
|
34
|
+
path: [],
|
|
35
|
+
message: "Credit validity must be set"
|
|
36
|
+
});
|
|
37
|
+
}) : N;
|
|
38
|
+
}), u = H(() => {
|
|
39
|
+
const l = R.value.safeParse(a.value);
|
|
40
|
+
return l.success ? [] : l.error.errors;
|
|
41
|
+
});
|
|
42
|
+
function F(l, e) {
|
|
43
|
+
l && (y.value = void 0, a.value = e), v.value = l;
|
|
44
|
+
}
|
|
45
|
+
const D = I;
|
|
46
|
+
async function S() {
|
|
47
|
+
const l = R.value.safeParse(a.value);
|
|
48
|
+
!l.success || !l.data || (await C(
|
|
49
|
+
async () => {
|
|
50
|
+
var e;
|
|
51
|
+
l.data.option.type === "VOUCHER" && y.value && (l.data.option.collectibleConfig.image = await j.update(
|
|
52
|
+
((e = l.data.option.collectibleConfig) == null ? void 0 : e.image) || j.collectibleImagePath(void 0, y.value),
|
|
53
|
+
y.value
|
|
54
|
+
));
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
message: "Uploading reward image",
|
|
58
|
+
successMessage: "Reward image updated"
|
|
59
|
+
}
|
|
60
|
+
), D("update", l.data));
|
|
61
|
+
}
|
|
62
|
+
function T(l) {
|
|
63
|
+
l === "VOUCHER" ? a.value.option = {
|
|
64
|
+
collectible: null,
|
|
65
|
+
type: "VOUCHER",
|
|
66
|
+
collectibleConfig: de("VOUCHER", {
|
|
67
|
+
business: le().currentBusiness.value._id
|
|
68
|
+
}),
|
|
69
|
+
earningOption: {
|
|
70
|
+
amount: 1,
|
|
71
|
+
type: "FIXED"
|
|
72
|
+
},
|
|
73
|
+
validityOption: {
|
|
74
|
+
validForDay: 7
|
|
75
|
+
}
|
|
76
|
+
} : a.value.option = {
|
|
77
|
+
collectible: p.loyaltyRewards.raw[0]._id,
|
|
78
|
+
collectibleType: p.loyaltyRewards.raw[0].type,
|
|
79
|
+
type: "LOYALTY",
|
|
80
|
+
earningOption: {
|
|
81
|
+
amount: 1,
|
|
82
|
+
type: "FIXED"
|
|
83
|
+
},
|
|
84
|
+
validityOption: {
|
|
85
|
+
validForDay: 7
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function $(l) {
|
|
90
|
+
a.value.option.collectible = l, a.value.option.collectibleType = p.loyaltyRewards.raw.find(
|
|
91
|
+
(e) => e._id === l
|
|
92
|
+
).type;
|
|
93
|
+
}
|
|
94
|
+
const V = x();
|
|
95
|
+
return n({
|
|
96
|
+
showSheet: F
|
|
97
|
+
}), (l, e) => {
|
|
98
|
+
const o = w("FmSelect"), i = w("FmForm"), m = w("FmButton"), g = w("FmSideSheet");
|
|
99
|
+
return b(), h(g, {
|
|
100
|
+
"max-width": 560,
|
|
101
|
+
modelValue: t(v),
|
|
102
|
+
"onUpdate:modelValue": [
|
|
103
|
+
e[8] || (e[8] = (r) => Z(v) ? v.value = r : null),
|
|
104
|
+
e[9] || (e[9] = (r) => v.value = r)
|
|
105
|
+
],
|
|
106
|
+
header: "Edit reward"
|
|
107
|
+
}, {
|
|
108
|
+
"side-sheet-footer": A(() => [
|
|
109
|
+
f("div", fe, [
|
|
110
|
+
d(m, {
|
|
111
|
+
variant: "primary",
|
|
112
|
+
type: "button",
|
|
113
|
+
label: "Confirm",
|
|
114
|
+
disabled: t(u).length > 0,
|
|
115
|
+
onClick: e[6] || (e[6] = (r) => S())
|
|
116
|
+
}, null, 8, ["disabled"]),
|
|
117
|
+
d(m, {
|
|
118
|
+
variant: "secondary",
|
|
119
|
+
type: "button",
|
|
120
|
+
label: "Cancel",
|
|
121
|
+
onClick: e[7] || (e[7] = (r) => v.value = !1)
|
|
122
|
+
})
|
|
123
|
+
])
|
|
124
|
+
]),
|
|
125
|
+
default: A(() => [
|
|
126
|
+
d(K, { json: t(a) }, null, 8, ["json"]),
|
|
127
|
+
d(i, {
|
|
128
|
+
class: "flex flex-col gap-y-24",
|
|
129
|
+
ref_key: "formRef",
|
|
130
|
+
ref: V,
|
|
131
|
+
onValidationSuccess: e[5] || (e[5] = (r) => S())
|
|
132
|
+
}, {
|
|
133
|
+
default: A(() => {
|
|
134
|
+
var r, E, c;
|
|
135
|
+
return [
|
|
136
|
+
d(se, {
|
|
137
|
+
modelValue: t(a).name,
|
|
138
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => t(a).name = s),
|
|
139
|
+
label: "Reward Name",
|
|
140
|
+
schema: t(_).typeAtPath(t(R), "name", []),
|
|
141
|
+
"error-text": t(_).helperText(t(u), "name")
|
|
142
|
+
}, null, 8, ["modelValue", "schema", "error-text"]),
|
|
143
|
+
d(o, {
|
|
144
|
+
label: "Reward Type",
|
|
145
|
+
disabled: !!t(a)._id,
|
|
146
|
+
items: [
|
|
147
|
+
{ label: "Voucher", value: "VOUCHER" },
|
|
148
|
+
{ label: "Loyalty", value: "LOYALTY" }
|
|
149
|
+
],
|
|
150
|
+
"model-value": t(a).option.type,
|
|
151
|
+
"onUpdate:modelValue": T
|
|
152
|
+
}, null, 8, ["disabled", "model-value"]),
|
|
153
|
+
t(a).option.type == "LOYALTY" ? (b(), h(o, {
|
|
154
|
+
key: 0,
|
|
155
|
+
label: "Loyalty type",
|
|
156
|
+
items: t(p).loyaltyRewards.items,
|
|
157
|
+
"model-value": t(a).option.collectible,
|
|
158
|
+
"onUpdate:modelValue": $
|
|
159
|
+
}, null, 8, ["items", "model-value"])) : k("", !0),
|
|
160
|
+
t(a).option.type === "LOYALTY" ? (b(), M(Y, { key: 1 }, [
|
|
161
|
+
e[10] || (e[10] = f("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
|
|
162
|
+
((r = t(p).loyaltyRewards.items.find(
|
|
163
|
+
(s) => {
|
|
164
|
+
var U;
|
|
165
|
+
return s.value === ((U = t(a)) == null ? void 0 : U.option.collectible);
|
|
166
|
+
}
|
|
167
|
+
)) == null ? void 0 : r.raw.type) !== "TITLE" ? (b(), h(ne, {
|
|
168
|
+
key: 0,
|
|
169
|
+
class: "mt-[-8px]",
|
|
170
|
+
rules: [
|
|
171
|
+
t(_).ruleAtPath(t(R), "option.earningOption", [
|
|
172
|
+
t(a).option.type
|
|
173
|
+
])
|
|
174
|
+
],
|
|
175
|
+
"helper-state": t(_).helperState(t(u), "option.earningOption"),
|
|
176
|
+
"error-text": t(_).helperText(t(u), "option.earningOption"),
|
|
177
|
+
"fixed-type": !0,
|
|
178
|
+
"model-value": t(a).option.earningOption,
|
|
179
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => t(a).option.earningOption = s)
|
|
180
|
+
}, null, 8, ["rules", "helper-state", "error-text", "model-value"])) : k("", !0),
|
|
181
|
+
d(re, {
|
|
182
|
+
class: "!gap-24",
|
|
183
|
+
"for-credit": t(a).option.type === "LOYALTY" && ((E = t(p).loyaltyRewards.items.find(
|
|
184
|
+
(s) => {
|
|
185
|
+
var U;
|
|
186
|
+
return s.value === ((U = t(a).option) == null ? void 0 : U.collectible);
|
|
187
|
+
}
|
|
188
|
+
)) == null ? void 0 : E.raw.type) === "CREDIT",
|
|
189
|
+
type: t(a).option.type === "VOUCHER" ? "range" : "custom",
|
|
190
|
+
rules: [
|
|
191
|
+
t(_).ruleAtPath(t(R), "option.validityOption", [
|
|
192
|
+
t(a).option.type
|
|
193
|
+
])
|
|
194
|
+
],
|
|
195
|
+
"model-value": t(a).option.validityOption,
|
|
196
|
+
"onUpdate:modelValue": e[2] || (e[2] = (s) => t(a).option.validityOption = s)
|
|
197
|
+
}, null, 8, ["for-credit", "type", "rules", "model-value"])
|
|
198
|
+
], 64)) : k("", !0),
|
|
199
|
+
t(a).option.type === "VOUCHER" ? (b(), h(ie, {
|
|
200
|
+
key: 2,
|
|
201
|
+
"reward-image": t(y),
|
|
202
|
+
"model-value": ((c = t(a)) == null ? void 0 : c.option.collectibleConfig) ?? void 0,
|
|
203
|
+
"onUpdate:modelValue": e[3] || (e[3] = (s) => t(a).option.collectibleConfig = s),
|
|
204
|
+
"onUpdate:rewardImage": e[4] || (e[4] = (s) => y.value = s)
|
|
205
|
+
}, null, 8, ["reward-image", "model-value"])) : k("", !0),
|
|
206
|
+
d(K, { json: t(u) }, null, 8, ["json"])
|
|
207
|
+
];
|
|
208
|
+
}),
|
|
209
|
+
_: 1
|
|
210
|
+
}, 512)
|
|
211
|
+
]),
|
|
212
|
+
_: 1
|
|
213
|
+
}, 8, ["modelValue"]);
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}), ve = { class: "px-24 flex flex-col gap-y-16" }, ge = { class: "flex items-center justify-between w-full" }, be = { class: "flex flex-col gap-16 text-center" }, Re = { class: "fm-typo-en-title-sm-800" }, Ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ke = /* @__PURE__ */ X({
|
|
217
|
+
__name: "Reward",
|
|
218
|
+
setup(W) {
|
|
219
|
+
const { t: n } = oe(), I = {
|
|
220
|
+
label: n("connect.storeRewards.create"),
|
|
221
|
+
value: "create",
|
|
222
|
+
isPrimary: !0,
|
|
223
|
+
prependIcon: "add"
|
|
224
|
+
}, p = J(), C = pe(), { global: v, minor: a } = G, y = ue(), R = Q(), u = x({
|
|
225
|
+
searchKey: "",
|
|
226
|
+
columnFilters: []
|
|
227
|
+
}), F = H(() => C.rewards);
|
|
228
|
+
function D(e) {
|
|
229
|
+
y.push({
|
|
230
|
+
name: ye["$connect-STORE_REWARD_COLLECTIONS"],
|
|
231
|
+
params: { id: e }
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
const S = [
|
|
235
|
+
{
|
|
236
|
+
header: n("connect.storeRewards.table.name"),
|
|
237
|
+
accessorFn: (e) => e.name
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
header: n("connect.storeRewards.table.type"),
|
|
241
|
+
cell(e) {
|
|
242
|
+
return e.row.original.collectibleConfig ? ee[e.row.original.collectibleConfig.type].chip() : "N/A";
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
header: n("connect.storeRewards.table.summary"),
|
|
247
|
+
accessorFn: (e) => {
|
|
248
|
+
var o, i;
|
|
249
|
+
if (e.option.type === "VOUCHER")
|
|
250
|
+
return me((i = (o = e.option.collectibleConfig) == null ? void 0 : o.extras) == null ? void 0 : i.effect);
|
|
251
|
+
if (e.option.collectibleType == "TITLE") {
|
|
252
|
+
const m = p.sortedTitles.find(
|
|
253
|
+
(g) => g._id == e.option.collectible
|
|
254
|
+
);
|
|
255
|
+
return `Get ${m == null ? void 0 : m.name} valid for ${e.option.validityOption.validForDay} days`;
|
|
256
|
+
}
|
|
257
|
+
return `Get ${e.option.earningOption.amount} ${ce.formattedType(e.option.collectibleType)}`;
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
header: n("connect.storeRewards.table.actions"),
|
|
262
|
+
cell(e) {
|
|
263
|
+
return O("div", { class: "flex items-center justify-end gap-4" }, [
|
|
264
|
+
O(
|
|
265
|
+
L.FmMenu,
|
|
266
|
+
{
|
|
267
|
+
placement: "bottom-end",
|
|
268
|
+
onClick: (o) => {
|
|
269
|
+
o.stopPropagation();
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"menu-button": () => O(L.FmButton, {
|
|
274
|
+
icon: "more_vert",
|
|
275
|
+
iconColor: "neutral-gray-400",
|
|
276
|
+
variant: "tertiary"
|
|
277
|
+
}),
|
|
278
|
+
default: () => [
|
|
279
|
+
e.row.original.option.type === "VOUCHER" && O(L.FmMenuItem, {
|
|
280
|
+
label: "View collections",
|
|
281
|
+
onClick: async (o) => {
|
|
282
|
+
o.stopPropagation(), D(
|
|
283
|
+
e.row.original.option.collectible
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
}),
|
|
287
|
+
O(
|
|
288
|
+
L.FmMenuItem,
|
|
289
|
+
{
|
|
290
|
+
onClick: async (o) => {
|
|
291
|
+
o.stopPropagation(), $(e.row.original);
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
label: O(
|
|
296
|
+
"div",
|
|
297
|
+
{
|
|
298
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
299
|
+
},
|
|
300
|
+
"Delete"
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
]);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
], T = x();
|
|
311
|
+
async function $(e) {
|
|
312
|
+
await te.remove(
|
|
313
|
+
n("connect.storeRewards.delete.confirm"),
|
|
314
|
+
n("connect.storeRewards.delete.title")
|
|
315
|
+
) && await a(
|
|
316
|
+
async () => {
|
|
317
|
+
await P.deleteReward(e._id), await C.readRewards();
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
message: n("connect.storeRewards.delete.message"),
|
|
321
|
+
successMessage: n("connect.storeRewards.delete.success")
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
async function V(e) {
|
|
326
|
+
var o;
|
|
327
|
+
e || (e = {
|
|
328
|
+
name: "",
|
|
329
|
+
option: {
|
|
330
|
+
type: "LOYALTY",
|
|
331
|
+
collectible: p.loyaltyRewards.items[0].value,
|
|
332
|
+
collectibleType: p.loyaltyRewards.items[0].raw.type,
|
|
333
|
+
validityOption: {
|
|
334
|
+
validForDay: 7
|
|
335
|
+
},
|
|
336
|
+
earningOption: {
|
|
337
|
+
type: "FIXED",
|
|
338
|
+
amount: 1
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}), (o = T.value) == null || o.showSheet(!0, ae(e));
|
|
342
|
+
}
|
|
343
|
+
async function l(e) {
|
|
344
|
+
let o = !1;
|
|
345
|
+
e._id && e.option.type === "VOUCHER" && await new Promise((i) => {
|
|
346
|
+
R.open({
|
|
347
|
+
title: "Confirmation",
|
|
348
|
+
message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
|
|
349
|
+
primaryActions: { text: "Update all", close: !0 },
|
|
350
|
+
secondaryActions: { text: "Update future only", close: !0 }
|
|
351
|
+
}).onPrimary(async () => {
|
|
352
|
+
o = !0, i();
|
|
353
|
+
}).onSecondary(async () => {
|
|
354
|
+
i();
|
|
355
|
+
});
|
|
356
|
+
}), await a(
|
|
357
|
+
async () => {
|
|
358
|
+
var i;
|
|
359
|
+
e.collectibleConfig = void 0, e._id ? await P.updateReward(e._id, {
|
|
360
|
+
...e,
|
|
361
|
+
updateCollection: o
|
|
362
|
+
}) : await P.createReward(e), await C.readRewards(), (i = T.value) == null || i.showSheet(!1);
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
message: "Updating reward",
|
|
366
|
+
successMessage: "Reward updated successfully"
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
return q(async () => {
|
|
371
|
+
await v(async () => {
|
|
372
|
+
await p.readMembership(), await p.readRewards(), await C.readRewards();
|
|
373
|
+
});
|
|
374
|
+
}), (e, o) => {
|
|
375
|
+
const i = w("FmPageHead"), m = w("FmSearch"), g = w("FmTable"), r = w("FmButton"), E = w("FmCard");
|
|
376
|
+
return b(), M(Y, null, [
|
|
377
|
+
d(i, {
|
|
378
|
+
title: t(n)("connect.reward.title"),
|
|
379
|
+
actions: [I],
|
|
380
|
+
"back-button": !0,
|
|
381
|
+
"onClick:action": o[0] || (o[0] = () => V()),
|
|
382
|
+
"onClick:back": o[1] || (o[1] = () => {
|
|
383
|
+
var c;
|
|
384
|
+
return (c = t(y)) == null ? void 0 : c.back();
|
|
385
|
+
})
|
|
386
|
+
}, null, 8, ["title", "actions"]),
|
|
387
|
+
f("div", ve, [
|
|
388
|
+
t(F) && t(F).length > 0 ? (b(), M(Y, { key: 0 }, [
|
|
389
|
+
f("div", ge, [
|
|
390
|
+
o[6] || (o[6] = f("div", { class: "flex gap-8" }, null, -1)),
|
|
391
|
+
d(m, {
|
|
392
|
+
modelValue: t(u).searchKey,
|
|
393
|
+
"onUpdate:modelValue": o[2] || (o[2] = (c) => t(u).searchKey = c),
|
|
394
|
+
class: "",
|
|
395
|
+
placeholder: "search",
|
|
396
|
+
collapsible: ""
|
|
397
|
+
}, null, 8, ["modelValue"])
|
|
398
|
+
]),
|
|
399
|
+
d(g, {
|
|
400
|
+
"row-data": t(F),
|
|
401
|
+
"column-defs": S,
|
|
402
|
+
"search-value": t(u).searchKey,
|
|
403
|
+
"column-filter": t(u).columnFilters,
|
|
404
|
+
onRowClick: o[3] || (o[3] = (c) => V(c.original)),
|
|
405
|
+
"hide-footer": t(F).length < 10
|
|
406
|
+
}, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
|
|
407
|
+
], 64)) : (b(), h(E, {
|
|
408
|
+
key: 1,
|
|
409
|
+
variant: "outlined",
|
|
410
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
411
|
+
}, {
|
|
412
|
+
default: A(() => [
|
|
413
|
+
o[7] || (o[7] = f("img", {
|
|
414
|
+
src: z,
|
|
415
|
+
class: "aspect-square w-[150px]"
|
|
416
|
+
}, null, -1)),
|
|
417
|
+
f("div", be, [
|
|
418
|
+
f("div", Re, B(t(n)("connect.storeRewards.empty.title")), 1),
|
|
419
|
+
f("div", Ce, B(t(n)("connect.storeRewards.empty.description")), 1)
|
|
420
|
+
]),
|
|
421
|
+
d(r, {
|
|
422
|
+
variant: "primary",
|
|
423
|
+
label: t(n)("connect.storeRewards.empty.action"),
|
|
424
|
+
onClick: o[4] || (o[4] = (c) => V()),
|
|
425
|
+
icon: "add"
|
|
426
|
+
}, null, 8, ["label"])
|
|
427
|
+
]),
|
|
428
|
+
_: 1
|
|
429
|
+
})),
|
|
430
|
+
d(we, {
|
|
431
|
+
ref_key: "rewardSheetRef",
|
|
432
|
+
ref: T,
|
|
433
|
+
onUpdate: o[5] || (o[5] = (c) => l(c))
|
|
434
|
+
}, null, 512)
|
|
435
|
+
])
|
|
436
|
+
], 64);
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
export {
|
|
441
|
+
Ke as default
|
|
442
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { ref as p, defineComponent as T, computed as x, resolveComponent as y, openBlock as U, createBlock as G, unref as e, isRef as $, withCtx as b, createElementVNode as v, createVNode as u, toDisplayString as j } from "vue";
|
|
2
|
+
import { u as B } from "./loading-CDbkBsRr.js";
|
|
3
|
+
import { J as P } from "./JsonViewer-v8_C7l5N.js";
|
|
4
|
+
import { _ as D } from "./ZodTextField.vue_vue_type_script_setup_true_lang-Bne_nxYS.js";
|
|
5
|
+
import { _ as I } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-Fx-J2gcK.js";
|
|
6
|
+
import { Z as L } from "./zod-Bg2FbC-D.js";
|
|
7
|
+
import { u as V } from "./app-wDQR6dpb.js";
|
|
8
|
+
import { defineStore as N } from "pinia";
|
|
9
|
+
import { r as k } from "./index-g9NNHS8s.js";
|
|
10
|
+
import { c as E } from "./index-CUl_8M_c.js";
|
|
11
|
+
import "./index-CgCcvX_L.js";
|
|
12
|
+
import "./index-BSHuLDD0.js";
|
|
13
|
+
import "./index-Dw2RtHKR.js";
|
|
14
|
+
import "./index-9WBy0L7U.js";
|
|
15
|
+
import "./plugins-DKNh-lBz.js";
|
|
16
|
+
import { u as J } from "./vue-i18n-CxMxiW_u.js";
|
|
17
|
+
import { c as C } from "./object-qECH92oz.js";
|
|
18
|
+
import { useDialog as Z } from "@feedmepos/ui-library";
|
|
19
|
+
const A = N("mf-connect-referral", () => {
|
|
20
|
+
const h = p();
|
|
21
|
+
return {
|
|
22
|
+
readReferralProgram: async () => {
|
|
23
|
+
const c = await k.read();
|
|
24
|
+
h.value = c;
|
|
25
|
+
},
|
|
26
|
+
referralProgram: h
|
|
27
|
+
};
|
|
28
|
+
}), H = { class: "flex flex-col space-y-16 pr-12" }, M = { class: "fm-typo-en-title-sm-800" }, O = { class: "flex items-center gap-8" }, W = /* @__PURE__ */ T({
|
|
29
|
+
__name: "EditReferralTierSheet",
|
|
30
|
+
emits: ["update"],
|
|
31
|
+
setup(h, { expose: _, emit: c }) {
|
|
32
|
+
const { t: n } = J(), m = c, s = p(!1), a = p({}), i = p(-1), w = A(), o = E.superRefine((r, t) => {
|
|
33
|
+
r.name.length >= 50 && t.addIssue({
|
|
34
|
+
code: "custom",
|
|
35
|
+
message: "Name must be less than 50 characters"
|
|
36
|
+
});
|
|
37
|
+
}), l = x(() => {
|
|
38
|
+
const r = o.safeParse(a.value);
|
|
39
|
+
return r.success ? [] : r.error.errors;
|
|
40
|
+
});
|
|
41
|
+
function R() {
|
|
42
|
+
const r = o.safeParse(a.value);
|
|
43
|
+
r.success && m("update", i.value, r.data);
|
|
44
|
+
}
|
|
45
|
+
function d(r, t) {
|
|
46
|
+
var f;
|
|
47
|
+
s.value = r, r && typeof t == "number" && t >= 0 ? (i.value = t, a.value = C(
|
|
48
|
+
(f = w.referralProgram) == null ? void 0 : f.reward[t]
|
|
49
|
+
)) : (i.value = -1, a.value = {
|
|
50
|
+
id: (/* @__PURE__ */ new Date()).toISOString(),
|
|
51
|
+
name: "",
|
|
52
|
+
rewards: [],
|
|
53
|
+
rule: void 0
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function g(r) {
|
|
57
|
+
a.value.rule = r;
|
|
58
|
+
}
|
|
59
|
+
return _({
|
|
60
|
+
showSheet: d,
|
|
61
|
+
data: a
|
|
62
|
+
}), (r, t) => {
|
|
63
|
+
const f = y("FmButton"), F = y("FmSideSheet");
|
|
64
|
+
return U(), G(F, {
|
|
65
|
+
"max-width": 1e3,
|
|
66
|
+
modelValue: e(s),
|
|
67
|
+
"onUpdate:modelValue": t[2] || (t[2] = (S) => $(s) ? s.value = S : null),
|
|
68
|
+
header: `${e(i) == -1 ? e(n)("connect.referral.editReferralTierSheet.create") : e(n)("connect.referral.editReferralTierSheet.edit")}`
|
|
69
|
+
}, {
|
|
70
|
+
"side-sheet-footer": b(() => [
|
|
71
|
+
v("div", O, [
|
|
72
|
+
u(f, {
|
|
73
|
+
label: e(n)("connect.editTierSheet.submit"),
|
|
74
|
+
onClick: R,
|
|
75
|
+
disabled: e(l).length > 0 || e(V)().isLoading,
|
|
76
|
+
loading: e(V)().isLoading
|
|
77
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
78
|
+
u(f, {
|
|
79
|
+
label: e(n)("connect.editTierSheet.cancel"),
|
|
80
|
+
onClick: t[1] || (t[1] = (S) => d(!1)),
|
|
81
|
+
variant: "tertiary"
|
|
82
|
+
}, null, 8, ["label"])
|
|
83
|
+
])
|
|
84
|
+
]),
|
|
85
|
+
default: b(() => [
|
|
86
|
+
u(P, { json: e(a) }, null, 8, ["json"]),
|
|
87
|
+
u(P, { json: e(l) }, null, 8, ["json"]),
|
|
88
|
+
v("div", H, [
|
|
89
|
+
u(D, {
|
|
90
|
+
modelValue: e(a).name,
|
|
91
|
+
"onUpdate:modelValue": t[0] || (t[0] = (S) => e(a).name = S),
|
|
92
|
+
label: e(n)("connect.referral.editReferralTierSheet.name"),
|
|
93
|
+
schema: e(L).typeAtPath(e(o), "name")
|
|
94
|
+
}, null, 8, ["modelValue", "label", "schema"]),
|
|
95
|
+
v("div", M, j(e(n)("connect.referral.editReferralTierSheet.target_audience")), 1),
|
|
96
|
+
u(I, {
|
|
97
|
+
"model-value": e(a).rule,
|
|
98
|
+
"onUpdate:modelValue": g
|
|
99
|
+
}, null, 8, ["model-value"])
|
|
100
|
+
])
|
|
101
|
+
]),
|
|
102
|
+
_: 1
|
|
103
|
+
}, 8, ["modelValue", "header"]);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}), de = /* @__PURE__ */ T({
|
|
107
|
+
__name: "RewardGroup",
|
|
108
|
+
setup(h, { expose: _ }) {
|
|
109
|
+
const { minor: c } = B, n = Z(), m = A(), s = x(() => {
|
|
110
|
+
var o;
|
|
111
|
+
return ((o = m.referralProgram) == null ? void 0 : o.reward) ?? [];
|
|
112
|
+
}), a = p(null);
|
|
113
|
+
function i(o) {
|
|
114
|
+
var l;
|
|
115
|
+
(l = a.value) == null || l.showSheet(!0, o);
|
|
116
|
+
}
|
|
117
|
+
_({
|
|
118
|
+
onManageRewardGroup: i
|
|
119
|
+
});
|
|
120
|
+
async function w(o, l) {
|
|
121
|
+
var r;
|
|
122
|
+
const R = o == -1 ? s.value.length : o, d = C(m.referralProgram);
|
|
123
|
+
d.reward[R] = l;
|
|
124
|
+
let g = !1;
|
|
125
|
+
await new Promise((t) => {
|
|
126
|
+
n.open({
|
|
127
|
+
title: "Confirmation",
|
|
128
|
+
message: "This will change all referral settings? Would you like to update previous referral record?",
|
|
129
|
+
primaryActions: { text: "Update all", close: !0 },
|
|
130
|
+
secondaryActions: { text: "Update future only", close: !0 }
|
|
131
|
+
}).onPrimary(async () => {
|
|
132
|
+
g = !0, t();
|
|
133
|
+
}).onSecondary(async () => {
|
|
134
|
+
t();
|
|
135
|
+
});
|
|
136
|
+
}), await c(async () => {
|
|
137
|
+
await k.update({ ...d, updateReferralRecord: g }), await m.readReferralProgram();
|
|
138
|
+
}), (r = a.value) == null || r.showSheet(!1);
|
|
139
|
+
}
|
|
140
|
+
return (o, l) => (U(), G(W, {
|
|
141
|
+
ref_key: "editReferralTierSheetRef",
|
|
142
|
+
ref: a,
|
|
143
|
+
onUpdate: w
|
|
144
|
+
}, null, 512));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
export {
|
|
148
|
+
de as _,
|
|
149
|
+
A as u
|
|
150
|
+
};
|