@feedmepos/mf-connect 0.0.12-beta.5 → 0.0.13-prod

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 (72) hide show
  1. package/dist/Analytic-DMbCeTaO.js +612 -0
  2. package/dist/{Broadcast-BFHQPSXL.js → Broadcast-bVaOzrys.js} +7 -7
  3. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B1DYJDOy.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cd2midth.js} +8 -8
  4. package/dist/{Card-rOJ8yJg_.js → Card-CdCTfDuP.js} +127 -127
  5. package/dist/{Collections-BT8ihCOa.js → Collections-CQIHkJ4W.js} +129 -141
  6. package/dist/{Credit-D83Jsn7v.js → Credit-DuIm1c4_.js} +7 -7
  7. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang--L-LP0DV.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DljWmOEP.js} +258 -242
  8. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-HLzZirO_.js → EffectSheet.vue_vue_type_style_index_0_lang-BuJL01zR.js} +6 -6
  9. package/dist/{Experience-C6uBhQod.js → Experience-DEnMLbsA.js} +7 -7
  10. package/dist/{Game-5P5HWqAL.js → Game-BYS0nrH6.js} +7 -7
  11. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DTDcpMpW.js → ImageInput.vue_vue_type_script_setup_true_lang-DW2tVaY0.js} +1 -1
  12. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CQIJ54m1.js → MainLayout-BkFJubzZ.js} +53 -20
  13. package/dist/{Marketing-ONuItJ_B.js → Marketing-Da0HTlaz.js} +25 -25
  14. package/dist/{Member-SB2IySXY.js → Member-CVe_bRGx.js} +2 -2
  15. package/dist/MemberList-DpUy4gFd.js +1718 -0
  16. package/dist/{MemberTransactions-DPQ6M7eR.js → MemberTransactions-DWdTDUIJ.js} +2 -2
  17. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-1KjmvWsp.js +203 -0
  18. package/dist/{Mission-rdnU6erJ.js → Mission-0eSMWCls.js} +7 -7
  19. package/dist/{Point-C2M66ORj.js → Point-ju1eHI9Z.js} +7 -7
  20. package/dist/{Promotion-DixbjmMJ.js → Promotion-DZjWvnQa.js} +8 -8
  21. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CJsIBnGp.js → RuleGroup.vue_vue_type_script_setup_true_lang-CDPvpj10.js} +14 -14
  22. package/dist/{Segment-j_zQSV7O.js → Segment-Da_kMLWC.js} +18 -19
  23. package/dist/{Setting-ClhkF-bT.js → Setting-CxX35f3G.js} +541 -571
  24. package/dist/Store-DjUI3S8V.js +1442 -0
  25. package/dist/{StoreRewards-Bh90Ml4z.js → StoreRewards-92k0Bvp_.js} +74 -75
  26. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DlbNMiw9.js → StoreTransactions.vue_vue_type_script_setup_true_lang-Bsrz-oMi.js} +79 -82
  27. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DNkJ-pFL.js +124 -0
  28. package/dist/{Tier-vxsDt3Kj.js → Tier-2J4GN90t.js} +68 -71
  29. package/dist/{Title-IFyz9vfW.js → Title-B3Dw3w_5.js} +75 -78
  30. package/dist/{Transaction-ETa-y_H9.js → Transaction-Dz6WT5Hb.js} +1 -1
  31. package/dist/{Voucher-BMYcuaPn.js → Voucher-Bf3oSOKc.js} +37 -37
  32. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +140 -0
  33. package/dist/{app-Bl9KwQq5.js → app-BSmDH0M7.js} +46 -46
  34. package/dist/{app-BqWTxQI-.js → app-C7I-jK_l.js} +1 -1
  35. package/dist/app.js +1 -1
  36. package/dist/{campaign-DI8CmTo2.js → campaign-CmvlWUoI.js} +11 -13
  37. package/dist/{collection.fn-CTEuol1r.js → collection.fn-DHlfGYAC.js} +2 -4
  38. package/dist/{dto-Bdlgo-8k.js → dto-rs6D-mtj.js} +239 -239
  39. package/dist/{effect-BdgYZfgW.js → effect-D8eQcTDU.js} +1 -1
  40. package/dist/{export-Dr_7YvBE.js → export-Bf2h8rMP.js} +3 -3
  41. package/dist/{helper-BygQ4tND.js → helper-BSlBLPdy.js} +1 -1
  42. package/dist/{index-CstgquVp.js → index-B64Y4rdW.js} +2 -2
  43. package/dist/{index-Djv3w5gV.js → index-BVSAl8E2.js} +37 -46
  44. package/dist/{index-DzQwND7p.js → index-CdMMIVsr.js} +217 -232
  45. package/dist/index-CuW8ePVX.js +244 -0
  46. package/dist/{index-DPYzF8No.js → index-D0nFU6ln.js} +1 -1
  47. package/dist/{index-Cv0dYoWA.js → index-fFL3EyTx.js} +68 -105
  48. package/dist/{index-Dhl0c4JQ.js → index-jqxAE4Rp.js} +1 -1
  49. package/dist/{index-BPdhkx4l.js → index-sIR31szI.js} +1 -1
  50. package/dist/{index-BtG8YOzi.js → index-wIa5WSXJ.js} +27 -28
  51. package/dist/{index-CpxxO2-G.js → index-x9e-DyDf.js} +1 -1
  52. package/dist/{loading-DlPkAkzK.js → loading-BxJj39Hj.js} +3156 -3156
  53. package/dist/{lodash-Cjf6EG_s.js → lodash-CrYvSLZb.js} +1 -1
  54. package/dist/{membership-B4-9J74r.js → membership-DKQL_Qp9.js} +73 -84
  55. package/dist/{money-il542E4J.js → money-B1P0wtzb.js} +1 -1
  56. package/dist/{number-WhKft9Yv.js → number-Bc1eguaq.js} +3 -3
  57. package/dist/{rule-XS2i1LKt.js → rule-BblG87FW.js} +2 -2
  58. package/dist/{rule-builder-CdK4IIT9.js → rule-builder-BQdKD4Gy.js} +1 -1
  59. package/dist/style.css +1 -1
  60. package/dist/{template-owB8rrou.js → template-o2RQUsfw.js} +6 -6
  61. package/dist/{usePagination-CxpwPyMW.js → usePagination-BaqNzQhm.js} +1 -1
  62. package/dist/{xlsx-CbJTFamj.js → xlsx-DqRMXFBK.js} +309 -309
  63. package/package.json +1 -1
  64. package/dist/Analytic-CCtweUZA.js +0 -757
  65. package/dist/MainLayout-CWfQ53Qr.js +0 -41
  66. package/dist/MemberList-C2X8fM7F.js +0 -1729
  67. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-CE03Mh2P.js +0 -432
  68. package/dist/Store-CaWIsSZ3.js +0 -1506
  69. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DkpguWBa.js +0 -136
  70. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js +0 -55
  71. package/dist/index-_8VUWoAN.js +0 -245
  72. package/dist/zod-W_PvIofQ.js +0 -90
