@bikdotai/bik-component-library 0.0.868-beta.8 → 0.0.868
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/README.md +0 -3
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/bik-copilot/BIKCopilot.js +2 -0
- package/dist/cjs/components/bik-copilot/BIKCopilot.js.map +1 -0
- package/dist/cjs/components/bik-copilot/ControlledCopilot.js +2 -0
- package/dist/cjs/components/bik-copilot/ControlledCopilot.js.map +1 -0
- package/dist/cjs/components/bik-copilot/ControlledCopilot.styled.js +27 -0
- package/dist/cjs/components/bik-copilot/ControlledCopilot.styled.js.map +1 -0
- package/dist/cjs/components/bik-copilot/CopilotBall.js +2 -0
- package/dist/cjs/components/bik-copilot/CopilotBall.js.map +1 -0
- package/dist/cjs/components/bik-copilot/CopilotBall.styled.js +42 -0
- package/dist/cjs/components/bik-copilot/CopilotBall.styled.js.map +1 -0
- package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.js +2 -0
- package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.js.map +1 -0
- package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.styled.js +108 -0
- package/dist/cjs/components/bik-copilot/CopilotFeedbackModal.styled.js.map +1 -0
- package/dist/cjs/components/bik-copilot/CopilotPanel.js +2 -0
- package/dist/cjs/components/bik-copilot/CopilotPanel.js.map +1 -0
- package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js +534 -0
- package/dist/cjs/components/bik-copilot/CopilotPanel.styled.js.map +1 -0
- package/dist/cjs/components/bik-copilot/copilotPlacement.js +2 -0
- package/dist/cjs/components/bik-copilot/copilotPlacement.js.map +1 -0
- package/dist/cjs/components/bik-copilot/copilotRegenerate.js +2 -0
- package/dist/cjs/components/bik-copilot/copilotRegenerate.js.map +1 -0
- package/dist/cjs/components/bik-copilot/services/copilotDb.js +2 -0
- package/dist/cjs/components/bik-copilot/services/copilotDb.js.map +1 -0
- package/dist/cjs/components/bik-copilot/services/copilotFeedbackClient.js +2 -0
- package/dist/cjs/components/bik-copilot/services/copilotFeedbackClient.js.map +1 -0
- package/dist/cjs/components/bik-copilot/services/copilotIcebreakersClient.js +2 -0
- package/dist/cjs/components/bik-copilot/services/copilotIcebreakersClient.js.map +1 -0
- package/dist/cjs/components/bik-copilot/services/copilotMessagesClient.js +2 -0
- package/dist/cjs/components/bik-copilot/services/copilotMessagesClient.js.map +1 -0
- package/dist/cjs/components/bik-copilot/services/copilotPageSession.js +2 -0
- package/dist/cjs/components/bik-copilot/services/copilotPageSession.js.map +1 -0
- package/dist/cjs/components/bik-copilot/services/copilotSseParser.js +7 -0
- package/dist/cjs/components/bik-copilot/services/copilotSseParser.js.map +1 -0
- package/dist/cjs/components/bik-copilot/services/copilotStreamClient.js +2 -0
- package/dist/cjs/components/bik-copilot/services/copilotStreamClient.js.map +1 -0
- package/dist/cjs/components/bik-copilot/useCopilotIcebreakers.js +2 -0
- package/dist/cjs/components/bik-copilot/useCopilotIcebreakers.js.map +1 -0
- package/dist/cjs/components/bik-copilot/useCopilotStreamChat.js +2 -0
- package/dist/cjs/components/bik-copilot/useCopilotStreamChat.js.map +1 -0
- package/dist/cjs/components/bik-copilot/useDraggableFloater.js +2 -0
- package/dist/cjs/components/bik-copilot/useDraggableFloater.js.map +1 -0
- package/dist/cjs/components/bik-copilot/utils/markdown.js +4 -0
- package/dist/cjs/components/bik-copilot/utils/markdown.js.map +1 -0
- package/dist/cjs/components/bik-copilot/utils/toolCtas.js +2 -0
- package/dist/cjs/components/bik-copilot/utils/toolCtas.js.map +1 -0
- package/dist/cjs/components/button/themes.js +2 -2
- package/dist/cjs/components/button/themes.js.map +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/agent-builder/constants/tools.d.ts +1 -0
- package/dist/esm/components/agent-builder/constants/tools.js +18 -18
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/bik-copilot/BIKCopilot.d.ts +31 -0
- package/dist/esm/components/bik-copilot/BIKCopilot.js +118 -0
- package/dist/esm/components/bik-copilot/BIKCopilot.js.map +1 -0
- package/dist/esm/components/bik-copilot/ControlledCopilot.d.ts +14 -0
- package/dist/esm/components/bik-copilot/ControlledCopilot.js +174 -0
- package/dist/esm/components/bik-copilot/ControlledCopilot.js.map +1 -0
- package/dist/esm/components/bik-copilot/ControlledCopilot.styled.d.ts +7 -0
- package/dist/esm/components/bik-copilot/ControlledCopilot.styled.js +31 -0
- package/dist/esm/components/bik-copilot/ControlledCopilot.styled.js.map +1 -0
- package/dist/esm/components/bik-copilot/CopilotBall.d.ts +13 -0
- package/dist/esm/components/bik-copilot/CopilotBall.js +50 -0
- package/dist/esm/components/bik-copilot/CopilotBall.js.map +1 -0
- package/dist/esm/components/bik-copilot/CopilotBall.styled.d.ts +9 -0
- package/dist/esm/components/bik-copilot/CopilotBall.styled.js +46 -0
- package/dist/esm/components/bik-copilot/CopilotBall.styled.js.map +1 -0
- package/dist/esm/components/bik-copilot/CopilotFeedbackModal.d.ts +29 -0
- package/dist/esm/components/bik-copilot/CopilotFeedbackModal.js +73 -0
- package/dist/esm/components/bik-copilot/CopilotFeedbackModal.js.map +1 -0
- package/dist/esm/components/bik-copilot/CopilotFeedbackModal.styled.d.ts +12 -0
- package/dist/esm/components/bik-copilot/CopilotFeedbackModal.styled.js +122 -0
- package/dist/esm/components/bik-copilot/CopilotFeedbackModal.styled.js.map +1 -0
- package/dist/esm/components/bik-copilot/CopilotPanel.d.ts +9 -0
- package/dist/esm/components/bik-copilot/CopilotPanel.js +536 -0
- package/dist/esm/components/bik-copilot/CopilotPanel.js.map +1 -0
- package/dist/esm/components/bik-copilot/CopilotPanel.styled.d.ts +67 -0
- package/dist/esm/components/bik-copilot/CopilotPanel.styled.js +573 -0
- package/dist/esm/components/bik-copilot/CopilotPanel.styled.js.map +1 -0
- package/dist/esm/components/bik-copilot/copilotPlacement.d.ts +24 -0
- package/dist/esm/components/bik-copilot/copilotPlacement.js +38 -0
- package/dist/esm/components/bik-copilot/copilotPlacement.js.map +1 -0
- package/dist/esm/components/bik-copilot/copilotRegenerate.d.ts +22 -0
- package/dist/esm/components/bik-copilot/copilotRegenerate.js +6 -0
- package/dist/esm/components/bik-copilot/copilotRegenerate.js.map +1 -0
- package/dist/esm/components/bik-copilot/index.d.ts +19 -0
- package/dist/esm/components/bik-copilot/model.d.ts +804 -0
- package/dist/esm/components/bik-copilot/services/copilotDb.d.ts +90 -0
- package/dist/esm/components/bik-copilot/services/copilotDb.js +96 -0
- package/dist/esm/components/bik-copilot/services/copilotDb.js.map +1 -0
- package/dist/esm/components/bik-copilot/services/copilotFeedbackClient.d.ts +15 -0
- package/dist/esm/components/bik-copilot/services/copilotFeedbackClient.js +55 -0
- package/dist/esm/components/bik-copilot/services/copilotFeedbackClient.js.map +1 -0
- package/dist/esm/components/bik-copilot/services/copilotIcebreakersClient.d.ts +11 -0
- package/dist/esm/components/bik-copilot/services/copilotIcebreakersClient.js +54 -0
- package/dist/esm/components/bik-copilot/services/copilotIcebreakersClient.js.map +1 -0
- package/dist/esm/components/bik-copilot/services/copilotMessagesClient.d.ts +23 -0
- package/dist/esm/components/bik-copilot/services/copilotMessagesClient.js +78 -0
- package/dist/esm/components/bik-copilot/services/copilotMessagesClient.js.map +1 -0
- package/dist/esm/components/bik-copilot/services/copilotPageSession.d.ts +37 -0
- package/dist/esm/components/bik-copilot/services/copilotPageSession.js +35 -0
- package/dist/esm/components/bik-copilot/services/copilotPageSession.js.map +1 -0
- package/dist/esm/components/bik-copilot/services/copilotSseParser.d.ts +22 -0
- package/dist/esm/components/bik-copilot/services/copilotSseParser.js +52 -0
- package/dist/esm/components/bik-copilot/services/copilotSseParser.js.map +1 -0
- package/dist/esm/components/bik-copilot/services/copilotStreamClient.d.ts +35 -0
- package/dist/esm/components/bik-copilot/services/copilotStreamClient.js +110 -0
- package/dist/esm/components/bik-copilot/services/copilotStreamClient.js.map +1 -0
- package/dist/esm/components/bik-copilot/useCopilotIcebreakers.d.ts +17 -0
- package/dist/esm/components/bik-copilot/useCopilotIcebreakers.js +60 -0
- package/dist/esm/components/bik-copilot/useCopilotIcebreakers.js.map +1 -0
- package/dist/esm/components/bik-copilot/useCopilotStreamChat.d.ts +20 -0
- package/dist/esm/components/bik-copilot/useCopilotStreamChat.js +377 -0
- package/dist/esm/components/bik-copilot/useCopilotStreamChat.js.map +1 -0
- package/dist/esm/components/bik-copilot/useDraggableFloater.d.ts +9 -0
- package/dist/esm/components/bik-copilot/useDraggableFloater.js +118 -0
- package/dist/esm/components/bik-copilot/useDraggableFloater.js.map +1 -0
- package/dist/esm/components/bik-copilot/utils/markdown.d.ts +1 -0
- package/dist/esm/components/bik-copilot/utils/markdown.js +48 -0
- package/dist/esm/components/bik-copilot/utils/markdown.js.map +1 -0
- package/dist/esm/components/bik-copilot/utils/toolCtas.d.ts +6 -0
- package/dist/esm/components/bik-copilot/utils/toolCtas.js +27 -0
- package/dist/esm/components/bik-copilot/utils/toolCtas.js.map +1 -0
- package/dist/esm/components/button/themes.js +1 -2
- package/dist/esm/components/button/themes.js.map +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +0 -7
- package/dist/esm/components/datePicker/DatePickerWrapper.js +64 -66
- package/dist/esm/components/datePicker/DatePickerWrapper.js.map +1 -1
- package/dist/esm/components/datePicker/index.d.ts +0 -1
- package/dist/esm/index.d.ts +1 -3
- package/dist/esm/index.js +844 -828
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/chip-selector/ChipSelector.js +0 -2
- package/dist/cjs/components/chip-selector/ChipSelector.js.map +0 -1
- package/dist/cjs/components/chip-selector/ChipSelector.styled.js +0 -36
- package/dist/cjs/components/chip-selector/ChipSelector.styled.js.map +0 -1
- package/dist/cjs/components/chip-selector/ChipSelectorGroup.js +0 -2
- package/dist/cjs/components/chip-selector/ChipSelectorGroup.js.map +0 -1
- package/dist/cjs/components/combo-box/ComboBox.js +0 -2
- package/dist/cjs/components/combo-box/ComboBox.js.map +0 -1
- package/dist/cjs/components/combo-box/ComboBox.styled.js +0 -33
- package/dist/cjs/components/combo-box/ComboBox.styled.js.map +0 -1
- package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js +0 -2
- package/dist/cjs/components/schedule-builder/RefreshSegmentToggle.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js +0 -138
- package/dist/cjs/components/schedule-builder/ScheduleBuilder.styled.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleEndPicker.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleFrequencyPicker.js.map +0 -1
- package/dist/cjs/components/schedule-builder/ScheduleHelper.js +0 -2
- package/dist/cjs/components/schedule-builder/ScheduleHelper.js.map +0 -1
- package/dist/cjs/components/schedule-builder/SendModeSelector.js +0 -2
- package/dist/cjs/components/schedule-builder/SendModeSelector.js.map +0 -1
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js +0 -2
- package/dist/cjs/components/schedule-builder/StartDateTimePicker.js.map +0 -1
- package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js +0 -2
- package/dist/cjs/components/schedule-builder/UpcomingRunsPreview.js.map +0 -1
- package/dist/cjs/components/schedule-builder/model.js +0 -2
- package/dist/cjs/components/schedule-builder/model.js.map +0 -1
- package/dist/esm/components/chip-selector/ChipSelector.d.ts +0 -9
- package/dist/esm/components/chip-selector/ChipSelector.js +0 -27
- package/dist/esm/components/chip-selector/ChipSelector.js.map +0 -1
- package/dist/esm/components/chip-selector/ChipSelector.styled.d.ts +0 -10
- package/dist/esm/components/chip-selector/ChipSelector.styled.js +0 -48
- package/dist/esm/components/chip-selector/ChipSelector.styled.js.map +0 -1
- package/dist/esm/components/chip-selector/ChipSelectorGroup.d.ts +0 -10
- package/dist/esm/components/chip-selector/ChipSelectorGroup.js +0 -48
- package/dist/esm/components/chip-selector/ChipSelectorGroup.js.map +0 -1
- package/dist/esm/components/chip-selector/index.d.ts +0 -4
- package/dist/esm/components/chip-selector/model.d.ts +0 -106
- package/dist/esm/components/combo-box/ComboBox.d.ts +0 -15
- package/dist/esm/components/combo-box/ComboBox.js +0 -118
- package/dist/esm/components/combo-box/ComboBox.js.map +0 -1
- package/dist/esm/components/combo-box/ComboBox.styled.d.ts +0 -12
- package/dist/esm/components/combo-box/ComboBox.styled.js +0 -40
- package/dist/esm/components/combo-box/ComboBox.styled.js.map +0 -1
- package/dist/esm/components/combo-box/index.d.ts +0 -3
- package/dist/esm/components/combo-box/model.d.ts +0 -55
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.d.ts +0 -22
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js +0 -31
- package/dist/esm/components/schedule-builder/RefreshSegmentToggle.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleBuilder.d.ts +0 -88
- package/dist/esm/components/schedule-builder/ScheduleBuilder.js +0 -105
- package/dist/esm/components/schedule-builder/ScheduleBuilder.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.d.ts +0 -81
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js +0 -168
- package/dist/esm/components/schedule-builder/ScheduleBuilder.styled.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.d.ts +0 -17
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.js +0 -105
- package/dist/esm/components/schedule-builder/ScheduleEndPicker.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.d.ts +0 -21
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js +0 -136
- package/dist/esm/components/schedule-builder/ScheduleFrequencyPicker.js.map +0 -1
- package/dist/esm/components/schedule-builder/ScheduleHelper.d.ts +0 -110
- package/dist/esm/components/schedule-builder/ScheduleHelper.js +0 -196
- package/dist/esm/components/schedule-builder/ScheduleHelper.js.map +0 -1
- package/dist/esm/components/schedule-builder/SendModeSelector.d.ts +0 -29
- package/dist/esm/components/schedule-builder/SendModeSelector.js +0 -41
- package/dist/esm/components/schedule-builder/SendModeSelector.js.map +0 -1
- package/dist/esm/components/schedule-builder/StartDateTimePicker.d.ts +0 -51
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js +0 -120
- package/dist/esm/components/schedule-builder/StartDateTimePicker.js.map +0 -1
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.d.ts +0 -19
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js +0 -44
- package/dist/esm/components/schedule-builder/UpcomingRunsPreview.js.map +0 -1
- package/dist/esm/components/schedule-builder/index.d.ts +0 -18
- package/dist/esm/components/schedule-builder/model.d.ts +0 -69
- package/dist/esm/components/schedule-builder/model.js +0 -8
- package/dist/esm/components/schedule-builder/model.js.map +0 -1
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Step between offered times, in minutes.
|
|
4
|
-
*
|
|
5
|
-
* Exported because a host seeding a default time has to round onto the same step
|
|
6
|
-
* — otherwise the seeded value is not one of the options the dropdown offers.
|
|
7
|
-
*/
|
|
8
|
-
export declare const TIME_STEP_MINUTES = 30;
|
|
9
|
-
/**
|
|
10
|
-
* Reads a typed 12-hour time.
|
|
11
|
-
*
|
|
12
|
-
* Accepts "9", "9:5" and "09:05" so the merchant can type naturally; am/pm sits
|
|
13
|
-
* on its own dropdown, so only 1-12 is valid here. Returns null while the text is
|
|
14
|
-
* incomplete, which is what keeps the field editable mid-entry.
|
|
15
|
-
*/
|
|
16
|
-
export declare const parseTimeText: (text: string) => {
|
|
17
|
-
hours: string;
|
|
18
|
-
minutes: string;
|
|
19
|
-
} | null;
|
|
20
|
-
export interface StartDateTimePickerProps {
|
|
21
|
-
/** The chosen date. Time-of-day is carried separately by hours/minutes/isAm. */
|
|
22
|
-
date?: Date;
|
|
23
|
-
onDateChange: (date: Date) => void;
|
|
24
|
-
/** 12-hour clock, "1"–"12". Empty string while nothing is chosen. */
|
|
25
|
-
hours: string;
|
|
26
|
-
/** "0"–"59". Empty string while nothing is chosen. */
|
|
27
|
-
minutes: string;
|
|
28
|
-
isAm: boolean;
|
|
29
|
-
/** Fires only for a parseable time, so partial typing does not clear state. */
|
|
30
|
-
onTimeChange: (time: {
|
|
31
|
-
hours: string;
|
|
32
|
-
minutes: string;
|
|
33
|
-
}) => void;
|
|
34
|
-
onMeridiemChange: (isAm: boolean) => void;
|
|
35
|
-
/** Called when focus leaves an unparseable time, for the caller to validate. */
|
|
36
|
-
onTimeInvalidBlur?: () => void;
|
|
37
|
-
/** Shown under the time field. The caller owns validation. */
|
|
38
|
-
timeErrorMessage?: string;
|
|
39
|
-
/** "Start date" when a recurrence follows, plain "Date" otherwise. */
|
|
40
|
-
dateLabel?: string;
|
|
41
|
-
minDate?: Date;
|
|
42
|
-
'data-test'?: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The start date and time-of-day row.
|
|
46
|
-
*
|
|
47
|
-
* Date and time are separate props rather than one Date because the time is
|
|
48
|
-
* edited as text and can be mid-entry ("9:" is not a time yet) — folding it into
|
|
49
|
-
* a Date would force a guess about what an incomplete entry means.
|
|
50
|
-
*/
|
|
51
|
-
export declare const StartDateTimePicker: React.FC<StartDateTimePickerProps>;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as P } from "react";
|
|
3
|
-
import { COLORS as p } from "../../constants/Theme.js";
|
|
4
|
-
import { ComboBox as $ } from "../combo-box/ComboBox.js";
|
|
5
|
-
import { BodySecondary as u } from "../TypographyStyle.js";
|
|
6
|
-
import { FieldsRow as A, DateFieldColumn as C, FieldLabel as h, RequiredMark as f, DatePickerSlot as k, TimeFieldColumn as B, TimeInputRow as F, TimeDropdownSlot as I, MeridiemDropdownSlot as R } from "./ScheduleBuilder.styled.js";
|
|
7
|
-
import { DatePickerWrapper as z } from "../datePicker/DatePickerWrapper.js";
|
|
8
|
-
import { DateButtonType as E } from "../datePicker/model.js";
|
|
9
|
-
import { Dropdown as L } from "../dropdown/Dropdown.js";
|
|
10
|
-
const O = 30, s = (c) => {
|
|
11
|
-
const d = c.trim();
|
|
12
|
-
if (!d) return null;
|
|
13
|
-
const i = d.match(/^(\d{1,2})(?::(\d{1,2}))?$/);
|
|
14
|
-
if (!i) return null;
|
|
15
|
-
const n = Number(i[1]), a = i[2] === void 0 ? 0 : Number(i[2]);
|
|
16
|
-
return n < 1 || n > 12 || a > 59 ? null : { hours: String(n), minutes: String(a) };
|
|
17
|
-
}, J = ({
|
|
18
|
-
date: c,
|
|
19
|
-
onDateChange: d,
|
|
20
|
-
hours: i,
|
|
21
|
-
minutes: n,
|
|
22
|
-
isAm: a,
|
|
23
|
-
onTimeChange: S,
|
|
24
|
-
onMeridiemChange: y,
|
|
25
|
-
onTimeInvalidBlur: M,
|
|
26
|
-
timeErrorMessage: T,
|
|
27
|
-
dateLabel: v = "Start date",
|
|
28
|
-
minDate: b,
|
|
29
|
-
"data-test": g
|
|
30
|
-
}) => {
|
|
31
|
-
const D = P(() => {
|
|
32
|
-
const e = [];
|
|
33
|
-
for (let o = 1; o <= 12; o += 1)
|
|
34
|
-
for (let m = 0; m < 60; m += O)
|
|
35
|
-
e.push(`${o}:${String(m).padStart(2, "0")}`);
|
|
36
|
-
const r = e.filter((o) => o.startsWith("12:"));
|
|
37
|
-
return [
|
|
38
|
-
...r,
|
|
39
|
-
...e.filter((o) => !r.includes(o))
|
|
40
|
-
].map((o) => ({ value: o }));
|
|
41
|
-
}, []), w = i !== "" && n !== "" ? `${i}:${String(n).padStart(2, "0")}` : void 0, x = [
|
|
42
|
-
{ label: "AM", value: "am", selected: a },
|
|
43
|
-
{ label: "PM", value: "pm", selected: !a }
|
|
44
|
-
];
|
|
45
|
-
return /* @__PURE__ */ l(A, { "data-test": g, children: [
|
|
46
|
-
/* @__PURE__ */ l(C, { children: [
|
|
47
|
-
/* @__PURE__ */ t(h, { children: /* @__PURE__ */ l(u, { color: p.content.primary, children: [
|
|
48
|
-
v,
|
|
49
|
-
/* @__PURE__ */ t(f, { children: " *" })
|
|
50
|
-
] }) }),
|
|
51
|
-
/* @__PURE__ */ t(k, { children: /* @__PURE__ */ t(
|
|
52
|
-
z,
|
|
53
|
-
{
|
|
54
|
-
val: c,
|
|
55
|
-
onChange: (e) => {
|
|
56
|
-
const r = Array.isArray(e) ? e[0] : e;
|
|
57
|
-
r && d(r);
|
|
58
|
-
},
|
|
59
|
-
displayFormat: "dd MMM yyyy",
|
|
60
|
-
dateButtonType: E.LARGE,
|
|
61
|
-
calendarProps: { minDate: b },
|
|
62
|
-
pickerStyles: { top: 8, zIndex: 4 }
|
|
63
|
-
}
|
|
64
|
-
) })
|
|
65
|
-
] }),
|
|
66
|
-
/* @__PURE__ */ l(B, { children: [
|
|
67
|
-
/* @__PURE__ */ t(h, { children: /* @__PURE__ */ l(u, { color: p.content.primary, children: [
|
|
68
|
-
"Time",
|
|
69
|
-
/* @__PURE__ */ t(f, { children: " *" })
|
|
70
|
-
] }) }),
|
|
71
|
-
/* @__PURE__ */ l(F, { children: [
|
|
72
|
-
/* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(
|
|
73
|
-
$,
|
|
74
|
-
{
|
|
75
|
-
"data-test": "recurrence-time",
|
|
76
|
-
value: w ?? "",
|
|
77
|
-
options: D,
|
|
78
|
-
placeholder: "hh:mm",
|
|
79
|
-
errorMessage: T || void 0,
|
|
80
|
-
validate: (e) => !!s(e),
|
|
81
|
-
sanitize: (e) => e.replace(/[^\d:]/g, "").slice(0, 5),
|
|
82
|
-
format: (e) => {
|
|
83
|
-
const r = s(e);
|
|
84
|
-
return r ? `${r.hours}:${r.minutes.padStart(2, "0")}` : e;
|
|
85
|
-
},
|
|
86
|
-
onChange: (e) => {
|
|
87
|
-
const r = s(e);
|
|
88
|
-
r && S(r);
|
|
89
|
-
},
|
|
90
|
-
onInvalidBlur: M
|
|
91
|
-
}
|
|
92
|
-
) }),
|
|
93
|
-
/* @__PURE__ */ t(R, { "data-test": "recurrence-meridiem", children: /* @__PURE__ */ t(
|
|
94
|
-
L,
|
|
95
|
-
{
|
|
96
|
-
size: "default",
|
|
97
|
-
isSearchable: !1,
|
|
98
|
-
isMultiSelect: !1,
|
|
99
|
-
options: x,
|
|
100
|
-
value: a ? "AM" : "PM",
|
|
101
|
-
buttonWidth: "100%",
|
|
102
|
-
width: "84px",
|
|
103
|
-
placeHolderHeight: "48px",
|
|
104
|
-
placeHolder: "AM",
|
|
105
|
-
onSelect: (e) => {
|
|
106
|
-
const r = Array.isArray(e) ? e[0] : e;
|
|
107
|
-
y(r?.value !== "pm");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
) })
|
|
111
|
-
] })
|
|
112
|
-
] })
|
|
113
|
-
] });
|
|
114
|
-
};
|
|
115
|
-
export {
|
|
116
|
-
J as StartDateTimePicker,
|
|
117
|
-
O as TIME_STEP_MINUTES,
|
|
118
|
-
s as parseTimeText
|
|
119
|
-
};
|
|
120
|
-
//# sourceMappingURL=StartDateTimePicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StartDateTimePicker.js","sources":["../../../../src/components/schedule-builder/StartDateTimePicker.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { COLORS } from '../../constants/Theme';\nimport { ComboBox } from '../combo-box';\nimport { DateButtonType, DatePickerWrapper } from '../datePicker';\nimport { Dropdown, DropdownOption, SingleOption } from '../dropdown';\nimport { BodySecondary } from '../TypographyStyle';\nimport {\n\tDateFieldColumn,\n\tDatePickerSlot,\n\tFieldLabel,\n\tFieldsRow,\n\tMeridiemDropdownSlot,\n\tRequiredMark,\n\tTimeDropdownSlot,\n\tTimeFieldColumn,\n\tTimeInputRow,\n} from './ScheduleBuilder.styled';\n\n/**\n * Step between offered times, in minutes.\n *\n * Exported because a host seeding a default time has to round onto the same step\n * — otherwise the seeded value is not one of the options the dropdown offers.\n */\nexport const TIME_STEP_MINUTES = 30;\n\n/**\n * Reads a typed 12-hour time.\n *\n * Accepts \"9\", \"9:5\" and \"09:05\" so the merchant can type naturally; am/pm sits\n * on its own dropdown, so only 1-12 is valid here. Returns null while the text is\n * incomplete, which is what keeps the field editable mid-entry.\n */\nexport const parseTimeText = (\n\ttext: string,\n): { hours: string; minutes: string } | null => {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return null;\n\n\tconst match = trimmed.match(/^(\\d{1,2})(?::(\\d{1,2}))?$/);\n\tif (!match) return null;\n\n\tconst hours = Number(match[1]);\n\t// Minutes are optional: \"9\" means 9:00.\n\tconst minutes = match[2] === undefined ? 0 : Number(match[2]);\n\n\tif (hours < 1 || hours > 12) return null;\n\tif (minutes > 59) return null;\n\n\treturn { hours: String(hours), minutes: String(minutes) };\n};\n\nexport interface StartDateTimePickerProps {\n\t/** The chosen date. Time-of-day is carried separately by hours/minutes/isAm. */\n\tdate?: Date;\n\tonDateChange: (date: Date) => void;\n\t/** 12-hour clock, \"1\"–\"12\". Empty string while nothing is chosen. */\n\thours: string;\n\t/** \"0\"–\"59\". Empty string while nothing is chosen. */\n\tminutes: string;\n\tisAm: boolean;\n\t/** Fires only for a parseable time, so partial typing does not clear state. */\n\tonTimeChange: (time: { hours: string; minutes: string }) => void;\n\tonMeridiemChange: (isAm: boolean) => void;\n\t/** Called when focus leaves an unparseable time, for the caller to validate. */\n\tonTimeInvalidBlur?: () => void;\n\t/** Shown under the time field. The caller owns validation. */\n\ttimeErrorMessage?: string;\n\t/** \"Start date\" when a recurrence follows, plain \"Date\" otherwise. */\n\tdateLabel?: string;\n\tminDate?: Date;\n\t'data-test'?: string;\n}\n\n/**\n * The start date and time-of-day row.\n *\n * Date and time are separate props rather than one Date because the time is\n * edited as text and can be mid-entry (\"9:\" is not a time yet) — folding it into\n * a Date would force a guess about what an incomplete entry means.\n */\nexport const StartDateTimePicker: React.FC<StartDateTimePickerProps> = ({\n\tdate,\n\tonDateChange,\n\thours,\n\tminutes,\n\tisAm,\n\tonTimeChange,\n\tonMeridiemChange,\n\tonTimeInvalidBlur,\n\ttimeErrorMessage,\n\tdateLabel = 'Start date',\n\tminDate,\n\t'data-test': dataTest,\n}) => {\n\t/**\n\t * Times offered in the picker, at TIME_STEP_MINUTES steps. 12 leads the day in\n\t * 12-hour time, so it sorts to the front rather than after 11.\n\t */\n\tconst timeOptions = useMemo(() => {\n\t\tconst values: string[] = [];\n\t\tfor (let hour = 1; hour <= 12; hour += 1) {\n\t\t\tfor (let minute = 0; minute < 60; minute += TIME_STEP_MINUTES) {\n\t\t\t\tvalues.push(`${hour}:${String(minute).padStart(2, '0')}`);\n\t\t\t}\n\t\t}\n\t\tconst twelves = values.filter((value) => value.startsWith('12:'));\n\t\treturn [\n\t\t\t...twelves,\n\t\t\t...values.filter((value) => !twelves.includes(value)),\n\t\t].map((value) => ({ value }));\n\t}, []);\n\n\tconst selectedTimeLabel =\n\t\thours !== '' && minutes !== ''\n\t\t\t? `${hours}:${String(minutes).padStart(2, '0')}`\n\t\t\t: undefined;\n\n\tconst meridiemDropdownOptions: SingleOption[] = [\n\t\t{ label: 'AM', value: 'am', selected: isAm },\n\t\t{ label: 'PM', value: 'pm', selected: !isAm },\n\t];\n\n\treturn (\n\t\t<FieldsRow data-test={dataTest}>\n\t\t\t<DateFieldColumn>\n\t\t\t\t<FieldLabel>\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t{dateLabel}\n\t\t\t\t\t\t<RequiredMark> *</RequiredMark>\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</FieldLabel>\n\t\t\t\t<DatePickerSlot>\n\t\t\t\t\t<DatePickerWrapper\n\t\t\t\t\t\tval={date}\n\t\t\t\t\t\tonChange={(value: Date | Date[]) => {\n\t\t\t\t\t\t\tconst dateValue = Array.isArray(value) ? value[0] : value;\n\t\t\t\t\t\t\tif (dateValue) onDateChange(dateValue);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tdisplayFormat=\"dd MMM yyyy\"\n\t\t\t\t\t\tdateButtonType={DateButtonType.LARGE}\n\t\t\t\t\t\tcalendarProps={{ minDate }}\n\t\t\t\t\t\tpickerStyles={{ top: 8, zIndex: 4 }}\n\t\t\t\t\t/>\n\t\t\t\t</DatePickerSlot>\n\t\t\t</DateFieldColumn>\n\t\t\t<TimeFieldColumn>\n\t\t\t\t<FieldLabel>\n\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\tTime\n\t\t\t\t\t\t<RequiredMark> *</RequiredMark>\n\t\t\t\t\t</BodySecondary>\n\t\t\t\t</FieldLabel>\n\t\t\t\t{/*\n Top-aligned: the time field's error message sits inside its own slot,\n so centring would drop AM/PM as the message appears.\n */}\n\t\t\t\t<TimeInputRow>\n\t\t\t\t\t<TimeDropdownSlot>\n\t\t\t\t\t\t<ComboBox\n\t\t\t\t\t\t\tdata-test=\"recurrence-time\"\n\t\t\t\t\t\t\tvalue={selectedTimeLabel ?? ''}\n\t\t\t\t\t\t\toptions={timeOptions}\n\t\t\t\t\t\t\tplaceholder=\"hh:mm\"\n\t\t\t\t\t\t\terrorMessage={timeErrorMessage || undefined}\n\t\t\t\t\t\t\tvalidate={(text) => !!parseTimeText(text)}\n\t\t\t\t\t\t\tsanitize={(text) => text.replace(/[^\\d:]/g, '').slice(0, 5)}\n\t\t\t\t\t\t\tformat={(text) => {\n\t\t\t\t\t\t\t\tconst parsed = parseTimeText(text);\n\t\t\t\t\t\t\t\tif (!parsed) return text;\n\t\t\t\t\t\t\t\treturn `${parsed.hours}:${parsed.minutes.padStart(2, '0')}`;\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonChange={(text) => {\n\t\t\t\t\t\t\t\tconst parsed = parseTimeText(text);\n\t\t\t\t\t\t\t\tif (!parsed) return;\n\t\t\t\t\t\t\t\tonTimeChange(parsed);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonInvalidBlur={onTimeInvalidBlur}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TimeDropdownSlot>\n\t\t\t\t\t<MeridiemDropdownSlot data-test=\"recurrence-meridiem\">\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\tisSearchable={false}\n\t\t\t\t\t\t\tisMultiSelect={false}\n\t\t\t\t\t\t\toptions={meridiemDropdownOptions}\n\t\t\t\t\t\t\tvalue={isAm ? 'AM' : 'PM'}\n\t\t\t\t\t\t\tbuttonWidth=\"100%\"\n\t\t\t\t\t\t\twidth=\"84px\"\n\t\t\t\t\t\t\tplaceHolderHeight=\"48px\"\n\t\t\t\t\t\t\tplaceHolder=\"AM\"\n\t\t\t\t\t\t\tonSelect={(\n\t\t\t\t\t\t\t\tselected: DropdownOption | DropdownOption[] | null,\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst normalized = (\n\t\t\t\t\t\t\t\t\tArray.isArray(selected) ? selected[0] : selected\n\t\t\t\t\t\t\t\t) as SingleOption | null;\n\t\t\t\t\t\t\t\tonMeridiemChange(normalized?.value !== 'pm');\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MeridiemDropdownSlot>\n\t\t\t\t</TimeInputRow>\n\t\t\t</TimeFieldColumn>\n\t\t</FieldsRow>\n\t);\n};\n"],"names":["TIME_STEP_MINUTES","parseTimeText","text","trimmed","match","hours","minutes","StartDateTimePicker","date","onDateChange","isAm","onTimeChange","onMeridiemChange","onTimeInvalidBlur","timeErrorMessage","dateLabel","minDate","dataTest","timeOptions","useMemo","values","hour","minute","twelves","value","selectedTimeLabel","meridiemDropdownOptions","jsxs","FieldsRow","DateFieldColumn","jsx","FieldLabel","BodySecondary","COLORS","RequiredMark","DatePickerSlot","DatePickerWrapper","dateValue","DateButtonType","TimeFieldColumn","TimeInputRow","TimeDropdownSlot","ComboBox","parsed","MeridiemDropdownSlot","Dropdown","selected","normalized"],"mappings":"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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { RecurrenceSummary } from './model';
|
|
3
|
-
export interface UpcomingRunsPreviewProps {
|
|
4
|
-
/** Run dates to list. Renders nothing when empty. */
|
|
5
|
-
runs: Date[];
|
|
6
|
-
/** Summary line under the list. Omit to show the list alone. */
|
|
7
|
-
summary?: RecurrenceSummary | null;
|
|
8
|
-
/** date-fns pattern for each run. */
|
|
9
|
-
dateFormat?: string;
|
|
10
|
-
'data-test'?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The dated list of the next few runs, with the plain-English summary beneath.
|
|
14
|
-
*
|
|
15
|
-
* Read-only: it renders whatever run dates it is given rather than deriving them,
|
|
16
|
-
* so a caller can preview a schedule it has not committed to. Pair it with
|
|
17
|
-
* `ScheduleHelper.computeUpcomingRuns` to produce the dates.
|
|
18
|
-
*/
|
|
19
|
-
export declare const UpcomingRunsPreview: React.FC<UpcomingRunsPreviewProps>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { format as h } from "date-fns";
|
|
3
|
-
import { COLORS as o } from "../../constants/Theme.js";
|
|
4
|
-
import { TitleSmall as g, BodyCaption as l } from "../TypographyStyle.js";
|
|
5
|
-
import { Column as i, UpcomingRunItem as s, UpcomingRunDot as f, SummaryHighlight as a } from "./ScheduleBuilder.styled.js";
|
|
6
|
-
const x = ({
|
|
7
|
-
runs: n,
|
|
8
|
-
summary: e,
|
|
9
|
-
dateFormat: m = "EEE d MMM, yyyy",
|
|
10
|
-
"data-test": p
|
|
11
|
-
}) => n.length ? /* @__PURE__ */ r(i, { gap: 12, "data-test": p, children: [
|
|
12
|
-
/* @__PURE__ */ r(i, { gap: 8, children: [
|
|
13
|
-
/* @__PURE__ */ t(g, { color: o.content.primary, children: "Upcoming runs" }),
|
|
14
|
-
/* @__PURE__ */ t(i, { gap: 16, children: n.map((c, d) => /* @__PURE__ */ r(
|
|
15
|
-
s,
|
|
16
|
-
{
|
|
17
|
-
isLast: d === n.length - 1,
|
|
18
|
-
children: [
|
|
19
|
-
/* @__PURE__ */ t(f, {}),
|
|
20
|
-
/* @__PURE__ */ t(l, { color: o.content.primary, children: h(c, m) })
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
c.getTime()
|
|
24
|
-
)) })
|
|
25
|
-
] }),
|
|
26
|
-
!!e && /* @__PURE__ */ r(
|
|
27
|
-
l,
|
|
28
|
-
{
|
|
29
|
-
color: o.content.secondary,
|
|
30
|
-
"data-test": "recurrence-summary",
|
|
31
|
-
children: [
|
|
32
|
-
"Repeats ",
|
|
33
|
-
/* @__PURE__ */ t(a, { children: e.frequencyLabel }),
|
|
34
|
-
" at ",
|
|
35
|
-
/* @__PURE__ */ t(a, { children: e.timeLabel }),
|
|
36
|
-
e.tail
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
)
|
|
40
|
-
] }) : null;
|
|
41
|
-
export {
|
|
42
|
-
x as UpcomingRunsPreview
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=UpcomingRunsPreview.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UpcomingRunsPreview.js","sources":["../../../../src/components/schedule-builder/UpcomingRunsPreview.tsx"],"sourcesContent":["import { format as formatDate } from 'date-fns';\nimport React from 'react';\nimport { COLORS } from '../../constants/Theme';\nimport { BodyCaption, TitleSmall } from '../TypographyStyle';\nimport { RecurrenceSummary } from './model';\nimport {\n\tColumn,\n\tSummaryHighlight,\n\tUpcomingRunDot,\n\tUpcomingRunItem,\n} from './ScheduleBuilder.styled';\n\nexport interface UpcomingRunsPreviewProps {\n\t/** Run dates to list. Renders nothing when empty. */\n\truns: Date[];\n\t/** Summary line under the list. Omit to show the list alone. */\n\tsummary?: RecurrenceSummary | null;\n\t/** date-fns pattern for each run. */\n\tdateFormat?: string;\n\t'data-test'?: string;\n}\n\n/**\n * The dated list of the next few runs, with the plain-English summary beneath.\n *\n * Read-only: it renders whatever run dates it is given rather than deriving them,\n * so a caller can preview a schedule it has not committed to. Pair it with\n * `ScheduleHelper.computeUpcomingRuns` to produce the dates.\n */\nexport const UpcomingRunsPreview: React.FC<UpcomingRunsPreviewProps> = ({\n\truns,\n\tsummary,\n\tdateFormat = 'EEE d MMM, yyyy',\n\t'data-test': dataTest,\n}) => {\n\tif (!runs.length) return null;\n\n\treturn (\n\t\t<Column gap={12} data-test={dataTest}>\n\t\t\t<Column gap={8}>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Upcoming runs</TitleSmall>\n\t\t\t\t<Column gap={16}>\n\t\t\t\t\t{runs.map((run, index) => (\n\t\t\t\t\t\t<UpcomingRunItem\n\t\t\t\t\t\t\tkey={run.getTime()}\n\t\t\t\t\t\t\tisLast={index === runs.length - 1}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<UpcomingRunDot />\n\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t{formatDate(run, dateFormat)}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t</UpcomingRunItem>\n\t\t\t\t\t))}\n\t\t\t\t</Column>\n\t\t\t</Column>\n\t\t\t{!!summary && (\n\t\t\t\t<BodyCaption\n\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\tdata-test=\"recurrence-summary\"\n\t\t\t\t>\n\t\t\t\t\t{'Repeats '}\n\t\t\t\t\t<SummaryHighlight>{summary.frequencyLabel}</SummaryHighlight>\n\t\t\t\t\t{' at '}\n\t\t\t\t\t<SummaryHighlight>{summary.timeLabel}</SummaryHighlight>\n\t\t\t\t\t{summary.tail}\n\t\t\t\t</BodyCaption>\n\t\t\t)}\n\t\t</Column>\n\t);\n};\n"],"names":["UpcomingRunsPreview","runs","summary","dateFormat","dataTest","jsxs","Column","jsx","TitleSmall","COLORS","run","index","UpcomingRunItem","UpcomingRunDot","BodyCaption","formatDate","SummaryHighlight"],"mappings":";;;;;AA6BO,MAAMA,IAA0D,CAAC;AAAA,EACvE,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,aAAaC;AACd,MACMH,EAAK,SAGT,gBAAAI,EAACC,GAAA,EAAO,KAAK,IAAI,aAAWF,GAC3B,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAO,KAAK,GACZ,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAA,EAAW,OAAOC,EAAO,QAAQ,SAAS,UAAA,iBAAa;AAAA,IACxD,gBAAAF,EAACD,KAAO,KAAK,IACX,YAAK,IAAI,CAACI,GAAKC,MACf,gBAAAN;AAAA,MAACO;AAAA,MAAA;AAAA,QAEA,QAAQD,MAAUV,EAAK,SAAS;AAAA,QAEhC,UAAA;AAAA,UAAA,gBAAAM,EAACM,GAAA,EAAe;AAAA,UAChB,gBAAAN,EAACO,KAAY,OAAOL,EAAO,QAAQ,SACjC,UAAAM,EAAWL,GAAKP,CAAU,EAAA,CAC5B;AAAA,QAAA;AAAA,MAAA;AAAA,MANKO,EAAI,QAAA;AAAA,IAAQ,CAQlB,EAAA,CACF;AAAA,EAAA,GACD;AAAA,EACC,CAAC,CAACR,KACF,gBAAAG;AAAA,IAACS;AAAA,IAAA;AAAA,MACA,OAAOL,EAAO,QAAQ;AAAA,MACtB,aAAU;AAAA,MAET,UAAA;AAAA,QAAA;AAAA,QACD,gBAAAF,EAACS,GAAA,EAAkB,UAAAd,EAAQ,eAAA,CAAe;AAAA,QACzC;AAAA,QACD,gBAAAK,EAACS,GAAA,EAAkB,UAAAd,EAAQ,UAAA,CAAU;AAAA,QACpCA,EAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AACV,GAEF,IAhCwB;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { RefreshSegmentToggle } from './RefreshSegmentToggle';
|
|
2
|
-
import { ScheduleBuilder } from './ScheduleBuilder';
|
|
3
|
-
import { ScheduleEndPicker } from './ScheduleEndPicker';
|
|
4
|
-
import { ScheduleFrequencyPicker } from './ScheduleFrequencyPicker';
|
|
5
|
-
import { SendModeSelector } from './SendModeSelector';
|
|
6
|
-
import { StartDateTimePicker } from './StartDateTimePicker';
|
|
7
|
-
import { UpcomingRunsPreview } from './UpcomingRunsPreview';
|
|
8
|
-
export { ScheduleBuilder, SendModeSelector, StartDateTimePicker, ScheduleFrequencyPicker, ScheduleEndPicker, UpcomingRunsPreview, RefreshSegmentToggle, };
|
|
9
|
-
export * from './model';
|
|
10
|
-
export * from './ScheduleHelper';
|
|
11
|
-
export type { ScheduleBuilderProps } from './ScheduleBuilder';
|
|
12
|
-
export type { SendModeSelectorProps, SendModeItem } from './SendModeSelector';
|
|
13
|
-
export type { StartDateTimePickerProps } from './StartDateTimePicker';
|
|
14
|
-
export { TIME_STEP_MINUTES, parseTimeText } from './StartDateTimePicker';
|
|
15
|
-
export type { ScheduleFrequencyPickerProps } from './ScheduleFrequencyPicker';
|
|
16
|
-
export type { ScheduleEndPickerProps } from './ScheduleEndPicker';
|
|
17
|
-
export type { UpcomingRunsPreviewProps } from './UpcomingRunsPreview';
|
|
18
|
-
export type { RefreshSegmentToggleProps } from './RefreshSegmentToggle';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for the recurrence pickers.
|
|
3
|
-
*
|
|
4
|
-
* These enums are duplicated from the consuming app's campaign types on purpose:
|
|
5
|
-
* a library component cannot import from an app, and the string values are what
|
|
6
|
-
* both ends already send over the wire, so the two stay compatible without a
|
|
7
|
-
* shared package. Cast at the boundary if your app has its own copy.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* When something sends. SEND_NOW hides the date and time; SCHEDULE shows them;
|
|
11
|
-
* RECURRING adds the frequency, end rule and run preview beneath.
|
|
12
|
-
*/
|
|
13
|
-
export declare enum SEND_MODE {
|
|
14
|
-
SEND_NOW = "SEND_NOW",
|
|
15
|
-
SCHEDULE = "SCHEDULE",
|
|
16
|
-
RECURRING = "RECURRING"
|
|
17
|
-
}
|
|
18
|
-
/** How often the series repeats. */
|
|
19
|
-
export declare enum RECURRENCE_FREQUENCY {
|
|
20
|
-
DAILY = "DAILY",
|
|
21
|
-
WEEKLY = "WEEKLY",
|
|
22
|
-
MONTHLY = "MONTHLY"
|
|
23
|
-
}
|
|
24
|
-
/** What stops a series from running forever. */
|
|
25
|
-
export declare enum RECURRENCE_END_MODE {
|
|
26
|
-
NEVER = "NEVER",
|
|
27
|
-
AFTER_RUNS = "AFTER_RUNS",
|
|
28
|
-
ON_DATE = "ON_DATE"
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The "Repeat every" choice shown for a monthly recurrence. FIRST and LAST are
|
|
32
|
-
* presets over the same dates the CUSTOM grid picks, so all three resolve to one
|
|
33
|
-
* set of dates plus a last-day flag rather than three separate code paths.
|
|
34
|
-
*/
|
|
35
|
-
export declare enum MONTHLY_REPEAT_OPTION {
|
|
36
|
-
FIRST = "FIRST",
|
|
37
|
-
LAST = "LAST",
|
|
38
|
-
CUSTOM = "CUSTOM"
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Everything the pickers below the start date own.
|
|
42
|
-
*
|
|
43
|
-
* The start date and time are deliberately not here — they belong to the
|
|
44
|
-
* schedule the recurrence repeats from, which every send mode shares.
|
|
45
|
-
* `ScheduleBuilder` holds those as its own `date`/`hours`/`minutes` props so
|
|
46
|
-
* switching mode does not have to move them between two shapes.
|
|
47
|
-
*/
|
|
48
|
-
export interface RecurrenceValue {
|
|
49
|
-
frequency?: RECURRENCE_FREQUENCY;
|
|
50
|
-
endMode?: RECURRENCE_END_MODE;
|
|
51
|
-
/** Weekly only. JS day indices — 0 = Sunday, matching `Date.getDay()`. */
|
|
52
|
-
daysOfWeek?: number[];
|
|
53
|
-
/** Monthly only. Calendar dates, 1–31. */
|
|
54
|
-
datesOfMonth?: number[];
|
|
55
|
-
/** Monthly only. Runs on the last day of every month, whatever date that is. */
|
|
56
|
-
lastDaySelected?: boolean;
|
|
57
|
-
monthlyRepeatOption?: MONTHLY_REPEAT_OPTION;
|
|
58
|
-
/** AFTER_RUNS only. Counts the first run, so 1 means "just the start date". */
|
|
59
|
-
endAfterRuns?: number;
|
|
60
|
-
/** ON_DATE only. Epoch seconds at the end of the chosen day. */
|
|
61
|
-
endOnDate?: number;
|
|
62
|
-
refreshSegmentBeforeEachRun?: boolean;
|
|
63
|
-
}
|
|
64
|
-
/** Summary line split into its semibold parts and the plain text between them. */
|
|
65
|
-
export interface RecurrenceSummary {
|
|
66
|
-
frequencyLabel: string;
|
|
67
|
-
timeLabel: string;
|
|
68
|
-
tail: string;
|
|
69
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var S = /* @__PURE__ */ ((r) => (r.SEND_NOW = "SEND_NOW", r.SCHEDULE = "SCHEDULE", r.RECURRING = "RECURRING", r))(S || {}), L = /* @__PURE__ */ ((r) => (r.DAILY = "DAILY", r.WEEKLY = "WEEKLY", r.MONTHLY = "MONTHLY", r))(L || {}), A = /* @__PURE__ */ ((r) => (r.NEVER = "NEVER", r.AFTER_RUNS = "AFTER_RUNS", r.ON_DATE = "ON_DATE", r))(A || {}), T = /* @__PURE__ */ ((r) => (r.FIRST = "FIRST", r.LAST = "LAST", r.CUSTOM = "CUSTOM", r))(T || {});
|
|
2
|
-
export {
|
|
3
|
-
T as MONTHLY_REPEAT_OPTION,
|
|
4
|
-
A as RECURRENCE_END_MODE,
|
|
5
|
-
L as RECURRENCE_FREQUENCY,
|
|
6
|
-
S as SEND_MODE
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sources":["../../../../src/components/schedule-builder/model.ts"],"sourcesContent":["/**\n * Types for the recurrence pickers.\n *\n * These enums are duplicated from the consuming app's campaign types on purpose:\n * a library component cannot import from an app, and the string values are what\n * both ends already send over the wire, so the two stay compatible without a\n * shared package. Cast at the boundary if your app has its own copy.\n */\n\n/**\n * When something sends. SEND_NOW hides the date and time; SCHEDULE shows them;\n * RECURRING adds the frequency, end rule and run preview beneath.\n */\nexport enum SEND_MODE {\n\tSEND_NOW = 'SEND_NOW',\n\tSCHEDULE = 'SCHEDULE',\n\tRECURRING = 'RECURRING',\n}\n\n/** How often the series repeats. */\nexport enum RECURRENCE_FREQUENCY {\n\tDAILY = 'DAILY',\n\tWEEKLY = 'WEEKLY',\n\tMONTHLY = 'MONTHLY',\n}\n\n/** What stops a series from running forever. */\nexport enum RECURRENCE_END_MODE {\n\tNEVER = 'NEVER',\n\tAFTER_RUNS = 'AFTER_RUNS',\n\tON_DATE = 'ON_DATE',\n}\n\n/**\n * The \"Repeat every\" choice shown for a monthly recurrence. FIRST and LAST are\n * presets over the same dates the CUSTOM grid picks, so all three resolve to one\n * set of dates plus a last-day flag rather than three separate code paths.\n */\nexport enum MONTHLY_REPEAT_OPTION {\n\tFIRST = 'FIRST',\n\tLAST = 'LAST',\n\tCUSTOM = 'CUSTOM',\n}\n\n/**\n * Everything the pickers below the start date own.\n *\n * The start date and time are deliberately not here — they belong to the\n * schedule the recurrence repeats from, which every send mode shares.\n * `ScheduleBuilder` holds those as its own `date`/`hours`/`minutes` props so\n * switching mode does not have to move them between two shapes.\n */\nexport interface RecurrenceValue {\n\tfrequency?: RECURRENCE_FREQUENCY;\n\tendMode?: RECURRENCE_END_MODE;\n\t/** Weekly only. JS day indices — 0 = Sunday, matching `Date.getDay()`. */\n\tdaysOfWeek?: number[];\n\t/** Monthly only. Calendar dates, 1–31. */\n\tdatesOfMonth?: number[];\n\t/** Monthly only. Runs on the last day of every month, whatever date that is. */\n\tlastDaySelected?: boolean;\n\tmonthlyRepeatOption?: MONTHLY_REPEAT_OPTION;\n\t/** AFTER_RUNS only. Counts the first run, so 1 means \"just the start date\". */\n\tendAfterRuns?: number;\n\t/** ON_DATE only. Epoch seconds at the end of the chosen day. */\n\tendOnDate?: number;\n\trefreshSegmentBeforeEachRun?: boolean;\n}\n\n/** Summary line split into its semibold parts and the plain text between them. */\nexport interface RecurrenceSummary {\n\tfrequencyLabel: string;\n\ttimeLabel: string;\n\ttail: string;\n}\n"],"names":["SEND_MODE","RECURRENCE_FREQUENCY","RECURRENCE_END_MODE","MONTHLY_REPEAT_OPTION"],"mappings":"AAaO,IAAKA,sBAAAA,OACXA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,YAAY,aAHDA,IAAAA,KAAA,CAAA,CAAA,GAOAC,sBAAAA,OACXA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,UAAU,WAHCA,IAAAA,KAAA,CAAA,CAAA,GAOAC,sBAAAA,OACXA,EAAA,QAAQ,SACRA,EAAA,aAAa,cACbA,EAAA,UAAU,WAHCA,IAAAA,KAAA,CAAA,CAAA,GAWAC,sBAAAA,OACXA,EAAA,QAAQ,SACRA,EAAA,OAAO,QACPA,EAAA,SAAS,UAHEA,IAAAA,KAAA,CAAA,CAAA;"}
|