@grafikr/shopify-typescript 2.5.0 → 2.6.0

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.
@@ -1,7 +1,7 @@
1
1
  import { RequireAtLeastOne } from 'type-fest';
2
2
 
3
3
  export type Analytics = {
4
- publish: (name: string, data: Record<any, any>) => boolean;
4
+ publish: (name: string, data: Record<string, unknown>) => boolean;
5
5
  visitor: (
6
6
  visitorInfo: RequireAtLeastOne<{ email: string; phone: string }>,
7
7
  options: { appId: string },
@@ -31,11 +31,10 @@ export type CustomerPrivacy = {
31
31
  },
32
32
  callback: () => void,
33
33
  ): void;
34
- shouldShowBanner(): boolean;
35
- thirdPartyMarketingAllowed(): boolean;
36
-
37
34
  /** @deprecated Use consent as an object instead */
38
35
  setTrackingConsent(consent: boolean, callback: () => void): void;
36
+ shouldShowBanner(): boolean;
37
+ thirdPartyMarketingAllowed(): boolean;
39
38
  /** @deprecated Use saleOfDataRegion instead */
40
39
  shouldShowCCPABanner(): boolean;
41
40
  /** @deprecated Use shouldShowBanner instead */
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@grafikr/shopify-typescript",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
- "format": "yarn prettier . --write"
6
+ "format": "biome format . --write",
7
+ "check": "biome check . --write",
8
+ "typecheck": "tsc --noEmit"
7
9
  },
8
10
  "engines": {
9
11
  "node": ">=16.0.0"
10
12
  },
11
13
  "devDependencies": {
12
- "prettier": "^3.5.2",
13
- "typescript": "^5.7.3"
14
+ "@biomejs/biome": "2.5.7",
15
+ "typescript": "^6.0.0"
14
16
  },
15
17
  "repository": {
16
18
  "type": "git",
@@ -21,6 +23,6 @@
21
23
  "type"
22
24
  ],
23
25
  "dependencies": {
24
- "type-fest": "^4.35.0"
26
+ "type-fest": "^5.7.0"
25
27
  }
26
28
  }
@@ -1,7 +1,7 @@
1
1
  import type {
2
+ CartError as CartErrorType,
2
3
  Cart as CartType,
3
4
  UpdatedCart as UpdatedCartType,
4
- CartError as CartErrorType,
5
5
  } from '../json/Cart';
6
6
  import type { UpdatedLineItem } from '../json/LineItem';
7
7
 
@@ -1,11 +1,12 @@
1
1
  import type { Product as ProductType } from '../json/Product';
2
+ import type { Product as ProductsListItemType } from '../json/Products/Product';
2
3
 
3
4
  export type Product = {
4
5
  product: ProductType;
5
6
  };
6
7
 
7
8
  export type Products = {
8
- products: Array<ProductType>; // TODO: Fix types
9
+ products: Array<ProductsListItemType>;
9
10
  };
10
11
 
