impact-nova 2.5.6 → 2.5.8
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/components/data/ag-grid-react/ag-grid.types.d.ts +2 -2
- package/dist/components/data/ag-grid-react/headers/components/date-filter-picker.d.ts +4 -2
- package/dist/components/data/ag-grid-react/headers/header-search-input.js +65 -65
- package/dist/components/data/ag-grid-react/headers/utils/date-utils.js +55 -48
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +4 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +82 -51
- package/dist/components/data-display/calendar/calendar-config.d.ts +13 -5
- package/dist/components/data-display/calendar/calendar-config.js +31 -20
- package/dist/components/data-display/calendar/calendar-day-button.js +43 -35
- package/dist/components/data-display/calendar/calendar-day-hover.d.ts +8 -0
- package/dist/components/data-display/calendar/calendar-day-hover.js +20 -0
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.d.ts +8 -1
- package/dist/components/data-display/calendar/calendar-day-picker-classnames.js +40 -20
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +12 -1
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +199 -98
- package/dist/components/data-display/calendar/calendar-day-picker-view.d.ts +12 -4
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +139 -92
- package/dist/components/data-display/calendar/calendar-fiscal-labels.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-fiscal-labels.js +90 -0
- package/dist/components/data-display/calendar/calendar-footer-summary.d.ts +13 -4
- package/dist/components/data-display/calendar/calendar-footer-summary.js +101 -50
- package/dist/components/data-display/calendar/calendar-footer.d.ts +16 -7
- package/dist/components/data-display/calendar/calendar-footer.js +88 -66
- package/dist/components/data-display/calendar/calendar-gregorian-presets.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-gregorian-presets.js +26 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.d.ts +1 -0
- package/dist/components/data-display/calendar/calendar-interval-caption.js +10 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.d.ts +23 -0
- package/dist/components/data-display/calendar/calendar-interval-utils.js +154 -0
- package/dist/components/data-display/calendar/calendar-month-panes.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-panes.js +9 -7
- package/dist/components/data-display/calendar/calendar-month-picker-panel.d.ts +5 -1
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +76 -77
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-month-utils.js +69 -60
- package/dist/components/data-display/calendar/calendar-padding-week.utils.d.ts +15 -0
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +22 -3
- package/dist/components/data-display/calendar/calendar-panel-context.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar-period-cell.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-period-cell.js +89 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.d.ts +2 -0
- package/dist/components/data-display/calendar/calendar-period-keyboard.js +18 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.d.ts +6 -0
- package/dist/components/data-display/calendar/calendar-preset-strip.js +26 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.d.ts +24 -0
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +115 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.d.ts +19 -0
- package/dist/components/data-display/calendar/calendar-quarter-utils.js +95 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +38 -0
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +72 -0
- package/dist/components/data-display/calendar/calendar-selection.d.ts +20 -0
- package/dist/components/data-display/calendar/calendar-selection.js +31 -0
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +6 -1
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +53 -38
- package/dist/components/data-display/calendar/calendar-week-number-header.d.ts +4 -0
- package/dist/components/data-display/calendar/calendar-week-number-header.js +15 -0
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +11 -3
- package/dist/components/data-display/calendar/calendar-week-utils.js +50 -42
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +18 -0
- package/dist/components/data-display/calendar/calendar-year-panes.js +98 -0
- package/dist/components/data-display/calendar/calendar-year-utils.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-year-utils.js +75 -0
- package/dist/components/data-display/calendar/calendar.d.ts +1 -1
- package/dist/components/data-display/calendar/calendar.js +303 -181
- package/dist/components/data-display/calendar/calendar.types.d.ts +53 -16
- package/dist/components/data-display/calendar/fiscal-period-caption-select.d.ts +7 -0
- package/dist/components/data-display/calendar/fiscal-period-caption-select.js +63 -0
- package/dist/components/data-display/calendar/index.d.ts +1 -1
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +12 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +92 -62
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +32 -12
- package/dist/components/data-display/calendar/use-calendar-state.js +371 -164
- package/dist/components/data-display/calendar/use-fiscal-calendar.d.ts +5 -0
- package/dist/components/data-display/calendar/use-fiscal-calendar.js +24 -0
- package/dist/components/feedback/tooltip/overflow-tooltip.js +57 -57
- package/dist/components/flows/guidance/guidance-error-boundary.js +22 -14
- package/dist/components/flows/guidance/guidance-layer.js +34 -32
- package/dist/components/flows/guidance/help-center/assets/whats-new-guide-icon.svg.js +4 -0
- package/dist/components/flows/guidance/help-center/filter-help-center-guides.js +10 -7
- package/dist/components/flows/guidance/help-center/guide-catalog-section.d.ts +7 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-section.js +24 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-utils.d.ts +3 -0
- package/dist/components/flows/guidance/help-center/guide-catalog-utils.js +19 -0
- package/dist/components/flows/guidance/help-center/guide-catalog.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/guide-catalog.js +89 -79
- package/dist/components/flows/guidance/help-center/help-center-guide-labels.d.ts +6 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-labels.js +33 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-row.d.ts +12 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-row.js +57 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.d.ts +9 -0
- package/dist/components/flows/guidance/help-center/help-center-guide-type-icons.js +114 -0
- package/dist/components/flows/guidance/help-center/help-center-header.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/help-center-header.js +20 -16
- package/dist/components/flows/guidance/help-center/help-center.constants.d.ts +1 -1
- package/dist/components/flows/guidance/help-center/help-center.constants.js +1 -1
- package/dist/components/flows/guidance/help-center/help-center.d.ts +3 -1
- package/dist/components/flows/guidance/help-center/help-center.js +74 -51
- package/dist/components/flows/guidance/help-center/help-center.types.d.ts +9 -1
- package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.d.ts +4 -0
- package/dist/components/flows/guidance/help-center/renderHelpCenterGuideTypeIcon.js +18 -0
- package/dist/components/flows/guidance/help-center.d.ts +4 -2
- package/dist/components/flows/guidance/help-center.js +23 -14
- package/dist/components/flows/guidance/hooks/useGuidanceOverlayGeometry.js +19 -17
- package/dist/components/flows/guidance/index.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/announcement-renderer.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/announcement-renderer.js +20 -12
- package/dist/components/flows/guidance/renderers/guidance-card-shared.d.ts +9 -11
- package/dist/components/flows/guidance/renderers/guidance-card-shared.js +124 -177
- package/dist/components/flows/guidance/renderers/guidance-renderer-shared.d.ts +1 -1
- package/dist/components/flows/guidance/renderers/guidance-renderer-shared.js +57 -72
- package/dist/components/flows/guidance/renderers/guidance-tour-overlay.js +23 -23
- package/dist/components/flows/wizard/wizard.js +41 -38
- package/dist/components/forms/date-picker/date-input-behavior.d.ts +7 -0
- package/dist/components/forms/date-picker/date-input-behavior.js +28 -24
- package/dist/components/forms/date-picker/date-picker-shell.d.ts +13 -0
- package/dist/components/forms/date-picker/date-picker-shell.js +31 -0
- package/dist/components/forms/date-picker/date-picker.js +187 -167
- package/dist/components/forms/date-picker/date-picker.types.d.ts +90 -43
- package/dist/components/forms/date-picker/date-range-picker.js +273 -224
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +13 -0
- package/dist/components/forms/date-picker/fiscal-pass-through.js +17 -0
- package/dist/components/forms/date-picker/fiscal-period-format.d.ts +9 -0
- package/dist/components/forms/date-picker/fiscal-period-format.js +50 -0
- package/dist/components/forms/date-picker/index.d.ts +12 -0
- package/dist/components/forms/date-picker/index.js +19 -7
- package/dist/components/forms/date-picker/month-picker.js +225 -182
- package/dist/components/forms/date-picker/month-range-picker.js +134 -110
- package/dist/components/forms/date-picker/multi-date-picker.js +77 -56
- package/dist/components/forms/date-picker/multi-month-picker.js +78 -57
- package/dist/components/forms/date-picker/multi-quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-quarter-picker.js +177 -0
- package/dist/components/forms/date-picker/multi-week-picker.js +81 -70
- package/dist/components/forms/date-picker/multi-year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/multi-year-picker.js +179 -0
- package/dist/components/forms/date-picker/quarter-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-picker.js +176 -0
- package/dist/components/forms/date-picker/quarter-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/quarter-range-picker.js +177 -0
- package/dist/components/forms/date-picker/week-picker.js +148 -137
- package/dist/components/forms/date-picker/week-range-picker.js +216 -205
- package/dist/components/forms/date-picker/year-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-picker.js +176 -0
- package/dist/components/forms/date-picker/year-range-picker.d.ts +3 -0
- package/dist/components/forms/date-picker/year-range-picker.js +179 -0
- package/dist/components/layout/horizontal-scroller/horizontal-scroller.js +35 -53
- package/dist/form-react/Fields/DateInputField.js +63 -58
- package/dist/form-react/Fields/DateRangeField.js +42 -37
- package/dist/form-react/Fields/MonthRangeField.js +50 -45
- package/dist/form-react/Fields/MultiWeekPickerField.js +7 -7
- package/dist/form-react/Fields/WeekRangePicker.js +44 -45
- package/dist/form-react/components/FieldRenderer.js +21 -23
- package/dist/form-react/registry/defaultFieldRegistrations.d.ts +9 -1
- package/dist/form-react/registry/defaultFieldRegistrations.js +11 -12
- package/dist/form-react/registry/resolveFieldComponent.d.ts +3 -2
- package/dist/form-react/registry/resolveFieldComponent.js +9 -133
- package/dist/form-react/types/fields.types.d.ts +22 -7
- package/dist/form-react/utils/date.utils.d.ts +3 -1
- package/dist/form-react/utils/date.utils.js +82 -53
- package/dist/i18n/defaultMessages.d.ts +29 -1
- package/dist/i18n/defaultMessages.js +54 -27
- package/dist/i18n/locales/de.js +31 -4
- package/dist/i18n/locales/es.js +31 -4
- package/dist/i18n/locales/hi.js +31 -4
- package/dist/i18n/locales/kn.js +31 -4
- package/dist/impact-nova-components.css +379 -3
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +528 -516
- package/dist/lib/fiscal-calendar/build-year.d.ts +8 -0
- package/dist/lib/fiscal-calendar/build-year.js +173 -0
- package/dist/lib/fiscal-calendar/civil-date.d.ts +21 -0
- package/dist/lib/fiscal-calendar/civil-date.js +94 -0
- package/dist/lib/fiscal-calendar/index.d.ts +10 -0
- package/dist/lib/fiscal-calendar/index.js +40 -0
- package/dist/lib/fiscal-calendar/lookup.d.ts +4 -0
- package/dist/lib/fiscal-calendar/lookup.js +70 -0
- package/dist/lib/fiscal-calendar/presets.d.ts +8 -0
- package/dist/lib/fiscal-calendar/presets.js +99 -0
- package/dist/lib/fiscal-calendar/selection.d.ts +18 -0
- package/dist/lib/fiscal-calendar/selection.js +32 -0
- package/dist/lib/fiscal-calendar/types.d.ts +145 -0
- package/dist/lib/fiscal-calendar/types.js +10 -0
- package/dist/lib/fiscal-calendar/week-selection.d.ts +22 -0
- package/dist/lib/fiscal-calendar/week-selection.js +107 -0
- package/dist/lib/guidance/engine/guidance-engine.d.ts +7 -5
- package/dist/lib/guidance/engine/guidance-engine.js +115 -47
- package/dist/lib/guidance/triggers/trigger-registry.js +6 -6
- package/dist/lib/guidance/types/guidance.types.d.ts +11 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +5 -1
- package/dist/lib/fiscal-calendar.d.ts +0 -62
- package/dist/lib/fiscal-calendar.js +0 -99
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless fiscal calendar types. No React. Civil dates are YYYY-MM-DD.
|
|
3
|
+
*/
|
|
4
|
+
export type CivilDate = string;
|
|
5
|
+
export type CalendarKind = "gregorian" | "fiscal";
|
|
6
|
+
export type FiscalMode = "basic" | "advanced" | "custom";
|
|
7
|
+
export type RetailPatternId = "4-4-5" | "4-5-4" | "5-4-4";
|
|
8
|
+
export type LeapWeekPolicy = "append-last-period" | "period-13";
|
|
9
|
+
export type FyLabelStyle = "fy-short" | "fy-long" | "ending-year" | "starting-year";
|
|
10
|
+
export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
+
/** Per-period week counts, e.g. [4,4,5,4,4,5,4,4,5,4,4,5] */
|
|
12
|
+
export type FiscalMonthPattern = number[];
|
|
13
|
+
export type FyAnchorRule = "on-or-before" | "closest-weekday";
|
|
14
|
+
export type FiscalCalendarConfig = {
|
|
15
|
+
kind: "shifted-year";
|
|
16
|
+
fyStartMonth: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
17
|
+
fyStartDay?: number;
|
|
18
|
+
fyLabel?: FyLabelStyle;
|
|
19
|
+
weekStartsOn?: Weekday;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "retail";
|
|
22
|
+
pattern: RetailPatternId | FiscalMonthPattern;
|
|
23
|
+
weekStartsOn: Weekday;
|
|
24
|
+
fyAnchor: {
|
|
25
|
+
month: number;
|
|
26
|
+
day: number;
|
|
27
|
+
rule: FyAnchorRule;
|
|
28
|
+
};
|
|
29
|
+
leapWeekPolicy?: LeapWeekPolicy;
|
|
30
|
+
fyLabel?: FyLabelStyle;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "custom-table";
|
|
33
|
+
periods: ReadonlyArray<{
|
|
34
|
+
fy: number;
|
|
35
|
+
period: number;
|
|
36
|
+
start: CivilDate;
|
|
37
|
+
end: CivilDate;
|
|
38
|
+
}>;
|
|
39
|
+
fyLabel?: FyLabelStyle;
|
|
40
|
+
weekStartsOn?: Weekday;
|
|
41
|
+
};
|
|
42
|
+
export interface FiscalWeek {
|
|
43
|
+
fy: number;
|
|
44
|
+
week: number;
|
|
45
|
+
start: CivilDate;
|
|
46
|
+
end: CivilDate;
|
|
47
|
+
period: number;
|
|
48
|
+
quarter: 1 | 2 | 3 | 4;
|
|
49
|
+
}
|
|
50
|
+
export interface FiscalPeriod {
|
|
51
|
+
fy: number;
|
|
52
|
+
period: number;
|
|
53
|
+
label: string;
|
|
54
|
+
displayLabel: string;
|
|
55
|
+
start: CivilDate;
|
|
56
|
+
end: CivilDate;
|
|
57
|
+
weekCount: number;
|
|
58
|
+
quarter: 1 | 2 | 3 | 4;
|
|
59
|
+
gregorianMonthSpan: ReadonlyArray<{
|
|
60
|
+
year: number;
|
|
61
|
+
month: number;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
export interface FiscalQuarter {
|
|
65
|
+
fy: number;
|
|
66
|
+
quarter: 1 | 2 | 3 | 4;
|
|
67
|
+
start: CivilDate;
|
|
68
|
+
end: CivilDate;
|
|
69
|
+
periods: readonly number[];
|
|
70
|
+
}
|
|
71
|
+
export interface FiscalYearModel {
|
|
72
|
+
fy: number;
|
|
73
|
+
start: CivilDate;
|
|
74
|
+
end: CivilDate;
|
|
75
|
+
weekCount: 52 | 53;
|
|
76
|
+
periodCount: 12 | 13;
|
|
77
|
+
weeks: readonly FiscalWeek[];
|
|
78
|
+
periods: readonly FiscalPeriod[];
|
|
79
|
+
quarters: readonly FiscalQuarter[];
|
|
80
|
+
}
|
|
81
|
+
export interface DateCellMeta {
|
|
82
|
+
iso: CivilDate;
|
|
83
|
+
gregorian: {
|
|
84
|
+
year: number;
|
|
85
|
+
month: number;
|
|
86
|
+
day: number;
|
|
87
|
+
};
|
|
88
|
+
fy?: number;
|
|
89
|
+
fiscalWeek?: number;
|
|
90
|
+
fiscalPeriod?: number;
|
|
91
|
+
fiscalQuarter?: 1 | 2 | 3 | 4;
|
|
92
|
+
isPeriodStart?: boolean;
|
|
93
|
+
isPeriodEnd?: boolean;
|
|
94
|
+
isFyStart?: boolean;
|
|
95
|
+
isFyEnd?: boolean;
|
|
96
|
+
crossesGregorianMonth?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export type Granularity = "day" | "week" | "period" | "quarter" | "year";
|
|
99
|
+
export type CalendarSelectionMode = "single" | "multiple" | "range" | "multi-range";
|
|
100
|
+
export interface CalendarInterval {
|
|
101
|
+
start: CivilDate;
|
|
102
|
+
end: CivilDate;
|
|
103
|
+
granularity: Granularity;
|
|
104
|
+
fy?: number;
|
|
105
|
+
period?: number;
|
|
106
|
+
week?: number;
|
|
107
|
+
quarter?: 1 | 2 | 3 | 4;
|
|
108
|
+
}
|
|
109
|
+
export type CalendarSelection = {
|
|
110
|
+
mode: "single";
|
|
111
|
+
value: CalendarInterval | null;
|
|
112
|
+
} | {
|
|
113
|
+
mode: "multiple";
|
|
114
|
+
value: CalendarInterval[];
|
|
115
|
+
} | {
|
|
116
|
+
mode: "range";
|
|
117
|
+
value: {
|
|
118
|
+
from: CalendarInterval;
|
|
119
|
+
to?: CalendarInterval;
|
|
120
|
+
} | null;
|
|
121
|
+
} | {
|
|
122
|
+
mode: "multi-range";
|
|
123
|
+
value: Array<{
|
|
124
|
+
from: CalendarInterval;
|
|
125
|
+
to: CalendarInterval;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
128
|
+
/** Picker-facing week value. Dates are local civil midnights. */
|
|
129
|
+
export interface WeekSelection {
|
|
130
|
+
year: number;
|
|
131
|
+
month: number;
|
|
132
|
+
weekOfMonth: number;
|
|
133
|
+
startDate: Date;
|
|
134
|
+
endDate: Date;
|
|
135
|
+
}
|
|
136
|
+
/** Legacy fiscal-month block described as a WeekSelection (weekOfMonth = period index). */
|
|
137
|
+
export interface FiscalMonth {
|
|
138
|
+
index: number;
|
|
139
|
+
startDate: Date;
|
|
140
|
+
endDate: Date;
|
|
141
|
+
weekCount: number;
|
|
142
|
+
}
|
|
143
|
+
export declare const FISCAL_PATTERNS: Record<RetailPatternId, FiscalMonthPattern>;
|
|
144
|
+
export declare const DEFAULT_LEAP_WEEK_POLICY: LeapWeekPolicy;
|
|
145
|
+
export declare const DEFAULT_FY_LABEL: FyLabelStyle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const E = {
|
|
2
|
+
"4-4-5": [4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 4, 5],
|
|
3
|
+
"4-5-4": [4, 5, 4, 4, 5, 4, 4, 5, 4, 4, 5, 4],
|
|
4
|
+
"5-4-4": [5, 4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 4]
|
|
5
|
+
}, L = "append-last-period", o = "fy-short";
|
|
6
|
+
export {
|
|
7
|
+
o as DEFAULT_FY_LABEL,
|
|
8
|
+
L as DEFAULT_LEAP_WEEK_POLICY,
|
|
9
|
+
E as FISCAL_PATTERNS
|
|
10
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CalendarKind, FiscalMode, FiscalMonth, FiscalMonthPattern, Granularity, WeekSelection, FiscalCalendarConfig, Weekday } from './types';
|
|
2
|
+
export type { FiscalMode, FiscalMonth, FiscalMonthPattern };
|
|
3
|
+
export declare function getFiscalWeekSelection(date: Date, weekStartsOn: Weekday): WeekSelection;
|
|
4
|
+
export declare function buildFiscalMonthCalendar(civilYear: number, pattern: FiscalMonthPattern, weekStartsOn: Weekday, fiscalYearStartMonth?: number): FiscalMonth[];
|
|
5
|
+
export declare function getFiscalMonthSelection(date: Date, fiscalCalendar: FiscalMonth[]): WeekSelection | undefined;
|
|
6
|
+
export declare function getCalendarWeekSelection(date: Date, weekStartsOn: Weekday): WeekSelection;
|
|
7
|
+
export interface ResolveWeekSelectionOptions {
|
|
8
|
+
calendarKind?: CalendarKind;
|
|
9
|
+
fiscalMode?: FiscalMode;
|
|
10
|
+
granularity?: Granularity;
|
|
11
|
+
fiscalMonthPattern?: FiscalMonthPattern;
|
|
12
|
+
fiscalYearStartMonth?: number;
|
|
13
|
+
weekStartsOn?: Weekday;
|
|
14
|
+
}
|
|
15
|
+
export declare function resolveWeekSelection(date: Date, options?: ResolveWeekSelectionOptions): WeekSelection;
|
|
16
|
+
export declare function toFiscalCalendarConfig(options: {
|
|
17
|
+
calendarKind?: CalendarKind;
|
|
18
|
+
fiscalMode?: FiscalMode;
|
|
19
|
+
fiscalMonthPattern?: FiscalMonthPattern;
|
|
20
|
+
fiscalYearStartMonth?: number;
|
|
21
|
+
weekStartsOn?: Weekday;
|
|
22
|
+
}): FiscalCalendarConfig | undefined;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { FISCAL_PATTERNS as y } from "./types.js";
|
|
2
|
+
function g(t, a) {
|
|
3
|
+
const e = new Date(t), s = (e.getDay() + 7 - a) % 7;
|
|
4
|
+
return e.setDate(e.getDate() - s), e.setHours(0, 0, 0, 0), e;
|
|
5
|
+
}
|
|
6
|
+
function D(t, a) {
|
|
7
|
+
const e = new Date(t);
|
|
8
|
+
return e.setDate(e.getDate() + a), e;
|
|
9
|
+
}
|
|
10
|
+
function u(t, a) {
|
|
11
|
+
const e = g(t, a), n = D(e, 6), c = new Date(t.getFullYear(), t.getMonth(), 1).getDay(), o = e.getDate(), r = e.getMonth() === t.getMonth() ? o : 1, i = Math.ceil((r + c) / 7);
|
|
12
|
+
return {
|
|
13
|
+
year: t.getFullYear(),
|
|
14
|
+
month: t.getMonth(),
|
|
15
|
+
weekOfMonth: Math.max(1, i),
|
|
16
|
+
startDate: e,
|
|
17
|
+
endDate: n
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function M(t, a, e, n = 1) {
|
|
21
|
+
if (a.length !== 12)
|
|
22
|
+
throw new Error(`fiscalMonthPattern must have exactly 12 entries, got ${a.length}`);
|
|
23
|
+
const s = new Date(t, n - 1, 1);
|
|
24
|
+
let c = g(s, e);
|
|
25
|
+
const o = [];
|
|
26
|
+
for (let r = 0; r < 12; r++) {
|
|
27
|
+
const i = a[r], f = new Date(c), l = D(f, i * 7 - 1);
|
|
28
|
+
o.push({ index: r, startDate: f, endDate: l, weekCount: i }), c = D(l, 1);
|
|
29
|
+
}
|
|
30
|
+
return o;
|
|
31
|
+
}
|
|
32
|
+
function w(t, a) {
|
|
33
|
+
const e = new Date(t);
|
|
34
|
+
e.setHours(0, 0, 0, 0);
|
|
35
|
+
for (const n of a) {
|
|
36
|
+
const s = new Date(n.startDate);
|
|
37
|
+
s.setHours(0, 0, 0, 0);
|
|
38
|
+
const c = new Date(n.endDate);
|
|
39
|
+
if (c.setHours(23, 59, 59, 999), e >= s && e <= c)
|
|
40
|
+
return {
|
|
41
|
+
year: n.startDate.getFullYear(),
|
|
42
|
+
month: n.startDate.getMonth(),
|
|
43
|
+
weekOfMonth: n.index + 1,
|
|
44
|
+
startDate: n.startDate,
|
|
45
|
+
endDate: n.endDate
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function d(t, a) {
|
|
50
|
+
const e = g(t, a), n = D(e, 6), s = new Date(t.getFullYear(), t.getMonth(), 1), c = new Date(t.getFullYear(), t.getMonth() + 1, 0), o = e < s ? new Date(s) : new Date(e), r = n > c ? new Date(c) : new Date(n), f = new Date(o.getFullYear(), o.getMonth(), 1).getDay(), l = o.getDate(), h = Math.ceil((l + f) / 7);
|
|
51
|
+
return {
|
|
52
|
+
year: o.getFullYear(),
|
|
53
|
+
month: o.getMonth(),
|
|
54
|
+
weekOfMonth: Math.max(1, h),
|
|
55
|
+
startDate: o,
|
|
56
|
+
endDate: r
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function F(t, a = {}) {
|
|
60
|
+
const {
|
|
61
|
+
calendarKind: e = "gregorian",
|
|
62
|
+
fiscalMode: n = "basic",
|
|
63
|
+
granularity: s,
|
|
64
|
+
fiscalMonthPattern: c,
|
|
65
|
+
fiscalYearStartMonth: o = 1,
|
|
66
|
+
weekStartsOn: r = 1
|
|
67
|
+
} = a;
|
|
68
|
+
if (e !== "fiscal")
|
|
69
|
+
return d(t, r);
|
|
70
|
+
if (n === "basic" || s !== "period")
|
|
71
|
+
return u(t, r);
|
|
72
|
+
const i = c ?? y["4-4-5"];
|
|
73
|
+
if (i.length !== 12)
|
|
74
|
+
return u(t, r);
|
|
75
|
+
const f = M(
|
|
76
|
+
t.getFullYear(),
|
|
77
|
+
i,
|
|
78
|
+
r,
|
|
79
|
+
o
|
|
80
|
+
), l = w(t, f);
|
|
81
|
+
if (l) return l;
|
|
82
|
+
const h = M(
|
|
83
|
+
t.getFullYear() - 1,
|
|
84
|
+
i,
|
|
85
|
+
r,
|
|
86
|
+
o
|
|
87
|
+
);
|
|
88
|
+
return w(t, h) ?? u(t, r);
|
|
89
|
+
}
|
|
90
|
+
function S(t) {
|
|
91
|
+
if (t.calendarKind !== "fiscal") return;
|
|
92
|
+
const a = t.weekStartsOn ?? 1, e = t.fiscalYearStartMonth ?? 1;
|
|
93
|
+
return {
|
|
94
|
+
kind: "retail",
|
|
95
|
+
pattern: t.fiscalMonthPattern ?? y["4-4-5"],
|
|
96
|
+
weekStartsOn: a,
|
|
97
|
+
fyAnchor: { month: e, day: 1, rule: "on-or-before" }
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
M as buildFiscalMonthCalendar,
|
|
102
|
+
d as getCalendarWeekSelection,
|
|
103
|
+
w as getFiscalMonthSelection,
|
|
104
|
+
u as getFiscalWeekSelection,
|
|
105
|
+
F as resolveWeekSelection,
|
|
106
|
+
S as toFiscalCalendarConfig
|
|
107
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GuidanceEngineConfig, GuidanceError, GuidanceEventHandler, GuidanceEventName, GuidanceSessionState, GuideManifest, RenderInstruction, Unsubscribe } from '../types/guidance.types';
|
|
1
|
+
import { GuidanceEngineConfig, GuidanceError, GuidanceEventHandler, GuidanceEventName, GuidanceGuideReplayOptions, GuidanceGuideStartOptions, GuidanceSessionState, GuideManifest, RenderInstruction, Unsubscribe } from '../types/guidance.types';
|
|
2
2
|
import { GuideRegistry } from './guide-registry';
|
|
3
3
|
import { TriggerPluginRegistry } from '../triggers/trigger-registry';
|
|
4
4
|
import { TargetResolver } from '../targets/target-resolver';
|
|
@@ -42,13 +42,13 @@ export declare class GuidanceEngine {
|
|
|
42
42
|
emitCustomEvent(eventName: string): void;
|
|
43
43
|
grantConsent(): void;
|
|
44
44
|
setPreviewMode(enabled: boolean): void;
|
|
45
|
-
start(guideId: string, options?:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
replay(guideId: string): Promise<void>;
|
|
45
|
+
start(guideId: string, options?: GuidanceGuideStartOptions): Promise<void>;
|
|
46
|
+
replay(guideId: string, options?: GuidanceGuideReplayOptions): Promise<void>;
|
|
47
|
+
private resolveGuideStartStepIndex;
|
|
49
48
|
dismiss(dismissMode?: 'session' | 'forever' | 'snoozed'): Promise<void>;
|
|
50
49
|
snooze(guideId?: string): Promise<void>;
|
|
51
50
|
advanceStep(): Promise<void>;
|
|
51
|
+
retryCurrentStep(): Promise<void>;
|
|
52
52
|
skipStep(): Promise<void>;
|
|
53
53
|
getRenderInstruction(): RenderInstruction | null;
|
|
54
54
|
private syncRenderInstructionCache;
|
|
@@ -64,6 +64,8 @@ export declare class GuidanceEngine {
|
|
|
64
64
|
private saveSessionStats;
|
|
65
65
|
private hydrateVisitCounts;
|
|
66
66
|
private incrementVisitCount;
|
|
67
|
+
private log;
|
|
68
|
+
private clearPersistedLastStep;
|
|
67
69
|
private scheduleEvaluation;
|
|
68
70
|
private setSession;
|
|
69
71
|
private notify;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { GuideRegistry as
|
|
2
|
-
import {
|
|
1
|
+
import { GuideRegistry as l } from "./guide-registry.js";
|
|
2
|
+
import { getStepIndex as u, getNextStepId as p, getStepById as S, resolveLocalizedStepContent as f } from "./step-navigation.js";
|
|
3
3
|
import { TriggerPluginRegistry as v } from "../triggers/trigger-registry.js";
|
|
4
|
-
import { registerBuiltInTriggerPlugins as
|
|
5
|
-
import { TargetResolver as
|
|
6
|
-
import { GuidanceTargetRefRegistry as
|
|
7
|
-
import { buildGuidanceStorageKey as a, buildSessionStatsKey as
|
|
8
|
-
class
|
|
4
|
+
import { registerBuiltInTriggerPlugins as w } from "../triggers/built-in-triggers.js";
|
|
5
|
+
import { TargetResolver as m, resolveTargetSynchronously as y, waitForTargetResolved as I } from "../targets/target-resolver.js";
|
|
6
|
+
import { GuidanceTargetRefRegistry as R } from "../targets/ref-registry.js";
|
|
7
|
+
import { buildGuidanceStorageKey as a, buildSessionStatsKey as g, createDefaultSessionStats as G } from "../storage/storage-keys.js";
|
|
8
|
+
class _ {
|
|
9
9
|
sessionState = { status: "idle" };
|
|
10
10
|
listeners = /* @__PURE__ */ new Set();
|
|
11
11
|
eventHandlers = /* @__PURE__ */ new Map();
|
|
12
|
-
guideRegistry = new
|
|
12
|
+
guideRegistry = new l();
|
|
13
13
|
triggerRegistry = new v();
|
|
14
|
-
targetRefRegistry = new
|
|
14
|
+
targetRefRegistry = new R();
|
|
15
15
|
targetResolver;
|
|
16
16
|
guideQueue = [];
|
|
17
17
|
previewMode = !1;
|
|
@@ -26,7 +26,7 @@ class P {
|
|
|
26
26
|
cachedRenderInstruction = null;
|
|
27
27
|
config;
|
|
28
28
|
constructor(t) {
|
|
29
|
-
this.config = t, this.targetResolver = new
|
|
29
|
+
this.config = t, this.targetResolver = new m(this.targetRefRegistry), w(this.triggerRegistry), this.consentGranted = !t.consentRequired;
|
|
30
30
|
}
|
|
31
31
|
get state() {
|
|
32
32
|
return this.sessionState;
|
|
@@ -105,10 +105,23 @@ class P {
|
|
|
105
105
|
}
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
await this.canStartGuide(t, e?.manual ?? !1)
|
|
108
|
+
if (!await this.canStartGuide(t, e?.manual ?? !1))
|
|
109
|
+
return;
|
|
110
|
+
const n = this.resolveGuideStartStepIndex(s, e?.stepId);
|
|
111
|
+
await this.activateGuide(s, n);
|
|
112
|
+
}
|
|
113
|
+
async replay(t, e) {
|
|
114
|
+
this.previewMode = !0, this.sessionState.guideId === t && this.sessionState.status !== "idle" && (this.log("replay.reset-session", {
|
|
115
|
+
guideId: t,
|
|
116
|
+
previousStatus: this.sessionState.status,
|
|
117
|
+
previousStepId: this.sessionState.stepId
|
|
118
|
+
}), this.emitEvent("guideEnd", { guideId: t, reason: "dismissed" }), await this.clearPersistedLastStep(t), this.setSession({ status: "idle" })), await this.start(t, { manual: !0, stepId: e?.stepId });
|
|
109
119
|
}
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
resolveGuideStartStepIndex(t, e) {
|
|
121
|
+
if (!e)
|
|
122
|
+
return 0;
|
|
123
|
+
const s = u(t, e);
|
|
124
|
+
return s >= 0 ? s : 0;
|
|
112
125
|
}
|
|
113
126
|
async dismiss(t = "session") {
|
|
114
127
|
const e = this.sessionState.guideId;
|
|
@@ -122,7 +135,7 @@ class P {
|
|
|
122
135
|
const s = await this.loadSessionStats();
|
|
123
136
|
s.snoozedUntil[e] = Date.now() + 1440 * 60 * 1e3, await this.saveSessionStats(s);
|
|
124
137
|
}
|
|
125
|
-
this.emitEvent("guideEnd", { guideId: e, reason: "dismissed" }), this.track("guide.dismissed", { guideId: e, dismissMode: t }), this.setSession({ status: "dismissed", guideId: e, dismissMode: t }), await this.dequeueNextGuide();
|
|
138
|
+
this.emitEvent("guideEnd", { guideId: e, reason: "dismissed" }), this.track("guide.dismissed", { guideId: e, dismissMode: t }), this.log("dismiss", { guideId: e, dismissMode: t, stepId: this.sessionState.stepId }), this.setSession({ status: "dismissed", guideId: e, dismissMode: t }), this.clearPersistedLastStep(e), await this.dequeueNextGuide();
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
async snooze(t) {
|
|
@@ -136,7 +149,7 @@ class P {
|
|
|
136
149
|
if (!s)
|
|
137
150
|
return;
|
|
138
151
|
this.track("step.completed", { guideId: t, stepId: e });
|
|
139
|
-
const i = await
|
|
152
|
+
const i = await p(
|
|
140
153
|
s,
|
|
141
154
|
e,
|
|
142
155
|
(r) => this.triggerRegistry.evaluateExpression(r, this.buildTriggerContext())
|
|
@@ -145,9 +158,19 @@ class P {
|
|
|
145
158
|
await this.completeGuide(t);
|
|
146
159
|
return;
|
|
147
160
|
}
|
|
148
|
-
const n =
|
|
161
|
+
const n = u(s, i);
|
|
149
162
|
await this.activateGuide(s, n);
|
|
150
163
|
}
|
|
164
|
+
async retryCurrentStep() {
|
|
165
|
+
const t = this.sessionState.guideId, e = this.sessionState.stepId;
|
|
166
|
+
if (!t || !e || this.sessionState.status !== "blocked" && this.sessionState.status !== "evaluating")
|
|
167
|
+
return;
|
|
168
|
+
const s = this.guideRegistry.get(t);
|
|
169
|
+
if (!s)
|
|
170
|
+
return;
|
|
171
|
+
const i = u(s, e);
|
|
172
|
+
i < 0 || await this.activateGuide(s, i);
|
|
173
|
+
}
|
|
151
174
|
async skipStep() {
|
|
152
175
|
const t = this.sessionState.guideId, e = this.sessionState.stepId;
|
|
153
176
|
!t || !e || (this.track("step.skipped", { guideId: t, stepId: e }), await this.advanceStep());
|
|
@@ -160,7 +183,7 @@ class P {
|
|
|
160
183
|
this.cachedRenderInstruction = null;
|
|
161
184
|
return;
|
|
162
185
|
}
|
|
163
|
-
const t = this.guideRegistry.get(this.sessionState.guideId), e = t ?
|
|
186
|
+
const t = this.guideRegistry.get(this.sessionState.guideId), e = t ? S(t, this.sessionState.stepId) : void 0;
|
|
164
187
|
if (!t || !e) {
|
|
165
188
|
this.cachedRenderInstruction = null;
|
|
166
189
|
return;
|
|
@@ -171,7 +194,7 @@ class P {
|
|
|
171
194
|
stepIndex: this.sessionState.stepIndex,
|
|
172
195
|
totalSteps: t.steps.length,
|
|
173
196
|
renderer: e.renderer,
|
|
174
|
-
content:
|
|
197
|
+
content: f(t, e, this.config.locale),
|
|
175
198
|
target: this.sessionState.resolvedTarget ?? null,
|
|
176
199
|
skippable: e.skippable,
|
|
177
200
|
advanceOn: e.advanceOn
|
|
@@ -193,7 +216,10 @@ class P {
|
|
|
193
216
|
if (!n.length)
|
|
194
217
|
return;
|
|
195
218
|
const r = n[0];
|
|
196
|
-
this.
|
|
219
|
+
this.log("evaluateTriggers.start", {
|
|
220
|
+
guideId: r.id,
|
|
221
|
+
routePath: this.routePath
|
|
222
|
+
}), this.track("guide.triggered", { guideId: r.id }), await this.start(r.id);
|
|
197
223
|
}
|
|
198
224
|
async activateGuide(t, e) {
|
|
199
225
|
const s = t.steps[e];
|
|
@@ -201,43 +227,71 @@ class P {
|
|
|
201
227
|
await this.completeGuide(t.id);
|
|
202
228
|
return;
|
|
203
229
|
}
|
|
204
|
-
let i =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
230
|
+
let i = null;
|
|
231
|
+
if (s.target) {
|
|
232
|
+
if (i = y(
|
|
233
|
+
this.targetResolver,
|
|
234
|
+
s.target
|
|
235
|
+
), i?.element || (this.setSession({
|
|
236
|
+
status: "evaluating",
|
|
237
|
+
guideId: t.id,
|
|
238
|
+
stepIndex: e,
|
|
239
|
+
stepId: s.id
|
|
240
|
+
}), i = await I(
|
|
241
|
+
this.targetResolver,
|
|
242
|
+
s.target,
|
|
243
|
+
s.timeout ?? 5e3
|
|
244
|
+
)), !i?.element) {
|
|
245
|
+
this.log("activateGuide.blocked", {
|
|
246
|
+
guideId: t.id,
|
|
247
|
+
stepId: s.id,
|
|
248
|
+
stepIndex: e,
|
|
249
|
+
reason: i ? "target_not_visible" : "target_not_found",
|
|
250
|
+
targetId: s.target?.targetId
|
|
251
|
+
}), this.setSession({
|
|
252
|
+
status: "blocked",
|
|
253
|
+
guideId: t.id,
|
|
254
|
+
stepIndex: e,
|
|
255
|
+
stepId: s.id,
|
|
256
|
+
reason: i ? "target_not_visible" : "target_not_found"
|
|
257
|
+
});
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
} else if (s.renderer !== "announcement") {
|
|
261
|
+
this.log("activateGuide.blocked", {
|
|
262
|
+
guideId: t.id,
|
|
263
|
+
stepId: s.id,
|
|
264
|
+
stepIndex: e,
|
|
265
|
+
reason: "target_not_found"
|
|
266
|
+
}), this.setSession({
|
|
219
267
|
status: "blocked",
|
|
220
268
|
guideId: t.id,
|
|
221
269
|
stepIndex: e,
|
|
222
270
|
stepId: s.id,
|
|
223
|
-
reason:
|
|
271
|
+
reason: "target_not_found"
|
|
224
272
|
});
|
|
225
273
|
return;
|
|
226
274
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
275
|
+
const n = this.sessionState;
|
|
276
|
+
if (n.status === "idle" || n.guideId !== t.id) {
|
|
277
|
+
this.log("guideStart", { guideId: t.id, stepId: s.id }), this.emitEvent("guideStart", { guideId: t.id, stepId: s.id }), this.track("guide.started", { guideId: t.id });
|
|
278
|
+
const o = await this.loadSessionStats();
|
|
279
|
+
o.guidesShownThisSession += 1, await this.saveSessionStats(o), await this.incrementVisitCount(t.id);
|
|
231
280
|
}
|
|
232
|
-
this.emitEvent("stepChange", { guideId: t.id, stepId: s.id }), this.track("step.viewed", { guideId: t.id, stepId: s.id }), this.
|
|
281
|
+
this.emitEvent("stepChange", { guideId: t.id, stepId: s.id }), this.track("step.viewed", { guideId: t.id, stepId: s.id }), this.log("step.active", {
|
|
282
|
+
guideId: t.id,
|
|
283
|
+
stepId: s.id,
|
|
284
|
+
stepIndex: e,
|
|
285
|
+
hasTarget: !!s.target
|
|
286
|
+
}), this.setSession({
|
|
233
287
|
status: "active",
|
|
234
288
|
guideId: t.id,
|
|
235
289
|
stepIndex: e,
|
|
236
290
|
stepId: s.id,
|
|
237
|
-
resolvedTarget: {
|
|
291
|
+
resolvedTarget: i?.element ? {
|
|
238
292
|
...i,
|
|
239
293
|
rect: i.element.getBoundingClientRect()
|
|
240
|
-
}
|
|
294
|
+
} : void 0
|
|
241
295
|
}), t.persistence.resumeOnRefresh && await this.config.storage.set({
|
|
242
296
|
[a(this.config.tenantId, t.id, "lastStep")]: {
|
|
243
297
|
stepId: s.id,
|
|
@@ -278,8 +332,8 @@ class P {
|
|
|
278
332
|
if (r && Date.now() < r || (e.dismissedCounts[t.id] ?? 0) >= 3 && t.persistence.mode === "showOnce")
|
|
279
333
|
return !1;
|
|
280
334
|
if (t.persistence.schedule) {
|
|
281
|
-
const d = Date.now(), c = Date.parse(t.persistence.schedule.start),
|
|
282
|
-
if (d < c || d >
|
|
335
|
+
const d = Date.now(), c = Date.parse(t.persistence.schedule.start), h = Date.parse(t.persistence.schedule.end);
|
|
336
|
+
if (d < c || d > h)
|
|
283
337
|
return !1;
|
|
284
338
|
}
|
|
285
339
|
return this.triggerRegistry.evaluateAll(
|
|
@@ -317,12 +371,12 @@ class P {
|
|
|
317
371
|
await this.start(t);
|
|
318
372
|
}
|
|
319
373
|
async loadSessionStats() {
|
|
320
|
-
const t =
|
|
374
|
+
const t = g(this.config.tenantId);
|
|
321
375
|
return (await this.config.storage.get([t]))[t] ?? G();
|
|
322
376
|
}
|
|
323
377
|
async saveSessionStats(t) {
|
|
324
378
|
await this.config.storage.set({
|
|
325
|
-
[
|
|
379
|
+
[g(this.config.tenantId)]: t
|
|
326
380
|
});
|
|
327
381
|
}
|
|
328
382
|
async hydrateVisitCounts(t) {
|
|
@@ -348,6 +402,20 @@ class P {
|
|
|
348
402
|
), n = ((await this.config.storage.get([e]))[e] ?? 0) + 1;
|
|
349
403
|
this.visitCounts[t] = n, await this.config.storage.set({ [e]: n });
|
|
350
404
|
}
|
|
405
|
+
log(t, e) {
|
|
406
|
+
if (this.config.debug) {
|
|
407
|
+
if (e) {
|
|
408
|
+
console.info(`[guidance] ${t}`, e);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
console.info(`[guidance] ${t}`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
async clearPersistedLastStep(t) {
|
|
415
|
+
await this.config.storage.delete([
|
|
416
|
+
a(this.config.tenantId, t, "lastStep")
|
|
417
|
+
]);
|
|
418
|
+
}
|
|
351
419
|
scheduleEvaluation() {
|
|
352
420
|
typeof window > "u" || (this.evaluationFrame !== null && cancelAnimationFrame(this.evaluationFrame), this.evaluationFrame = requestAnimationFrame(() => {
|
|
353
421
|
this.evaluationFrame = null, this.evaluateTriggers(this.routePath);
|
|
@@ -380,5 +448,5 @@ class P {
|
|
|
380
448
|
}
|
|
381
449
|
}
|
|
382
450
|
export {
|
|
383
|
-
|
|
451
|
+
_ as GuidanceEngine
|
|
384
452
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class s {
|
|
2
2
|
plugins = /* @__PURE__ */ new Map();
|
|
3
3
|
register(t) {
|
|
4
4
|
this.plugins.set(t.type, t);
|
|
@@ -22,11 +22,11 @@ class r {
|
|
|
22
22
|
);
|
|
23
23
|
return t.op === "and" ? a.every(Boolean) : a.some(Boolean);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
25
|
+
const l = this.plugins.get(t.plugin);
|
|
26
|
+
if (!l?.evaluate)
|
|
27
27
|
return !1;
|
|
28
28
|
try {
|
|
29
|
-
return !!await
|
|
29
|
+
return !!await l.evaluate(e, t.config ?? {});
|
|
30
30
|
} catch {
|
|
31
31
|
return !1;
|
|
32
32
|
}
|
|
@@ -36,9 +36,9 @@ class r {
|
|
|
36
36
|
t.map(
|
|
37
37
|
(a) => this.evaluateExpression(a, e)
|
|
38
38
|
)
|
|
39
|
-
)).every(Boolean) : !
|
|
39
|
+
)).every(Boolean) : !1;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
s as TriggerPluginRegistry
|
|
44
44
|
};
|
|
@@ -5,6 +5,13 @@ export type EndReason = 'completed' | 'dismissed' | 'error' | 'skipped';
|
|
|
5
5
|
export type BlockReason = 'target_not_found' | 'target_not_visible' | 'timeout';
|
|
6
6
|
export type PersistenceMode = 'showOnce' | 'replayable' | 'dismissForever' | 'scheduled';
|
|
7
7
|
export type AdvanceCondition = 'click-next' | 'click-target' | 'auto' | 'custom-event';
|
|
8
|
+
export interface GuidanceGuideStartOptions {
|
|
9
|
+
manual?: boolean;
|
|
10
|
+
stepId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GuidanceGuideReplayOptions {
|
|
13
|
+
stepId?: string;
|
|
14
|
+
}
|
|
8
15
|
export type MediaType = 'image' | 'video' | 'lottie';
|
|
9
16
|
export interface StepAction {
|
|
10
17
|
label: string;
|
|
@@ -29,7 +36,7 @@ export interface TargetDescriptor {
|
|
|
29
36
|
}
|
|
30
37
|
export interface Step {
|
|
31
38
|
id: string;
|
|
32
|
-
target
|
|
39
|
+
target?: TargetDescriptor;
|
|
33
40
|
renderer: string;
|
|
34
41
|
content: StepContent;
|
|
35
42
|
advanceOn: AdvanceCondition;
|
|
@@ -49,6 +56,7 @@ export interface PersistenceConfig {
|
|
|
49
56
|
end: string;
|
|
50
57
|
};
|
|
51
58
|
}
|
|
59
|
+
export type GuideType = 'tour' | 'whats-new' | 'how-to' | 'tip';
|
|
52
60
|
export interface GuideMetadata {
|
|
53
61
|
createdAt: string;
|
|
54
62
|
updatedAt: string;
|
|
@@ -56,6 +64,8 @@ export interface GuideMetadata {
|
|
|
56
64
|
title?: string;
|
|
57
65
|
description?: string;
|
|
58
66
|
category?: string;
|
|
67
|
+
/** Semantic content type for Help Center labeling and launch CTAs. */
|
|
68
|
+
guideType?: GuideType;
|
|
59
69
|
}
|
|
60
70
|
export interface GuideManifest {
|
|
61
71
|
schemaVersion: GuidanceSchemaVersion;
|