react-semaphor 0.1.428 → 0.1.430

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.
Files changed (96) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +72 -71
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +5 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +1031 -622
  7. package/dist/chunks/analyze-result-contract-BswhsmWT.js +1 -0
  8. package/dist/chunks/{analyze-result-contract-DnfF8kBb.js → analyze-result-contract-CfOBEwaC.js} +681 -759
  9. package/dist/chunks/{code-editor-CojfM3qp.js → code-editor-C65eEYyU.js} +2980 -2960
  10. package/dist/chunks/code-editor-DOh3aYEh.js +138 -0
  11. package/dist/chunks/{comparison-document-migration-b6c3xiWh.js → comparison-document-migration-DbU_BTxR.js} +1 -1
  12. package/dist/chunks/{comparison-document-migration-BJH1idOd.js → comparison-document-migration-Dj6xZMCb.js} +2 -2
  13. package/dist/chunks/csv-utils-Co0WxHke.js +4 -0
  14. package/dist/chunks/csv-utils-suxSkJGj.js +376 -0
  15. package/dist/chunks/{dashboard-509sbC4_.js → dashboard-0Tpj3XFq.js} +49934 -47167
  16. package/dist/chunks/dashboard-CVDy3fbO.js +1402 -0
  17. package/dist/chunks/{dashboard-briefing-launcher-B-ZTWJwo.js → dashboard-briefing-launcher-DLQqwXMF.js} +1 -1
  18. package/dist/chunks/{dashboard-briefing-launcher-DIdYHNTq.js → dashboard-briefing-launcher-pkNPk_4j.js} +100 -99
  19. package/dist/chunks/{dashboard-controls-CbRzWo1N.js → dashboard-controls-CIN4biYx.js} +114 -113
  20. package/dist/chunks/{dashboard-controls-CWprw-Pb.js → dashboard-controls-DbW9Jt_P.js} +2 -2
  21. package/dist/chunks/dashboard-json-BDKT0Z-m.js +1 -0
  22. package/dist/chunks/{dashboard-json-jO4GQfZk.js → dashboard-json-DBfR770k.js} +18 -17
  23. package/dist/chunks/edit-dashboard-visual-BjAp_UpK.js +182 -0
  24. package/dist/chunks/{edit-dashboard-visual-KgQTjqWp.js → edit-dashboard-visual-qkvRHS8Q.js} +8721 -8481
  25. package/dist/chunks/{metric-comparison-CWweq9RG.js → metric-comparison-CPoDx56y.js} +1 -1
  26. package/dist/chunks/{metric-comparison-BKgkMy9r.js → metric-comparison-DVy3fll_.js} +1 -1
  27. package/dist/chunks/numeric-presentation-CGTcqocU.js +517 -0
  28. package/dist/chunks/numeric-presentation-Dlb-Dk4c.js +1 -0
  29. package/dist/chunks/report-preferences-dialog-Bx8uzG8K.js +690 -0
  30. package/dist/chunks/report-preferences-dialog-LCHeqh7t.js +1 -0
  31. package/dist/chunks/source-identity-5OPV4gvg.js +92 -0
  32. package/dist/chunks/source-identity-Cbo2LOHQ.js +1 -0
  33. package/dist/chunks/{update-policy-CY2k-pJP.js → update-policy-De2NswtM.js} +1 -1
  34. package/dist/chunks/{update-policy-BgONreNd.js → update-policy-DnF_74zC.js} +1 -1
  35. package/dist/chunks/{use-create-flow-overlay-state-BiMYdjZP.js → use-create-flow-overlay-state-C-CxrQ48.js} +1 -1
  36. package/dist/chunks/{use-create-flow-overlay-state-CGsLzp9A.js → use-create-flow-overlay-state-C-j8E5IZ.js} +97 -96
  37. package/dist/chunks/validators-B2vUAqTf.js +1 -0
  38. package/dist/chunks/{validators-Cz-XuORM.js → validators-Bce_J7Vd.js} +19 -13
  39. package/dist/dashboard/index.cjs +1 -1
  40. package/dist/dashboard/index.js +1 -1
  41. package/dist/dashboard-authoring/index.cjs +3 -3
  42. package/dist/dashboard-authoring/index.js +20 -19
  43. package/dist/data-app-builder/index.cjs +1 -1
  44. package/dist/data-app-builder/index.js +50 -50
  45. package/dist/data-app-codegen/index.cjs +1 -1
  46. package/dist/data-app-codegen/index.js +2 -2
  47. package/dist/data-app-codegen-node/index.cjs +1 -1
  48. package/dist/data-app-codegen-node/index.js +3 -3
  49. package/dist/data-app-sdk/index.cjs +2 -2
  50. package/dist/data-app-sdk/index.js +27 -26
  51. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  52. package/dist/data-app-sdk-adapters/index.js +25 -24
  53. package/dist/data-app-sdk-validation/index.cjs +1 -1
  54. package/dist/data-app-sdk-validation/index.js +57 -55
  55. package/dist/format-utils/index.cjs +2 -5
  56. package/dist/format-utils/index.js +136 -161
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.js +158 -155
  59. package/dist/report-runtime-context/index.cjs +1 -0
  60. package/dist/report-runtime-context/index.js +394 -0
  61. package/dist/style.css +1 -1
  62. package/dist/surfboard/index.cjs +1 -1
  63. package/dist/surfboard/index.js +7 -6
  64. package/dist/types/analytics-protocol.d.ts +0 -4
  65. package/dist/types/briefings.d.ts +216 -19
  66. package/dist/types/dashboard-assistant.d.ts +0 -2
  67. package/dist/types/dashboard-authoring.d.ts +34 -9
  68. package/dist/types/dashboard.d.ts +93 -9
  69. package/dist/types/data-app-builder.d.ts +0 -1
  70. package/dist/types/data-app-codegen-node.d.ts +6 -28
  71. package/dist/types/data-app-codegen.d.ts +6 -28
  72. package/dist/types/data-app-sdk-adapters.d.ts +6 -28
  73. package/dist/types/data-app-sdk-validation.d.ts +6 -29
  74. package/dist/types/data-app-sdk.d.ts +6 -31
  75. package/dist/types/format-utils.d.ts +128 -4
  76. package/dist/types/index.cjs +1 -1
  77. package/dist/types/index.js +10 -13
  78. package/dist/types/main.d.ts +249 -89
  79. package/dist/types/report-runtime-context.d.ts +99 -0
  80. package/dist/types/shared.d.ts +34 -9
  81. package/dist/types/surfboard.d.ts +119 -16
  82. package/dist/types/types.d.ts +156 -73
  83. package/dist/types/value-format-preferences.d.ts +126 -0
  84. package/dist/value-format-preferences/index.cjs +1 -0
  85. package/dist/value-format-preferences/index.js +635 -0
  86. package/package.json +11 -1
  87. package/dist/chunks/analyze-result-contract-ege_u6Nl.js +0 -1
  88. package/dist/chunks/calendar-preferences-dialog-BF9bNAF_.js +0 -457
  89. package/dist/chunks/calendar-preferences-dialog-_L9eBQfj.js +0 -1
  90. package/dist/chunks/code-editor-BoowcKU0.js +0 -138
  91. package/dist/chunks/dashboard-CMDXBLnG.js +0 -1402
  92. package/dist/chunks/dashboard-json-BEZrxx_k.js +0 -1
  93. package/dist/chunks/date-formatter-BTTYdAik.js +0 -1
  94. package/dist/chunks/date-formatter-D-89jTjG.js +0 -514
  95. package/dist/chunks/edit-dashboard-visual-D3uhqgm3.js +0 -182
  96. package/dist/chunks/validators-B4VMLX3_.js +0 -1
