@inspirer-dev/crm-dashboard 1.0.31 → 1.0.33

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.
@@ -8,23 +8,44 @@ import type { StepFlowBuilderProps, FlowStep, CampaignContext, EntrySegment } fr
8
8
  import { parseValue } from './utils';
9
9
  import { FlowCanvas } from './flow-canvas';
10
10
 
11
+ type SegmentItem = { id?: number; documentId?: string; name?: string };
12
+
11
13
  type RawSegmentValue =
12
14
  | number
13
- | { id?: number; documentId?: string; name?: string }
15
+ | SegmentItem
16
+ | SegmentItem[]
17
+ | { connect?: SegmentItem[]; disconnect?: SegmentItem[] }
14
18
  | null
15
19
  | undefined;
16
20
 
17
- const extractSegmentId = (value: RawSegmentValue): number | null => {
21
+ const extractSegmentFromValue = (value: RawSegmentValue): SegmentItem | null => {
18
22
  if (!value) return null;
19
- if (typeof value === 'number') return value;
20
- if (typeof value === 'object' && value.id) return value.id;
23
+ if (typeof value === 'number') return { id: value };
24
+ if (Array.isArray(value)) {
25
+ return value.length > 0 ? value[0] : null;
26
+ }
27
+ if (typeof value === 'object') {
28
+ if ('connect' in value && Array.isArray(value.connect) && value.connect.length > 0) {
29
+ return value.connect[0];
30
+ }
31
+ if ('id' in value && value.id) {
32
+ return value as SegmentItem;
33
+ }
34
+ if ('documentId' in value && value.documentId) {
35
+ return value as SegmentItem;
36
+ }
37
+ }
21
38
  return null;
22
39
  };
23
40
 
41
+ const extractSegmentId = (value: RawSegmentValue): number | null => {
42
+ const segment = extractSegmentFromValue(value);
43
+ return segment?.id ?? null;
44
+ };
45
+
24
46
  const extractSegmentName = (value: RawSegmentValue): string | null => {
25
- if (!value) return null;
26
- if (typeof value === 'object' && value.name) return value.name;
27
- return null;
47
+ const segment = extractSegmentFromValue(value);
48
+ return segment?.name ?? null;
28
49
  };
29
50
 
30
51
  const StepFlowBuilderInner = forwardRef<HTMLDivElement, StepFlowBuilderProps>(
@@ -5,16 +5,32 @@ import "reactflow/dist/style.css";
5
5
  import { Field, Flex, Badge, Box } from "@strapi/design-system";
6
6
  import { useForm } from "@strapi/strapi/admin";
7
7
  import { p as parseValue, F as FlowCanvas } from "./FlowCanvas-DeOEnPV0.mjs";
8
- const extractSegmentId = (value) => {
8
+ const extractSegmentFromValue = (value) => {
9
9
  if (!value) return null;
10
- if (typeof value === "number") return value;
11
- if (typeof value === "object" && value.id) return value.id;
10
+ if (typeof value === "number") return { id: value };
11
+ if (Array.isArray(value)) {
12
+ return value.length > 0 ? value[0] : null;
13
+ }
14
+ if (typeof value === "object") {
15
+ if ("connect" in value && Array.isArray(value.connect) && value.connect.length > 0) {
16
+ return value.connect[0];
17
+ }
18
+ if ("id" in value && value.id) {
19
+ return value;
20
+ }
21
+ if ("documentId" in value && value.documentId) {
22
+ return value;
23
+ }
24
+ }
12
25
  return null;
13
26
  };
27
+ const extractSegmentId = (value) => {
28
+ const segment = extractSegmentFromValue(value);
29
+ return segment?.id ?? null;
30
+ };
14
31
  const extractSegmentName = (value) => {
15
- if (!value) return null;
16
- if (typeof value === "object" && value.name) return value.name;
17
- return null;
32
+ const segment = extractSegmentFromValue(value);
33
+ return segment?.name ?? null;
18
34
  };
19
35
  const StepFlowBuilderInner = forwardRef(
20
36
  ({ name, value, onChange, intlLabel, disabled, error, required, hint }, ref) => {
@@ -5016,7 +5016,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
5016
5016
  var ys = arrObjKeys(obj, inspect2);
5017
5017
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
5018
5018
  var protoTag = obj instanceof Object ? "" : "null prototype";
5019
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
5019
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
5020
5020
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
5021
5021
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
5022
5022
  if (ys.length === 0) {
@@ -5041,25 +5041,25 @@ function canTrustToString(obj) {
5041
5041
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
5042
5042
  }
5043
5043
  function isArray$8(obj) {
5044
- return toStr(obj) === "[object Array]" && canTrustToString(obj);
5044
+ return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
5045
5045
  }
5046
5046
  function isDate$1(obj) {
5047
- return toStr(obj) === "[object Date]" && canTrustToString(obj);
5047
+ return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
5048
5048
  }
5049
5049
  function isRegExp$1(obj) {
5050
- return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
5050
+ return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
5051
5051
  }
5052
5052
  function isError$1(obj) {
5053
- return toStr(obj) === "[object Error]" && canTrustToString(obj);
5053
+ return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
5054
5054
  }
5055
5055
  function isString(obj) {
5056
- return toStr(obj) === "[object String]" && canTrustToString(obj);
5056
+ return toStr$1(obj) === "[object String]" && canTrustToString(obj);
5057
5057
  }
5058
5058
  function isNumber(obj) {
5059
- return toStr(obj) === "[object Number]" && canTrustToString(obj);
5059
+ return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
5060
5060
  }
5061
5061
  function isBoolean(obj) {
5062
- return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
5062
+ return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
5063
5063
  }
5064
5064
  function isSymbol$2(obj) {
5065
5065
  if (hasShammedSymbols) {
@@ -5095,7 +5095,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
5095
5095
  function has$5(obj, key) {
5096
5096
  return hasOwn$1.call(obj, key);
5097
5097
  }
5098
- function toStr(obj) {
5098
+ function toStr$1(obj) {
5099
5099
  return objectToString.call(obj);
5100
5100
  }
5101
5101
  function nameOf(f2) {
@@ -5404,7 +5404,7 @@ var syntax = SyntaxError;
5404
5404
  var uri = URIError;
5405
5405
  var abs$1 = Math.abs;
5406
5406
  var floor$1 = Math.floor;
5407
- var max$1 = Math.max;
5407
+ var max$2 = Math.max;
5408
5408
  var min$1 = Math.min;
5409
5409
  var pow$1 = Math.pow;
5410
5410
  var round$1 = Math.round;
@@ -5533,99 +5533,78 @@ function requireObject_getPrototypeOf() {
5533
5533
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
5534
5534
  return Object_getPrototypeOf;
5535
5535
  }
5536
- var implementation;
5537
- var hasRequiredImplementation;
5538
- function requireImplementation() {
5539
- if (hasRequiredImplementation) return implementation;
5540
- hasRequiredImplementation = 1;
5541
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
5542
- var toStr2 = Object.prototype.toString;
5543
- var max2 = Math.max;
5544
- var funcType = "[object Function]";
5545
- var concatty = function concatty2(a2, b2) {
5546
- var arr = [];
5547
- for (var i2 = 0; i2 < a2.length; i2 += 1) {
5548
- arr[i2] = a2[i2];
5549
- }
5550
- for (var j2 = 0; j2 < b2.length; j2 += 1) {
5551
- arr[j2 + a2.length] = b2[j2];
5552
- }
5553
- return arr;
5554
- };
5555
- var slicy = function slicy2(arrLike, offset) {
5556
- var arr = [];
5557
- for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
5558
- arr[j2] = arrLike[i2];
5536
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
5537
+ var toStr = Object.prototype.toString;
5538
+ var max$1 = Math.max;
5539
+ var funcType = "[object Function]";
5540
+ var concatty = function concatty2(a2, b2) {
5541
+ var arr = [];
5542
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
5543
+ arr[i2] = a2[i2];
5544
+ }
5545
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
5546
+ arr[j2 + a2.length] = b2[j2];
5547
+ }
5548
+ return arr;
5549
+ };
5550
+ var slicy = function slicy2(arrLike, offset) {
5551
+ var arr = [];
5552
+ for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
5553
+ arr[j2] = arrLike[i2];
5554
+ }
5555
+ return arr;
5556
+ };
5557
+ var joiny = function(arr, joiner) {
5558
+ var str = "";
5559
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
5560
+ str += arr[i2];
5561
+ if (i2 + 1 < arr.length) {
5562
+ str += joiner;
5559
5563
  }
5560
- return arr;
5561
- };
5562
- var joiny = function(arr, joiner) {
5563
- var str = "";
5564
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
5565
- str += arr[i2];
5566
- if (i2 + 1 < arr.length) {
5567
- str += joiner;
5564
+ }
5565
+ return str;
5566
+ };
5567
+ var implementation$1 = function bind(that) {
5568
+ var target = this;
5569
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
5570
+ throw new TypeError(ERROR_MESSAGE + target);
5571
+ }
5572
+ var args = slicy(arguments, 1);
5573
+ var bound;
5574
+ var binder = function() {
5575
+ if (this instanceof bound) {
5576
+ var result = target.apply(
5577
+ this,
5578
+ concatty(args, arguments)
5579
+ );
5580
+ if (Object(result) === result) {
5581
+ return result;
5568
5582
  }
5583
+ return this;
5569
5584
  }
5570
- return str;
5585
+ return target.apply(
5586
+ that,
5587
+ concatty(args, arguments)
5588
+ );
5571
5589
  };
5572
- implementation = function bind2(that) {
5573
- var target = this;
5574
- if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
5575
- throw new TypeError(ERROR_MESSAGE + target);
5576
- }
5577
- var args = slicy(arguments, 1);
5578
- var bound;
5579
- var binder = function() {
5580
- if (this instanceof bound) {
5581
- var result = target.apply(
5582
- this,
5583
- concatty(args, arguments)
5584
- );
5585
- if (Object(result) === result) {
5586
- return result;
5587
- }
5588
- return this;
5589
- }
5590
- return target.apply(
5591
- that,
5592
- concatty(args, arguments)
5593
- );
5590
+ var boundLength = max$1(0, target.length - args.length);
5591
+ var boundArgs = [];
5592
+ for (var i2 = 0; i2 < boundLength; i2++) {
5593
+ boundArgs[i2] = "$" + i2;
5594
+ }
5595
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
5596
+ if (target.prototype) {
5597
+ var Empty = function Empty2() {
5594
5598
  };
5595
- var boundLength = max2(0, target.length - args.length);
5596
- var boundArgs = [];
5597
- for (var i2 = 0; i2 < boundLength; i2++) {
5598
- boundArgs[i2] = "$" + i2;
5599
- }
5600
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
5601
- if (target.prototype) {
5602
- var Empty = function Empty2() {
5603
- };
5604
- Empty.prototype = target.prototype;
5605
- bound.prototype = new Empty();
5606
- Empty.prototype = null;
5607
- }
5608
- return bound;
5609
- };
5610
- return implementation;
5611
- }
5612
- var functionBind;
5613
- var hasRequiredFunctionBind;
5614
- function requireFunctionBind() {
5615
- if (hasRequiredFunctionBind) return functionBind;
5616
- hasRequiredFunctionBind = 1;
5617
- var implementation2 = requireImplementation();
5618
- functionBind = Function.prototype.bind || implementation2;
5619
- return functionBind;
5620
- }
5621
- var functionCall;
5622
- var hasRequiredFunctionCall;
5623
- function requireFunctionCall() {
5624
- if (hasRequiredFunctionCall) return functionCall;
5625
- hasRequiredFunctionCall = 1;
5626
- functionCall = Function.prototype.call;
5627
- return functionCall;
5628
- }
5599
+ Empty.prototype = target.prototype;
5600
+ bound.prototype = new Empty();
5601
+ Empty.prototype = null;
5602
+ }
5603
+ return bound;
5604
+ };
5605
+ var implementation = implementation$1;
5606
+ var functionBind = Function.prototype.bind || implementation;
5607
+ var functionCall = Function.prototype.call;
5629
5608
  var functionApply;
5630
5609
  var hasRequiredFunctionApply;
5631
5610
  function requireFunctionApply() {
@@ -5635,14 +5614,14 @@ function requireFunctionApply() {
5635
5614
  return functionApply;
5636
5615
  }
5637
5616
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
5638
- var bind$2 = requireFunctionBind();
5617
+ var bind$2 = functionBind;
5639
5618
  var $apply$1 = requireFunctionApply();
5640
- var $call$2 = requireFunctionCall();
5619
+ var $call$2 = functionCall;
5641
5620
  var $reflectApply = reflectApply;
5642
5621
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
5643
- var bind$1 = requireFunctionBind();
5622
+ var bind$1 = functionBind;
5644
5623
  var $TypeError$4 = type;
5645
- var $call$1 = requireFunctionCall();
5624
+ var $call$1 = functionCall;
5646
5625
  var $actualApply = actualApply;
5647
5626
  var callBindApplyHelpers = function callBindBasic(args) {
5648
5627
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -5708,8 +5687,8 @@ function requireHasown() {
5708
5687
  hasRequiredHasown = 1;
5709
5688
  var call = Function.prototype.call;
5710
5689
  var $hasOwn = Object.prototype.hasOwnProperty;
5711
- var bind2 = requireFunctionBind();
5712
- hasown = bind2.call(call, $hasOwn);
5690
+ var bind3 = functionBind;
5691
+ hasown = bind3.call(call, $hasOwn);
5713
5692
  return hasown;
5714
5693
  }
5715
5694
  var undefined$1;
@@ -5723,7 +5702,7 @@ var $TypeError$3 = type;
5723
5702
  var $URIError = uri;
5724
5703
  var abs = abs$1;
5725
5704
  var floor = floor$1;
5726
- var max = max$1;
5705
+ var max = max$2;
5727
5706
  var min = min$1;
5728
5707
  var pow = pow$1;
5729
5708
  var round = round$1;
@@ -5757,7 +5736,7 @@ var getProto = requireGetProto();
5757
5736
  var $ObjectGPO = requireObject_getPrototypeOf();
5758
5737
  var $ReflectGPO = requireReflect_getPrototypeOf();
5759
5738
  var $apply = requireFunctionApply();
5760
- var $call = requireFunctionCall();
5739
+ var $call = functionCall;
5761
5740
  var needsEval = {};
5762
5741
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
5763
5742
  var INTRINSICS = {
@@ -5928,13 +5907,13 @@ var LEGACY_ALIASES = {
5928
5907
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
5929
5908
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
5930
5909
  };
5931
- var bind = requireFunctionBind();
5910
+ var bind2 = functionBind;
5932
5911
  var hasOwn = requireHasown();
5933
- var $concat = bind.call($call, Array.prototype.concat);
5934
- var $spliceApply = bind.call($apply, Array.prototype.splice);
5935
- var $replace = bind.call($call, String.prototype.replace);
5936
- var $strSlice = bind.call($call, String.prototype.slice);
5937
- var $exec = bind.call($call, RegExp.prototype.exec);
5912
+ var $concat = bind2.call($call, Array.prototype.concat);
5913
+ var $spliceApply = bind2.call($apply, Array.prototype.splice);
5914
+ var $replace = bind2.call($call, String.prototype.replace);
5915
+ var $strSlice = bind2.call($call, String.prototype.slice);
5916
+ var $exec = bind2.call($call, RegExp.prototype.exec);
5938
5917
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
5939
5918
  var reEscapeChar = /\\(\\)?/g;
5940
5919
  var stringToPath$1 = function stringToPath(string2) {
@@ -29,16 +29,32 @@ require("reactflow/dist/style.css");
29
29
  const designSystem = require("@strapi/design-system");
30
30
  const admin = require("@strapi/strapi/admin");
31
31
  const FlowCanvas = require("./FlowCanvas-C83ErNYt.js");
32
- const extractSegmentId = (value) => {
32
+ const extractSegmentFromValue = (value) => {
33
33
  if (!value) return null;
34
- if (typeof value === "number") return value;
35
- if (typeof value === "object" && value.id) return value.id;
34
+ if (typeof value === "number") return { id: value };
35
+ if (Array.isArray(value)) {
36
+ return value.length > 0 ? value[0] : null;
37
+ }
38
+ if (typeof value === "object") {
39
+ if ("connect" in value && Array.isArray(value.connect) && value.connect.length > 0) {
40
+ return value.connect[0];
41
+ }
42
+ if ("id" in value && value.id) {
43
+ return value;
44
+ }
45
+ if ("documentId" in value && value.documentId) {
46
+ return value;
47
+ }
48
+ }
36
49
  return null;
37
50
  };
51
+ const extractSegmentId = (value) => {
52
+ const segment = extractSegmentFromValue(value);
53
+ return segment?.id ?? null;
54
+ };
38
55
  const extractSegmentName = (value) => {
39
- if (!value) return null;
40
- if (typeof value === "object" && value.name) return value.name;
41
- return null;
56
+ const segment = extractSegmentFromValue(value);
57
+ return segment?.name ?? null;
42
58
  };
43
59
  const StepFlowBuilderInner = React.forwardRef(
44
60
  ({ name, value, onChange, intlLabel, disabled, error, required, hint }, ref) => {
@@ -131,7 +131,7 @@ const index = {
131
131
  components: {
132
132
  Input: async () => Promise.resolve().then(() => require(
133
133
  /* webpackChunkName: "crm-step-flow-builder" */
134
- "../_chunks/index-M5DjnD5_.js"
134
+ "../_chunks/index-CqO7LEVh.js"
135
135
  ))
136
136
  },
137
137
  options: {
@@ -130,7 +130,7 @@ const index = {
130
130
  components: {
131
131
  Input: async () => import(
132
132
  /* webpackChunkName: "crm-step-flow-builder" */
133
- "../_chunks/index-o6OKhTfK.mjs"
133
+ "../_chunks/index-BNOhY9sY.mjs"
134
134
  )
135
135
  },
136
136
  options: {
@@ -148,7 +148,7 @@ const index = {
148
148
  Component: async () => {
149
149
  const component = await import(
150
150
  /* webpackChunkName: "crm-dashboard-page" */
151
- "../_chunks/index-DK0SzKlX.mjs"
151
+ "../_chunks/index-CjLk1_Rj.mjs"
152
152
  );
153
153
  return component;
154
154
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inspirer-dev/crm-dashboard",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "CRM Dashboard and Tools",
5
5
  "strapi": {
6
6
  "name": "crm-dashboard",