-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] Xola - new components #18788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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, | ||
}, | ||
]; | ||
}, | ||
}, | ||
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, | ||
}, | ||
}, | ||
}); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$.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(); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seller ID options likely returning a User ID instead of Seller ID. Same issue as in the update action: sellerId: {
propDefinition: [
app,
"sellerId",
],
- async options() {
- const {
- id: value,
- name: label,
- } = await this.getUser();
- return [
- {
- label,
- value,
- },
- ];
- },
}, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||
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, | ||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||
}; |
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, | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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; | ||
}, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.📝 Committable suggestion
🤖 Prompt for AI Agents