-
Notifications
You must be signed in to change notification settings - Fork 5.5k
17945 trusted shops #18417
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
Merged
Merged
17945 trusted shops #18417
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d1e79e9
Add eTrusted actions and utilities
luancazarine 45e508e
pnpm update
luancazarine f23c367
Merge branch 'master' into 17945-trusted-shops
luancazarine a33a020
Refactor eTrusted module structure
luancazarine d622095
Refactor parameter handling in eTrusted review actions
luancazarine 9371fca
Merge branch 'master' into 17945-trusted-shops
luancazarine 4200922
pnpm update
luancazarine 25dbc6b
Update parseObject function to return an empty array for undefined input
luancazarine cd92ad5
Remove optional flag from Veto Reporter Email and add error handling …
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
components/etrusted/actions/create-veto-for-review/create-veto-for-review.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import etrusted from "../../etrusted.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "etrusted-create-veto-for-review", | ||
| name: "Create A Veto For A Review", | ||
| description: "Creates a veto for a specific review. [See the documentation](https://developers.etrusted.com/reference/createveto)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| etrusted, | ||
| reviewId: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "reviewId", | ||
| ], | ||
| }, | ||
| comment: { | ||
| type: "string", | ||
| label: "Comment", | ||
| description: "The veto comment. Provide additional information on the review or your veto here.", | ||
| }, | ||
| reason: { | ||
| type: "string", | ||
| label: "Reason", | ||
| description: "The reason for the veto.", | ||
| options: [ | ||
| "UNTRUTHFUL", | ||
| "ABUSIVE", | ||
| "VIOLATES_THE_TERMS_OF_USE", | ||
| "INAPPROPRIATE_IMAGE", | ||
| ], | ||
| }, | ||
| vetoReporterEmail: { | ||
| type: "string", | ||
| label: "Veto Reporter Email", | ||
| description: "The E-Mail address of the veto reporter.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.etrusted.createVetoForReview({ | ||
| $, | ||
| reviewId: this.reviewId, | ||
| data: { | ||
| comment: this.comment, | ||
| reason: this.reason, | ||
| vetoReporterEmail: this.vetoReporterEmail, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created veto with ID ${response.id} for review ${this.reviewId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
27 changes: 27 additions & 0 deletions
27
components/etrusted/actions/delete-review-reply/delete-review-reply.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import etrusted from "../../etrusted.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "etrusted-delete-review-reply", | ||
| name: "Delete Review Reply", | ||
| description: "Reply to a review. [See the documentation](https://developers.etrusted.com/reference/deletereviewreply)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| etrusted, | ||
| reviewId: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "reviewId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.etrusted.deleteReviewReply({ | ||
| $, | ||
| reviewId: this.reviewId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully deleted review reply for review ${this.reviewId}`); | ||
| return response; | ||
| }, | ||
| }; |
149 changes: 149 additions & 0 deletions
149
...s/get-list-of-reviews-with-fewer-properties/get-list-of-reviews-with-fewer-properties.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import etrusted from "../../etrusted.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "etrusted-get-list-of-reviews-with-fewer-properties", | ||
| name: "Get List of Reviews with Fewer Properties", | ||
| description: "Retrieves a list of reviews with fewer properties. [See the documentation](https://developers.etrusted.com/reference/getminimalreviews)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| etrusted, | ||
| channelId: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "channelId", | ||
| ], | ||
| type: "string[]", | ||
| optional: true, | ||
| }, | ||
| after: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "reviewId", | ||
| ], | ||
| label: "After", | ||
| description: "`After` is a review ID. The list of reviews in the response will only contain reviews submitted earlier than the review with this ID.", | ||
| optional: true, | ||
| }, | ||
| before: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "reviewId", | ||
| ], | ||
| label: "Before", | ||
| description: "`Before` is a review ID. The list of reviews in the response will only contain reviews submitted later than the review with this ID.", | ||
| optional: true, | ||
| }, | ||
| submittedAfter: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "submittedAfter", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| submittedBefore: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "submittedBefore", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| rating: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "rating", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "status", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "type", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| hasReply: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "hasReply", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| ignoreStatements: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "ignoreStatements", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| query: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "query", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| sku: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "sku", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| orderBy: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "orderBy", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "maxResults", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.etrusted.paginate({ | ||
| $, | ||
| fn: this.etrusted.getListOfReviewsWithFewerProperties, | ||
| params: { | ||
| channels: this.channelId && parseObject(this.channelId).join(","), | ||
| after: this.after, | ||
| before: this.before, | ||
| submittedAfter: this.submittedAfter, | ||
| submittedBefore: this.submittedBefore, | ||
| rating: this.rating && parseObject(this.rating).join(","), | ||
| status: this.status && parseObject(this.status).join(","), | ||
| type: this.type && parseObject(this.type).join(","), | ||
| hasReply: this.hasReply, | ||
| ignoreStatements: this.ignoreStatements, | ||
| query: this.query, | ||
| sku: this.sku, | ||
| orderBy: this.orderBy, | ||
| maxResults: this.maxResults, | ||
| }, | ||
| maxResults: this.maxResults, | ||
| }); | ||
|
|
||
| const reviews = []; | ||
| for await (const review of response) { | ||
| reviews.push(review); | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${reviews.length} review${reviews.length === 1 | ||
| ? "" | ||
| : "s"} with fewer properties`); | ||
| return reviews; | ||
| }, | ||
| }; |
159 changes: 159 additions & 0 deletions
159
components/etrusted/actions/get-list-of-reviews/get-list-of-reviews.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import etrusted from "../../etrusted.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "etrusted-get-list-of-reviews", | ||
| name: "Get List of Reviews", | ||
| description: "Get a list of reviews for a specific channel, a set of channels or for your entire account. [See the documentation](https://developers.etrusted.com/reference/getreviews)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| etrusted, | ||
| channelId: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "channelId", | ||
| ], | ||
| type: "string[]", | ||
| optional: true, | ||
| }, | ||
| after: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "reviewId", | ||
| ], | ||
| label: "After", | ||
| description: "`After` is a review ID. The list of reviews in the response will only contain reviews submitted earlier than the review with this ID.", | ||
| optional: true, | ||
| }, | ||
| before: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "reviewId", | ||
| ], | ||
| label: "Before", | ||
| description: "`Before` is a review ID. The list of reviews in the response will only contain reviews submitted later than the review with this ID.", | ||
| optional: true, | ||
| }, | ||
| submittedAfter: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "submittedAfter", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| submittedBefore: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "submittedBefore", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| rating: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "rating", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "status", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "type", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| hasReply: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "hasReply", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| additionalInformation: { | ||
| type: "string[]", | ||
| label: "Additional Information", | ||
| description: "A list of additional pieces of information to be retrieved with the review. If this property is not set, none of the of additional information are included in the review.", | ||
| options: [ | ||
| "VETO", | ||
| "ATTACHMENTS", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| ignoreStatements: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "ignoreStatements", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| query: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "query", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| sku: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "sku", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| orderBy: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "orderBy", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| etrusted, | ||
| "maxResults", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = this.etrusted.paginate({ | ||
| $, | ||
| fn: this.etrusted.getListOfReviews, | ||
| params: { | ||
| channels: parseObject(this.channelId)?.join(","), | ||
| after: this.after, | ||
| before: this.before, | ||
| submittedAfter: this.submittedAfter, | ||
| submittedBefore: this.submittedBefore, | ||
| rating: parseObject(this.rating)?.join(","), | ||
| status: parseObject(this.status)?.join(","), | ||
| type: parseObject(this.type)?.join(","), | ||
| hasReply: this.hasReply, | ||
| additionalInformation: parseObject(this.additionalInformation)?.join(","), | ||
| ignoreStatements: this.ignoreStatements, | ||
| query: this.query, | ||
| sku: parseObject(this.sku)?.join(","), | ||
| orderBy: this.orderBy, | ||
| }, | ||
| maxResults: this.maxResults, | ||
| }); | ||
|
|
||
| const reviews = []; | ||
| for await (const review of response) { | ||
| reviews.push(review); | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $.export("$summary", `Successfully retrieved ${reviews.length} review${reviews.length === 1 | ||
| ? "" | ||
| : "s"}`); | ||
| return reviews; | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.