@grafikr/shopify-typescript 1.1.1 → 2.0.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.
Files changed (68) hide show
  1. package/global/CustomEvents.ts +38 -0
  2. package/global/Shopify.ts +22 -34
  3. package/global/modules/customerPrivacy.ts +44 -15
  4. package/package.json +7 -10
  5. package/type/endpoints/BrowsingContextSuggestions.ts +3 -0
  6. package/type/endpoints/Cart.ts +22 -0
  7. package/type/endpoints/Collection.ts +14 -0
  8. package/type/endpoints/Page.ts +9 -0
  9. package/type/endpoints/Policy.ts +5 -0
  10. package/type/endpoints/Product.ts +14 -0
  11. package/type/endpoints/Search.ts +20 -0
  12. package/type/json/BrowsingContextSuggestions.ts +25 -0
  13. package/type/json/Cart.ts +33 -0
  14. package/type/json/Collection.ts +12 -0
  15. package/type/json/DiscountAllocation.ts +6 -0
  16. package/type/json/DiscountApplication.ts +13 -0
  17. package/type/json/FeaturedImage.ts +15 -0
  18. package/type/json/Image.ts +6 -0
  19. package/type/json/LineItem.ts +67 -0
  20. package/type/json/Page.ts +9 -0
  21. package/type/json/Policy.ts +7 -0
  22. package/type/json/Product.ts +22 -0
  23. package/type/json/ProductImage.ts +10 -0
  24. package/type/json/ProductOption.ts +7 -0
  25. package/type/json/ProductVariant.ts +23 -0
  26. package/type/json/Search/Article.ts +11 -0
  27. package/type/json/Search/Collection.ts +7 -0
  28. package/type/json/Search/Page.ts +6 -0
  29. package/type/json/Search/Product.ts +18 -0
  30. package/type/json/Search/ProductVariant.ts +12 -0
  31. package/type/json/Search/SearchItem.ts +7 -0
  32. package/type/liquid/Article.ts +18 -0
  33. package/type/liquid/Collection.ts +20 -0
  34. package/type/liquid/FeaturedVariantImage.ts +11 -0
  35. package/type/liquid/FeaturedVariantMedia.ts +8 -0
  36. package/type/liquid/Image.ts +7 -0
  37. package/type/liquid/Pagination.ts +16 -0
  38. package/type/liquid/PreviewImage.ts +6 -0
  39. package/type/liquid/Product.ts +29 -0
  40. package/type/liquid/ProductMedia.ts +13 -0
  41. package/type/liquid/ProductVariant.ts +29 -0
  42. package/global/modules/Image.ts +0 -7
  43. package/type/Cart.ts +0 -18
  44. package/type/Collection.ts +0 -12
  45. package/type/DiscountAllocations.ts +0 -6
  46. package/type/DiscountApplication.ts +0 -13
  47. package/type/Image.ts +0 -6
  48. package/type/LineItem.ts +0 -49
  49. package/type/Option.ts +0 -7
  50. package/type/Product.ts +0 -22
  51. package/type/ProductImage.ts +0 -10
  52. package/type/Variant.ts +0 -23
  53. package/type/object/Article.ts +0 -18
  54. package/type/object/Collection.ts +0 -17
  55. package/type/object/FeaturedMedia.ts +0 -8
  56. package/type/object/Image.ts +0 -7
  57. package/type/object/Media.ts +0 -13
  58. package/type/object/PreviewImage.ts +0 -6
  59. package/type/object/Product.ts +0 -29
  60. package/type/object/Rule.ts +0 -5
  61. package/type/object/Variant.ts +0 -24
  62. package/type/search/Article.ts +0 -12
  63. package/type/search/Collection.ts +0 -7
  64. package/type/search/FeaturedImage.ts +0 -7
  65. package/type/search/Item.ts +0 -7
  66. package/type/search/Page.ts +0 -6
  67. package/type/search/Product.ts +0 -17
  68. package/type/search/Result.ts +0 -13
@@ -0,0 +1,38 @@
1
+ export type CustomEvents = {
2
+ /** The theme editor preview inspector has been activated */
3
+ 'shopify:inspector:activate': undefined;
4
+
5
+ /** The theme editor preview inspector has been deactivated */
6
+ 'shopify:inspector:deactivate': undefined;
7
+
8
+ /** A section has been added or re-rendered */
9
+ 'shopify:section:load': { sectionId: string };
10
+
11
+ /** A section has been deleted or is being re-rendered */
12
+ 'shopify:section:unload': { sectionId: string };
13
+
14
+ /** The user has selected the section in the sidebar */
15
+ 'shopify:section:select': {
16
+ sectionId: string;
17
+ load: boolean;
18
+ };
19
+
20
+ /** The user has deselected the section in the sidebar. */
21
+ 'shopify:section:deselect': { sectionId: string };
22
+
23
+ /** A section has been reordered */
24
+ 'shopify:section:reorder': { sectionId: string };
25
+
26
+ /** The user has selected the block in the sidebar */
27
+ 'shopify:block:select': {
28
+ blockId: string;
29
+ sectionId: string;
30
+ load: boolean;
31
+ };
32
+
33
+ /** User has deselected the block in the sidebar */
34
+ 'shopify:block:deselect': {
35
+ blockId: string;
36
+ sectionId: string;
37
+ };
38
+ };
package/global/Shopify.ts CHANGED
@@ -1,36 +1,24 @@
1
- import ProductJSON from '../type/Product';
2
- import ProductObject from '../type/object/Product';
3
- import Image from './modules/Image';
4
- import CustomerPrivacy from './modules/customerPrivacy';
1
+ import { CustomerPrivacy } from './modules/customerPrivacy';
5
2
 
6
- export default interface Shopify {
7
- CountryProvinceSelector?: (country_domid: string, province_domid: string, options?: {
8
- hideElement: string
9
- }) => void
10
- postLink?: (path: string, options?: {
11
- method?: string
12
- parameters?: object
13
- }) => void
14
- addListener?: (target: HTMLElement, eventName: string, callback: CallableFunction) => void
15
- setSelectorByValue?: (selector: HTMLSelectElement, value: any) => number
16
- Image?: Image
17
- OptionSelectors?: (selector: string, config: {
18
- product: ProductJSON | ProductObject
19
- onVariantSelected: CallableFunction
20
- enableHistoryState?: boolean
21
- }) => void
22
- OptionSelectorsFromDOM?: FunctionConstructor
23
- loadFeatures: (features: any[], callback: CallableFunction) => void
24
- customerPrivacy?: CustomerPrivacy
3
+ export type Shopify = {
4
+ loadFeatures: (
5
+ features: Array<{ name: string; version: string }>,
6
+ callback: CallableFunction,
7
+ ) => void;
8
+ customerPrivacy?: CustomerPrivacy;
25
9
  currency: {
26
- active: string
27
- rate: string
28
- }
29
- cdnHost: 'cdn.shopify.com'
30
- country: string
31
- locale: string
32
- formatMoney: (price: string | number, format: string) => string
33
- money_format: string
34
- shop: string
35
- designMode: true | undefined
36
- }
10
+ active: string;
11
+ rate: string;
12
+ };
13
+ cdnHost: string;
14
+ country: string;
15
+ designMode: true | undefined;
16
+ locale: string;
17
+ shop: string;
18
+ recaptchaV3: {
19
+ siteKey: string;
20
+ };
21
+ routes: {
22
+ root: string;
23
+ };
24
+ };
@@ -1,15 +1,44 @@
1
- export default interface CustomerPrivacy {
2
- getCCPAConsent(): string
3
- getRegulation(): string
4
- getShopPrefs(): {
5
- limit: string[]
6
- }
7
- getTrackingConsent(): string
8
- isRegulationEnforced(): boolean
9
- setCCPAConsent(consented: boolean, callback: CallableFunction): void
10
- setTrackingConsent(consented: boolean, callback: CallableFunction): void
11
- shouldShowCCPABanner(): boolean
12
- shouldShowGDPRBanner(): boolean
13
- userCanBeTracked(): boolean
14
- userDataCanBeSold(): boolean
15
- }
1
+ type YesNo = '' | 'yes' | 'no';
2
+
3
+ export type CustomerPrivacy = {
4
+ analyticsProcessingAllowed(): boolean;
5
+ currentVisitorConsent(): {
6
+ marketing: YesNo;
7
+ analytics: YesNo;
8
+ preferences: YesNo;
9
+ sale_of_data: YesNo;
10
+ gpc: YesNo;
11
+ };
12
+ doesMerchantSupportGranularConsent(): boolean;
13
+ firstPartyMarketingAllowed(): boolean;
14
+ getCCPAConsent(): YesNo;
15
+ getRegulation(): string;
16
+ getShopPrefs(): { limit: Array<string> };
17
+ getTrackingConsent(): YesNo;
18
+ isRegulationEnforced(): boolean;
19
+ preferencesProcessingAllowed(): boolean;
20
+ saleOfDataRegion(): boolean;
21
+ setCCPAConsent(consent: boolean, callback: () => void): void;
22
+ setTrackingConsent(
23
+ consent: {
24
+ analytics?: boolean;
25
+ marketing?: boolean;
26
+ preferences?: boolean;
27
+ sale_of_data?: boolean;
28
+ },
29
+ callback: () => void,
30
+ ): void;
31
+ shouldShowBanner(): boolean;
32
+ thirdPartyMarketingAllowed(): boolean;
33
+
34
+ /** @deprecated Use consent as an object instead */
35
+ setTrackingConsent(consent: boolean, callback: () => void): void;
36
+ /** @deprecated Use saleOfDataRegion instead */
37
+ shouldShowCCPABanner(): boolean;
38
+ /** @deprecated Use shouldShowBanner instead */
39
+ shouldShowGDPRBanner(): boolean;
40
+ /** @deprecated */
41
+ userCanBeTracked(): boolean;
42
+ /** @deprecated */
43
+ userDataCanBeSold(): boolean;
44
+ };
package/package.json CHANGED
@@ -1,19 +1,16 @@
1
1
  {
2
2
  "name": "@grafikr/shopify-typescript",
3
- "version": "1.1.1",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
- "lint": "node_modules/.bin/eslint . --ext .js,.ts",
7
- "test": "yarn lint"
6
+ "format": "yarn prettier . --write"
7
+ },
8
+ "engines": {
9
+ "node": ">=16.0.0"
8
10
  },
