Skip to content

Commit 628008e

Browse files
Update Returnista component with new actions and sources, version bum… (#20602)
* Update Returnista component with new actions and sources, version bump to 0.1.0 - Bumped version from 0.0.1 to 0.1.0 in package.json. - Added new actions for creating, retrieving, and updating return locations, as well as fetching consumer purchases, draft return orders, return orders, return order emails, return reasons, and return requests. - Introduced new sources for new return order and shipment label events. - Enhanced prop definitions in returnista.app.mjs for better integration and usability. - Added constants for country codes to support return location management. * pnpm update * Refactor Returnista component for clarity and consistency - Updated descriptions in returnista.app.mjs for better clarity. - Renamed method getReturnOrdersEmails to getReturnOrderEmails for consistency. - Enhanced metadata generation in various sources by including timestamps in IDs. - Added a check in base.mjs to prevent deactivation if no hook ID is present. * Add Get Return Order Emails action to Returnista component - Introduced a new action to retrieve emails related to return orders. - Enhanced prop definitions for account ID and return order ID. - Included documentation link for reference. - Added summary export for successful email retrieval. * Fix description typo in Get Return Order Emails action for clarity * fix doc link --------- Co-authored-by: Michelle Bergeron <michelle.bergeron@gmail.com>
1 parent 5078c33 commit 628008e

28 files changed

Lines changed: 3323 additions & 7 deletions

File tree

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import returnista from "../../returnista.app.mjs";
2+
3+
export default {
4+
key: "returnista-create-return-location",
5+
name: "Create Return Location",
6+
description: "Creates a new return location for the given account. [See the documentation](https://platform.returnista.com/reference/rest-api/#post-/account/-accountId/return-location)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
returnista,
16+
accountId: {
17+
propDefinition: [
18+
returnista,
19+
"accountId",
20+
],
21+
},
22+
name: {
23+
propDefinition: [
24+
returnista,
25+
"name",
26+
],
27+
},
28+
street: {
29+
propDefinition: [
30+
returnista,
31+
"street",
32+
],
33+
},
34+
houseNumber: {
35+
propDefinition: [
36+
returnista,
37+
"houseNumber",
38+
],
39+
},
40+
suffix: {
41+
propDefinition: [
42+
returnista,
43+
"suffix",
44+
],
45+
optional: true,
46+
},
47+
city: {
48+
propDefinition: [
49+
returnista,
50+
"city",
51+
],
52+
},
53+
postalCode: {
54+
propDefinition: [
55+
returnista,
56+
"postalCode",
57+
],
58+
},
59+
countryCode: {
60+
propDefinition: [
61+
returnista,
62+
"countryCode",
63+
],
64+
},
65+
stateProvinceCode: {
66+
propDefinition: [
67+
returnista,
68+
"stateProvinceCode",
69+
],
70+
optional: true,
71+
},
72+
companyName: {
73+
propDefinition: [
74+
returnista,
75+
"companyName",
76+
],
77+
},
78+
attention: {
79+
propDefinition: [
80+
returnista,
81+
"attention",
82+
],
83+
optional: true,
84+
},
85+
phoneNumber: {
86+
propDefinition: [
87+
returnista,
88+
"phoneNumber",
89+
],
90+
},
91+
contactName: {
92+
propDefinition: [
93+
returnista,
94+
"contactName",
95+
],
96+
optional: true,
97+
},
98+
},
99+
async run({ $ }) {
100+
const response = await this.returnista.createReturnLocation({
101+
$,
102+
accountId: this.accountId,
103+
data: {
104+
name: this.name,
105+
returnAddress: {
106+
street: this.street,
107+
houseNumber: this.houseNumber,
108+
suffix: this.suffix,
109+
city: this.city,
110+
postalCode: this.postalCode,
111+
countryCode: this.countryCode,
112+
stateProvinceCode: this.stateProvinceCode,
113+
},
114+
companyName: this.companyName,
115+
attention: this.attention,
116+
phoneNumber: this.phoneNumber,
117+
contactName: this.contactName,
118+
},
119+
});
120+
$.export("$summary", `Successfully created return location with ID: ${response.id}`);
121+
return response;
122+
},
123+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import returnista from "../../returnista.app.mjs";
2+
3+
export default {
4+
key: "returnista-get-consumer-purchases",
5+
name: "Get Consumer Purchases",
6+
description: "Get consumer purchases. [See the documentation](https://platform.returnista.com/reference/rest-api/#get-/consumer/-consumerId/purchases)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
returnista,
16+
consumerId: {
17+
propDefinition: [
18+
returnista,
19+
"consumerId",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const { data: response } = await this.returnista.getConsumerPurchases({
25+
$,
26+
consumerId: this.consumerId,
27+
});
28+
$.export("$summary", `Successfully retrieved ${response.length} consumer purchases`);
29+
return response;
30+
},
31+
};
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import returnista from "../../returnista.app.mjs";
2+
import getReturnOrders from "../get-return-orders/get-return-orders.mjs";
3+
4+
export default {
5+
...getReturnOrders,
6+
key: "returnista-get-draft-return-orders",
7+
name: "Get Draft Return Orders",
8+
description: "Gets a list of draft return orders for the given account. [See the documentation](https://platform.returnista.com/reference/rest-api/#get-/account/-accountId-/draft-return-orders)",
9+
version: "0.0.1",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: true,
14+
},
15+
type: "action",
16+
props: {
17+
returnista,
18+
accountId: {
19+
propDefinition: [
20+
returnista,
21+
"accountId",
22+
],
23+
},
24+
limit: {
25+
propDefinition: [
26+
returnista,
27+
"limit",
28+
],
29+
},
30+
page: {
31+
propDefinition: [
32+
returnista,
33+
"page",
34+
],
35+
},
36+
filter: {
37+
propDefinition: [
38+
returnista,
39+
"filter",
40+
],
41+
},
42+
search: {
43+
propDefinition: [
44+
returnista,
45+
"search",
46+
],
47+
},
48+
sortBy: {
49+
propDefinition: [
50+
returnista,
51+
"sortBy",
52+
],
53+
},
54+
orderBy: {
55+
propDefinition: [
56+
returnista,
57+
"orderBy",
58+
],
59+
},
60+
},
61+
async run({ $ }) {
62+
const { data: response } = await this.returnista.getDraftReturnOrders({
63+
$,
64+
accountId: this.accountId,
65+
params: {
66+
limit: this.limit,
67+
page: this.page,
68+
filter: this.filter,
69+
search: this.search,
70+
sortBy: this.sortBy,
71+
orderBy: this.orderBy,
72+
},
73+
});
74+
$.export("$summary", `Successfully retrieved ${response.length} draft return orders`);
75+
return response;
76+
},
77+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import returnista from "../../returnista.app.mjs";
2+
3+
export default {
4+
key: "returnista-get-return-locations",
5+
name: "Get Return Locations",
6+
description: "Gets a list of return locations for the given account. [See the documentation](https://platform.returnista.com/reference/rest-api/#get-/account/-accountId/return-locations)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
returnista,
16+
accountId: {
17+
propDefinition: [
18+
returnista,
19+
"accountId",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const { data: response } = await this.returnista.getReturnLocations({
25+
$,
26+
accountId: this.accountId,
27+
});
28+
$.export("$summary", `Successfully retrieved ${response.length} return location(s)`);
29+
return response;
30+
},
31+
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import returnista from "../../returnista.app.mjs";
2+
3+
export default {
4+
key: "returnista-get-return-order-emails",
5+
name: "Get Return Order Emails",
6+
description: "Returns emails related to a return order. [See the documentation](https://platform.returnista.com/reference/rest-api/#get-/account/-accountId/return-orders/emails)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
returnista,
16+
accountId: {
17+
propDefinition: [
18+
returnista,
19+
"accountId",
20+
],
21+
},
22+
returnOrderId: {
23+
propDefinition: [
24+
returnista,
25+
"returnOrderId",
26+
({ accountId }) => ({
27+
accountId,
28+
}),
29+
],
30+
},
31+
},
32+
async run({ $ }) {
33+
const { data: response } = await this.returnista.getReturnOrderEmails({
34+
$,
35+
accountId: this.accountId,
36+
returnOrderId: this.returnOrderId,
37+
});
38+
39+
$.export("$summary", `Successfully retrieved ${response.length} return order emails`);
40+
return response;
41+
},
42+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import returnista from "../../returnista.app.mjs";
2+
3+
export default {
4+
key: "returnista-get-return-order",
5+
name: "Get Return Order",
6+
description: "Gets a return order by ID. [See the documentation](https://platform.returnista.com/reference/rest-api/#get-/account/-accountId/return-order/-id)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
returnista,
16+
accountId: {
17+
propDefinition: [
18+
returnista,
19+
"accountId",
20+
],
21+
},
22+
returnOrderId: {
23+
propDefinition: [
24+
returnista,
25+
"returnOrderId",
26+
({ accountId }) => ({
27+
accountId,
28+
}),
29+
],
30+
},
31+
},
32+
async run({ $ }) {
33+
const response = await this.returnista.getReturnOrder({
34+
$,
35+
accountId: this.accountId,
36+
returnOrderId: this.returnOrderId,
37+
});
38+
$.export("$summary", `Successfully retrieved return order ${this.returnOrderId}`);
39+
return response;
40+
},
41+
};

0 commit comments

Comments
 (0)