Skip to content

Commit

Permalink
Fix empty cart type (#991)
Browse files Browse the repository at this point in the history
* Fix event type to be any object. Empty array is not a valid json schema type.

* Lint
  • Loading branch information
matheusgr authored Jan 24, 2025
1 parent d2515a9 commit 7d2725f
Show file tree
Hide file tree
Showing 5 changed files with 909 additions and 897 deletions.
12 changes: 10 additions & 2 deletions verified-reviews/utils/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,21 @@ export const createClient = (params: ConfigVerifiedReviews | undefined) => {
};
/** @description https://documenter.getpostman.com/view/2336519/SVzw6MK5#daf51360-c79e-451a-b627-33bdd0ef66b8 */
const reviews = (
{ productId, count = 5, offset = 0, order: _order = "date_desc", customizeOrder = false }:
{
productId,
count = 5,
offset = 0,
order: _order = "date_desc",
customizeOrder = false,
}:
& PaginationOptions
& {
productId: string | string[];
},
) => {
const order = customizeOrder ? _order : orderMap[_order as keyof typeof orderMap];
const order = customizeOrder
? _order
: orderMap[_order as keyof typeof orderMap];

const payload = {
query: "reviews",
Expand Down
4 changes: 3 additions & 1 deletion vtex/actions/analytics/sendEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export type Props =
}
| {
type: "page.empty_cart";
products: [];
// Empty array is converted to a invalid json schema... so, let it be anything.
// deno-lint-ignore ban-types
products: {};
}
| {
type: "page.confirmation";
Expand Down
2 changes: 1 addition & 1 deletion vtex/loaders/promotion/getPromotionById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
idCalculatorConfiguration: string;
}

export const defaultVisibility = 'private'
export const defaultVisibility = "private";

export default async function loader(
props: Props,
Expand Down
Loading

0 comments on commit 7d2725f

Please sign in to comment.