@inspirer-dev/crm-dashboard 1.0.9 → 1.0.11

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.
@@ -0,0 +1,339 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React__default, { forwardRef, useState, useCallback } from "react";
3
+ import { Field, Flex, Typography, Card, CardContent, Box, Button, SingleSelect, SingleSelectOption, Tooltip, IconButton, Switch, TextInput } from "@strapi/design-system";
4
+ import { Plus, Trash } from "@strapi/icons";
5
+ import { useTheme } from "styled-components";
6
+ const booleanOperators = ["$eq", "$ne"];
7
+ const numberOperators = ["$eq", "$ne", "$gt", "$lt", "$gte", "$lte"];
8
+ const timeAgoOperators = ["$gt", "$lt", "$gte", "$lte"];
9
+ const CANCEL_METRICS = [
10
+ {
11
+ key: "has_deposit_since_trigger",
12
+ label: "Made Deposit",
13
+ valueType: "boolean",
14
+ description: "User made a successful deposit after the trigger event",
15
+ operators: booleanOperators
16
+ },
17
+ {
18
+ key: "has_activity_since_trigger",
19
+ label: "Had Activity",
20
+ valueType: "boolean",
21
+ description: "User had any activity (case open, upgrade, battle, etc.) after trigger",
22
+ operators: booleanOperators
23
+ },
24
+ {
25
+ key: "has_session_since_trigger",
26
+ label: "Returned to Site",
27
+ valueType: "boolean",
28
+ description: "User had a new session/visit after the trigger event",
29
+ operators: booleanOperators
30
+ },
31
+ {
32
+ key: "balance_sufficient",
33
+ label: "Balance Sufficient",
34
+ valueType: "boolean",
35
+ description: "User balance is now sufficient for the intended action",
36
+ operators: booleanOperators
37
+ },
38
+ {
39
+ key: "is_authenticated",
40
+ label: "Is Authenticated",
41
+ valueType: "boolean",
42
+ description: "User has logged in / authenticated",
43
+ operators: booleanOperators
44
+ },
45
+ {
46
+ key: "battle_completed",
47
+ label: "Battle Completed",
48
+ valueType: "boolean",
49
+ description: "The battle was completed or continued",
50
+ operators: booleanOperators
51
+ },
52
+ {
53
+ key: "upgrade_completed",
54
+ label: "Upgrade Completed",
55
+ valueType: "boolean",
56
+ description: "The upgrade was completed or retried",
57
+ operators: booleanOperators
58
+ },
59
+ {
60
+ key: "contract_completed",
61
+ label: "Contract Completed",
62
+ valueType: "boolean",
63
+ description: "The contract was completed",
64
+ operators: booleanOperators
65
+ },
66
+ {
67
+ key: "deposit_count",
68
+ label: "Deposit Count",
69
+ valueType: "number",
70
+ description: "Total number of deposits (e.g., for checking if 2nd deposit exists)",
71
+ operators: numberOperators
72
+ },
73
+ {
74
+ key: "case_open_count_since_trigger",
75
+ label: "Cases Opened Since Trigger",
76
+ valueType: "number",
77
+ description: "Number of cases opened after the trigger event",
78
+ operators: numberOperators
79
+ },
80
+ {
81
+ key: "time_since_trigger",
82
+ label: "Time Since Trigger",
83
+ valueType: "time_ago",
84
+ description: "How long since the trigger event fired",
85
+ operators: timeAgoOperators
86
+ }
87
+ ];
88
+ const CANCEL_TIME_UNITS = [
89
+ { value: "minutes_ago", label: "minutes" },
90
+ { value: "hours_ago", label: "hours" }
91
+ ];
92
+ const generateId = () => Math.random().toString(36).substring(2, 11);
93
+ const DEFAULT_CONFIG = {
94
+ logic: "$or",
95
+ rules: []
96
+ };
97
+ const parseConfig = (value) => {
98
+ if (!value) return DEFAULT_CONFIG;
99
+ try {
100
+ const parsed = JSON.parse(value);
101
+ if (parsed.logic && Array.isArray(parsed.rules)) {
102
+ return parsed;
103
+ }
104
+ return DEFAULT_CONFIG;
105
+ } catch {
106
+ return DEFAULT_CONFIG;
107
+ }
108
+ };
109
+ const serializeConfig = (config) => {
110
+ return JSON.stringify(config);
111
+ };
112
+ const getMetric = (key) => {
113
+ return CANCEL_METRICS.find((m) => m.key === key);
114
+ };
115
+ const OPERATORS = [
116
+ { value: "$eq", label: "=" },
117
+ { value: "$ne", label: "≠" },
118
+ { value: "$gt", label: ">" },
119
+ { value: "$lt", label: "<" },
120
+ { value: "$gte", label: "≥" },
121
+ { value: "$lte", label: "≤" }
122
+ ];
123
+ const ValueInput = ({ metric, value, operator, onChange, disabled }) => {
124
+ if (metric.valueType === "boolean") {
125
+ const boolVal = value === true || value === "true";
126
+ return /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
127
+ /* @__PURE__ */ jsx(
128
+ Switch,
129
+ {
130
+ label: "",
131
+ checked: boolVal,
132
+ onChange: () => onChange(!boolVal),
133
+ disabled
134
+ }
135
+ ),
136
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: boolVal ? "true" : "false" })
137
+ ] });
138
+ }
139
+ if (metric.valueType === "number") {
140
+ return /* @__PURE__ */ jsx(
141
+ TextInput,
142
+ {
143
+ type: "number",
144
+ value: String(value ?? 0),
145
+ onChange: (e) => onChange(parseInt(e.target.value, 10) || 0),
146
+ disabled,
147
+ "aria-label": "Value"
148
+ }
149
+ );
150
+ }
151
+ if (metric.valueType === "time_ago") {
152
+ const timeValue = value || { minutes_ago: 10 };
153
+ const unit = Object.keys(timeValue)[0] || "minutes_ago";
154
+ const numValue = timeValue[unit] || 10;
155
+ return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
156
+ /* @__PURE__ */ jsx(Box, { style: { width: "80px" }, children: /* @__PURE__ */ jsx(
157
+ TextInput,
158
+ {
159
+ type: "number",
160
+ value: String(numValue),
161
+ onChange: (e) => onChange({ [unit]: parseInt(e.target.value, 10) || 0 }),
162
+ disabled,
163
+ "aria-label": "Time value"
164
+ }
165
+ ) }),
166
+ /* @__PURE__ */ jsx(Box, { style: { width: "120px" }, children: /* @__PURE__ */ jsx(
167
+ SingleSelect,
168
+ {
169
+ value: unit,
170
+ onChange: (newUnit) => onChange({ [newUnit]: numValue }),
171
+ disabled,
172
+ children: CANCEL_TIME_UNITS.map((u) => /* @__PURE__ */ jsx(SingleSelectOption, { value: u.value, children: u.label }, u.value))
173
+ }
174
+ ) })
175
+ ] });
176
+ }
177
+ return null;
178
+ };
179
+ const RuleRow = ({ rule, onUpdate, onDelete, disabled }) => {
180
+ const theme = useTheme();
181
+ const colors = theme?.colors;
182
+ const metric = getMetric(rule.field);
183
+ const availableOperators = metric?.operators || ["$eq"];
184
+ const handleFieldChange = (fieldKey) => {
185
+ const newMetric = getMetric(fieldKey);
186
+ let newValue = true;
187
+ if (newMetric?.valueType === "number") {
188
+ newValue = 0;
189
+ } else if (newMetric?.valueType === "time_ago") {
190
+ newValue = { minutes_ago: 10 };
191
+ }
192
+ const newOp = newMetric?.operators[0] || "$eq";
193
+ onUpdate({ ...rule, field: fieldKey, operator: newOp, value: newValue });
194
+ };
195
+ return /* @__PURE__ */ jsxs(
196
+ Flex,
197
+ {
198
+ gap: 2,
199
+ alignItems: "center",
200
+ padding: 2,
201
+ background: "neutral0",
202
+ hasRadius: true,
203
+ style: { border: `1px solid ${colors?.neutral200 || "#dcdce4"}` },
204
+ children: [
205
+ /* @__PURE__ */ jsx(Box, { style: { flex: "1 1 200px", minWidth: "180px" }, children: /* @__PURE__ */ jsx(
206
+ SingleSelect,
207
+ {
208
+ value: rule.field,
209
+ onChange: (val) => handleFieldChange(val),
210
+ disabled,
211
+ size: "S",
212
+ children: CANCEL_METRICS.map((m) => /* @__PURE__ */ jsx(SingleSelectOption, { value: m.key, children: m.label }, m.key))
213
+ }
214
+ ) }),
215
+ /* @__PURE__ */ jsx(Box, { style: { width: "80px" }, children: /* @__PURE__ */ jsx(
216
+ SingleSelect,
217
+ {
218
+ value: rule.operator,
219
+ onChange: (val) => onUpdate({ ...rule, operator: val }),
220
+ disabled,
221
+ size: "S",
222
+ children: OPERATORS.filter((op) => availableOperators.includes(op.value)).map((op) => /* @__PURE__ */ jsx(SingleSelectOption, { value: op.value, children: op.label }, op.value))
223
+ }
224
+ ) }),
225
+ /* @__PURE__ */ jsx(Box, { style: { flex: "1 1 150px", minWidth: "120px" }, children: metric && /* @__PURE__ */ jsx(
226
+ ValueInput,
227
+ {
228
+ metric,
229
+ value: rule.value,
230
+ operator: rule.operator,
231
+ onChange: (val) => onUpdate({ ...rule, value: val }),
232
+ disabled
233
+ }
234
+ ) }),
235
+ /* @__PURE__ */ jsx(Tooltip, { label: "Delete condition", children: /* @__PURE__ */ jsx(IconButton, { onClick: onDelete, label: "Delete condition", variant: "ghost", disabled, children: /* @__PURE__ */ jsx(Trash, {}) }) })
236
+ ]
237
+ }
238
+ );
239
+ };
240
+ const CancelConditionsField = forwardRef(
241
+ ({ name, value, onChange, intlLabel, disabled, error, required, hint }, ref) => {
242
+ const [config, setConfig] = useState(() => parseConfig(value));
243
+ const theme = useTheme();
244
+ theme?.colors;
245
+ React__default.useEffect(() => {
246
+ const parsed = parseConfig(value);
247
+ setConfig(parsed);
248
+ }, [value]);
249
+ const handleUpdate = useCallback((newConfig) => {
250
+ setConfig(newConfig);
251
+ onChange({
252
+ target: {
253
+ name,
254
+ value: serializeConfig(newConfig)
255
+ }
256
+ });
257
+ }, [name, onChange]);
258
+ const handleAddRule = () => {
259
+ const newRule = {
260
+ id: generateId(),
261
+ field: "has_deposit_since_trigger",
262
+ operator: "$eq",
263
+ value: true
264
+ };
265
+ handleUpdate({
266
+ ...config,
267
+ rules: [...config.rules, newRule]
268
+ });
269
+ };
270
+ const handleUpdateRule = (ruleId, updatedRule) => {
271
+ handleUpdate({
272
+ ...config,
273
+ rules: config.rules.map((r) => r.id === ruleId ? updatedRule : r)
274
+ });
275
+ };
276
+ const handleDeleteRule = (ruleId) => {
277
+ handleUpdate({
278
+ ...config,
279
+ rules: config.rules.filter((r) => r.id !== ruleId)
280
+ });
281
+ };
282
+ const handleLogicToggle = () => {
283
+ handleUpdate({
284
+ ...config,
285
+ logic: config.logic === "$or" ? "$and" : "$or"
286
+ });
287
+ };
288
+ const hasRules = config.rules.length > 0;
289
+ return /* @__PURE__ */ jsx(Field.Root, { name, error, required, hint, ref, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 3, children: [
290
+ /* @__PURE__ */ jsx(Field.Label, { children: intlLabel?.defaultMessage || "Cancel Conditions" }),
291
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Skip sending if any of these conditions are true (checked right before send)" }),
292
+ /* @__PURE__ */ jsx(Card, { background: "neutral100", children: /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs(Box, { padding: 4, children: [
293
+ hasRules && /* @__PURE__ */ jsx(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 3, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
294
+ /* @__PURE__ */ jsx(
295
+ Button,
296
+ {
297
+ variant: config.logic === "$or" ? "default" : "secondary",
298
+ size: "S",
299
+ onClick: handleLogicToggle,
300
+ disabled,
301
+ children: config.logic === "$or" ? "OR" : "AND"
302
+ }
303
+ ),
304
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: config.logic === "$or" ? "Cancel if ANY condition is true" : "Cancel if ALL conditions are true" })
305
+ ] }) }),
306
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
307
+ config.rules.map((rule) => /* @__PURE__ */ jsx(
308
+ RuleRow,
309
+ {
310
+ rule,
311
+ onUpdate: (updated) => handleUpdateRule(rule.id, updated),
312
+ onDelete: () => handleDeleteRule(rule.id),
313
+ disabled
314
+ },
315
+ rule.id
316
+ )),
317
+ !hasRules && /* @__PURE__ */ jsx(Box, { padding: 4, background: "neutral0", hasRadius: true, style: { textAlign: "center" }, children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral500", children: "No cancel conditions defined. Message will be sent if segment rules match." }) })
318
+ ] }),
319
+ /* @__PURE__ */ jsx(Box, { marginTop: 3, children: /* @__PURE__ */ jsx(
320
+ Button,
321
+ {
322
+ variant: "secondary",
323
+ startIcon: /* @__PURE__ */ jsx(Plus, {}),
324
+ onClick: handleAddRule,
325
+ disabled,
326
+ size: "S",
327
+ children: "Add Cancel Condition"
328
+ }
329
+ ) })
330
+ ] }) }) }),
331
+ error && /* @__PURE__ */ jsx(Field.Error, { children: error }),
332
+ hint && /* @__PURE__ */ jsx(Field.Hint, { children: hint })
333
+ ] }) });
334
+ }
335
+ );
336
+ CancelConditionsField.displayName = "CancelConditionsField";
337
+ export {
338
+ CancelConditionsField as default
339
+ };
@@ -5034,7 +5034,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
5034
5034
  var ys = arrObjKeys(obj, inspect2);
