Skip to content

Commit 954ce27

Browse files
committed
[Components] Xola - new components
1 parent 9ffd7bf commit 954ce27

File tree

25 files changed

+1491
-8
lines changed

25 files changed

+1491
-8
lines changed
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-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+
label: "Seller ID",
18+
description: "The unique identifier of the seller",
19+
propDefinition: [
20+
app,
21+
"userId",
22+
],
23+
},
24+
eventId: {
25+
propDefinition: [
26+
app,
27+
"eventId",
28+
({ sellerId }) => ({
29+
sellerId,
30+
}),
31+
],
32+
},
33+
guideId: {
34+
propDefinition: [
35+
app,
36+
"guideId",
37+
({ sellerId }) => ({
38+
sellerId,
39+
}),
40+
],
41+
},
42+
forceConfirm: {
43+
type: "boolean",
44+
label: "Force Confirm",
45+
description: "Force assignment even if guide has conflicts",
46+
optional: true,
47+
},
48+
},
49+
async run({ $ }) {
50+
const {
51+
app,
52+
eventId,
53+
guideId,
54+
forceConfirm,
55+
} = this;
56+
57+
const response = await app.addEventGuide({
58+
$,
59+
eventId,
60+
data: {
61+
guide: {
62+
id: guideId,
63+
forceConfirm,
64+
},
65+
},
66+
});
67+
68+
$.export("$summary", "Successfully added guide to event");
69+
return response;
70+
},
71+
};
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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+
label: "Seller ID",
18+
description: "The unique identifier of the seller",
19+
propDefinition: [
20+
app,
21+
"userId",
22+
],
23+
},
24+
experienceId: {
25+
propDefinition: [
26+
app,
27+
"experienceId",
28+
({ sellerId }) => ({
29+
sellerId,
30+
}),
31+
],
32+
},
33+
name: {
34+
propDefinition: [
35+
app,
36+
"name",
37+
],
38+
},
39+
type: {
40+
propDefinition: [
41+
app,
42+
"type",
43+
],
44+
},
45+
days: {
46+
propDefinition: [
47+
app,
48+
"days",
49+
],
50+
},
51+
departure: {
52+
propDefinition: [
53+
app,
54+
"departure",
55+
],
56+
},
57+
times: {
58+
propDefinition: [
59+
app,
60+
"times",
61+
],
62+
},
63+
priceDelta: {
64+
propDefinition: [
65+
app,
66+
"priceDelta",
67+
],
68+
},
69+
repeat: {
70+
propDefinition: [
71+
app,
72+
"repeat",
73+
],
74+
},
75+
start: {
76+
propDefinition: [
77+
app,
78+
"start",
79+
],
80+
},
81+
end: {
82+
propDefinition: [
83+
app,
84+
"end",
85+
],
86+
},
87+
dates: {
88+
propDefinition: [
89+
app,
90+
"dates",
91+
],
92+
},
93+
},
94+
async run({ $ }) {
95+
const {
96+
app,
97+
experienceId,
98+
name,
99+
type,
100+
days,
101+
times,
102+
departure,
103+
priceDelta,
104+
repeat,
105+
start,
106+
end,
107+
dates,
108+
} = this;
109+
110+
const response = await app.createExperienceSchedule({
111+
$,
112+
experienceId,
113+
data: {
114+
start,
115+
end,
116+
dates,
117+
type,
118+
name,
119+
repeat,
120+
days,
121+
times,
122+
departure,
123+
priceDelta,
124+
},
125+
});
126+
127+
$.export("$summary", `Successfully created schedule for experience with ID \`${response.id}\``);
128+
return response;
129+
},
130+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
label: "Seller ID",
18+
description: "The unique identifier of the seller",
19+
propDefinition: [
20+
app,
21+
"userId",
22+
],
23+
},
24+
experienceId: {
25+
propDefinition: [
26+
app,
27+
"experienceId",
28+
({ sellerId }) => ({
29+
sellerId,
30+
}),
31+
],
32+
},
33+
scheduleId: {
34+
propDefinition: [
35+
app,
36+
"scheduleId",
37+
({ experienceId }) => ({
38+
experienceId,
39+
}),
40+
],
41+
},
42+
},
43+
async run({ $ }) {
44+
const {
45+
app,
46+
experienceId,
47+
scheduleId,
48+
} = this;
49+
50+
await app.deleteExperienceSchedule({
51+
$,
52+
experienceId,
53+
scheduleId,
54+
});
55+
56+
$.export("$summary", "Successfully deleted schedule");
57+
return {
58+
success: true,
59+
};
60+
},
61+
};
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
label: "Seller ID",
18+
description: "The unique identifier of the seller",
19+
propDefinition: [
20+
app,
21+
"userId",
22+
],
23+
},
24+
eventId: {
25+
propDefinition: [
26+
app,
27+
"eventId",
28+
({ sellerId }) => ({
29+
sellerId,
30+
}),
31+
],
32+
},
33+
max: {
34+
type: "integer",
35+
label: "Max",
36+
description: "Maximum capacity override",
37+
min: 0,
38+
},
39+
manual: {
40+
type: "boolean",
41+
label: "Manual",
42+
description: "Flag to reopen a closed event as manual",
43+
optional: true,
44+
},
45+
},
46+
async run({ $ }) {
47+
const {
48+
app,
49+
eventId,
50+
max,
51+
manual,
52+
} = this;
53+
54+
const response = await app.patchEvent({
55+
$,
56+
eventId,
57+
data: {
58+
max,
59+
manual,
60+
},
61+
});
62+
63+
$.export("$summary", "Successfully patched event");
64+
return response;
65+
},
66+
};
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import app from "../../xola.app.mjs";
2+
3+
export default {
4+
key: "xola-remove-event-guide",
5+
name: "Remove Event Guide",
6+
description: "Removes a guide from an event. [See the documentation](https://xola.github.io/xola-docs/#tag/events/operation/removeEventGuide)",
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+
label: "Seller ID",
18+
description: "The unique identifier of the seller",
19+
propDefinition: [
20+
app,
21+
"userId",
22+
],
23+
},
24+
eventId: {
25+
propDefinition: [
26+
app,
27+
"eventId",
28+
({ sellerId }) => ({
29+
sellerId,
30+
}),
31+
],
32+
},
33+
guideId: {
34+
propDefinition: [
35+
app,
36+
"guideId",
37+
({ sellerId }) => ({
38+
sellerId,
39+
}),
40+
],
41+
},
42+
},
43+
async run({ $ }) {
44+
const {
45+
app,
46+
eventId,
47+
guideId,
48+
} = this;
49+
50+
const response = await app.removeEventGuide({
51+
$,
52+
eventId,
53+
guideId,
54+
});
55+
56+
$.export("$summary", "Successfully removed guide from event");
57+
return response;
58+
},
59+
};

0 commit comments

Comments
 (0)