@sprucelabs/spruce-calendar-components 22.3.11 → 22.3.12

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.
@@ -240,7 +240,7 @@ export default class RootSkillViewController extends AbstractSkillViewController
240
240
  }
241
241
  catch (err) {
242
242
  console.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
243
- this.calendarVc.deselectEvent();
243
+ yield this.events.deselectEvent();
244
244
  yield this.alert({
245
245
  message: (_b = err.message) !== null && _b !== void 0 ? _b : 'Shoot! I could not load that for you! Refresh and try again!!',
246
246
  });
@@ -16,6 +16,7 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
16
16
  load(sm: CalendarToolBeltStateMachine): Promise<void>;
17
17
  protected loadRemoteCards(): Promise<void>;
18
18
  protected handleClickSave(): Promise<void>;
19
+ private deselectEvent;
19
20
  private handleDidUpdateContext;
20
21
  private getContext;
21
22
  clearPendingContextChanges(shouldEmitDidUpdate?: boolean): Promise<void>;
@@ -44,11 +44,18 @@ export default class AbstractCalendarEventToolBeltState {
44
44
  }
45
45
  handleClickSave() {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
+ yield this.deselectEvent();
47
48
  const updates = this.pendingContextUpdates;
48
49
  yield this.clearPendingContextChanges(false);
49
50
  yield this.sm.updateContext(Object.assign({}, updates));
50
51
  });
51
52
  }
53
+ deselectEvent() {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const { events } = this.sm.getContext();
56
+ yield events.deselectEvent();
57
+ });
58
+ }
52
59
  handleDidUpdateContext(skipToolWithId) {
53
60
  return __awaiter(this, void 0, void 0, function* () {
54
61
  yield Promise.all(this.vcs.map(({ vc, toolId }) => __awaiter(this, void 0, void 0, function* () {
@@ -61,13 +61,14 @@ export declare class CalendarEventManager {
61
61
  getEvent(id: string): CalendarEvent;
62
62
  private loadCalendars;
63
63
  private handleWillUpdateContext;
64
+ deselectEvent(): Promise<void>;
64
65
  private handleDidUpdateContext;
65
66
  private saveEvent;
66
67
  getIsLoaded(): boolean;
67
68
  hasEvent(id: string): boolean;
68
69
  optionallyAskForUpdateRepeatingStrategy(event: UpdateEvent): Promise<boolean>;
69
70
  }
70
- export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent'>;
71
+ export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent' | 'deselectEvent'>;
71
72
  declare type EventManagerRemoteViewControllerFactory = Pick<RemoteViewControllerFactory, 'fetchRemoteController'>;
72
73
  export interface CalendarEventManagerOptions {
73
74
  calendarVc: EventManagerCalendarVc;
@@ -292,6 +292,11 @@ export class CalendarEventManager {
292
292
  };
293
293
  });
294
294
  }
295
+ deselectEvent() {
296
+ return __awaiter(this, void 0, void 0, function* () {
297
+ this.calendarVc.deselectEvent();
298
+ });
299
+ }
295
300
  handleDidUpdateContext() {
296
301
  return __awaiter(this, void 0, void 0, function* () {
297
302
  if (this.shouldIgnoreNextContextUpdate) {
@@ -213,7 +213,7 @@ class RootSkillViewController extends heartwood_view_controllers_1.AbstractSkill
213
213
  }
214
214
  catch (err) {
215
215
  console.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
216
- this.calendarVc.deselectEvent();
216
+ await this.events.deselectEvent();
217
217
  await this.alert({
218
218
  message: (_b = err.message) !== null && _b !== void 0 ? _b : 'Shoot! I could not load that for you! Refresh and try again!!',
219
219
  });
@@ -16,6 +16,7 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
16
16
  load(sm: CalendarToolBeltStateMachine): Promise<void>;
17
17
  protected loadRemoteCards(): Promise<void>;
18
18
  protected handleClickSave(): Promise<void>;
19
+ private deselectEvent;
19
20
  private handleDidUpdateContext;
20
21
  private getContext;
21
22
  clearPendingContextChanges(shouldEmitDidUpdate?: boolean): Promise<void>;
@@ -35,10 +35,15 @@ class AbstractCalendarEventToolBeltState {
35
35
  await registrar.fetchAndAddCards((id) => this.buildVcConstructorOptions(id));
36
36
  }
37
37
  async handleClickSave() {
38
+ await this.deselectEvent();
38
39
  const updates = this.pendingContextUpdates;
39
40
  await this.clearPendingContextChanges(false);
40
41
  await this.sm.updateContext(Object.assign({}, updates));
41
42
  }
43
+ async deselectEvent() {
44
+ const { events } = this.sm.getContext();
45
+ await events.deselectEvent();
46
+ }
42
47
  async handleDidUpdateContext(skipToolWithId) {
43
48
  await Promise.all(this.vcs.map(async ({ vc, toolId }) => {
44
49
  if (toolId !== skipToolWithId) {
@@ -61,13 +61,14 @@ export declare class CalendarEventManager {
61
61
  getEvent(id: string): CalendarEvent;
62
62
  private loadCalendars;
63
63
  private handleWillUpdateContext;
64
+ deselectEvent(): Promise<void>;
64
65
  private handleDidUpdateContext;
65
66
  private saveEvent;
66
67
  getIsLoaded(): boolean;
67
68
  hasEvent(id: string): boolean;
68
69
  optionallyAskForUpdateRepeatingStrategy(event: UpdateEvent): Promise<boolean>;
69
70
  }
70
- export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent'>;
71
+ export declare type EventManagerCalendarVc = Pick<CalendarViewController, 'replaceEventsInRange' | 'mixinEvents' | 'removeEvent' | 'addEvent' | 'hasEvent' | 'updateEvent' | 'setShifts' | 'getShifts' | 'getEvent' | 'getPeople' | 'setControllerForEventType' | 'setRemoteStore' | 'getSelectedEvent' | 'selectEvent' | 'deselectEvent'>;
71
72
  declare type EventManagerRemoteViewControllerFactory = Pick<RemoteViewControllerFactory, 'fetchRemoteController'>;
72
73
  export interface CalendarEventManagerOptions {
73
74
  calendarVc: EventManagerCalendarVc;
@@ -255,6 +255,9 @@ class CalendarEventManager {
255
255
  shouldAllowUpdates: pass,
256
256
  };
257
257
  }
258
+ async deselectEvent() {
259
+ this.calendarVc.deselectEvent();
260
+ }
258
261
  async handleDidUpdateContext() {
259
262
  if (this.shouldIgnoreNextContextUpdate) {
260
263
  this.shouldIgnoreNextContextUpdate = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "22.3.11",
4
+ "version": "22.3.12",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },