@decocms/apps 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/apps",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "type": "module",
5
5
  "description": "Deco commerce apps for TanStack Start - Shopify, VTEX, commerce types, analytics utils",
6
6
  "exports": {
@@ -37,25 +37,41 @@ export type CartFragment = {
37
37
 
38
38
  // Mutation types
39
39
  export type AddItemToCartMutation = { cart?: CartFragment | null };
40
- export type AddItemToCartMutationVariables = { cartId: string; lines: any };
40
+ export type AddItemToCartMutationVariables = { cartId: string; lines: unknown };
41
41
  export type UpdateItemsMutation = { cart?: CartFragment | null };
42
- export type UpdateItemsMutationVariables = { cartId: string; lines: any };
42
+ export type UpdateItemsMutationVariables = { cartId: string; lines: unknown };
43
43
  export type AddCouponMutation = { cart?: CartFragment | null };
44
44
  export type AddCouponMutationVariables = { cartId: string; discountCodes: string[] };
45
45
 
46
- // Product types
47
- export type ProductFragment = any;
48
- export type ProductVariantFragment = any;
49
- export type GetProductQuery = { product?: any };
50
- export type GetProductQueryVariables = { handle?: string; identifiers?: any[] };
51
- export type ProductRecommendationsQuery = { productRecommendations?: any[] };
46
+ // Product types — these are intentionally loose stubs because the
47
+ // real Shopify Storefront API GraphQL types are huge and only a tiny
48
+ // subset is consumed. `unknown` keeps consumers honest (forces a cast
49
+ // at the boundary) without exploding the type surface.
50
+ export type ProductFragment = unknown;
51
+ export type ProductVariantFragment = unknown;
52
+ export type GetProductQuery = { product?: unknown };
53
+ export type GetProductQueryVariables = { handle?: string; identifiers?: unknown[] };
54
+ export type ProductRecommendationsQuery = { productRecommendations?: unknown[] };
52
55
  export type ProductRecommendationsQueryVariables = { productId: string };
53
56
 
54
57
  // Search/Collection types
55
58
  export type InputMaybe<T> = T | null | undefined;
56
59
  export type ProductCollectionSortKeys = string;
57
60
  export type SearchSortKeys = string;
58
- export type ProductFilter = any;
61
+ // Loose shape derived from the only consumers in
62
+ // `shopify/utils/utils.ts` (filterToObject + getFiltersByUrl). Keeps
63
+ // the types honest without depending on Shopify's full GraphQL schema.
64
+ export type ProductFilter = {
65
+ tag?: string;
66
+ productType?: string;
67
+ productVendor?: string;
68
+ available?: boolean;
69
+ price?: { min?: number; max?: number };
70
+ variantOption?: { name: string; value: string };
71
+ productMetafield?: { namespace: string; key: string; value: string };
72
+ taxonomyMetafield?: { namespace: string; key: string; value: string };
73
+ category?: { id: string };
74
+ };
59
75
 
60
76
  // Customer types
61
77
  export type Customer = {
@@ -65,9 +81,9 @@ export type Customer = {
65
81
  email?: string | null;
66
82
  phone?: string | null;
67
83
  acceptsMarketing?: boolean;
68
- defaultAddress?: any;
69
- addresses?: { nodes: any[] };
70
- orders?: { nodes: any[] };
84
+ defaultAddress?: unknown;
85
+ addresses?: { nodes: unknown[] };
86
+ orders?: { nodes: unknown[] };
71
87
  };
72
88
 
73
89
  export type CustomerAccessTokenCreateInput = {
@@ -31,9 +31,7 @@ import type { OrderForm, OrderFormItem } from "../types";
31
31
  export interface CreateUseCartInvoke {
32
32
  vtex: {
33
33
  actions: {
34
- getOrCreateCart: (args: {
35
- data: { orderFormId?: string };
36
- }) => Promise<OrderForm>;
34
+ getOrCreateCart: (args: { data: { orderFormId?: string } }) => Promise<OrderForm>;
37
35
  addItemsToCart: (args: {
38
36
  data: {
39
37
  orderFormId: string;
@@ -130,10 +128,7 @@ export function createUseCart(opts: CreateUseCartOptions) {
130
128
  return of.orderFormId;
131
129
  }
132
130
 
133
- function itemToAnalyticsItem(
134
- item: OrderFormItem & { coupon?: string },
135
- index: number,
136
- ) {
131
+ function itemToAnalyticsItem(item: OrderFormItem & { coupon?: string }, index: number) {
137
132
  return {
138
133
  item_id: item.productId,
139
134
  item_group_id: item.productId,
@@ -217,11 +212,7 @@ export function createUseCart(opts: CreateUseCartOptions) {
217
212
  },
218
213
  },
219
214
 
220
- addItem: async (params: {
221
- id: string;
222
- seller: string;
223
- quantity?: number;
224
- }) => {
215
+ addItem: async (params: { id: string; seller: string; quantity?: number }) => {
225
216
  setLoading(true);
226
217
  try {
227
218
  const ofId = await ensureOrderForm();
@@ -266,9 +257,7 @@ export function createUseCart(opts: CreateUseCartOptions) {
266
257
  }
267
258
  },
268
259
 
269
- updateItems: async (params: {
270
- orderItems: Array<{ index: number; quantity: number }>;
271
- }) => {
260
+ updateItems: async (params: { orderItems: Array<{ index: number; quantity: number }> }) => {
272
261
  const ofId = _orderForm?.orderFormId || getOrderFormIdFromCookie();
273
262
  if (!ofId) return;
274
263
  setLoading(true);
@@ -319,10 +308,7 @@ export function createUseCart(opts: CreateUseCartOptions) {
319
308
  }
320
309
  },
321
310
 
322
- sendAttachment: async (params: {
323
- attachment: string;
324
- body: Record<string, unknown>;
325
- }) => {
311
+ sendAttachment: async (params: { attachment: string; body: Record<string, unknown> }) => {
326
312
  const ofId = _orderForm?.orderFormId || getOrderFormIdFromCookie();
327
313
  if (!ofId) return;
328
314
  setLoading(true);
@@ -361,9 +347,7 @@ export function createUseCart(opts: CreateUseCartOptions) {
361
347
  },
362
348
 
363
349
  mapItemsToAnalyticsItems: (orderForm: OrderForm | null) => {
364
- return (orderForm?.items || []).map((item, index) =>
365
- itemToAnalyticsItem(item, index),
366
- );
350
+ return (orderForm?.items || []).map((item, index) => itemToAnalyticsItem(item, index));
367
351
  },
368
352
  };
369
353
  }
@@ -1,9 +1,9 @@
1
- export { type UseAutocompleteOptions, useAutocomplete } from "./useAutocomplete";
2
- export { type CartItem, type OrderForm, type UseCartOptions, useCart } from "./useCart";
3
1
  export {
4
2
  type CreateUseCartInvoke,
5
3
  type CreateUseCartOptions,
6
4
  createUseCart,
7
5
  } from "./createUseCart";
6
+ export { type UseAutocompleteOptions, useAutocomplete } from "./useAutocomplete";
7
+ export { type CartItem, type OrderForm, type UseCartOptions, useCart } from "./useCart";
8
8
  export { type UseUserOptions, useUser, type VtexUser } from "./useUser";
9
9
  export { type UseWishlistOptions, useWishlist, type WishlistItem } from "./useWishlist";