@sprucelabs/spruce-calendar-components 38.1.8 → 38.1.10
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/__tests__/support/utilities/mixinViewControllersForTests.js +2 -0
- package/build/esm/__tests__/support/utilities/mixinViewControllersForTests.js +2 -0
- package/build/esm/tools/VenueSelectionTool.vc.js +3 -0
- package/build/esm/viewControllers/VenuesList.vc.d.ts +2 -1
- package/build/esm/viewControllers/VenuesList.vc.js +12 -2
- package/build/tools/VenueSelectionTool.vc.js +3 -0
- package/build/viewControllers/VenuesList.vc.d.ts +2 -1
- package/build/viewControllers/VenuesList.vc.js +12 -2
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ const VenueSelectionTool_vc_1 = __importDefault(require("../../../tools/VenueSel
|
|
|
13
13
|
const EventControlsCard_vc_1 = __importDefault(require("../../../viewControllers/EventControlsCard.vc"));
|
|
14
14
|
const RepeatingControlsList_vc_1 = __importDefault(require("../../../viewControllers/RepeatingControlsList.vc"));
|
|
15
15
|
const UniversalCalendarEvent_vc_1 = __importDefault(require("../../../viewControllers/UniversalCalendarEvent.vc"));
|
|
16
|
+
const VenuesList_vc_1 = __importDefault(require("../../../viewControllers/VenuesList.vc"));
|
|
16
17
|
function mixinViewControllersForTests(factory) {
|
|
17
18
|
for (const [id, vc] of Object.entries(vcs)) {
|
|
18
19
|
if (!factory.hasController(id)) {
|
|
@@ -30,4 +31,5 @@ const vcs = {
|
|
|
30
31
|
['calendar.event-controls-card']: EventControlsCard_vc_1.default,
|
|
31
32
|
['calendar.universal-calendar-event']: UniversalCalendarEvent_vc_1.default,
|
|
32
33
|
['calendar.venue-selection-tool']: VenueSelectionTool_vc_1.default,
|
|
34
|
+
['calendar.venues-list']: VenuesList_vc_1.default,
|
|
33
35
|
};
|
|
@@ -7,6 +7,7 @@ import VenueSelectionToolViewController from '../../../tools/VenueSelectionTool.
|
|
|
7
7
|
import EventControlsCardViewController from '../../../viewControllers/EventControlsCard.vc.js';
|
|
8
8
|
import RepeatingControlsListViewController from '../../../viewControllers/RepeatingControlsList.vc.js';
|
|
9
9
|
import UniversalCalendarEventViewController from '../../../viewControllers/UniversalCalendarEvent.vc.js';
|
|
10
|
+
import VenuesListViewController from '../../../viewControllers/VenuesList.vc.js';
|
|
10
11
|
export default function mixinViewControllersForTests(factory) {
|
|
11
12
|
for (const [id, vc] of Object.entries(vcs)) {
|
|
12
13
|
if (!factory.hasController(id)) {
|
|
@@ -24,4 +25,5 @@ const vcs = {
|
|
|
24
25
|
['calendar.event-controls-card']: EventControlsCardViewController,
|
|
25
26
|
['calendar.universal-calendar-event']: UniversalCalendarEventViewController,
|
|
26
27
|
['calendar.venue-selection-tool']: VenueSelectionToolViewController,
|
|
28
|
+
['calendar.venues-list']: VenuesListViewController,
|
|
27
29
|
};
|
|
@@ -6,6 +6,7 @@ export default class VenuesListViewController extends AbstractViewController<Lis
|
|
|
6
6
|
private venues;
|
|
7
7
|
protected onSelectHandler?: (venue: Venue) => void;
|
|
8
8
|
private router;
|
|
9
|
+
private isLoaded;
|
|
9
10
|
constructor(options: ViewControllerOptions & VenuesListConstructorOptions);
|
|
10
11
|
private ListVc;
|
|
11
12
|
load(options: VenuesListLoadOptions): Promise<void>;
|
|
@@ -14,7 +15,7 @@ export default class VenuesListViewController extends AbstractViewController<Lis
|
|
|
14
15
|
selectVenue(provider: string): Promise<void>;
|
|
15
16
|
private handleOnClickJoinUrl;
|
|
16
17
|
private handleChange;
|
|
17
|
-
render():
|
|
18
|
+
render(): List;
|
|
18
19
|
}
|
|
19
20
|
export interface VenuesListLoadOptions {
|
|
20
21
|
organizationId: string;
|
|
@@ -12,6 +12,7 @@ class VenuesListViewController extends AbstractViewController {
|
|
|
12
12
|
constructor(options) {
|
|
13
13
|
super(options);
|
|
14
14
|
this.venues = [];
|
|
15
|
+
this.isLoaded = false;
|
|
15
16
|
const { router, onSelect } = options;
|
|
16
17
|
this.onSelectHandler = onSelect;
|
|
17
18
|
this.router = router;
|
|
@@ -26,20 +27,27 @@ class VenuesListViewController extends AbstractViewController {
|
|
|
26
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
28
|
const { organizationId } = options;
|
|
28
29
|
const client = yield this.connectToApi();
|
|
30
|
+
this.isLoaded = true;
|
|
29
31
|
try {
|
|
30
|
-
const
|
|
32
|
+
const results = yield client.emitAndFlattenResponses('calendar.register-venues::v2021_05_19', {
|
|
31
33
|
target: {
|
|
32
34
|
organizationId,
|
|
33
35
|
},
|
|
34
36
|
});
|
|
37
|
+
if (results.length === 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const venues = results[0].venues;
|
|
35
41
|
this.venues.push(...venues);
|
|
36
42
|
this.populateList();
|
|
37
43
|
}
|
|
38
44
|
catch (err) {
|
|
45
|
+
this.log.error(`Emitting register-venues failed`, err.stack);
|
|
39
46
|
yield this.alert({
|
|
40
47
|
message: `We had trouble loading your venues. Please try again later. Error: ${err.message}`,
|
|
41
48
|
});
|
|
42
49
|
}
|
|
50
|
+
this.triggerRender();
|
|
43
51
|
});
|
|
44
52
|
}
|
|
45
53
|
populateList() {
|
|
@@ -111,7 +119,9 @@ class VenuesListViewController extends AbstractViewController {
|
|
|
111
119
|
(_a = this.onSelectHandler) === null || _a === void 0 ? void 0 : _a.call(this, venue);
|
|
112
120
|
}
|
|
113
121
|
render() {
|
|
114
|
-
return this.
|
|
122
|
+
return (this.venues.length === 0 && this.isLoaded
|
|
123
|
+
? null
|
|
124
|
+
: this.listVc.render());
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
127
|
VenuesListViewController.id = 'venues-list';
|
|
@@ -6,6 +6,7 @@ export default class VenuesListViewController extends AbstractViewController<Lis
|
|
|
6
6
|
private venues;
|
|
7
7
|
protected onSelectHandler?: (venue: Venue) => void;
|
|
8
8
|
private router;
|
|
9
|
+
private isLoaded;
|
|
9
10
|
constructor(options: ViewControllerOptions & VenuesListConstructorOptions);
|
|
10
11
|
private ListVc;
|
|
11
12
|
load(options: VenuesListLoadOptions): Promise<void>;
|
|
@@ -14,7 +15,7 @@ export default class VenuesListViewController extends AbstractViewController<Lis
|
|
|
14
15
|
selectVenue(provider: string): Promise<void>;
|
|
15
16
|
private handleOnClickJoinUrl;
|
|
16
17
|
private handleChange;
|
|
17
|
-
render():
|
|
18
|
+
render(): List;
|
|
18
19
|
}
|
|
19
20
|
export interface VenuesListLoadOptions {
|
|
20
21
|
organizationId: string;
|
|
@@ -5,6 +5,7 @@ class VenuesListViewController extends heartwood_view_controllers_1.AbstractView
|
|
|
5
5
|
constructor(options) {
|
|
6
6
|
super(options);
|
|
7
7
|
this.venues = [];
|
|
8
|
+
this.isLoaded = false;
|
|
8
9
|
const { router, onSelect } = options;
|
|
9
10
|
this.onSelectHandler = onSelect;
|
|
10
11
|
this.router = router;
|
|
@@ -18,20 +19,27 @@ class VenuesListViewController extends heartwood_view_controllers_1.AbstractView
|
|
|
18
19
|
async load(options) {
|
|
19
20
|
const { organizationId } = options;
|
|
20
21
|
const client = await this.connectToApi();
|
|
22
|
+
this.isLoaded = true;
|
|
21
23
|
try {
|
|
22
|
-
const
|
|
24
|
+
const results = await client.emitAndFlattenResponses('calendar.register-venues::v2021_05_19', {
|
|
23
25
|
target: {
|
|
24
26
|
organizationId,
|
|
25
27
|
},
|
|
26
28
|
});
|
|
29
|
+
if (results.length === 0) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const venues = results[0].venues;
|
|
27
33
|
this.venues.push(...venues);
|
|
28
34
|
this.populateList();
|
|
29
35
|
}
|
|
30
36
|
catch (err) {
|
|
37
|
+
this.log.error(`Emitting register-venues failed`, err.stack);
|
|
31
38
|
await this.alert({
|
|
32
39
|
message: `We had trouble loading your venues. Please try again later. Error: ${err.message}`,
|
|
33
40
|
});
|
|
34
41
|
}
|
|
42
|
+
this.triggerRender();
|
|
35
43
|
}
|
|
36
44
|
populateList() {
|
|
37
45
|
this.venues.forEach((venue) => this.listVc.addRow(this.renderVenueRow(venue)));
|
|
@@ -97,7 +105,9 @@ class VenuesListViewController extends heartwood_view_controllers_1.AbstractView
|
|
|
97
105
|
this.onSelectHandler?.(venue);
|
|
98
106
|
}
|
|
99
107
|
render() {
|
|
100
|
-
return this.
|
|
108
|
+
return (this.venues.length === 0 && this.isLoaded
|
|
109
|
+
? null
|
|
110
|
+
: this.listVc.render());
|
|
101
111
|
}
|
|
102
112
|
}
|
|
103
113
|
VenuesListViewController.id = 'venues-list';
|