@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
  var _a, _b;
11178
11208
  if (!props.item) {
@@ -11196,7 +11226,19 @@ var SavedViewCollectionMenuItem = (props) => {
11196
11226
  event.stopPropagation();
11197
11227
  (_a = props.onUpdate) == null ? void 0 : _a.call(props, props.item);
11198
11228
  };
11229
+ const { showToast } = (0, import_toast_alert.useToastAlertContext)();
11199
11230
  const i18n = (0, import_core_react3.useI18nContext)();
11231
+ const copyShareLink = async (event) => {
11232
+ event.stopPropagation();
11233
+ try {
11234
+ const currentUrl = new URL(window.location.href);
11235
+ await navigator.clipboard.writeText(currentUrl.toString());
11236
+ showToast.success(i18n.t("savedViews.actions.linkCopied"));
11237
+ } catch (error) {
11238
+ console.error("Failed to copy link:", error);
11239
+ showToast.error(i18n.t("savedViews.errors.copyFailed"));
11240
+ }
11241
+ };
11200
11242
  const flyoutMenuOptions = [
11201
11243
  {
11202
11244
  value: "editNameDesc",
@@ -11207,7 +11249,7 @@ var SavedViewCollectionMenuItem = (props) => {
11207
11249
  label: i18n.t("savedViews.actions.delete")
11208
11250
  }
11209
11251
  ];
11210
- return /* @__PURE__ */ React13.createElement(
11252
+ return /* @__PURE__ */ React14.createElement(
11211
11253
  Container2,
11212
11254
  {
11213
11255
  "aria-selected": Boolean(props.selected),
@@ -11218,7 +11260,7 @@ var SavedViewCollectionMenuItem = (props) => {
11218
11260
  }),
11219
11261
  "data-testid": "saved-view-collection-menu-item"
11220
11262
  },
11221
- /* @__PURE__ */ React13.createElement(
11263
+ /* @__PURE__ */ React14.createElement(
11222
11264
  "span",
11223
11265
  {
11224
11266
  "data-testid": "saved-view-display-name",
@@ -11226,7 +11268,7 @@ var SavedViewCollectionMenuItem = (props) => {
11226
11268
  },
11227
11269
  props.item.name
11228
11270
  ),
11229
- /* @__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(
11271
+ /* @__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(
11230
11272
  import_core_react3.Button,
11231
11273
  {
11232
11274
  onClick: updateItem,
@@ -11237,7 +11279,17 @@ var SavedViewCollectionMenuItem = (props) => {
11237
11279
  loading: props.isUpdateProcessing
11238
11280
  },
11239
11281
  i18n.t("savedViews.actions.update")
11240
- ))), /* @__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(
11282
+ )), props.item.id !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(
11283
+ import_core_react3.Button,
11284
+ {
11285
+ onClick: copyShareLink,
11286
+ variant: "tertiary",
11287
+ size: "sm",
11288
+ "aria-label": i18n.t("savedViews.actions.copyShareLink"),
11289
+ "data-testid": "copy-share-link-button"
11290
+ },
11291
+ /* @__PURE__ */ React14.createElement(Link_default, { size: "sm" })
11292
+ ))), /* @__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(
11241
11293
  import_core_react3.DropdownFlyout,
11242
11294
  {
11243
11295
  "data-testid": "saved-view-overflow-button",
@@ -11261,13 +11313,176 @@ var ExpandedPanel = styled_components_esm_default(import_core_react4.Panel)`
11261
11313
  `;
11262
11314
 
11263
11315
  // src/SavedViews/components/Panels/PanelContent.tsx
11264
- var import_core_react6 = require("@procore/core-react");
11265
- var import_toast_alert = require("@procore/toast-alert");
11316
+ var import_core_react7 = require("@procore/core-react");
11317
+ var import_toast_alert2 = require("@procore/toast-alert");
11266
11318
  var import_react9 = __toESM(require("react"));
11267
11319
 
11320
+ // ../../node_modules/@procore/core-http/dist/modern/index.js
11321
+ function getCSRFToken() {
11322
+ const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
11323
+ return token ? decodeURIComponent(token.pop() || "") : "";
11324
+ }
11325
+ function getCSRFHeader() {
11326
+ const csrfToken = getCSRFToken();
11327
+ return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
11328
+ }
11329
+ function removeLeadingSlash(url) {
11330
+ return url.startsWith("/") ? url.substring(1, url.length) : url;
11331
+ }
11332
+ function removeTrailingSlash(url) {
11333
+ return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
11334
+ }
11335
+ function applyBaseUrl(url, baseUrl) {
11336
+ return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
11337
+ }
11338
+ function getOptions({ headers, ...options }) {
11339
+ const opts = {
11340
+ credentials: "same-origin",
11341
+ headers: {
11342
+ ...getCSRFHeader(),
11343
+ ...headers
11344
+ },
11345
+ mode: "same-origin",
11346
+ ...options
11347
+ };
11348
+ return opts;
11349
+ }
11350
+ function getUrl(url, baseUrl) {
11351
+ return baseUrl ? applyBaseUrl(url, baseUrl) : url;
11352
+ }
11353
+ function request(url, { baseUrl, ...options } = {}) {
11354
+ return fetch(getUrl(url, baseUrl), getOptions(options));
11355
+ }
11356
+ function requestJSON(url, requestParams = {}) {
11357
+ return request(url, requestParams).then(
11358
+ (response) => response.json()
11359
+ );
11360
+ }
11361
+
11362
+ // src/utils/Api/queries.ts
11363
+ var import_react_query2 = require("@tanstack/react-query");
11364
+
11365
+ // src/utils/Api/queriesHandler.ts
11366
+ var import_react_query = require("@tanstack/react-query");
11367
+ var import_core_react5 = require("@procore/core-react");
11368
+ var useApiRequest = (props, method, mutationKey) => {
11369
+ const { projectId, companyId, domain, tableName } = props;
11370
+ const queryClient2 = (0, import_react_query.useQueryClient)();
11371
+ const { locale: locale2 } = (0, import_core_react5.useI18nContext)();
11372
+ return (0, import_react_query.useMutation)({
11373
+ mutationKey,
11374
+ mutationFn: async (savedView) => {
11375
+ let url = "";
11376
+ if (method === "DELETE" || method === "PUT") {
11377
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
11378
+ } else {
11379
+ url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11380
+ }
11381
+ const response = await requestJSON(url, {
11382
+ method,
11383
+ body: JSON.stringify(savedView),
11384
+ headers: {
11385
+ "Content-Type": "application/json",
11386
+ "Accept-Language": locale2
11387
+ }
11388
+ });
11389
+ if (response.error) {
11390
+ throw response.error;
11391
+ }
11392
+ return response.data;
11393
+ },
11394
+ onSuccess: (savedView) => {
11395
+ if (method === "DELETE" || method === "POST") {
11396
+ queryClient2.invalidateQueries({
11397
+ queryKey: ["savedViews", domain, tableName]
11398
+ });
11399
+ return;
11400
+ } else {
11401
+ const oldData = queryClient2.getQueryData([
11402
+ "savedViews",
11403
+ domain,
11404
+ tableName
11405
+ ]);
11406
+ const oldView = oldData == null ? void 0 : oldData.find((item) => item.id === savedView.id);
11407
+ if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
11408
+ queryClient2.invalidateQueries({
11409
+ queryKey: ["savedViews", domain, tableName]
11410
+ });
11411
+ return;
11412
+ }
11413
+ }
11414
+ queryClient2.setQueryData(
11415
+ ["savedViews", domain, tableName],
11416
+ (oldData) => {
11417
+ if (!oldData)
11418
+ return [savedView];
11419
+ return oldData.map(
11420
+ (item) => item.id === savedView.id ? savedView : item
11421
+ );
11422
+ }
11423
+ );
11424
+ }
11425
+ });
11426
+ };
11427
+
11268
11428
  // src/utils/Constants/viewLevels.ts
11269
11429
  var VIEW_LEVELS = ["company", "project", "personal"];
11270
11430
 
11431
+ // src/utils/Api/queries.ts
11432
+ var PAGE_SIZE = 50 * VIEW_LEVELS.length;
11433
+ var useSavedViewsQuery = (props) => {
11434
+ const { projectId, companyId, domain, tableName } = props;
11435
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
11436
+ return (0, import_react_query2.useQuery)({
11437
+ enabled: props.enableSavedViews,
11438
+ queryKey: ["savedViews", domain, tableName],
11439
+ queryFn: async () => {
11440
+ const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
11441
+ const response = await requestJSON(getUrl2);
11442
+ return response.data;
11443
+ }
11444
+ });
11445
+ };
11446
+ var useSavedViewsPermissions = (props) => {
11447
+ const { projectId, companyId, domain } = props;
11448
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
11449
+ return (0, import_react_query2.useQuery)({
11450
+ enabled: props.enableSavedViews,
11451
+ queryKey: ["savedViewsConfig", domain],
11452
+ queryFn: async () => {
11453
+ const response = await requestJSON(url);
11454
+ return response.data;
11455
+ }
11456
+ });
11457
+ };
11458
+ var useCreateSavedView = (props) => useApiRequest(props, "POST", [
11459
+ "createSavedView",
11460
+ props.domain,
11461
+ props.tableName
11462
+ ]);
11463
+ var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
11464
+ "updateSavedView",
11465
+ props.domain,
11466
+ props.tableName
11467
+ ]);
11468
+ var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
11469
+ "deleteSavedView",
11470
+ props.domain,
11471
+ props.tableName
11472
+ ]);
11473
+ var useFetchSavedViewById = (savedViewId, queryInput, enabled = true) => {
11474
+ const { projectId, companyId } = queryInput;
11475
+ return (0, import_react_query2.useQuery)({
11476
+ enabled: enabled && Boolean(savedViewId),
11477
+ queryKey: ["savedView", savedViewId],
11478
+ queryFn: async () => {
11479
+ const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedViewId}`;
11480
+ const response = await requestJSON(url);
11481
+ return response.data;
11482
+ }
11483
+ });
11484
+ };
11485
+
11271
11486
  // src/SavedViews/components/Panels/PanelContentUtils.ts
11272
11487
  var import_lodash = __toESM(require_lodash());
11273
11488
 
@@ -11282,7 +11497,7 @@ function getSmartGridConfig(api) {
11282
11497
  columnState: columnStateResult,
11283
11498
  rowHeight: rowHeightResult,
11284
11499
  columnGroupState: columnGroupStateResult,
11285
- rowGroupState: rowGroupStateResult.filter((col) => typeof (col == null ? void 0 : col.getColId) === "function").map((col) => col.getColId()),
11500
+ rowGroupState: rowGroupStateResult,
11286
11501
  filterState: serverFiltersResult
11287
11502
  };
11288
11503
  return smartGridConfig;
@@ -11470,7 +11685,7 @@ var useGroups = () => {
11470
11685
  };
11471
11686
 
11472
11687
  // src/SavedViews/components/Panels/ViewLevelHeader.tsx
11473
- var import_core_react5 = require("@procore/core-react");
11688
+ var import_core_react6 = require("@procore/core-react");
11474
11689
  var import_react7 = __toESM(require("react"));
11475
11690
  var groupIcon = (group) => {
11476
11691
  switch (group) {
@@ -11482,26 +11697,26 @@ var groupIcon = (group) => {
11482
11697
  return /* @__PURE__ */ import_react7.default.createElement(Building_default, null);
11483
11698
  }
11484
11699
  };
11485
- var Header = styled_components_esm_default(import_core_react5.Flex)`
11700
+ var Header = styled_components_esm_default(import_core_react6.Flex)`
11486
11701
  width: 100%;
11487
11702
  &:hover {
11488
- background-color: ${import_core_react5.colors.gray98};
11703
+ background-color: ${import_core_react6.colors.gray98};
11489
11704
  }
11490
11705
  `;
11491
11706
  var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
11492
- const I18n = (0, import_core_react5.useI18nContext)();
11707
+ const I18n = (0, import_core_react6.useI18nContext)();
11493
11708
  return /* @__PURE__ */ import_react7.default.createElement(
11494
11709
  Header,
11495
11710
  {
11496
11711
  alignItems: "center",
11497
- padding: `${import_core_react5.spacing.sm}px`,
11498
- gap: `${import_core_react5.spacing.sm}px`,
11712
+ padding: `${import_core_react6.spacing.sm}px`,
11713
+ gap: `${import_core_react6.spacing.sm}px`,
11499
11714
  style: { cursor: "pointer" },
11500
11715
  onClick: () => toggleGroup(group)
11501
11716
  },
11502
11717
  expanded ? /* @__PURE__ */ import_react7.default.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ import_react7.default.createElement(ChevronRight_default, { size: "sm" }),
11503
11718
  groupIcon(group),
11504
- /* @__PURE__ */ import_react7.default.createElement(import_core_react5.Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11719
+ /* @__PURE__ */ import_react7.default.createElement(import_core_react6.Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
11505
11720
  );
11506
11721
  };
11507
11722
  var ViewLevelHeader_default = ViewLevelHeader;
@@ -11519,39 +11734,37 @@ var useScrollToRef = (dependency) => {
11519
11734
  };
11520
11735
 
11521
11736
  // src/SavedViews/components/Panels/PanelContent.tsx
11522
- var Row = styled_components_esm_default(import_core_react6.UNSAFE_Menu.Item)`
11737
+ var Row = styled_components_esm_default(import_core_react7.UNSAFE_Menu.Item)`
11523
11738
  width: 100%;
11524
11739
  padding-left: 35px;
11525
11740
  padding-right: 4px;
11526
- background-color: ${({ selected }) => selected ? import_core_react6.colors.blue96 : "transparent"};
11741
+ background-color: ${({ selected }) => selected ? import_core_react7.colors.blue96 : "transparent"};
11527
11742
 
11528
11743
  &:hover {
11529
- background-color: ${({ selected }) => selected ? import_core_react6.colors.blue96 : import_core_react6.colors.gray98};
11744
+ background-color: ${({ selected }) => selected ? import_core_react7.colors.blue96 : import_core_react7.colors.gray98};
11530
11745
  }
11531
11746
  `;
11532
- var Panel2 = styled_components_esm_default(import_core_react6.DetailPage.Card)`
11747
+ var Panel2 = styled_components_esm_default(import_core_react7.DetailPage.Card)`
11533
11748
  margin: 0;
11534
11749
  height: 100%;
11535
- padding-top: ${import_core_react6.spacing.sm}px;
11750
+ padding-top: ${import_core_react7.spacing.sm}px;
11536
11751
  box-shadow: none;
