@flamingo-stack/openframe-frontend-core 0.0.739 → 0.0.741
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/build/export-map.json +1 -1
- package/dist/{chunk-ENCAIAMY.cjs → chunk-4XL4YEZM.cjs} +3 -3
- package/dist/{chunk-FL6UO7IR.cjs → chunk-5SVOGLNK.cjs} +2 -2
- package/dist/{chunk-WFPCCBOM.cjs → chunk-7AM3AFM4.cjs} +10 -10
- package/dist/{chunk-S2CA5WE4.cjs → chunk-CWRVTQUO.cjs} +9 -1
- package/dist/{chunk-KHXZFLIN.cjs → chunk-DKOLQPE7.cjs} +8 -2
- package/dist/{chunk-UXFJXIUT.cjs → chunk-EKGL5K5K.cjs} +2 -2
- package/dist/{chunk-DTLHY2ZF.cjs → chunk-FQN6STIM.cjs} +12 -155
- package/dist/{chunk-V2ZFH42N.cjs → chunk-HYBMADYO.cjs} +3 -3
- package/dist/{chunk-NX6JQT25.cjs → chunk-I6UE6YVM.cjs} +4 -4
- package/dist/{chunk-SB4VWA5V.cjs → chunk-IK2RJUEA.cjs} +2118 -268
- package/dist/{chunk-CUDTMCXK.cjs → chunk-ITPEFCQ2.cjs} +13 -13
- package/dist/{chunk-WMKNZI4G.cjs → chunk-JFS6TZDX.cjs} +22 -22
- package/dist/{chunk-RGFT3P3L.cjs → chunk-LZ6NOVXX.cjs} +55 -55
- package/dist/{chunk-TF7J6VXG.cjs → chunk-QEUGYHFB.cjs} +9 -9
- package/dist/{chunk-II4QMH26.cjs → chunk-STEJZPIO.cjs} +3 -3
- package/dist/{chunk-UI3HROSI.cjs → chunk-XJ36TEGE.cjs} +33 -33
- package/dist/{chunk-UYP3G6PB.cjs → chunk-YQ37ZCD2.cjs} +2 -2
- package/dist/{chunk-Q7GG3WC5.cjs → chunk-ZJPDGVA6.cjs} +5 -5
- package/dist/{chunk-EGN4I5Q7.cjs → chunk-ZYOS7LVQ.cjs} +134 -46
- package/dist/{cloud-tenants-QSFSO3PA.cjs → cloud-tenants-MVJK52I2.cjs} +13 -13
- package/dist/components/case-studies/index.cjs +11 -11
- package/dist/components/chat/index.cjs +2 -2
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/docs/index.cjs +7 -7
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/features/capability-explorer.d.ts +9 -2
- package/dist/components/features/capability-explorer.d.ts.map +1 -1
- package/dist/components/features/capability-explorer.js +113 -6
- package/dist/components/features/index.cjs +141 -3
- package/dist/components/features/index.d.ts +1 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/index.js +1 -0
- package/dist/components/features/scripts/execution-cells.d.ts +65 -0
- package/dist/components/features/scripts/execution-cells.d.ts.map +1 -0
- package/dist/components/features/scripts/execution-cells.js +75 -0
- package/dist/components/features/scripts/execution-status.d.ts +48 -0
- package/dist/components/features/scripts/execution-status.d.ts.map +1 -0
- package/dist/components/features/scripts/execution-status.js +15 -0
- package/dist/components/features/scripts/index.d.ts +20 -0
- package/dist/components/features/scripts/index.d.ts.map +1 -0
- package/dist/components/features/scripts/index.js +59 -0
- package/dist/components/features/scripts/schedule-form/index.d.ts +18 -0
- package/dist/components/features/scripts/schedule-form/index.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/index.js +84 -0
- package/dist/components/features/scripts/schedule-form/schedule-enums.d.ts +24 -0
- package/dist/components/features/scripts/schedule-form/schedule-enums.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-enums.js +18 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-fields.d.ts +57 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-fields.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-fields.js +169 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-types.d.ts +138 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-types.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-form-types.js +72 -0
- package/dist/components/features/scripts/schedule-form/schedule-interval-input.d.ts +54 -0
- package/dist/components/features/scripts/schedule-form/schedule-interval-input.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-interval-input.js +60 -0
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.d.ts +29 -0
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-offline-fields.js +124 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.d.ts +52 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-picker-card.js +244 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-search-field.d.ts +35 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-search-field.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-script-search-field.js +58 -0
- package/dist/components/features/scripts/schedule-form/schedule-scripts-field.d.ts +25 -0
- package/dist/components/features/scripts/schedule-form/schedule-scripts-field.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-scripts-field.js +66 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.d.ts +77 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing-fields.js +262 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing.d.ts +288 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing.d.ts.map +1 -0
- package/dist/components/features/scripts/schedule-form/schedule-timing.js +165 -0
- package/dist/components/features/scripts/script-cells.d.ts +11 -0
- package/dist/components/features/scripts/script-cells.d.ts.map +1 -0
- package/dist/components/features/scripts/script-cells.js +19 -0
- package/dist/components/features/scripts/script-executions-table.d.ts +58 -0
- package/dist/components/features/scripts/script-executions-table.d.ts.map +1 -0
- package/dist/components/features/scripts/script-executions-table.js +88 -0
- package/dist/components/features/scripts/script-schedules-table.d.ts +38 -0
- package/dist/components/features/scripts/script-schedules-table.d.ts.map +1 -0
- package/dist/components/features/scripts/script-schedules-table.js +71 -0
- package/dist/components/features/scripts/script-shell-badge.d.ts +9 -0
- package/dist/components/features/scripts/script-shell-badge.d.ts.map +1 -0
- package/dist/components/features/scripts/script-shell-badge.js +15 -0
- package/dist/components/features/scripts/scripts-table-columns.d.ts +162 -0
- package/dist/components/features/scripts/scripts-table-columns.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-table-columns.js +69 -0
- package/dist/components/features/scripts/scripts-table-shared.d.ts +19 -0
- package/dist/components/features/scripts/scripts-table-shared.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-table-shared.js +35 -0
- package/dist/components/features/scripts/scripts-table.d.ts +40 -0
- package/dist/components/features/scripts/scripts-table.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-table.js +84 -0
- package/dist/components/features/scripts/scripts-tabs.d.ts +5 -0
- package/dist/components/features/scripts/scripts-tabs.d.ts.map +1 -0
- package/dist/components/features/scripts/scripts-tabs.js +10 -0
- package/dist/components/features/scripts/shell-types.d.ts +13 -0
- package/dist/components/features/scripts/shell-types.d.ts.map +1 -0
- package/dist/components/features/scripts/shell-types.js +21 -0
- package/dist/components/help-center-pages/index.cjs +53 -53
- package/dist/components/index.cjs +178 -34
- package/dist/components/meeting-scheduler/index.cjs +17 -17
- package/dist/components/navigation/index.cjs +6 -6
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/product-demo/fixtures/scripts.d.ts +34 -0
- package/dist/components/product-demo/fixtures/scripts.d.ts.map +1 -0
- package/dist/components/product-demo/fixtures/scripts.js +123 -0
- package/dist/components/product-demo/fixtures/shared.d.ts +8 -0
- package/dist/components/product-demo/fixtures/shared.d.ts.map +1 -1
- package/dist/components/product-demo/fixtures/shared.js +7 -1
- package/dist/components/product-demo/fixtures/software-update.d.ts.map +1 -1
- package/dist/components/product-demo/fixtures/software-update.js +1 -5
- package/dist/components/product-demo/index.cjs +16 -13
- package/dist/components/product-demo/product-screen.d.ts.map +1 -1
- package/dist/components/product-demo/product-screen.js +2 -1
- package/dist/components/product-demo/registry.d.ts.map +1 -1
- package/dist/components/product-demo/registry.js +2 -1
- package/dist/components/product-demo/screen-keys.cjs +2 -1
- package/dist/components/product-demo/screen-keys.d.ts +1 -0
- package/dist/components/product-demo/screen-keys.d.ts.map +1 -1
- package/dist/components/product-demo/screen-keys.js +2 -1
- package/dist/components/product-demo/screens/scripts.d.ts +11 -0
- package/dist/components/product-demo/screens/scripts.d.ts.map +1 -0
- package/dist/components/product-demo/screens/scripts.js +130 -0
- package/dist/components/shared/legal-document/index.d.ts +2 -1
- package/dist/components/shared/legal-document/index.d.ts.map +1 -1
- package/dist/components/shared/legal-document/index.js +10 -2
- package/dist/components/shared/legal-document/legal-document-page.d.ts +35 -23
- package/dist/components/shared/legal-document/legal-document-page.d.ts.map +1 -1
- package/dist/components/shared/legal-document/legal-document-page.js +27 -10
- package/dist/components/shared/legal-document/use-legal-docs.d.ts +7 -3
- package/dist/components/shared/legal-document/use-legal-docs.d.ts.map +1 -1
- package/dist/components/shared/legal-document/use-legal-docs.js +7 -0
- package/dist/components/shared/legal-document/use-legal-documents.d.ts +31 -0
- package/dist/components/shared/legal-document/use-legal-documents.d.ts.map +1 -0
- package/dist/components/shared/legal-document/use-legal-documents.js +67 -0
- package/dist/components/tickets/index.cjs +8 -8
- package/dist/components/ui/index.cjs +3 -3
- package/dist/{devices-C7XLWJFC.cjs → devices-W3S7Q2PG.cjs} +9 -9
- package/dist/index.cjs +150 -8
- package/dist/{knowledge-3QKWTOE7.cjs → knowledge-AIYQ4FC3.cjs} +7 -7
- package/dist/{logs-JXD75NR4.cjs → logs-7SHJ2ARE.cjs} +25 -25
- package/dist/{policies-ZPN53PFQ.cjs → policies-EIZJ5SUP.cjs} +10 -10
- package/dist/{remote-session-DNFZ5OLY.cjs → remote-session-BZMNE6D2.cjs} +5 -5
- package/dist/scripts-J2FWC7E4.cjs +2112 -0
- package/dist/{software-update-CRSIBS3K.cjs → software-update-QAMNASVF.cjs} +14 -18
- package/dist/{tickets-board-CKZRB6YV.cjs → tickets-board-CEDHD3KB.cjs} +17 -17
- package/dist/utils/index.cjs +8 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/legal-documents.d.ts +18 -0
- package/dist/utils/legal-documents.d.ts.map +1 -0
- package/dist/utils/legal-documents.js +8 -0
- package/package.json +1 -1
- package/src/components/features/capability-explorer.tsx +134 -7
- package/src/components/features/index.ts +1 -0
- package/src/components/features/scripts/execution-cells.tsx +149 -0
- package/src/components/features/scripts/execution-status.ts +42 -0
- package/src/components/features/scripts/index.ts +42 -0
- package/src/components/features/scripts/schedule-form/index.ts +59 -0
- package/src/components/features/scripts/schedule-form/schedule-enums.ts +26 -0
- package/src/components/features/scripts/schedule-form/schedule-form-fields.tsx +249 -0
- package/src/components/features/scripts/schedule-form/schedule-form-types.ts +189 -0
- package/src/components/features/scripts/schedule-form/schedule-interval-input.tsx +121 -0
- package/src/components/features/scripts/schedule-form/schedule-offline-fields.tsx +218 -0
- package/src/components/features/scripts/schedule-form/schedule-script-picker-card.tsx +321 -0
- package/src/components/features/scripts/schedule-form/schedule-script-search-field.tsx +115 -0
- package/src/components/features/scripts/schedule-form/schedule-scripts-field.tsx +97 -0
- package/src/components/features/scripts/schedule-form/schedule-timing-fields.tsx +482 -0
- package/src/components/features/scripts/schedule-form/schedule-timing.ts +484 -0
- package/src/components/features/scripts/script-cells.tsx +29 -0
- package/src/components/features/scripts/script-executions-table.tsx +145 -0
- package/src/components/features/scripts/script-schedules-table.tsx +113 -0
- package/src/components/features/scripts/script-shell-badge.tsx +25 -0
- package/src/components/features/scripts/scripts-table-columns.ts +95 -0
- package/src/components/features/scripts/scripts-table-shared.tsx +43 -0
- package/src/components/features/scripts/scripts-table.tsx +124 -0
- package/src/components/features/scripts/scripts-tabs.ts +11 -0
- package/src/components/features/scripts/shell-types.ts +26 -0
- package/src/components/product-demo/fixtures/scripts.ts +186 -0
- package/src/components/product-demo/fixtures/shared.ts +7 -0
- package/src/components/product-demo/fixtures/software-update.ts +1 -7
- package/src/components/product-demo/product-screen.tsx +3 -1
- package/src/components/product-demo/registry.ts +1 -0
- package/src/components/product-demo/screen-keys.ts +1 -0
- package/src/components/product-demo/screens/scripts.tsx +192 -0
- package/src/components/shared/legal-document/index.ts +8 -0
- package/src/components/shared/legal-document/legal-document-page.tsx +83 -44
- package/src/components/shared/legal-document/use-legal-docs.ts +18 -3
- package/src/components/shared/legal-document/use-legal-documents.ts +113 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/legal-documents.ts +21 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { SCHEDULE_OFFLINE_BEHAVIOR, SCHEDULE_TIME_REFERENCE, SCRIPT_SCHEDULE_TRIGGER } from "./schedule-enums.js";
|
|
2
|
+
import { ScheduleFormFields } from "./schedule-form-fields.js";
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_SCHEDULE_FORM_VALUES,
|
|
5
|
+
EMPTY_SCHEDULE_SCRIPT_ROW,
|
|
6
|
+
SCHEDULE_OFFLINE_BEHAVIOR_OPTIONS,
|
|
7
|
+
SCHEDULE_TIME_REFERENCE_OPTIONS,
|
|
8
|
+
SCHEDULE_TRIGGER_OPTIONS
|
|
9
|
+
} from "./schedule-form-types.js";
|
|
10
|
+
import { ScheduleIntervalInput } from "./schedule-interval-input.js";
|
|
11
|
+
import { ScheduleOfflineFields } from "./schedule-offline-fields.js";
|
|
12
|
+
import { ScheduleScriptPickerCard } from "./schedule-script-picker-card.js";
|
|
13
|
+
import { ScheduleScriptSearchField } from "./schedule-script-search-field.js";
|
|
14
|
+
import { ScheduleScriptsField } from "./schedule-scripts-field.js";
|
|
15
|
+
import { ScheduleTimingFields } from "./schedule-timing-fields.js";
|
|
16
|
+
import {
|
|
17
|
+
applyTimeSlot,
|
|
18
|
+
dateToTimeSlot,
|
|
19
|
+
DEFAULT_RECONNECT_WINDOW,
|
|
20
|
+
DURATION_UNIT_LABELS,
|
|
21
|
+
DURATION_UNIT_OPTIONS,
|
|
22
|
+
DURATION_UNIT_SECONDS,
|
|
23
|
+
DURATION_UNIT_VALUES,
|
|
24
|
+
earliestDeviceLocalDay,
|
|
25
|
+
earliestScheduleDay,
|
|
26
|
+
fromScheduleInstant,
|
|
27
|
+
getTimeSlotOptions,
|
|
28
|
+
isDeviceLocalTime,
|
|
29
|
+
isEventTrigger,
|
|
30
|
+
isRetryOnReconnect,
|
|
31
|
+
isScheduleStartInPast,
|
|
32
|
+
isSlotOnGrid,
|
|
33
|
+
isStartInPastAndChanged,
|
|
34
|
+
MIN_RECONNECT_MINUTES,
|
|
35
|
+
MIN_REPEAT_MINUTES,
|
|
36
|
+
NO_SLOTS_TODAY_MESSAGE,
|
|
37
|
+
PAST_START_MESSAGE,
|
|
38
|
+
slotToLabel,
|
|
39
|
+
snapReconnectInterval,
|
|
40
|
+
snapRepeatInterval,
|
|
41
|
+
startOfToday
|
|
42
|
+
} from "./schedule-timing.js";
|
|
43
|
+
export {
|
|
44
|
+
DEFAULT_RECONNECT_WINDOW,
|
|
45
|
+
DEFAULT_SCHEDULE_FORM_VALUES,
|
|
46
|
+
DURATION_UNIT_LABELS,
|
|
47
|
+
DURATION_UNIT_OPTIONS,
|
|
48
|
+
DURATION_UNIT_SECONDS,
|
|
49
|
+
DURATION_UNIT_VALUES,
|
|
50
|
+
EMPTY_SCHEDULE_SCRIPT_ROW,
|
|
51
|
+
MIN_RECONNECT_MINUTES,
|
|
52
|
+
MIN_REPEAT_MINUTES,
|
|
53
|
+
NO_SLOTS_TODAY_MESSAGE,
|
|
54
|
+
PAST_START_MESSAGE,
|
|
55
|
+
SCHEDULE_OFFLINE_BEHAVIOR,
|
|
56
|
+
SCHEDULE_OFFLINE_BEHAVIOR_OPTIONS,
|
|
57
|
+
SCHEDULE_TIME_REFERENCE,
|
|
58
|
+
SCHEDULE_TIME_REFERENCE_OPTIONS,
|
|
59
|
+
SCHEDULE_TRIGGER_OPTIONS,
|
|
60
|
+
SCRIPT_SCHEDULE_TRIGGER,
|
|
61
|
+
ScheduleFormFields,
|
|
62
|
+
ScheduleIntervalInput,
|
|
63
|
+
ScheduleOfflineFields,
|
|
64
|
+
ScheduleScriptPickerCard,
|
|
65
|
+
ScheduleScriptSearchField,
|
|
66
|
+
ScheduleScriptsField,
|
|
67
|
+
ScheduleTimingFields,
|
|
68
|
+
applyTimeSlot,
|
|
69
|
+
dateToTimeSlot,
|
|
70
|
+
earliestDeviceLocalDay,
|
|
71
|
+
earliestScheduleDay,
|
|
72
|
+
fromScheduleInstant,
|
|
73
|
+
getTimeSlotOptions,
|
|
74
|
+
isDeviceLocalTime,
|
|
75
|
+
isEventTrigger,
|
|
76
|
+
isRetryOnReconnect,
|
|
77
|
+
isScheduleStartInPast,
|
|
78
|
+
isSlotOnGrid,
|
|
79
|
+
isStartInPastAndChanged,
|
|
80
|
+
slotToLabel,
|
|
81
|
+
snapReconnectInterval,
|
|
82
|
+
snapRepeatInterval,
|
|
83
|
+
startOfToday
|
|
84
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three schedule enums the form branches on, with the values the OpenFrame
|
|
3
|
+
* API uses. A host's generated enums carry the same strings, so its values and
|
|
4
|
+
* these are assignable both ways.
|
|
5
|
+
*/
|
|
6
|
+
/** What fires a schedule: a date and time, or a device coming online. */
|
|
7
|
+
export declare const SCRIPT_SCHEDULE_TRIGGER: {
|
|
8
|
+
readonly DATE_TIME: "DATE_TIME";
|
|
9
|
+
readonly DEVICE_ONLINE: "DEVICE_ONLINE";
|
|
10
|
+
};
|
|
11
|
+
export type ScriptScheduleTrigger = (typeof SCRIPT_SCHEDULE_TRIGGER)[keyof typeof SCRIPT_SCHEDULE_TRIGGER];
|
|
12
|
+
/** Which clock a schedule's date and time mean: the account's, or each device's. */
|
|
13
|
+
export declare const SCHEDULE_TIME_REFERENCE: {
|
|
14
|
+
readonly SERVER: "SERVER";
|
|
15
|
+
readonly DEVICE_LOCAL: "DEVICE_LOCAL";
|
|
16
|
+
};
|
|
17
|
+
export type ScheduleTimeReference = (typeof SCHEDULE_TIME_REFERENCE)[keyof typeof SCHEDULE_TIME_REFERENCE];
|
|
18
|
+
/** What a schedule does with a device that is offline when it fires. */
|
|
19
|
+
export declare const SCHEDULE_OFFLINE_BEHAVIOR: {
|
|
20
|
+
readonly SKIP: "SKIP";
|
|
21
|
+
readonly RETRY_ON_RECONNECT: "RETRY_ON_RECONNECT";
|
|
22
|
+
};
|
|
23
|
+
export type ScheduleOfflineBehavior = (typeof SCHEDULE_OFFLINE_BEHAVIOR)[keyof typeof SCHEDULE_OFFLINE_BEHAVIOR];
|
|
24
|
+
//# sourceMappingURL=schedule-enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-enums.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-enums.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yEAAyE;AACzE,eAAO,MAAM,uBAAuB;;;CAG1B,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAE3G,oFAAoF;AACpF,eAAO,MAAM,uBAAuB;;;CAG1B,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAE3G,wEAAwE;AACxE,eAAO,MAAM,yBAAyB;;;CAG5B,CAAC;AACX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const SCRIPT_SCHEDULE_TRIGGER = {
|
|
3
|
+
DATE_TIME: "DATE_TIME",
|
|
4
|
+
DEVICE_ONLINE: "DEVICE_ONLINE"
|
|
5
|
+
};
|
|
6
|
+
const SCHEDULE_TIME_REFERENCE = {
|
|
7
|
+
SERVER: "SERVER",
|
|
8
|
+
DEVICE_LOCAL: "DEVICE_LOCAL"
|
|
9
|
+
};
|
|
10
|
+
const SCHEDULE_OFFLINE_BEHAVIOR = {
|
|
11
|
+
SKIP: "SKIP",
|
|
12
|
+
RETRY_ON_RECONNECT: "RETRY_ON_RECONNECT"
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
SCHEDULE_OFFLINE_BEHAVIOR,
|
|
16
|
+
SCHEDULE_TIME_REFERENCE,
|
|
17
|
+
SCRIPT_SCHEDULE_TRIGGER
|
|
18
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type OSPlatformOption } from '../../../../utils/os-platforms';
|
|
2
|
+
import type { ScheduleTimeReference } from './schedule-enums';
|
|
3
|
+
import { type RenderScheduleScriptSearch, type ScheduleFormGate, type ScheduleTimeSlot } from './schedule-form-types';
|
|
4
|
+
export interface ScheduleFormFieldsProps {
|
|
5
|
+
showErrors: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Locks every control. This is the edit page's loading state: the real fields,
|
|
8
|
+
* in the geometry they will keep, with nothing in them yet — so there is no
|
|
9
|
+
* placeholder to swap for them when the schedule lands.
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The "Select Script" field of each script card. Searching the script library
|
|
14
|
+
* is the host's query, so the field is a slot: the product passes its
|
|
15
|
+
* data-bound search, a fixture a static one (both draw
|
|
16
|
+
* `ScheduleScriptSearchField`).
|
|
17
|
+
*/
|
|
18
|
+
renderScriptSearch: RenderScheduleScriptSearch;
|
|
19
|
+
/** Whether the Timezone picker is offered: the host's flag, as a gate. Default `off`. */
|
|
20
|
+
timeReferenceGate?: ScheduleFormGate;
|
|
21
|
+
/** The platforms "Supported Platform" offers. Default: every OS platform. */
|
|
22
|
+
platforms?: ReadonlyArray<OSPlatformOption>;
|
|
23
|
+
/** Platform ids shown but not selectable yet ("Coming Soon"). Default none. */
|
|
24
|
+
comingSoonPlatforms?: ReadonlyArray<string>;
|
|
25
|
+
/** The Time dropdown's options; see `ScheduleTimingFields`. Default: the viewer's own clock. */
|
|
26
|
+
getTimeSlots?: (date: Date | null, timeReference: ScheduleTimeReference) => ScheduleTimeSlot[];
|
|
27
|
+
/**
|
|
28
|
+
* `stacked` (default): the name is a row of its own, over the rest. `inline`:
|
|
29
|
+
* on a wide form it sits beside the Date / Time / Repeat row, for a host that
|
|
30
|
+
* shows only those (the sections between them hidden).
|
|
31
|
+
*/
|
|
32
|
+
nameLayout?: 'stacked' | 'inline';
|
|
33
|
+
/** The "Note" field. Default true. */
|
|
34
|
+
showNote?: boolean;
|
|
35
|
+
/** The trigger choice (on a schedule, or when a device comes online). Default true. */
|
|
36
|
+
showTrigger?: boolean;
|
|
37
|
+
/** "Supported Platform". Default true. */
|
|
38
|
+
showPlatforms?: boolean;
|
|
39
|
+
/** "If device is offline at scheduled time". Default true. */
|
|
40
|
+
showOfflineBehavior?: boolean;
|
|
41
|
+
/** The "Scheduled Scripts" heading over the script cards. Default true. */
|
|
42
|
+
showScriptsHeading?: boolean;
|
|
43
|
+
/** Each script card's arguments and environment variables. Default true. */
|
|
44
|
+
showScriptParams?: boolean;
|
|
45
|
+
/** Offer "Add Script". Default true; false is a form of the scripts it opens with. */
|
|
46
|
+
addScripts?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Every field of the schedule form, in the order the design has them. Reads the
|
|
50
|
+
* form off context, so the page around it only owns the chrome and the Save.
|
|
51
|
+
*
|
|
52
|
+
* The defaults are the product's page. The layout props are for a host that
|
|
53
|
+
* shows the form in less room (a picture of it): fewer sections, and the name
|
|
54
|
+
* beside the timing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function ScheduleFormFields({ showErrors, disabled, renderScriptSearch, timeReferenceGate, platforms, comingSoonPlatforms, getTimeSlots, nameLayout, showNote, showTrigger, showPlatforms, showOfflineBehavior, showScriptsHeading, showScriptParams, addScripts, }: ScheduleFormFieldsProps): import("react").JSX.Element;
|
|
57
|
+
//# sourceMappingURL=schedule-form-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-form-fields.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-form-fields.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,KAAK,0BAA0B,EAG/B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAK/B,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,kBAAkB,EAAE,0BAA0B,CAAC;IAC/C,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;IACrC,6EAA6E;IAC7E,SAAS,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC5C,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,gGAAgG;IAChG,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,aAAa,EAAE,qBAAqB,KAAK,gBAAgB,EAAE,CAAC;IAC/F;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAClC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8DAA8D;IAC9D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sFAAsF;IACtF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,QAAgB,EAChB,kBAAkB,EAClB,iBAAyB,EACzB,SAAwB,EACxB,mBAAwB,EACxB,YAAY,EACZ,UAAsB,EACtB,QAAe,EACf,WAAkB,EAClB,aAAoB,EACpB,mBAA0B,EAC1B,kBAAyB,EACzB,gBAAuB,EACvB,UAAiB,GAClB,EAAE,uBAAuB,+BA0JzB"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use no memo";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
|
6
|
+
import { useContentMdUp } from "../../../../hooks/ui/use-content-breakpoint.js";
|
|
7
|
+
import { OS_PLATFORMS } from "../../../../utils/os-platforms.js";
|
|
8
|
+
import { Input } from "../../../ui/input.js";
|
|
9
|
+
import { Label } from "../../../ui/label.js";
|
|
10
|
+
import { RadioGroupBlock } from "../../../ui/radio-group.js";
|
|
11
|
+
import { Textarea } from "../../../ui/textarea.js";
|
|
12
|
+
import { TruncateText } from "../../../ui/truncate-text.js";
|
|
13
|
+
import { SelectButton } from "../../select-button.js";
|
|
14
|
+
import {
|
|
15
|
+
SCHEDULE_TRIGGER_OPTIONS
|
|
16
|
+
} from "./schedule-form-types.js";
|
|
17
|
+
import { ScheduleOfflineFields } from "./schedule-offline-fields.js";
|
|
18
|
+
import { ScheduleScriptsField } from "./schedule-scripts-field.js";
|
|
19
|
+
import { ScheduleTimingFields } from "./schedule-timing-fields.js";
|
|
20
|
+
function ScheduleFormFields({
|
|
21
|
+
showErrors,
|
|
22
|
+
disabled = false,
|
|
23
|
+
renderScriptSearch,
|
|
24
|
+
timeReferenceGate = "off",
|
|
25
|
+
platforms = OS_PLATFORMS,
|
|
26
|
+
comingSoonPlatforms = [],
|
|
27
|
+
getTimeSlots,
|
|
28
|
+
nameLayout = "stacked",
|
|
29
|
+
showNote = true,
|
|
30
|
+
showTrigger = true,
|
|
31
|
+
showPlatforms = true,
|
|
32
|
+
showOfflineBehavior = true,
|
|
33
|
+
showScriptsHeading = true,
|
|
34
|
+
showScriptParams = true,
|
|
35
|
+
addScripts = true
|
|
36
|
+
}) {
|
|
37
|
+
const { control, formState, getValues, setValue } = useFormContext();
|
|
38
|
+
const isMdUp = useContentMdUp();
|
|
39
|
+
const supportedPlatforms = useWatch({ control, name: "supportedPlatforms" });
|
|
40
|
+
const togglePlatform = useCallback(
|
|
41
|
+
(platform) => {
|
|
42
|
+
const current = getValues("supportedPlatforms");
|
|
43
|
+
const has = current.includes(platform);
|
|
44
|
+
setValue("supportedPlatforms", has ? current.filter((p) => p !== platform) : [...current, platform], {
|
|
45
|
+
shouldValidate: true,
|
|
46
|
+
shouldDirty: true
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
[getValues, setValue]
|
|
50
|
+
);
|
|
51
|
+
const nameField = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--spacing-system-xxs)]", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(Label, { className: "text-h4", children: "Schedule Name" }),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
Controller,
|
|
55
|
+
{
|
|
56
|
+
name: "name",
|
|
57
|
+
control,
|
|
58
|
+
render: ({ field, fieldState }) => /* @__PURE__ */ jsx(
|
|
59
|
+
Input,
|
|
60
|
+
{
|
|
61
|
+
placeholder: "Enter schedule name",
|
|
62
|
+
value: field.value,
|
|
63
|
+
onChange: field.onChange,
|
|
64
|
+
disabled,
|
|
65
|
+
className: "w-full",
|
|
66
|
+
error: showErrors ? fieldState.error?.message : void 0,
|
|
67
|
+
invalid: showErrors && !!fieldState.error
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
const platformField = /* @__PURE__ */ jsxs(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: "relative flex flex-col gap-[var(--spacing-system-xxs)]",
|
|
77
|
+
"data-invalid": showErrors && !!formState.errors.supportedPlatforms || void 0,
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx(Label, { className: "text-h4", children: "Supported Platform" }),
|
|
80
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-[var(--spacing-system-mf)] content-md:grid-cols-4", children: platforms.map((platform) => {
|
|
81
|
+
const comingSoon = comingSoonPlatforms.includes(platform.id);
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
SelectButton,
|
|
84
|
+
{
|
|
85
|
+
title: platform.name,
|
|
86
|
+
icon: /* @__PURE__ */ jsx(platform.icon, { className: "h-5 w-5" }),
|
|
87
|
+
selected: !comingSoon && supportedPlatforms.includes(platform.id),
|
|
88
|
+
disabled: comingSoon || disabled,
|
|
89
|
+
tag: comingSoon ? isMdUp ? "Coming Soon" : "Soon" : void 0,
|
|
90
|
+
onClick: comingSoon || disabled ? void 0 : () => togglePlatform(platform.id)
|
|
91
|
+
},
|
|
92
|
+
platform.id
|
|
93
|
+
);
|
|
94
|
+
}) }),
|
|
95
|
+
showErrors && formState.errors.supportedPlatforms && /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 translate-y-full", children: /* @__PURE__ */ jsx(TruncateText, { variant: "h6", className: "text-ods-error", children: formState.errors.supportedPlatforms.message ?? "" }) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
const timingFields = /* @__PURE__ */ jsx(
|
|
100
|
+
ScheduleTimingFields,
|
|
101
|
+
{
|
|
102
|
+
showErrors,
|
|
103
|
+
disabled,
|
|
104
|
+
timeReferenceGate,
|
|
105
|
+
getTimeSlots
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
const nameInline = nameLayout === "inline";
|
|
109
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--spacing-system-lf)]", children: [
|
|
110
|
+
nameInline ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--spacing-system-lf)] content-md:flex-row content-md:items-start", children: [
|
|
111
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 content-md:flex-1", children: nameField }),
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 content-md:flex-[3]", children: timingFields })
|
|
113
|
+
] }) : nameField,
|
|
114
|
+
showNote && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--spacing-system-xxs)]", children: [
|
|
115
|
+
/* @__PURE__ */ jsx(Label, { className: "text-h4", children: "Note" }),
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
Controller,
|
|
118
|
+
{
|
|
119
|
+
name: "description",
|
|
120
|
+
control,
|
|
121
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
122
|
+
Textarea,
|
|
123
|
+
{
|
|
124
|
+
placeholder: "Enter note here (optional)",
|
|
125
|
+
value: field.value,
|
|
126
|
+
onChange: field.onChange,
|
|
127
|
+
disabled,
|
|
128
|
+
className: "min-h-[96px] w-full"
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] }),
|
|
134
|
+
showTrigger && /* @__PURE__ */ jsx(
|
|
135
|
+
Controller,
|
|
136
|
+
{
|
|
137
|
+
name: "trigger",
|
|
138
|
+
control,
|
|
139
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
140
|
+
RadioGroupBlock,
|
|
141
|
+
{
|
|
142
|
+
variant: "grouped",
|
|
143
|
+
value: field.value,
|
|
144
|
+
onValueChange: field.onChange,
|
|
145
|
+
disabled,
|
|
146
|
+
options: SCHEDULE_TRIGGER_OPTIONS
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
showPlatforms && platformField,
|
|
152
|
+
!nameInline && timingFields,
|
|
153
|
+
showOfflineBehavior && /* @__PURE__ */ jsx(ScheduleOfflineFields, { showErrors, disabled }),
|
|
154
|
+
/* @__PURE__ */ jsx(
|
|
155
|
+
ScheduleScriptsField,
|
|
156
|
+
{
|
|
157
|
+
showErrors,
|
|
158
|
+
disabled,
|
|
159
|
+
renderScriptSearch,
|
|
160
|
+
showHeading: showScriptsHeading,
|
|
161
|
+
showScriptParams,
|
|
162
|
+
addScripts
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] });
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
ScheduleFormFields
|
|
169
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ScriptArgument } from '../../../platform/ScriptArguments';
|
|
3
|
+
import { type ScheduleOfflineBehavior, type ScheduleTimeReference, type ScriptScheduleTrigger } from './schedule-enums';
|
|
4
|
+
import { type DurationUnit } from './schedule-timing';
|
|
5
|
+
/** One of a script's own environment variables. `value` is null for a secret: the server masks it on every read. */
|
|
6
|
+
export interface ScheduleFormEnvVar {
|
|
7
|
+
name: string;
|
|
8
|
+
value: string | null;
|
|
9
|
+
secret: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** One card of "Scheduled Scripts": the picked script and what the schedule runs it with. */
|
|
12
|
+
export interface ScheduleFormScriptRow {
|
|
13
|
+
/** `''` = no script picked yet. */
|
|
14
|
+
scriptId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
/** The picked script's OWN platforms (UI ids) — a host checks them against the schedule's. */
|
|
17
|
+
supportedPlatforms: string[];
|
|
18
|
+
timeoutSeconds: number;
|
|
19
|
+
args: ScriptArgument[];
|
|
20
|
+
envVars: ScriptArgument[];
|
|
21
|
+
/**
|
|
22
|
+
* The picked script's OWN defaults, carried with no control of their
|
|
23
|
+
* own: an override is written only for the half that differs from
|
|
24
|
+
* them, so a schedule keeps inheriting later edits to the script
|
|
25
|
+
* instead of freezing a copy the day it was saved.
|
|
26
|
+
*/
|
|
27
|
+
defaultArgs: string[];
|
|
28
|
+
defaultEnvVars: ScheduleFormEnvVar[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Everything the schedule form holds. The fields read it off the
|
|
32
|
+
* react-hook-form context; the host owns the form itself (its schema, its
|
|
33
|
+
* seeding, its submit), and checks its own form type against this one.
|
|
34
|
+
*/
|
|
35
|
+
export interface ScheduleFormData {
|
|
36
|
+
name: string;
|
|
37
|
+
/** "Note" in the UI. */
|
|
38
|
+
description: string;
|
|
39
|
+
trigger: ScriptScheduleTrigger;
|
|
40
|
+
scheduledDate: Date | null;
|
|
41
|
+
/** `HH:mm` on the 30-minute grid; `''` = the user hasn't picked a time yet. */
|
|
42
|
+
scheduledTime: string;
|
|
43
|
+
/** Which clock the pair above means — the "Timezone" control. Held even when the control is not rendered. */
|
|
44
|
+
timeReference: ScheduleTimeReference;
|
|
45
|
+
repeatEnabled: boolean;
|
|
46
|
+
/** `null` while the box is EMPTY — the user is mid-edit, not proposing zero. */
|
|
47
|
+
repeatInterval: number | null;
|
|
48
|
+
repeatUnit: DurationUnit;
|
|
49
|
+
/** The stored cadence the form was seeded with, carried with no control of its own. */
|
|
50
|
+
repeatSecondsStored: number | null;
|
|
51
|
+
/**
|
|
52
|
+
* The stored start the form was seeded with, carried with no control of its
|
|
53
|
+
* own: a start that has already passed stays legal for as long as the form
|
|
54
|
+
* still shows exactly it (see `isStartInPastAndChanged`).
|
|
55
|
+
*/
|
|
56
|
+
startAtStored: string | null;
|
|
57
|
+
offlineBehavior: ScheduleOfflineBehavior;
|
|
58
|
+
/** "Stop Retry after", as the `[interval] [unit]` pair. `null` while the box is empty. */
|
|
59
|
+
reconnectInterval: number | null;
|
|
60
|
+
reconnectUnit: DurationUnit;
|
|
61
|
+
/** The stored reconnect window the form was seeded with, carried with no control of its own. */
|
|
62
|
+
reconnectWindowSecondsStored: number | null;
|
|
63
|
+
/** UI platform ids the schedule targets. */
|
|
64
|
+
supportedPlatforms: string[];
|
|
65
|
+
/** Card order IS the run order. */
|
|
66
|
+
scripts: ScheduleFormScriptRow[];
|
|
67
|
+
}
|
|
68
|
+
export declare const EMPTY_SCHEDULE_SCRIPT_ROW: ScheduleFormScriptRow;
|
|
69
|
+
export declare const SCHEDULE_TRIGGER_OPTIONS: ({
|
|
70
|
+
value: "DATE_TIME";
|
|
71
|
+
label: string;
|
|
72
|
+
description: string;
|
|
73
|
+
} | {
|
|
74
|
+
value: "DEVICE_ONLINE";
|
|
75
|
+
label: string;
|
|
76
|
+
description: string;
|
|
77
|
+
})[];
|
|
78
|
+
/**
|
|
79
|
+
* The "Timezone" dropdown (design node 793:61340), in the designer's own
|
|
80
|
+
* wording: the account's clock, or each device's.
|
|
81
|
+
*
|
|
82
|
+
* SERVER first — it is the backend's documented default for a null
|
|
83
|
+
* `timeReference`, and it is what every schedule authored before the field
|
|
84
|
+
* existed already means.
|
|
85
|
+
*/
|
|
86
|
+
export declare const SCHEDULE_TIME_REFERENCE_OPTIONS: ({
|
|
87
|
+
value: "SERVER";
|
|
88
|
+
label: string;
|
|
89
|
+
} | {
|
|
90
|
+
value: "DEVICE_LOCAL";
|
|
91
|
+
label: string;
|
|
92
|
+
})[];
|
|
93
|
+
/**
|
|
94
|
+
* The two answers to "if device is offline at scheduled time" (design node
|
|
95
|
+
* 460:63425). SKIP first, because it is both the design's default and the
|
|
96
|
+
* behavior every schedule authored before this field existed already has — the
|
|
97
|
+
* backend reads a null `offlineBehavior` as SKIP.
|
|
98
|
+
*/
|
|
99
|
+
export declare const SCHEDULE_OFFLINE_BEHAVIOR_OPTIONS: ({
|
|
100
|
+
value: "SKIP";
|
|
101
|
+
label: string;
|
|
102
|
+
description: string;
|
|
103
|
+
} | {
|
|
104
|
+
value: "RETRY_ON_RECONNECT";
|
|
105
|
+
label: string;
|
|
106
|
+
description: string;
|
|
107
|
+
})[];
|
|
108
|
+
export declare const DEFAULT_SCHEDULE_FORM_VALUES: ScheduleFormData;
|
|
109
|
+
/**
|
|
110
|
+
* A flag a host has asked about and may not have an answer to yet. `loading`
|
|
111
|
+
* is never read as `off`: the fields it decides are locked until it settles.
|
|
112
|
+
*/
|
|
113
|
+
export type ScheduleFormGate = 'on' | 'off' | 'loading';
|
|
114
|
+
/** One option of the Time dropdown: `value` is 24h `HH:mm`, `label` what the viewer reads. */
|
|
115
|
+
export interface ScheduleTimeSlot {
|
|
116
|
+
value: string;
|
|
117
|
+
label: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* What a card's "Select Script" slot is told. Searching the script library is
|
|
121
|
+
* the host's query, so the field is a slot: the product passes its data-bound
|
|
122
|
+
* search, a fixture passes a static one. Both draw `ScheduleScriptSearchField`.
|
|
123
|
+
*/
|
|
124
|
+
export interface ScheduleScriptSearchSlotProps {
|
|
125
|
+
/** The card's script: `''` while nothing is picked. */
|
|
126
|
+
scriptId: string;
|
|
127
|
+
/** Its name — the label shown when the script is not on the current search page. */
|
|
128
|
+
name: string;
|
|
129
|
+
/** UI platform ids the schedule targets — what a host narrows its search by. */
|
|
130
|
+
supportedPlatforms: string[];
|
|
131
|
+
/** Writes the card: the row a picked script seeds, or null when the field is cleared. */
|
|
132
|
+
onPick: (row: ScheduleFormScriptRow | null) => void;
|
|
133
|
+
disabled: boolean;
|
|
134
|
+
error: string | undefined;
|
|
135
|
+
invalid: boolean;
|
|
136
|
+
}
|
|
137
|
+
export type RenderScheduleScriptSearch = (field: ScheduleScriptSearchSlotProps) => ReactNode;
|
|
138
|
+
//# sourceMappingURL=schedule-form-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-form-types.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-form-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
SCHEDULE_OFFLINE_BEHAVIOR,
|
|
4
|
+
SCHEDULE_TIME_REFERENCE,
|
|
5
|
+
SCRIPT_SCHEDULE_TRIGGER
|
|
6
|
+
} from "./schedule-enums.js";
|
|
7
|
+
import { DEFAULT_RECONNECT_WINDOW } from "./schedule-timing.js";
|
|
8
|
+
const EMPTY_SCHEDULE_SCRIPT_ROW = {
|
|
9
|
+
scriptId: "",
|
|
10
|
+
name: "",
|
|
11
|
+
supportedPlatforms: [],
|
|
12
|
+
// 0 keeps the Timeout field locked and empty until a script is picked.
|
|
13
|
+
timeoutSeconds: 0,
|
|
14
|
+
args: [],
|
|
15
|
+
envVars: [],
|
|
16
|
+
defaultArgs: [],
|
|
17
|
+
defaultEnvVars: []
|
|
18
|
+
};
|
|
19
|
+
const SCHEDULE_TRIGGER_OPTIONS = [
|
|
20
|
+
{
|
|
21
|
+
value: SCRIPT_SCHEDULE_TRIGGER.DATE_TIME,
|
|
22
|
+
label: "Run on schedule",
|
|
23
|
+
description: "Runs at the set date and time, whether or not the device is online."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: SCRIPT_SCHEDULE_TRIGGER.DEVICE_ONLINE,
|
|
27
|
+
label: "Run when device comes online",
|
|
28
|
+
description: "Waits for the device to connect, then runs as soon as it's reachable."
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
const SCHEDULE_TIME_REFERENCE_OPTIONS = [
|
|
32
|
+
{ value: SCHEDULE_TIME_REFERENCE.SERVER, label: "Your account timezone" },
|
|
33
|
+
{ value: SCHEDULE_TIME_REFERENCE.DEVICE_LOCAL, label: "Device local timezone" }
|
|
34
|
+
];
|
|
35
|
+
const SCHEDULE_OFFLINE_BEHAVIOR_OPTIONS = [
|
|
36
|
+
{
|
|
37
|
+
value: SCHEDULE_OFFLINE_BEHAVIOR.SKIP,
|
|
38
|
+
label: "Skip this Run",
|
|
39
|
+
description: "Next run stays on schedule. Missed runs are logged."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: SCHEDULE_OFFLINE_BEHAVIOR.RETRY_ON_RECONNECT,
|
|
43
|
+
label: "Run when device comes back online",
|
|
44
|
+
description: "Executes on the next reconnect."
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
const DEFAULT_SCHEDULE_FORM_VALUES = {
|
|
48
|
+
name: "",
|
|
49
|
+
description: "",
|
|
50
|
+
trigger: SCRIPT_SCHEDULE_TRIGGER.DATE_TIME,
|
|
51
|
+
scheduledDate: null,
|
|
52
|
+
scheduledTime: "",
|
|
53
|
+
timeReference: SCHEDULE_TIME_REFERENCE.SERVER,
|
|
54
|
+
repeatEnabled: false,
|
|
55
|
+
repeatInterval: 1,
|
|
56
|
+
repeatUnit: "day",
|
|
57
|
+
repeatSecondsStored: null,
|
|
58
|
+
startAtStored: null,
|
|
59
|
+
offlineBehavior: SCHEDULE_OFFLINE_BEHAVIOR.SKIP,
|
|
60
|
+
reconnectInterval: DEFAULT_RECONNECT_WINDOW.interval,
|
|
61
|
+
reconnectUnit: DEFAULT_RECONNECT_WINDOW.unit,
|
|
62
|
+
reconnectWindowSecondsStored: null,
|
|
63
|
+
supportedPlatforms: ["windows"],
|
|
64
|
+
scripts: [EMPTY_SCHEDULE_SCRIPT_ROW]
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
DEFAULT_SCHEDULE_FORM_VALUES,
|
|
68
|
+
EMPTY_SCHEDULE_SCRIPT_ROW,
|
|
69
|
+
SCHEDULE_OFFLINE_BEHAVIOR_OPTIONS,
|
|
70
|
+
SCHEDULE_TIME_REFERENCE_OPTIONS,
|
|
71
|
+
SCHEDULE_TRIGGER_OPTIONS
|
|
72
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
interface ScheduleIntervalInputProps {
|
|
2
|
+
/** The form's value. `null` = the box is empty. */
|
|
3
|
+
value: number | null;
|
|
4
|
+
onChange: (next: number | null) => void;
|
|
5
|
+
/**
|
|
6
|
+
* The form's own blur handler. Load-bearing, not optional plumbing: react-hook-form
|
|
7
|
+
* learns a field was left ONLY through this, and `reValidateMode: 'onBlur'` is
|
|
8
|
+
* what re-runs the schema. Without it an error the user has already fixed sits
|
|
9
|
+
* on screen until the next Save.
|
|
10
|
+
*/
|
|
11
|
+
onBlur?: () => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
invalid?: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
min?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Marks this box as where `scrollToFirstInvalidField` should put focus when
|
|
20
|
+
* the error is carried by an ancestor rather than by the input itself.
|
|
21
|
+
*/
|
|
22
|
+
'data-invalid-focus'?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The `[interval]` half of the form's two duration pairs (Repeat in, Stop Retry
|
|
26
|
+
* after).
|
|
27
|
+
*
|
|
28
|
+
* **What the user types owns the display; the form value never writes back into
|
|
29
|
+
* it while the field has focus.** That inversion is the whole component. Binding
|
|
30
|
+
* a number input straight to validated state reads as a bug rather than a rule:
|
|
31
|
+
* the previous version coerced an emptied box back to a floor on every
|
|
32
|
+
* keystroke, so the digit reappeared as fast as it was deleted and "1" could not
|
|
33
|
+
* be typed over. Any round trip through `Number()` has the same shape in
|
|
34
|
+
* smaller ways — a leading zero vanishes mid-word, "10" briefly becomes "1"
|
|
35
|
+
* while a character is being removed.
|
|
36
|
+
*
|
|
37
|
+
* So the raw string is local state, and the form is told the PARSED value as it
|
|
38
|
+
* changes. Keeping the form current (rather than committing on blur alone)
|
|
39
|
+
* matters for one case: submitting with Enter never fires a blur, and a form
|
|
40
|
+
* reading a stale interval would save a number the user cannot see.
|
|
41
|
+
*
|
|
42
|
+
* The reverse direction — form → box — is deliberately narrow. It runs only
|
|
43
|
+
* when the field is NOT focused, which is exactly the set of changes that come
|
|
44
|
+
* from somewhere else: the record arriving (`useSeedForm`), or the unit
|
|
45
|
+
* dropdown raising the interval to its floor. While the box has focus those
|
|
46
|
+
* cannot happen, and nothing else may repaint what is being typed.
|
|
47
|
+
*
|
|
48
|
+
* Validation timing is the form's business, not this component's: errors are
|
|
49
|
+
* held until the first Save (`showErrors`) and re-checked on blur
|
|
50
|
+
* (`reValidateMode`), so nothing here is judged mid-word.
|
|
51
|
+
*/
|
|
52
|
+
export declare function ScheduleIntervalInput({ value, onChange, onBlur, disabled, invalid, error, min, className, 'aria-label': ariaLabel, 'data-invalid-focus': invalidFocus, }: ScheduleIntervalInputProps): import("react").JSX.Element;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=schedule-interval-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-interval-input.d.ts","sourceRoot":"","sources":["../../../../../src/components/features/scripts/schedule-form/schedule-interval-input.tsx"],"names":[],"mappings":"AAKA,UAAU,0BAA0B;IAClC,mDAAmD;IACnD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACxC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,KAAK,EACL,GAAG,EACH,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,oBAAoB,EAAE,YAAY,GACnC,EAAE,0BAA0B,+BAoD5B"}
|