@@ -164,6 +164,45 @@ declare const BRIEFING_ARTIFACT_FORMATS: readonly ["markdown", "html"];
164
164
 
165
165
  declare const BRIEFING_KIND: "BRIEFING";
166
166
 
167
+ declare type BriefingAppearanceColorTokens = Partial<{
168
+ background: string;
169
+ foreground: string;
170
+ muted: string;
171
+ mutedForeground: string;
172
+ border: string;
173
+ primary: string;
174
+ primaryForeground: string;
175
+ positive: string;
176
+ negative: string;
177
+ warning: string;
178
+ info: string;
179
+ }>;
180
+
181
+ declare type BriefingAppearanceScheme = {
182
+ tokens?: BriefingAppearanceTokens;
183
+ components?: {
184
+ chart?: {
185
+ palette?: string[];
186
+ };
187
+ };
188
+ };
189
+
190
+ declare type BriefingAppearanceSpec = {
191
+ version?: number;
192
+ schemes?: {
193
+ light?: BriefingAppearanceScheme;
194
+ dark?: BriefingAppearanceScheme;
195
+ };
196
+ };
197
+
198
+ declare type BriefingAppearanceTokens = {
199
+ color?: BriefingAppearanceColorTokens;
200
+ typography?: {
201
+ fontFamily?: string;
202
+ monoFontFamily?: string;
203
+ };
204
+ };
205
+
167
206
  export declare type BriefingArtifactFormat = 'markdown' | 'html';
168
207
 
169
208
  declare type BriefingArtifactFormat_2 = (typeof BRIEFING_ARTIFACT_FORMATS)[number];
@@ -288,8 +327,18 @@ export declare type BriefingFormatProfile = 'concise' | 'balanced' | 'detailed';
288
327
 
289
328
  declare type BriefingFormatProfile_2 = 'concise' | 'balanced' | 'detailed';
290
329
 