11537
11752
  `;
11538
11753
  var PanelContent = (props) => {
11539
- var _a;
11540
- const { showToast } = (0, import_toast_alert.useToastAlertContext)();
11541
- const I18n = (0, import_core_react6.useI18nContext)();
11542
- const { useSavedViewsQuery: useSavedViewsQuery2, useSavedViewsPermissions: useSavedViewsPermissions2, useUpdateSavedView: useUpdateSavedView2 } = props.backend;
11543
- const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView2(props.queryInput);
11544
- const { data: savedViews, error: savedViewsError } = useSavedViewsQuery2(
11545
- props.queryInput
11546
- );
11754
+ var _a, _b;
11755
+ const { showToast } = (0, import_toast_alert2.useToastAlertContext)();
11756
+ const I18n = (0, import_core_react7.useI18nContext)();
11757
+ const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView(props.queryInput);
11758
+ const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
11759
+ const savedViews = props.savedViews ?? savedViewsFromQuery;
11547
11760
  const errorToastRef = import_react9.default.useRef(null);
11548
11761
  import_react9.default.useEffect(() => {
11549
11762
  if (savedViewsError && savedViewsError !== errorToastRef.current) {
11550
11763
  showToast.error(I18n.t("savedViews.errors.fetch"));
11551
11764
  errorToastRef.current = savedViewsError;
11552
11765
  }
11553
- }, [savedViewsError]);
11554
- const { data: permissions } = useSavedViewsPermissions2(props.queryInput);
11766
+ }, [savedViewsError, showToast, I18n]);
11767
+ const { data: permissions } = useSavedViewsPermissions(props.queryInput);
11555
11768
  const selectedRowRef = useScrollToRef(savedViews);
11556
11769
  const onUpdate = (data) => {
11557
11770
  const newSavedView = {
@@ -11572,7 +11785,23 @@ var PanelContent = (props) => {
11572
11785
  };
11573
11786
  const { groups, toggleGroup } = useGroups();
11574
11787
  const isDefaultSelected = ((_a = props.selectedSavedView) == null ? void 0 : _a.id) === "default";
11575
- 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(
11788
+ const isTemporarySelected = ((_b = props.selectedSavedView) == null ? void 0 : _b.id) === "temporary";
11789
+ const temporaryView = savedViews == null ? void 0 : savedViews.find((view) => view.id === "temporary");
11790
+ 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(
11791
+ Row,
11792
+ {
11793
+ selected: isTemporarySelected,
11794
+ onClick: () => props.onSelect({ item: temporaryView }),
11795
+ ref: isTemporarySelected ? selectedRowRef : null
11796
+ },
11797
+ /* @__PURE__ */ import_react9.default.createElement(
11798
+ SavedViewCollectionMenuItem,
11799
+ {
11800
+ item: temporaryView,
11801
+ selected: isTemporarySelected
11802
+ }
11803
+ )
11804
+ ), /* @__PURE__ */ import_react9.default.createElement(
11576
11805
  Row,
11577
11806
  {
11578
11807
  selected: isDefaultSelected,
@@ -11588,7 +11817,9 @@ var PanelContent = (props) => {
11588
11817
  )
11589
11818
  ), VIEW_LEVELS.map((level) => {
11590
11819
  const isExpanded = groups[level];
11591
- const views = isExpanded && savedViews ? savedViews.filter((view) => view.view_level === level) : [];
11820
+ const views = isExpanded && savedViews ? savedViews.filter(
11821
+ (view) => view.view_level === level && view.id !== "temporary"
11822
+ ) : [];
11592
11823
  return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, { key: level }, /* @__PURE__ */ import_react9.default.createElement(
11593
11824
  ViewLevelHeader_default,
11594
11825
  {
@@ -11638,12 +11869,12 @@ var PanelContent = (props) => {
11638
11869
  };
11639
11870
 
11640
11871
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
11641
- var import_react14 = __toESM(require("react"));
11872
+ var import_react19 = __toESM(require("react"));
11642
11873
 
11643
11874
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
11644
- var import_core_react7 = require("@procore/core-react");
11875
+ var import_core_react8 = require("@procore/core-react");
11645
11876
  var useDefaultViewName = (domain, defaultViewName) => {
11646
- const i18n = (0, import_core_react7.useI18nContext)();
11877
+ const i18n = (0, import_core_react8.useI18nContext)();
11647
11878
  return defaultViewName || i18n.t(domain, {
11648
11879
  scope: "savedViews.defaultViewTitle",
11649
11880
  defaultValue: "Default View"
@@ -11698,21 +11929,21 @@ var useSmartGridConfig = (gridApi) => {
11698
11929
  };
11699
11930
 
11700
11931
  // src/SavedViews/components/SavedViews/SavedViews.tsx
11701
- var import_core_react12 = require("@procore/core-react");
11702
- var import_react13 = __toESM(require("react"));
11932
+ var import_core_react13 = require("@procore/core-react");
11933
+ var import_react18 = __toESM(require("react"));
11703
11934
  var import_react_query3 = require("@tanstack/react-query");
11704
11935
 
11705
11936
  // src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
11706
- var import_core_react8 = require("@procore/core-react");
11937
+ var import_core_react9 = require("@procore/core-react");
11707
11938
  var import_react11 = __toESM(require("react"));
11708
11939
  var SavedViewsDeleteConfirmationModalShared = ({
11709
11940
  onCancel,
11710
11941
  onDelete,
11711
11942
  open
11712
11943
  }) => {
11713
- const i18n = (0, import_core_react8.useI18nContext)();
11944
+ const i18n = (0, import_core_react9.useI18nContext)();
11714
11945
  return /* @__PURE__ */ import_react11.default.createElement(
11715
- import_core_react8.ConfirmModal,
11946
+ import_core_react9.ConfirmModal,
11716
11947
  {
11717
11948
  "data-testid": "delete-confirmation-modal",
11718
11949
  open,
@@ -11721,8 +11952,8 @@ var SavedViewsDeleteConfirmationModalShared = ({
11721
11952
  onClose: onCancel,
11722
11953
  style: { overflowWrap: "anywhere" }
11723
11954
  },
11724
- /* @__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"))),
11725
- /* @__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"))))
11955
+ /* @__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"))),
11956
+ /* @__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"))))
11726
11957
  );
11727
11958
  };
11728
11959
 
@@ -11730,8 +11961,8 @@ var SavedViewsDeleteConfirmationModalShared = ({
11730
11961
  var import_react12 = __toESM(require("react"));
11731
11962
 
11732
11963
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
11733
- var import_core_react9 = require("@procore/core-react");
11734
- var React17 = __toESM(require("react"));
11964
+ var import_core_react10 = require("@procore/core-react");
11965
+ var React18 = __toESM(require("react"));
11735
11966
 
11736
11967
  // ../../node_modules/yup/index.esm.js
11737
11968
  var import_property_expr = __toESM(require_property_expr());
@@ -14059,7 +14290,6 @@ function extractMessage(error, I18n) {
14059
14290
  }
14060
14291
 
14061
14292
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
14062
- var { useEffect: useEffect3, useRef: useRef2 } = React17;
14063
14293
  var ScrollContainer = styled_components_esm_default("div")`
14064
14294
  overflow: auto;
