@sprucelabs/spruce-calendar-components 22.3.5 → 22.3.6

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.
@@ -15,10 +15,10 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
15
15
  private _isLoaded;
16
16
  load(sm: CalendarToolBeltStateMachine): Promise<void>;
17
17
  protected loadRemoteCards(): Promise<void>;
18
- private handleClickSave;
18
+ protected handleClickSave(): Promise<void>;
19
19
  private handleDidUpdateContext;
20
20
  private getContext;
21
- clearPendingContextChanges(): Promise<void>;
21
+ clearPendingContextChanges(shouldEmitDidUpdate?: boolean): Promise<void>;
22
22
  addTool(options: AddToolOptions): Promise<CalendarTool>;
23
23
  protected buildVcConstructorOptions(id: string): CalendarToolOptions;
24
24
  private addVc;
@@ -44,8 +44,9 @@ export default class AbstractCalendarEventToolBeltState {
44
44
  }
45
45
  handleClickSave() {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
- yield this.sm.updateContext(Object.assign({}, this.pendingContextUpdates));
48
- yield this.clearPendingContextChanges();
47
+ const updates = this.pendingContextUpdates;
48
+ yield this.clearPendingContextChanges(false);
49
+ yield this.sm.updateContext(Object.assign({}, updates));
49
50
  });
50
51
  }
51
52
  handleDidUpdateContext(skipToolWithId) {
@@ -61,10 +62,12 @@ export default class AbstractCalendarEventToolBeltState {
61
62
  getContext() {
62
63
  return Object.assign(Object.assign({}, this.sm.getContext()), this.pendingContextUpdates);
63
64
  }
64
- clearPendingContextChanges() {
65
+ clearPendingContextChanges(shouldEmitDidUpdate = true) {
65
66
  return __awaiter(this, void 0, void 0, function* () {
66
67
  this.pendingContextUpdates = {};
67
- yield this.handleDidUpdateContext();
68
+ if (shouldEmitDidUpdate) {
69
+ yield this.handleDidUpdateContext();
70
+ }
68
71
  });
69
72
  }
70
73
  addTool(options) {
@@ -15,10 +15,10 @@ export default abstract class AbstractCalendarEventToolBeltState implements Tool
15
15
  private _isLoaded;
16
16
  load(sm: CalendarToolBeltStateMachine): Promise<void>;
17
17
  protected loadRemoteCards(): Promise<void>;
18
- private handleClickSave;
18
+ protected handleClickSave(): Promise<void>;
19
19
  private handleDidUpdateContext;
20
20
  private getContext;
21
- clearPendingContextChanges(): Promise<void>;
21
+ clearPendingContextChanges(shouldEmitDidUpdate?: boolean): Promise<void>;
22
22
  addTool(options: AddToolOptions): Promise<CalendarTool>;
23
23
  protected buildVcConstructorOptions(id: string): CalendarToolOptions;
24
24
  private addVc;
@@ -35,8 +35,9 @@ class AbstractCalendarEventToolBeltState {
35
35
  await registrar.fetchAndAddCards((id) => this.buildVcConstructorOptions(id));
36
36
  }
37
37
  async handleClickSave() {
38
- await this.sm.updateContext(Object.assign({}, this.pendingContextUpdates));
39
- await this.clearPendingContextChanges();
38
+ const updates = this.pendingContextUpdates;
39
+ await this.clearPendingContextChanges(false);
40
+ await this.sm.updateContext(Object.assign({}, updates));
40
41
  }
41
42
  async handleDidUpdateContext(skipToolWithId) {
42
43
  await Promise.all(this.vcs.map(async ({ vc, toolId }) => {
@@ -49,9 +50,11 @@ class AbstractCalendarEventToolBeltState {
49
50
  getContext() {
50
51
  return Object.assign(Object.assign({}, this.sm.getContext()), this.pendingContextUpdates);
51
52
  }
52
- async clearPendingContextChanges() {
53
+ async clearPendingContextChanges(shouldEmitDidUpdate = true) {
53
54
  this.pendingContextUpdates = {};
54
- await this.handleDidUpdateContext();
55
+ if (shouldEmitDidUpdate) {
56
+ await this.handleDidUpdateContext();
57
+ }
55
58
  }
56
59
  async addTool(options) {
57
60
  (0, schema_1.assertOptions)(options, ['id', 'lineIcon', 'cardVcId']);
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.5",
4
+ "version": "22.3.6",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },