react-semaphor 0.1.445 → 0.1.447
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.
- package/dist/analytics-protocol/index.js +8 -8
- package/dist/appearance/index.cjs +1 -1
- package/dist/appearance/index.js +1 -1
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +9 -9
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{analyze-result-contract-DUv3QnMl.js → analyze-result-contract-T-0Ntzys.js} +1 -1
- package/dist/chunks/{braces-BdbUk_r9.js → braces-8TRlDwDw.js} +1 -1
- package/dist/chunks/{braces-BKimshER.cjs → braces-v55uLCAK.cjs} +1 -1
- package/dist/chunks/{catalog-field-grounding-AOGwWu0K.js → catalog-field-grounding-S2jKwKGD.js} +9 -9
- package/dist/chunks/{common-types-DFsDdpH7.js → common-types-B7Jk3Rtj.js} +5 -5
- package/dist/chunks/{dashboard-briefing-launcher-2SLNOaTg.js → dashboard-briefing-launcher-CDjcivK2.js} +192 -191
- package/dist/chunks/dashboard-briefing-launcher-D44Au-Qp.cjs +26 -0
- package/dist/chunks/dashboard-controls-DH3J4L1D.cjs +52 -0
- package/dist/chunks/dashboard-controls-tHwb3g3W.js +2409 -0
- package/dist/chunks/{dashboard-date-comparison-definition-BaYxjLi5.js → dashboard-date-comparison-definition-Ba-clViK.js} +1 -1
- package/dist/chunks/{dashboard-input-contract-BFpERluO.js → dashboard-input-contract-DSt8dGzP.js} +4 -4
- package/dist/chunks/{dashboard-json-BZwq3EcS.js → dashboard-json-Bihrrl5_.js} +11 -11
- package/dist/chunks/dashboard-json-VOXcUBqx.cjs +1 -0
- package/dist/chunks/edit-dashboard-visual-8XtuSSKG.cjs +177 -0
- package/dist/chunks/{edit-dashboard-visual-njLPYip3.js → edit-dashboard-visual-Dsc9mZnc.js} +7113 -7097
- package/dist/chunks/{editor-action-buttons-CBVMFipA.cjs → editor-action-buttons-BFqvBlLw.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-BhLX5Q6m.js → editor-action-buttons-BbVgPOda.js} +41 -41
- package/dist/chunks/{format-types-CZH5w1lo.js → format-types-DZGgYj39.js} +5 -5
- package/dist/chunks/index-BSTyv45D.cjs +1395 -0
- package/dist/chunks/{index-If0wlXGi.js → index-CJdxSyQq.js} +308 -308
- package/dist/chunks/{index-Dpm_VET4.cjs → index-DRlMUglg.cjs} +2 -2
- package/dist/chunks/{dashboard-u61yfU6u.js → index-srGACKDr.js} +148223 -151540
- package/dist/chunks/{layout-grid-D5tYJg1-.js → layout-grid-CiubineE.js} +1 -1
- package/dist/chunks/{layout-grid-3-HWzEwU.cjs → layout-grid-xm8pqtx0.cjs} +1 -1
- package/dist/chunks/{metric-comparison-BJ_Qu1ZF.js → metric-comparison-97zHGEx5.js} +7 -7
- package/dist/chunks/mouse-pointer-2-BZvGk45-.js +19 -0
- package/dist/chunks/mouse-pointer-2-DX4A_XZw.cjs +6 -0
- package/dist/chunks/{palette-DW_l7Jr0.cjs → palette-BN-jYtaK.cjs} +1 -1
- package/dist/chunks/{palette-jqaAcwiQ.js → palette-Cp1hqZtm.js} +1 -1
- package/dist/chunks/{pivot-result-identity-B6QCWOSi.js → pivot-result-identity-CwJWpKI7.js} +3 -3
- package/dist/chunks/{pivot-result-lifecycle-BM3Pl-D1.js → pivot-result-lifecycle-BBabQ_da.js} +27 -27
- package/dist/chunks/{presentation-execution-CGlb7YZ6.js → presentation-execution-BLfPTGX_.js} +10 -10
- package/dist/chunks/{report-preferences-dialog-D_NJu2wU.js → report-preferences-dialog-DZez53xw.js} +6 -6
- package/dist/chunks/report-preferences-dialog-TYTIHpHi.cjs +1 -0
- package/dist/chunks/{report-runtime-context-Qzn11HQe.js → report-runtime-context-bCy3CVzK.js} +1 -1
- package/dist/chunks/{save-4_uMnE6s.cjs → save-3dYRmehL.cjs} +1 -1
- package/dist/chunks/{save-HCJjjzdX.js → save-DgMfP0j8.js} +1 -1
- package/dist/chunks/{search-DHZCro8B.js → search-BHsQIWBV.js} +1 -1
- package/dist/chunks/{search-6ZmeMq55.cjs → search-BqqhaMx9.cjs} +1 -1
- package/dist/chunks/{code-editor-B4gTfvc5.js → switch-Bz2uj3q0.js} +9405 -9330
- package/dist/chunks/switch-rbwGjmad.cjs +138 -0
- package/dist/chunks/{temporal-bucket-authoring-BUZMuVca.js → temporal-bucket-authoring-CgOuakGW.js} +2 -2
- package/dist/chunks/{temporal-bucket-contract-B2bJ1oe4.js → temporal-bucket-contract-_F6vNhhH.js} +3 -3
- package/dist/chunks/{temporal-result-owner-Cb27SSG9.js → temporal-result-owner-6peubmhU.js} +3 -3
- package/dist/chunks/{token-types-DLo91nOf.js → token-types-BHR58aTy.js} +1 -1
- package/dist/chunks/{update-policy-eg59mQqv.js → update-policy-g0rCQ9BM.js} +9 -9
- package/dist/chunks/{validators-wZ2WlNHc.js → validators-Cs74WVie.js} +46 -46
- package/dist/chunks/x-B6ghREd2.cjs +31 -0
- package/dist/chunks/{index-xHCrHprY.js → x-CXDkqdur.js} +59 -59
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +6 -6
- package/dist/data-app-builder/index.cjs +13 -18
- package/dist/data-app-builder/index.js +92 -106
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +6 -6
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +4 -4
- package/dist/format-utils/index.js +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.js +16 -16
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +3 -3
- package/dist/types/brand-studio.d.ts +2 -2
- package/dist/types/dashboard.d.ts +3 -2
- package/dist/types/data-app-builder.d.ts +2 -2
- package/dist/types/data-app-sdk.d.ts +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +7 -7
- package/dist/types/main.d.ts +27 -25
- package/dist/types/surfboard.d.ts +3 -2
- package/package.json +1 -2
- package/dist/chunks/code-editor-BYVorgOf.cjs +0 -138
- package/dist/chunks/dashboard-CAiwJW3L.cjs +0 -1397
- package/dist/chunks/dashboard-briefing-launcher-CHwjpUYz.cjs +0 -26
- package/dist/chunks/dashboard-controls-BfL14aqO.js +0 -2238
- package/dist/chunks/dashboard-controls-BgGTg4yw.cjs +0 -36
- package/dist/chunks/dashboard-json-BOv8tCa9.cjs +0 -1
- package/dist/chunks/edit-dashboard-visual-BdVCH0DJ.cjs +0 -182
- package/dist/chunks/index-jSrCwPQz.cjs +0 -31
- package/dist/chunks/report-preferences-dialog-r8QzOSFb.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as _ } from "./validators-
|
|
1
|
+
import { e as _ } from "./validators-Cs74WVie.js";
|
|
2
2
|
const g = "higher_is_better", D = {
|
|
3
3
|
displayMode: "difference",
|
|
4
4
|
showComparison: !0,
|
|
@@ -376,12 +376,12 @@ export {
|
|
|
376
376
|
D as C,
|
|
377
377
|
g as D,
|
|
378
378
|
y as a,
|
|
379
|
-
|
|
379
|
+
k as b,
|
|
380
380
|
C as c,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
N as d,
|
|
382
|
+
M as e,
|
|
383
|
+
S as f,
|
|
384
|
+
T as g,
|
|
385
385
|
I as r,
|
|
386
|
-
|
|
386
|
+
b as v
|
|
387
387
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { c as e } from "./x-CXDkqdur.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.453.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
const a = e("MousePointer2", [
|
|
9
|
+
[
|
|
10
|
+
"path",
|
|
11
|
+
{
|
|
12
|
+
d: "M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",
|
|
13
|
+
key: "edeuup"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
]);
|
|
17
|
+
export {
|
|
18
|
+
a as M
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";const e=require("./x-B6ghREd2.cjs");/**
|
|
2
|
+
* @license lucide-react v0.453.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const o=e.createLucideIcon("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);exports.MousePointer2=o;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var y = Object.defineProperty;
|
|
2
2
|
var c = (t, e, r) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var u = (t, e, r) => c(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { v as d } from "./temporal-bucket-contract-
|
|
4
|
+
import { v as d } from "./temporal-bucket-contract-_F6vNhhH.js";
|
|
5
5
|
function f(t) {
|
|
6
6
|
return !!(t != null && t.isSubtotal && t.subtotalScope === "pivot-value");
|
|
7
7
|
}
|
|
@@ -86,9 +86,9 @@ function P(t, e) {
|
|
|
86
86
|
export {
|
|
87
87
|
a as P,
|
|
88
88
|
P as a,
|
|
89
|
-
|
|
89
|
+
v as b,
|
|
90
90
|
m as c,
|
|
91
91
|
b as d,
|
|
92
|
-
|
|
92
|
+
f as i,
|
|
93
93
|
w as r
|
|
94
94
|
};
|
package/dist/chunks/{pivot-result-lifecycle-BM3Pl-D1.js → pivot-result-lifecycle-BBabQ_da.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var V = Object.defineProperty;
|
|
2
2
|
var U = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var w = (e, t, n) => U(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { t as y, c as B,
|
|
5
|
-
import { b as h } from "./presentation-execution-
|
|
4
|
+
import { t as y, c as B, g as Z, e as q, a as D, m as L, b, i as G, f as X, d as H, h as Y } from "./format-types-DZGgYj39.js";
|
|
5
|
+
import { b as h } from "./presentation-execution-BLfPTGX_.js";
|
|
6
6
|
import { f as W } from "./temporal-bucket-BnPxGrAi.js";
|
|
7
|
-
import {
|
|
8
|
-
import "./analyze-result-contract-
|
|
9
|
-
import { a as Q } from "./metric-comparison-
|
|
10
|
-
import {
|
|
11
|
-
import { d as ee, P as te } from "./pivot-result-identity-
|
|
7
|
+
import { q as J } from "./validators-Cs74WVie.js";
|
|
8
|
+
import "./analyze-result-contract-T-0Ntzys.js";
|
|
9
|
+
import { a as Q } from "./metric-comparison-97zHGEx5.js";
|
|
10
|
+
import { a as z } from "./temporal-bucket-contract-_F6vNhhH.js";
|
|
11
|
+
import { d as ee, P as te } from "./pivot-result-identity-CwJWpKI7.js";
|
|
12
12
|
function M(e, t) {
|
|
13
13
|
const n = y(e), o = y(t), r = n.getTime() - o.getTime();
|
|
14
14
|
return r < 0 ? -1 : r > 0 ? 1 : r;
|
|
@@ -60,7 +60,7 @@ function ue(e, t, n) {
|
|
|
60
60
|
return oe(n == null ? void 0 : n.roundingMethod)(o);
|
|
61
61
|
}
|
|
62
62
|
function fe(e, t, n) {
|
|
63
|
-
const o =
|
|
63
|
+
const o = Z(), r = (n == null ? void 0 : n.locale) ?? o.locale ?? q, s = 2520, a = M(e, t);
|
|
64
64
|
if (isNaN(a))
|
|
65
65
|
throw new RangeError("Invalid time value");
|
|
66
66
|
const i = Object.assign({}, n, {
|
|
@@ -888,27 +888,27 @@ export {
|
|
|
888
888
|
$e as P,
|
|
889
889
|
ze as a,
|
|
890
890
|
De as b,
|
|
891
|
-
|
|
892
|
-
|
|
891
|
+
xe as c,
|
|
892
|
+
Ye as d,
|
|
893
893
|
Se as e,
|
|
894
894
|
et as f,
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
895
|
+
Je as g,
|
|
896
|
+
Qe as h,
|
|
897
|
+
Le as i,
|
|
898
|
+
S as j,
|
|
899
|
+
nt as k,
|
|
900
900
|
_e as l,
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
901
|
+
Te as m,
|
|
902
|
+
N as n,
|
|
903
|
+
tt as o,
|
|
904
|
+
K as p,
|
|
905
|
+
rt as q,
|
|
906
|
+
We as r,
|
|
907
|
+
ot as s,
|
|
908
|
+
st as t,
|
|
909
|
+
it as u,
|
|
910
|
+
l as v,
|
|
911
|
+
Oe as w,
|
|
912
|
+
at as x,
|
|
913
913
|
de as y
|
|
914
914
|
};
|
package/dist/chunks/{presentation-execution-CGlb7YZ6.js → presentation-execution-BLfPTGX_.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as C } from "./report-runtime-context-
|
|
1
|
+
import { b as C } from "./report-runtime-context-bCy3CVzK.js";
|
|
2
2
|
import { canonicalizeSupportedLocale as F, canonicalizeSupportedCurrencyCode as y } from "../value-format-preferences/index.js";
|
|
3
3
|
import { p as M } from "./temporal-bucket-BnPxGrAi.js";
|
|
4
4
|
function I(r) {
|
|
@@ -618,18 +618,18 @@ function ee(r) {
|
|
|
618
618
|
export {
|
|
619
619
|
Z as a,
|
|
620
620
|
G as b,
|
|
621
|
-
|
|
621
|
+
v as c,
|
|
622
622
|
k as d,
|
|
623
|
-
|
|
623
|
+
S as e,
|
|
624
624
|
J as f,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
625
|
+
E as g,
|
|
626
|
+
Y as h,
|
|
627
|
+
R as i,
|
|
628
|
+
Q as j,
|
|
629
629
|
T as k,
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
A as l,
|
|
631
|
+
X as m,
|
|
632
|
+
p as n,
|
|
633
633
|
ee as o,
|
|
634
634
|
K as p,
|
|
635
635
|
O as r,
|
package/dist/chunks/{report-preferences-dialog-D_NJu2wU.js → report-preferences-dialog-DZez53xw.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as l, Fragment as R, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import le, { useState as C, useRef as Y, useEffect as U, useCallback as A, useMemo as _ } from "react";
|
|
3
|
-
import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z,
|
|
4
|
-
import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./
|
|
5
|
-
import { a as xe } from "./report-runtime-context-
|
|
6
|
-
import "./
|
|
7
|
-
import "./validators-
|
|
8
|
-
import "./analyze-result-contract-
|
|
3
|
+
import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, b as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./index-srGACKDr.js";
|
|
4
|
+
import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./switch-Bz2uj3q0.js";
|
|
5
|
+
import { a as xe } from "./report-runtime-context-bCy3CVzK.js";
|
|
6
|
+
import "./x-CXDkqdur.js";
|
|
7
|
+
import "./validators-Cs74WVie.js";
|
|
8
|
+
import "./analyze-result-contract-T-0Ntzys.js";
|
|
9
9
|
import { parseValueFormatPreferencesResponse as Ne, canonicalizeSupportedLocale as Pe, canonicalizeSupportedCurrencyCode as Ee } from "../value-format-preferences/index.js";
|
|
10
10
|
function Ae(r = {}) {
|
|
11
11
|
const { authToken: c, tokenProps: e } = Q(), m = X(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("react"),n=require("./index-BSTyv45D.cjs"),o=require("./switch-rbwGjmad.cjs"),V=require("./report-runtime-context-C8LZFsqV.cjs");require("./x-B6ghREd2.cjs");require("./validators-9D4KBqKD.cjs");require("./analyze-result-contract-BHb7sUUW.cjs");const D=require("../value-format-preferences/index.cjs");function _(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(C=>C.actions.applyResolvedCalendarPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,[v,b]=l.useState(!1),[g,j]=l.useState(!1),[y,k]=l.useState(!1),[T,f]=l.useState(null),[N,P]=l.useState(null),h=l.useRef(c);h.current=c,l.useEffect(()=>{P(null),f(null),b(!1),j(!1),k(!1)},[c]);const w=l.useCallback(async C=>{const r=V.parseCalendarPreferencesResponse(await C.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),S=l.useCallback(async()=>{if(!d||!c||!m)return;const C=c;b(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to fetch preferences")}const t=await w(r);h.current===C&&P(t)}catch(r){h.current===C&&f(r instanceof Error?r.message:"Unknown error")}finally{h.current===C&&b(!1)}},[c,m,d,w]);l.useEffect(()=>{d&&S()},[d,S]);const E=l.useCallback(async C=>{if(!c||!m)return f("Not authenticated"),!1;const r=c;j(!0),f(null);try{const t=await fetch(`${m}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(C)});if(!t.ok){const z=await t.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}const x=await w(t);return h.current!==r?!1:(P(x),p(x.resolved,x.sources),!0)}catch(t){return h.current===r&&f(t instanceof Error?t.message:"Unknown error"),!1}finally{h.current===r&&j(!1)}},[c,m,p,w]),A=l.useCallback(async()=>{if(!c||!m)return f("Not authenticated"),!1;const C=c;k(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to clear preferences")}const t=await w(r);return h.current!==C?!1:(P(t),p(t.resolved,t.sources),!0)}catch(r){return h.current===C&&f(r instanceof Error?r.message:"Unknown error"),!1}finally{h.current===C&&k(!1)}},[c,m,p,w]);return{preferences:N,isLoading:v,isSaving:g,isClearing:y,error:T,updatePreferences:E,clearPreferences:A,refetch:S}}const F=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],I=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function M(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return F.map(s=>s.value)}function G(s){if(!s)return"default";if(s.tz!==s.weekStart)return"inherited";switch(s.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(s){const i=F.find(a=>a.value===s);return i?i.label:s}function W(s){const i=I.find(a=>a.value===s);return i?i.label:String(s)}function H({active:s,onClose:i}){const{preferences:a,isLoading:p,isSaving:d,isClearing:c,updatePreferences:m,clearPreferences:v}=_({enabled:s}),b=n.useCalendarContext(),g=(a==null?void 0:a.resolved.tz)||(b==null?void 0:b.tz)||"UTC",j=(a==null?void 0:a.resolved.weekStart)??(b==null?void 0:b.weekStart)??1,[y,k]=l.useState((a==null?void 0:a.stored)===null),[T,f]=l.useState(!1),[N,P]=l.useState(g),[h,w]=l.useState(j),[S,E]=l.useState(!1),A=l.useMemo(()=>M(),[]),C=l.useMemo(()=>A.filter(u=>!F.some($=>$.value===u)),[A]),r=l.useMemo(()=>U(N),[N]),t=a!=null&&a.inherited?U(a.inherited.tz):"UTC",x=a!=null&&a.inherited?W(a.inherited.weekStart):"Monday",z=G(a==null?void 0:a.inheritedSources);l.useEffect(()=>{if(!s){f(!1);return}T||(a&&k(a.stored===null),P(g),w(j))},[s,T,a,g,j]);const q=async()=>{if(p){n.ue.error("Preferences are still loading. Please try again.");return}y?await v()?(n.ue.success("Now using default settings."),i()):n.ue.error("Failed to save preferences. Please try again."):await m({tz:N,weekStart:h})?(n.ue.success("Preferences saved."),i()):n.ue.error("Failed to save preferences. Please try again.")},B=()=>{i()},L=d||c,O=L||p;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(n.RadioGroup,{value:y?"defaults":"custom",onValueChange:u=>{f(!0),k(u==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",y&&"bg-muted/50"),onClick:()=>{f(!0),k(!0)},children:[e.jsx(n.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",z," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t,", week starts ",x]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!y&&"bg-muted/50"),onClick:()=>{f(!0),k(!1)},children:[e.jsx(n.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:o.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",y&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Timezone"}),e.jsxs(o.Popover,{open:S,onOpenChange:E,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":S,className:"w-full justify-between text-[12px] font-normal",disabled:y,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(n.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(o.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(n.Command,{className:"overflow-visible",children:[e.jsx(n.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(n.CommandList,{children:[e.jsx(n.CommandEmpty,{children:"No timezone found."}),e.jsx(n.CommandGroup,{heading:"Common",children:F.map(u=>e.jsxs(n.CommandItem,{value:`${u.value} ${u.label}`,onSelect:()=>{f(!0),P(u.value),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:u.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.value})]},u.value))}),e.jsx(n.CommandSeparator,{}),e.jsx(n.CommandGroup,{heading:"All timezones",children:C.map(u=>e.jsxs(n.CommandItem,{value:u,onSelect:()=>{f(!0),P(u),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u?"opacity-100":"opacity-0")}),u]},u))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Week starts on"}),e.jsx(n.RadioGroup,{value:String(h),onValueChange:u=>{f(!0),w(Number(u))},className:"flex gap-4",disabled:y,children:I.map(u=>e.jsxs("label",{htmlFor:`week-start-${u.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",y&&"cursor-not-allowed"),children:[e.jsx(n.RadioGroupItem,{value:String(u.value),id:`week-start-${u.value}`,disabled:y}),u.label]},u.value))})]})]})]}),e.jsxs(n.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:B,disabled:L,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:q,disabled:O,children:L?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function K(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,v=l.useRef(c);v.current=c;const[b,g]=l.useState(null),[j,y]=l.useState(!1),[k,T]=l.useState(!1),[f,N]=l.useState(!1),[P,h]=l.useState(null);l.useEffect(()=>{g(null),h(null),y(!1),T(!1),N(!1)},[c]);const w=l.useCallback(async r=>{const t=D.parseValueFormatPreferencesResponse(await r.json());if(!t.ok)throw new Error("Value format preferences response is invalid");return t.value},[]),S=l.useCallback(async(r,t)=>{if(!c||!m)throw new Error("Not authenticated");const x=await fetch(`${m}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${c}`,...t?{"Content-Type":"application/json"}:{}},body:t?JSON.stringify(t):void 0});if(!x.ok){const z=await x.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}return w(x)},[c,m,w]),E=l.useCallback(async()=>{if(!d||!c||!m)return;const r=c;y(!0),h(null);try{const t=await S("GET");v.current===r&&g(t)}catch(t){v.current===r&&h(t instanceof Error?t.message:"Unknown error")}finally{v.current===r&&y(!1)}},[c,m,d,S]);l.useEffect(()=>{d&&E()},[d,E]);const A=l.useCallback(async r=>{const t=c;T(!0),h(null);try{const x=await S("PATCH",r);return v.current!==t?!1:(g(x),p(x.resolved,x.sources),!0)}catch(x){return v.current===t&&h(x instanceof Error?x.message:"Unknown error"),!1}finally{v.current===t&&T(!1)}},[c,p,S]),C=l.useCallback(async()=>{const r=c;N(!0),h(null);try{const t=await S("DELETE");return v.current!==r?!1:(g(t),p(t.resolved,t.sources),!0)}catch(t){return v.current===r&&h(t instanceof Error?t.message:"Unknown error"),!1}finally{v.current===r&&N(!1)}},[c,p,S]);return{preferences:b,isLoading:j,isSaving:k,isClearing:f,error:P,updatePreferences:A,clearPreferences:C,refetch:E}}function J({active:s,onClose:i}){var v,b;const{preferences:a,isLoading:p,isSaving:d,updatePreferences:c}=K({enabled:s});if(!s)return null;if(!a)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:p?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const m=[((v=a.stored)==null?void 0:v.locale)??"",((b=a.stored)==null?void 0:b.defaultCurrency)??""].join(":");return e.jsx(Z,{preferences:a,isSaving:d,updatePreferences:c,onClose:i},m)}function Z({preferences:s,isSaving:i,updatePreferences:a,onClose:p}){const[d,c]=l.useState(()=>{var g,j;return{locale:(g=s.stored)==null?void 0:g.locale,defaultCurrency:(j=s.stored)==null?void 0:j.defaultCurrency}}),m=(d.locale===void 0||D.canonicalizeSupportedLocale(d.locale)!==void 0)&&(d.defaultCurrency===void 0||D.canonicalizeSupportedCurrencyCode(d.defaultCurrency)!==void 0),v=async()=>{var T,f;const g={},j=[];d.locale!==void 0?g.locale=d.locale:((T=s.stored)==null?void 0:T.locale)!==void 0&&j.push("locale"),d.defaultCurrency!==void 0?g.defaultCurrency=d.defaultCurrency:((f=s.stored)==null?void 0:f.defaultCurrency)!==void 0&&j.push("defaultCurrency");const y={...Object.keys(g).length>0?{set:g}:{},...j.length>0?{clear:j}:{}};(Object.keys(y).length===0?!0:await a(y))?(n.ue.success("Display format preferences saved."),p()):n.ue.error("Failed to save preferences. Please try again.")},b=async()=>{await a({clear:["locale","defaultCurrency"]})?(n.ue.success("Locale and currency preferences reset."),p()):n.ue.error("Failed to reset locale and currency preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(n.DisplayFormatPreferencesFields,{value:d,inherited:s.inherited,inheritedSources:s.inheritedSources,onChange:c,disabled:i})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:b,disabled:i||s.stored===null,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:p,disabled:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:v,disabled:i||!m,children:i?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function Y({open:s,onOpenChange:i}){const[a,p]=l.useState("display"),d=()=>i(!1);return e.jsx(n.Dialog,{open:s,onOpenChange:i,children:e.jsxs(n.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(n.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(o.Tabs,{value:a,onValueChange:p,children:[e.jsxs(o.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(o.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(o.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(o.TabsContent,{value:"display",children:e.jsx(J,{active:s&&a==="display",onClose:d})}),e.jsx(o.TabsContent,{value:"calendar",children:e.jsx(H,{active:s&&a==="calendar",onClose:d})})]})]})})}exports.ReportPreferencesDialog=Y;
|
package/dist/chunks/{report-runtime-context-Qzn11HQe.js → report-runtime-context-bCy3CVzK.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseValueFormatPreferences as _, isReportPreferenceSource as C } from "../value-format-preferences/index.js";
|
|
2
|
-
import { b as k, e as g } from "./validators-
|
|
2
|
+
import { b as k, e as g } from "./validators-Cs74WVie.js";
|
|
3
3
|
const M = {
|
|
4
4
|
tz: "UTC",
|
|
5
5
|
weekStart: 1,
|