react-semaphor 0.1.375 → 0.1.377
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.cjs +1 -1
- package/dist/analytics-protocol/index.js +47 -43
- package/dist/brand-studio/index.cjs +4 -9
- package/dist/brand-studio/index.js +98 -108
- package/dist/chunks/{braces-C3-w6xDL.js → braces-C2uBgj3t.js} +1 -1
- package/dist/chunks/{braces-C8QqW4wu.js → braces-CkXyWzRh.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-DXgi7q5u.js → calendar-preferences-dialog-C55VOTIy.js} +6 -5
- package/dist/chunks/calendar-preferences-dialog-DAukJOaP.js +1 -0
- package/dist/chunks/catalog-field-grounding-BGW0hnB9.js +1 -0
- package/dist/chunks/catalog-field-grounding-DHXEI7cW.js +199 -0
- package/dist/chunks/{chevrons-up-down-DSvLu4Ye.js → chevrons-up-down-BnzChFLU.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CnCSGY02.js → chevrons-up-down-W0nzHzx0.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Jwbmrcl_.js → dashboard-briefing-launcher-CUyeiL_T.js} +3141 -2372
- package/dist/chunks/dashboard-briefing-launcher-DMKfG_z3.js +111 -0
- package/dist/chunks/dashboard-controls-B4hxFc3Q.js +2279 -0
- package/dist/chunks/dashboard-controls-D4vI0wvU.js +52 -0
- package/dist/chunks/dashboard-json-DQnm6daE.js +1 -0
- package/dist/chunks/{dashboard-json-Cl1O3uh0.js → dashboard-json-pl1_mFqJ.js} +14 -13
- package/dist/chunks/{edit-dashboard-visual-B_0sbc43.js → edit-dashboard-visual-CF4aSsav.js} +4729 -4645
- package/dist/chunks/edit-dashboard-visual-CjTXY51a.js +178 -0
- package/dist/chunks/{index-BIks0ktd.js → index-B2kPleRS.js} +186 -181
- package/dist/chunks/{index-BSkBy5cH.js → index-Bn866BBY.js} +22824 -22664
- package/dist/chunks/layout-grid-BFmJ7vmH.js +16 -0
- package/dist/chunks/layout-grid-CTOW9oTg.js +6 -0
- package/dist/chunks/{palette-DUGktM-M.js → palette-DrhPeer-.js} +1 -1
- package/dist/chunks/{palette-D-f4-82S.js → palette-OFaniMPn.js} +1 -1
- package/dist/chunks/{save-D3YYinDz.js → save-BxWBiQv1.js} +1 -1
- package/dist/chunks/{save-kkBEBeLg.js → save-Dh6gSC4x.js} +1 -1
- package/dist/chunks/{switch-Dkx2qEOr.js → switch-C-fGjxjY.js} +2002 -1983
- package/dist/chunks/switch-D5xopzFD.js +168 -0
- package/dist/chunks/use-create-flow-overlay-state-Dg2ffpCE.js +21 -0
- package/dist/chunks/use-create-flow-overlay-state-DrKP0jWE.js +1968 -0
- package/dist/chunks/{validation-1V7bWmYw.js → validation-BHFaWDU-.js} +1 -1
- package/dist/chunks/{validation-DlrTIf1N.js → validation-bMedDBOo.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +18 -13
- package/dist/data-app-builder/index.js +141 -131
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +22 -21
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +151 -151
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +84 -0
- package/dist/types/main.d.ts +8 -12
- package/package.json +1 -1
- package/dist/chunks/calendar-preferences-dialog-CsRzDpDs.js +0 -1
- package/dist/chunks/catalog-field-grounding-DoEBOXQd.js +0 -100
- package/dist/chunks/catalog-field-grounding-Du6mKDcF.js +0 -1
- package/dist/chunks/dashboard-briefing-launcher-C-G6vQTL.js +0 -106
- package/dist/chunks/dashboard-controls-DzGGNQxv.js +0 -2269
- package/dist/chunks/dashboard-controls-p7VKzWSb.js +0 -57
- package/dist/chunks/dashboard-json-CvPhMpbM.js +0 -1
- package/dist/chunks/edit-dashboard-visual-CSrdS10O.js +0 -178
- package/dist/chunks/resource-management-panel-IHbUOh2g.js +0 -6
- package/dist/chunks/resource-management-panel-tFjbtgPw.js +0 -1018
- package/dist/chunks/switch-fIkmwzUt.js +0 -168
- package/dist/chunks/use-create-flow-overlay-state-D-yGZTR3.js +0 -1647
- package/dist/chunks/use-create-flow-overlay-state-DbaUD5xc.js +0 -26
- package/dist/chunks/use-visual-utils-B5hwU_av.js +0 -1
- package/dist/chunks/use-visual-utils-Dj82r7DA.js +0 -340
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-B2kPleRS.js"),e=require("../chunks/common-types-C73-Ud1-.js"),a=require("../chunks/calendar-preferences-dialog-DAukJOaP.js");exports.Surfboard=r.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=a.CalendarPreferencesDialog;
|
package/dist/surfboard/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e } from "../chunks/index-
|
|
1
|
+
import { a as e } from "../chunks/index-Bn866BBY.js";
|
|
2
2
|
import { C, E } from "../chunks/common-types-4bjoIgvm.js";
|
|
3
|
-
import { C as s } from "../chunks/calendar-preferences-dialog-
|
|
3
|
+
import { C as s } from "../chunks/calendar-preferences-dialog-C55VOTIy.js";
|
|
4
4
|
export {
|
|
5
5
|
C as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
s as CalendarPreferencesDialog,
|
|
@@ -58,6 +58,8 @@ export declare function getAnalyticsCatalogFieldCandidates(field: AnalyticsCatal
|
|
|
58
58
|
|
|
59
59
|
export declare function getAnalyticsCatalogFieldName(field: AnalyticsCatalogField): string;
|
|
60
60
|
|
|
61
|
+
export declare function getSemaphorAnalyzeResultFieldNames(): SemaphorAnalyzeResultFieldName[];
|
|
62
|
+
|
|
61
63
|
export declare function getSemaphorConnectionCapabilities(connectionType: string | undefined, options?: {
|
|
62
64
|
connectionId?: string;
|
|
63
65
|
}): SemaphorConnectionCapabilities;
|
|
@@ -76,6 +78,8 @@ export declare function isAnalyticsMetricIdentifierField(field: AnalyticsCatalog
|
|
|
76
78
|
|
|
77
79
|
export declare function isAnalyticsTechnicalIdentifierField(field: AnalyticsCatalogField): boolean;
|
|
78
80
|
|
|
81
|
+
export declare function isSemaphorAnalyzeResultFieldName(value: string): value is SemaphorAnalyzeResultFieldName;
|
|
82
|
+
|
|
79
83
|
export declare type MatrixAxisLevelDescriptor = {
|
|
80
84
|
instanceId: string;
|
|
81
85
|
fieldKey: string;
|
|
@@ -405,6 +409,8 @@ export declare function normalizeSemaphorDialect(input: string | undefined): Sem
|
|
|
405
409
|
|
|
406
410
|
export declare function normalizeSemaphorInputOperator(value: SemaphorInputOperatorInput | string | null | undefined): SemaphorInputOperator | undefined;
|
|
407
411
|
|
|
412
|
+
export declare function parseSemaphorAnalyzeResult(value: unknown): SemaphorAnalyzeResult;
|
|
413
|
+
|
|
408
414
|
export declare function parseSemaphorIsoTimeWindowBoundary(value: unknown): Date | null;
|
|
409
415
|
|
|
410
416
|
export declare function preferSemaphorFieldRefMetadata(current: SemaphorFieldRef, next: SemaphorFieldRef): SemaphorFieldRef;
|
|
@@ -619,6 +625,42 @@ export declare const SEMAPHOR_ANALYTICS_INTENT_FIXTURES: {
|
|
|
619
625
|
};
|
|
620
626
|
};
|
|
621
627
|
|
|
628
|
+
export declare const SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT: {
|
|
629
|
+
readonly answerSummary: "string";
|
|
630
|
+
readonly responseDetail: "responseDetail";
|
|
631
|
+
readonly mode: "string";
|
|
632
|
+
readonly comparisonType: "string";
|
|
633
|
+
readonly executionResult: "unknown";
|
|
634
|
+
readonly compiledQuery: "unknown";
|
|
635
|
+
readonly data: "unknown";
|
|
636
|
+
readonly resultSets: "record";
|
|
637
|
+
readonly columns: "unknownArray";
|
|
638
|
+
readonly records: "recordArray";
|
|
639
|
+
readonly rowCount: "number";
|
|
640
|
+
readonly rowLimitExceeded: "boolean";
|
|
641
|
+
readonly output: "string";
|
|
642
|
+
readonly querySpec: "unknown";
|
|
643
|
+
readonly metadata: "record";
|
|
644
|
+
readonly validation: "unknown";
|
|
645
|
+
readonly coverage: "unknown";
|
|
646
|
+
readonly missingFields: "stringArray";
|
|
647
|
+
readonly warnings: "unknownArray";
|
|
648
|
+
readonly comparison: "unknown";
|
|
649
|
+
readonly population: "unknown";
|
|
650
|
+
readonly comparisons: "recordArray";
|
|
651
|
+
readonly fieldsUsed: "unknown";
|
|
652
|
+
readonly changes: "recordArray";
|
|
653
|
+
readonly largestNegativeChanges: "recordArray";
|
|
654
|
+
readonly largestPositiveChanges: "recordArray";
|
|
655
|
+
readonly drivers: "recordArray";
|
|
656
|
+
readonly absoluteDeltaDrivers: "recordArray";
|
|
657
|
+
readonly largestNegativeDrivers: "recordArray";
|
|
658
|
+
readonly largestPositiveDrivers: "recordArray";
|
|
659
|
+
readonly periodRows: "recordArray";
|
|
660
|
+
readonly sql: "unknown";
|
|
661
|
+
readonly omitted: "stringArray";
|
|
662
|
+
};
|
|
663
|
+
|
|
622
664
|
export declare type SemaphorAbsoluteTimeWindow = {
|
|
623
665
|
kind: 'absolute';
|
|
624
666
|
start: string;
|
|
@@ -763,6 +805,48 @@ export declare type SemaphorAnalyticsValueFilter = SemaphorAnalyticsFilterBase &
|
|
|
763
805
|
|
|
764
806
|
export declare type SemaphorAnalyticsValueFilterOperator = Exclude<SemaphorAnalyticsFilterOperator, 'is_null' | 'is_not_null'>;
|
|
765
807
|
|
|
808
|
+
export declare type SemaphorAnalyzeResponseDetail = 'compact' | 'standard' | 'debug';
|
|
809
|
+
|
|
810
|
+
export declare type SemaphorAnalyzeResult = Partial<Record<SemaphorAnalyzeResultFieldName, unknown>> & {
|
|
811
|
+
answerSummary?: string;
|
|
812
|
+
responseDetail?: SemaphorAnalyzeResponseDetail;
|
|
813
|
+
mode?: string;
|
|
814
|
+
comparisonType?: string;
|
|
815
|
+
executionResult?: SemaphorAnalyticsExecutionResult;
|
|
816
|
+
compiledQuery?: SemaphorCompiledQuery;
|
|
817
|
+
data?: unknown;
|
|
818
|
+
resultSets?: Record<string, unknown>;
|
|
819
|
+
columns?: unknown[];
|
|
820
|
+
records?: Record<string, unknown>[];
|
|
821
|
+
rowCount?: number;
|
|
822
|
+
rowLimitExceeded?: boolean;
|
|
823
|
+
output?: string;
|
|
824
|
+
querySpec?: unknown;
|
|
825
|
+
metadata?: Record<string, unknown>;
|
|
826
|
+
validation?: unknown;
|
|
827
|
+
coverage?: unknown;
|
|
828
|
+
missingFields?: string[];
|
|
829
|
+
warnings?: unknown[];
|
|
830
|
+
comparison?: unknown;
|
|
831
|
+
population?: unknown;
|
|
832
|
+
comparisons?: Record<string, unknown>[];
|
|
833
|
+
fieldsUsed?: unknown;
|
|
834
|
+
changes?: Record<string, unknown>[];
|
|
835
|
+
largestNegativeChanges?: Record<string, unknown>[];
|
|
836
|
+
largestPositiveChanges?: Record<string, unknown>[];
|
|
837
|
+
drivers?: Record<string, unknown>[];
|
|
838
|
+
absoluteDeltaDrivers?: Record<string, unknown>[];
|
|
839
|
+
largestNegativeDrivers?: Record<string, unknown>[];
|
|
840
|
+
largestPositiveDrivers?: Record<string, unknown>[];
|
|
841
|
+
periodRows?: Record<string, unknown>[];
|
|
842
|
+
sql?: unknown;
|
|
843
|
+
omitted?: string[];
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
export declare type SemaphorAnalyzeResultFieldKind = 'boolean' | 'number' | 'record' | 'recordArray' | 'responseDetail' | 'string' | 'stringArray' | 'unknown' | 'unknownArray';
|
|
847
|
+
|
|
848
|
+
export declare type SemaphorAnalyzeResultFieldName = keyof typeof SEMAPHOR_ANALYZE_RESULT_FIELD_CONTRACT;
|
|
849
|
+
|
|
766
850
|
export declare type SemaphorCompiledQuery = {
|
|
767
851
|
kind: 'config';
|
|
768
852
|
queryId: string;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -182,7 +182,6 @@ declare type Actions_2 = {
|
|
|
182
182
|
addBaseQuery: (baseQuery: TBaseQuery) => void;
|
|
183
183
|
removeBaseQuery: (baseQueryId: string) => void;
|
|
184
184
|
setBaseQueries: (baseQueries: TBaseQuery[]) => void;
|
|
185
|
-
setIsDashboardPanelOpen: (open: boolean) => void;
|
|
186
185
|
updateCardId: (oldCardId: string, newCardId: string) => {
|
|
187
186
|
success: boolean;
|
|
188
187
|
error?: string;
|
|
@@ -2261,7 +2260,6 @@ export declare type DashboardStore = {
|
|
|
2261
2260
|
/** True when dashboardInputValues came from a strict execution snapshot. */
|
|
2262
2261
|
dashboardInputValuesAreAuthoritative: boolean;
|
|
2263
2262
|
semanticExecutionPayload: SemanticExecutionPayload;
|
|
2264
|
-
isDashboardPanelOpen: boolean;
|
|
2265
2263
|
drillHistory: Array<{
|
|
2266
2264
|
sourceDashboardId: string;
|
|
2267
2265
|
targetDashboardId: string;
|
|
@@ -4714,16 +4712,6 @@ export declare interface ResourceListItem {
|
|
|
4714
4712
|
};
|
|
4715
4713
|
}
|
|
4716
4714
|
|
|
4717
|
-
export declare function ResourceManagementPanel({ isOpen, onClose, className, onDashboardItemClick, variant, }: ResourceManagementPanelProps): JSX.Element;
|
|
4718
|
-
|
|
4719
|
-
declare interface ResourceManagementPanelProps {
|
|
4720
|
-
isOpen: boolean;
|
|
4721
|
-
onClose: () => void;
|
|
4722
|
-
className?: string;
|
|
4723
|
-
onDashboardItemClick?: (dashboardId: string) => void;
|
|
4724
|
-
variant?: 'overlay' | 'inline';
|
|
4725
|
-
}
|
|
4726
|
-
|
|
4727
4715
|
export declare enum ResourceType {
|
|
4728
4716
|
DASHBOARD = "dashboard",
|
|
4729
4717
|
VISUAL = "visual"
|
|
@@ -7088,6 +7076,7 @@ export declare function useResourceManagement(resourceType: ResourceType, onDele
|
|
|
7088
7076
|
data: UpdateResourceRequest | UpdateDashboardTemplateRequest;
|
|
7089
7077
|
}, void>;
|
|
7090
7078
|
deleteResource: UseMutateFunction<any, Error, string, void>;
|
|
7079
|
+
deleteResourceAsync: UseMutateAsyncFunction<any, Error, string, void>;
|
|
7091
7080
|
duplicateResource: UseMutateFunction<any, Error, string, void>;
|
|
7092
7081
|
shareResource: UseMutateFunction<any, Error, {
|
|
7093
7082
|
resourceType: ResourceType;
|
|
@@ -7197,6 +7186,13 @@ declare type VisualProps = DashboardProps & {
|
|
|
7197
7186
|
displayPreferences?: VisualDisplayPreferences;
|
|
7198
7187
|
};
|
|
7199
7188
|
|
|
7189
|
+
export declare function VisualsLibraryDialog({ open, onOpenChange, }: VisualsLibraryDialogProps): JSX.Element;
|
|
7190
|
+
|
|
7191
|
+
declare interface VisualsLibraryDialogProps {
|
|
7192
|
+
open: boolean;
|
|
7193
|
+
onOpenChange: (open: boolean) => void;
|
|
7194
|
+
}
|
|
7195
|
+
|
|
7200
7196
|
export declare function WatchDashboardButton({ disabled, briefingCount, className, onClick, }: WatchDashboardButtonProps): JSX.Element;
|
|
7201
7197
|
|
|
7202
7198
|
export declare type WatchDashboardButtonProps = {
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-BIks0ktd.js"),i=require("./switch-fIkmwzUt.js");require("./index-BxM99sFL.js");const G=require("./chevrons-up-down-CnCSGY02.js");function W(n={}){var y,P,z,A;const{authToken:d,tokenProps:a}=t.useSemaphorContext(),x=n.enabled??!0,m=(d==null?void 0:d.accessToken)??null,f=(a==null?void 0:a.apiServiceUrl)??null,[L,C]=l.useState(!1),[j,b]=l.useState(!1),[h,g]=l.useState(!1),[N,c]=l.useState(null),[v,S]=l.useState(null),k=v||{tz:((P=(y=a==null?void 0:a.params)==null?void 0:y.calendarContext)==null?void 0:P.tz)||null,weekStart:((A=(z=a==null?void 0:a.params)==null?void 0:z.calendarContext)==null?void 0:A.weekStart)??null},p=l.useCallback(async()=>{if(!(!x||!m||!f)){C(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to fetch preferences")}const r=await o.json();S({tz:r.tz,weekStart:r.weekStart,source:r.source,isInherited:r.isInherited,userHasPrefs:r.userHasPrefs,inherited:r.inherited})}catch(o){const r=o instanceof Error?o.message:"Unknown error";c(r)}finally{C(!1)}}},[m,f,x]);l.useEffect(()=>{x&&p()},[x,p]);const T=l.useCallback(async o=>{if(!m||!f)return c("Not authenticated"),!1;b(!0),c(null);try{const r=await fetch(`${f}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:JSON.stringify(o)});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error||"Failed to update preferences")}return await p(),!0}catch(r){const u=r instanceof Error?r.message:"Unknown error";return c(u),!1}finally{b(!1)}},[m,f,p]),w=l.useCallback(async()=>{if(!m||!f)return c("Not authenticated"),!1;g(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to clear preferences")}const r=await o.text();if(r)try{const u=JSON.parse(r);return S({tz:u.tz,weekStart:u.weekStart,source:u.source,isInherited:u.isInherited??!0,userHasPrefs:!1,inherited:u.inherited}),!0}catch{}return await p(),!0}catch(o){const r=o instanceof Error?o.message:"Unknown error";return c(r),!1}finally{g(!1)}},[m,f,p]);return{preferences:k,isLoading:L,isSaving:j,isClearing:h,error:N,updatePreferences:T,clearPreferences:w,refetch:p}}const E=[{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"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],H="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const n=Intl;if(n.supportedValuesOf)return n.supportedValuesOf("timeZone")}catch{}return E.map(n=>n.value)}function q(n){switch(n){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function O(n){const d=E.find(a=>a.value===n);return d?d.label:n}function V(n){const d=M.find(a=>a.value===n);return d?d.label:String(n)}function Z({open:n,onOpenChange:d}){var D,U,F;const{preferences:a,isLoading:x,isSaving:m,isClearing:f,updatePreferences:L,clearPreferences:C}=W({enabled:n}),j=a.tz||((D=a.inherited)==null?void 0:D.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,b=a.weekStart??((U=a.inherited)==null?void 0:U.weekStart)??1,[h,g]=l.useState(!a.userHasPrefs),[N,c]=l.useState(!1),[v,S]=l.useState(j),[k,p]=l.useState(b),[T,w]=l.useState(!1),y=l.useMemo(()=>_(),[]),P=l.useMemo(()=>y.filter(s=>!E.some(R=>R.value===s)),[y]),z=l.useMemo(()=>O(v),[v]),A=a.inherited?O(a.inherited.tz):"UTC",o=a.inherited?V(a.inherited.weekStart):"Monday",r=q((F=a.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!n){c(!1);return}N||(a.userHasPrefs!==void 0&&g(!a.userHasPrefs),S(j),p(b))},[n,N,a.userHasPrefs,j,b]);const u=async()=>{if(x){t.ue.error("Preferences are still loading. Please try again.");return}h?await C()?(t.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again."):await L({tz:v,weekStart:k})?(t.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again.")},$=()=>{d(!1)},I=m||f,B=I||x;return e.jsx(t.Dialog,{open:n,onOpenChange:d,children:e.jsxs(t.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{className:"text-[15px]",children:"Calendar preferences"}),e.jsx(t.DialogDescription,{className:"text-[13px] leading-5",children:"Set your timezone and week-start for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(t.RadioGroup,{value:h?"defaults":"custom",onValueChange:s=>{c(!0),g(s==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",h&&"bg-muted/50"),onClick:()=>{c(!0),g(!0)},children:[e.jsx(t.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 ",r," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[A,", week starts ",o]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!h&&"bg-muted/50"),onClick:()=>{c(!0),g(!1)},children:[e.jsx(t.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:i.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",h&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Timezone"}),e.jsxs(i.Popover,{open:T,onOpenChange:w,modal:!0,children:[e.jsx(i.PopoverTrigger,{asChild:!0,children:e.jsxs(i.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":T,className:"w-full justify-between text-[12px] font-normal",disabled:h,children:[e.jsx("span",{className:"truncate",children:z}),e.jsx(G.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(i.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(t.Command,{className:"overflow-visible",children:[e.jsx(t.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(t.CommandList,{children:[e.jsx(t.CommandEmpty,{children:"No timezone found."}),e.jsx(t.CommandGroup,{heading:"Common",children:E.map(s=>e.jsxs(t.CommandItem,{value:`${s.value} ${s.label}`,onSelect:()=>{c(!0),S(s.value),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:s.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.value})]},s.value))}),e.jsx(t.CommandSeparator,{}),e.jsx(t.CommandGroup,{heading:"All timezones",children:P.map(s=>e.jsxs(t.CommandItem,{value:s,onSelect:()=>{c(!0),S(s),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s?"opacity-100":"opacity-0")}),s]},s))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Week starts on"}),e.jsx(t.RadioGroup,{value:String(k),onValueChange:s=>{c(!0),p(Number(s))},className:"flex gap-4",disabled:h,children:M.map(s=>e.jsxs("label",{htmlFor:`week-start-${s.value}`,className:i.cn("flex cursor-pointer items-center gap-2 text-[13px]",h&&"cursor-not-allowed"),children:[e.jsx(t.RadioGroupItem,{value:String(s.value),id:`week-start-${s.value}`,disabled:h}),s.label]},s.value))})]})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(i.Button,{variant:"outline",size:"xs",onClick:$,disabled:I,children:"Cancel"}),e.jsx(i.Button,{size:"xs",onClick:u,disabled:B,children:I?e.jsxs(e.Fragment,{children:[e.jsx(i.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})})}exports.CalendarPreferencesDialog=Z;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
function c(n) {
|
|
2
|
-
return typeof n == "string" ? n.trim().toLowerCase() : "";
|
|
3
|
-
}
|
|
4
|
-
function g(n) {
|
|
5
|
-
return String(n.column_name || n.name || n.qualifiedFieldName || "");
|
|
6
|
-
}
|
|
7
|
-
function p(n) {
|
|
8
|
-
return Array.from(
|
|
9
|
-
new Set(
|
|
10
|
-
[
|
|
11
|
-
n.column_name,
|
|
12
|
-
n.name,
|
|
13
|
-
n.qualifiedFieldName,
|
|
14
|
-
n.alias
|
|
15
|
-
].filter(
|
|
16
|
-
(e) => typeof e == "string" && e.trim().length > 0
|
|
17
|
-
).map((e) => e.trim())
|
|
18
|
-
)
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
function o(n) {
|
|
22
|
-
const e = C(n);
|
|
23
|
-
return e ? e.includes("int") || e.includes("uint") || e.includes("bigint") || e.includes("smallint") || e.includes("tinyint") || e.includes("numeric") || e.includes("decimal") || e.includes("double") || e.includes("float") || e.includes("number") || e.includes("real") || e.includes("money") || e.includes("currency") || e.includes("percent") ? "number" : e.includes("timestamp") || e.includes("datetime") || e.startsWith("time") ? "datetime" : e.includes("date") ? "date" : e.includes("bool") ? "boolean" : "string" : "unknown";
|
|
24
|
-
}
|
|
25
|
-
function C(n) {
|
|
26
|
-
let e = c(n), t = "";
|
|
27
|
-
for (; e && e !== t; )
|
|
28
|
-
t = e, e = d(e, "nullable"), e = d(e, "lowcardinality");
|
|
29
|
-
return e;
|
|
30
|
-
}
|
|
31
|
-
function d(n, e) {
|
|
32
|
-
const t = `${e}(`;
|
|
33
|
-
return !n.startsWith(t) || !n.endsWith(")") ? n : n.slice(t.length, -1).trim();
|
|
34
|
-
}
|
|
35
|
-
function A(n) {
|
|
36
|
-
const e = o(n);
|
|
37
|
-
return e === "date" || e === "datetime";
|
|
38
|
-
}
|
|
39
|
-
function u(n) {
|
|
40
|
-
return A(n.dataType || n.data_type);
|
|
41
|
-
}
|
|
42
|
-
function m(n) {
|
|
43
|
-
const e = f(n);
|
|
44
|
-
return e === "id" || e === "row_id";
|
|
45
|
-
}
|
|
46
|
-
function l(n) {
|
|
47
|
-
const e = f(n);
|
|
48
|
-
return m(n) || e.endsWith("_id") || e.endsWith("_key") || e.endsWith("_number");
|
|
49
|
-
}
|
|
50
|
-
function f(n) {
|
|
51
|
-
return c(
|
|
52
|
-
g(n) || n.name || n.alias
|
|
53
|
-
).replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
54
|
-
}
|
|
55
|
-
function y(n, e = {}) {
|
|
56
|
-
const t = c(n.role);
|
|
57
|
-
return t === "metric" || t === "measure" ? !e.excludeIdentifiers || !l(n) : t === "groupby" || t === "dimension" || t === "date" || t === "id" ? !1 : o(
|
|
58
|
-
n.dataType || n.data_type
|
|
59
|
-
) === "number" && (!e.excludeIdentifiers || !l(n));
|
|
60
|
-
}
|
|
61
|
-
function h(n) {
|
|
62
|
-
return !y(n) && !u(n);
|
|
63
|
-
}
|
|
64
|
-
function D(n) {
|
|
65
|
-
const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
66
|
-
for (const a of n) {
|
|
67
|
-
if (m(a))
|
|
68
|
-
continue;
|
|
69
|
-
const r = p(a);
|
|
70
|
-
if (r.length !== 0) {
|
|
71
|
-
if (u(a)) {
|
|
72
|
-
r.forEach((i) => t.add(i));
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
if (y(a, { excludeIdentifiers: !0 })) {
|
|
76
|
-
r.forEach((i) => e.add(i));
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
r.forEach((i) => s.add(i));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
validMetricCandidates: Array.from(e).sort(),
|
|
84
|
-
validDateCandidates: Array.from(t).sort(),
|
|
85
|
-
validDimensionCandidates: Array.from(s).sort()
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
export {
|
|
89
|
-
p as a,
|
|
90
|
-
o as b,
|
|
91
|
-
u as c,
|
|
92
|
-
m as d,
|
|
93
|
-
l as e,
|
|
94
|
-
y as f,
|
|
95
|
-
g,
|
|
96
|
-
h,
|
|
97
|
-
A as i,
|
|
98
|
-
D as j,
|
|
99
|
-
c as n
|
|
100
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function l(t){return typeof t=="string"?t.trim().toLowerCase():""}function f(t){return String(t.column_name||t.name||t.qualifiedFieldName||"")}function g(t){return Array.from(new Set([t.column_name,t.name,t.qualifiedFieldName,t.alias].filter(e=>typeof e=="string"&&e.trim().length>0).map(e=>e.trim())))}function d(t){const e=p(t);return e?e.includes("int")||e.includes("uint")||e.includes("bigint")||e.includes("smallint")||e.includes("tinyint")||e.includes("numeric")||e.includes("decimal")||e.includes("double")||e.includes("float")||e.includes("number")||e.includes("real")||e.includes("money")||e.includes("currency")||e.includes("percent")?"number":e.includes("timestamp")||e.includes("datetime")||e.startsWith("time")?"datetime":e.includes("date")?"date":e.includes("bool")?"boolean":"string":"unknown"}function p(t){let e=l(t),i="";for(;e&&e!==i;)i=e,e=y(e,"nullable"),e=y(e,"lowcardinality");return e}function y(t,e){const i=`${e}(`;return!t.startsWith(i)||!t.endsWith(")")?t:t.slice(i.length,-1).trim()}function A(t){const e=d(t);return e==="date"||e==="datetime"}function o(t){return A(t.dataType||t.data_type)}function u(t){const e=C(t);return e==="id"||e==="row_id"}function c(t){const e=C(t);return u(t)||e.endsWith("_id")||e.endsWith("_key")||e.endsWith("_number")}function C(t){return l(f(t)||t.name||t.alias).replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function m(t,e={}){const i=l(t.role);return i==="metric"||i==="measure"?!e.excludeIdentifiers||!c(t):i==="groupby"||i==="dimension"||i==="date"||i==="id"?!1:d(t.dataType||t.data_type)==="number"&&(!e.excludeIdentifiers||!c(t))}function D(t){return!m(t)&&!o(t)}function F(t){const e=new Set,i=new Set,s=new Set;for(const a of t){if(u(a))continue;const r=g(a);if(r.length!==0){if(o(a)){r.forEach(n=>i.add(n));continue}if(m(a,{excludeIdentifiers:!0})){r.forEach(n=>e.add(n));continue}r.forEach(n=>s.add(n))}}return{validMetricCandidates:Array.from(e).sort(),validDateCandidates:Array.from(i).sort(),validDimensionCandidates:Array.from(s).sort()}}exports.buildAnalyticsCatalogFieldSummary=F;exports.getAnalyticsCatalogFieldCandidates=g;exports.getAnalyticsCatalogFieldName=f;exports.isAnalyticsCatalogDateField=o;exports.isAnalyticsCatalogDimensionField=D;exports.isAnalyticsCatalogMetricField=m;exports.isAnalyticsDateLikeDataType=A;exports.isAnalyticsMetricIdentifierField=c;exports.isAnalyticsTechnicalIdentifierField=u;exports.normalizeAnalyticsCatalogDataType=d;exports.normalizeAnalyticsCatalogName=l;
|