@procore/saved-views 5.0.0-alpha.4 → 5.1.0-alpha

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.
@@ -63,7 +63,7 @@ var require_big = __commonJS({
63
63
  "use strict";
64
64
  (function(GLOBAL) {
65
65
  "use strict";
66
- var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero", P3 = {}, UNDEFINED = void 0, NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
66
+ var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, STRICT = false, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero", P4 = {}, UNDEFINED = void 0, NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
67
67
  function _Big_() {
68
68
  function Big2(n2) {
69
69
  var x2 = this;
@@ -84,7 +84,7 @@ var require_big = __commonJS({
84
84
  }
85
85
  x2.constructor = Big2;
86
86
  }
87
- Big2.prototype = P3;
87
+ Big2.prototype = P4;
88
88
  Big2.DP = DP;
89
89
  Big2.RM = RM;
90
90
  Big2.NE = NE;
@@ -181,12 +181,12 @@ var require_big = __commonJS({
181
181
  }
182
182
  return x2.s < 0 && isNonzero ? "-" + s2 : s2;
183
183
  }
184
- P3.abs = function() {
184
+ P4.abs = function() {
185
185
  var x2 = new this.constructor(this);
186
186
  x2.s = 1;
187
187
  return x2;
188
188
  };
189
- P3.cmp = function(y2) {
189
+ P4.cmp = function(y2) {
190
190
  var isneg, x2 = this, xc = x2.c, yc = (y2 = new x2.constructor(y2)).c, i2 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
191
191
  if (!xc[0] || !yc[0])
192
192
  return !xc[0] ? !yc[0] ? 0 : -j2 : i2;
@@ -202,7 +202,7 @@ var require_big = __commonJS({
202
202
  }
203
203
  return k2 == l2 ? 0 : k2 > l2 ^ isneg ? 1 : -1;
204
204
  };
205
- P3.div = function(y2) {
205
+ P4.div = function(y2) {
206
206
  var x2 = this, Big2 = x2.constructor, a2 = x2.c, b2 = (y2 = new Big2(y2)).c, k2 = x2.s == y2.s ? 1 : -1, dp = Big2.DP;
207
207
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
208
208
  throw Error(INVALID_DP);
@@ -265,22 +265,22 @@ var require_big = __commonJS({
265
265
  round(q2, p, Big2.RM, r2[0] !== UNDEFINED);
266
266
  return q2;
267
267
  };
268
- P3.eq = function(y2) {
268
+ P4.eq = function(y2) {
269
269
  return this.cmp(y2) === 0;
270
270
  };
271
- P3.gt = function(y2) {
271
+ P4.gt = function(y2) {
272
272
  return this.cmp(y2) > 0;
273
273
  };
274
- P3.gte = function(y2) {
274
+ P4.gte = function(y2) {
275
275
  return this.cmp(y2) > -1;
276
276
  };
277
- P3.lt = function(y2) {
277
+ P4.lt = function(y2) {
278
278
  return this.cmp(y2) < 0;
279
279
  };
280
- P3.lte = function(y2) {
280
+ P4.lte = function(y2) {
281
281
  return this.cmp(y2) < 1;
282
282
  };
283
- P3.minus = P3.sub = function(y2) {
283
+ P4.minus = P4.sub = function(y2) {
284
284
  var i2, j2, t2, xlty, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
285
285
  if (a2 != b2) {
286
286
  y2.s = -b2;
@@ -350,7 +350,7 @@ var require_big = __commonJS({
350
350
  y2.e = ye2;
351
351
  return y2;
352
352
  };
353
- P3.mod = function(y2) {
353
+ P4.mod = function(y2) {
354
354
  var ygtx, x2 = this, Big2 = x2.constructor, a2 = x2.s, b2 = (y2 = new Big2(y2)).s;
355
355
  if (!y2.c[0]) {
356
356
  throw Error(DIV_BY_ZERO);
@@ -369,12 +369,12 @@ var require_big = __commonJS({
369
369
  Big2.RM = b2;
370
370
  return this.minus(x2.times(y2));
371
371
  };
372
- P3.neg = function() {
372
+ P4.neg = function() {
373
373
  var x2 = new this.constructor(this);
374
374
  x2.s = -x2.s;
375
375
  return x2;
376
376
  };
377
- P3.plus = P3.add = function(y2) {
377
+ P4.plus = P4.add = function(y2) {
378
378
  var e2, k2, t2, x2 = this, Big2 = x2.constructor;
379
379
  y2 = new Big2(y2);
380
380
  if (x2.s != y2.s) {
@@ -424,7 +424,7 @@ var require_big = __commonJS({
424
424
  y2.e = ye2;
425
425
  return y2;
426
426
  };
427
- P3.pow = function(n2) {
427
+ P4.pow = function(n2) {
428
428
  var x2 = this, one = new x2.constructor("1"), y2 = one, isneg = n2 < 0;
429
429
  if (n2 !== ~~n2 || n2 < -MAX_POWER || n2 > MAX_POWER) {
430
430
  throw Error(INVALID + "exponent");
@@ -441,13 +441,13 @@ var require_big = __commonJS({
441
441
  }
442
442
  return isneg ? one.div(y2) : y2;
443
443
  };
444
- P3.prec = function(sd, rm) {
444
+ P4.prec = function(sd, rm) {
445
445
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
446
446
  throw Error(INVALID + "precision");
447
447
  }
448
448
  return round(new this.constructor(this), sd, rm);
449
449
  };
450
- P3.round = function(dp, rm) {
450
+ P4.round = function(dp, rm) {
451
451
  if (dp === UNDEFINED)
452
452
  dp = 0;
453
453
  else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
@@ -455,7 +455,7 @@ var require_big = __commonJS({
455
455
  }
456
456
  return round(new this.constructor(this), dp + this.e + 1, rm);
457
457
  };
458
- P3.sqrt = function() {
458
+ P4.sqrt = function() {
459
459
  var r2, c2, t2, x2 = this, Big2 = x2.constructor, s2 = x2.s, e2 = x2.e, half = new Big2("0.5");
460
460
  if (!x2.c[0])
461
461
  return new Big2(x2);
@@ -480,7 +480,7 @@ var require_big = __commonJS({
480
480
  } while (t2.c.slice(0, e2).join("") !== r2.c.slice(0, e2).join(""));
481
481
  return round(r2, (Big2.DP -= 4) + r2.e + 1, Big2.RM);
482
482
  };
483
- P3.times = P3.mul = function(y2) {
483
+ P4.times = P4.mul = function(y2) {
484
484
  var c2, x2 = this, Big2 = x2.constructor, xc = x2.c, yc = (y2 = new Big2(y2)).c, a2 = xc.length, b2 = yc.length, i2 = x2.e, j2 = y2.e;
485
485
  y2.s = x2.s == y2.s ? 1 : -1;
486
486
  if (!xc[0] || !yc[0]) {
@@ -516,7 +516,7 @@ var require_big = __commonJS({
516
516
  y2.c = c2;
517
517
  return y2;
518
518
  };
519
- P3.toExponential = function(dp, rm) {
519
+ P4.toExponential = function(dp, rm) {
520
520
  var x2 = this, n2 = x2.c[0];
521
521
  if (dp !== UNDEFINED) {
522
522
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
@@ -528,7 +528,7 @@ var require_big = __commonJS({
528
528
  }
529
529
  return stringify(x2, true, !!n2);
530
530
  };
531
- P3.toFixed = function(dp, rm) {
531
+ P4.toFixed = function(dp, rm) {
532
532
  var x2 = this, n2 = x2.c[0];
533
533
  if (dp !== UNDEFINED) {
534
534
  if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
@@ -540,18 +540,18 @@ var require_big = __commonJS({
540
540
  }
541
541
  return stringify(x2, false, !!n2);
542
542
  };
543
- P3.toJSON = P3.toString = function() {
543
+ P4.toJSON = P4.toString = function() {
544
544
  var x2 = this, Big2 = x2.constructor;
545
545
  return stringify(x2, x2.e <= Big2.NE || x2.e >= Big2.PE, !!x2.c[0]);
546
546
  };
547
- P3.toNumber = function() {
547
+ P4.toNumber = function() {
548
548
  var n2 = +stringify(this, true, true);
549
549
  if (this.constructor.strict === true && !this.eq(n2.toString())) {
550
550
  throw Error(NAME + "Imprecise conversion");
551
551
  }
552
552
  return n2;
553
553
  };
554
- P3.toPrecision = function(sd, rm) {
554
+ P4.toPrecision = function(sd, rm) {
555
555
  var x2 = this, Big2 = x2.constructor, n2 = x2.c[0];
556
556
  if (sd !== UNDEFINED) {
557
557
  if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
@@ -563,7 +563,7 @@ var require_big = __commonJS({
563
563
  }
564
564
  return stringify(x2, sd <= x2.e || x2.e <= Big2.NE || x2.e >= Big2.PE, !!n2);
565
565
  };
566
- P3.valueOf = function() {
566
+ P4.valueOf = function() {
567
567
  var x2 = this, Big2 = x2.constructor;
568
568
  if (Big2.strict === true) {
569
569
  throw Error(NAME + "valueOf disallowed");
@@ -1873,13 +1873,13 @@ var require_GetFallbackLocaleList = __commonJS({
1873
1873
  var require_GetTranslationsFromLocale = __commonJS({
1874
1874
  "../../node_modules/@procore/globalization-toolkit/dist/getTranslationsFromLocale/GetTranslationsFromLocale.js"(exports2) {
1875
1875
  "use strict";
1876
- var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P3, generator) {
1876
+ var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P4, generator) {
1877
1877
  function adopt(value) {
1878
- return value instanceof P3 ? value : new P3(function(resolve) {
1878
+ return value instanceof P4 ? value : new P4(function(resolve) {
1879
1879
  resolve(value);
1880
1880
  });
1881
1881
  }
1882
- return new (P3 || (P3 = Promise))(function(resolve, reject) {
1882
+ return new (P4 || (P4 = Promise))(function(resolve, reject) {
1883
1883
  function fulfilled(value) {
1884
1884
  try {
1885
1885
  step(generator.next(value));
@@ -8807,7 +8807,11 @@ var en_default = {
8807
8807
  create: "Create",
8808
8808
  edit: "Edit",
8809
8809
  cancel: "Cancel",
8810
- close: "Close"
8810
+ close: "Close",
8811
+ viewTemporarily: "View Temporarily",
8812
+ createView: "Create View",
8813
+ copyShareLink: "Copy Share Link",
8814
+ linkCopied: "Share link copied to clipboard"
8811
8815
  },
8812
8816
  modal: {
8813
8817
  edit: {
@@ -8820,6 +8824,10 @@ var en_default = {
8820
8824
  headline: "Delete Saved View",
8821
8825
  description: "This view cannot be restored once it has been deleted."
8822
8826
  },
8827
+ copyConfirmation: {
8828
+ headline: 'Create "{{savedViewName}}" as a personal saved view?',
8829
+ description: "You pasted a link to a saved view that does not yet exist for you. You can create it as a personal saved view or just view it temporarily."
8830
+ },
8823
8831
  fields: {
8824
8832
  name: "Name",
8825
8833
  description: "Description",
@@ -8852,11 +8860,15 @@ var en_default = {
8852
8860
  update: {
8853
8861
  success: "The saved view was successfully updated."
8854
8862
  },
8863
+ copy: {
8864
+ success: "The link was successfully created and copied to the clipboard."
8865
+ },
8855
8866
  errors: {
8856
8867
  fetch: "Sorry, the saved views couldn't be fetched. Try again.",
8857
8868
  create: "Sorry, the saved view couldn't be created. Try again.",
8858
8869
  update: "Sorry, the saved view couldn't be updated. Try again.",
8859
- delete: "Sorry, the saved view couldn't be deleted. Try again."
8870
+ delete: "Sorry, the saved view couldn't be deleted. Try again.",
8871
+ copyFailed: "Failed to copy share link to clipboard"
8860
8872
  },
8861
8873
  defaultViewTitle: {
8862
8874
  rfi: "All RFIs",
@@ -9825,16 +9837,33 @@ var Help = React7.forwardRef(function Help2(props, ref) {
9825
9837
  Help.displayName = "Help";
9826
9838
  var Help_default = Help;
9827
9839
 
9828
- // ../../node_modules/@procore/core-icons/dist/icons/Person.js
9840
+ // ../../node_modules/@procore/core-icons/dist/icons/Link.js
9829
9841
  var React8 = __toESM(require("react"));
9830
- var Person = React8.forwardRef(function Person2(props, ref) {
9842
+ var Link = React8.forwardRef(function Link2(props, ref) {
9831
9843
  return React8.createElement(
9832
9844
  Icon,
9833
- __assign({}, props, { name: "Person" }),
9845
+ __assign({}, props, { name: "Link" }),
9834
9846
  React8.createElement(
9835
9847
  "svg",
9836
9848
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9837
- React8.createElement("path", { d: "M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V20H20V18C20 15.34 14.67 14 12 14Z", fill: "currentColor" })
9849
+ React8.createElement("path", { d: "M6.01273 13.106C6.21565 9.97594 8.81868 7.5 12 7.5H13.5V10.5L12 10.5C10.3431 10.5 9 11.8431 9 13.5L9 16.5C9 18.1569 10.3431 19.5 12 19.5H16.5C18.1569 19.5 19.5 18.1569 19.5 16.5L19.5 8.30269C21.2934 9.34012 22.5 11.2792 22.5 13.5V16.5C22.5 19.8137 19.8137 22.5 16.5 22.5H12C8.68629 22.5 6 19.8137 6 16.5L6 13.0987L6.01273 13.106Z", fill: "currentColor" }),
9850
+ React8.createElement("path", { d: "M15 10.5C15 10.501 15 10.502 15 10.503V10.5269C14.9854 12.1712 13.6478 13.5 12 13.5L10.5 13.5V16.5H12C15.1813 16.5 17.7844 14.0241 17.9873 10.894L18.0086 10.9064L18.0001 10.8343L18 7.5C18 4.18629 15.3137 1.5 12 1.5H7.5C4.18629 1.5 1.5 4.18629 1.5 7.5V10.5C1.5 12.7208 2.7066 14.6599 4.5 15.6973L4.5 7.5C4.5 5.84315 5.84315 4.5 7.5 4.5L12 4.5C13.6569 4.5 15 5.84315 15 7.5H14.9867L15 7.52707L15 10.5Z", fill: "currentColor" })
9851
+ )
9852
+ );
9853
+ });
9854
+ Link.displayName = "Link";
9855
+ var Link_default = Link;
9856
+
9857
+ // ../../node_modules/@procore/core-icons/dist/icons/Person.js
9858
+ var React9 = __toESM(require("react"));
9859
+ var Person = React9.forwardRef(function Person2(props, ref) {
9860
+ return React9.createElement(
9861
+ Icon,
9862
+ __assign({}, props, { name: "Person" }),
9863
+ React9.createElement(
9864
+ "svg",
9865
+ { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9866
+ React9.createElement("path", { d: "M12 12C14.21 12 16 10.21 16 8C16 5.79 14.21 4 12 4C9.79 4 8 5.79 8 8C8 10.21 9.79 12 12 12ZM12 14C9.33 14 4 15.34 4 18V20H20V18C20 15.34 14.67 14 12 14Z", fill: "currentColor" })
9838
9867
  )
9839
9868
  );
9840
9869
  });
@@ -9842,15 +9871,15 @@ Person.displayName = "Person";
9842
9871
  var Person_default = Person;
9843
9872
 
9844
9873
  // ../../node_modules/@procore/core-icons/dist/icons/Plus.js
9845
- var React9 = __toESM(require("react"));
9846
- var Plus = React9.forwardRef(function Plus2(props, ref) {
9847
- return React9.createElement(
9874
+ var React10 = __toESM(require("react"));
9875
+ var Plus = React10.forwardRef(function Plus2(props, ref) {
9876
+ return React10.createElement(
9848
9877
  Icon,
9849
9878
  __assign({}, props, { name: "Plus" }),
9850
- React9.createElement(
9879
+ React10.createElement(
9851
9880
  "svg",
9852
9881
  { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ref },
9853
- React9.createElement("path", { d: "M13.25 5H10.75V10.75H5V13.25H10.75V19H13.25V13.25H19V10.75H13.25V5Z", fill: "currentColor" })
9882
+ React10.createElement("path", { d: "M13.25 5H10.75V10.75H5V13.25H10.75V19H13.25V13.25H19V10.75H13.25V5Z", fill: "currentColor" })
9854
9883
  )
9855
9884
  );
9856
9885
  });
@@ -9996,7 +10025,7 @@ function stylis_min(W2) {
9996
10025
  break;
9997
10026
  }
9998
10027
  default:
9999
- 58 !== f2.charCodeAt(t2 - 1) && (p += P3(f2, q2, g2, f2.charCodeAt(2)));
10028
+ 58 !== f2.charCodeAt(t2 - 1) && (p += P4(f2, q2, g2, f2.charCodeAt(2)));
10000
10029
  }
10001
10030
  I = r2 = u2 = q2 = 0;
10002
10031
  f2 = "";
@@ -10169,7 +10198,7 @@ function stylis_min(W2) {
10169
10198
  }
10170
10199
  return d + c2;
10171
10200
  }
10172
- function P3(d, c2, e2, h) {
10201
+ function P4(d, c2, e2, h) {
10173
10202
  var a2 = d + ";", m2 = 2 * c2 + 3 * e2 + 4 * h;
10174
10203
  if (944 === m2) {
10175
10204
  d = a2.indexOf(":", 9) + 1;
@@ -10276,7 +10305,7 @@ function stylis_min(W2) {
10276
10305
  case 931:
10277
10306
  case 953:
10278
10307
  if (true === la.test(d))
10279
- return 115 === (b2 = d.substring(d.indexOf(":") + 1)).charCodeAt(0) ? P3(d.replace("stretch", "fill-available"), c2, e2, h).replace(":fill-available", ":stretch") : a2.replace(b2, "-webkit-" + b2) + a2.replace(b2, "-moz-" + b2.replace("fill-", "")) + a2;
10308
+ return 115 === (b2 = d.substring(d.indexOf(":") + 1)).charCodeAt(0) ? P4(d.replace("stretch", "fill-available"), c2, e2, h).replace(":fill-available", ":stretch") : a2.replace(b2, "-webkit-" + b2) + a2.replace(b2, "-moz-" + b2.replace("fill-", "")) + a2;
10280
10309
  break;
10281
10310
  case 962:
10282
10311
  if (a2 = "-webkit-" + a2 + (102 === a2.charCodeAt(5) ? "-ms-" + a2 : "") + a2, 211 === e2 + h && 105 === a2.charCodeAt(13) && 0 < a2.indexOf("transform", 10))
@@ -10290,7 +10319,7 @@ function stylis_min(W2) {
10290
10319
  return R2(2 !== c2 ? h : h.replace(na, "$1"), e2, c2);
10291
10320
  }
10292
10321
  function ea(d, c2) {
10293
- var e2 = P3(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
10322
+ var e2 = P4(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
10294
10323
  return e2 !== c2 + ";" ? e2.replace(oa, " or ($1)").substring(4) : "(" + c2 + ")";
10295
10324
  }
10296
10325
  function H3(d, c2, e2, h, a2, m2, b2, v2, n2, q2) {
@@ -10948,7 +10977,7 @@ function Fe(e2, t2, n2) {
10948
10977
  o2 && e2.shouldForwardProp && (N = t2.shouldForwardProp ? function(n3, r2, o3) {
10949
10978
  return e2.shouldForwardProp(n3, r2, o3) && t2.shouldForwardProp(n3, r2, o3);
10950
10979
  } : e2.shouldForwardProp);
10951
- var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length, P3 = function(e3, t3) {
10980
+ var A2, C2 = new re(n2, v2, o2 ? e2.componentStyle : void 0), I = C2.isStatic && 0 === c2.length, P4 = function(e3, t3) {
10952
10981
  return function(e4, t4, n3, r2) {
10953
10982
  var o3 = e4.attrs, i3 = e4.componentStyle, a3 = e4.defaultProps, c3 = e4.foldedComponentIds, l3 = e4.shouldForwardProp, d2 = e4.styledComponentId, h2 = e4.target, f2 = function(e5, t5, n4) {
10954
10983
  void 0 === e5 && (e5 = S);
@@ -10967,7 +10996,7 @@ function Fe(e2, t2, n2) {
10967
10996
  return t4.style && v3.style !== t4.style && (A3.style = m({}, t4.style, {}, v3.style)), A3.className = Array.prototype.concat(c3, d2, g2 !== d2 ? g2 : null, t4.className, v3.className).filter(Boolean).join(" "), A3.ref = E2, (0, import_react.createElement)(b2, A3);
10968
10997
  }(A2, e3, t3, I);
10969
10998
  };
10970
- return P3.displayName = y2, (A2 = import_react.default.forwardRef(P3)).attrs = _3, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
10999
+ return P4.displayName = y2, (A2 = import_react.default.forwardRef(P4)).attrs = _3, A2.componentStyle = C2, A2.displayName = y2, A2.shouldForwardProp = N, A2.foldedComponentIds = o2 ? Array.prototype.concat(e2.foldedComponentIds, e2.styledComponentId) : g, A2.styledComponentId = v2, A2.target = o2 ? e2.target : e2, A2.withComponent = function(e3) {
10971
11000
  var r2 = t2.componentId, o3 = function(e4, t3) {
10972
11001
  if (null == e4)
10973
11002
  return {};
@@ -11149,14 +11178,15 @@ var useSavedViewsPanel = (domain, tableName) => {
11149
11178
  setIsOpen(!isOpen);
11150
11179
  localStorage.setItem(key(domain, tableName), JSON.stringify(!isOpen));
11151
11180
  };
11152
- const Button6 = () => /* @__PURE__ */ import_react5.default.createElement(SavedViewsButton, { handleClick, isOpen });
11153
- return { isOpen, SavedViewsButton: Button6 };
11181
+ const Button7 = () => /* @__PURE__ */ import_react5.default.createElement(SavedViewsButton, { handleClick, isOpen });
11182
+ return { isOpen, SavedViewsButton: Button7 };
11154
11183
  };
11155
11184
  var useSavedViewsPanel_default = useSavedViewsPanel;
11156
11185
 
11157
11186
  // src/SavedViews/components/MenuItems/SavedViewsCollectionsMenuItem.tsx
11158
11187
  var import_core_react3 = require("@procore/core-react");
11159
- var React13 = __toESM(require("react"));
11188
+ var React14 = __toESM(require("react"));
11189
+ var import_toast_alert = require("@procore/toast-alert");
11160
11190
  var RowActionsBox = styled_components_esm_default(import_core_react3.Flex)`
11161
11191
  justify-content: center;
11162
11192
  align-items: center;
@@ -11172,7 +11202,7 @@ var Container2 = styled_components_esm_default(import_core_react3.Flex)`
11172
11202
  ${({ "aria-selected": selected }) => selected ? "color: hsl(218, 75%, 45%);" : ""}
11173
11203
  `;
11174
11204
  var SavedViewCollectionMenuItem = (props) => {
11175
- const onClick = React13.useCallback(
11205
+ const onClick = React14.useCallback(
11176
11206
  (a2) => {
11177
11207
  if (!props.item) {
11178
11208
  return;
@@ -11194,7 +11224,19 @@ var SavedViewCollectionMenuItem = (props) => {
11194
11224
  event.stopPropagation();
11195
11225
  props.onUpdate?.(props.item);
11196
11226
  };
11227
+ const { showToast } = (0, import_toast_alert.useToastAlertContext)();
11197
11228
  const i18n = (0, import_core_react3.useI18nContext)();
11229
+ const copyShareLink = async (event) => {
11230
+ event.stopPropagation();
11231
+ try {
11232
+ const currentUrl = new URL(window.location.href);
11233
+ await navigator.clipboard.writeText(currentUrl.toString());
11234
+ showToast.success(i18n.t("savedViews.actions.linkCopied"));
11235
+ } catch (error) {
11236
+ console.error("Failed to copy link:", error);
11237
+ showToast.error(i18n.t("savedViews.errors.copyFailed"));
11238
+ }
11239
+ };
11198
11240
  const flyoutMenuOptions = [
11199
11241
  {
11200
11242
  value: "editNameDesc",
@@ -11205,7 +11247,7 @@ var SavedViewCollectionMenuItem = (props) => {
11205
11247
  label: i18n.t("savedViews.actions.delete")
11206
11248
  }
11207
11249
  ];
11208
- return /* @__PURE__ */ React13.createElement(
11250
+ return /* @__PURE__ */ React14.createElement(
11209
11251
  Container2,
11210
11252
  {
11211
11253
  "aria-selected": Boolean(props.selected),
@@ -11216,7 +11258,7 @@ var SavedViewCollectionMenuItem = (props) => {
11216
11258
  }),
11217
11259
  "data-testid": "saved-view-collection-menu-item"
11218
11260
  },
11219
- /* @__PURE__ */ React13.createElement(
11261
+ /* @__PURE__ */ React14.createElement(
11220
11262
  "span",
11221
11263
  {
11222
11264
  "data-testid": "saved-view-display-name",
@@ -11224,7 +11266,7 @@ var SavedViewCollectionMenuItem = (props) => {
11224
11266
  },
11225
11267
  props.item.name
11226
11268
  ),
11227
- /* @__PURE__ */ React13.createElement(RowActionsBox, null, /* @__PURE__ */ React13.createElement(import_core_react3.Box, { justifyContent: "space-between" }, props.item.id !== "default" && props.canUpdate && /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(
11269
+ /* @__PURE__ */ React14.createElement(RowActionsBox, null, /* @__PURE__ */ React14.createElement(import_core_react3.Box, { justifyContent: "space-between" }, props.item.id !== "default" && props.canUpdate && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(
11228
11270
  import_core_react3.Button,
11229
11271
  {
11230
11272
  onClick: updateItem,
@@ -11235,7 +11277,17 @@ var SavedViewCollectionMenuItem = (props) => {
11235
11277
  loading: props.isUpdateProcessing
11236
11278
  },
11237
11279
  i18n.t("savedViews.actions.update")
11238
- ))), /* @__PURE__ */ React13.createElement(import_core_react3.Box, null, props.item.id !== "default" && props.canEditOrDelete && /* @__PURE__ */ React13.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React13.createElement(
11280
+ )), props.item.id !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(
11281
+ import_core_react3.Button,
11282
+ {
11283
+ onClick: copyShareLink,
11284
+ variant: "tertiary",
11285
+ size: "sm",
11286
+ "aria-label": i18n.t("savedViews.actions.copyShareLink"),
11287
+ "data-testid": "copy-share-link-button"
11288
+ },
11289
+ /* @__PURE__ */ React14.createElement(Link_default, { size: "sm" })
11290
+ ))), /* @__PURE__ */ React14.createElement(import_core_react3.Box, null, props.item.id !== "default" && props.canEditOrDelete && /* @__PURE__ */ React14.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React14.createElement(
11239
11291
  import_core_react3.DropdownFlyout,
11240
11292
  {
11241
11293
  "data-testid": "saved-view-overflow-button",
@@ -11259,13 +11311,176 @@ var ExpandedPanel = styled_components_esm_default(import_core_react4.Panel)`
11259
11311
  `;
11260
11312
 
11261
11313
  // src/SavedViews/components/Panels/PanelContent.tsx
11262
- var import_core_react6 = require("@procore/core-react");
11263
- var import_toast_alert = require("@procore/toast-alert");
11314
+ var import_core_react7 = require("@procore/core-react");
11315
+ var import_toast_alert2 = require("@procore/toast-alert");
11264
11316
  var import_react9 = __toESM(require("react"));
11265
11317
 
11318
+ // ../../node_modules/@procore/core-http/dist/modern/index.js
11319
+ function getCSRFToken() {
11320
+ const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
11321
+ return token ? decodeURIComponent(token.pop() || "") : "";
11322
+ }
11323
+ function getCSRFHeader() {
11324
+ const csrfToken = getCSRFToken();
11325
+ return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
11326
+ }
11327
+ function removeLeadingSlash(url) {
11328
+ return url.startsWith("/") ? url.substring(1, url.length) : url;
11329
+ }
11330
+ function removeTrailingSlash(url) {
11331
+ return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
11332
+ }
11333
+ function applyBaseUrl(url, baseUrl) {
11334
+ return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
11335
+ }
11336
+ function getOptions({ headers, ...options }) {
11337
+ const opts = {
11338
+ credentials: "same-origin",
11339
+ headers: {
11340
+ ...getCSRFHeader(),
11341
+ ...headers
11342
+ },
11343
+ mode: "same-origin",
11344
+ ...options
11345
+ };
11346
+ return opts;
11347
+ }
11348
+ function getUrl(url, baseUrl) {
11349
+ return baseUrl ? applyBaseUrl(url, baseUrl) : url;
11350
+ }
11351
+ function request(url, { baseUrl, ...options } = {}) {
11352
+ return fetch(getUrl(url, baseUrl), getOptions(options));
11353
+ }
11354
+ function requestJSON(url, requestParams = {}) {
11355
+ return request(url, requestParams).then(
11356
+ (response) => response.json()
11357
+ );
11358
+ }
11359
+
11360
+ // src/utils/Api/queries.ts
11361
+ var import_react_query2 = require("@tanstack/react-query");
11362
+
11363
+ // src/utils/Api/queriesHandler.ts
11364
+ var import_react_query = require("@tanstack/react-query");
11365
+ var import_core_react5 = require("@procore/core-react");
11366
+ var useApiRequest = (props, method, mutationKey) => {
11367
+ const { projectId, companyId, domain, tableName } = props;
11368
+ const queryClient2 = (0, import_react_query.useQueryClient)();
11369
+ const { locale: locale2 } = (0, import_core_react5.useI18nContext)();
11370
+ return (0, import_react_query.useMutation)({
11371
+ mutationKey,
11372
+ mutationFn: async (savedView) => {
11373
+ let url = "";
11374
+ if (method === "DELETE" || method === "PUT") {
11375
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
11376
+ } else {
11377
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11378
+ }
11379
+ const response = await requestJSON(url, {
11380
+ method,
11381
+ body: JSON.stringify(savedView),
11382
+ headers: {
11383
+ "Content-Type": "application/json",
11384
+ "Accept-Language": locale2
11385
+ }
11386
+ });
11387
+ if (response.error) {
11388
+ throw response.error;
11389
+ }
11390
+ return response.data;
11391
+ },
11392
+ onSuccess: (savedView) => {
11393
+ if (method === "DELETE" || method === "POST") {
11394
+ queryClient2.invalidateQueries({
11395
+ queryKey: ["savedViews", domain, tableName]
11396
+ });
11397
+ return;
11398
+ } else {
11399
+ const oldData = queryClient2.getQueryData([
11400
+ "savedViews",
11401
+ domain,
11402
+ tableName
11403
+ ]);
11404
+ const oldView = oldData?.find((item) => item.id === savedView.id);
11405
+ if (oldView?.name !== savedView.name) {
11406
+ queryClient2.invalidateQueries({
11407
+ queryKey: ["savedViews", domain, tableName]
11408
+ });
11409
+ return;
11410
+ }
11411
+ }
11412
+ queryClient2.setQueryData(
11413
+ ["savedViews", domain, tableName],
11414
+ (oldData) => {
11415
+ if (!oldData)
11416
+ return [savedView];
11417
+ return oldData.map(
11418
+ (item) => item.id === savedView.id ? savedView : item
11419
+ );
11420
+ }
11421
+ );
11422
+ }
11423
+ });
11424
+ };
11425
+
11266
11426
  // src/utils/Constants/viewLevels.ts
11267
11427
  var VIEW_LEVELS = ["company", "project", "personal"];
11268
11428
 
11429
+ // src/utils/Api/queries.ts
11430
+ var PAGE_SIZE = 50 * VIEW_LEVELS.length;
11431
+ var useSavedViewsQuery = (props) => {
11432
+ const { projectId, companyId, domain, tableName } = props;
11433
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11434
+ return (0, import_react_query2.useQuery)({
11435
+ enabled: props.enableSavedViews,
11436
+ queryKey: ["savedViews", domain, tableName],
11437
+ queryFn: async () => {
11438
+ const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
11439
+ const response = await requestJSON(getUrl2);
11440
+ return response.data;
11441
+ }
11442
+ });
11443
+ };
11444
+ var useSavedViewsPermissions = (props) => {
11445
+ const { projectId, companyId, domain } = props;
11446
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
11447
+ return (0, import_react_query2.useQuery)({
11448
+ enabled: props.enableSavedViews,
11449
+ queryKey: ["savedViewsConfig", domain],
11450
+ queryFn: async () => {
11451
+ const response = await requestJSON(url);
11452
+ return response.data;
11453
+ }
11454
+ });
11455
+ };
11456
+ var useCreateSavedView = (props) => useApiRequest(props, "POST", [
11457
+ "createSavedView",
11458
+ props.domain,
11459
+ props.tableName
11460
+ ]);
11461
+ var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
11462
+ "updateSavedView",
11463
+ props.domain,
11464
+ props.tableName
11465
+ ]);
11466
+ var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
11467
+ "deleteSavedView",
11468
+ props.domain,
11469
+ props.tableName
11470
+ ]);
11471
+ var useFetchSavedViewById = (savedViewId, queryInput, enabled = true) => {
11472
+ const { projectId, companyId } = queryInput;
11473
+ return (0, import_react_query2.useQuery)({
11474
+ enabled: enabled && Boolean(savedViewId),
11475
+ queryKey: ["savedView", savedViewId],
11476
+ queryFn: async () => {
11477
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedViewId}`;
11478
+ const response = await requestJSON(url);
11479
+ return response.data;
11480
+ }
11481
+ });
11482
+ };
11483
+
11269
11484
  // src/SavedViews/components/Panels/PanelContentUtils.ts
11270
11485
  var import_lodash = __toESM(require_lodash());
11271
11486
 
@@ -11280,7 +11495,7 @@ function getSmartGridConfig(api) {
11280
11495
  columnState: columnStateResult,
11281
11496
  rowHeight: rowHeightResult,
11282
11497
  columnGroupState: columnGroupStateResult,
11283
- rowGroupState: rowGroupStateResult.filter((col) => typeof col?.getColId === "function").map((col) => col.getColId()),
11498
+ rowGroupState: rowGroupStateResult,
11284
11499
  filterState: serverFiltersResult
11285
11500
  };
11286
11501
  return smartGridConfig;
@@ -11468,7 +11683,7 @@ var useGroups = () => {
11468
11683
  };
11469
11684
 
11470
11685
  // src/SavedViews/components/Panels/ViewLevelHeader.tsx
11471
- var import_core_react5 = require("@procore/core-react");
11686
+ var import_core_react6 = require("@procore/core-react");
11472
11687
  var import_react7 = __toESM(require("react"));
11473
11688
  var groupIcon = (group) => {
11474
11689
  switch (group) {
@@ -11480,26 +11695,26 @@ var groupIcon = (group) => {
11480
11695
  return /* @__PURE__ */ import_react7.default.createElement(Building_default, null);
11481
11696
  }
11482
11697
  };
11483
- var Header = styled_components_esm_default(import_core_react5.Flex)`
11698
+ var Header = styled_components_esm_default(import_core_react6.Flex)`
11484
11699
  width: 100%;
11485
11700
  &:hover {
11486
- background-color: ${import_core_react5.colors.gray98};
11701
+ background-color: ${import_core_react6.colors.gray98};
11487
11702
  }
11488
11703
  `;
11489
11704
  var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
11490
- const I18n = (0, import_core_react5.useI18nContext)();
11705
+ const I18n = (0, import_core_react6.useI18nContext)();
11491
11706
  return /* @__PURE__ */ import_react7.default.createElement(
11492
11707
  Header,
11493
11708
  {
11494
11709
  alignItems: "center",
11495
- padding: `${import_core_react5.spacing.sm}px`,
11496
- gap: `${import_core_react5.spacing.sm}px`,
11710
+ padding: `${import_core_react6.spacing.sm}px`,
11711
+ gap: `${import_core_react6.spacing.sm}px`,
11497
11712
  style: { cursor: "pointer" },
11498
11713
  onClick: () => toggleGroup(group)
11499
11714
  },
11500
11715
  expanded ? /* @__PURE__ */ import_react7.default.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ import_react7.default.createElement(ChevronRight_default, { size: "sm" }),
11501
11716
  groupIcon(group),
11502
- /* @__PURE__ */ import_react7.default.createElement(import_core_react5.Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11717
+ /* @__PURE__ */ import_react7.default.createElement(import_core_react6.Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11503
11718
  );
11504
11719
  };
11505
11720
  var ViewLevelHeader_default = ViewLevelHeader;
@@ -11517,38 +11732,36 @@ var useScrollToRef = (dependency) => {
11517
11732
  };
11518
11733
 
11519
11734
  // src/SavedViews/components/Panels/PanelContent.tsx
11520
- var Row = styled_components_esm_default(import_core_react6.UNSAFE_Menu.Item)`
11735
+ var Row = styled_components_esm_default(import_core_react7.UNSAFE_Menu.Item)`
11521
11736
  width: 100%;
11522
11737
  padding-left: 35px;
11523
11738
  padding-right: 4px;
11524
- background-color: ${({ selected }) => selected ? import_core_react6.colors.blue96 : "transparent"};
11739
+ background-color: ${({ selected }) => selected ? import_core_react7.colors.blue96 : "transparent"};
11525
11740
 
11526
11741
  &:hover {
11527
- background-color: ${({ selected }) => selected ? import_core_react6.colors.blue96 : import_core_react6.colors.gray98};
11742
+ background-color: ${({ selected }) => selected ? import_core_react7.colors.blue96 : import_core_react7.colors.gray98};
11528
11743
  }
11529
11744
  `;
11530
- var Panel2 = styled_components_esm_default(import_core_react6.DetailPage.Card)`
11745
+ var Panel2 = styled_components_esm_default(import_core_react7.DetailPage.Card)`
11531
11746
  margin: 0;
11532
11747
  height: 100%;
11533
- padding-top: ${import_core_react6.spacing.sm}px;
11748
+ padding-top: ${import_core_react7.spacing.sm}px;
11534
11749
  box-shadow: none;
11535
11750
  `;
11536
11751
  var PanelContent = (props) => {
11537
- const { showToast } = (0, import_toast_alert.useToastAlertContext)();
11538
- const I18n = (0, import_core_react6.useI18nContext)();
11539
- const { useSavedViewsQuery: useSavedViewsQuery2, useSavedViewsPermissions: useSavedViewsPermissions2, useUpdateSavedView: useUpdateSavedView2 } = props.backend;
11540
- const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView2(props.queryInput);
11541
- const { data: savedViews, error: savedViewsError } = useSavedViewsQuery2(
11542
- props.queryInput
11543
- );
11752
+ const { showToast } = (0, import_toast_alert2.useToastAlertContext)();
11753
+ const I18n = (0, import_core_react7.useI18nContext)();
11754
+ const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView(props.queryInput);
11755
+ const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
11756
+ const savedViews = props.savedViews ?? savedViewsFromQuery;
11544
11757
  const errorToastRef = import_react9.default.useRef(null);
11545
11758
  import_react9.default.useEffect(() => {
11546
11759
  if (savedViewsError && savedViewsError !== errorToastRef.current) {
11547
11760
  showToast.error(I18n.t("savedViews.errors.fetch"));
11548
11761
  errorToastRef.current = savedViewsError;
11549
11762
  }
11550
- }, [savedViewsError]);
11551
- const { data: permissions } = useSavedViewsPermissions2(props.queryInput);
11763
+ }, [savedViewsError, showToast, I18n]);
11764
+ const { data: permissions } = useSavedViewsPermissions(props.queryInput);
11552
11765
  const selectedRowRef = useScrollToRef(savedViews);
11553
11766
  const onUpdate = (data) => {
11554
11767
  const newSavedView = {
@@ -11569,7 +11782,23 @@ var PanelContent = (props) => {
11569
11782
  };
11570
11783
  const { groups, toggleGroup } = useGroups();
11571
11784
  const isDefaultSelected = props.selectedSavedView?.id === "default";
11572
- return /* @__PURE__ */ import_react9.default.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ import_react9.default.createElement(import_core_react6.Flex, { direction: "column", style: { height: "100%", width: "100%" } }, /* @__PURE__ */ import_react9.default.createElement(
11785
+ const isTemporarySelected = props.selectedSavedView?.id === "temporary";
11786
+ const temporaryView = savedViews?.find((view) => view.id === "temporary");
11787
+ return /* @__PURE__ */ import_react9.default.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ import_react9.default.createElement(import_core_react7.Flex, { direction: "column", style: { height: "100%", width: "100%" } }, temporaryView && /* @__PURE__ */ import_react9.default.createElement(
11788
+ Row,
11789
+ {
11790
+ selected: isTemporarySelected,
11791
+ onClick: () => props.onSelect({ item: temporaryView }),
11792
+ ref: isTemporarySelected ? selectedRowRef : null
11793
+ },
11794
+ /* @__PURE__ */ import_react9.default.createElement(
11795
+ SavedViewCollectionMenuItem,
11796
+ {
11797
+ item: temporaryView,
11798
+ selected: isTemporarySelected
11799
+ }
11800
+ )
11801
+ ), /* @__PURE__ */ import_react9.default.createElement(
11573
11802
  Row,
11574
11803
  {
11575
11804
  selected: isDefaultSelected,
@@ -11585,7 +11814,9 @@ var PanelContent = (props) => {
11585
11814
  )
11586
11815
  ), VIEW_LEVELS.map((level) => {
11587
11816
  const isExpanded = groups[level];
11588
- const views = isExpanded && savedViews ? savedViews.filter((view) => view.view_level === level) : [];
11817
+ const views = isExpanded && savedViews ? savedViews.filter(
11818
+ (view) => view.view_level === level && view.id !== "temporary"
11819
+ ) : [];
11589
11820
  return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, { key: level }, /* @__PURE__ */ import_react9.default.createElement(
11590
11821
  ViewLevelHeader_default,
11591
11822
  {
@@ -11634,12 +11865,12 @@ var PanelContent = (props) => {
11634
11865
  };
11635
11866
 
11636
11867
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
11637
- var import_react14 = __toESM(require("react"));
11868
+ var import_react19 = __toESM(require("react"));
11638
11869
 
11639
11870
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
11640
- var import_core_react7 = require("@procore/core-react");
11871
+ var import_core_react8 = require("@procore/core-react");
11641
11872
  var useDefaultViewName = (domain, defaultViewName) => {
11642
- const i18n = (0, import_core_react7.useI18nContext)();
11873
+ const i18n = (0, import_core_react8.useI18nContext)();
11643
11874
  return defaultViewName || i18n.t(domain, {
11644
11875
  scope: "savedViews.defaultViewTitle",
11645
11876
  defaultValue: "Default View"
@@ -11694,21 +11925,21 @@ var useSmartGridConfig = (gridApi) => {
11694
11925
  };
11695
11926
 
11696
11927
  // src/SavedViews/components/SavedViews/SavedViews.tsx
11697
- var import_core_react12 = require("@procore/core-react");
11698
- var import_react13 = __toESM(require("react"));
11928
+ var import_core_react13 = require("@procore/core-react");
11929
+ var import_react18 = __toESM(require("react"));
11699
11930
  var import_react_query3 = require("@tanstack/react-query");
11700
11931
 
11701
11932
  // src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
11702
- var import_core_react8 = require("@procore/core-react");
11933
+ var import_core_react9 = require("@procore/core-react");
11703
11934
  var import_react11 = __toESM(require("react"));
11704
11935
  var SavedViewsDeleteConfirmationModalShared = ({
11705
11936
  onCancel,
11706
11937
  onDelete,
11707
11938
  open
11708
11939
  }) => {
11709
- const i18n = (0, import_core_react8.useI18nContext)();
11940
+ const i18n = (0, import_core_react9.useI18nContext)();
11710
11941
  return /* @__PURE__ */ import_react11.default.createElement(
11711
- import_core_react8.ConfirmModal,
11942
+ import_core_react9.ConfirmModal,
11712
11943
  {
11713
11944
  "data-testid": "delete-confirmation-modal",
11714
11945
  open,
@@ -11717,8 +11948,8 @@ var SavedViewsDeleteConfirmationModalShared = ({
11717
11948
  onClose: onCancel,
11718
11949
  style: { overflowWrap: "anywhere" }
11719
11950
  },
11720
- /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Modal.Body, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react8.P, null, i18n.t("savedViews.modal.delete.description"))),
11721
- /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Modal.Footer, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Modal.FooterButtons, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Button, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ import_react11.default.createElement(import_core_react8.Button, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
11951
+ /* @__PURE__ */ import_react11.default.createElement(import_core_react9.Modal.Body, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react9.P, null, i18n.t("savedViews.modal.delete.description"))),
11952
+ /* @__PURE__ */ import_react11.default.createElement(import_core_react9.Modal.Footer, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react9.Modal.FooterButtons, null, /* @__PURE__ */ import_react11.default.createElement(import_core_react9.Button, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ import_react11.default.createElement(import_core_react9.Button, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
11722
11953
  );
11723
11954
  };
11724
11955
 
@@ -11726,8 +11957,8 @@ var SavedViewsDeleteConfirmationModalShared = ({
11726
11957
  var import_react12 = __toESM(require("react"));
11727
11958
 
11728
11959
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
11729
- var import_core_react9 = require("@procore/core-react");
11730
- var React17 = __toESM(require("react"));
11960
+ var import_core_react10 = require("@procore/core-react");
11961
+ var React18 = __toESM(require("react"));
11731
11962
 
11732
11963
  // ../../node_modules/yup/index.esm.js
11733
11964
  var import_property_expr = __toESM(require_property_expr());
@@ -14055,7 +14286,6 @@ function extractMessage(error, I18n) {
14055
14286
  }
14056
14287
 
14057
14288
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14058
- var { useEffect: useEffect3, useRef: useRef2 } = React17;
14059
14289
  var ScrollContainer = styled_components_esm_default("div")`
14060
14290
  overflow: auto;
14061
14291
  `;
@@ -14073,38 +14303,22 @@ var SavedViewsCreateUpdateModalBase = ({
14073
14303
  selectedSavedView,
14074
14304
  setSelectedSavedView,
14075
14305
  setOpenEditCreateModal,
14076
- onSelect,
14077
- backend
14306
+ onSelect
14078
14307
  }) => {
14079
- const I18n = (0, import_core_react9.useI18nContext)();
14308
+ const I18n = (0, import_core_react10.useI18nContext)();
14080
14309
  const NAME_MAX_LENGTH = 150;
14081
- const originalBodyWidth = useRef2("");
14082
- useEffect3(() => {
14083
- if (open) {
14084
- originalBodyWidth.current = document.body.style.width || "";
14085
- document.body.style.width = "100%";
14086
- } else {
14087
- document.body.style.width = originalBodyWidth.current;
14088
- }
14089
- return () => {
14090
- if (originalBodyWidth.current !== void 0) {
14091
- document.body.style.width = originalBodyWidth.current;
14092
- }
14093
- };
14094
- }, [open]);
14095
- const { useCreateSavedView: useCreateSavedView2, useUpdateSavedView: useUpdateSavedView2, useSavedViewsPermissions: useSavedViewsPermissions2 } = backend;
14096
14310
  const {
14097
14311
  mutate: createSavedView,
14098
14312
  isPending: isCreating,
14099
14313
  error: createError,
14100
14314
  reset: resetCreateMutation
14101
- } = useCreateSavedView2(queryInput);
14315
+ } = useCreateSavedView(queryInput);
14102
14316
  const {
14103
14317
  mutate: updateSavedView,
14104
14318
  isPending: isUpdating,
14105
14319
  error: updateError,
14106
14320
  reset: resetUpdateMutation
14107
- } = useUpdateSavedView2(queryInput);
14321
+ } = useUpdateSavedView(queryInput);
14108
14322
  const resetMutations = () => {
14109
14323
  resetCreateMutation();
14110
14324
  resetUpdateMutation();
@@ -14113,7 +14327,7 @@ var SavedViewsCreateUpdateModalBase = ({
14113
14327
  resetMutations();
14114
14328
  onCancel();
14115
14329
  };
14116
- const { data: permissions } = useSavedViewsPermissions2(queryInput);
14330
+ const { data: permissions } = useSavedViewsPermissions(queryInput);
14117
14331
  const isLoading = isCreating || isUpdating;
14118
14332
  const errors = extractMessage(createError || updateError, I18n);
14119
14333
  const handleOnSubmit = (data) => {
@@ -14145,8 +14359,8 @@ var SavedViewsCreateUpdateModalBase = ({
14145
14359
  }
14146
14360
  };
14147
14361
  const viewLevelOptions = getViewLevelOptions(permissions, I18n);
14148
- return /* @__PURE__ */ React17.createElement(
14149
- import_core_react9.Modal,
14362
+ return /* @__PURE__ */ React18.createElement(
14363
+ import_core_react10.Modal,
14150
14364
  {
14151
14365
  "aria-label": I18n.t("savedViews.ariaLabels.modal"),
14152
14366
  onClickOverlay: onClose,
@@ -14154,15 +14368,15 @@ var SavedViewsCreateUpdateModalBase = ({
14154
14368
  style: { width: "540px" },
14155
14369
  "data-testid": "create-update-modal"
14156
14370
  },
14157
- /* @__PURE__ */ React17.createElement(ScrollContainer, null, /* @__PURE__ */ React17.createElement(
14158
- import_core_react9.Modal.Header,
14371
+ /* @__PURE__ */ React18.createElement(ScrollContainer, null, /* @__PURE__ */ React18.createElement(
14372
+ import_core_react10.Modal.Header,
14159
14373
  {
14160
14374
  onClose,
14161
- style: { borderBottom: `1px solid ${import_core_react9.colors.gray85}` }
14375
+ style: { borderBottom: `1px solid ${import_core_react10.colors.gray85}` }
14162
14376
  },
14163
- /* @__PURE__ */ React17.createElement(import_core_react9.H2, null, header)
14164
- ), /* @__PURE__ */ React17.createElement(
14165
- import_core_react9.Form,
14377
+ /* @__PURE__ */ React18.createElement(import_core_react10.H2, null, header)
14378
+ ), /* @__PURE__ */ React18.createElement(
14379
+ import_core_react10.Form,
14166
14380
  {
14167
14381
  initialValues: {
14168
14382
  name: initialName,
@@ -14187,14 +14401,14 @@ var SavedViewsCreateUpdateModalBase = ({
14187
14401
  onReset: onCancel,
14188
14402
  validateOnChange: true
14189
14403
  },
14190
- /* @__PURE__ */ React17.createElement(import_core_react9.Form.Form, { name: header }, /* @__PURE__ */ React17.createElement(
14191
- import_core_react9.Modal.Body,
14404
+ /* @__PURE__ */ React18.createElement(import_core_react10.Form.Form, { name: header }, /* @__PURE__ */ React18.createElement(
14405
+ import_core_react10.Modal.Body,
14192
14406
  {
14193
- style: { paddingTop: 0, paddingBottom: 0, marginTop: import_core_react9.spacing.lg }
14407
+ style: { paddingTop: 0, paddingBottom: 0, marginTop: import_core_react10.spacing.lg }
14194
14408
  },
14195
- errors && /* @__PURE__ */ React17.createElement(import_core_react9.ErrorBanner, { style: { marginBottom: import_core_react9.spacing.xl } }, /* @__PURE__ */ React17.createElement(import_core_react9.Banner.Content, null, /* @__PURE__ */ React17.createElement(import_core_react9.Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React17.createElement(import_core_react9.Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14196
- /* @__PURE__ */ React17.createElement(import_core_react9.Form.Row, null, /* @__PURE__ */ React17.createElement(
14197
- import_core_react9.Form.Text,
14409
+ errors && /* @__PURE__ */ React18.createElement(import_core_react10.ErrorBanner, { style: { marginBottom: import_core_react10.spacing.xl } }, /* @__PURE__ */ React18.createElement(import_core_react10.Banner.Content, null, /* @__PURE__ */ React18.createElement(import_core_react10.Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React18.createElement(import_core_react10.Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14410
+ /* @__PURE__ */ React18.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React18.createElement(
14411
+ import_core_react10.Form.Text,
14198
14412
  {
14199
14413
  name: "name",
14200
14414
  error: errors?.name,
@@ -14204,13 +14418,13 @@ var SavedViewsCreateUpdateModalBase = ({
14204
14418
  onChange: () => resetMutations()
14205
14419
  }
14206
14420
  )),
14207
- /* @__PURE__ */ React17.createElement(
14208
- import_core_react9.Form.Row,
14421
+ /* @__PURE__ */ React18.createElement(
14422
+ import_core_react10.Form.Row,
14209
14423
  {
14210
- style: { marginTop: errors?.name ? import_core_react9.spacing.xl : import_core_react9.spacing.none }
14424
+ style: { marginTop: errors?.name ? import_core_react10.spacing.xl : import_core_react10.spacing.none }
14211
14425
  },
14212
- /* @__PURE__ */ React17.createElement(
14213
- import_core_react9.Form.TextArea,
14426
+ /* @__PURE__ */ React18.createElement(
14427
+ import_core_react10.Form.TextArea,
14214
14428
  {
14215
14429
  name: "description",
14216
14430
  placeholder: I18n.t("savedViews.modal.fields.description"),
@@ -14220,20 +14434,19 @@ var SavedViewsCreateUpdateModalBase = ({
14220
14434
  }
14221
14435
  )
14222
14436
  ),
14223
- viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React17.createElement(import_core_react9.Form.Row, null, /* @__PURE__ */ React17.createElement(
14224
- import_core_react9.Form.Select,
14437
+ viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React18.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React18.createElement(
14438
+ import_core_react10.Form.Select,
14225
14439
  {
14226
14440
  name: "view_level",
14227
- qa: { label: "view-level" },
14228
14441
  options: viewLevelOptions,
14229
14442
  label: I18n.t("savedViews.modal.fields.viewLevel"),
14230
14443
  colWidth: 12,
14231
14444
  onSearch: false,
14232
14445
  onClear: false
14233
14446
  }
14234
- )) : /* @__PURE__ */ React17.createElement(React17.Fragment, null)
14235
- ), /* @__PURE__ */ React17.createElement(import_core_react9.Modal.Footer, { style: { borderTop: `1px solid ${import_core_react9.colors.gray85}` } }, /* @__PURE__ */ React17.createElement(import_core_react9.Flex, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React17.createElement(import_core_react9.Typography, { color: "gray45", italic: true }, /* @__PURE__ */ React17.createElement(import_core_react9.Typography, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React17.createElement(import_core_react9.Modal.FooterButtons, null, /* @__PURE__ */ React17.createElement(import_core_react9.Button, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React17.createElement(
14236
- import_core_react9.Button,
14447
+ )) : /* @__PURE__ */ React18.createElement(React18.Fragment, null)
14448
+ ), /* @__PURE__ */ React18.createElement(import_core_react10.Modal.Footer, { style: { borderTop: `1px solid ${import_core_react10.colors.gray85}` } }, /* @__PURE__ */ React18.createElement(import_core_react10.Flex, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React18.createElement(import_core_react10.Typography, { color: "gray45", italic: true }, /* @__PURE__ */ React18.createElement(import_core_react10.Typography, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React18.createElement(import_core_react10.Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(import_core_react10.Button, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React18.createElement(
14449
+ import_core_react10.Button,
14237
14450
  {
14238
14451
  "data-testid": "create-update-modal-button",
14239
14452
  type: "submit",
@@ -14248,7 +14461,7 @@ var SavedViewsCreateUpdateModalBase = ({
14248
14461
  };
14249
14462
 
14250
14463
  // src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
14251
- var import_core_react10 = require("@procore/core-react");
14464
+ var import_core_react11 = require("@procore/core-react");
14252
14465
  var SavedViewsFormModal = ({
14253
14466
  open,
14254
14467
  mode,
@@ -14260,10 +14473,9 @@ var SavedViewsFormModal = ({
14260
14473
  setSelectedSavedView,
14261
14474
  setOpenEditCreateModal,
14262
14475
  onSelect,
14263
- defaultView,
14264
- backend
14476
+ defaultView
14265
14477
  }) => {
14266
- const i18n = (0, import_core_react10.useI18nContext)();
14478
+ const i18n = (0, import_core_react11.useI18nContext)();
14267
14479
  return /* @__PURE__ */ import_react12.default.createElement(
14268
14480
  SavedViewsCreateUpdateModalBase,
14269
14481
  {
@@ -14280,169 +14492,276 @@ var SavedViewsFormModal = ({
14280
14492
  setSelectedSavedView,
14281
14493
  setOpenEditCreateModal,
14282
14494
  onSelect,
14283
- defaultView,
14284
- backend
14495
+ defaultView
14285
14496
  }
14286
14497
  );
14287
14498
  };
14288
14499
 
14289
- // ../../node_modules/@procore/core-http/dist/modern/index.js
14290
- function getCSRFToken() {
14291
- const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
14292
- return token ? decodeURIComponent(token.pop() || "") : "";
14293
- }
14294
- function getCSRFHeader() {
14295
- const csrfToken = getCSRFToken();
14296
- return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
14297
- }
14298
- function removeLeadingSlash(url) {
14299
- return url.startsWith("/") ? url.substring(1, url.length) : url;
14300
- }
14301
- function removeTrailingSlash(url) {
14302
- return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
14303
- }
14304
- function applyBaseUrl(url, baseUrl) {
14305
- return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
14306
- }
14307
- function getOptions({ headers, ...options }) {
14308
- const opts = {
14309
- credentials: "same-origin",
14310
- headers: {
14311
- ...getCSRFHeader(),
14312
- ...headers
14313
- },
14314
- mode: "same-origin",
14315
- ...options
14500
+ // src/SavedViews/components/SavedViewsModals/CopyViewConfirmationModal.tsx
14501
+ var import_core_react12 = require("@procore/core-react");
14502
+ var import_react13 = __toESM(require("react"));
14503
+ var CreateViewConfirmationModal = ({ open, savedViewName, onClose, onViewTemporarily, onCreateView }) => {
14504
+ const i18n = (0, import_core_react12.useI18nContext)();
14505
+ const handleViewTemporarily = () => {
14506
+ onViewTemporarily?.();
14316
14507
  };
14317
- return opts;
14318
- }
14319
- function getUrl(url, baseUrl) {
14320
- return baseUrl ? applyBaseUrl(url, baseUrl) : url;
14321
- }
14322
- function request(url, { baseUrl, ...options } = {}) {
14323
- return fetch(getUrl(url, baseUrl), getOptions(options));
14324
- }
14325
- function requestJSON(url, requestParams = {}) {
14326
- return request(url, requestParams).then(
14327
- (response) => response.json()
14508
+ const handleCreateView = () => {
14509
+ onCreateView?.();
14510
+ };
14511
+ return /* @__PURE__ */ import_react13.default.createElement(
14512
+ import_core_react12.Modal,
14513
+ {
14514
+ "data-testid": "create-view-confirmation-modal",
14515
+ open,
14516
+ onClickOverlay: onClose
14517
+ },
14518
+ /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Modal.Header, { onClose }, i18n.t("savedViews.modal.copyConfirmation.headline", {
14519
+ savedViewName
14520
+ })),
14521
+ /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Modal.Body, null, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.P, null, i18n.t("savedViews.modal.copyConfirmation.description"))),
14522
+ /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Modal.Footer, null, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Modal.FooterButtons, null, /* @__PURE__ */ import_react13.default.createElement(
14523
+ import_core_react12.Button,
14524
+ {
14525
+ variant: "secondary",
14526
+ onClick: handleViewTemporarily,
14527
+ "data-testid": "view-temporarily-button"
14528
+ },
14529
+ i18n.t("savedViews.actions.viewTemporarily")
14530
+ ), /* @__PURE__ */ import_react13.default.createElement(
14531
+ import_core_react12.Button,
14532
+ {
14533
+ variant: "primary",
14534
+ onClick: handleCreateView,
14535
+ "data-testid": "create-view-button"
14536
+ },
14537
+ i18n.t("savedViews.actions.createView")
14538
+ )))
14328
14539
  );
14329
- }
14540
+ };
14330
14541
 
14331
- // src/utils/Api/queries.ts
14332
- var import_react_query2 = require("@tanstack/react-query");
14542
+ // src/utils/Hooks/useViewSelection.ts
14543
+ var import_react15 = require("react");
14333
14544
 
14334
- // src/utils/Api/queriesHandler.ts
14335
- var import_react_query = require("@tanstack/react-query");
14336
- var import_core_react11 = require("@procore/core-react");
14337
- var useApiRequest = (props, method, mutationKey) => {
14338
- const { projectId, companyId, domain, tableName } = props;
14339
- const queryClient2 = (0, import_react_query.useQueryClient)();
14340
- const { locale: locale2 } = (0, import_core_react11.useI18nContext)();
14341
- return (0, import_react_query.useMutation)({
14342
- mutationKey,
14343
- mutationFn: async (savedView) => {
14344
- let url = "";
14345
- if (method === "DELETE" || method === "PUT") {
14346
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
14347
- } else {
14348
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14545
+ // src/utils/Hooks/useUrlSync.ts
14546
+ var import_react14 = require("react");
14547
+ var import_react_router_dom = require("react-router-dom");
14548
+ var useUrlSync = (selectedView, availableViews, defaultView, onViewFound, onViewNotFound) => {
14549
+ const [searchParams, setSearchParams] = (0, import_react_router_dom.useSearchParams)();
14550
+ const applySavedViewFromUrl = (savedViewId) => {
14551
+ if (savedViewId === "default") {
14552
+ if (defaultView.id !== selectedView?.id) {
14553
+ onViewFound(defaultView);
14349
14554
  }
14350
- const response = await requestJSON(url, {
14351
- method,
14352
- body: JSON.stringify(savedView),
14353
- headers: {
14354
- "Content-Type": "application/json",
14355
- "Accept-Language": locale2
14356
- }
14357
- });
14358
- if (response.error) {
14359
- throw response.error;
14360
- }
14361
- return response.data;
14362
- },
14363
- onSuccess: (savedView) => {
14364
- if (method === "DELETE" || method === "POST") {
14365
- queryClient2.invalidateQueries({
14366
- queryKey: ["savedViews", domain, tableName]
14367
- });
14368
- return;
14369
- } else {
14370
- const oldData = queryClient2.getQueryData([
14371
- "savedViews",
14372
- domain,
14373
- tableName
14374
- ]);
14375
- const oldView = oldData?.find((item) => item.id === savedView.id);
14376
- if (oldView?.name !== savedView.name) {
14377
- queryClient2.invalidateQueries({
14378
- queryKey: ["savedViews", domain, tableName]
14379
- });
14380
- return;
14381
- }
14555
+ return;
14556
+ }
14557
+ const viewInUserViews = availableViews.find((v2) => v2.id === savedViewId);
14558
+ if (viewInUserViews) {
14559
+ if (viewInUserViews.id !== selectedView?.id) {
14560
+ onViewFound(viewInUserViews);
14382
14561
  }
14383
- queryClient2.setQueryData(
14384
- ["savedViews", domain, tableName],
14385
- (oldData) => {
14386
- if (!oldData)
14387
- return [savedView];
14388
- return oldData.map(
14389
- (item) => item.id === savedView.id ? savedView : item
14390
- );
14562
+ } else {
14563
+ onViewNotFound(savedViewId);
14564
+ }
14565
+ };
14566
+ const applyListView = (viewParam) => {
14567
+ if (viewParam === "list" && defaultView.id !== selectedView?.id) {
14568
+ onViewFound(defaultView);
14569
+ }
14570
+ };
14571
+ (0, import_react14.useEffect)(() => {
14572
+ if (!availableViews.length)
14573
+ return;
14574
+ const savedViewId = searchParams.get("saved-view");
14575
+ const viewParamFromConsumer = searchParams.get("view");
14576
+ if (savedViewId) {
14577
+ applySavedViewFromUrl(savedViewId);
14578
+ return;
14579
+ }
14580
+ if (viewParamFromConsumer) {
14581
+ applyListView(viewParamFromConsumer);
14582
+ }
14583
+ }, [
14584
+ searchParams,
14585
+ availableViews,
14586
+ defaultView,
14587
+ selectedView,
14588
+ onViewFound,
14589
+ onViewNotFound
14590
+ ]);
14591
+ const updateUrl = (view) => {
14592
+ setSearchParams(
14593
+ (currentParams) => {
14594
+ const updatedParams = new URLSearchParams(currentParams);
14595
+ if (view.id === "default") {
14596
+ updatedParams.delete("saved-view");
14597
+ } else {
14598
+ updatedParams.set("saved-view", view.id);
14391
14599
  }
14600
+ return updatedParams;
14601
+ },
14602
+ { replace: true }
14603
+ );
14604
+ };
14605
+ return { updateUrl };
14606
+ };
14607
+
14608
+ // src/utils/Hooks/useViewSelection.ts
14609
+ var useViewSelection = (config, savedViews, openCrossUserModal) => {
14610
+ const [selectedSavedView, setSelectedSavedView] = (0, import_react15.useState)(() => {
14611
+ try {
14612
+ const savedView = JSON.parse(
14613
+ localStorage.getItem(
14614
+ `${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`
14615
+ )
14392
14616
  );
14617
+ return savedView || config.defaultView;
14618
+ } catch (e2) {
14619
+ return config.defaultView;
14393
14620
  }
14394
14621
  });
14622
+ const [temporaryView, setTemporaryView] = (0, import_react15.useState)(null);
14623
+ const createTemporaryView = (0, import_react15.useCallback)((fetchedView) => {
14624
+ const tempView = {
14625
+ ...fetchedView,
14626
+ id: "temporary",
14627
+ name: "Temporary View"
14628
+ };
14629
+ setTemporaryView(tempView);
14630
+ return tempView;
14631
+ }, []);
14632
+ const clearTemporaryView = (0, import_react15.useCallback)(() => setTemporaryView(null), []);
14633
+ const updateLocalStorage = (0, import_react15.useCallback)(
14634
+ (view) => {
14635
+ if (config.stickyViewsKey) {
14636
+ localStorage.setItem(
14637
+ `${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`,
14638
+ JSON.stringify(view)
14639
+ );
14640
+ }
14641
+ },
14642
+ [
14643
+ config.domain,
14644
+ config.tableName,
14645
+ config.stickyViewsKey,
14646
+ config.projectId,
14647
+ config.userId
14648
+ ]
14649
+ );
14650
+ const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
14651
+ const onUrlViewFound = (foundView) => {
14652
+ selectView(foundView);
14653
+ };
14654
+ const onUrlViewNotFound = (viewId) => {
14655
+ if (viewId === selectedSavedView?.id) {
14656
+ return;
14657
+ }
14658
+ openCrossUserModal(viewId);
14659
+ };
14660
+ const { updateUrl } = useUrlSync(
14661
+ selectedSavedView,
14662
+ allViews,
14663
+ config.defaultView,
14664
+ onUrlViewFound,
14665
+ onUrlViewNotFound
14666
+ );
14667
+ const selectView = (0, import_react15.useCallback)(
14668
+ (view) => {
14669
+ if (view.id !== "temporary" && temporaryView) {
14670
+ clearTemporaryView();
14671
+ }
14672
+ const viewToSelect = config.onSelect({ item: view });
14673
+ setSelectedSavedView(viewToSelect);
14674
+ updateLocalStorage(viewToSelect);
14675
+ updateUrl(viewToSelect);
14676
+ return viewToSelect;
14677
+ },
14678
+ [config, temporaryView, clearTemporaryView, updateLocalStorage, updateUrl]
14679
+ );
14680
+ return {
14681
+ selectedView: selectedSavedView,
14682
+ selectView,
14683
+ updateLocalStorage,
14684
+ temporaryView,
14685
+ createTemporaryView
14686
+ };
14395
14687
  };
14396
14688
 
14397
- // src/utils/Api/queries.ts
14398
- var PAGE_SIZE = 50 * VIEW_LEVELS.length;
14399
- var useSavedViewsQuery = (props) => {
14400
- const { projectId, companyId, domain, tableName } = props;
14401
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14402
- return (0, import_react_query2.useQuery)({
14403
- enabled: props.enableSavedViews,
14404
- queryKey: ["savedViews", domain, tableName],
14405
- queryFn: async () => {
14406
- const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
14407
- const response = await requestJSON(getUrl2);
14408
- return response.data;
14689
+ // src/utils/Hooks/useCrossUserSharing.ts
14690
+ var import_react16 = __toESM(require("react"));
14691
+ var useCrossUserSharing = (queryInput, viewId, selectedSavedView, defaultView, actions, tableName) => {
14692
+ const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
14693
+ viewId,
14694
+ queryInput,
14695
+ Boolean(viewId)
14696
+ );
14697
+ const { mutate: createSavedView } = useCreateSavedView(queryInput);
14698
+ import_react16.default.useEffect(() => {
14699
+ if (fetchError && viewId) {
14700
+ actions.selectView(selectedSavedView ?? defaultView);
14701
+ actions.closeModal();
14702
+ }
14703
+ }, [fetchError, viewId, actions, selectedSavedView, defaultView]);
14704
+ const viewSharedViewTemporarily = () => {
14705
+ if (fetchedView) {
14706
+ const tempView = actions.createTemporaryView(fetchedView);
14707
+ actions.selectView(tempView);
14708
+ actions.closeModal();
14409
14709
  }
14410
- });
14411
- };
14412
- var useSavedViewsPermissions = (props) => {
14413
- const { projectId, companyId, domain } = props;
14414
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
14415
- return (0, import_react_query2.useQuery)({
14416
- enabled: props.enableSavedViews,
14417
- queryKey: ["savedViewsConfig", domain],
14418
- queryFn: async () => {
14419
- const response = await requestJSON(url);
14420
- return response.data;
14710
+ };
14711
+ const createPersonalCopyOfSharedView = () => {
14712
+ if (fetchedView) {
14713
+ const viewToCreate = {
14714
+ name: fetchedView.name,
14715
+ description: fetchedView.description,
14716
+ table_name: tableName,
14717
+ table_config: fetchedView.table_config,
14718
+ view_level: "personal"
14719
+ };
14720
+ createSavedView(viewToCreate, {
14721
+ onSuccess: (newView) => {
14722
+ actions.selectView(newView);
14723
+ actions.closeModal();
14724
+ }
14725
+ });
14421
14726
  }
14422
- });
14727
+ };
14728
+ return {
14729
+ fetchedView,
14730
+ viewSharedViewTemporarily,
14731
+ createPersonalCopyOfSharedView
14732
+ };
14733
+ };
14734
+
14735
+ // src/utils/Hooks/useModalState.ts
14736
+ var import_react17 = require("react");
14737
+ var useModalState = () => {
14738
+ const [activeModal, setActiveModal] = (0, import_react17.useState)(null);
14739
+ const [modalData, setModalData] = (0, import_react17.useState)(null);
14740
+ const openModal = (0, import_react17.useCallback)(
14741
+ (type, data) => {
14742
+ setActiveModal(type);
14743
+ setModalData(data ?? null);
14744
+ },
14745
+ []
14746
+ );
14747
+ const closeModal = (0, import_react17.useCallback)(() => {
14748
+ setActiveModal(null);
14749
+ setModalData(null);
14750
+ }, []);
14751
+ const isModalOpen = (0, import_react17.useCallback)(
14752
+ (type) => {
14753
+ return activeModal === type;
14754
+ },
14755
+ [activeModal]
14756
+ );
14757
+ return {
14758
+ openModal,
14759
+ closeModal,
14760
+ isModalOpen,
14761
+ modalData,
14762
+ activeModal
14763
+ };
14423
14764
  };
14424
- var useCreateSavedView = (props) => useApiRequest(props, "POST", [
14425
- "createSavedView",
14426
- props.domain,
14427
- props.tableName
14428
- ]);
14429
- var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
14430
- "updateSavedView",
14431
- props.domain,
14432
- props.tableName
14433
- ]);
14434
- var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
14435
- "deleteSavedView",
14436
- props.domain,
14437
- props.tableName
14438
- ]);
14439
- var createQueries = (customBackend) => ({
14440
- useSavedViewsQuery: customBackend?.useSavedViewsQuery ?? useSavedViewsQuery,
14441
- useSavedViewsPermissions: customBackend?.useSavedViewsPermissions ?? useSavedViewsPermissions,
14442
- useCreateSavedView: customBackend?.useCreateSavedView ?? useCreateSavedView,
14443
- useUpdateSavedView: customBackend?.useUpdateSavedView ?? useUpdateSavedView,
14444
- useDeleteSavedView: customBackend?.useDeleteSavedView ?? useDeleteSavedView
14445
- });
14446
14765
 
14447
14766
  // src/SavedViews/components/SavedViews/SavedViews.tsx
14448
14767
  var StyledPanel = styled_components_esm_default.div`
@@ -14458,75 +14777,80 @@ var SavedViewsContent = (props) => {
14458
14777
  projectId,
14459
14778
  companyId
14460
14779
  };
14461
- const backend = createQueries(props.backend);
14462
- const { mutate: deleteSavedView } = backend.useDeleteSavedView(queryInput);
14463
- const [selectedSavedView, setSelectedSavedView] = (0, import_react13.useState)(() => {
14464
- try {
14465
- const savedView = JSON.parse(
14466
- localStorage.getItem(
14467
- `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
14468
- )
14469
- );
14470
- return savedView || props.defaultView;
14471
- } catch (e2) {
14472
- return props.defaultView;
14473
- }
14474
- });
14475
- const updateLocalStorage = (view) => {
14476
- if (props.stickyViewsKey) {
14477
- localStorage.setItem(
14478
- `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
14479
- JSON.stringify(view)
14480
- );
14481
- }
14482
- };
14483
- const handleViewItemSelect = ({ item }) => {
14484
- const viewToSetAsSelected = props.onSelect({ item });
14485
- setSelectedSavedView(viewToSetAsSelected);
14486
- updateLocalStorage(viewToSetAsSelected);
14780
+ const { data: savedViews } = useSavedViewsQuery(queryInput);
14781
+ const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
14782
+ const { openModal, closeModal, isModalOpen, modalData, activeModal } = useModalState();
14783
+ const openCrossUserModal = (viewId) => {
14784
+ openModal("crossUser" /* CROSS_USER */, { viewId });
14487
14785
  };
14488
- const onDelete = () => {
14489
- if (selectedSavedView) {
14490
- deleteSavedView(selectedSavedView, {
14491
- onSuccess: () => handleViewItemSelect({ item: props.defaultView })
14786
+ const {
14787
+ selectedView,
14788
+ selectView,
14789
+ updateLocalStorage,
14790
+ temporaryView,
14791
+ createTemporaryView
14792
+ } = useViewSelection(
14793
+ {
14794
+ domain: props.domain,
14795
+ tableName: props.tableName,
14796
+ stickyViewsKey: props.stickyViewsKey,
14797
+ userId: props.userId,
14798
+ projectId,
14799
+ defaultView: props.defaultView,
14800
+ onSelect: props.onSelect
14801
+ },
14802
+ savedViews,
14803
+ openCrossUserModal
14804
+ );
14805
+ const {
14806
+ fetchedView,
14807
+ viewSharedViewTemporarily,
14808
+ createPersonalCopyOfSharedView
14809
+ } = useCrossUserSharing(
14810
+ queryInput,
14811
+ modalData?.viewId ?? null,
14812
+ selectedView,
14813
+ props.defaultView,
14814
+ {
14815
+ selectView,
14816
+ createTemporaryView,
14817
+ closeModal
14818
+ },
14819
+ props.tableName
14820
+ );
14821
+ const deleteSelectedView = () => {
14822
+ if (selectedView) {
14823
+ deleteSavedView(selectedView, {
14824
+ onSuccess: () => selectView(props.defaultView)
14492
14825
  });
14493
14826
  }
14494
14827
  };
14495
- const i18n = (0, import_core_react12.useI18nContext)();
14496
- const [openDeleteModal, setOpenDeleteModal] = (0, import_react13.useState)(false);
14497
- const [openEditCreateModal, setOpenEditCreateModal] = (0, import_react13.useState)(false);
14498
- const [editCreateModalType, setEditCreateModalType] = (0, import_react13.useState)(
14499
- "create" /* CREATE */
14500
- );
14501
- const onCloseDeleteModal = () => {
14502
- setOpenDeleteModal(false);
14503
- };
14504
- const onCloseEditModal = () => {
14505
- setOpenEditCreateModal(false);
14828
+ const confirmDeleteAndCloseModal = () => {
14829
+ deleteSelectedView();
14830
+ closeModal();
14506
14831
  };
14507
- const openModal = (type) => {
14508
- setEditCreateModalType(type);
14509
- setOpenEditCreateModal(true);
14510
- };
14511
- const onOpenDeleteModal = () => {
14512
- setOpenDeleteModal(true);
14832
+ const i18n = (0, import_core_react13.useI18nContext)();
14833
+ const selectSavedViewFromList = ({ item }) => selectView(item);
14834
+ const setSelectedSavedView = (view) => {
14835
+ selectView(view);
14513
14836
  };
14514
- return /* @__PURE__ */ import_react13.default.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ import_react13.default.createElement(
14837
+ const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
14838
+ return /* @__PURE__ */ import_react18.default.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ import_react18.default.createElement(
14515
14839
  ExpandedPanel,
14516
14840
  {
14517
14841
  "data-testid": "saved-view-expanded-panel",
14518
14842
  provider: props.provider
14519
14843
  },
14520
- /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Panel.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Panel.Title, null, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Flex, { alignItems: "center" }, /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Box, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ import_react13.default.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ import_react13.default.createElement(
14521
- import_core_react12.Tooltip,
14844
+ /* @__PURE__ */ import_react18.default.createElement(import_core_react13.Panel.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ import_react18.default.createElement(import_core_react13.Panel.Title, null, /* @__PURE__ */ import_react18.default.createElement(import_core_react13.Flex, { alignItems: "center" }, /* @__PURE__ */ import_react18.default.createElement(import_core_react13.Box, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ import_react18.default.createElement(import_core_react13.Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ import_react18.default.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ import_react18.default.createElement(
14845
+ import_core_react13.Tooltip,
14522
14846
  {
14523
14847
  overlay: i18n.t("savedViews.actions.create"),
14524
14848
  showDelay: 1e3
14525
14849
  },
14526
- /* @__PURE__ */ import_react13.default.createElement("span", null, /* @__PURE__ */ import_react13.default.createElement(
14527
- import_core_react12.Button,
14850
+ /* @__PURE__ */ import_react18.default.createElement("span", null, /* @__PURE__ */ import_react18.default.createElement(
14851
+ import_core_react13.Button,
14528
14852
  {
14529
- icon: /* @__PURE__ */ import_react13.default.createElement(Plus_default, null),
14853
+ icon: /* @__PURE__ */ import_react18.default.createElement(Plus_default, null),
14530
14854
  variant: "secondary",
14531
14855
  "data-testid": "expanded-panel-create-button",
14532
14856
  onClick: () => openModal("create" /* CREATE */),
@@ -14535,58 +14859,63 @@ var SavedViewsContent = (props) => {
14535
14859
  i18n.t("savedViews.actions.create")
14536
14860
  ))
14537
14861
  )),
14538
- /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Panel.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ import_react13.default.createElement(
14862
+ /* @__PURE__ */ import_react18.default.createElement(import_core_react13.Panel.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ import_react18.default.createElement(
14539
14863
  PanelContent,
14540
14864
  {
14541
- onSelect: handleViewItemSelect,
14865
+ onSelect: selectSavedViewFromList,
14542
14866
  openModal,
14543
- onDelete: onOpenDeleteModal,
14867
+ onDelete: () => openModal("delete" /* DELETE */),
14544
14868
  updateLocalStorage,
14545
14869
  setSelectedSavedView,
14546
14870
  queryInput,
14547
- selectedSavedView,
14871
+ selectedSavedView: selectedView,
14548
14872
  tableConfig: props.tableConfig,
14549
14873
  defaultView: props.defaultView,
14550
14874
  stickyViewsKey: props.stickyViewsKey,
14875
+ savedViews: allViews,
14551
14876
  provider: props.provider,
14552
- userId: props.userId,
14553
- backend
14877
+ userId: props.userId
14554
14878
  }
14555
14879
  ))
14556
- ), /* @__PURE__ */ import_react13.default.createElement(
14880
+ ), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ import_react18.default.createElement(
14557
14881
  SavedViewsFormModal,
14558
14882
  {
14559
- open: openEditCreateModal,
14560
- mode: editCreateModalType,
14561
- onCancel: onCloseEditModal,
14883
+ open: true,
14884
+ mode: activeModal,
14885
+ onCancel: closeModal,
14562
14886
  queryInput,
14563
14887
  tableConfig: props.tableConfig,
14564
14888
  tableName: props.tableName,
14565
- selectedSavedView,
14889
+ selectedSavedView: selectedView,
14566
14890
  setSelectedSavedView,
14567
- onSelect: (view) => handleViewItemSelect({ item: view }),
14568
- setOpenEditCreateModal,
14569
- defaultView: props.defaultView,
14570
- backend
14891
+ onSelect: selectView,
14892
+ setOpenEditCreateModal: closeModal,
14893
+ defaultView: props.defaultView
14571
14894
  }
14572
- ), selectedSavedView && /* @__PURE__ */ import_react13.default.createElement(
14895
+ ), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ import_react18.default.createElement(
14573
14896
  SavedViewsDeleteConfirmationModalShared,
14574
14897
  {
14575
- open: openDeleteModal,
14576
- onDelete: () => {
14577
- onDelete();
14578
- onCloseDeleteModal();
14579
- },
14580
- onCancel: onCloseDeleteModal
14898
+ open: true,
14899
+ onDelete: confirmDeleteAndCloseModal,
14900
+ onCancel: closeModal
14901
+ }
14902
+ ), fetchedView && isModalOpen("crossUser" /* CROSS_USER */) && /* @__PURE__ */ import_react18.default.createElement(
14903
+ CreateViewConfirmationModal,
14904
+ {
14905
+ open: true,
14906
+ savedViewName: fetchedView.name,
14907
+ onClose: closeModal,
14908
+ onViewTemporarily: viewSharedViewTemporarily,
14909
+ onCreateView: createPersonalCopyOfSharedView
14581
14910
  }
14582
14911
  ));
14583
14912
  };
14584
14913
  var SavedViews = (props) => {
14585
- return /* @__PURE__ */ import_react13.default.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ import_react13.default.createElement(import_react_query3.QueryClientProvider, { client: queryClient }, /* @__PURE__ */ import_react13.default.createElement(SavedViewsContent, { ...props })));
14914
+ return /* @__PURE__ */ import_react18.default.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ import_react18.default.createElement(import_react_query3.QueryClientProvider, { client: queryClient }, /* @__PURE__ */ import_react18.default.createElement(SavedViewsContent, { ...props })));
14586
14915
  };
14587
14916
 
14588
14917
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
14589
- var import_toast_alert2 = require("@procore/toast-alert");
14918
+ var import_toast_alert3 = require("@procore/toast-alert");
14590
14919
  var SmartGridSavedViews = (props) => {
14591
14920
  const { gridApi, projectId, companyId } = props;
14592
14921
  const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
@@ -14605,20 +14934,18 @@ var SmartGridSavedViews = (props) => {
14605
14934
  gridApi.refreshCells();
14606
14935
  return item;
14607
14936
  }
14608
- const tableConfig2 = item.table_config;
14609
- const updatedItemConfig = props.transformSettings?.(tableConfig2) ?? tableConfig2;
14610
14937
  const updatedView = {
14611
14938
  ...item,
14612
14939
  table_config: customAndConfigSync(
14613
- updatedItemConfig,
14614
- tableConfig2
14940
+ item.table_config,
14941
+ tableConfig
14615
14942
  )
14616
14943
  };
14617
14944
  updateTableConfig(updatedView, gridApi, "smart-grid");
14618
14945
  setTableConfig(updatedView.table_config);
14619
14946
  return updatedView;
14620
14947
  };
14621
- return /* @__PURE__ */ import_react14.default.createElement(import_toast_alert2.ToastAlertProvider, null, /* @__PURE__ */ import_react14.default.createElement(
14948
+ return /* @__PURE__ */ import_react19.default.createElement(import_toast_alert3.ToastAlertProvider, null, /* @__PURE__ */ import_react19.default.createElement(
14622
14949
  SavedViews,
14623
14950
  {
14624
14951
  onSelect,
@@ -14631,18 +14958,17 @@ var SmartGridSavedViews = (props) => {
14631
14958
  tableName: props.tableName,
14632
14959
  tableConfig,
14633
14960
  stickyViewsKey: props.stickyViewsKey,
14634
- enableSavedViews: props.enableSavedViews,
14635
- backend: props.backend
14961
+ enableSavedViews: props.enableSavedViews
14636
14962
  }
14637
14963
  ));
14638
14964
  };
14639
14965
 
14640
14966
  // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14641
- var import_react16 = __toESM(require("react"));
14967
+ var import_react21 = __toESM(require("react"));
14642
14968
 
14643
14969
  // src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
14644
- var import_react15 = require("react");
14645
- var import_core_react13 = require("@procore/core-react");
14970
+ var import_react20 = require("react");
14971
+ var import_core_react14 = require("@procore/core-react");
14646
14972
  var DEFAULT_COLUMN_STATE = {
14647
14973
  hidden: false,
14648
14974
  pinned: null,
@@ -14689,7 +15015,7 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
14689
15015
  return result;
14690
15016
  };
14691
15017
  var useDefaultViewName2 = (domain, defaultViewName) => {
14692
- const i18n = (0, import_core_react13.useI18nContext)();
15018
+ const i18n = (0, import_core_react14.useI18nContext)();
14693
15019
  return defaultViewName || i18n.t(domain, {
14694
15020
  scope: "savedViews.defaultViewTitle",
14695
15021
  defaultValue: "Default View"
@@ -14697,7 +15023,7 @@ var useDefaultViewName2 = (domain, defaultViewName) => {
14697
15023
  };
14698
15024
  var useDefaultView2 = (props) => {
14699
15025
  const name = useDefaultViewName2(props.domain, props.defaultViewName);
14700
- const extractedDefaultConfig = (0, import_react15.useMemo)(
15026
+ const extractedDefaultConfig = (0, import_react20.useMemo)(
14701
15027
  () => extractDefaultView(props.columnDefinitions, props.receivedConfigFromTool),
14702
15028
  [props.columnDefinitions, props.receivedConfigFromTool]
14703
15029
  );
@@ -14710,18 +15036,18 @@ var useDefaultView2 = (props) => {
14710
15036
  };
14711
15037
 
14712
15038
  // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14713
- var import_toast_alert3 = require("@procore/toast-alert");
14714
- var DataTableSavedViews = (0, import_react16.forwardRef)((props, ref) => {
15039
+ var import_toast_alert4 = require("@procore/toast-alert");
15040
+ var DataTableSavedViews = (0, import_react21.forwardRef)((props, ref) => {
14715
15041
  const { tableApi, onTableConfigChange, projectId, companyId } = props;
14716
- const [internalTableConfig, setInternalTableConfig] = (0, import_react16.useState)(
15042
+ const [internalTableConfig, setInternalTableConfig] = (0, import_react21.useState)(
14717
15043
  props.defaultViewConfig
14718
15044
  );
14719
- (0, import_react16.useImperativeHandle)(ref, () => ({
15045
+ (0, import_react21.useImperativeHandle)(ref, () => ({
14720
15046
  setTableConfig: (newConfig) => {
14721
15047
  handleConfigChange(newConfig);
14722
15048
  }
14723
15049
  }));
14724
- const handleConfigChange = (0, import_react16.useCallback)(
15050
+ const handleConfigChange = (0, import_react21.useCallback)(
14725
15051
  (newConfig) => {
14726
15052
  setInternalTableConfig(newConfig);
14727
15053
  onTableConfigChange(newConfig);
@@ -14749,7 +15075,7 @@ var DataTableSavedViews = (0, import_react16.forwardRef)((props, ref) => {
14749
15075
  if (!internalTableConfig) {
14750
15076
  return null;
14751
15077
  }
14752
- return /* @__PURE__ */ import_react16.default.createElement(import_toast_alert3.ToastAlertProvider, null, /* @__PURE__ */ import_react16.default.createElement(
15078
+ return /* @__PURE__ */ import_react21.default.createElement(import_toast_alert4.ToastAlertProvider, null, /* @__PURE__ */ import_react21.default.createElement(
14753
15079
  SavedViews,
14754
15080
  {
14755
15081
  onSelect,