Skip to content

Commit bd77627

Browse files
new ticketsauce components: addressing reivew comments by Guilherm
1 parent 59b8e40 commit bd77627

File tree

7 files changed

+196
-107
lines changed

7 files changed

+196
-107
lines changed

components/ticketsauce/actions/get-event-details/get-event-details.mjs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export default {
1414
props: {
1515
ticketsauce,
1616
partnerId: {
17-
type: "string",
18-
label: "Partner ID",
19-
description: "Including this ID will limit the event selection to the specific partner.",
20-
optional: true,
17+
propDefinition: [
18+
ticketsauce,
19+
"partnerId",
20+
],
2121
},
2222
organizationId: {
23-
type: "string",
24-
label: "Organization ID",
25-
description: "Including this ID will limit the event selection to the specific organization.",
26-
optional: true,
23+
propDefinition: [
24+
ticketsauce,
25+
"organizationId",
26+
],
2727
},
2828
eventId: {
2929
propDefinition: [
@@ -47,20 +47,19 @@ export default {
4747
],
4848
},
4949
includePerformers: {
50-
type: "boolean",
51-
label: "Include Performers",
52-
description: "If true, returns any associated performers/artists with the event.",
53-
optional: true,
54-
default: false,
50+
propDefinition: [
51+
ticketsauce,
52+
"includePerformers",
53+
],
5554
},
5655
},
57-
async run() {
56+
async run({ $ }) {
5857
const params = {
59-
photos: this.photos,
60-
include_performers: this.includePerformers,
58+
photos: parseInt(this.photos) === 1,
59+
include_performers: parseInt(this.includePerformers) === 1,
6160
};
6261

63-
return this.ticketsauce.getEventDetails({
62+
return this.ticketsauce.getEventDetails($, {
6463
eventId: this.eventId,
6564
params,
6665
});

components/ticketsauce/actions/get-events/get-events.mjs

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export default {
1414
props: {
1515
ticketsauce,
1616
partnerId: {
17-
type: "string",
18-
label: "Partner ID",
19-
description: "Including this ID will limit the result set to the specific partner.",
20-
optional: true,
17+
propDefinition: [
18+
ticketsauce,
19+
"partnerId",
20+
],
2121
},
2222
organizationId: {
23-
type: "string",
24-
label: "Organization ID",
25-
description: "Including this ID will limit the result set to the specific organization.",
26-
optional: true,
23+
propDefinition: [
24+
ticketsauce,
25+
"organizationId",
26+
],
2727
},
2828
startAfter: {
2929
type: "string",
@@ -38,66 +38,94 @@ export default {
3838
optional: true,
3939
},
4040
activeOnly: {
41-
type: "boolean",
41+
type: "string",
4242
label: "Active Only",
4343
description: "Leaving this as true will restrict retrieved events to only 'active' events. Setting to false will allow the retrieval of both active and inactive events.",
4444
optional: true,
45-
default: true,
45+
default: "1",
46+
options: [
47+
"0",
48+
"1",
49+
],
4650
},
4751
privacyType: {
4852
type: "string",
4953
label: "Privacy Type",
50-
description: "By default, this will restrict events to only those that are public. Changing to 'all' will remove all restriction, or changing to 'unlisted' will make it only pull those events that are set to unlisted.",
54+
description: "Filter events by privacy type.",
5155
optional: true,
5256
default: "public",
5357
options: [
54-
"public",
55-
"all",
56-
"unlisted",
58+
{
59+
label: "Public events only",
60+
value: "public",
61+
},
62+
{
63+
label: "All events (no restriction)",
64+
value: "all",
65+
},
66+
{
67+
label: "Unlisted events only",
68+
value: "unlisted",
69+
},
5770
],
5871
},
5972
sortBy: {
6073
type: "string",
6174
label: "Sort By",
62-
description: "Which field to sort by. By default ('date'), will sort events by their start date. Other options are 'name' (event name) or 'city' (the city where the event is located).",
75+
description: "Field to sort events by.",
6376
optional: true,
6477
options: [
65-
"date",
66-
"name",
67-
"city",
78+
{
79+
label: "Event start date",
80+
value: "date",
81+
},
82+
{
83+
label: "Event name",
84+
value: "name",
85+
},
86+
{
87+
label: "City location",
88+
value: "city",
89+
},
6890
],
6991
},
7092
sortDir: {
7193
type: "string",
7294
label: "Sort Direction",
73-
description: "Which direction you'd like to sort - either ascending ('asc' - the default) or descending ('desc').",
95+
description: "Direction to sort results.",
7496
optional: true,
7597
options: [
76-
"asc",
77-
"desc",
98+
{
99+
label: "Ascending",
100+
value: "asc",
101+
},
102+
{
103+
label: "Descending",
104+
value: "desc",
105+
},
78106
],
79107
},
80108
includePerformers: {
81-
type: "boolean",
82-
label: "Include Performers",
83-
description: "Returns any associated performers/artists with an event",
84-
optional: true,
109+
propDefinition: [
110+
ticketsauce,
111+
"includePerformers",
112+
],
85113
},
86114
},
87-
async run() {
115+
async run({ $ }) {
88116
const params = {
89117
partner_id: this.partnerId,
90118
organization_id: this.organizationId,
91119
start_after: this.startAfter,
92120
end_before: this.endBefore,
93-
active_only: this.activeOnly,
121+
active_only: parseInt(this.activeOnly) === 1,
94122
privacy_type: this.privacyType,
95123
sort_by: this.sortBy,
96124
sort_dir: this.sortDir,
97-
include_performers: this.includePerformers,
125+
include_performers: parseInt(this.includePerformers) === 1,
98126
};
99127

100-
return this.ticketsauce.listEvents({
128+
return this.ticketsauce.listEvents($, {
101129
params,
102130
});
103131
},

components/ticketsauce/actions/get-order-details/get-order-details.mjs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export default {
1414
props: {
1515
ticketsauce,
1616
partnerId: {
17-
type: "string",
18-
label: "Partner ID",
19-
description: "Including this ID will limit the event selection to the specific partner.",
20-
optional: true,
17+
propDefinition: [
18+
ticketsauce,
19+
"partnerId",
20+
],
2121
},
2222
organizationId: {
23-
type: "string",
24-
label: "Organization ID",
25-
description: "Including this ID will limit the event selection to the specific organization.",
26-
optional: true,
23+
propDefinition: [
24+
ticketsauce,
25+
"organizationId",
26+
],
2727
},
2828
eventId: {
2929
propDefinition: [
@@ -45,8 +45,8 @@ export default {
4545
],
4646
},
4747
},
48-
async run() {
49-
return this.ticketsauce.getOrderDetails({
48+
async run({ $ }) {
49+
return this.ticketsauce.getOrderDetails($, {
5050
orderId: this.orderId,
5151
});
5252
},

components/ticketsauce/actions/get-orders/get-orders.mjs

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export default {
1414
props: {
1515
ticketsauce,
1616
partnerId: {
17-
type: "string",
18-
label: "Partner ID",
19-
description: "Including this ID will limit the event selection to the specific partner.",
20-
optional: true,
17+
propDefinition: [
18+
ticketsauce,
19+
"partnerId",
20+
],
2121
},
2222
organizationId: {
23-
type: "string",
24-
label: "Organization ID",
25-
description: "Including this ID will limit the event selection to the specific organization.",
26-
optional: true,
23+
propDefinition: [
24+
ticketsauce,
25+
"organizationId",
26+
],
2727
},
2828
eventId: {
2929
propDefinition: [
@@ -56,67 +56,94 @@ export default {
5656
optional: true,
5757
},
5858
returnQuestionnaires: {
59-
type: "boolean",
59+
type: "string",
6060
label: "Return Questionnaires",
6161
description: "Whether or not to return the question responses from questionnaires (will include attendee responses as well IF tickets are returned)",
6262
optional: true,
63+
default: "0",
64+
options: [
65+
"0",
66+
"1",
67+
],
6368
},
6469
returnTickets: {
65-
type: "boolean",
70+
type: "string",
6671
label: "Return Tickets",
6772
description: "Whether or not to return the tickets for each order as well.",
6873
optional: true,
74+
default: "0",
75+
options: [
76+
"0",
77+
"1",
78+
],
6979
},
7080
returnLineItemFees: {
71-
type: "boolean",
81+
type: "string",
7282
label: "Return Line Item Fees",
7383
description: "Whether or not to return the itemized line item fees for each order (if they exist).",
7484
optional: true,
85+
default: "0",
86+
options: [
87+
"0",
88+
"1",
89+
],
7590
},
7691
orderedAfter: {
7792
type: "string",
7893
label: "Ordered After",
79-
description: "Only retrieve orders that were ordered AFTER the specified date/time (format: YYYY-MM-DD or YYYY-MM-DD HH:MM:SS).",
94+
description: "Only retrieve orders that were ordered AFTER the specified date/time (format`: YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`).",
8095
optional: true,
8196
},
8297
orderedBefore: {
8398
type: "string",
8499
label: "Ordered Before",
85-
description: "Only retrieve orders that were ordered BEFORE the specified date/time (format: YYYY-MM-DD or YYYY-MM-DD HH:MM:SS).",
100+
description: "Only retrieve orders that were ordered BEFORE the specified date/time (format`: YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`).",
86101
optional: true,
87102
},
88103
modifiedAfter: {
89104
type: "string",
90105
label: "Modified After",
91-
description: "Only retrieve orders that were modified AFTER the specified date/time (format: YYYY-MM-DD or YYYY-MM-DD HH:MM:SS).",
106+
description: "Only retrieve orders that were modified AFTER the specified date/time (format`: YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`).",
92107
optional: true,
93108
},
94109
modifiedBefore: {
95110
type: "string",
96111
label: "Modified Before",
97-
description: "Only retrieve orders that were modified BEFORE the specified date/time (format: YYYY-MM-DD or YYYY-MM-DD HH:MM:SS).",
112+
description: "Only retrieve orders that were modified BEFORE the specified date/time (format`: YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`).",
98113
optional: true,
99114
},
100115
sortBy: {
101116
type: "string",
102117
label: "Sort By",
103-
description: "Which field to sort by. By default ('date'), this will sort orders by their ordered date. Or 'name' to order by last name.",
118+
description: "Field to sort orders by.",
104119
optional: true,
105120
default: "date",
106121
options: [
107-
"date",
108-
"name",
122+
{
123+
label: "Ordered date",
124+
value: "date",
125+
},
126+
{
127+
label: "Last name",
128+
value: "name",
129+
},
109130
],
110131
},
111132
sortDir: {
112133
type: "string",
113134
label: "Sort Direction",
114-
description: "Which direction you'd like to sort - either ascending ('asc' - the default) or descending ('desc').",
135+
description: "Direction to sort results.",
115136
optional: true,
116137
default: "asc",
117138
options: [
118-
"asc",
119-
"desc",
139+
{
140+
label: "Ascending",
141+
value: "asc",
142+
},
143+
{
144+
label: "Descending",
145+
value: "desc",
146+
},
120147
],
121148
},
122149
totalAbove: {
@@ -132,14 +159,14 @@ export default {
132159
optional: true,
133160
},
134161
},
135-
async run() {
162+
async run({ $ }) {
136163
const params = {
137164
per_page: this.perPage,
138165
page: this.page,
139166
q: this.q,
140-
return_questionnaires: this.returnQuestionnaires,
141-
return_tickets: this.returnTickets,
142-
return_line_item_fees: this.returnLineItemFees,
167+
return_questionnaires: parseInt(this.returnQuestionnaires) === 1,
168+
return_tickets: parseInt(this.returnTickets) === 1,
169+
return_line_item_fees: parseInt(this.returnLineItemFees) === 1,
143170
ordered_after: this.orderedAfter,
144171
ordered_before: this.orderedBefore,
145172
modified_after: this.modifiedAfter,
@@ -150,7 +177,7 @@ export default {
150177
total_below: this.totalBelow,
151178
};
152179

153-
return this.ticketsauce.listOrders({
180+
return this.ticketsauce.listOrders($, {
154181
eventId: this.eventId,
155182
params,
156183
});

0 commit comments

Comments
 (0)