330
+ declare type BriefingFragments = {
331
+ preHeaderText?: string;
332
+ headerBannerHtml?: string;
333
+ signatureHtml?: string;
334
+ footerHtml?: string;
335
+ disclaimerHtml?: string;
336
+ unsubscribeUrl?: string;
337
+ };
338
+
291
339
  export declare type BriefingJobConfig = {
292
340
  kind: BriefingKind;
341
+ reportContext: ReportRuntimeContext;
293
342
  source: BriefingSource;
294
343
  body: BriefingBody;
295
344
  attachments: BriefingAttachment[];
@@ -301,6 +350,7 @@ export declare type BriefingKind = typeof BRIEFING_KIND;
301
350
 
302
351
  export declare type BriefingLimits = {
303
352
  maxToolCalls?: number;
353
+ maxPlanningIterations?: number;
304
354
  maxRows?: number;
305
355
  timeoutMs?: number;
306
356
  };
@@ -350,6 +400,10 @@ export declare type BriefingPresentation = {
350
400
  audience?: string;
351
401
  tone?: string;
352
402
  format?: string;
403
+ appearance?: BriefingAppearanceSpec;
404
+ brandOverrides?: BriefingThemeOverrides;
405
+ fragments?: BriefingFragments;
406
+ viewUrl?: string;
353
407
  };
354
408
 
355
409
  export declare type BriefingPreviewPlan = {
@@ -529,6 +583,12 @@ export declare type BriefingTenantSummary = {
529
583
  latestRunStatus: BriefingRunStatus | string | null;
530
584
  };
531
585
 
586
+ declare type BriefingThemeOverrides = {
587
+ brandName?: string;
588
+ logoUrl?: string;
589
+ link?: string;
590
+ };
591
+
532
592
  declare type BriefingWebhookConfig = {
533
593
  url: string;
534
594
  method?: 'POST' | 'PUT';
@@ -613,33 +673,13 @@ export declare interface CalculatedFieldFormula {
613
673
  */
614
674
  export declare type CalculatedFieldOperation = 'sum' | 'difference' | 'product' | 'ratio' | 'change' | 'percentage' | 'scale' | 'custom';
615
675
 
616
- /**
617
- * Calendar context for timezone-aware date operations.
618
- * Controls how dates are interpreted, grouped, and displayed.
619
- */
620
676
  export declare type CalendarContext = {
621
- /**
622
- * IANA timezone identifier.
623
- * @example 'America/Chicago', 'Europe/London', 'Asia/Tokyo', 'UTC'
624
- * @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
625
- */
626
677
  tz: string;
627
- /**
628
- * Day the week starts on.
629
- * 0 = Sunday (US, Canada, Japan)
630
- * 1 = Monday (ISO standard, most of Europe)
631
- * 6 = Saturday (Middle East)
632
- * @default 1 (Monday) for backward compatibility
633
- */
634
678
  weekStart: WeekStart;
635
- /**
636
- * Date anchor for relative date calculations.
637
- * - 'now': Use current time (default, live dashboards)
638
- * - { iso: string }: Fixed ISO 8601 date for reproducible views
639
- */
640
679
  anchor: 'now' | {
641
680
  iso: string;
642
681
  };
682
+ fiscalCalendar?: MonthAlignedFiscalCalendar;
643
683
  };
644
684
 
645
685
  export declare type CancelBriefingPreviewRunResponse = {
@@ -841,12 +881,17 @@ declare interface ColumnSettings {
841
881
  totalsLabel?: string;
842
882
  numberFormat: {
843
883
  style: 'decimal' | 'currency' | 'percent' | 'scientific';
844
- currency: string;
845
- locale: string;
846
- minimumFractionDigits: number;
847
- maximumFractionDigits: number;
884
+ currency?: string;
885
+ locale?: string;
886
+ minimumFractionDigits?: number;
887
+ maximumFractionDigits?: number;
848
888
  useGrouping?: boolean;
849
889
  percentValueMode?: 'fraction' | 'whole';
890
+ scale?: number;
891
+ compact?: boolean;
892
+ negativeStyle?: 'minus' | 'parentheses';
893
+ prefix?: string;
894
+ suffix?: string;
850
895
  showDataBar: boolean;
851
896
  dataBarColor: string;
852
897
  dataBarMinValue?: number;
@@ -872,8 +917,6 @@ declare interface ColumnSettings {
872
917
  colorRanges: ColorRange_2[];
873
918
  }
874
919
 
875
- declare type ColumnSettingsMap = Record<string, ColumnSettings>;
876
-
877
920
  declare type ColumnTextWrap = 'default' | 'truncate' | 'wrap' | 'nowrap' | 'preserve';
878
921
 
879
922
  declare type ColumnType = 'string' | 'number' | 'date';
@@ -1021,7 +1064,7 @@ export declare type ControlBinding = {
1021
1064
  controlId: string;
1022
1065
  target: 'config_grain';
1023
1066
  mapping: Record<string, string>;
1024
- };
1067
+ } | CurrencyPresentationBinding;
1025
1068
 
1026
1069
  export declare type ControlDashboardInput = DashboardInputBase & {
1027
1070
  kind: 'control';
@@ -1090,6 +1133,23 @@ export declare type CreateBriefingRequest = {
1090
1133
  deliveryConfig: BriefingDeliveryConfig | null;
1091
1134
  };
1092
1135
 
1136
+ export declare type CurrencyPresentationBinding = {
1137
+ controlId: string;
1138
+ target: 'presentation_currency';
1139
+ presentationTarget: CurrencyPresentationTarget;
1140
+ };
1141
+
1142
+ export declare type CurrencyPresentationTarget = {
1143
+ kind: 'metric';
1144
+ metricId: string;
1145
+ } | {
1146
+ kind: 'column';
1147
+ columnKey: string;
1148
+ } | {
1149
+ kind: 'matrix_measure';
1150
+ measureId: string;
1151
+ };
1152
+
1093
1153
  export declare type CustomCard = CardWithContent | CardWithFooter;
1094
1154
 
1095
1155
  declare type DashboardAIContext = AIContext & {
@@ -1400,10 +1460,6 @@ export declare type DateSelectionMode = 'range' | 'months';
1400
1460
 
1401
1461
  export declare type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
1402
1462
 
1403
- /**
1404
- * Default CalendarContext when not provided.
1405
- * Used as fallback for backward compatibility.
1406
- */
1407
1463
  export declare const DEFAULT_CALENDAR_CONTEXT: CalendarContext;
1408
1464
 
1409
1465
  export declare const DEFAULT_SEMANTIC_DOMAIN_ACCESS: SemanticDomainAccess;
@@ -2120,6 +2176,7 @@ export declare type FormatSpec = {
2120
2176
 
2121
2177
  export declare type GetDashboardResponse = {
2122
2178
  dashboard: TDashboard;
2179
+ initialReportContext: ReportRuntimeContext;
2123
2180
  lenses: TLens[];
2124
2181
  filterValues?: TFilterValue[] | null;
2125
2182
  inputValues?: LensInputValuesSnapshot | null;
@@ -2348,6 +2405,8 @@ export declare type LoadingProps = {
2348
2405
  message?: string;
2349
2406
  };
2350
2407
 
2408
+ declare type LocaleStyle = 'short' | 'medium' | 'long';
2409
+
2351
2410
  export declare type LogicalOperator = 'AND' | 'OR';
2352
2411
 
2353
2412
  /**
@@ -2561,7 +2620,6 @@ declare type MatrixResultCell = {
2561
2620
  columnId?: string;
2562
2621
  measureId: string;
2563
2622
  value: unknown;
2564
- formattedValue?: string;
2565
2623
  presence: MatrixCellPresence;
2566
2624
  role: MatrixCellRole;
2567
2625
  calculationId?: string;
@@ -2662,6 +2720,11 @@ export declare interface MetricField extends Field {
2662
2720
  semanticComparisonPolarity?: MetricComparisonPolarity;
2663
2721
  }
2664
2722
 
2723
+ declare type MonthAlignedFiscalCalendar = {
2724
+ kind: 'month_aligned';
2725
+ yearStartMonth: number;
2726
+ };
2727
+
2665
2728
  declare type NoneOptions = {};
2666
2729
 
2667
2730
  export declare type NumberAxisFormat = {
@@ -2749,6 +2812,12 @@ declare type Params = {
2749
2812
  [key: string]: string | number | string[] | number[];
2750
2813
  };
2751
2814
 
2815
+ declare type PersistedColumnSettings = Omit<Partial<ColumnSettings>, 'numberFormat'> & {
2816
+ numberFormat?: Partial<ColumnSettings['numberFormat']>;
2817
+ };
2818
+
2819
+ declare type PersistedColumnSettingsMap = Record<string, PersistedColumnSettings>;
2820
+
2752
2821
  declare type PersistedInteraction = Interaction & {
2753
2822
  id?: string;
2754
2823
  };
@@ -2897,6 +2966,26 @@ export declare type RelativeDateFilter = {
2897
2966
 
2898
2967
  export declare type RelativeDateUnit = DateUnit | SubDayDateUnit;
2899
2968
 
2969
+ declare const REPORT_PREFERENCE_SOURCES: readonly ["viewer_user", "viewer_tenant_user", "session_initial", "viewer_tenant", "viewer_organization", "system_default"];
2970
+
2971
+ declare type ReportPreferenceSource = (typeof REPORT_PREFERENCE_SOURCES)[number];
2972
+
2973
+ declare type ReportPreferenceSources = {
2974
+ calendar: ResolvedCalendarPreferenceSources;
2975
+ valueFormat: ResolvedValueFormatPreferenceSources;
2976
+ };
2977
+
2978
+ declare type ReportRuntimeContext = {
2979
+ calendar: CalendarContext;
2980
+ valueFormat: ResolvedValueFormatPreferences;
2981
+ preferenceSources: ReportPreferenceSources;
2982
+ };
2983
+
2984
+ declare type ResolvedCalendarPreferenceSources = {
2985
+ tz: ReportPreferenceSource;
2986
+ weekStart: ReportPreferenceSource;
2987
+ };
2988
+
2900
2989
  export declare type ResolvedDashboardDateComparisonInput = {
2901
2990
  inputId: string;
2902
2991
  filterId: string;
@@ -2972,20 +3061,24 @@ declare type ResolvedPrimaryDateField = {
2972
3061
  supportedGranularities?: TimeGranularity[];
2973
3062
  } | null;
2974
3063
 
2975
- /**
2976
- * Parameters in JWT payload (after backend resolution).
2977
- * The backend ALWAYS includes calendarContext, even if customer didn't provide it.
2978
- */
2979
- export declare type ResolvedTokenParams = Omit<TokenParams, 'calendarContext'> & {
2980
- /**
2981
- * Full calendar context for timezone-aware operations.
2982
- * ALWAYS present in JWT - resolved by backend from:
2983
- * 1. Token request calendarContext (highest priority)
2984
- * 2. Token request timezone (legacy)
2985
- * 3. User/Tenant/Org preferences (Phase 7)
2986
- * 4. Default: { tz: 'UTC', weekStart: 1, anchor: 'now' }
2987
- */
2988
- calendarContext: CalendarContext;
3064
+ declare type ResolvedValueFormatPreferences = {
3065
+ locale: string;
3066
+ dateStyle: LocaleStyle;
3067
+ dateTime: {
3068
+ dateStyle: LocaleStyle;
3069
+ timeStyle: LocaleStyle;
3070
+ };
3071
+ defaultCurrency: string;
3072
+ };
3073
+
3074
+ declare type ResolvedValueFormatPreferenceSources = {
3075
+ locale: ReportPreferenceSource;
3076
+ dateStyle: ReportPreferenceSource;
3077
+ dateTime: {
3078
+ dateStyle: ReportPreferenceSource;
3079
+ timeStyle: ReportPreferenceSource;
3080
+ };
3081
+ defaultCurrency: ReportPreferenceSource;
2989
3082
  };
2990
3083
 
2991
3084
  export declare type RunBriefingNowRequest = {
@@ -3362,7 +3455,6 @@ declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' |
3362
3455
 
3363
3456
  declare type SemaphorValueFormat = {
3364
3457
  type: 'number' | 'currency' | 'percent' | 'percentage' | 'scientific';
3365
- locale?: string;
3366
3458
  minimumFractionDigits?: number;
3367
3459
  maximumFractionDigits?: number;
3368
3460
  useGrouping?: boolean;
@@ -3574,7 +3666,7 @@ declare type TableHeaderStyle = 'plain' | 'filled' | 'accent';
3574
3666
  declare type TablePart = 'body' | 'header' | 'footer' | 'subtotal' | 'grandTotal';
3575
3667
 
3576
3668
  declare type TablePreferences = {
3577
- columnSettingsMap?: ColumnSettingsMap;
3669
+ columnSettingsMap?: PersistedColumnSettingsMap;
3578
3670
  baseFormatting?: TableBaseFormatting;
3579
3671
  conditionalFormatting?: TableConditionalFormatting;
3580
3672
  selectColumnVisible?: boolean;
@@ -4404,19 +4496,6 @@ export declare type TLineStyle = 'solid' | 'dashed' | 'dotted' | 'dash-dot';
4404
4496
  * This is used for token REQUEST (customer provides these).
4405
4497
  */
4406
4498
  export declare type TokenParams = {
4407
- /**
4408
- * Currency formatting options.
4409
- */
4410
- currencyFormat?: {
4411
- /**
4412
- * Locale identifier (e.g., 'en-US', 'fr-FR').
4413
- */
4414
- locale: string;
4415
- /**
4416
- * Currency code compliant with ISO 4217 (e.g., 'USD', 'EUR').
4417
- */
4418
- currency: string;
4419
- };
4420
4499
  /**
4421
4500
  * IANA timezone identifier for date operations.
4422
4501
  * @deprecated Use calendarContext.tz instead for full calendar control.
@@ -4424,11 +4503,11 @@ export declare type TokenParams = {
4424
4503
  */
4425
4504
  timezone?: string;
4426
4505
  /**
4427
- * Full calendar context for timezone-aware operations.
4428
- * Optional in token request - the backend ALWAYS resolves and includes
4429
- * this in the JWT, even when the customer doesn't provide it.
4506
+ * Optional developer-authored Calendar seed for the report session.
4507
+ * The resolved viewer state is delivered by dashboard bootstrap instead.
4430
4508
  */
4431
4509
  calendarContext?: CalendarContext;
4510
+ valueFormatPreferences?: ValueFormatPreferences;
4432
4511
  };
4433
4512
 
4434
4513
  /**
@@ -4496,9 +4575,9 @@ export declare type TokenProps = {
4496
4575
  rcls?: TokenSecurityPolicy[] | TokenSecurityPolicy;
4497
4576
  /**
4498
4577
  * Parameter overrides and preferences (e.g., formatting).
4499
- * Uses ResolvedTokenParams because backend ALWAYS includes calendarContext.
4578
+ * These are developer-authored initial inputs, not resolved viewer state.
4500
4579
  */
4501
- params?: ResolvedTokenParams;
4580
+ params?: TokenParams;
4502
4581
  /**
4503
4582
  * UI behavior and feature flags.
4504
4583
  */
@@ -4791,6 +4870,16 @@ export declare interface UserPreference {
4791
4870
  updatedAt: string;
4792
4871
  }
4793
4872
 
4873
+ declare type ValueFormatPreferences = {
4874
+ locale?: string;
4875
+ dateStyle?: LocaleStyle;
4876
+ dateTime?: {
4877
+ dateStyle?: LocaleStyle;
4878
+ timeStyle?: LocaleStyle;
4879
+ };
4880
+ defaultCurrency?: string;
4881
+ };
4882
+
4794
4883
  declare type ViewerPeriodComparisonSpec = Extract<MetricComparisonSpec, {
4795
4884
  kind: 'previous_period' | 'previous_year';
4796
4885
  }>;
@@ -4831,12 +4920,6 @@ export declare type VisualDisplayPreferences = {
4831
4920
  };
4832
4921
  };
4833
4922
 
4834
- /**
4835
- * Week start day type.
4836
- * 0 = Sunday (US, Canada, Japan)
4837
- * 1 = Monday (ISO standard, most of Europe)
4838
- * 6 = Saturday (Middle East)
4839
- */
4840
4923
  export declare type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
4841
4924
 
4842
4925
  export declare type WindowFunction = 'running_total' | 'moving_average' | 'previous_period_delta' | 'percent_of_total';
@@ -0,0 +1,126 @@
1
+ export declare function applyValueFormatPreferenceMutation(stored: unknown, request: unknown): MutationResult;
2
+
3
+ export declare function canonicalizeSupportedCurrencyCode(input: unknown): string | undefined;
4
+
5
+ export declare function canonicalizeSupportedLocale(input: unknown): string | undefined;
6
+
7
+ export declare function decodeStoredValueFormatPreferences(input: unknown, scope: StoredScope): {
8
+ value: ValueFormatPreferences | null;
9
+ diagnostics: StoredValueFormatPreferenceDiagnostic[];
10
+ };
11
+
12
+ export declare const DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES: ResolvedValueFormatPreferences;
13
+
14
+ export declare function getSupportedCurrencyCodes(): readonly string[];
15
+
16
+ export declare function isReportPreferenceSource(value: unknown): value is ReportPreferenceSource;
17
+
18
+ export declare type LocaleStyle = 'short' | 'medium' | 'long';
19
+
20
+ declare type MutationResult = {
21
+ ok: true;
22
+ value: ValueFormatPreferences | null;
23
+ } | {
24
+ ok: false;
25
+ issues: ValueFormatPreferenceValidationIssue[];
26
+ };
27
+
28
+ declare type ParseResult = {
29
+ ok: true;
30
+ value: ValueFormatPreferences;
31
+ } | {
32
+ ok: false;
33
+ issues: ValueFormatPreferenceValidationIssue[];
34
+ };
35
+
36
+ export declare function parseValueFormatPreferences(input: unknown): ParseResult;
37
+
38
+ export declare function parseValueFormatPreferencesResponse(input: unknown): ValueFormatPreferencesResponseParseResult;
39
+
40
+ export declare const REPORT_PREFERENCE_SOURCES: readonly ["viewer_user", "viewer_tenant_user", "session_initial", "viewer_tenant", "viewer_organization", "system_default"];
41
+
42
+ export declare type ReportPreferenceSource = (typeof REPORT_PREFERENCE_SOURCES)[number];
43
+
44
+ export declare type ResolvedValueFormatPreferences = {
45
+ locale: string;
46
+ dateStyle: LocaleStyle;
47
+ dateTime: {
48
+ dateStyle: LocaleStyle;
49
+ timeStyle: LocaleStyle;
50
+ };
51
+ defaultCurrency: string;
52
+ };
53
+
54
+ export declare type ResolvedValueFormatPreferenceSources = {
55
+ locale: ReportPreferenceSource;
56
+ dateStyle: ReportPreferenceSource;
57
+ dateTime: {
58
+ dateStyle: ReportPreferenceSource;
59
+ timeStyle: ReportPreferenceSource;
60
+ };
61
+ defaultCurrency: ReportPreferenceSource;
62
+ };
63
+
64
+ export declare function resolveValueFormatPreferences(layers: {
65
+ user?: unknown;
66
+ tenantUser?: unknown;
67
+ sessionInitial?: ValueFormatPreferences | null;
68
+ tenant?: unknown;
69
+ organization?: unknown;
70
+ }): {
71
+ preferences: ResolvedValueFormatPreferences;
72
+ sources: ResolvedValueFormatPreferenceSources;
73
+ diagnostics: StoredValueFormatPreferenceDiagnostic[];
74
+ };
75
+
76
+ declare type StoredScope = StoredValueFormatPreferenceDiagnostic['scope'];
77
+
78
+ export declare type StoredValueFormatPreferenceDiagnostic = {
79
+ scope: 'viewer_user' | 'viewer_tenant_user' | 'viewer_tenant' | 'viewer_organization';
80
+ path: ValueFormatPreferencePath | '$';
81
+ code: 'invalid_stored_preference';
82
+ };
83
+
84
+ export declare type UpdateValueFormatPreferencesRequest = {
85
+ set?: ValueFormatPreferences;
86
+ clear?: ValueFormatPreferencePath[];
87
+ };
88
+
89
+ export declare type ValueFormatPreferencePath = 'locale' | 'dateStyle' | 'dateTime.dateStyle' | 'dateTime.timeStyle' | 'defaultCurrency';
90
+
91
+ export declare type ValueFormatPreferences = {
92
+ locale?: string;
93
+ dateStyle?: LocaleStyle;
94
+ dateTime?: {
95
+ dateStyle?: LocaleStyle;
96
+ timeStyle?: LocaleStyle;
97
+ };
98
+ defaultCurrency?: string;
99
+ };
100
+
101
+ export declare type ValueFormatPreferencesResponse = {
102
+ stored: ValueFormatPreferences | null;
103
+ inherited: ResolvedValueFormatPreferences;
104
+ inheritedSources: ResolvedValueFormatPreferenceSources;
105
+ resolved: ResolvedValueFormatPreferences;
106
+ sources: ResolvedValueFormatPreferenceSources;
107
+ diagnostics: StoredValueFormatPreferenceDiagnostic[];
108
+ };
109
+
110
+ export declare type ValueFormatPreferencesResponseParseResult = {
111
+ ok: true;
112
+ value: ValueFormatPreferencesResponse;
113
+ } | {
114
+ ok: false;
115
+ issues: ValueFormatPreferenceValidationIssue[];
116
+ };
117
+
118
+ export declare type ValueFormatPreferenceValidationIssue = {
119
+ path: string;
120
+ code: ValueFormatPreferenceValidationIssueCode;
121
+ message: string;
122
+ };
123
+
124
+ export declare type ValueFormatPreferenceValidationIssueCode = 'invalid_type' | 'unknown_property' | 'invalid_locale' | 'unsupported_locale' | 'invalid_currency' | 'invalid_style' | 'empty_mutation' | 'duplicate_clear_path' | 'conflicting_operation';
125
+
126
+ export { }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S={locale:"en-US",dateStyle:"short",dateTime:{dateStyle:"short",timeStyle:"short"},defaultCurrency:"USD"},F=["viewer_user","viewer_tenant_user","session_initial","viewer_tenant","viewer_organization","system_default"],j=new Set(F);function v(e){return typeof e=="string"&&j.has(e)}const L=["locale","dateStyle","dateTime","defaultCurrency"],E=["dateStyle","timeStyle"],D=["stored","inherited","inheritedSources","resolved","sources","diagnostics"],z=["locale","dateStyle","dateTime","defaultCurrency"],N=["scope","path","code"],g=["locale","dateStyle","dateTime.dateStyle","dateTime.timeStyle","defaultCurrency"],M=["short","medium","long"];let _,C;function f(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function i(e,t,r){return{path:e,code:t,message:r}}function O(e,t){if(typeof e!="string")return{ok:!1,issue:i(t,"invalid_type",`${t} must be a string`)};const r=e.trim();let s;try{s=Intl.getCanonicalLocales(r)[0]??""}catch{return{ok:!1,issue:i(t,"invalid_locale",`${t} must be a valid BCP 47 locale`)}}if(!s||new Intl.Locale(s).baseName!==s)return{ok:!1,issue:i(t,"invalid_locale",`${t} must be a base BCP 47 locale without extensions`)};const a=Intl.DateTimeFormat.supportedLocalesOf([s]).length===1,n=Intl.NumberFormat.supportedLocalesOf([s]).length===1;return!a||!n?{ok:!1,issue:i(t,"unsupported_locale",`${t} is not supported by this runtime`)}:{ok:!0,value:s}}function Y(e){const t=O(e,"locale");return t.ok?t.value:void 0}function V(){if(_)return _;const e=Intl.supportedValuesOf;if(typeof e!="function")throw new Error('This runtime does not support Intl.supportedValuesOf("currency")');return _=new Set(e.call(Intl,"currency")),_}function K(){return C||(C=Object.freeze([...V()].sort((e,t)=>e.localeCompare(t)))),C}function A(e){if(typeof e!="string")return;const t=e.trim().toUpperCase();return V().has(t)?t:void 0}function I(e,t){if(typeof e!="string")return{ok:!1,issue:i(t,"invalid_type",`${t} must be a string`)};const r=A(e);return r?{ok:!0,value:r}:{ok:!1,issue:i(t,"invalid_currency",`${t} must be a supported ISO 4217 currency code`)}}function T(e,t){return typeof e!="string"?{ok:!1,issue:i(t,"invalid_type",`${t} must be a string`)}:M.includes(e)?{ok:!0,value:e}:{ok:!1,issue:i(t,"invalid_style",`${t} must be short, medium, or long`)}}function m(e,t,r=""){const s=new Set(t);return Object.keys(e).filter(a=>!s.has(a)).sort().map(a=>{const n=r?`${r}.${a}`:a;return i(n,"unknown_property",`${n} is not a recognized preference property`)})}function h(e){if(!f(e))return{ok:!1,issues:[i("$","invalid_type","Value format preferences must be a plain object")]};const t=m(e,L),r={};if(d(e,"locale")){const s=O(e.locale,"locale");s.ok?r.locale=s.value:t.push(s.issue)}if(d(e,"dateStyle")){const s=T(e.dateStyle,"dateStyle");s.ok?r.dateStyle=s.value:t.push(s.issue)}if(d(e,"dateTime"))if(!f(e.dateTime))t.push(i("dateTime","invalid_type","dateTime must be a plain object"));else{t.push(...m(e.dateTime,E,"dateTime"));const s={};if(d(e.dateTime,"dateStyle")){const a=T(e.dateTime.dateStyle,"dateTime.dateStyle");a.ok?s.dateStyle=a.value:t.push(a.issue)}if(d(e.dateTime,"timeStyle")){const a=T(e.dateTime.timeStyle,"dateTime.timeStyle");a.ok?s.timeStyle=a.value:t.push(a.issue)}Object.keys(s).length>0&&(r.dateTime=s)}if(d(e,"defaultCurrency")){const s=I(e.defaultCurrency,"defaultCurrency");s.ok?r.defaultCurrency=s.value:t.push(s.issue)}return t.length>0?{ok:!1,issues:t}:{ok:!0,value:r}}function b(e,t){var a;const r=h(e);if(!r.ok)return{ok:!1,issues:r.issues.map(n=>({...n,path:n.path==="$"?t:`${t}.${n.path}`}))};const s=r.value;return!s.locale||!s.dateStyle||!((a=s.dateTime)!=null&&a.dateStyle)||!s.dateTime.timeStyle||!s.defaultCurrency?{ok:!1,issues:[i(t,"invalid_type",`${t} must contain every resolved preference`)]}:{ok:!0,value:{locale:s.locale,dateStyle:s.dateStyle,dateTime:s.dateTime,defaultCurrency:s.defaultCurrency}}}function w(e,t){if(!f(e))return{ok:!1,issues:[i(t,"invalid_type",`${t} must contain a valid source for every preference`)]};const r=m(e,z,t);f(e.dateTime)?r.push(...m(e.dateTime,E,`${t}.dateTime`)):r.push(i(`${t}.dateTime`,"invalid_type",`${t}.dateTime must contain valid date and time sources`));const s=f(e.dateTime)?e.dateTime:void 0,a=v(e.locale)?e.locale:void 0,n=v(e.dateStyle)?e.dateStyle:void 0,o=v(s==null?void 0:s.dateStyle)?s.dateStyle:void 0,l=v(s==null?void 0:s.timeStyle)?s.timeStyle:void 0,u=v(e.defaultCurrency)?e.defaultCurrency:void 0;return(!a||!n||!o||!l||!u)&&r.push(i(t,"invalid_type",`${t} must contain a valid source for every preference`)),r.length>0||!s||!a||!n||!o||!l||!u?{ok:!1,issues:r}:{ok:!0,value:{locale:a,dateStyle:n,dateTime:{dateStyle:o,timeStyle:l},defaultCurrency:u}}}const B=new Set(["viewer_user","viewer_tenant_user","viewer_tenant","viewer_organization"]),G=new Set(g);function H(e){if(!Array.isArray(e))return{ok:!1,issues:[i("diagnostics","invalid_type","diagnostics must be an array")]};const t=[],r=[];return e.forEach((s,a)=>{const n=f(s)?m(s,N,`diagnostics.${a}`):[];if(r.push(...n),!f(s)||n.length>0||typeof s.scope!="string"||!B.has(s.scope)||s.path!=="$"&&!G.has(s.path)||s.code!=="invalid_stored_preference"){r.push(i(`diagnostics.${a}`,"invalid_type","diagnostic entry is invalid"));return}t.push(s)}),r.length>0?{ok:!1,issues:r}:{ok:!0,value:t}}function x(e){if(!f(e))return{ok:!1,issues:[i("$","invalid_type","Value format preference response must be a plain object")]};const t=m(e,D),r=e.stored===null?{ok:!0,value:null}:h(e.stored),s=b(e.inherited,"inherited"),a=b(e.resolved,"resolved"),n=w(e.inheritedSources,"inheritedSources"),o=w(e.sources,"sources"),l=H(e.diagnostics),u=[...t,...r.ok?[]:r.issues,...s.ok?[]:s.issues,...a.ok?[]:a.issues,...n.ok?[]:n.issues,...o.ok?[]:o.issues,...l.ok?[]:l.issues];return u.length>0||!r.ok||!s.ok||!a.ok||!n.ok||!o.ok||!l.ok?{ok:!1,issues:u}:{ok:!0,value:{stored:r.value,inherited:s.value,inheritedSources:n.value,resolved:a.value,sources:o.value,diagnostics:l.value}}}function k(e){var r,s;const t=new Set;return e.locale!==void 0&&t.add("locale"),e.dateStyle!==void 0&&t.add("dateStyle"),((r=e.dateTime)==null?void 0:r.dateStyle)!==void 0&&t.add("dateTime.dateStyle"),((s=e.dateTime)==null?void 0:s.timeStyle)!==void 0&&t.add("dateTime.timeStyle"),e.defaultCurrency!==void 0&&t.add("defaultCurrency"),t}function W(e,t){return{...e,...t.locale!==void 0?{locale:t.locale}:{},...t.dateStyle!==void 0?{dateStyle:t.dateStyle}:{},...t.dateTime?{dateTime:{...e.dateTime,...t.dateTime}}:{},...t.defaultCurrency!==void 0?{defaultCurrency:t.defaultCurrency}:{}}}function J(e,t){var s,a;const r={...e,...e.dateTime?{dateTime:{...e.dateTime}}:{}};for(const n of t)n==="locale"&&delete r.locale,n==="dateStyle"&&delete r.dateStyle,n==="dateTime.dateStyle"&&((s=r.dateTime)==null||delete s.dateStyle),n==="dateTime.timeStyle"&&((a=r.dateTime)==null||delete a.timeStyle),n==="defaultCurrency"&&delete r.defaultCurrency;return r.dateTime&&Object.keys(r.dateTime).length===0&&delete r.dateTime,r}function Q(e){if(e===void 0)return{paths:[],issues:[]};if(!Array.isArray(e))return{paths:[],issues:[i("clear","invalid_type","clear must be an array")]};const t=[],r=[],s=new Set;return e.forEach((a,n)=>{if(typeof a!="string"||!g.includes(a)){r.push(i(`clear.${n}`,typeof a=="string"?"unknown_property":"invalid_type",`clear.${n} must be a recognized preference path`));return}const o=a;if(s.has(o)){r.push(i(o,"duplicate_clear_path",`${o} appears more than once in clear`));return}s.add(o),t.push(o)}),{paths:t,issues:r}}function X(e,t){if(!f(t))return{ok:!1,issues:[i("$","invalid_type","Preference mutation must be a plain object")]};const r=m(t,["set","clear"]);let s={};if(t.set!==void 0){const u=h(t.set);u.ok?s=u.value:r.push(...u.issues)}const a=Q(t.clear);r.push(...a.issues);const n=k(s);r.length===0&&n.size===0&&a.paths.length===0&&r.push(i("$","empty_mutation","Preference mutation must set or clear at least one leaf"));for(const u of a.paths)n.has(u)&&r.push(i(u,"conflicting_operation",`${u} cannot be set and cleared in the same mutation`));if(r.length>0)return{ok:!1,issues:r};const o=Z(e),l=J(W(o??{},s),a.paths);return{ok:!0,value:k(l).size===0?null:l}}function $(e,t){return{scope:e,path:t,code:"invalid_stored_preference"}}function P(e,t){if(e==null)return{value:null,diagnostics:[]};if(!f(e))return{value:null,diagnostics:[$(t,"$")]};const r=new Set;Object.keys(e).some(o=>!L.includes(o))&&r.add("$");const s={};if(d(e,"locale")){const o=O(e.locale,"locale");o.ok?s.locale=o.value:r.add("locale")}if(d(e,"dateStyle")){const o=T(e.dateStyle,"dateStyle");o.ok?s.dateStyle=o.value:r.add("dateStyle")}if(d(e,"dateTime"))if(!f(e.dateTime))r.add("$");else{Object.keys(e.dateTime).some(l=>!E.includes(l))&&r.add("$");const o={};if(d(e.dateTime,"dateStyle")){const l=T(e.dateTime.dateStyle,"dateTime.dateStyle");l.ok?o.dateStyle=l.value:r.add("dateTime.dateStyle")}if(d(e.dateTime,"timeStyle")){const l=T(e.dateTime.timeStyle,"dateTime.timeStyle");l.ok?o.timeStyle=l.value:r.add("dateTime.timeStyle")}Object.keys(o).length>0&&(s.dateTime=o)}if(d(e,"defaultCurrency")){const o=I(e.defaultCurrency,"defaultCurrency");o.ok?s.defaultCurrency=o.value:r.add("defaultCurrency")}const n=["$",...g].filter(o=>r.has(o)).map(o=>$(t,o));return{value:k(s).size===0?null:s,diagnostics:n}}function Z(e){return P(e,"viewer_user").value}function q(e,t){return P(e,t)}function p(e,t,r){for(const s of e){if(!s.value)continue;const a=t(s.value);if(a!==void 0)return{value:a,source:s.source}}return{value:r,source:"system_default"}}function ee(e){if(e.user!==void 0&&e.tenantUser!==void 0)throw new TypeError("Value format preference resolution cannot include both user and tenantUser");const t=[],r=[],s=(c,y,U)=>{const R=P(c,y);t.push({value:R.value,source:U}),r.push(...R.diagnostics)};e.user!==void 0?s(e.user,"viewer_user","viewer_user"):e.tenantUser!==void 0&&s(e.tenantUser,"viewer_tenant_user","viewer_tenant_user"),e.sessionInitial&&t.push({value:e.sessionInitial,source:"session_initial"}),e.user===void 0&&(e.tenantUser!==void 0||e.tenant!==void 0)&&s(e.tenant,"viewer_tenant","viewer_tenant"),s(e.organization,"viewer_organization","viewer_organization");const a=p(t,c=>c.locale,S.locale),n=p(t,c=>c.dateStyle,S.dateStyle),o=p(t,c=>{var y;return(y=c.dateTime)==null?void 0:y.dateStyle},S.dateTime.dateStyle),l=p(t,c=>{var y;return(y=c.dateTime)==null?void 0:y.timeStyle},S.dateTime.timeStyle),u=p(t,c=>c.defaultCurrency,S.defaultCurrency);return{preferences:{locale:a.value,dateStyle:n.value,dateTime:{dateStyle:o.value,timeStyle:l.value},defaultCurrency:u.value},sources:{locale:a.source,dateStyle:n.source,dateTime:{dateStyle:o.source,timeStyle:l.source},defaultCurrency:u.source},diagnostics:r}}exports.DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES=S;exports.REPORT_PREFERENCE_SOURCES=F;exports.applyValueFormatPreferenceMutation=X;exports.canonicalizeSupportedCurrencyCode=A;exports.canonicalizeSupportedLocale=Y;exports.decodeStoredValueFormatPreferences=q;exports.getSupportedCurrencyCodes=K;exports.isReportPreferenceSource=v;exports.parseValueFormatPreferences=h;exports.parseValueFormatPreferencesResponse=x;exports.resolveValueFormatPreferences=ee;