Skip to content

Commit 7f7c939

Browse files
committed
[Components] Xola - new components
1 parent 54291be commit 7f7c939

File tree

25 files changed

+1551
-7
lines changed

25 files changed

+1551
-7
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import app from "../../xola.app.mjs";
2+
3+
export default {
4+
key: "xola-add-event-guide",
5+
name: "Add Event Guide",
6+
description: "Adds a guide to an event. [See the documentation](https://xola.github.io/xola-docs/#tag/events/operation/addEventGuide)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: true,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
sellerId: {
17+
propDefinition: [
18+
app,
19+
"sellerId",
20+
],
21+
async options() {
22+
const {
23+
id: value,
24+
name: label,
25+
} = await this.getUser();
26+
return [
27+
{
28+
label,
29+
value,
30+
},
31+
];
32+
},
33+
},
34+
eventId: {
35+
propDefinition: [
36+
app,
37+
"eventId",
38+
({ sellerId }) => ({
39+
sellerId,
40+
}),
41+
],
42+
},
43+
guideId: {
44+
propDefinition: [
45+
app,
46+
"guideId",
47+
({ sellerId }) => ({
48+
sellerId,
49+
}),
50+
],
51+
},
52+
forceConfirm: {
53+
type: "boolean",
54+
label: "Force Confirm",
55+
description: "Force assignment even if guide has conflicts",
56+
optional: true,
57+
},
58+
},
59+
async run({ $ }) {
60+
const {
61+
app,
62+
eventId,
63+
guideId,
64+
forceConfirm,
65+
} = this;
66+
67+
const response = await app.addEventGuide({
68+
$,
69+
eventId,
70+
data: {
71+
guide: {
72+
id: guideId,
73+
forceConfirm,
74+
},
75+
},
76+
});
77+
78+
$.export("$summary", "Successfully added guide to event");
79+
return response;
80+
},
81+
};
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import app from "../../xola.app.mjs";
2+
3+
export default {
4+
key: "xola-create-experience-schedule",
5+
name: "Create Experience Schedule",
6+
description: "Creates a new schedule for an experience. [See the documentation](https://xola.github.io/xola-docs/#tag/schedules/operation/createExperienceSchedule)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
sellerId: {
17+
propDefinition: [
18+
app,
19+
"sellerId",
20+
],
21+
async options() {
22+
const {
23+
id: value,
24+
name: label,
25+
} = await this.getUser();
26+
return [
27+
{
28+
label,
29+
value,
30+
},
31+
];
32+
},
33+
},
34+
experienceId: {
35+
propDefinition: [
36+
app,
37+
"experienceId",
38+
({ sellerId }) => ({
39+
sellerId,
40+
}),
41+
],
42+
},
43+
name: {
44+
propDefinition: [
45+
app,
46+
"name",
47+
],
48+
},
49+
type: {
50+
propDefinition: [
51+
app,
52+
"type",
53+
],
54+
},
55+
days: {
56+
propDefinition: [
57+
app,
58+
"days",
59+
],
60+
},
61+
departure: {
62+
propDefinition: [
63+
app,
64+
"departure",
65+
],
66+
},
67+
times: {
68+
propDefinition: [
69+
app,
70+
"times",
71+
],
72+
},
73+
priceDelta: {
74+
propDefinition: [
75+
app,
76+
"priceDelta",
77+
],
78+
},
79+
repeat: {
80+
propDefinition: [
81+
app,
82+
"repeat",
83+
],
84+
},
85+
start: {
86+
propDefinition: [
87+
app,
88+
"start",
89+
],
90+
},
91+
end: {
92+
propDefinition: [
93+
app,
94+
"end",
95+
],
96+
},
97+
dates: {
98+
propDefinition: [
99+
app,
100+
"dates",
101+
],
102+
},
103+
},
104+
async run({ $ }) {
105+
const {
106+
app,
107+
experienceId,
108+
name,
109+
type,
110+
days,
111+
times,
112+
departure,
113+
priceDelta,
114+
repeat,
115+
start,
116+
end,
117+
dates,
118+
} = this;
119+
120+
const response = await app.createExperienceSchedule({
121+
$,
122+
experienceId,
123+
data: {
124+
start,
125+
end,
126+
dates,
127+
type,
128+
name,
129+
repeat,
130+
days,
131+
times,
132+
departure,
133+
priceDelta,
134+
},
135+
});
136+
137+
$.export("$summary", `Successfully created schedule for experience with ID \`${response.id}\``);
138+
return response;
139+
},
140+
};
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import app from "../../xola.app.mjs";
2+
3+
export default {
4+
key: "xola-delete-experience-schedule",
5+
name: "Delete Experience Schedule",
6+
description: "Deletes a schedule from an experience. [See the documentation](https://xola.github.io/xola-docs/#tag/schedules/operation/deleteExperienceSchedule)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: true,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
sellerId: {
17+
propDefinition: [
18+
app,
19+
"sellerId",
20+
],
21+
async options() {
22+
const {
23+
id: value,
24+
name: label,
25+
} = await this.getUser();
26+
return [
27+
{
28+
label,
29+
value,
30+
},
31+
];
32+
},
33+
},
34+
experienceId: {
35+
propDefinition: [
36+
app,
37+
"experienceId",
38+
({ sellerId }) => ({
39+
sellerId,
40+
}),
41+
],
42+
},
43+
scheduleId: {
44+
propDefinition: [
45+
app,
46+
"scheduleId",
47+
({ experienceId }) => ({
48+
experienceId,
49+
}),
50+
],
51+
},
52+
},
53+
async run({ $ }) {
54+
const {
55+
app,
56+
experienceId,
57+
scheduleId,
58+
} = this;
59+
60+
await app.deleteExperienceSchedule({
61+
$,
62+
experienceId,
63+
scheduleId,
64+
});
65+
66+
$.export("$summary", "Successfully deleted schedule");
67+
return {
68+
success: true,
69+
};
70+
},
71+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import app from "../../xola.app.mjs";
2+
3+
export default {
4+
key: "xola-patch-event",
5+
name: "Patch Event",
6+
description: "Partially update an event's properties. [See the documentation](https://xola.github.io/xola-docs/#tag/events/operation/patchEvent)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: true,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
app,
16+
sellerId: {
17+
propDefinition: [
18+
app,
19+
"sellerId",
20+
],
21+
async options() {
22+
const {
23+
id: value,
24+
name: label,
25+
} = await this.getUser();
26+
return [
27+
{
28+
label,
29+
value,
30+
},
31+
];
32+
},
33+
},
34+
eventId: {
35+
propDefinition: [
36+
app,
37+
"eventId",
38+
({ sellerId }) => ({
39+
sellerId,
40+
}),
41+
],
42+
},
43+
max: {
44+
type: "integer",
45+
label: "Max",
46+
description: "Maximum capacity override",
47+
min: 0,
48+
},
49+
manual: {
50+
type: "boolean",
51+
label: "Manual",
52+
description: "Flag to reopen a closed event as manual",
53+
optional: true,
54+
},
55+
},
56+
async run({ $ }) {
57+
const {
58+
app,
59+
eventId,
60+
max,
61+
manual,
62+
} = this;
63+
64+
const response = await app.patchEvent({
65+
$,
66+
eventId,
67+
data: {
68+
max,
69+
manual,
70+
},
71+
});
72+
73+
$.export("$summary", "Successfully patched event");
74+
return response;
75+
},
76+
};

0 commit comments

Comments
 (0)