5035
5035
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
5036
5036
  var protoTag = obj instanceof Object ? "" : "null prototype";
5037
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
5037
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
5038
5038
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
5039
5039
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
5040
5040
  if (ys.length === 0) {
@@ -5059,25 +5059,25 @@ function canTrustToString(obj) {
5059
5059
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
5060
5060
  }
5061
5061
  function isArray$8(obj) {
5062
- return toStr(obj) === "[object Array]" && canTrustToString(obj);
5062
+ return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
5063
5063
  }
5064
5064
  function isDate$1(obj) {
5065
- return toStr(obj) === "[object Date]" && canTrustToString(obj);
5065
+ return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
5066
5066
  }
5067
5067
  function isRegExp$1(obj) {
5068
- return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
5068
+ return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
5069
5069
  }
5070
5070
  function isError$1(obj) {
5071
- return toStr(obj) === "[object Error]" && canTrustToString(obj);
5071
+ return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
5072
5072
  }
5073
5073
  function isString(obj) {
5074
- return toStr(obj) === "[object String]" && canTrustToString(obj);
5074
+ return toStr$1(obj) === "[object String]" && canTrustToString(obj);
5075
5075
  }
5076
5076
  function isNumber(obj) {
5077
- return toStr(obj) === "[object Number]" && canTrustToString(obj);
5077
+ return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
5078
5078
  }
5079
5079
  function isBoolean(obj) {
5080
- return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
5080
+ return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
5081
5081
  }
5082
5082
  function isSymbol$2(obj) {
5083
5083
  if (hasShammedSymbols) {
@@ -5113,7 +5113,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
5113
5113
  function has$5(obj, key) {
5114
5114
  return hasOwn$1.call(obj, key);
5115
5115
  }
5116
- function toStr(obj) {
5116
+ function toStr$1(obj) {
5117
5117
  return objectToString.call(obj);
5118
5118
  }
5119
5119
  function nameOf(f2) {
@@ -5422,7 +5422,7 @@ var syntax = SyntaxError;
5422
5422
  var uri = URIError;
5423
5423
  var abs$1 = Math.abs;
5424
5424
  var floor$1 = Math.floor;
5425
- var max$1 = Math.max;
5425
+ var max$2 = Math.max;
5426
5426
  var min$1 = Math.min;
5427
5427
  var pow$1 = Math.pow;
5428
5428
  var round$1 = Math.round;
@@ -5551,99 +5551,78 @@ function requireObject_getPrototypeOf() {
5551
5551
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
5552
5552
  return Object_getPrototypeOf;
5553
5553
  }
5554
- var implementation;
5555
- var hasRequiredImplementation;
5556
- function requireImplementation() {
5557
- if (hasRequiredImplementation) return implementation;
5558
- hasRequiredImplementation = 1;
5559
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
5560
- var toStr2 = Object.prototype.toString;
5561
- var max2 = Math.max;
5562
- var funcType = "[object Function]";
5563
- var concatty = function concatty2(a2, b2) {
5564
- var arr = [];
5565
- for (var i2 = 0; i2 < a2.length; i2 += 1) {
5566
- arr[i2] = a2[i2];
5567
- }
5568
- for (var j2 = 0; j2 < b2.length; j2 += 1) {
5569
- arr[j2 + a2.length] = b2[j2];
5570
- }
5571
- return arr;
5572
- };
5573
- var slicy = function slicy2(arrLike, offset) {
5574
- var arr = [];
5575
- for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
5576
- arr[j2] = arrLike[i2];
5554
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
5555
+ var toStr = Object.prototype.toString;
5556
+ var max$1 = Math.max;
5557
+ var funcType = "[object Function]";
5558
+ var concatty = function concatty2(a2, b2) {
5559
+ var arr = [];
5560
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
5561
+ arr[i2] = a2[i2];
5562
+ }
5563
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
5564
+ arr[j2 + a2.length] = b2[j2];
5565
+ }
5566
+ return arr;
5567
+ };
5568
+ var slicy = function slicy2(arrLike, offset) {
5569
+ var arr = [];
5570
+ for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
5571
+ arr[j2] = arrLike[i2];
5572
+ }
5573
+ return arr;
5574
+ };
5575
+ var joiny = function(arr, joiner) {
5576
+ var str = "";
5577
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
5578
+ str += arr[i2];
5579
+ if (i2 + 1 < arr.length) {
5580
+ str += joiner;
5577
5581
  }
5578
- return arr;
5579
- };
5580
- var joiny = function(arr, joiner) {
5581
- var str = "";
5582
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
5583
- str += arr[i2];
5584
- if (i2 + 1 < arr.length) {
5585
- str += joiner;
5582
+ }
5583
+ return str;
5584
+ };
5585
+ var implementation$1 = function bind(that) {
5586
+ var target = this;
5587
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
5588
+ throw new TypeError(ERROR_MESSAGE + target);
5589
+ }
5590
+ var args = slicy(arguments, 1);
5591
+ var bound;
5592
+ var binder = function() {
5593
+ if (this instanceof bound) {
5594
+ var result = target.apply(
5595
+ this,
5596
+ concatty(args, arguments)
5597
+ );
5598
+ if (Object(result) === result) {
5599
+ return result;
5586
5600
  }
5601
+ return this;
5587
5602
  }
5588
- return str;
5603
+ return target.apply(
5604
+ that,
5605
+ concatty(args, arguments)
5606
+ );
5589
5607
  };
5590
- implementation = function bind2(that) {
5591
- var target = this;
5592
- if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
5593
- throw new TypeError(ERROR_MESSAGE + target);
5594
- }
5595
- var args = slicy(arguments, 1);
5596
- var bound;
5597
- var binder = function() {
5598
- if (this instanceof bound) {
5599
- var result = target.apply(
5600
- this,
5601
- concatty(args, arguments)
5602
- );
5603
- if (Object(result) === result) {
5604
- return result;
5605
- }
5606
- return this;
5607
- }
5608
- return target.apply(
5609
- that,
5610
- concatty(args, arguments)
5611
- );
5608
+ var boundLength = max$1(0, target.length - args.length);
5609
+ var boundArgs = [];
5610
+ for (var i2 = 0; i2 < boundLength; i2++) {
5611
+ boundArgs[i2] = "$" + i2;
5612
+ }
5613
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
5614
+ if (target.prototype) {
5615
+ var Empty = function Empty2() {
5612
5616
  };
5613
- var boundLength = max2(0, target.length - args.length);
5614
- var boundArgs = [];
5615
- for (var i2 = 0; i2 < boundLength; i2++) {
5616
- boundArgs[i2] = "$" + i2;
5617
- }
5618
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
5619
- if (target.prototype) {
5620
- var Empty = function Empty2() {
5621
- };
5622
- Empty.prototype = target.prototype;
5623
- bound.prototype = new Empty();
5624
- Empty.prototype = null;
5625
- }
5626
- return bound;
5627
- };
5628
- return implementation;
5629
- }
5630
- var functionBind;
5631
- var hasRequiredFunctionBind;
5632
- function requireFunctionBind() {
5633
- if (hasRequiredFunctionBind) return functionBind;
5634
- hasRequiredFunctionBind = 1;
5635
- var implementation2 = requireImplementation();
5636
- functionBind = Function.prototype.bind || implementation2;
5637
- return functionBind;
5638
- }
5639
- var functionCall;
5640
- var hasRequiredFunctionCall;
5641
- function requireFunctionCall() {
5642
- if (hasRequiredFunctionCall) return functionCall;
5643
- hasRequiredFunctionCall = 1;
5644
- functionCall = Function.prototype.call;
5645
- return functionCall;
5646
- }
5617
+ Empty.prototype = target.prototype;
5618
+ bound.prototype = new Empty();
5619
+ Empty.prototype = null;
5620
+ }
5621
+ return bound;
5622
+ };
5623
+ var implementation = implementation$1;
5624
+ var functionBind = Function.prototype.bind || implementation;
5625
+ var functionCall = Function.prototype.call;
5647
5626
  var functionApply;
5648
5627
  var hasRequiredFunctionApply;
5649
5628
  function requireFunctionApply() {
@@ -5653,14 +5632,14 @@ function requireFunctionApply() {
5653
5632
  return functionApply;
5654
5633
  }
5655
5634
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
5656
- var bind$2 = requireFunctionBind();
5635
+ var bind$2 = functionBind;
5657
5636
  var $apply$1 = requireFunctionApply();
5658
- var $call$2 = requireFunctionCall();
5637
+ var $call$2 = functionCall;
5659
5638
  var $reflectApply = reflectApply;
5660
5639
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
5661
- var bind$1 = requireFunctionBind();
5640
+ var bind$1 = functionBind;
5662
5641
  var $TypeError$4 = type;
5663
- var $call$1 = requireFunctionCall();
5642
+ var $call$1 = functionCall;
5664
5643
  var $actualApply = actualApply;
5665
5644
  var callBindApplyHelpers = function callBindBasic(args) {
5666
5645
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -5726,8 +5705,8 @@ function requireHasown() {
5726
5705
  hasRequiredHasown = 1;
5727
5706
  var call = Function.prototype.call;
5728
5707
  var $hasOwn = Object.prototype.hasOwnProperty;
5729
- var bind2 = requireFunctionBind();
5730
- hasown = bind2.call(call, $hasOwn);
5708
+ var bind3 = functionBind;
5709
+ hasown = bind3.call(call, $hasOwn);
5731
5710
  return hasown;
5732
5711
  }
5733
5712
  var undefined$1;
@@ -5741,7 +5720,7 @@ var $TypeError$3 = type;
5741
5720
  var $URIError = uri;
5742
5721
  var abs = abs$1;
5743
5722
  var floor = floor$1;
5744
- var max = max$1;
5723
+ var max = max$2;
5745
5724
  var min = min$1;
5746
5725
  var pow = pow$1;
5747
5726
  var round = round$1;
@@ -5775,7 +5754,7 @@ var getProto = requireGetProto();
5775
5754
  var $ObjectGPO = requireObject_getPrototypeOf();
5776
5755
  var $ReflectGPO = requireReflect_getPrototypeOf();
5777
5756
  var $apply = requireFunctionApply();
5778
- var $call = requireFunctionCall();
5757
+ var $call = functionCall;
5779
5758
  var needsEval = {};
5780
5759
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
5781
5760
  var INTRINSICS = {
@@ -5946,13 +5925,13 @@ var LEGACY_ALIASES = {
5946
5925
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
5947
5926
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
5948
5927
  };
5949
- var bind = requireFunctionBind();
5928
+ var bind2 = functionBind;
5950
5929
  var hasOwn = requireHasown();
5951
- var $concat = bind.call($call, Array.prototype.concat);
5952
- var $spliceApply = bind.call($apply, Array.prototype.splice);
5953
- var $replace = bind.call($call, String.prototype.replace);
5954
- var $strSlice = bind.call($call, String.prototype.slice);
5955
- var $exec = bind.call($call, RegExp.prototype.exec);
5930
+ var $concat = bind2.call($call, Array.prototype.concat);
5931
+ var $spliceApply = bind2.call($apply, Array.prototype.splice);
5932
+ var $replace = bind2.call($call, String.prototype.replace);
5933
+ var $strSlice = bind2.call($call, String.prototype.slice);
5934
+ var $exec = bind2.call($call, RegExp.prototype.exec);
5956
5935
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
5957
5936
  var reEscapeChar = /\\(\\)?/g;
5958
5937
  var stringToPath$1 = function stringToPath(string2) {
@@ -16971,9 +16950,9 @@ const usersService = adminApi.enhanceEndpoints({
16971
16950
  });
16972
16951
  const { useCreateUserMutation, useGetUsersQuery, useUpdateUserMutation, useDeleteManyUsersMutation, useGetRolesQuery, useCreateRoleMutation, useUpdateRoleMutation, useGetRolePermissionsQuery, useGetRolePermissionLayoutQuery, useUpdateRolePermissionsMutation } = usersService;
16973
16952
  const getBackendUrl = () => {
16974
- const raw = process.env.STRAPI_ADMIN_CRM_BACKEND_URL || "http://localhost:3100/api";
16953
+ const raw = process.env.STRAPI_ADMIN_CRM_BACKEND_URL || "http://localhost:3100";
16975
16954
  if (!/^https?:\/\//i.test(raw)) {
16976
- return "http://localhost:3100/api";
16955
+ return "http://localhost:3100";
16977
16956
  }
16978
16957
  return raw.endsWith("/") ? raw.slice(0, -1) : raw;
16979
16958
  };
@@ -16994,7 +16973,7 @@ const LogsTable = () => {
16994
16973
  if (filterUserId) params.set("userId", filterUserId);
16995
16974
  if (filterStatus) params.set("status", filterStatus);
16996
16975
  const backendUrl = getBackendUrl();
16997
- const res = await fetch(new URL(`/crm/logs?${params}`, backendUrl).toString());
16976
+ const res = await fetch(new URL(`/api/crm/logs?${params}`, backendUrl).toString());
16998
16977
  if (res.ok) {
16999
16978
  const data = await res.json();
17000
16979
  setLogs(data.data || []);
@@ -17120,7 +17099,7 @@ const AntiSpamLogsTable = () => {
17120
17099
  pageSize: "20"
17121
17100
  });
17122
17101
  const backendUrl = getBackendUrl();
17123
- const res = await fetch(new URL(`/crm/anti-spam-logs?${params}`, backendUrl).toString());
17102
+ const res = await fetch(new URL(`/api/crm/anti-spam-logs?${params}`, backendUrl).toString());
17124
17103
  if (res.ok) {
17125
17104
  const data = await res.json();
17126
17105
  setLogs(data.data || []);
@@ -17214,7 +17193,7 @@ const StatsView = () => {
17214
17193
  setLoading(true);
17215
17194
  try {
17216
17195
  const backendUrl = getBackendUrl();
17217
- const res = await fetch(new URL("/crm/stats", backendUrl).toString());
17196
+ const res = await fetch(new URL("/api/crm/stats", backendUrl).toString());
17218
17197
  if (res.ok) {
17219
17198
  const data = await res.json();
17220
17199
  setStats(Array.isArray(data) ? data : []);