@sprucelabs/spruce-calendar-components 20.9.14 → 20.9.15

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.
@@ -126,15 +126,16 @@ export default class AbstractCalendarEventToolBeltState {
126
126
  return __awaiter(this, void 0, void 0, function* () {
127
127
  const pendingUpdates = Object.assign(Object.assign({}, this.pendingContextUpdates), updates);
128
128
  if (equalDeep(this.pendingContextUpdates, pendingUpdates)) {
129
- return;
129
+ return false;
130
130
  }
131
131
  this.pendingContextUpdates = pendingUpdates;
132
132
  yield this.handleDidUpdateContext(fromToolId);
133
133
  const vc = this.getVcForTool(fromToolId);
134
134
  if ((vc === null || vc === void 0 ? void 0 : vc.shouldPersistContextChangesImmediately) ||
135
135
  (options === null || options === void 0 ? void 0 : options.shouldPersistContextChangesImmediately)) {
136
- yield this.sm.updateContext(Object.assign({}, updates));
136
+ return this.sm.updateContext(Object.assign({}, updates));
137
137
  }
138
+ return false;
138
139
  });
139
140
  }
140
141
  removeTool(id) {
@@ -22,7 +22,9 @@ declare type ICalendarToolBeltContext = SkillViewControllerLoadOptions & {
22
22
  };
23
23
  export interface CalendarToolBeltContext extends ICalendarToolBeltContext {
24
24
  }
25
- export declare type CalendarToolBeltStateMachine = ToolBeltStateMachine<CalendarToolBeltContext>;
25
+ export interface CalendarToolBeltStateMachine<Context extends CalendarToolBeltContext = CalendarToolBeltContext> extends ToolBeltStateMachine<Context> {
26
+ updateContext: UpdateCalendarToolBeltContextHandler<Context>;
27
+ }
26
28
  export interface RemoteCalendarTool extends CalendarTool {
27
29
  getLineIcon(): LineIcon;
28
30
  }
@@ -34,7 +36,7 @@ export interface CalendarTool extends AbstractViewController<Card> {
34
36
  export interface UpdateCalendarContextOptions {
35
37
  shouldPersistContextChangesImmediately?: boolean;
36
38
  }
37
- export declare type UpdateCalendarToolBeltContextHandler = (context: Partial<CalendarToolBeltContext>, options?: UpdateCalendarContextOptions) => Promise<void>;
39
+ export declare type UpdateCalendarToolBeltContextHandler<Context extends CalendarToolBeltContext = CalendarToolBeltContext> = (context: Partial<Context>, options?: UpdateCalendarContextOptions) => Promise<boolean>;
38
40
  export declare type GetCalendarToolBeltContextHandler = () => CalendarToolBeltContext;
39
41
  export declare type GetPersonFromEventHandler = () => Promise<Person | null>;
40
42
  export declare type GetHasPendingContextChangesHandler = () => boolean;
@@ -64,7 +64,7 @@ export default class EventTitleToolViewController extends AbstractViewController
64
64
  return __awaiter(this, void 0, void 0, function* () {
65
65
  const { event } = this.getContext();
66
66
  event.timeBlocks[0] = Object.assign(Object.assign({}, event.timeBlocks[0]), this.formVc.getValues());
67
- return this.updateContextHandler({
67
+ yield this.updateContextHandler({
68
68
  event: Object.assign({}, event),
69
69
  });
70
70
  });
@@ -105,15 +105,16 @@ class AbstractCalendarEventToolBeltState {
105
105
  async handleUpdateContextFromTool(updates, fromToolId, options) {
106
106
  const pendingUpdates = Object.assign(Object.assign({}, this.pendingContextUpdates), updates);
107
107
  if ((0, isEqual_1.default)(this.pendingContextUpdates, pendingUpdates)) {
108
- return;
108
+ return false;
109
109
  }
110
110
  this.pendingContextUpdates = pendingUpdates;
111
111
  await this.handleDidUpdateContext(fromToolId);
112
112
  const vc = this.getVcForTool(fromToolId);
113
113
  if ((vc === null || vc === void 0 ? void 0 : vc.shouldPersistContextChangesImmediately) ||
114
114
  (options === null || options === void 0 ? void 0 : options.shouldPersistContextChangesImmediately)) {
115
- await this.sm.updateContext(Object.assign({}, updates));
115
+ return this.sm.updateContext(Object.assign({}, updates));
116
116
  }
117
+ return false;
117
118
  }
118
119
  removeTool(id) {
119
120
  (0, schema_1.assertOptions)({ id }, ['id']);
@@ -22,7 +22,9 @@ declare type ICalendarToolBeltContext = SkillViewControllerLoadOptions & {
22
22
  };
23
23
  export interface CalendarToolBeltContext extends ICalendarToolBeltContext {
24
24
  }
25
- export declare type CalendarToolBeltStateMachine = ToolBeltStateMachine<CalendarToolBeltContext>;
25
+ export interface CalendarToolBeltStateMachine<Context extends CalendarToolBeltContext = CalendarToolBeltContext> extends ToolBeltStateMachine<Context> {
26
+ updateContext: UpdateCalendarToolBeltContextHandler<Context>;
27
+ }
26
28
  export interface RemoteCalendarTool extends CalendarTool {
27
29
  getLineIcon(): LineIcon;
28
30
  }
@@ -34,7 +36,7 @@ export interface CalendarTool extends AbstractViewController<Card> {
34
36
  export interface UpdateCalendarContextOptions {
35
37
  shouldPersistContextChangesImmediately?: boolean;
36
38
  }
37
- export declare type UpdateCalendarToolBeltContextHandler = (context: Partial<CalendarToolBeltContext>, options?: UpdateCalendarContextOptions) => Promise<void>;
39
+ export declare type UpdateCalendarToolBeltContextHandler<Context extends CalendarToolBeltContext = CalendarToolBeltContext> = (context: Partial<Context>, options?: UpdateCalendarContextOptions) => Promise<boolean>;
38
40
  export declare type GetCalendarToolBeltContextHandler = () => CalendarToolBeltContext;
39
41
  export declare type GetPersonFromEventHandler = () => Promise<Person | null>;
40
42
  export declare type GetHasPendingContextChangesHandler = () => boolean;
@@ -56,7 +56,7 @@ class EventTitleToolViewController extends heartwood_view_controllers_1.Abstract
56
56
  async handleChangeForm() {
57
57
  const { event } = this.getContext();
58
58
  event.timeBlocks[0] = Object.assign(Object.assign({}, event.timeBlocks[0]), this.formVc.getValues());
59
- return this.updateContextHandler({
59
+ await this.updateContextHandler({
60
60
  event: Object.assign({}, event),
61
61
  });
62
62
  }
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": "20.9.14",
4
+ "version": "20.9.15",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },