@procore/saved-views 5.0.0 → 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",
@@ -11260,7 +11312,7 @@ var ExpandedPanel = styled_components_esm_default(import_core_react4.Panel)`
11260
11312
 
11261
11313
  // src/SavedViews/components/Panels/PanelContent.tsx
11262
11314
  var import_core_react7 = require("@procore/core-react");
11263
- var import_toast_alert = require("@procore/toast-alert");
11315
+ var import_toast_alert2 = require("@procore/toast-alert");
11264
11316
  var import_react9 = __toESM(require("react"));
11265
11317
 
11266
11318
  // ../../node_modules/@procore/core-http/dist/modern/index.js
@@ -11416,6 +11468,18 @@ var useDeleteSavedView = (props) => useApiRequest(props, "DELETE", [
11416
11468
  props.domain,
11417
11469
  props.tableName
11418
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
+ };
11419
11483
 
11420
11484
  // src/SavedViews/components/Panels/PanelContentUtils.ts
11421
11485
  var import_lodash = __toESM(require_lodash());
@@ -11685,19 +11749,18 @@ var Panel2 = styled_components_esm_default(import_core_react7.DetailPage.Card)`
11685
11749
  box-shadow: none;
11686
11750
  `;
11687
11751
  var PanelContent = (props) => {
11688
- const { showToast } = (0, import_toast_alert.useToastAlertContext)();
11752
+ const { showToast } = (0, import_toast_alert2.useToastAlertContext)();
11689
11753
  const I18n = (0, import_core_react7.useI18nContext)();
11690
11754
  const { mutate: updateSavedView, isPending: isUpdateLoading } = useUpdateSavedView(props.queryInput);
11691
- const { data: savedViews, error: savedViewsError } = useSavedViewsQuery(
11692
- props.queryInput
11693
- );
11755
+ const { data: savedViewsFromQuery, error: savedViewsError } = useSavedViewsQuery(props.queryInput);
11756
+ const savedViews = props.savedViews ?? savedViewsFromQuery;
11694
11757
  const errorToastRef = import_react9.default.useRef(null);
11695
11758
  import_react9.default.useEffect(() => {
11696
11759
  if (savedViewsError && savedViewsError !== errorToastRef.current) {
11697
11760
  showToast.error(I18n.t("savedViews.errors.fetch"));
11698
11761
  errorToastRef.current = savedViewsError;
11699
11762
  }
11700
- }, [savedViewsError]);
11763
+ }, [savedViewsError, showToast, I18n]);
11701
11764
  const { data: permissions } = useSavedViewsPermissions(props.queryInput);
11702
11765
  const selectedRowRef = useScrollToRef(savedViews);
11703
11766
  const onUpdate = (data) => {
@@ -11719,7 +11782,23 @@ var PanelContent = (props) => {
11719
11782
  };
11720
11783
  const { groups, toggleGroup } = useGroups();
11721
11784
  const isDefaultSelected = props.selectedSavedView?.id === "default";
11722
- 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%" } }, /* @__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(
11723
11802
  Row,
11724
11803
  {
11725
11804
  selected: isDefaultSelected,
@@ -11735,7 +11814,9 @@ var PanelContent = (props) => {
11735
11814
  )
11736
11815
  ), VIEW_LEVELS.map((level) => {
11737
11816
  const isExpanded = groups[level];
11738
- 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
+ ) : [];
11739
11820
  return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, { key: level }, /* @__PURE__ */ import_react9.default.createElement(
11740
11821
  ViewLevelHeader_default,
11741
11822
  {
@@ -11784,7 +11865,7 @@ var PanelContent = (props) => {
11784
11865
  };
11785
11866
 
11786
11867
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
11787
- var import_react14 = __toESM(require("react"));
11868
+ var import_react19 = __toESM(require("react"));
11788
11869
 
11789
11870
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridDefaultSavedView.tsx
11790
11871
  var import_core_react8 = require("@procore/core-react");
@@ -11844,8 +11925,8 @@ var useSmartGridConfig = (gridApi) => {
11844
11925
  };
11845
11926
 
11846
11927
  // src/SavedViews/components/SavedViews/SavedViews.tsx
11847
- var import_core_react12 = require("@procore/core-react");
11848
- var import_react13 = __toESM(require("react"));
11928
+ var import_core_react13 = require("@procore/core-react");
11929
+ var import_react18 = __toESM(require("react"));
11849
11930
  var import_react_query3 = require("@tanstack/react-query");
11850
11931
 
11851
11932
  // src/SavedViews/components/SavedViewsModals/SavedViewsDeleteConfirmationModalShared.tsx
@@ -11877,7 +11958,7 @@ var import_react12 = __toESM(require("react"));
11877
11958
 
11878
11959
  // src/SavedViews/components/SavedViewsModals/SavedViewsCreateUpdateModalBase.tsx
11879
11960
  var import_core_react10 = require("@procore/core-react");
11880
- var React17 = __toESM(require("react"));
11961
+ var React18 = __toESM(require("react"));
11881
11962
 
11882
11963
  // ../../node_modules/yup/index.esm.js
11883
11964
  var import_property_expr = __toESM(require_property_expr());
@@ -14278,7 +14359,7 @@ var SavedViewsCreateUpdateModalBase = ({
14278
14359
  }
14279
14360
  };
14280
14361
  const viewLevelOptions = getViewLevelOptions(permissions, I18n);
14281
- return /* @__PURE__ */ React17.createElement(
14362
+ return /* @__PURE__ */ React18.createElement(
14282
14363
  import_core_react10.Modal,
14283
14364
  {
14284
14365
  "aria-label": I18n.t("savedViews.ariaLabels.modal"),
@@ -14287,14 +14368,14 @@ var SavedViewsCreateUpdateModalBase = ({
14287
14368
  style: { width: "540px" },
14288
14369
  "data-testid": "create-update-modal"
14289
14370
  },
14290
- /* @__PURE__ */ React17.createElement(ScrollContainer, null, /* @__PURE__ */ React17.createElement(
14371
+ /* @__PURE__ */ React18.createElement(ScrollContainer, null, /* @__PURE__ */ React18.createElement(
14291
14372
  import_core_react10.Modal.Header,
14292
14373
  {
14293
14374
  onClose,
14294
14375
  style: { borderBottom: `1px solid ${import_core_react10.colors.gray85}` }
14295
14376
  },
14296
- /* @__PURE__ */ React17.createElement(import_core_react10.H2, null, header)
14297
- ), /* @__PURE__ */ React17.createElement(
14377
+ /* @__PURE__ */ React18.createElement(import_core_react10.H2, null, header)
14378
+ ), /* @__PURE__ */ React18.createElement(
14298
14379
  import_core_react10.Form,
14299
14380
  {
14300
14381
  initialValues: {
@@ -14320,13 +14401,13 @@ var SavedViewsCreateUpdateModalBase = ({
14320
14401
  onReset: onCancel,
14321
14402
  validateOnChange: true
14322
14403
  },
14323
- /* @__PURE__ */ React17.createElement(import_core_react10.Form.Form, { name: header }, /* @__PURE__ */ React17.createElement(
14404
+ /* @__PURE__ */ React18.createElement(import_core_react10.Form.Form, { name: header }, /* @__PURE__ */ React18.createElement(
14324
14405
  import_core_react10.Modal.Body,
14325
14406
  {
14326
14407
  style: { paddingTop: 0, paddingBottom: 0, marginTop: import_core_react10.spacing.lg }
14327
14408
  },
14328
- errors && /* @__PURE__ */ React17.createElement(import_core_react10.ErrorBanner, { style: { marginBottom: import_core_react10.spacing.xl } }, /* @__PURE__ */ React17.createElement(import_core_react10.Banner.Content, null, /* @__PURE__ */ React17.createElement(import_core_react10.Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React17.createElement(import_core_react10.Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
14329
- /* @__PURE__ */ React17.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React17.createElement(
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(
14330
14411
  import_core_react10.Form.Text,
14331
14412
  {
14332
14413
  name: "name",
@@ -14337,12 +14418,12 @@ var SavedViewsCreateUpdateModalBase = ({
14337
14418
  onChange: () => resetMutations()
14338
14419
  }
14339
14420
  )),
14340
- /* @__PURE__ */ React17.createElement(
14421
+ /* @__PURE__ */ React18.createElement(
14341
14422
  import_core_react10.Form.Row,
14342
14423
  {
14343
14424
  style: { marginTop: errors?.name ? import_core_react10.spacing.xl : import_core_react10.spacing.none }
14344
14425
  },
14345
- /* @__PURE__ */ React17.createElement(
14426
+ /* @__PURE__ */ React18.createElement(
14346
14427
  import_core_react10.Form.TextArea,
14347
14428
  {
14348
14429
  name: "description",
@@ -14353,7 +14434,7 @@ var SavedViewsCreateUpdateModalBase = ({
14353
14434
  }
14354
14435
  )
14355
14436
  ),
14356
- viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React17.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React17.createElement(
14437
+ viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React18.createElement(import_core_react10.Form.Row, null, /* @__PURE__ */ React18.createElement(
14357
14438
  import_core_react10.Form.Select,
14358
14439
  {
14359
14440
  name: "view_level",
@@ -14363,8 +14444,8 @@ var SavedViewsCreateUpdateModalBase = ({
14363
14444
  onSearch: false,
14364
14445
  onClear: false
14365
14446
  }
14366
- )) : /* @__PURE__ */ React17.createElement(React17.Fragment, null)
14367
- ), /* @__PURE__ */ React17.createElement(import_core_react10.Modal.Footer, { style: { borderTop: `1px solid ${import_core_react10.colors.gray85}` } }, /* @__PURE__ */ React17.createElement(import_core_react10.Flex, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React17.createElement(import_core_react10.Typography, { color: "gray45", italic: true }, /* @__PURE__ */ React17.createElement(import_core_react10.Typography, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React17.createElement(import_core_react10.Modal.FooterButtons, null, /* @__PURE__ */ React17.createElement(import_core_react10.Button, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React17.createElement(
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(
14368
14449
  import_core_react10.Button,
14369
14450
  {
14370
14451
  "data-testid": "create-update-modal-button",
@@ -14416,6 +14497,272 @@ var SavedViewsFormModal = ({
14416
14497
  );
14417
14498
  };
14418
14499
 
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?.();
14507
+ };
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
+ )))
14539
+ );
14540
+ };
14541
+
14542
+ // src/utils/Hooks/useViewSelection.ts
14543
+ var import_react15 = require("react");
14544
+
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);
14554
+ }
14555
+ return;
14556
+ }
14557
+ const viewInUserViews = availableViews.find((v2) => v2.id === savedViewId);
14558
+ if (viewInUserViews) {
14559
+ if (viewInUserViews.id !== selectedView?.id) {
14560
+ onViewFound(viewInUserViews);
14561
+ }
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);
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
+ )
14616
+ );
14617
+ return savedView || config.defaultView;
14618
+ } catch (e2) {
14619
+ return config.defaultView;
14620
+ }
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
+ };
14687
+ };
14688
+
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();
14709
+ }
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
+ });
14726
+ }
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
+ };
14764
+ };
14765
+
14419
14766
  // src/SavedViews/components/SavedViews/SavedViews.tsx
14420
14767
  var StyledPanel = styled_components_esm_default.div`
14421
14768
  border: ${({ provider }) => provider === "data-table" ? "1px solid #d6dadc" : "none"};
@@ -14430,74 +14777,80 @@ var SavedViewsContent = (props) => {
14430
14777
  projectId,
14431
14778
  companyId
14432
14779
  };
14780
+ const { data: savedViews } = useSavedViewsQuery(queryInput);
14433
14781
  const { mutate: deleteSavedView } = useDeleteSavedView(queryInput);
14434
- const [selectedSavedView, setSelectedSavedView] = (0, import_react13.useState)(() => {
14435
- try {
14436
- const savedView = JSON.parse(
14437
- localStorage.getItem(
14438
- `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`
14439
- )
14440
- );
14441
- return savedView || props.defaultView;
14442
- } catch (e2) {
14443
- return props.defaultView;
14444
- }
14445
- });
14446
- const updateLocalStorage = (view) => {
14447
- if (props.stickyViewsKey) {
14448
- localStorage.setItem(
14449
- `${props.domain}_${props.tableName}_${props.stickyViewsKey}_${projectId}_${props.userId}`,
14450
- JSON.stringify(view)
14451
- );
14452
- }
14453
- };
14454
- const handleViewItemSelect = ({ item }) => {
14455
- const viewToSetAsSelected = props.onSelect({ item });
14456
- setSelectedSavedView(viewToSetAsSelected);
14457
- updateLocalStorage(viewToSetAsSelected);
14782
+ const { openModal, closeModal, isModalOpen, modalData, activeModal } = useModalState();
14783
+ const openCrossUserModal = (viewId) => {
14784
+ openModal("crossUser" /* CROSS_USER */, { viewId });
14458
14785
  };
14459
- const onDelete = () => {
14460
- if (selectedSavedView) {
14461
- deleteSavedView(selectedSavedView, {
14462
- 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)
14463
14825
  });
14464
14826
  }
14465
14827
  };
14466
- const i18n = (0, import_core_react12.useI18nContext)();
14467
- const [openDeleteModal, setOpenDeleteModal] = (0, import_react13.useState)(false);
14468
- const [openEditCreateModal, setOpenEditCreateModal] = (0, import_react13.useState)(false);
14469
- const [editCreateModalType, setEditCreateModalType] = (0, import_react13.useState)(
14470
- "create" /* CREATE */
14471
- );
14472
- const onCloseDeleteModal = () => {
14473
- setOpenDeleteModal(false);
14474
- };
14475
- const onCloseEditModal = () => {
14476
- setOpenEditCreateModal(false);
14477
- };
14478
- const openModal = (type) => {
14479
- setEditCreateModalType(type);
14480
- setOpenEditCreateModal(true);
14828
+ const confirmDeleteAndCloseModal = () => {
14829
+ deleteSelectedView();
14830
+ closeModal();
14481
14831
  };
14482
- const onOpenDeleteModal = () => {
14483
- setOpenDeleteModal(true);
14832
+ const i18n = (0, import_core_react13.useI18nContext)();
14833
+ const selectSavedViewFromList = ({ item }) => selectView(item);
14834
+ const setSelectedSavedView = (view) => {
14835
+ selectView(view);
14484
14836
  };
14485
- 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(
14486
14839
  ExpandedPanel,
14487
14840
  {
14488
14841
  "data-testid": "saved-view-expanded-panel",
14489
14842
  provider: props.provider
14490
14843
  },
14491
- /* @__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(
14492
- 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,
14493
14846
  {
14494
14847
  overlay: i18n.t("savedViews.actions.create"),
14495
14848
  showDelay: 1e3
14496
14849
  },
14497
- /* @__PURE__ */ import_react13.default.createElement("span", null, /* @__PURE__ */ import_react13.default.createElement(
14498
- import_core_react12.Button,
14850
+ /* @__PURE__ */ import_react18.default.createElement("span", null, /* @__PURE__ */ import_react18.default.createElement(
14851
+ import_core_react13.Button,
14499
14852
  {
14500
- icon: /* @__PURE__ */ import_react13.default.createElement(Plus_default, null),
14853
+ icon: /* @__PURE__ */ import_react18.default.createElement(Plus_default, null),
14501
14854
  variant: "secondary",
14502
14855
  "data-testid": "expanded-panel-create-button",
14503
14856
  onClick: () => openModal("create" /* CREATE */),
@@ -14506,56 +14859,63 @@ var SavedViewsContent = (props) => {
14506
14859
  i18n.t("savedViews.actions.create")
14507
14860
  ))
14508
14861
  )),
14509
- /* @__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(
14510
14863
  PanelContent,
14511
14864
  {
14512
- onSelect: handleViewItemSelect,
14865
+ onSelect: selectSavedViewFromList,
14513
14866
  openModal,
14514
- onDelete: onOpenDeleteModal,
14867
+ onDelete: () => openModal("delete" /* DELETE */),
14515
14868
  updateLocalStorage,
14516
14869
  setSelectedSavedView,
14517
14870
  queryInput,
14518
- selectedSavedView,
14871
+ selectedSavedView: selectedView,
14519
14872
  tableConfig: props.tableConfig,
14520
14873
  defaultView: props.defaultView,
14521
14874
  stickyViewsKey: props.stickyViewsKey,
14875
+ savedViews: allViews,
14522
14876
  provider: props.provider,
14523
14877
  userId: props.userId
14524
14878
  }
14525
14879
  ))
14526
- ), /* @__PURE__ */ import_react13.default.createElement(
14880
+ ), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ import_react18.default.createElement(
14527
14881
  SavedViewsFormModal,
14528
14882
  {
14529
- open: openEditCreateModal,
14530
- mode: editCreateModalType,
14531
- onCancel: onCloseEditModal,
14883
+ open: true,
14884
+ mode: activeModal,
14885
+ onCancel: closeModal,
14532
14886
  queryInput,
14533
14887
  tableConfig: props.tableConfig,
14534
14888
  tableName: props.tableName,
14535
- selectedSavedView,
14889
+ selectedSavedView: selectedView,
14536
14890
  setSelectedSavedView,
14537
- onSelect: (view) => handleViewItemSelect({ item: view }),
14538
- setOpenEditCreateModal,
14891
+ onSelect: selectView,
14892
+ setOpenEditCreateModal: closeModal,
14539
14893
  defaultView: props.defaultView
14540
14894
  }
14541
- ), selectedSavedView && /* @__PURE__ */ import_react13.default.createElement(
14895
+ ), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ import_react18.default.createElement(
14542
14896
  SavedViewsDeleteConfirmationModalShared,
14543
14897
  {
14544
- open: openDeleteModal,
14545
- onDelete: () => {
14546
- onDelete();
14547
- onCloseDeleteModal();
14548
- },
14549
- 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
14550
14910
  }
14551
14911
  ));