@@ -1,136 +0,0 @@
1
- import { defineComponent as N, ref as C, computed as L, watch as E, resolveComponent as g, openBlock as o, createElementBlock as i, Fragment as y, toDisplayString as I, createCommentVNode as A, createElementVNode as M, createVNode as v, unref as u, renderList as S, createBlock as b, isRef as U, withCtx as F } from "vue";
2
- import { a as T } from "./app-Bl9KwQq5.js";
3
- function j(l, s, n) {
4
- return l.some(
5
- n instanceof Function ? n : (a) => a === s
6
- ) || l.push(s), l;
7
- }
8
- function q(l, s, n) {
9
- return l.filter(
10
- n instanceof Function ? (a) => !n(a) : (a) => a !== s
11
- );
12
- }
13
- const D = {
14
- key: 0,
15
- class: "fm-typo-en-body-lg-400"
16
- }, K = {
17
- key: 1,
18
- class: "space-y-4"
19
- }, O = { key: 0 }, R = { key: 1 }, z = { key: 2 }, J = /* @__PURE__ */ N({
20
- __name: "TargetLocationInput",
21
- props: {
22
- label: {
23
- type: String
24
- },
25
- type: {
26
- type: String,
27
- default: "select"
28
- },
29
- modelValue: {
30
- type: Object,
31
- required: !0
32
- }
33
- },
34
- emits: ["update:model-value"],
35
- setup(l, { emit: s }) {
36
- const n = T(), a = l, c = C(""), w = L(() => n.locations.filter(
37
- (d) => {
38
- var t;
39
- return d.name.toLowerCase().includes(c.value.toLowerCase()) || ((t = d == null ? void 0 : d.code) == null ? void 0 : t.toLowerCase().includes(c.value.toLowerCase()));
40
- }
41
- )), p = s;
42
- function k(d, t) {
43
- const m = d ? j(a.modelValue || [], t.toString()) : q(
44
- a.modelValue || n.locations.map((V) => V._id.toString()),
45
- t.toString()
46
- );
47
- return p("update:model-value", m);
48
- }
49
- const r = C(!1), $ = L(() => {
50
- var m, V;
51
- const t = ((m = a.modelValue) == null ? void 0 : m.slice(0, 5).map((h) => {
52
- var f;
53
- return ((f = n.locationById(h)) == null ? void 0 : f.name) || h;
54
- })) || [];
55
- return a.modelValue && ((V = a.modelValue) == null ? void 0 : V.length) > 5 && t.push(`+${a.modelValue.length - 5} more`), t;
56
- });
57
- return E(r, (d) => {
58
- d && (c.value = "");
59
- }), (d, t) => {
60
- const m = g("FmCheckbox"), V = g("FmChip"), h = g("FmField"), f = g("FmTextField"), B = g("FmMenu");
61
- return o(), i(y, null, [
62
- l.label ? (o(), i("div", D, I(l.label), 1)) : A("", !0),
63
- l.type === "checkbox" ? (o(), i("div", K, [
64
- M("div", null, [
65
- v(m, {
66
- value: null,
67
- indeterminate: l.modelValue != null && l.modelValue.length > 0 && l.modelValue.length < u(n).locations.length,
68
- label: "All locations",
69
- "model-value": l.modelValue == null || l.modelValue.length === u(n).locations.length,
70
- "onUpdate:modelValue": t[0] || (t[0] = (e) => p("update:model-value", e ? null : []))
71
- }, null, 8, ["indeterminate", "model-value"])
72
- ]),
73
- (o(!0), i(y, null, S(u(n).locations, (e) => (o(), i("div", {
74
- key: e._id.toString()
75
- }, [
76
- v(m, {
77
- value: e._id.toString(),
78
- label: `${e.code ? `${e.code} - ` : ""} ${e.name}`,
79
- "model-value": !l.modelValue || l.modelValue.includes(e._id.toString()),
80
- "onUpdate:modelValue": (x) => k(x, e._id.toString())
81
- }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"])
82
- ]))), 128))
83
- ])) : (o(), b(B, {
84
- key: 2,
85
- modelValue: u(r),
86
- "onUpdate:modelValue": t[3] || (t[3] = (e) => U(r) ? r.value = e : null),
87
- onMenuChanged: t[4] || (t[4] = (e) => r.value = e),
88
- placement: "top-end"
89
- }, {
90
- "menu-button": F(() => [
91
- v(h, {
92
- "append-icon": u(r) ? "expand_more" : "expand_less",
93
- class: "!h-auto"
94
- }, {
95
- default: F(() => [
96
- !l.modelValue || l.modelValue.length == u(n).locations.length ? (o(), i("div", O, " All Locations ")) : l.modelValue.length ? (o(), i("div", z, [
97
- (o(!0), i(y, null, S(u($), (e) => (o(), b(V, {
98
- key: e,
99
- label: e,
100
- class: "max-w-[130px] text-ellipsis"
101
- }, null, 8, ["label"]))), 128))
102
- ])) : (o(), i("div", R, "No Locations"))
103
- ]),
104
- _: 1
105
- }, 8, ["append-icon"])
106
- ]),
107
- default: F(() => [
108
- v(f, {
109
- modelValue: u(c),
110
- "onUpdate:modelValue": t[1] || (t[1] = (e) => U(c) ? c.value = e : null),
111
- placeholder: "Search locations"
112
- }, null, 8, ["modelValue"]),
113
- v(m, {
114
- value: null,
115
- indeterminate: l.modelValue != null && l.modelValue.length > 0 && l.modelValue.length < u(n).locations.length,
116
- label: "All locations",
117
- "model-value": l.modelValue == null || l.modelValue.length === u(n).locations.length,
118
- "onUpdate:modelValue": t[2] || (t[2] = (e) => p("update:model-value", e ? null : []))
119
- }, null, 8, ["indeterminate", "model-value"]),
120
- (o(!0), i(y, null, S(u(w), (e) => (o(), b(m, {
121
- key: e._id.toString(),
122
- value: e._id.toString(),
123
- label: `${e.code ? `${e.code} - ` : ""} ${e.name}`,
124
- "model-value": !l.modelValue || l.modelValue.includes(e._id.toString()),
125
- "onUpdate:modelValue": (x) => k(x, e._id.toString())
126
- }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"]))), 128))
127
- ]),
128
- _: 1
129
- }, 8, ["modelValue"]))
130
- ], 64);
131
- };
132
- }
133
- });
134
- export {
135
- J as _
136
- };
@@ -1,55 +0,0 @@
1
- import { defineComponent as u, useAttrs as p, resolveComponent as f, openBlock as o, createBlock as y, mergeProps as b, unref as t, createSlots as v, withCtx as x, createElementVNode as a, toDisplayString as g, renderSlot as h, createElementBlock as k, createCommentVNode as F } from "vue";
2
- import { Z as d } from "./zod-W_PvIofQ.js";
3
- const S = { class: "fm-typo-en-body-lg-400 flex gap-4 text-fm-color-typo-primary items-center" }, V = {
4
- key: 0,
5
- class: "text-fm-color-typo-tertiary"
6
- }, q = /* @__PURE__ */ u({
7
- __name: "ZodTextField",
8
- props: {
9
- label: {
10
- type: String,
11
- required: !1
12
- },
13
- schema: {
14
- type: Object,
15
- required: !0
16
- },
17
- modelValue: {
18
- type: String
19
- },
20
- disabled: {
21
- type: Boolean,
22
- default: !1
23
- }
24
- },
25
- emits: ["update:model-value", "focus-changed"],
26
- setup(e, { emit: r }) {
27
- const s = r, n = p();
28
- return (m, l) => {
29
- const i = f("FmTextField");
30
- return o(), y(i, b({
31
- "model-value": e.modelValue,
32
- "onUpdate:modelValue": l[0] || (l[0] = (c) => s("update:model-value", c)),
33
- disabled: e.disabled
34
- }, t(n), {
35
- rules: [t(d).toRule(e.schema)]
36
- }), v({ _: 2 }, [
37
- e.label ? {
38
- name: "label",
39
- fn: x(() => [
40
- a("div", S, [
41
- a("div", null, g(e.label), 1),
42
- h(m.$slots, "append-label", {}, () => [
43
- t(d).isRequired(e.schema) ? F("", !0) : (o(), k("div", V, " (optional) "))
44
- ])
45
- ])
46
- ]),
47
- key: "0"
48
- } : void 0
49
- ]), 1040, ["model-value", "disabled", "rules"]);
50
- };
51
- }
52
- });
53
- export {
54
- q as _
55
- };
@@ -1,245 +0,0 @@
1
- import { z as e, F as n, g as b, e as t, m as i } from "./loading-DlPkAkzK.js";
2
- import { e as s } from "./index-DzQwND7p.js";
3
- import "vue";
4
- const g = e.object({
5
- icon: e.string(),
6
- label: e.string(),
7
- value: e.string()
8
- }), y = e.object({
9
- gatewayKey: e.enum([
10
- "REVENUE_MONSTER",
11
- "FEEDME",
12
- "FEEDME_MEMBER_CREDIT",
13
- "RAZER_MERCHANT_SERVICE"
14
- ]),
15
- checkoutUrl: e.string().optional(),
16
- checkoutId: e.string().optional(),
17
- callbackUrl: e.string().optional(),
18
- vcode: e.string().optional(),
19
- merchantId: e.string().optional(),
20
- amount: e.string().optional(),
21
- currency: e.string().optional(),
22
- returnUrl: e.string().optional(),
23
- notifyUrl: e.string().optional(),
24
- channels: e.array(g).optional(),
25
- transactionId: e.string().optional()
26
- });
27
- e.object({
28
- trx: e.lazy(() => x),
29
- onlineTrx: y.optional(),
30
- url: e.string().optional()
31
- });
32
- const a = e.enum(["POS", "APP"]), l = e.enum(["topupCount"]), h = e.object({
33
- line1: e.string(),
34
- line2: e.string().optional(),
35
- state: e.string(),
36
- city: e.string(),
37
- postcode: e.string(),
38
- country: e.string()
39
- }), c = e.object({
40
- name: e.string(),
41
- regNo: e.string(),
42
- address: h,
43
- phoneNo: e.string(),
44
- sstRegNo: e.string().optional()
45
- }), d = e.object({
46
- systemCode: e.string(),
47
- inclusive: e.boolean()
48
- }), E = e.object({
49
- id: n,
50
- dayToExpire: e.number()
51
- }), F = e.object({
52
- normal: e.coerce.number(),
53
- free: e.object({
54
- day: e.coerce.number(),
55
- amount: e.coerce.number(),
56
- remark: e.string().nullish()
57
- }).nullish()
58
- }), j = e.object({
59
- systemCode: e.string(),
60
- taxCode: e.string()
61
- }), _ = e.object({
62
- name: e.string(),
63
- systemCode: e.string(),
64
- taxCode: e.string(),
65
- rate: b,
66
- total: t
67
- });
68
- e.object({
69
- canPurchase: e.boolean(),
70
- reason: e.string()
71
- });
72
- e.object({
73
- type: l
74
- });
75
- e.object({
76
- type: l,
77
- min: e.number().nullish(),
78
- max: e.number().nullish()
79
- });
80
- const f = e.object({
81
- options: e.object({
82
- maxReceive: e.number().min(0).nullish(),
83
- maxPerUser: e.number().min(0).nullish()
84
- }),
85
- rule: s.nullish()
86
- }), u = e.object({
87
- _id: e.string(),
88
- isFeedvibe: e.boolean().nullish(),
89
- // conditions: z.array(FdoTopupCountCondition),
90
- image: e.string().nullish(),
91
- rule: s.nullish(),
92
- name: e.string(),
93
- price: t,
94
- originalPrice: t.nullish(),
95
- // new field to indicate coinPrice
96
- coinPrice: e.number().nullish(),
97
- titles: e.array(E),
98
- credit: F,
99
- taxes: e.array(j),
100
- taxTotals: e.array(_),
101
- priceWithTaxes: t.nullish(),
102
- vouchers: e.array(n),
103
- _inclusiveTaxes: e.array(d).nullish(),
104
- _taxSystem: e.array(e.string()).nullish(),
105
- stripePriceId: e.string().nullish(),
106
- subscriptionValidity: e.number().min(1, "Must be at least 1 day").max(365, "Maximum is 365").nullish(),
107
- redeemWithCode: e.boolean().nullish(),
108
- internal: e.boolean().optional(),
109
- hideInPos: e.boolean().optional(),
110
- config: f.optional(),
111
- pf_titles: e.array(e.any()).optional(),
112
- pf_vouchers: e.array(e.any()).optional(),
113
- pf_credit: e.number().optional()
114
- }).superRefine((o, r) => {
115
- o.stripePriceId && !o.subscriptionValidity && r.addIssue({
116
- code: "custom",
117
- message: "Validity is required when stripePriceId is provided",
118
- path: ["subscriptionValidity"]
119
- }), o.originalPrice && o.originalPrice.amount && o.originalPrice.amount < o.price.amount && r.addIssue({
120
- code: "custom",
121
- message: "Original price must be greater than price",
122
- path: ["originalPrice"]
123
- });
124
- }), p = e.object({
125
- name: e.string(),
126
- bundles: e.array(u)
127
- });
128
- e.object({
129
- _id: e.string(),
130
- name: e.string(),
131
- expiredAt: e.string()
132
- });
133
- const I = e.object({
134
- apiKey: e.string(),
135
- webhookSecret: e.string()
136
- }), T = e.object({
137
- company: c.nullish(),
138
- inclusiveTaxes: e.array(d).nullish(),
139
- stripe: I.optional()
140
- }), C = {
141
- collectionName: "Stores",
142
- transform: {
143
- _id: "oid",
144
- business: "oid"
145
- }
146
- };
147
- T.extend({
148
- _id: n,
149
- business: n,
150
- categories: e.array(p)
151
- }).describe(i.describe(C));
152
- const S = e.object({
153
- refundedAt: e.coerce.date(),
154
- reason: e.string(),
155
- transactions: e.array(n)
156
- }), m = e.object({
157
- type: e.enum(["ONLINE", "OFFLINE", "COIN", "STRIPE", "CARD", "FEEDVIBE"]),
158
- extra: e.string().nullish()
159
- }), x = e.object({
160
- _id: n,
161
- source: a,
162
- // can be memberStorePurchase
163
- ref: e.string(),
164
- business: n,
165
- company: c,
166
- location: n.optional(),
167
- member: n,
168
- // createdAt: z.coerce.date(),
169
- bundle: u,
170
- transactions: e.array(n),
171
- // array of transaction id (voucher, credit, title)
172
- status: e.enum([
173
- "PENDING_PAYMENT",
174
- "PENDING_TRANSACTION",
175
- "COMPLETED",
176
- "REFUNDED"
177
- ]),
178
- refund: S.nullish(),
179
- paymentType: m.nullish(),
180
- paymentRef: e.string().nullish(),
181
- pf_transactions: e.array(e.any()).optional(),
182
- pf_member: e.any().optional(),
183
- pf_location: e.any().optional(),
184
- pf_ref: e.any().optional()
185
- }).describe(
186
- i.describe({
187
- collectionName: "StoreTransactions",
188
- transform: {
189
- _id: "oid",
190
- business: "oid",
191
- location: "oid",
192
- member: "oid",
193
- transaction: "oid"
194
- }
195
- })
196
- );
197
- e.object({
198
- bundle: n,
199
- member: e.string(),
200
- ref: e.string(),
201
- paymentType: m.nullish(),
202
- withCoin: e.boolean().optional(),
203
- card: e.string().optional(),
204
- location: n.optional(),
205
- source: a
206
- });
207
- e.object({
208
- categories: e.array(p)
209
- });
210
- e.object({
211
- id: n,
212
- reason: e.string(),
213
- location: n.optional()
214
- });
215
- e.object({
216
- _id: n,
217
- business: n,
218
- user: n,
219
- bundleId: e.string(),
220
- transaction: e.array(n),
221
- subscriptionId: e.string(),
222
- expiredAt: e.coerce.date()
223
- }).describe(
224
- i.describe({
225
- collectionName: "StoreSubscriptions",
226
- transform: {
227
- _id: "oid",
228
- business: "oid",
229
- user: "oid",
230
- transaction: "oid",
231
- expiredAt: "date"
232
- }
233
- })
234
- );
235
- e.object({
236
- member: e.string(),
237
- subscriptionId: e.string()
238
- });
239
- export {
240
- T as F,
241
- c as a,
242
- h as b,
243
- u as c,
244
- x as d
245
- };
@@ -1,90 +0,0 @@
1
- import { h as u } from "vue";
2
- function a(e, o) {
3
- return e.path.join(".") === o;
4
- }
5
- function Z(e, o) {
6
- return e.some((t) => o == "" || a(t, o)) ? "error" : "none";
7
- }
8
- function p(e, o) {
9
- return e.filter((t) => o == "" || a(t, o)).map((t) => t.message).join(",") || void 0;
10
- }
11
- const r = {
12
- ZodIntersection: (e) => e._def.typeName == "ZodIntersection",
13
- ZodNullable: (e) => e._def.typeName == "ZodNullable",
14
- ZodOptional: (e) => e._def.typeName == "ZodOptional",
15
- ZodEffects: (e) => e._def.typeName == "ZodEffects",
16
- ZodDiscriminatedUnion: (e) => e._def.typeName == "ZodDiscriminatedUnion",
17
- ZodUnion: (e) => e._def.typeName == "ZodUnion",
18
- ZodLazy: (e) => e._def.typeName == "ZodLazy",
19
- ZodRecord: (e) => e._def.typeName == "ZodRecord",
20
- ZodObject: (e) => e._def.typeName == "ZodObject"
21
- };
22
- function s(e) {
23
- return !(r.ZodNullable(e) || r.ZodOptional(e));
24
- }
25
- function f(e, o = []) {
26
- function t(d) {
27
- const n = [d._def.left, d._def.right];
28
- return r.ZodObject(n[0]) && r.ZodObject(n[1]) ? Object.keys(n[0].shape).length > Object.keys(n[1].shape).length ? n[0] : n[1] : n.find((i) => r.ZodDiscriminatedUnion(i)) || n.find((i) => r.ZodObject(i)) || n[1];
29
- }
30
- if ((r.ZodNullable(e) || r.ZodOptional(e)) && (e = f(e.unwrap(), o)), r.ZodEffects(e) && (e = f(e.sourceType(), o)), r.ZodDiscriminatedUnion(e)) {
31
- const d = Object.fromEntries(e.optionsMap.entries());
32
- if (o.length) {
33
- const n = o.shift(), i = d[n];
34
- return f(i, o);
35
- }
36
- return console.log(
37
- "discriminatedUnion found but no KEY supplied, keys:",
38
- Object.keys(d)
39
- ), e;
40
- }
41
- return r.ZodLazy(e) && (e = f(e._def.getter(), o)), r.ZodIntersection(e) && (e = f(t(e), o)), e;
42
- }
43
- function c(e, o, t = []) {
44
- return o === "" ? f(e, t) : o.split(".").reduce((d, n) => {
45
- const i = f(d, t);
46
- return r.ZodObject(i) ? i.shape[n] : d;
47
- }, e);
48
- }
49
- function l(e, o) {
50
- return (t) => {
51
- const d = e.safeParse(t);
52
- return d.success ? !0 : d.error.errors.filter((n) => !o || n.path.join(".") === o).map((n) => n.message).join(", ");
53
- };
54
- }
55
- function b(e, o, t = []) {
56
- return l(c(e, o, t));
57
- }
58
- function m(e, o) {
59
- if (!o) return;
60
- const t = s(e) ? "hidden" : "";
61
- return u(
62
- "div",
63
- { class: "flex items-center gap-x-4 fm-typo-en-body-lg-400" },
64
- [
65
- u("div", o),
66
- u(
67
- "div",
68
- {
69
- class: `text-fm-color-typo-secondary ${t}`
70
- },
71
- "(optional)"
72
- )
73
- ]
74
- );
75
- }
76
- const h = {
77
- helperState: Z,
78
- helperText: p,
79
- typeAtPath: c,
80
- toRule: l,
81
- ruleAtPath: b,
82
- isRequired: s,
83
- toInputLabel: m,
84
- unwrap: f
85
- };
86
- export {
87
- h as Z,
88
- p as a,
89
- Z as g
90
- };