11
12
  export type Recommendations = {
@@ -1,10 +1,10 @@
1
- import type { LineItem, UpdatedLineItem } from './LineItem';
2
1
  import type { DiscountApplication } from './DiscountApplication';
2
+ import type { LineItem, UpdatedLineItem } from './LineItem';
3
3
 
4
4
  export type Cart = {
5
5
  token: string;
6
6
  note: string | null;
7
- attributes: Record<string, any>;
7
+ attributes: Record<string, unknown>;
8
8
  original_total_price: number;
9
9
  total_price: number;
10
10
  total_discount: number;
@@ -15,6 +15,10 @@ export type Cart = {
15
15
  currency: string;
16
16
  items_subtotal_price: number;
17
17
  cart_level_discount_applications: Array<DiscountApplication>;
18
+ discount_codes: Array<{
19
+ code: string;
20
+ applicable: boolean;
21
+ }>;
18
22
  };
19
23
 
20
24
  export type UpdatedCart = Omit<Cart, 'cart_level_discount_applications'> & {
@@ -3,7 +3,7 @@ import type { FeaturedImage } from './FeaturedImage';
3
3
 
4
4
  export type LineItem = {
5
5
  id: number;
6
- properties: Record<string, any>;
6
+ properties: Record<string, unknown>;
7
7
  quantity: number;
8
8
  variant_id: number;
9
9
  key: string;
@@ -1,6 +1,6 @@
1
- import type { ProductVariant } from './ProductVariant';
2
- import type { ProductOption } from './ProductOption';
3
1
  import type { ProductImage } from './ProductImage';
2
+ import type { ProductOption } from './ProductOption';
3
+ import type { ProductVariant } from './ProductVariant';
4
4
 
5
5
  export type Product = {
6
6
  id: number;
@@ -0,0 +1,19 @@
1
+ import type { ProductImage } from './ProductImage';
2
+ import type { ProductOption } from './ProductOption';
3
+ import type { ProductVariant } from './ProductVariant';
4
+
5
+ export type Product = {
6
+ id: number;
7
+ title: string;
8
+ body_html: string | null;
9
+ vendor: string;
10
+ product_type: string;
11
+ created_at: string;
12
+ handle: string;
13
+ updated_at: string;
14
+ published_at: string;
15
+ tags: Array<string>;
16
+ variants: Array<ProductVariant>;
17
+ options: Array<ProductOption>;
18
+ images: Array<ProductImage>;
19
+ };
@@ -0,0 +1,11 @@
1
+ export type ProductImage = {
2
+ id: number;
3
+ product_id: number;
4
+ position: number;
5
+ created_at: string;
6
+ updated_at: string;
7
+ src: string;
8
+ width: number;
9
+ height: number;
10
+ variant_ids: Array<number>;
11
+ };
@@ -0,0 +1,5 @@
1
+ export type ProductOption = {
2
+ name: string;
3
+ position: number;
4
+ values: Array<string>;
5
+ };
@@ -0,0 +1,26 @@
1
+ import type { ProductImage } from '../ProductImage';
2
+
3
+ export type ProductVariant = {
4
+ id: number;
5
+ product_id: number;
6
+ title: string;
7
+ price: string;
8
+ sku: string | null;
9
+ position: number;
10
+ compare_at_price: string | null;
11
+ created_at: string;
12
+ updated_at: string;
13
+ taxable: boolean;
14
+ grams: number;
15
+ available: boolean;
16
+ requires_shipping: boolean;
17
+ featured_image: ProductImage | null;
18
+
19
+ // Deprecated properties
20
+ /** @deprecated */
21
+ option1: string | null;
22
+ /** @deprecated */
23
+ option2: string | null;
24
+ /** @deprecated */
25
+ option3: string | null;
26
+ };
@@ -1,5 +1,5 @@
1
- import type { SearchItem } from './SearchItem';
2
1
  import type { FeaturedImage } from '../FeaturedImage';
2
+ import type { SearchItem } from './SearchItem';
3
3
 
4
4
  export type Article = SearchItem & {
5
5
  author: string;
@@ -1,5 +1,5 @@
1
- import type { SearchItem } from './SearchItem';
2
1
  import type { FeaturedImage } from '../FeaturedImage';
2
+ import type { SearchItem } from './SearchItem';
3
3
 
4
4
  export type Collection = SearchItem & {
5
5
  published_at: string;
@@ -1,6 +1,6 @@
1
1
  import type { FeaturedImage } from '../FeaturedImage';
2
- import type { SearchItem } from './SearchItem';
3
2
  import type { ProductVariant } from './ProductVariant';
3
+ import type { SearchItem } from './SearchItem';
4
4
 
5
5
  export type Product = SearchItem & {
6
6
  available: boolean;
@@ -1,5 +1,5 @@
1
- import type { ProductVariant } from './ProductVariant';
2
1
  import type { ProductMedia } from './ProductMedia';
2
+ import type { ProductVariant } from './ProductVariant';
3
3
 
4
4
  export type Product = {
5
5
  id: number;