14552
14912
  };
14553
14913
  var SavedViews = (props) => {
14554
- 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 })));
14555
14915
  };
14556
14916
 
14557
14917
  // src/SavedViews/components/SavedViews/SmartGrid/SmartGridSavedViews.tsx
14558
- var import_toast_alert2 = require("@procore/toast-alert");
14918
+ var import_toast_alert3 = require("@procore/toast-alert");
14559
14919
  var SmartGridSavedViews = (props) => {
14560
14920
  const { gridApi, projectId, companyId } = props;
14561
14921
  const { config: tableConfig, setConfig: setTableConfig } = useSmartGridConfig(gridApi);
@@ -14585,7 +14945,7 @@ var SmartGridSavedViews = (props) => {
14585
14945
  setTableConfig(updatedView.table_config);
14586
14946
  return updatedView;
14587
14947
  };
14588
- 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(
14589
14949
  SavedViews,
14590
14950
  {
14591
14951
  onSelect,
@@ -14604,11 +14964,11 @@ var SmartGridSavedViews = (props) => {
14604
14964
  };
14605
14965
 
14606
14966
  // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14607
- var import_react16 = __toESM(require("react"));
14967
+ var import_react21 = __toESM(require("react"));
14608
14968
 
14609
14969
  // src/SavedViews/components/SavedViews/DataTable/DataTableDefaultSavedView.tsx
14610
- var import_react15 = require("react");
14611
- var import_core_react13 = require("@procore/core-react");
14970
+ var import_react20 = require("react");
14971
+ var import_core_react14 = require("@procore/core-react");
14612
14972
  var DEFAULT_COLUMN_STATE = {
14613
14973
  hidden: false,
14614
14974
  pinned: null,
@@ -14655,7 +15015,7 @@ var extractDefaultView = (columnDefinitions, receivedConfigFromTool) => {
14655
15015
  return result;
14656
15016
  };
14657
15017
  var useDefaultViewName2 = (domain, defaultViewName) => {
14658
- const i18n = (0, import_core_react13.useI18nContext)();
15018
+ const i18n = (0, import_core_react14.useI18nContext)();
14659
15019
  return defaultViewName || i18n.t(domain, {
14660
15020
  scope: "savedViews.defaultViewTitle",
14661
15021
  defaultValue: "Default View"
@@ -14663,7 +15023,7 @@ var useDefaultViewName2 = (domain, defaultViewName) => {
14663
15023
  };
14664
15024
  var useDefaultView2 = (props) => {
14665
15025
  const name = useDefaultViewName2(props.domain, props.defaultViewName);
14666
- const extractedDefaultConfig = (0, import_react15.useMemo)(
15026
+ const extractedDefaultConfig = (0, import_react20.useMemo)(
14667
15027
  () => extractDefaultView(props.columnDefinitions, props.receivedConfigFromTool),
14668
15028
  [props.columnDefinitions, props.receivedConfigFromTool]
14669
15029
  );
@@ -14676,18 +15036,18 @@ var useDefaultView2 = (props) => {
14676
15036
  };
14677
15037
 
14678
15038
  // src/SavedViews/components/SavedViews/DataTable/DataTableSavedViews.tsx
14679
- var import_toast_alert3 = require("@procore/toast-alert");
14680
- 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) => {
14681
15041
  const { tableApi, onTableConfigChange, projectId, companyId } = props;
14682
- const [internalTableConfig, setInternalTableConfig] = (0, import_react16.useState)(
15042
+ const [internalTableConfig, setInternalTableConfig] = (0, import_react21.useState)(
14683
15043
  props.defaultViewConfig
14684
15044
  );
14685
- (0, import_react16.useImperativeHandle)(ref, () => ({
15045
+ (0, import_react21.useImperativeHandle)(ref, () => ({
14686
15046
  setTableConfig: (newConfig) => {
14687
15047
  handleConfigChange(newConfig);
14688
15048
  }
14689
15049
  }));
14690
- const handleConfigChange = (0, import_react16.useCallback)(
15050
+ const handleConfigChange = (0, import_react21.useCallback)(
14691
15051
  (newConfig) => {
14692
15052
  setInternalTableConfig(newConfig);
14693
15053
  onTableConfigChange(newConfig);
@@ -14715,7 +15075,7 @@ var DataTableSavedViews = (0, import_react16.forwardRef)((props, ref) => {
14715
15075
  if (!internalTableConfig) {
14716
15076
  return null;
14717
15077
  }
14718
- 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(
14719
15079
  SavedViews,
14720
15080
  {
14721
15081
  onSelect,