Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions components/xola/actions/add-event-guide/add-event-guide.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import app from "../../xola.app.mjs";

export default {
key: "xola-add-event-guide",
name: "Add Event Guide",
description: "Adds a guide to an event. [See the documentation](https://xola.github.io/xola-docs/#tag/events/operation/addEventGuide)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
props: {
app,
sellerId: {
propDefinition: [
app,
"sellerId",
],
async options() {
const {
id: value,
name: label,
} = await this.getUser();
return [
{
label,
value,
},
];
},
Comment on lines +21 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Seller ID options likely returning a User ID instead of Seller ID.

Same pattern: this.getUser() returns the user, not the seller. Remove this override or map to the seller’s ID.

     sellerId: {
       propDefinition: [
         app,
         "sellerId",
       ],
-      async options() {
-        const {
-          id: value,
-          name: label,
-        } = await this.getUser();
-        return [
-          {
-            label,
-            value,
-          },
-        ];
-      },
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async options() {
const {
id: value,
name: label,
} = await this.getUser();
return [
{
label,
value,
},
];
},
sellerId: {
propDefinition: [
app,
"sellerId",
],
},
🤖 Prompt for AI Agents
In components/xola/actions/add-event-guide/add-event-guide.mjs around lines 21
to 32, the options() override is calling this.getUser() which returns a User
object, so the returned value is a User ID rather than the Seller ID; change the
call to retrieve the seller (e.g., call this.getSeller() and destructure its id
and name) or, if only getUser() is available, map to the seller id via
user.seller.id and seller name for label, then return that seller id/value
instead of the user id. Ensure the label/value reflect the seller (not the user)
and remove the override if it’s unnecessary.

},
eventId: {
propDefinition: [
app,
"eventId",
({ sellerId }) => ({
sellerId,
}),
],
},
guideId: {
propDefinition: [
app,
"guideId",
({ sellerId }) => ({
sellerId,
}),
],
},
forceConfirm: {
type: "boolean",
label: "Force Confirm",
description: "Force assignment even if guide has conflicts",
optional: true,
},
},
async run({ $ }) {
const {
app,
eventId,
guideId,
forceConfirm,
} = this;

const response = await app.addEventGuide({
$,
eventId,
data: {
guide: {
id: guideId,
forceConfirm,
},
},
});

$.export("$summary", "Successfully added guide to event");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import app from "../../xola.app.mjs";

export default {
key: "xola-create-experience-schedule",
name: "Create Experience Schedule",
description: "Creates a new schedule for an experience. [See the documentation](https://xola.github.io/xola-docs/#tag/schedules/operation/createExperienceSchedule)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
props: {
app,
sellerId: {
propDefinition: [
app,
"sellerId",
],
async options() {
const {
id: value,
name: label,
} = await this.getUser();
return [
{
label,
value,
},
];
},
},
experienceId: {
propDefinition: [
app,
"experienceId",
({ sellerId }) => ({
sellerId,
}),
],
},
name: {
propDefinition: [
app,
"name",
],
},
type: {
propDefinition: [
app,
"type",
],
},
days: {
propDefinition: [
app,
"days",
],
},
departure: {
propDefinition: [
app,
"departure",
],
},
times: {
propDefinition: [
app,
"times",
],
},
priceDelta: {
propDefinition: [
app,
"priceDelta",
],
},
repeat: {
propDefinition: [
app,
"repeat",
],
},
start: {
propDefinition: [
app,
"start",
],
},
end: {
propDefinition: [
app,
"end",
],
},
dates: {
propDefinition: [
app,
"dates",
],
},
},
async run({ $ }) {
const {
app,
experienceId,
name,
type,
days,
times,
departure,
priceDelta,
repeat,
start,
end,
dates,
} = this;

const response = await app.createExperienceSchedule({
$,
experienceId,
data: {
start,
end,
dates,
type,
name,
repeat,
days,
times,
departure,
priceDelta,
},
});

$.export("$summary", `Successfully created schedule for experience with ID \`${response.id}\``);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import app from "../../xola.app.mjs";

export default {
key: "xola-delete-experience-schedule",
name: "Delete Experience Schedule",
description: "Deletes a schedule from an experience. [See the documentation](https://xola.github.io/xola-docs/#tag/schedules/operation/deleteExperienceSchedule)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
props: {
app,
sellerId: {
propDefinition: [
app,
"sellerId",
],
async options() {
const {
id: value,
name: label,
} = await this.getUser();
return [
{
label,
value,
},
];
},
Comment on lines +21 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Seller ID options likely returning a User ID instead of Seller ID.

Same issue as in the update action: this.getUser() returns a user, not a seller. This will mis-populate sellerId and break downstream filters. Remove the override or resolve seller.id.

     sellerId: {
       propDefinition: [
         app,
         "sellerId",
       ],
-      async options() {
-        const {
-          id: value,
-          name: label,
-        } = await this.getUser();
-        return [
-          {
-            label,
-            value,
-          },
-        ];
-      },
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async options() {
const {
id: value,
name: label,
} = await this.getUser();
return [
{
label,
value,
},
];
},
sellerId: {
propDefinition: [
app,
"sellerId",
],
},
🤖 Prompt for AI Agents
In
components/xola/actions/delete-experience-schedule/delete-experience-schedule.mjs
around lines 21 to 32, the options() override is using this.getUser() which
returns a user object so the returned value is a User ID instead of the Seller
ID expected by downstream filters; update the implementation to return the
seller's id (e.g., obtain the seller object or seller.id from the authenticated
user) or remove this override so the original seller-based options logic is
used, ensuring the returned value is seller.id and the label remains the seller
name.

},
experienceId: {
propDefinition: [
app,
"experienceId",
({ sellerId }) => ({
sellerId,
}),
],
},
scheduleId: {
propDefinition: [
app,
"scheduleId",
({ experienceId }) => ({
experienceId,
}),
],
},
},
async run({ $ }) {
const {
app,
experienceId,
scheduleId,
} = this;

await app.deleteExperienceSchedule({
$,
experienceId,
scheduleId,
});

$.export("$summary", "Successfully deleted schedule");
return {
success: true,
};
},
};
76 changes: 76 additions & 0 deletions components/xola/actions/patch-event/patch-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import app from "../../xola.app.mjs";

export default {
key: "xola-patch-event",
name: "Patch Event",
description: "Partially update an event's properties. [See the documentation](https://xola.github.io/xola-docs/#tag/events/operation/patchEvent)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
props: {
app,
sellerId: {
propDefinition: [
app,
"sellerId",
],
async options() {
const {
id: value,
name: label,
} = await this.getUser();
return [
{
label,
value,
},
];
},
},
eventId: {
propDefinition: [
app,
"eventId",
({ sellerId }) => ({
sellerId,
}),
],
},
max: {
type: "integer",
label: "Max",
description: "Maximum capacity override",
min: 0,
},
manual: {
type: "boolean",
label: "Manual",
description: "Flag to reopen a closed event as manual",
optional: true,
},
},
async run({ $ }) {
const {
app,
eventId,
max,
manual,
} = this;

const response = await app.patchEvent({
$,
eventId,
data: {
max,
manual,
},
});

$.export("$summary", "Successfully patched event");
return response;
},
};
Loading
Loading