@sprucelabs/spruce-calendar-components 22.10.49 → 22.10.51
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/build/.spruce/errors/options.types.d.ts +1 -1
- package/build/.spruce/schemas/schemas.types.d.ts +243 -243
- package/build/__tests__/support/SpyEventManager.d.ts +1 -1
- package/build/__tests__/support/SpyEventManager.js +3 -3
- package/build/__tests__/support/utilities/calendarAssert.d.ts +2 -2
- package/build/__tests__/support/utilities/calendarSkillAssert.d.ts +1 -1
- package/build/calendar/Calendar.vc.d.ts +9 -9
- package/build/calendar/CalendarEventManager.d.ts +5 -5
- package/build/calendar/CalendarEventManager.js +7 -7
- package/build/calendar/CalendarPeopleManager.d.ts +2 -2
- package/build/constants.d.ts +1 -1
- package/build/esm/.spruce/errors/options.types.d.ts +1 -1
- package/build/esm/.spruce/schemas/schemas.types.d.ts +243 -243
- package/build/esm/__tests__/support/SpyEventManager.d.ts +1 -1
- package/build/esm/__tests__/support/SpyEventManager.js +3 -3
- package/build/esm/__tests__/support/utilities/calendarAssert.d.ts +2 -2
- package/build/esm/__tests__/support/utilities/calendarSkillAssert.d.ts +1 -1
- package/build/esm/calendar/Calendar.vc.d.ts +9 -9
- package/build/esm/calendar/CalendarEventManager.d.ts +5 -5
- package/build/esm/calendar/CalendarEventManager.js +7 -7
- package/build/esm/calendar/CalendarPeopleManager.d.ts +2 -2
- package/build/esm/constants.d.ts +1 -1
- package/build/esm/skillViewControllers/Root.svc.d.ts +1 -1
- package/build/esm/stores/RemoteEventStore.d.ts +2 -2
- package/build/esm/stores/RemotePreferencesStore.d.ts +1 -1
- package/build/esm/toolBelt/CalendarToolRegistrar.d.ts +1 -1
- package/build/esm/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +1 -1
- package/build/esm/toolBelt/states/PrerequisitesToolBeltState.d.ts +4 -4
- package/build/esm/tools/CalendarSelectTool.vc.d.ts +2 -2
- package/build/esm/tools/EventDateTimeTool.vc.d.ts +1 -1
- package/build/esm/tools/EventRepeatingTool.vc.d.ts +2 -2
- package/build/esm/tools/EventTitleTool.vc.d.ts +2 -2
- package/build/esm/tools/PersonSelectTool.vc.d.ts +3 -3
- package/build/esm/tools/PersonSelectTool.vc.js +10 -10
- package/build/esm/types/calendar.types.d.ts +22 -22
- package/build/esm/utilities/calendarShiftGenerator.d.ts +1 -1
- package/build/esm/viewControllers/DateSelectCard.vc.d.ts +2 -2
- package/build/esm/viewControllers/RepeatingControlsList.vc.d.ts +1 -1
- package/build/esm/viewControllers/SelectUpdateRepeatingStrategyCard.vc.d.ts +1 -1
- package/build/skillViewControllers/Root.svc.d.ts +1 -1
- package/build/stores/RemoteEventStore.d.ts +2 -2
- package/build/stores/RemotePreferencesStore.d.ts +1 -1
- package/build/toolBelt/CalendarToolRegistrar.d.ts +1 -1
- package/build/toolBelt/states/AbstractCalendarEventToolBeltState.d.ts +1 -1
- package/build/toolBelt/states/PrerequisitesToolBeltState.d.ts +4 -4
- package/build/tools/CalendarSelectTool.vc.d.ts +2 -2
- package/build/tools/EventDateTimeTool.vc.d.ts +1 -1
- package/build/tools/EventRepeatingTool.vc.d.ts +2 -2
- package/build/tools/EventTitleTool.vc.d.ts +2 -2
- package/build/tools/PersonSelectTool.vc.d.ts +3 -3
- package/build/tools/PersonSelectTool.vc.js +10 -10
- package/build/types/calendar.types.d.ts +22 -22
- package/build/utilities/calendarShiftGenerator.d.ts +1 -1
- package/build/viewControllers/DateSelectCard.vc.d.ts +2 -2
- package/build/viewControllers/RepeatingControlsList.vc.d.ts +1 -1
- package/build/viewControllers/SelectUpdateRepeatingStrategyCard.vc.d.ts +1 -1
- package/package.json +1 -1
|
@@ -63,15 +63,15 @@ export default class CalendarViewController extends CoreCalendarViewController {
|
|
|
63
63
|
shifts?: SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarShift[] | null | undefined;
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
type Calendar = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Calendar;
|
|
67
|
+
type Event = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
68
|
+
type DraftAddedHandler = (event: Event) => void | Promise<void>;
|
|
69
|
+
type EventSwappedHandler = (draft: Event, saved: Event) => void | Promise<void>;
|
|
70
|
+
type EventDroppedHandler = (id: string, updates: Partial<Event>) => boolean | Promise<boolean>;
|
|
71
|
+
type DraftRemovedHandler = () => void | Promise<void>;
|
|
72
|
+
type ClickEventHandler = (options: ClickEventOptions) => void | Promise<void>;
|
|
73
|
+
type StartDateTimeChangeHandler = (date: number) => void | Promise<void>;
|
|
74
|
+
type DeselectEventHandler = () => void | Promise<void>;
|
|
75
75
|
export interface CalendarViewControllerOptions {
|
|
76
76
|
people?: NonNullable<Calendar['people']>;
|
|
77
77
|
remoteEventStore?: RemoteEventStore;
|
|
@@ -102,9 +102,9 @@ export default class CalendarEventManager {
|
|
|
102
102
|
hasEvent(id: string): boolean;
|
|
103
103
|
optionallyAskForUpdateRepeatingStrategy(event: UpdateEvent, action?: RepeatingUpdateAction): Promise<boolean>;
|
|
104
104
|
}
|
|
105
|
-
export
|
|
106
|
-
|
|
107
|
-
export
|
|
105
|
+
export type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent' | 'deselectEvent' | 'removeEvents' | 'setStartDate'>;
|
|
106
|
+
type EventManagerRemoteViewControllerFactory = Pick<RemoteViewControllerFactory, 'fetchRemoteController'>;
|
|
107
|
+
export type RepeatingUpdateAction = 'update' | 'cancel';
|
|
108
108
|
export interface CalendarEventManagerOptions {
|
|
109
109
|
calendarVc: EventManagerCalendarVc;
|
|
110
110
|
events: RemoteEventStore;
|
|
@@ -114,8 +114,8 @@ export interface CalendarEventManagerOptions {
|
|
|
114
114
|
preferences: RemotePreferencesStore;
|
|
115
115
|
askForUpdateStrategy: AskForUpdateStrategyHandler;
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
export
|
|
117
|
+
type AskForUpdateStrategyHandler = (event: UpdateEvent, action: RepeatingUpdateAction) => Promise<UpdateRepeatingStrategyWithCancel>;
|
|
118
|
+
export type SavedEvent = Partial<CalendarEvent> & {
|
|
119
119
|
id: string;
|
|
120
120
|
};
|
|
121
121
|
export {};
|
|
@@ -24,6 +24,13 @@ import SpruceError from '../errors/SpruceError.js';
|
|
|
24
24
|
import calendarShiftGenerator from '../utilities/calendarShiftGenerator.js';
|
|
25
25
|
import draftEventGenerator from '../utilities/draftGenerator.js';
|
|
26
26
|
export default class CalendarEventManager {
|
|
27
|
+
get calendarIds() {
|
|
28
|
+
return this.calendars.map((c) => c.id);
|
|
29
|
+
}
|
|
30
|
+
get visibleCalendarIds() {
|
|
31
|
+
var _a;
|
|
32
|
+
return (_a = this.prefs.getVisibleCalendarIds()) !== null && _a !== void 0 ? _a : this.calendars.map((c) => c.id);
|
|
33
|
+
}
|
|
27
34
|
constructor(options) {
|
|
28
35
|
this.allEvents = [];
|
|
29
36
|
this.inclusiveCalendarIds = [];
|
|
@@ -50,13 +57,6 @@ export default class CalendarEventManager {
|
|
|
50
57
|
this.askForUpdateStrategy = askForUpdateStrategy;
|
|
51
58
|
this.calendarVc.setRemoteStore(this.events);
|
|
52
59
|
}
|
|
53
|
-
get calendarIds() {
|
|
54
|
-
return this.calendars.map((c) => c.id);
|
|
55
|
-
}
|
|
56
|
-
get visibleCalendarIds() {
|
|
57
|
-
var _a;
|
|
58
|
-
return (_a = this.prefs.getVisibleCalendarIds()) !== null && _a !== void 0 ? _a : this.calendars.map((c) => c.id);
|
|
59
|
-
}
|
|
60
60
|
replaceEventsInRange(events, startMs, endMs) {
|
|
61
61
|
this.calendarVc.replaceEventsInRange(events.filter((e) => this.isCalendarSelected(e.calendarId)), startMs, endMs);
|
|
62
62
|
this.allEvents = this.allEvents.filter((e) => events.findIndex((event) => event.id === e.id) === -1 &&
|
|
@@ -43,13 +43,13 @@ export interface PeopleManagerOptions {
|
|
|
43
43
|
calendarVc: PeopleManagerCalendarVc;
|
|
44
44
|
getVisibleEvents: () => CalendarEvent[];
|
|
45
45
|
}
|
|
46
|
-
export
|
|
46
|
+
export type PeopleManagerCalendarVc = Pick<CalendarViewController, 'addPerson' | 'getPeople' | 'removePerson' | 'setPeople'>;
|
|
47
47
|
declare const peopleContract: {
|
|
48
48
|
eventSignatures: {
|
|
49
49
|
'did-update': {};
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
type PeopleContract = typeof peopleContract;
|
|
53
53
|
export interface SetVisiblePeolpeOptions {
|
|
54
54
|
shouldForceEmitDidChange?: boolean;
|
|
55
55
|
}
|
package/build/esm/constants.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export declare const MAX_GET_SCHEDULE_DAYS: number;
|
|
|
2
2
|
export declare const UPDATE_STRATEGY_SPECIFIC_DATES: "only-this-one";
|
|
3
3
|
export declare const UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD: "all-going-forward";
|
|
4
4
|
export declare const UPDATE_STRATEGY_ALL: "all";
|
|
5
|
-
export
|
|
5
|
+
export type UpdateRepeatingStrategy = typeof UPDATE_STRATEGY_SPECIFIC_DATES | typeof UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD | typeof UPDATE_STRATEGY_ALL;
|
|
@@ -72,7 +72,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
72
72
|
private getVisibleEvents;
|
|
73
73
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.SkillView;
|
|
74
74
|
}
|
|
75
|
-
export
|
|
75
|
+
export type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
76
76
|
export interface RootArgs {
|
|
77
77
|
startDate?: number;
|
|
78
78
|
visiblePeopleIds?: string[];
|
|
@@ -41,7 +41,7 @@ export interface RemoteEventStoreOptions {
|
|
|
41
41
|
connectToApi: () => Promise<MercuryClient>;
|
|
42
42
|
calendarId?: string;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
type FullEvent = SpruceSchemas.CalendarUtils.v2021_05_19.CalendarEvent;
|
|
45
45
|
export interface RemoteEventStore {
|
|
46
46
|
load(options: {
|
|
47
47
|
organizationId: string;
|
|
@@ -57,7 +57,7 @@ export interface RemoteEventStore {
|
|
|
57
57
|
getEventTypes(): Promise<CalendarEventType[]>;
|
|
58
58
|
getCalendars(): Promise<Calendar[]>;
|
|
59
59
|
}
|
|
60
|
-
export
|
|
60
|
+
export type GetScheduleOptions = {
|
|
61
61
|
calendarIds: string[];
|
|
62
62
|
peopleIds: string[];
|
|
63
63
|
startDate: number;
|
|
@@ -20,7 +20,7 @@ export default class RemotePreferencesStore {
|
|
|
20
20
|
getVisiblePeopleMode(): PersonMode | null | undefined;
|
|
21
21
|
getIsLoaded(): boolean;
|
|
22
22
|
}
|
|
23
|
-
export
|
|
23
|
+
export type VisiblePeopleMode = 'custom' | 'me' | 'working';
|
|
24
24
|
export interface RemotePreferencesStoreOptions {
|
|
25
25
|
connectToApi: () => Promise<MercuryClient>;
|
|
26
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RemoteCalendarTool, CalendarToolBeltStateMachine } from '../types/calendar.types';
|
|
2
|
-
export
|
|
2
|
+
export type AddToolHandler = (vc: RemoteCalendarTool & {
|
|
3
3
|
id: string;
|
|
4
4
|
}) => Promise<void> | void;
|
|
5
5
|
export default class CalendarToolRegistrar {
|
|
@@ -29,6 +29,6 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
29
29
|
getControlsVc(): EventControlsCardViewController;
|
|
30
30
|
destroy(): Promise<void>;
|
|
31
31
|
}
|
|
32
|
-
export
|
|
32
|
+
export type AddToolOptions = Omit<Tool, 'card'> & {
|
|
33
33
|
cardVcId: ViewControllerId;
|
|
34
34
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CardViewController, SpruceSchemas, ToolBeltState } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { CalendarToolBeltStateMachine } from '../../types/calendar.types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
type Calendar = SpruceSchemas.Calendar.v2021_05_19.Calendar;
|
|
4
|
+
type EventType = SpruceSchemas.Calendar.v2021_05_19.CalendarEventType;
|
|
5
|
+
type SelectCalendarHandler = (calendar: Calendar) => Promise<void> | void;
|
|
6
|
+
type SelectTypeHandler = (type: EventType) => Promise<void> | void;
|
|
7
7
|
export interface PrerequisitesToolBeltStateOptions {
|
|
8
8
|
onSelectCalendar?: SelectCalendarHandler;
|
|
9
9
|
onSelectEventType?: SelectTypeHandler;
|
|
@@ -21,8 +21,8 @@ export default class CalendarSelectCardViewController extends AbstractViewContro
|
|
|
21
21
|
}): Promise<void>;
|
|
22
22
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export
|
|
24
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
25
|
+
export type CalendarVisibilityToggleHandler = (calendarId: string, isVisible: boolean) => any;
|
|
26
26
|
export interface CalendarSelectCardOptions {
|
|
27
27
|
events: CalendarEventManager;
|
|
28
28
|
}
|
|
@@ -38,5 +38,5 @@ export default class EventDateTimeToolViewController extends AbstractViewControl
|
|
|
38
38
|
}, false>;
|
|
39
39
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
42
42
|
export {};
|
|
@@ -28,9 +28,9 @@ export default class PersonSelectToolViewController extends AbstractViewControll
|
|
|
28
28
|
getIsLoaded(): boolean;
|
|
29
29
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
30
30
|
}
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
31
|
+
export type PersonVisibilityToggleHandler = (person: SpruceSchemas.Spruce.v2020_07_22.Person, isVisible: boolean) => void;
|
|
32
|
+
export type PersonVisibilytModeToggleHandler = (mode: PersonMode) => Promise<void> | void;
|
|
33
|
+
export type PersonMode = 'me' | 'custom' | 'working';
|
|
34
34
|
export interface PersonSelectCardOptions {
|
|
35
35
|
people: CalendarPeopleManager;
|
|
36
36
|
}
|
|
@@ -10,16 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { AbstractViewController, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
11
|
import { assertOptions } from '@sprucelabs/schema';
|
|
12
12
|
export default class PersonSelectToolViewController extends AbstractViewController {
|
|
13
|
-
constructor(options) {
|
|
14
|
-
super(options);
|
|
15
|
-
this.shouldUpdateVisibilityOnToggleChange = true;
|
|
16
|
-
this.isLoaded = false;
|
|
17
|
-
const { people } = assertOptions(options, ['people']);
|
|
18
|
-
this.people = people;
|
|
19
|
-
this.listVc = this.ListVc();
|
|
20
|
-
this.modeButtonBarVc = this.ModeButtonBarVc();
|
|
21
|
-
this.cardVc = this.CardVc();
|
|
22
|
-
}
|
|
23
13
|
get visiblePeopleIds() {
|
|
24
14
|
return this.people.getVisiblePeopleIds();
|
|
25
15
|
}
|
|
@@ -30,6 +20,16 @@ export default class PersonSelectToolViewController extends AbstractViewControll
|
|
|
30
20
|
get mode() {
|
|
31
21
|
return this.people.getVisibilityMode();
|
|
32
22
|
}
|
|
23
|
+
constructor(options) {
|
|
24
|
+
super(options);
|
|
25
|
+
this.shouldUpdateVisibilityOnToggleChange = true;
|
|
26
|
+
this.isLoaded = false;
|
|
27
|
+
const { people } = assertOptions(options, ['people']);
|
|
28
|
+
this.people = people;
|
|
29
|
+
this.listVc = this.ListVc();
|
|
30
|
+
this.modeButtonBarVc = this.ModeButtonBarVc();
|
|
31
|
+
this.cardVc = this.CardVc();
|
|
32
|
+
}
|
|
33
33
|
CardVc() {
|
|
34
34
|
return this.Controller('card', {
|
|
35
35
|
header: {
|
|
@@ -12,20 +12,20 @@ export interface Schedule {
|
|
|
12
12
|
target: EventTarget;
|
|
13
13
|
events: CalendarEventRecord[];
|
|
14
14
|
}
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
export
|
|
28
|
-
|
|
15
|
+
export type EventForShift = Pick<CalendarEvent, 'id' | 'timeBlocks' | 'startDateTimeMs' | 'target'>;
|
|
16
|
+
export type DraftEvent = Pick<CalendarEvent, 'id' | 'startDateTimeMs' | 'style' | 'calendarId' | 'target' | 'timeBlocks' | 'isBusy'>;
|
|
17
|
+
export type CalendarEventRecord = SpruceSchemas.CalendarUtils.v2021_05_19.CalendarEvent;
|
|
18
|
+
export type CalendarEvent = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
19
|
+
export type UpdateEvent = SpruceSchemas.Calendar.v2021_05_19.UpdateCalendarEventEmitPayload & CalendarEvent;
|
|
20
|
+
export type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
|
|
21
|
+
export type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
22
|
+
export type EventType = SpruceSchemas.Calendar.v2021_05_19.CalendarEventType;
|
|
23
|
+
export type Calendar = SpruceSchemas.Calendar.v2021_05_19.Calendar;
|
|
24
|
+
export type CalendarEventType = SpruceSchemas.Calendar.v2021_05_19.CalendarEventType;
|
|
25
|
+
export type SimpleCalendar = Pick<Calendar, 'id' | 'availableTimeSlotBehavior'>;
|
|
26
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
27
|
+
export type PersonWithoutSchedule = SpruceSchemas.Calendar.v2021_05_19.PersonWithoutSchedule;
|
|
28
|
+
type ICalendarToolBeltContext = SkillViewControllerLoadOptions & {
|
|
29
29
|
event: CalendarEvent;
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated use events or people to control the state of the calendar
|
|
@@ -51,20 +51,20 @@ export interface CalendarTool extends AbstractViewController<Card> {
|
|
|
51
51
|
export interface UpdateCalendarContextOptions {
|
|
52
52
|
shouldPersistContextChangesImmediately?: boolean;
|
|
53
53
|
}
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
export
|
|
59
|
-
export
|
|
60
|
-
export
|
|
54
|
+
export type UpdateCalendarToolBeltContextHandler<Context extends CalendarToolBeltContext = CalendarToolBeltContext> = (context: Partial<Context>, options?: UpdateCalendarContextOptions) => Promise<boolean>;
|
|
55
|
+
export type Tool = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.ToolBeltTool;
|
|
56
|
+
export type GetCalendarToolBeltContextHandler = () => CalendarToolBeltContext;
|
|
57
|
+
export type GetPersonFromEventHandler = () => Promise<Person | null>;
|
|
58
|
+
export type GetHasPendingContextChangesHandler = () => boolean;
|
|
59
|
+
export type CancelEventHandler = (eventId: string) => boolean | Promise<boolean | void> | void;
|
|
60
|
+
export type UpdateRepeatingStrategyWithCancel = UpdateRepeatingStrategy | 'cancel';
|
|
61
61
|
export interface CalendarToolOptions {
|
|
62
62
|
updateContext: UpdateCalendarToolBeltContextHandler;
|
|
63
63
|
getContext: GetCalendarToolBeltContextHandler;
|
|
64
64
|
getPersonFromEvent: GetPersonFromEventHandler;
|
|
65
65
|
getHasPendingContextChanges: GetHasPendingContextChangesHandler;
|
|
66
66
|
}
|
|
67
|
-
export
|
|
67
|
+
export type CancelEventRecurringOptions = SpruceSchemas.Calendar.v2021_05_19.CancelCalendarEventEmitPayload;
|
|
68
68
|
export interface EventWithToolBeltState {
|
|
69
69
|
getToolBeltState(): ToolBeltState;
|
|
70
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
export
|
|
2
|
+
export type CalendarShift = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarShift;
|
|
3
3
|
import { EventForShift } from '../types/calendar.types';
|
|
4
4
|
declare const calendarShiftGenerator: {
|
|
5
5
|
generateFromEvent(event: EventForShift): CalendarShift[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractViewController, CalendarViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
3
|
+
type DateSelectHandler = (dateTimeMs: number) => void | Promise<void>;
|
|
4
4
|
export interface DateSelectOptions {
|
|
5
5
|
onSelectDate: DateSelectHandler;
|
|
6
6
|
startDate: number;
|
|
@@ -42,6 +42,6 @@ export default class RepeatingControlsListViewController extends AbstractViewCon
|
|
|
42
42
|
private changeCalendarSelectedDate;
|
|
43
43
|
render(): import("@sprucelabs/calendar-utils").SpruceSchemas.HeartwoodViewControllers.v2021_02_11.List;
|
|
44
44
|
}
|
|
45
|
-
export
|
|
45
|
+
export type RepeatingOptions = Partial<Pick<CalendarEvent, 'repeats' | 'interval' | 'repeatsUntil' | 'occurrences' | 'startDateTimeMs' | 'daysOfWeek' | 'daysOfMonth'> & {
|
|
46
46
|
repeatAmount?: 'forever' | 'until' | 'after';
|
|
47
47
|
}>;
|
|
@@ -12,7 +12,7 @@ export default class SelectUpdateRepeatingStrategyCardViewController extends Abs
|
|
|
12
12
|
getEvent(): CalendarEvent;
|
|
13
13
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
16
16
|
export interface SelectUpdateRepeatingStrategyOptions {
|
|
17
17
|
event: CalendarEvent;
|
|
18
18
|
action?: 'update' | 'cancel';
|
|
@@ -72,7 +72,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
|
|
|
72
72
|
private getVisibleEvents;
|
|
73
73
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.SkillView;
|
|
74
74
|
}
|
|
75
|
-
export
|
|
75
|
+
export type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
76
76
|
export interface RootArgs {
|
|
77
77
|
startDate?: number;
|
|
78
78
|
visiblePeopleIds?: string[];
|
|
@@ -41,7 +41,7 @@ export interface RemoteEventStoreOptions {
|
|
|
41
41
|
connectToApi: () => Promise<MercuryClient>;
|
|
42
42
|
calendarId?: string;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
type FullEvent = SpruceSchemas.CalendarUtils.v2021_05_19.CalendarEvent;
|
|
45
45
|
export interface RemoteEventStore {
|
|
46
46
|
load(options: {
|
|
47
47
|
organizationId: string;
|
|
@@ -57,7 +57,7 @@ export interface RemoteEventStore {
|
|
|
57
57
|
getEventTypes(): Promise<CalendarEventType[]>;
|
|
58
58
|
getCalendars(): Promise<Calendar[]>;
|
|
59
59
|
}
|
|
60
|
-
export
|
|
60
|
+
export type GetScheduleOptions = {
|
|
61
61
|
calendarIds: string[];
|
|
62
62
|
peopleIds: string[];
|
|
63
63
|
startDate: number;
|
|
@@ -20,7 +20,7 @@ export default class RemotePreferencesStore {
|
|
|
20
20
|
getVisiblePeopleMode(): PersonMode | null | undefined;
|
|
21
21
|
getIsLoaded(): boolean;
|
|
22
22
|
}
|
|
23
|
-
export
|
|
23
|
+
export type VisiblePeopleMode = 'custom' | 'me' | 'working';
|
|
24
24
|
export interface RemotePreferencesStoreOptions {
|
|
25
25
|
connectToApi: () => Promise<MercuryClient>;
|
|
26
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RemoteCalendarTool, CalendarToolBeltStateMachine } from '../types/calendar.types';
|
|
2
|
-
export
|
|
2
|
+
export type AddToolHandler = (vc: RemoteCalendarTool & {
|
|
3
3
|
id: string;
|
|
4
4
|
}) => Promise<void> | void;
|
|
5
5
|
export default class CalendarToolRegistrar {
|
|
@@ -29,6 +29,6 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
|
|
|
29
29
|
getControlsVc(): EventControlsCardViewController;
|
|
30
30
|
destroy(): Promise<void>;
|
|
31
31
|
}
|
|
32
|
-
export
|
|
32
|
+
export type AddToolOptions = Omit<Tool, 'card'> & {
|
|
33
33
|
cardVcId: ViewControllerId;
|
|
34
34
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CardViewController, SpruceSchemas, ToolBeltState } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { CalendarToolBeltStateMachine } from '../../types/calendar.types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
type Calendar = SpruceSchemas.Calendar.v2021_05_19.Calendar;
|
|
4
|
+
type EventType = SpruceSchemas.Calendar.v2021_05_19.CalendarEventType;
|
|
5
|
+
type SelectCalendarHandler = (calendar: Calendar) => Promise<void> | void;
|
|
6
|
+
type SelectTypeHandler = (type: EventType) => Promise<void> | void;
|
|
7
7
|
export interface PrerequisitesToolBeltStateOptions {
|
|
8
8
|
onSelectCalendar?: SelectCalendarHandler;
|
|
9
9
|
onSelectEventType?: SelectTypeHandler;
|
|
@@ -21,8 +21,8 @@ export default class CalendarSelectCardViewController extends AbstractViewContro
|
|
|
21
21
|
}): Promise<void>;
|
|
22
22
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export
|
|
24
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
25
|
+
export type CalendarVisibilityToggleHandler = (calendarId: string, isVisible: boolean) => any;
|
|
26
26
|
export interface CalendarSelectCardOptions {
|
|
27
27
|
events: CalendarEventManager;
|
|
28
28
|
}
|
|
@@ -38,5 +38,5 @@ export default class EventDateTimeToolViewController extends AbstractViewControl
|
|
|
38
38
|
}, false>;
|
|
39
39
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
42
42
|
export {};
|
|
@@ -28,9 +28,9 @@ export default class PersonSelectToolViewController extends AbstractViewControll
|
|
|
28
28
|
getIsLoaded(): boolean;
|
|
29
29
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
30
30
|
}
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export
|
|
31
|
+
export type PersonVisibilityToggleHandler = (person: SpruceSchemas.Spruce.v2020_07_22.Person, isVisible: boolean) => void;
|
|
32
|
+
export type PersonVisibilytModeToggleHandler = (mode: PersonMode) => Promise<void> | void;
|
|
33
|
+
export type PersonMode = 'me' | 'custom' | 'working';
|
|
34
34
|
export interface PersonSelectCardOptions {
|
|
35
35
|
people: CalendarPeopleManager;
|
|
36
36
|
}
|
|
@@ -3,16 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
4
4
|
const schema_1 = require("@sprucelabs/schema");
|
|
5
5
|
class PersonSelectToolViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
6
|
-
constructor(options) {
|
|
7
|
-
super(options);
|
|
8
|
-
this.shouldUpdateVisibilityOnToggleChange = true;
|
|
9
|
-
this.isLoaded = false;
|
|
10
|
-
const { people } = (0, schema_1.assertOptions)(options, ['people']);
|
|
11
|
-
this.people = people;
|
|
12
|
-
this.listVc = this.ListVc();
|
|
13
|
-
this.modeButtonBarVc = this.ModeButtonBarVc();
|
|
14
|
-
this.cardVc = this.CardVc();
|
|
15
|
-
}
|
|
16
6
|
get visiblePeopleIds() {
|
|
17
7
|
return this.people.getVisiblePeopleIds();
|
|
18
8
|
}
|
|
@@ -23,6 +13,16 @@ class PersonSelectToolViewController extends heartwood_view_controllers_1.Abstra
|
|
|
23
13
|
get mode() {
|
|
24
14
|
return this.people.getVisibilityMode();
|
|
25
15
|
}
|
|
16
|
+
constructor(options) {
|
|
17
|
+
super(options);
|
|
18
|
+
this.shouldUpdateVisibilityOnToggleChange = true;
|
|
19
|
+
this.isLoaded = false;
|
|
20
|
+
const { people } = (0, schema_1.assertOptions)(options, ['people']);
|
|
21
|
+
this.people = people;
|
|
22
|
+
this.listVc = this.ListVc();
|
|
23
|
+
this.modeButtonBarVc = this.ModeButtonBarVc();
|
|
24
|
+
this.cardVc = this.CardVc();
|
|
25
|
+
}
|
|
26
26
|
CardVc() {
|
|
27
27
|
return this.Controller('card', {
|
|
28
28
|
header: {
|
|
@@ -12,20 +12,20 @@ export interface Schedule {
|
|
|
12
12
|
target: EventTarget;
|
|
13
13
|
events: CalendarEventRecord[];
|
|
14
14
|
}
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
export
|
|
28
|
-
|
|
15
|
+
export type EventForShift = Pick<CalendarEvent, 'id' | 'timeBlocks' | 'startDateTimeMs' | 'target'>;
|
|
16
|
+
export type DraftEvent = Pick<CalendarEvent, 'id' | 'startDateTimeMs' | 'style' | 'calendarId' | 'target' | 'timeBlocks' | 'isBusy'>;
|
|
17
|
+
export type CalendarEventRecord = SpruceSchemas.CalendarUtils.v2021_05_19.CalendarEvent;
|
|
18
|
+
export type CalendarEvent = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarEvent;
|
|
19
|
+
export type UpdateEvent = SpruceSchemas.Calendar.v2021_05_19.UpdateCalendarEventEmitPayload & CalendarEvent;
|
|
20
|
+
export type Person = SpruceSchemas.Spruce.v2020_07_22.Person;
|
|
21
|
+
export type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
22
|
+
export type EventType = SpruceSchemas.Calendar.v2021_05_19.CalendarEventType;
|
|
23
|
+
export type Calendar = SpruceSchemas.Calendar.v2021_05_19.Calendar;
|
|
24
|
+
export type CalendarEventType = SpruceSchemas.Calendar.v2021_05_19.CalendarEventType;
|
|
25
|
+
export type SimpleCalendar = Pick<Calendar, 'id' | 'availableTimeSlotBehavior'>;
|
|
26
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
27
|
+
export type PersonWithoutSchedule = SpruceSchemas.Calendar.v2021_05_19.PersonWithoutSchedule;
|
|
28
|
+
type ICalendarToolBeltContext = SkillViewControllerLoadOptions & {
|
|
29
29
|
event: CalendarEvent;
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated use events or people to control the state of the calendar
|
|
@@ -51,20 +51,20 @@ export interface CalendarTool extends AbstractViewController<Card> {
|
|
|
51
51
|
export interface UpdateCalendarContextOptions {
|
|
52
52
|
shouldPersistContextChangesImmediately?: boolean;
|
|
53
53
|
}
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
export
|
|
59
|
-
export
|
|
60
|
-
export
|
|
54
|
+
export type UpdateCalendarToolBeltContextHandler<Context extends CalendarToolBeltContext = CalendarToolBeltContext> = (context: Partial<Context>, options?: UpdateCalendarContextOptions) => Promise<boolean>;
|
|
55
|
+
export type Tool = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.ToolBeltTool;
|
|
56
|
+
export type GetCalendarToolBeltContextHandler = () => CalendarToolBeltContext;
|
|
57
|
+
export type GetPersonFromEventHandler = () => Promise<Person | null>;
|
|
58
|
+
export type GetHasPendingContextChangesHandler = () => boolean;
|
|
59
|
+
export type CancelEventHandler = (eventId: string) => boolean | Promise<boolean | void> | void;
|
|
60
|
+
export type UpdateRepeatingStrategyWithCancel = UpdateRepeatingStrategy | 'cancel';
|
|
61
61
|
export interface CalendarToolOptions {
|
|
62
62
|
updateContext: UpdateCalendarToolBeltContextHandler;
|
|
63
63
|
getContext: GetCalendarToolBeltContextHandler;
|
|
64
64
|
getPersonFromEvent: GetPersonFromEventHandler;
|
|
65
65
|
getHasPendingContextChanges: GetHasPendingContextChangesHandler;
|
|
66
66
|
}
|
|
67
|
-
export
|
|
67
|
+
export type CancelEventRecurringOptions = SpruceSchemas.Calendar.v2021_05_19.CancelCalendarEventEmitPayload;
|
|
68
68
|
export interface EventWithToolBeltState {
|
|
69
69
|
getToolBeltState(): ToolBeltState;
|
|
70
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
export
|
|
2
|
+
export type CalendarShift = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarShift;
|
|
3
3
|
import { EventForShift } from '../types/calendar.types';
|
|
4
4
|
declare const calendarShiftGenerator: {
|
|
5
5
|
generateFromEvent(event: EventForShift): CalendarShift[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractViewController, CalendarViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
3
|
+
type DateSelectHandler = (dateTimeMs: number) => void | Promise<void>;
|
|
4
4
|
export interface DateSelectOptions {
|
|
5
5
|
onSelectDate: DateSelectHandler;
|
|
6
6
|
startDate: number;
|