14065
14295
  `;
@@ -14077,38 +14307,22 @@ var SavedViewsCreateUpdateModalBase = ({
14077
14307
  selectedSavedView,
14078
14308
  setSelectedSavedView,
14079
14309
  setOpenEditCreateModal,
14080
- onSelect,
14081
- backend
14310
+ onSelect
14082
14311
  }) => {
14083
- const I18n = (0, import_core_react9.useI18nContext)();
14312
+ const I18n = (0, import_core_react10.useI18nContext)();
14084
14313
  const NAME_MAX_LENGTH = 150;
14085
- const originalBodyWidth = useRef2("");
14086
- useEffect3(() => {
14087
- if (open) {
14088
- originalBodyWidth.current = document.body.style.width || "";
14089
- document.body.style.width = "100%";
14090
- } else {
14091
- document.body.style.width = originalBodyWidth.current;
14092
- }
14093
- return () => {
14094
- if (originalBodyWidth.current !== void 0) {
14095
- document.body.style.width = originalBodyWidth.current;
14096
- }
14097
- };
14098
- }, [open]);
14099
- const { useCreateSavedView: useCreateSavedView2, useUpdateSavedView: useUpdateSavedView2, useSavedViewsPermissions: useSavedViewsPermissions2 } = backend;
14100
14314
  const {
14101
14315
  mutate: createSavedView,
14102
14316
  isPending: isCreating,
14103
14317
  error: createError,
14104
14318
  reset: resetCreateMutation
14105
- } = useCreateSavedView2(queryInput);
14319
+ } = useCreateSavedView(queryInput);
14106
14320
  const {
14107
14321
  mutate: updateSavedView,
14108
14322
  isPending: isUpdating,
14109
14323
  error: updateError,
14110
14324
  reset: resetUpdateMutation
14111
- } = useUpdateSavedView2(queryInput);
14325
+ } = useUpdateSavedView(queryInput);
14112
14326
  const resetMutations = () => {
14113
14327
  resetCreateMutation();
14114
14328
  resetUpdateMutation();
@@ -14117,7 +14331,7 @@ var SavedViewsCreateUpdateModalBase = ({
14117
14331
  resetMutations();
14118
14332
  onCancel();
14119
14333
  };
14120
- const { data: permissions } = useSavedViewsPermissions2(queryInput);
14334
+ const { data: permissions } = useSavedViewsPermissions(queryInput);
14121
14335
  const isLoading = isCreating || isUpdating;
14122
14336
  const errors = extractMessage(createError || updateError, I18n);
14123
14337
  const handleOnSubmit = (data) => {
@@ -14149,8 +14363,8 @@ var SavedViewsCreateUpdateModalBase = ({
14149
14363
  }
14150
14364
  };
14151
14365
  const viewLevelOptions = getViewLevelOptions(permissions, I18n);
14152
- return /* @__PURE__ */ React17.createElement(
14153
- import_core_react9.Modal,
14366
+ return /* @__PURE__ */ React18.createElement(
14367
+ import_core_react10.Modal,
14154
14368
  {
14155
14369
  "aria-label": I18n.t("savedViews.ariaLabels.modal"),
14156
14370
  onClickOverlay: onClose,
@@ -14158,15 +14372,15 @@ var SavedViewsCreateUpdateModalBase = ({
14158
14372
  style: { width: "540px" },
14159
14373
  "data-testid": "create-update-modal"
14160
14374
  },
14161
- /* @__PURE__ */ React17.createElement(ScrollContainer, null, /* @__PURE__ */ React17.createElement(
14162
- import_core_react9.Modal.Header,
14375
+ /* @__PURE__ */ React18.createElement(ScrollContainer, null, /* @__PURE__ */ React18.createElement(
14376
+ import_core_react10.Modal.Header,
14163
14377
  {
14164
14378
  onClose,
14165
- style: { borderBottom: `1px solid ${import_core_react9.colors.gray85}` }
14379
+ style: { borderBottom: `1px solid ${import_core_react10.colors.gray85}` }
14166
14380
  },
14167
- /* @__PURE__ */ React17.createElement(import_core_react9.H2, null, header)
14168
- ), /* @__PURE__ */ React17.createElement(
14169
- import_core_react9.Form,
14381
+ /* @__PURE__ */ React18.createElement(import_core_react10.H2, null, header)
14382
+ ), /* @__PURE__ */ React18.createElement(
14383
+ import_core_react10.Form,
14170
14384
  {
14171
14385
  initialValues: {
14172
14386
  name: initialName,
@@ -14191,14 +14405,14 @@ var SavedViewsCreateUpdateModalBase = ({
14191
14405
  onReset: onCancel,
14192
14406
  validateOnChange: true
14193
14407
  },
14194
- /* @__PURE__ */ React17.createElement(import_core_react9.Form.Form, { name: header }, /* @__PURE__ */ React17.createElement(
14195
- import_core_react9.Modal.Body,
14408
+ /* @__PURE__ */ React18.createElement(import_core_react10.Form.Form, { name: header }, /* @__PURE__ */ React18.createElement(
14409
+ import_core_react10.Modal.Body,
14196
14410
  {
14197
- style: { paddingTop: 0, paddingBottom: 0, marginTop: import_core_react9.spacing.lg }
14411
+ style: { paddingTop: 0, paddingBottom: 0, marginTop: import_core_react10.spacing.lg }
14198
14412
  },
14199
- 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 == null ? void 0 : errors.form) || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14200
- /* @__PURE__ */ React17.createElement(import_core_react9.Form.Row, null, /* @__PURE__ */ React17.createElement(
14201
- import_core_react9.Form.Text,
14413
+ 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 == null ? void 0 : errors.form) || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14414
+ /* @__PURE__ */ React18.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React18.createElement(
14415
+ import_core_react10.Form.Text,
14202
14416
  {
14203
14417
  name: "name",
14204
14418
  error: errors == null ? void 0 : errors.name,
@@ -14208,13 +14422,13 @@ var SavedViewsCreateUpdateModalBase = ({
14208
14422
  onChange: () => resetMutations()
14209
14423
  }
14210
14424
  )),
14211
- /* @__PURE__ */ React17.createElement(
14212
- import_core_react9.Form.Row,
14425
+ /* @__PURE__ */ React18.createElement(
14426
+ import_core_react10.Form.Row,
14213
14427
  {
14214
- style: { marginTop: (errors == null ? void 0 : errors.name) ? import_core_react9.spacing.xl : import_core_react9.spacing.none }
14428
+ style: { marginTop: (errors == null ? void 0 : errors.name) ? import_core_react10.spacing.xl : import_core_react10.spacing.none }
14215
14429
  },
14216
- /* @__PURE__ */ React17.createElement(
14217
- import_core_react9.Form.TextArea,
14430
+ /* @__PURE__ */ React18.createElement(
14431
+ import_core_react10.Form.TextArea,
14218
14432
  {
14219
14433
  name: "description",
14220
14434
  placeholder: I18n.t("savedViews.modal.fields.description"),
@@ -14224,20 +14438,19 @@ var SavedViewsCreateUpdateModalBase = ({
14224
14438
  }
14225
14439
  )
14226
14440
  ),
14227
- viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React17.createElement(import_core_react9.Form.Row, null, /* @__PURE__ */ React17.createElement(
14228
- import_core_react9.Form.Select,
14441
+ viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React18.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React18.createElement(
14442
+ import_core_react10.Form.Select,
14229
14443
  {
14230
14444
  name: "view_level",
14231
- qa: { label: "view-level" },
14232
14445
  options: viewLevelOptions,
14233
14446
  label: I18n.t("savedViews.modal.fields.viewLevel"),
14234
14447
  colWidth: 12,
14235
14448
  onSearch: false,
14236
14449
  onClear: false
14237
14450
  }
14238
- )) : /* @__PURE__ */ React17.createElement(React17.Fragment, null)
14239
- ), /* @__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(
14240
- import_core_react9.Button,
14451
+ )) : /* @__PURE__ */ React18.createElement(React18.Fragment, null)
14452
+ ), /* @__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(
14453
+ import_core_react10.Button,
14241
14454
  {
14242
14455
  "data-testid": "create-update-modal-button",
14243
14456
  type: "submit",
@@ -14252,7 +14465,7 @@ var SavedViewsCreateUpdateModalBase = ({
14252
14465
  };
14253
14466
 
14254
14467
  // src/SavedViews/components/SavedViewsModals/SavedViewsFormModal.tsx
14255
- var import_core_react10 = require("@procore/core-react");
14468
+ var import_core_react11 = require("@procore/core-react");
14256
14469
  var SavedViewsFormModal = ({
14257
14470
  open,
14258
14471
  mode,
@@ -14264,10 +14477,9 @@ var SavedViewsFormModal = ({
14264
14477
  setSelectedSavedView,
14265
14478
  setOpenEditCreateModal,
14266
14479
  onSelect,
14267
- defaultView,
14268
- backend
14480
+ defaultView
14269
14481
  }) => {
14270
- const i18n = (0, import_core_react10.useI18nContext)();
14482
+ const i18n = (0, import_core_react11.useI18nContext)();
14271
14483
  return /* @__PURE__ */ import_react12.default.createElement(
14272
14484
  SavedViewsCreateUpdateModalBase,
14273
14485
  {
@@ -14284,169 +14496,276 @@ var SavedViewsFormModal = ({
14284
14496
  setSelectedSavedView,
14285
14497
  setOpenEditCreateModal,
14286
14498
  onSelect,
14287
- defaultView,
14288
- backend
14499
+ defaultView
14289
14500
  }
14290
14501
  );
14291
14502
  };
14292
14503
 
14293
- // ../../node_modules/@procore/core-http/dist/modern/index.js
14294
- function getCSRFToken() {
14295
- const token = document.cookie.match("(^|;)\\s*csrf_token\\s*=\\s*([^;]+)");
14296
- return token ? decodeURIComponent(token.pop() || "") : "";
14297
- }
14298
- function getCSRFHeader() {
14299
- const csrfToken = getCSRFToken();
14300
- return csrfToken ? { "X-CSRF-TOKEN": csrfToken } : {};
14301
- }
14302
- function removeLeadingSlash(url) {
14303
- return url.startsWith("/") ? url.substring(1, url.length) : url;
14304
- }
14305
- function removeTrailingSlash(url) {
14306
- return url.endsWith("/") ? url.substring(0, url.length - 1) : url;
14307
- }
14308
- function applyBaseUrl(url, baseUrl) {
14309
- return `${removeTrailingSlash(baseUrl)}/${removeLeadingSlash(url)}`;
14310
- }
14311
- function getOptions({ headers, ...options }) {
14312
- const opts = {
14313
- credentials: "same-origin",
14314
- headers: {
14315
- ...getCSRFHeader(),
14316
- ...headers
14317
- },
14318
- mode: "same-origin",
14319
- ...options
14504
+ // src/SavedViews/components/SavedViewsModals/CopyViewConfirmationModal.tsx
14505
+ var import_core_react12 = require("@procore/core-react");
14506
+ var import_react13 = __toESM(require("react"));
14507
+ var CreateViewConfirmationModal = ({ open, savedViewName, onClose, onViewTemporarily, onCreateView }) => {
14508
+ const i18n = (0, import_core_react12.useI18nContext)();
14509
+ const handleViewTemporarily = () => {
14510
+ onViewTemporarily == null ? void 0 : onViewTemporarily();
14320
14511
  };
14321
- return opts;
14322
- }
14323
- function getUrl(url, baseUrl) {
14324
- return baseUrl ? applyBaseUrl(url, baseUrl) : url;
14325
- }
14326
- function request(url, { baseUrl, ...options } = {}) {
14327
- return fetch(getUrl(url, baseUrl), getOptions(options));
14328
- }
14329
- function requestJSON(url, requestParams = {}) {
14330
- return request(url, requestParams).then(
14331
- (response) => response.json()
14512
+ const handleCreateView = () => {
14513
+ onCreateView == null ? void 0 : onCreateView();
14514
+ };
14515
+ return /* @__PURE__ */ import_react13.default.createElement(
14516
+ import_core_react12.Modal,
14517
+ {
14518
+ "data-testid": "create-view-confirmation-modal",
14519
+ open,
14520
+ onClickOverlay: onClose
14521
+ },
14522
+ /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Modal.Header, { onClose }, i18n.t("savedViews.modal.copyConfirmation.headline", {
14523
+ savedViewName
14524
+ })),
14525
+ /* @__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"))),
14526
+ /* @__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(
14527
+ import_core_react12.Button,
14528
+ {
14529
+ variant: "secondary",
14530
+ onClick: handleViewTemporarily,
14531
+ "data-testid": "view-temporarily-button"
14532
+ },
14533
+ i18n.t("savedViews.actions.viewTemporarily")
14534
+ ), /* @__PURE__ */ import_react13.default.createElement(
14535
+ import_core_react12.Button,
14536
+ {
14537
+ variant: "primary",
14538
+ onClick: handleCreateView,
14539
+ "data-testid": "create-view-button"
14540
+ },
14541
+ i18n.t("savedViews.actions.createView")
14542
+ )))
14332
14543
  );
14333
- }
14544
+ };
14334
14545
 
14335
- // src/utils/Api/queries.ts
14336
- var import_react_query2 = require("@tanstack/react-query");
14546
+ // src/utils/Hooks/useViewSelection.ts
14547
+ var import_react15 = require("react");
14337
14548
 
14338
- // src/utils/Api/queriesHandler.ts
14339
- var import_react_query = require("@tanstack/react-query");
14340
- var import_core_react11 = require("@procore/core-react");
14341
- var useApiRequest = (props, method, mutationKey) => {
14342
- const { projectId, companyId, domain, tableName } = props;
14343
- const queryClient2 = (0, import_react_query.useQueryClient)();
14344
- const { locale: locale2 } = (0, import_core_react11.useI18nContext)();
14345
- return (0, import_react_query.useMutation)({
14346
- mutationKey,
14347
- mutationFn: async (savedView) => {
14348
- let url = "";
14349
- if (method === "DELETE" || method === "PUT") {
14350
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/${savedView.id}?permissions_domain=${domain}`;
14351
- } else {
14352
- url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14549
+ // src/utils/Hooks/useUrlSync.ts
14550
+ var import_react14 = require("react");
14551
+ var import_react_router_dom = require("react-router-dom");
14552
+ var useUrlSync = (selectedView, availableViews, defaultView, onViewFound, onViewNotFound) => {
14553
+ const [searchParams, setSearchParams] = (0, import_react_router_dom.useSearchParams)();
14554
+ const applySavedViewFromUrl = (savedViewId) => {
14555
+ if (savedViewId === "default") {
14556
+ if (defaultView.id !== (selectedView == null ? void 0 : selectedView.id)) {
14557
+ onViewFound(defaultView);
14353
14558
  }
14354
- const response = await requestJSON(url, {
14355
- method,
14356
- body: JSON.stringify(savedView),
14357
- headers: {
14358
- "Content-Type": "application/json",
14359
- "Accept-Language": locale2
14360
- }
14361
- });
14362
- if (response.error) {
14363
- throw response.error;
14364
- }
14365
- return response.data;
14366
- },
14367
- onSuccess: (savedView) => {
14368
- if (method === "DELETE" || method === "POST") {
14369
- queryClient2.invalidateQueries({
14370
- queryKey: ["savedViews", domain, tableName]
14371
- });
14372
- return;
14373
- } else {
14374
- const oldData = queryClient2.getQueryData([
14375
- "savedViews",
14376
- domain,
14377
- tableName
14378
- ]);
14379
- const oldView = oldData == null ? void 0 : oldData.find((item) => item.id === savedView.id);
14380
- if ((oldView == null ? void 0 : oldView.name) !== savedView.name) {
14381
- queryClient2.invalidateQueries({
14382
- queryKey: ["savedViews", domain, tableName]
14383
- });
14384
- return;
14385
- }
14559
+ return;
14560
+ }
14561
+ const viewInUserViews = availableViews.find((v2) => v2.id === savedViewId);
14562
+ if (viewInUserViews) {
14563
+ if (viewInUserViews.id !== (selectedView == null ? void 0 : selectedView.id)) {
14564
+ onViewFound(viewInUserViews);
14386
14565
  }
14387
- queryClient2.setQueryData(
14388
- ["savedViews", domain, tableName],
14389
- (oldData) => {
14390
- if (!oldData)
14391
- return [savedView];
14392
- return oldData.map(
14393
- (item) => item.id === savedView.id ? savedView : item
14394
- );
14566
+ } else {
14567
+ onViewNotFound(savedViewId);
14568
+ }
14569
+ };
14570
+ const applyListView = (viewParam) => {
14571
+ if (viewParam === "list" && defaultView.id !== (selectedView == null ? void 0 : selectedView.id)) {
14572
+ onViewFound(defaultView);
14573
+ }
14574
+ };
14575
+ (0, import_react14.useEffect)(() => {
14576
+ if (!availableViews.length)
14577
+ return;
14578
+ const savedViewId = searchParams.get("saved-view");
14579
+ const viewParamFromConsumer = searchParams.get("view");
14580
+ if (savedViewId) {
14581
+ applySavedViewFromUrl(savedViewId);
14582
+ return;
14583
+ }
14584
+ if (viewParamFromConsumer) {
14585
+ applyListView(viewParamFromConsumer);
14586
+ }
14587
+ }, [
14588
+ searchParams,
14589
+ availableViews,
14590
+ defaultView,
14591
+ selectedView,
14592
+ onViewFound,
14593
+ onViewNotFound
14594
+ ]);
14595
+ const updateUrl = (view) => {
14596
+ setSearchParams(
14597
+ (currentParams) => {
14598
+ const updatedParams = new URLSearchParams(currentParams);
14599
+ if (view.id === "default") {
14600
+ updatedParams.delete("saved-view");
14601
+ } else {
14602
+ updatedParams.set("saved-view", view.id);
14395
14603
  }
14604
+ return updatedParams;
14605
+ },
14606
+ { replace: true }
14607
+ );
14608
+ };
14609
+ return { updateUrl };
14610
+ };
14611
+
14612
+ // src/utils/Hooks/useViewSelection.ts
14613
+ var useViewSelection = (config, savedViews, openCrossUserModal) => {
14614
+ const [selectedSavedView, setSelectedSavedView] = (0, import_react15.useState)(() => {
14615
+ try {
14616
+ const savedView = JSON.parse(
14617
+ localStorage.getItem(
14618
+ `${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`
14619
+ )
14396
14620
  );
14621
+ return savedView || config.defaultView;
14622
+ } catch (e2) {
14623
+ return config.defaultView;
14397
14624
  }
14398
14625
  });
14626
+ const [temporaryView, setTemporaryView] = (0, import_react15.useState)(null);
14627
+ const createTemporaryView = (0, import_react15.useCallback)((fetchedView) => {
14628
+ const tempView = {
14629
+ ...fetchedView,
14630
+ id: "temporary",
14631
+ name: "Temporary View"
14632
+ };
14633
+ setTemporaryView(tempView);
14634
+ return tempView;
14635
+ }, []);
14636
+ const clearTemporaryView = (0, import_react15.useCallback)(() => setTemporaryView(null), []);
14637
+ const updateLocalStorage = (0, import_react15.useCallback)(
14638
+ (view) => {
14639
+ if (config.stickyViewsKey) {
14640
+ localStorage.setItem(
14641
+ `${config.domain}_${config.tableName}_${config.stickyViewsKey}_${config.projectId}_${config.userId}`,
14642
+ JSON.stringify(view)
14643
+ );
14644
+ }
14645
+ },
14646
+ [
14647
+ config.domain,
14648
+ config.tableName,
14649
+ config.stickyViewsKey,
14650
+ config.projectId,
14651
+ config.userId
14652
+ ]
14653
+ );
14654
+ const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
14655
+ const onUrlViewFound = (foundView) => {
14656
+ selectView(foundView);
14657
+ };
14658
+ const onUrlViewNotFound = (viewId) => {
14659
+ if (viewId === (selectedSavedView == null ? void 0 : selectedSavedView.id)) {
14660
+ return;
14661
+ }
14662
+ openCrossUserModal(viewId);
14663
+ };
14664
+ const { updateUrl } = useUrlSync(
14665
+ selectedSavedView,
14666
+ allViews,
14667
+ config.defaultView,
14668
+ onUrlViewFound,
14669
+ onUrlViewNotFound
14670
+ );
14671
+ const selectView = (0, import_react15.useCallback)(
14672
+ (view) => {
14673
+ if (view.id !== "temporary" && temporaryView) {
14674
+ clearTemporaryView();
14675
+ }
14676
+ const viewToSelect = config.onSelect({ item: view });
14677
+ setSelectedSavedView(viewToSelect);
14678
+ updateLocalStorage(viewToSelect);
14679
+ updateUrl(viewToSelect);
14680
+ return viewToSelect;
14681
+ },
14682
+ [config, temporaryView, clearTemporaryView, updateLocalStorage, updateUrl]
14683
+ );
14684
+ return {
14685
+ selectedView: selectedSavedView,
14686
+ selectView,
14687
+ updateLocalStorage,
14688
+ temporaryView,
14689
+ createTemporaryView
14690
+ };
14399
14691
  };
14400
14692
 
14401
- // src/utils/Api/queries.ts
14402
- var PAGE_SIZE = 50 * VIEW_LEVELS.length;
14403
- var useSavedViewsQuery = (props) => {
14404
- const { projectId, companyId, domain, tableName } = props;
14405
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views?table_name=${tableName}&permissions_domain=${domain}`;
14406
- return (0, import_react_query2.useQuery)({
14407
- enabled: props.enableSavedViews,
14408
- queryKey: ["savedViews", domain, tableName],
14409
- queryFn: async () => {
14410
- const getUrl2 = `${url}&per_page=${PAGE_SIZE}`;
14411
- const response = await requestJSON(getUrl2);
14412
- return response.data;
14693
+ // src/utils/Hooks/useCrossUserSharing.ts
14694
+ var import_react16 = __toESM(require("react"));
14695
+ var useCrossUserSharing = (queryInput, viewId, selectedSavedView, defaultView, actions, tableName) => {
14696
+ const { data: fetchedView, isError: fetchError } = useFetchSavedViewById(
14697
+ viewId,
14698
+ queryInput,
14699
+ Boolean(viewId)
14700
+ );
14701
+ const { mutate: createSavedView } = useCreateSavedView(queryInput);
14702
+ import_react16.default.useEffect(() => {
14703
+ if (fetchError && viewId) {
14704
+ actions.selectView(selectedSavedView ?? defaultView);
14705
+ actions.closeModal();
14706
+ }
14707
+ }, [fetchError, viewId, actions, selectedSavedView, defaultView]);
14708
+ const viewSharedViewTemporarily = () => {
14709
+ if (fetchedView) {
14710
+ const tempView = actions.createTemporaryView(fetchedView);
14711
+ actions.selectView(tempView);
14712
+ actions.closeModal();
14413
14713
  }
14414
- });
14415
- };
14416
- var useSavedViewsPermissions = (props) => {
14417
- const { projectId, companyId, domain } = props;
14418
- const url = `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views/permissions?permissions_domain=${domain}`;
14419
- return (0, import_react_query2.useQuery)({
14420
- enabled: props.enableSavedViews,
14421
- queryKey: ["savedViewsConfig", domain],
14422
- queryFn: async () => {
14423
- const response = await requestJSON(url);
14424
- return response.data;
14714
+ };
14715
+ const createPersonalCopyOfSharedView = () => {
14716
+ if (fetchedView) {
14717
+ const viewToCreate = {
14718
+ name: fetchedView.name,
14719
+ description: fetchedView.description,
14720
+ table_name: tableName,
14721
+ table_config: fetchedView.table_config,
14722
+ view_level: "personal"
14723
+ };
14724
+ createSavedView(viewToCreate, {
14725
+ onSuccess: (newView) => {
14726
+ actions.selectView(newView);
14727
+ actions.closeModal();
14728
+ }
14729
+ });
14425
14730
  }
14426
- });
14731
+ };
14732
+ return {
14733
+ fetchedView,
14734
+ viewSharedViewTemporarily,
14735
+ createPersonalCopyOfSharedView
14736
+ };
14737
+ };
14738
+
14739
+ // src/utils/Hooks/useModalState.ts
14740
+ var import_react17 = require("react");
14741
+ var useModalState = () => {
14742
+ const [activeModal, setActiveModal] = (0, import_react17.useState)(null);
14743
+ const [modalData, setModalData] = (0, import_react17.useState)(null);
14744
+ const openModal = (0, import_react17.useCallback)(
14745
+ (type, data) => {
14746
+ setActiveModal(type);
14747
+ setModalData(data ?? null);
14748
+ },
14749
+ []
14750
+ );
14751
+ const closeModal = (0, import_react17.useCallback)(() => {
14752
+ setActiveModal(null);
14753
+ setModalData(null);
14754
+ }, []);
14755
+ const isModalOpen = (0, import_react17.useCallback)(
14756
+ (type) => {
14757
+ return activeModal === type;
14758
+ },
14759
+ [activeModal]
14760
+ );
14761
+ return {
14762
+ openModal,
14763
+ closeModal,
14764
+ isModalOpen,
14765
+ modalData,
14766
+ activeModal
14767
+ };
14427
14768
  };
14428
- var useCreateSavedView = (props) => useApiRequest(props, "POST", [
14429
- "createSavedView",
14430
- props.domain,
14431
- props.tableName
14432
- ]);
14433
- var useUpdateSavedView = (props) => useApiRequest(props, "PUT", [
14434
- "updateSavedView",
14435
- props.domain,
14436
- props.tableName
14437
- ]);
14438
- var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
14439
- "deleteSavedView",
14440
- props.domain,
14441
- props.tableName
14442
- ]);
14443
- var createQueries = (customBackend) => ({
14444
- useSavedViewsQuery: (customBackend == null ? void 0 : customBackend.useSavedViewsQuery) ?? useSavedViewsQuery,
14445
- useSavedViewsPermissions: (customBackend == null ? void 0 : customBackend.useSavedViewsPermissions) ?? useSavedViewsPermissions,
14446
- useCreateSavedView: (customBackend == null ? void 0 : customBackend.useCreateSavedView) ?? useCreateSavedView,
14447
- useUpdateSavedView: (customBackend == null ? void 0 : customBackend.useUpdateSavedView) ?? useUpdateSavedView,
14448
- useDeleteSavedView: (customBackend == null ? void 0 : customBackend.useDeleteSavedView) ?? useDeleteSavedView
14449
- });
14450
14769
 
14451
14770
  // src/SavedViews/components/SavedViews/SavedViews.tsx
14452
14771
  var StyledPanel = styled_components_esm_default.div`
@@ -14462,75 +14781,80 @@ var SavedViewsContent = (props) => {
14462
14781
  projectId,
14463
14782
  companyId
14464
14783
  };
14465
- const backend = createQueries(props.backend);
14466
- const { mutate: deleteSavedView } = backend.useDeleteSavedView(queryInput);
14467
- const [selectedSavedView, setSelectedSavedView] = (0, import_react13.useState)(() => {
14468
- try {
14469
- const savedView = JSON.parse(
14470
- localStorage.getItem(
14471
- `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
14472
- )
14473
- );
14474
- return savedView || props.defaultView;
14475
- } catch (e2) {
14476
- return props.defaultView;
14477
- }
14478
- });
14479
- const updateLocalStorage = (view) => {
14480
- if (props.stickyViewsKey) {
14481
- localStorage.setItem(
14482
- `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
14483
- JSON.stringify(view)
14484
- );
14485
- }
14486
- };
14487
- const handleViewItemSelect = ({ item }) => {
14488
- const viewToSetAsSelected = props.onSelect({ item });
14489
- setSelectedSavedView(viewToSetAsSelected);
14490
- updateLocalStorage(viewToSetAsSelected);
14784
+ const { data: savedViews } = useSavedViewsQuery(queryInput);
14785
+ const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
14786
+ const { openModal, closeModal, isModalOpen, modalData, activeModal } = useModalState();
14787
+ const openCrossUserModal = (viewId) => {
14788
+ openModal("crossUser" /* CROSS_USER */, { viewId });
14491
14789
  };
14492
- const onDelete = () => {
14493
- if (selectedSavedView) {
14494
- deleteSavedView(selectedSavedView, {
14495
- onSuccess: () => handleViewItemSelect({ item: props.defaultView })
14790
+ const {
14791
+ selectedView,
14792
+ selectView,
14793
+ updateLocalStorage,
14794
+ temporaryView,
14795
+ createTemporaryView
14796
+ } = useViewSelection(
14797
+ {
14798
+ domain: props.domain,
14799
+ tableName: props.tableName,
14800
+ stickyViewsKey: props.stickyViewsKey,
14801
+ userId: props.userId,
14802
+ projectId,
14803
+ defaultView: props.defaultView,
14804
+ onSelect: props.onSelect
14805
+ },
14806
+ savedViews,
14807
+ openCrossUserModal
14808
+ );
14809
+ const {
14810
+ fetchedView,
14811
+ viewSharedViewTemporarily,
14812
+ createPersonalCopyOfSharedView
14813
+ } = useCrossUserSharing(
14814
+ queryInput,
14815
+ (modalData == null ? void 0 : modalData.viewId) ?? null,
14816
+ selectedView,
14817
+ props.defaultView,
14818
+ {
14819
+ selectView,
14820
+ createTemporaryView,
14821
+ closeModal
14822
+ },
14823
+ props.tableName
14824
+ );
14825
+ const deleteSelectedView = () => {
14826
+ if (selectedView) {
14827
+ deleteSavedView(selectedView, {
14828
+ onSuccess: () => selectView(props.defaultView)
14496
14829
  });
14497
14830
  }
14498
14831
  };
14499
- const i18n = (0, import_core_react12.useI18nContext)();
14500
- const [openDeleteModal, setOpenDeleteModal] = (0, import_react13.useState)(false);
14501
- const [openEditCreateModal, setOpenEditCreateModal] = (0, import_react13.useState)(false);
14502
- const [editCreateModalType, setEditCreateModalType] = (0, import_react13.useState)(
14503
- "create" /* CREATE */
14504
- );
14505
- const onCloseDeleteModal = () => {
14506
- setOpenDeleteModal(false);
14507
- };
14508
- const onCloseEditModal = () => {
14509
- setOpenEditCreateModal(false);
14510
- };
14511
- const openModal = (type) => {
14512
- setEditCreateModalType(type);
14513
- setOpenEditCreateModal(true);
14832
+ const confirmDeleteAndCloseModal = () => {
14833
+ deleteSelectedView();
14834
+ closeModal();
14514
14835
  };
14515
- const onOpenDeleteModal = () => {
14516
- setOpenDeleteModal(true);
14836
+ const i18n = (0, import_core_react13.useI18nContext)();
14837
+ const selectSavedViewFromList = ({ item }) => selectView(item);
14838
+ const setSelectedSavedView = (view) => {
14839
+ selectView(view);
14517
14840
  };
14518
- return /* @__PURE__ */ import_react13.default.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ import_react13.default.createElement(
14841
+ const allViews = temporaryView ? [...savedViews ?? [], temporaryView] : savedViews ?? [];
14842
+ return /* @__PURE__ */ import_react18.default.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ import_react18.default.createElement(
14519
14843
  ExpandedPanel,
14520
14844
  {
14521
14845
  "data-testid": "saved-view-expanded-panel",
14522
14846
  provider: props.provider
14523
14847
  },
14524
- /* @__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(
14525
- import_core_react12.Tooltip,
14848
+ /* @__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(
14849
+ import_core_react13.Tooltip,
14526
14850
  {
14527
14851
  overlay: i18n.t("savedViews.actions.create"),
14528
14852
  showDelay: 1e3
14529
14853
  },
14530
- /* @__PURE__ */ import_react13.default.createElement("span", null, /* @__PURE__ */ import_react13.default.createElement(
14531
- import_core_react12.Button,
14854
+ /* @__PURE__ */ import_react18.default.createElement("span", null, /* @__PURE__ */ import_react18.default.createElement(
14855
+ import_core_react13.Button,
14532
14856
  {
14533
- icon: /* @__PURE__ */ import_react13.default.createElement(Plus_default, null),
14857
+ icon: /* @__PURE__ */ import_react18.default.createElement(Plus_default, null),
14534
14858
  variant: "secondary",
14535
14859
  "data-testid": "expanded-panel-create-button",
14536
14860
  onClick: () => openModal("create" /* CREATE */),
@@ -14539,58 +14863,63 @@ var SavedViewsContent = (props) => {
14539
14863
  i18n.t("savedViews.actions.create")
14540
14864
  ))
14541
14865
  )),
14542
- /* @__PURE__ */ import_react13.default.createElement(import_core_react12.Panel.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ import_react13.default.createElement(
14866
+ /* @__PURE__ */ import_react18.default.createElement(import_core_react13.Panel.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ import_react18.default.createElement(
14543
14867
  PanelContent,
14544
14868
  {
14545
- onSelect: handleViewItemSelect,
14869
+ onSelect: selectSavedViewFromList,
14546
14870
  openModal,
14547
- onDelete: onOpenDeleteModal,
14871
+ onDelete: () => openModal("delete" /* DELETE */),
14548
14872
  updateLocalStorage,
14549
14873
  setSelectedSavedView,
14550
14874
  queryInput,
14551
- selectedSavedView,
14875
+ selectedSavedView: selectedView,
14552
14876
  tableConfig: props.tableConfig,
14553
14877
  defaultView: props.defaultView,
14554
14878
  stickyViewsKey: props.stickyViewsKey,
14879
+ savedViews: allViews,
14555
14880
  provider: props.provider,
14556
- userId: props.userId,
14557
- backend
14881
+ userId: props.userId
14558
14882
  }
14559
14883
  ))
14560
- ), /* @__PURE__ */ import_react13.default.createElement(
14884
+ ), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ import_react18.default.createElement(
14561
14885
  SavedViewsFormModal,
14562
14886
  {
14563
- open: openEditCreateModal,
14564
- mode: editCreateModalType,
14565
- onCancel: onCloseEditModal,
14887
+ open: true,
14888
+ mode: activeModal,
14889
+ onCancel: closeModal,
14566
14890
  queryInput,
14567
14891
  tableConfig: props.tableConfig,
14568
14892
  tableName: props.tableName,
14569
- selectedSavedView,
14893
+ selectedSavedView: selectedView,
14570
14894
  setSelectedSavedView,
14571
- onSelect: (view) => handleViewItemSelect({ item: view }),
14572
- setOpenEditCreateModal,
14573
- defaultView: props.defaultView,
14574
- backend
14895
+ onSelect: selectView,
14896
+ setOpenEditCreateModal: closeModal,
14897
+ defaultView: props.defaultView
14575
14898
  }
14576
- ), selectedSavedView && /* @__PURE__ */ import_react13.default.createElement(
14899
+ ), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ import_react18.default.createElement(
14577
14900
  SavedViewsDeleteConfirmationModalShared,
14578
14901
  {
14579
- open: openDeleteModal,
14580
- onDelete: () => {
14581
- onDelete();
14582
- onCloseDeleteModal();
14583
- },
14584
- onCancel: onCloseDeleteModal
14902
+ open: true,
14903
+ onDelete: confirmDeleteAndCloseModal,
14904
+ onCancel: closeModal
14905
+ }
14906
+ ), fetchedView && isModalOpen("crossUser" /* CROSS_USER */) && /* @__PURE__ */ import_react18.default.createElement(
14907
+ CreateViewConfirmationModal,
14908
+ {
14909
+ open: true,
14910
+ savedViewName: fetchedView.name,
14911
+ onClose: closeModal,
14912
+ onViewTemporarily: viewSharedViewTemporarily,
14913
+ onCreateView: createPersonalCopyOfSharedView
14585
14914
  }
14586
14915
  ));
14587
14916
  };
14588
14917
  var SavedViews = (props) => {
14589
- 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 })));
14918
+ 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 })));
14590
14919
  };
14591
14920
 
14592
14921
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
14593
- var import_toast_alert2 = require("@procore/toast-alert");
14922
+ var import_toast_alert3 = require("@procore/toast-alert");
14594
14923
  var SmartGridSavedViews = (props) => {
14595
14924
  const { gridApi, projectId, companyId } = props;
14596
14925
  const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
@@ -14599,7 +14928,6 @@ var SmartGridSavedViews = (props) => {
14599
14928
  domain: props.domain
14600
14929
  });
14601
14930
  const onSelect = ({ item }) => {
14602
- var _a;
14603
14931
  if (!gridApi)
14604
14932
  return item;
14605
14933
  if (item.id === "default") {
@@ -14610,20 +14938,18 @@ var SmartGridSavedViews = (props) => {
14610
14938
  gridApi.refreshCells();
14611
14939
  return item;
14612
14940
  }
14613
- const tableConfig2 = item.table_config;
14614
- const updatedItemConfig = ((_a = props.transformSettings) == null ? void 0 : _a.call(props, tableConfig2)) ?? tableConfig2;
14615
14941
  const updatedView = {
14616
14942
  ...item,
14617
14943
  table_config: customAndConfigSync(
14618
- updatedItemConfig,
14619
- tableConfig2
14944
+ item.table_config,
14945
+ tableConfig
14620
14946
  )
14621
14947
  };
14622
14948
  updateTableConfig(updatedView, gridApi, "smart-grid");
14623
14949
  setTableConfig(updatedView.table_config);
14624
14950
  return updatedView;
14625
14951
  };
14626
- return /* @__PURE__ */ import_react14.default.createElement(import_toast_alert2.ToastAlertProvider, null, /* @__PURE__ */ import_react14.default.createElement(
14952
+ return /* @__PURE__ */ import_react19.default.createElement(import_toast_alert3.ToastAlertProvider, null, /* @__PURE__ */ import_react19.default.createElement(
14627
14953
  SavedViews,
14628
14954
  {
14629
14955
  onSelect,
@@ -14636,18 +14962,17 @@ var SmartGridSavedViews = (props) => {
14636
14962
  tableName: props.tableName,
14637
14963
  tableConfig,
14638
14964
  stickyViewsKey: props.stickyViewsKey,
14639
- enableSavedViews: props.enableSavedViews,
14640
- backend: props.backend
14965
+ enableSavedViews: props.enableSavedViews
14641
14966
  }
14642
14967
  ));
14643
14968
  };
14644
14969
 
14645
14970
  // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14646
- var import_react16 = __toESM(require("react"));
14971
+ var import_react21 = __toESM(require("react"));
14647
14972
 
14648
14973
  // src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
14649
- var import_react15 = require("react");
14650
- var import_core_react13 = require("@procore/core-react");
14974
+ var import_react20 = require("react");
14975
+ var import_core_react14 = require("@procore/core-react");
14651
14976
  var DEFAULT_COLUMN_STATE = {
14652
14977
  hidden: false,
14653
14978
  pinned: null,
@@ -14695,7 +15020,7 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
14695
15020
  return result;
14696
15021
  };
14697
15022
  var useDefaultViewName2 = (domain, defaultViewName) => {
14698
- const i18n = (0, import_core_react13.useI18nContext)();
15023
+ const i18n = (0, import_core_react14.useI18nContext)();
14699
15024
  return defaultViewName || i18n.t(domain, {
14700
15025
  scope: "savedViews.defaultViewTitle",
14701
15026
  defaultValue: "Default View"
@@ -14703,7 +15028,7 @@ var useDefaultViewName2 = (domain, defaultViewName) => {
14703
15028
  };
14704
15029
  var useDefaultView2 = (props) => {
14705
15030
  const name = useDefaultViewName2(props.domain, props.defaultViewName);
14706
- const extractedDefaultConfig = (0, import_react15.useMemo)(
15031
+ const extractedDefaultConfig = (0, import_react20.useMemo)(
14707
15032
  () => extractDefaultView(props.columnDefinitions, props.receivedConfigFromTool),
14708
15033
  [props.columnDefinitions, props.receivedConfigFromTool]
14709
15034
  );
@@ -14716,18 +15041,18 @@ var useDefaultView2 = (props) => {
14716
15041
  };
14717
15042
 
14718
15043
  // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14719
- var import_toast_alert3 = require("@procore/toast-alert");
14720
- var DataTableSavedViews = (0, import_react16.forwardRef)((props, ref) => {
15044
+ var import_toast_alert4 = require("@procore/toast-alert");
15045
+ var DataTableSavedViews = (0, import_react21.forwardRef)((props, ref) => {
14721
15046
  const { tableApi, onTableConfigChange, projectId, companyId } = props;
14722
- const [internalTableConfig, setInternalTableConfig] = (0, import_react16.useState)(
15047
+ const [internalTableConfig, setInternalTableConfig] = (0, import_react21.useState)(
14723
15048
  props.defaultViewConfig
14724
15049
  );
14725
- (0, import_react16.useImperativeHandle)(ref, () => ({
15050
+ (0, import_react21.useImperativeHandle)(ref, () => ({
14726
15051
  setTableConfig: (newConfig) => {
14727
15052
  handleConfigChange(newConfig);
14728
15053
  }
14729
15054
  }));
14730
- const handleConfigChange = (0, import_react16.useCallback)(
15055
+ const handleConfigChange = (0, import_react21.useCallback)(
14731
15056
  (newConfig) => {
14732
15057
  setInternalTableConfig(newConfig);
14733
15058
  onTableConfigChange(newConfig);
@@ -14755,7 +15080,7 @@ var DataTableSavedViews = (0, import_react16.forwardRef)((props, ref) => {
14755
15080
  if (!internalTableConfig) {
14756
15081
  return null;
14757
15082
  }
14758
- return /* @__PURE__ */ import_react16.default.createElement(import_toast_alert3.ToastAlertProvider, null, /* @__PURE__ */ import_react16.default.createElement(
15083
+ return /* @__PURE__ */ import_react21.default.createElement(import_toast_alert4.ToastAlertProvider, null, /* @__PURE__ */ import_react21.default.createElement(
14759
15084
  SavedViews,
14760
15085
  {
14761
15086
  onSelect,