9
11
  "devDependencies": {
10
- "@typescript-eslint/eslint-plugin": "^5.0.0",
11
- "@typescript-eslint/parser": "^5.0.0",
12
- "eslint": "^8.4.0",
13
- "eslint-config-airbnb-base": "^15.0.0",
14
- "eslint-config-airbnb-typescript": "^17.0.0",
15
- "eslint-plugin-import": "^2.0.0",
16
- "typescript": "^4.0.0"
12
+ "prettier": "^3.0.0",
13
+ "typescript": "^5.0.0"
17
14
  },
18
15
  "repository": {
19
16
  "type": "git",
@@ -0,0 +1,3 @@
1
+ import { BrowsingContextSuggestions as BrowsingContextSuggestionsType } from '../json/BrowsingContextSuggestions';
2
+
3
+ export type BrowsingContextSuggestions = BrowsingContextSuggestionsType;
@@ -0,0 +1,22 @@
1
+ import {
2
+ Cart as CartType,
3
+ UpdatedCart as UpdatedCartType,
4
+ CartError as CartErrorType,
5
+ } from '../json/Cart';
6
+ import { UpdatedLineItem } from '../json/LineItem';
7
+
8
+ export type Cart = CartType;
9
+
10
+ export type CartAdd =
11
+ | UpdatedLineItem
12
+ | {
13
+ items: Array<UpdatedLineItem>;
14
+ };
15
+
16
+ export type CartChange = UpdatedCartType;
17
+
18
+ export type CartClear = CartType;
19
+
20
+ export type CartUpdate = UpdatedCartType;
21
+
22
+ export type CartError = CartErrorType;
@@ -0,0 +1,14 @@
1
+ import { Collection as CollectionType } from '../json/Collection';
2
+ import { Product as ProductType } from '../json/Product';
3
+
4
+ export type Collection = {
5
+ collection: CollectionType;
6
+ };
7
+
8
+ export type Collections = {
9
+ collections: Array<CollectionType>;
10
+ };
11
+
12
+ export type Products = {
13
+ products: Array<ProductType>;
14
+ };
@@ -0,0 +1,9 @@
1
+ import { Page as PageType } from '../json/Page';
2
+
3
+ export type Page = {
4
+ page: PageType;
5
+ };
6
+
7
+ export type Pages = {
8
+ pages: Array<PageType>;
9
+ };
@@ -0,0 +1,5 @@
1
+ import { Policy as PolicyType } from '../json/Policy';
2
+
3
+ export type Policy = {
4
+ policy: PolicyType;
5
+ };
@@ -0,0 +1,14 @@
1
+ import { Product as ProductType } from '../json/Product';
2
+
3
+ export type Product = {
4
+ product: ProductType;
5
+ };
6
+
7
+ export type Products = {
8
+ products: Array<ProductType>; // TODO: Fix types
9
+ };
10
+
11
+ export type Recommendations = {
12
+ products: Array<ProductType>;
13
+ intent: 'related' | 'complementary';
14
+ };
@@ -0,0 +1,20 @@
1
+ import { Article as ArticleType } from '../json/Search/Article';
2
+ import { Collection as CollectionType } from '../json/Search/Collection';
3
+ import { Page as PageType } from '../json/Search/Page';
4
+ import { Product as ProductType } from '../json/Search/Product';
5
+
6
+ export type Suggest = {
7
+ resources: {
8
+ results: {
9
+ queries?: Array<{
10
+ url: string;
11
+ text: string;
12
+ styled_text: string;
13
+ }>;
14
+ articles?: Array<ArticleType>;
15
+ collections?: Array<CollectionType>;
16
+ pages?: Array<PageType>;
17
+ products?: Array<ProductType>;
18
+ };
19
+ };
20
+ };
@@ -0,0 +1,25 @@
1
+ export type BrowsingContextSuggestions = {
2
+ detected_values: {
3
+ country: {
4
+ handle: string;
5
+ name: string;
6
+ };
7
+ };
8
+ suggestions: Array<{
9
+ parts: {
10
+ country: {
11
+ handle: string;
12
+ name: string;
13
+ confidence: number;
14
+ options: Record<string, string>;
15
+ };
16
+ language: {
17
+ handle: string;
18
+ name: string;
19
+ confidence: number;
20
+ options: Record<string, string>;
21
+ };
22
+ };
23
+ confidence: string;
24
+ }>;
25
+ };
@@ -0,0 +1,33 @@
1
+ import { LineItem, UpdatedLineItem } from './LineItem';
2
+ import { DiscountApplication } from './DiscountApplication';
3
+
4
+ export type Cart = {
5
+ token: string;
6
+ note: string | null;
7
+ attributes: Record<string, any>;
8
+ original_total_price: number;
9
+ total_price: number;
10
+ total_discount: number;
11
+ total_weight: number;
12
+ item_count: number;
13
+ items: Array<LineItem>;
14
+ requires_shipping: boolean;
15
+ currency: string;
16
+ items_subtotal_price: number;
17
+ cart_level_discount_applications: Array<DiscountApplication>;
18
+ };
19
+
20
+ export type UpdatedCart = Omit<Cart, 'cart_level_discount_applications'> & {
21
+ items_added: Array<UpdatedLineItem>;
22
+ items_removed: Array<UpdatedLineItem>;
23
+ cart_level_discount_applications: Array<{
24
+ amount: number;
25
+ discount_application: DiscountApplication;
26
+ }>;
27
+ };
28
+
29
+ export type CartError = {
30
+ description: string;
31
+ message: string;
32
+ status: number;
33
+ };
@@ -0,0 +1,12 @@
1
+ import { Image } from './Image';
2
+
3
+ export type Collection = {
4
+ id: number;
5
+ title: string;
6
+ handle: string;
7
+ description: string;
8
+ published_at: string;
9
+ updated_at: string;
10
+ image: Image | null;
11
+ products_count: number;
12
+ };
@@ -0,0 +1,6 @@
1
+ import { DiscountApplication } from './DiscountApplication';
2
+
3
+ export type DiscountAllocation = {
4
+ amount: number;
5
+ discount_application: DiscountApplication;
6
+ };
@@ -0,0 +1,13 @@
1
+ export type DiscountApplication = {
2
+ type: 'automatic' | 'discount_code' | 'manual' | 'script';
3
+ key: string;
4
+ title: string;
5
+ description: string | null;
6
+ value: string;
7
+ created_at: string;
8
+ value_type: 'fixed_amount' | 'percentage';
9
+ allocation_method: 'across' | 'each' | 'one';
10
+ target_selection: 'all' | 'entitled' | 'explicit';
11
+ target_type: 'line_item' | 'shipping_line';
12
+ total_allocated_amount: number;
13
+ };
@@ -0,0 +1,15 @@
1
+ export type FeaturedImage =
2
+ | {
3
+ aspect_ratio: number;
4
+ alt: string;
5
+ height: number;
6
+ url: string;
7
+ width: number;
8
+ }
9
+ | {
10
+ aspect_ratio: null;
11
+ alt: null;
12
+ height: null;
13
+ url: null;
14
+ width: null;
15
+ };
@@ -0,0 +1,6 @@
1
+ export type Image = {
2
+ id: number;
3
+ created_at: string;
4
+ src: string;
5
+ alt: string | null;
6
+ };
@@ -0,0 +1,67 @@
1
+ import { DiscountAllocation } from './DiscountAllocation';
2
+ import { FeaturedImage } from './FeaturedImage';
3
+
4
+ export type LineItem = {
5
+ id: number;
6
+ properties: Record<string, any>;
7
+ quantity: number;
8
+ variant_id: number;
9
+ key: string;
10
+ title: string;
11
+ original_price: number;
12
+ discounted_price: number;
13
+ original_line_price: number;
14
+ sku: string;
15
+ grams: number;
16
+ vendor: string;
17
+ taxable: boolean;
18
+ product_id: number;
19
+ product_has_only_default_variant: boolean;
20
+ gift_card: boolean;
21
+ final_price: number;
22
+ final_line_price: number;
23
+ url: string;
24
+ featured_image: FeaturedImage;
25
+ image: string | null;
26
+ handle: string;
27
+ requires_shipping: boolean;
28
+ product_type: string;
29
+ product_title: string;
30
+ product_description: string;
31
+ variant_title: string;
32
+ variant_options: Array<string>;
33
+ options_with_values: [
34
+ {
35
+ name: string;
36
+ value: string;
37
+ },
38
+ ];
39
+ line_level_discount_allocations: Array<DiscountAllocation>;
40
+ line_level_total_discount: number;
41
+ quantity_rule: {
42
+ min: number;
43
+ max: number | null;
44
+ increment: number;
45
+ };
46
+ has_components: boolean;
47
+
48
+ // Deprecated values
49
+ /** @deprecated Use line_level_discount_allocations instead */
50
+ discounts: [
51
+ {
52
+ amount: number;
53
+ title: string;
54
+ },
55
+ ];
56
+ /** @deprecated Use final_line_price instead */
57
+ line_price: number;
58
+ /** @deprecated Use final_price instead */
59
+ price: number;
60
+ /** @deprecated Use line_level_total_discount instead */
61
+ total_discount: number;
62
+ };
63
+
64
+ export type UpdatedLineItem = LineItem & {
65
+ untranslated_product_title: string;
66
+ untranslated_variant_title: string;
67
+ };
@@ -0,0 +1,9 @@
1
+ export type Page = {
2
+ id: number;
3
+ body_html: string;
4
+ created_at: string;
5
+ published_at: string;
6
+ updated_at: string;
7
+ handle: string;
8
+ title: string;
9
+ };
@@ -0,0 +1,7 @@
1
+ export type Policy = {
2
+ body: string;
3
+ created_at: string;
4
+ updated_at: string;
5
+ handle: string;
6
+ title: string;
7
+ };
@@ -0,0 +1,22 @@
1
+ import { ProductVariant } from './ProductVariant';
2
+ import { ProductOption } from './ProductOption';
3
+ import { ProductImage } from './ProductImage';
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
+ template_suffix: string;
16
+ published_scope: string;
17
+ tags: string;
18
+ variants: Array<ProductVariant>;
19
+ options: Array<ProductOption>;
20
+ images: Array<ProductImage>;
21
+ image: ProductImage;
22
+ };
@@ -0,0 +1,10 @@
1
+ import { Image } from './Image';
2
+
3
+ export type ProductImage = Image & {
4
+ product_id: number;
5
+ position: number;
6
+ updated_at: string;
7
+ width: number;
8
+ height: number;
9
+ variant_ids: Array<number>;
10
+ };
@@ -0,0 +1,7 @@
1
+ export type ProductOption = {
2
+ id: number;
3
+ product_id: number;
4
+ name: string;
5
+ position: number;
6
+ values: Array<string>;
7
+ };
@@ -0,0 +1,23 @@
1
+ export type ProductVariant = {
2
+ id: number;
3
+ product_id: number;
4
+ title: string;
5
+ price: string;
6
+ sku: string;
7
+ position: number;
8
+ compare_at_price: string;
9
+ fulfillment_service: string;
10
+ inventory_management: string;
11
+ option1: string | null;
12
+ option2: string | null;
13
+ option3: string | null;
14
+ created_at: string;
15
+ updated_at: string;
16
+ taxable: boolean;
17
+ barcode: string;
18
+ grams: number;
19
+ image_id: number | null;
20
+ weight: number;
21
+ weight_unit: 'g' | 'kg';
22
+ requires_shipping: boolean;
23
+ };
@@ -0,0 +1,11 @@
1
+ import { SearchItem } from './SearchItem';
2
+ import { FeaturedImage } from '../FeaturedImage';
3
+
4
+ export type Article = SearchItem & {
5
+ author: string;
6
+ image: string | null;
7
+ published_at: string;
8
+ summary_html: string;
9
+ tags: Array<string>;
10
+ featured_image: FeaturedImage;
11
+ };
@@ -0,0 +1,7 @@
1
+ import { SearchItem } from './SearchItem';
2
+ import { FeaturedImage } from '../FeaturedImage';
3
+
4
+ export type Collection = SearchItem & {
5
+ published_at: string;
6
+ featured_image: FeaturedImage;
7
+ };
@@ -0,0 +1,6 @@
1
+ import { SearchItem } from './SearchItem';
2
+
3
+ export type Page = SearchItem & {
4
+ author: null;
5
+ published_at: string;
6
+ };
@@ -0,0 +1,18 @@
1
+ import { FeaturedImage } from '../FeaturedImage';
2
+ import { SearchItem } from './SearchItem';
3
+ import { ProductVariant } from './ProductVariant';
4
+
5
+ export type Product = SearchItem & {
6
+ available: boolean;
7
+ compare_at_price_max: string;
8
+ compare_at_price_min: string;
9
+ image: string | null;
10
+ price: string;
11
+ price_max: string;
12
+ price_min: string;
13
+ tags: Array<string>;
14
+ type: string;
15
+ variants: Array<ProductVariant>;
16
+ vendor: string;
17
+ featured_image: FeaturedImage;
18
+ };
@@ -0,0 +1,12 @@
1
+ import { FeaturedImage } from '../FeaturedImage';
2
+
3
+ export type ProductVariant = {
4
+ available: true;
5
+ compare_at_price: string | null;
6
+ id: number;
7
+ image: string | null;
8
+ price: string;
9
+ title: string;
10
+ url: string;
11
+ featured_image: FeaturedImage;
12
+ };
@@ -0,0 +1,7 @@
1
+ export type SearchItem = {
2
+ id: number;
3
+ handle: string;
4
+ url: string;
5
+ title: string;
6
+ body: string;
7
+ };
@@ -0,0 +1,18 @@
1
+ import { Image } from './Image';
2
+
3
+ export type Article = {
4
+ id: number;
5
+ title: string;
6
+ created_at: string;
7
+ body_html: string;
8
+ blog_id: number;
9
+ author: string;
10
+ user_id: number;
11
+ published_at: string;
12
+ updated_at: string;
13
+ summary_html: string;
14
+ template_suffix: string;
15
+ handle: string;
16
+ tags: string;
17
+ image?: Image;
18
+ };
@@ -0,0 +1,20 @@
1
+ import { Image } from './Image';
2
+
3
+ export type Collection = {
4
+ id: number;
5
+ handle: string;
6
+ title: string;
7
+ updated_at: string;
8
+ body_html: string;
9
+ published_at: string;
10
+ sort_order: string;
11
+ template_suffix: string;
12
+ disjunctive?: boolean;
13
+ rules?: Array<{
14
+ column: string;
15
+ relation: string;
16
+ condition: string;
17
+ }>;
18
+ published_scope: string;
19
+ image?: Image;
20
+ };
@@ -0,0 +1,11 @@
1
+ export type FeaturedVariantImage = {
2
+ alt: string | null;
3
+ created_at: string;
4
+ height: number;
5
+ id: number;
6
+ position: number;
7
+ product_id: number;
8
+ updated_at: string;
9
+ variant_ids: Array<number>;
10
+ width: number;
11
+ };
@@ -0,0 +1,8 @@
1
+ import { PreviewImage } from './PreviewImage';
2
+
3
+ export type FeaturedVariantMedia = {
4
+ alt: string | null;
5
+ id: number;
6
+ position: number;
7
+ preview_image: PreviewImage;
8
+ };
@@ -0,0 +1,7 @@
1
+ export type Image = {
2
+ created_at: string;
3
+ alt: string | null;
4
+ width: number;
5
+ height: number;
6
+ src: string;
7
+ };
@@ -0,0 +1,16 @@
1
+ type Part = {
2
+ is_link: boolean;
3
+ title: string;
4
+ url?: string;
5
+ };
6
+
7
+ export type Pagination = {
8
+ current_offset: number;
9
+ current_page: number;
10
+ items: number;
11
+ page_size: number;
12
+ parts: Array<Part>;
13
+ previous?: Part;
14
+ next?: Part;
15
+ pages: number;
16
+ };
@@ -0,0 +1,6 @@
1
+ export type PreviewImage = {
2
+ aspect_ratio: number;
3
+ height: number;
4
+ width: number;
5
+ src: string;
6
+ };
@@ -0,0 +1,29 @@
1
+ import { ProductVariant } from './ProductVariant';
2
+ import { ProductMedia } from './ProductMedia';
3
+
4
+ export type Product = {
5
+ id: number;
6
+ title: string;
7
+ handle: string;
8
+ description: string;
9
+ published_at: string;
10
+ created_at: string;
11
+ vendor: string;
12
+ type: string;
13
+ tags: Array<string>;
14
+ price: number;
15
+ price_min: number;
16
+ price_max: number;
17
+ available: boolean;
18
+ price_varies: boolean;
19
+ compare_at_price: string | null;
20
+ compare_at_price_min: number;
21
+ compare_at_price_max: number;
22
+ compare_at_price_varies: boolean;
23
+ variants: Array<ProductVariant>;
24
+ images: Array<string>;
25
+ featured_image: string | null;
26
+ options: Array<string>;
27
+ media: Array<ProductMedia>;
28
+ content: string;
29
+ };
@@ -0,0 +1,13 @@
1
+ import { PreviewImage } from './PreviewImage';
2
+
3
+ export type ProductMedia = {
4
+ alt: string | null;
5
+ id: number;
6
+ position: number;
7
+ preview_image: PreviewImage;
8
+ aspect_ratio: number;
9
+ height: number;
10
+ media_type: string;
11
+ src: string;
12
+ width: number;
13
+ };
@@ -0,0 +1,29 @@
1
+ import { FeaturedVariantImage } from './FeaturedVariantImage';
2
+ import { FeaturedVariantMedia } from './FeaturedVariantMedia';
3
+
4
+ export type ProductVariant = {
5
+ id: number;
6
+ title: string;
7
+ option1: string;
8
+ option2: string | null;
9
+ option3: string | null;
10
+ sku: string | null;
11
+ requires_shipping: boolean;
12
+ taxable: boolean;
13
+ featured_image?: FeaturedVariantImage;
14
+ featured_media?: FeaturedVariantMedia;
15
+ available: boolean;
16
+ name: string;
17
+ public_title: string | null;
18
+ options: Array<string>;
19
+ price: number;
20
+ weight: number;
21
+ compare_at_price: number | null;
22
+ inventory_management: string;
23
+ barcode: string | null;
24
+ quantity_rule: {
25
+ increment: number;
26
+ max: number | null;
27
+ min: number;
28
+ };
29
+ };
@@ -1,7 +0,0 @@
1
- export default interface Image {
2
- switchImage: CallableFunction
3
- getSizedImageUrl: (src: string, size: string) => string
4
- imageSize: (src: string) => string | null
5
- loadImage: (src: string) => void
6
- removeProtocol: (url: string) => string
7
- }
package/type/Cart.ts DELETED
@@ -1,18 +0,0 @@
1
- import LineItem from './LineItem';
2
- import DiscountApplication from './DiscountApplication';
3
-
4
- export default interface Cart {
5
- token: string
6
- note: string | null
7
- attributes: { [key: string]: string | boolean } | null
8
- original_total_price: number
9
- total_price: number
10
- total_discount: number
11
- total_weight: number
12
- item_count: number
13
- items: LineItem[]
14
- requires_shipping: boolean
15
- currency: string
16
- items_subtotal_price: number
17
- cart_level_discount_applications: DiscountApplication[]
18
- }
@@ -1,12 +0,0 @@
1
- import Image from './Image';
2
-
3
- export default interface Collection {
4
- id: number
5
- title: string
6
- handle: string
7
- description: string
8
- published_at: string
9
- updated_at: string
10
- image: Image | null
11
- products_count: number
12
- }
@@ -1,6 +0,0 @@
1
- import DiscountApplication from './DiscountApplication';
2
-
3
- export default interface DiscountAllocations {
4
- amount: number
5
- discount_application: DiscountApplication
6
- }
@@ -1,13 +0,0 @@
1
- export default interface DiscountApplication {
2
- type: 'automatic' | 'discount_code' | 'manual' | 'script'
3
- key: string
4
- title: string
5
- description: string | null
6
- value: number
7
- created_at: string
8
- value_type: 'fixed_amount' | 'percentage'
9
- allocation_method: 'across' | 'each' | 'one'
10
- target_selection: 'all' | 'entitled' | 'explicit'
11
- target_type: 'line_item' | 'shipping_line'
12
- total_allocated_amount: number
13
- }
package/type/Image.ts DELETED
@@ -1,6 +0,0 @@
1
- export default interface Image {
2
- id: number
3
- created_at: string
4
- src: string
5
- alt: string | null
6
- }
package/type/LineItem.ts DELETED
@@ -1,49 +0,0 @@
1
- export default interface Item {
2
- id: number
3
- properties: { [key: string]: any } | null
4
- quantity: number
5
- variant_id: number
6
- key: string
7
- title: string
8
- price: number
9
- original_price: number
10
- discounted_price: number
11
- line_price: number
12
- original_line_price: number
13
- total_discount: number
14
- discounts: [{
15
- amount: number
16
- title: string
17
- }]
18
- sku: string
19
- grams: number
20
- vendor: string
21
- taxable: boolean
22
- product_id: number
23
- product_has_only_default_variant: boolean
24
- gift_card: boolean
25
- final_price: number
26
- final_line_price: number
27
- url: string
28
- featured_image: {
29
- aspect_ratio: number
30
- alt: string
31
- height: number
32
- url: string
33
- width: number
34
- }
35
- image: string
36
- handle: string
37
- requires_shipping: boolean
38
- product_type: string
39
- product_title: string
40
- product_description: string
41
- variant_title: string
42
- variant_options: string[]
43
- options_with_values: [{
44
- name: string
45
- value: string
46
- }]
47
- line_level_discount_allocations: any[]
48
- line_level_total_discount: number
49
- }
package/type/Option.ts DELETED
@@ -1,7 +0,0 @@
1
- export default interface Option {
2
- id: number
3
- product_id: number
4
- name: string
5
- position: number
6
- values: string[]
7
- }
package/type/Product.ts DELETED
@@ -1,22 +0,0 @@
1
- import Variant from './Variant';
2
- import Option from './Option';
3
- import ProductImage from './ProductImage';
4
-
5
- export default interface Product {
6
- id: number
7
- title: string
8
- body_html: string
9
- vendor: string
10
- product_type: string
11
- created_at: string
12
- handle: string
13
- updated_at: string
14
- published_at: string
15
- template_suffix: string
16
- published_scope: string
17
- tags: string
18
- variants: Variant[]
19
- options: Option[]
20
- images: ProductImage[]
21
- image: ProductImage
22
- }
@@ -1,10 +0,0 @@
1
- import Image from './Image';
2
-
3
- export default interface ProductImage extends Image {
4
- product_id: number
5
- position: number
6
- updated_at: string
7
- width: number
8
- height: number
9
- variant_ids: number[]
10
- }
package/type/Variant.ts DELETED
@@ -1,23 +0,0 @@
1
- export default interface Variant {
2
- id: number
3
- product_id: number
4
- title: string
5
- price: string
6
- sku: string
7
- position: number
8
- compare_at_price: string
9
- fulfillment_service: string
10
- inventory_management: string
11
- option1: string | null
12
- option2: string | null
13
- option3: string | null
14
- created_at: string
15
- updated_at: string
16
- taxable: boolean
17
- barcode: string
18
- grams: number
19
- image_id: number | null
20
- weight: number
21
- weight_unit: 'g' | 'kg'
22
- requires_shipping: boolean
23
- }
@@ -1,18 +0,0 @@
1
- import Image from './Image';
2
-
3
- export default interface Article {
4
- id: number
5
- title: string
6
- created_at: string
7
- body_html: string
8
- blog_id: number
9
- author: string
10
- user_id: number
11
- published_at: string
12
- updated_at: string
13
- summary_html: string
14
- template_suffix: string
15
- handle: string
16
- tags: string
17
- image: Image
18
- }
@@ -1,17 +0,0 @@
1
- import Image from './Image';
2
- import Rule from './Rule';
3
-
4
- export default interface Collection {
5
- id: number
6
- handle: string
7
- title: string
8
- updated_at: string
9
- body_html: string
10
- published_at: string
11
- sort_order: string
12
- template_suffix: string
13
- disjunctive?: boolean
14
- rules?: Rule[]
15
- published_scope: string
16
- image?: Image
17
- }
@@ -1,8 +0,0 @@
1
- import PreviewImage from './PreviewImage';
2
-
3
- export default interface FeaturedMedia {
4
- alt: string | null
5
- id: number
6
- position: number
7
- preview_image: PreviewImage
8
- }
@@ -1,7 +0,0 @@
1
- export default interface Image {
2
- created_at: string
3
- alt: string | null
4
- width: number
5
- height: number
6
- src: string
7
- }
@@ -1,13 +0,0 @@
1
- import PreviewImage from './PreviewImage';
2
-
3
- export default interface Media {
4
- alt: string | null
5
- id: number
6
- position: number
7
- preview_image: PreviewImage
8
- aspect_ratio: number
9
- height: number
10
- media_type: string
11
- src: string
12
- width: number
13
- }
@@ -1,6 +0,0 @@
1
- export default interface PreviewImage {
2
- aspect_ratio: number
3
- height: number
4
- width: number
5
- src: string
6
- }
@@ -1,29 +0,0 @@
1
- import Variant from './Variant';
2
- import Media from './Media';
3
-
4
- export default interface Product {
5
- id: number
6
- title: string
7
- handle: string
8
- description: string
9
- published_at: string
10
- created_at: string
11
- vendor: string
12
- type: string
13
- tags: string[]
14
- price: number
15
- price_min: number
16
- price_max: number
17
- available: boolean
18
- price_varies: boolean
19
- compare_at_price: string | null
20
- compare_at_price_min: number
21
- compare_at_price_max: number
22
- compare_at_price_varies: boolean
23
- variants: Variant[]
24
- images: string[]
25
- featured_image: string | null
26
- options: string[]
27
- media: Media[]
28
- content: string
29
- }
@@ -1,5 +0,0 @@
1
- export default interface Rule {
2
- column: string
3
- relation: string
4
- condition: string
5
- }
@@ -1,24 +0,0 @@
1
- import FeaturedImage from '../search/FeaturedImage';
2
- import FeaturedMedia from './FeaturedMedia';
3
-
4
- export default interface Variant {
5
- id: number
6
- title: string
7
- option1: string | null
8
- option2: string | null
9
- option3: string | null
10
- sku: string | null
11
- requires_shipping: boolean
12
- taxable: boolean
13
- featured_image?: FeaturedImage
14
- featured_media?: FeaturedMedia
15
- available: boolean
16
- name: string
17
- public_title: string | null
18
- options: string[]
19
- price: number
20
- weight: number
21
- compare_at_price: number | null
22
- inventory_management: string
23
- barcode: string | null
24
- }
@@ -1,12 +0,0 @@
1
- import Item from './Item';
2
- import FeaturedImage from './FeaturedImage';
3
-
4
- export default interface Article extends Item {
5
- author: string
6
- image: string | null
7
- published_at: string
8
- summary_html: string
9
- tags: string[]
10
- title: string
11
- featured_image: FeaturedImage
12
- }
@@ -1,7 +0,0 @@
1
- import Item from './Item';
2
- import FeaturedImage from './FeaturedImage';
3
-
4
- export default interface Collection extends Item {
5
- published_at: string
6
- featured_image: FeaturedImage
7
- }
@@ -1,7 +0,0 @@
1
- export default interface FeaturedImage {
2
- alt: string | null
3
- aspect_ratio: number | null
4
- height: number | null
5
- url: string | null
6
- width: number | null
7
- }
@@ -1,7 +0,0 @@
1
- export default interface Item {
2
- id: number
3
- handle: string
4
- url: string
5
- title: string
6
- body: string
7
- }
@@ -1,6 +0,0 @@
1
- import Item from './Item';
2
-
3
- export default interface Page extends Item {
4
- author: null
5
- published_at: string
6
- }
@@ -1,17 +0,0 @@
1
- import Item from './Item';
2
- import FeaturedImage from './FeaturedImage';
3
-
4
- export default interface Product extends Item {
5
- available: boolean
6
- compare_at_price_max: string
7
- compare_at_price_min: string
8
- image: string | null
9
- price: string
10
- price_max: string
11
- price_min: string
12
- tags: string[]
13
- type: string
14
- variants: []
15
- vendor: string
16
- featured_image: FeaturedImage
17
- }
@@ -1,13 +0,0 @@
1
- import Collection from './Collection';
2
- import Page from './Page';
3
- import Product from './Product';
4
-
5
- export default interface Result {
6
- resources: {
7
- results: {
8
- collections?: Collection[]
9
- pages?: Page[]
10
- products?: Product[]
11
- }
12
- }
13
- }