@swishapp/sdk 0.113.0 → 0.119.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.
- package/dist/ajax-api/ajax-api-client.d.ts +25 -1
- package/dist/ajax-api/ajax-api-publisher.d.ts +1 -2
- package/dist/events/event-bus.d.ts +1 -1
- package/dist/intents/handlers/open-list-handler.d.ts +1 -0
- package/dist/intents/handlers/open-list-menu-handler.d.ts +6 -2
- package/dist/intents/handlers/save-cart-line-handler.d.ts +16 -0
- package/dist/intents/hooks/after-save-cart-line-hook.d.ts +5 -0
- package/dist/intents/intents.d.ts +9 -0
- package/dist/intents/types.d.ts +5 -2
- package/dist/options/swish-options.d.ts +8 -4
- package/dist/options/types.d.ts +42 -16
- package/dist/storefront-api/load-product-images.d.ts +2 -2
- package/dist/storefront-api/load-product.d.ts +76 -0
- package/dist/storefront-api/queries/fragments.d.ts +1 -5
- package/dist/storefront-api/queries/index.d.ts +2 -10
- package/dist/storefront-api/storefront-api-client.d.ts +61 -27
- package/dist/storefront-api/types/storefront.generated.d.ts +186 -376
- package/dist/storefront-api/types/storefront.types.d.ts +174 -36
- package/dist/swish-api/swish-api-client.d.ts +69 -17
- package/dist/swish-ui/swish-ui.d.ts +7 -6
- package/dist/swish-ui/types.d.ts +4 -0
- package/dist/swish.d.ts +11 -4
- package/dist/swish.js +93 -246
- package/dist/types.d.ts +3 -1
- package/package.json +23 -23
- package/dist/storefront-api/load-product-card-data.d.ts +0 -17
- package/dist/storefront-api/load-product-detail-data.d.ts +0 -17
- package/dist/storefront-api/load-product-options.d.ts +0 -16
- package/dist/storefront-api/load-selected-variant.d.ts +0 -16
|
@@ -61,13 +61,37 @@ export interface AddToCartRequest {
|
|
|
61
61
|
export interface AddToCartResponse {
|
|
62
62
|
items: CartLineItem[];
|
|
63
63
|
}
|
|
64
|
+
export interface CartChangeItem {
|
|
65
|
+
product_id: number;
|
|
66
|
+
variant_id: number;
|
|
67
|
+
id: string;
|
|
68
|
+
image: string;
|
|
69
|
+
price: string;
|
|
70
|
+
presentment_price: number;
|
|
71
|
+
quantity: number;
|
|
72
|
+
title: string;
|
|
73
|
+
product_title: string;
|
|
74
|
+
variant_title: string;
|
|
75
|
+
vendor: string;
|
|
76
|
+
product_type: string;
|
|
77
|
+
sku: string;
|
|
78
|
+
url: string;
|
|
79
|
+
untranslated_product_title: string;
|
|
80
|
+
untranslated_variant_title: string;
|
|
81
|
+
view_key: string;
|
|
82
|
+
}
|
|
83
|
+
export interface CartChangeResponse extends Cart {
|
|
84
|
+
items_added: CartChangeItem[];
|
|
85
|
+
items_removed: CartChangeItem[];
|
|
86
|
+
discount_codes: any[];
|
|
87
|
+
}
|
|
64
88
|
export interface CartError {
|
|
65
89
|
message: string;
|
|
66
90
|
status: string;
|
|
67
91
|
description: string;
|
|
68
92
|
}
|
|
69
93
|
export declare class AjaxApiClient {
|
|
70
|
-
private config;
|
|
94
|
+
private readonly config;
|
|
71
95
|
private readonly cache;
|
|
72
96
|
constructor(config: AjaxConfig);
|
|
73
97
|
patchFetch(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EventName = "cart-add" | "cart-update" | "cart-change" | "cart-clear" | "item-create" | "item-update" | "item-delete" | "item-lists-update" | "list-create" | "list-update" | "list-delete" | "token-update";
|
|
1
|
+
export type EventName = "cart-add" | "cart-update" | "cart-change" | "cart-clear" | "item-create" | "item-update" | "item-delete" | "item-lists-update" | "list-create" | "list-update" | "list-delete" | "notification-update" | "notification-delete" | "token-update";
|
|
2
2
|
export declare class EventBus {
|
|
3
3
|
private readonly eventBus;
|
|
4
4
|
subscribe(type: EventName | EventName[], callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): () => void;
|
|
@@ -3,6 +3,7 @@ import { IntentHandler } from "../intent-handler";
|
|
|
3
3
|
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
4
4
|
export declare const OpenListIntentDataSchema: v.ObjectSchema<{
|
|
5
5
|
readonly listId: v.StringSchema<undefined>;
|
|
6
|
+
readonly listType: v.OptionalSchema<v.PicklistSchema<NonNullable<"user" | "smart" | "shared" | undefined>[], undefined>, "user">;
|
|
6
7
|
}, undefined>;
|
|
7
8
|
export type OpenListIntentData = v.InferInput<typeof OpenListIntentDataSchema>;
|
|
8
9
|
export type OpenListSuccessResponse = SuccessIntentResponse<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { IntentHandler } from "../intent-handler";
|
|
3
|
-
import { IntentResponse } from "../types";
|
|
3
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
4
4
|
import { DeleteListSuccessResponse } from "./delete-list-handler";
|
|
5
5
|
import { EditListAccessSuccessResponse } from "./edit-list-access-handler";
|
|
6
6
|
import { EditListSuccessResponse } from "./edit-list-handler";
|
|
@@ -9,7 +9,11 @@ export declare const OpenListMenuIntentDataSchema: v.ObjectSchema<{
|
|
|
9
9
|
readonly listId: v.StringSchema<undefined>;
|
|
10
10
|
}, undefined>;
|
|
11
11
|
export type OpenListMenuIntentData = v.InferInput<typeof OpenListMenuIntentDataSchema>;
|
|
12
|
-
|
|
12
|
+
type AddItemsSuccessResponse = SuccessIntentResponse<{
|
|
13
|
+
listId: string;
|
|
14
|
+
}>;
|
|
15
|
+
export type OpenListMenuSuccessResponse = EditListSuccessResponse | DeleteListSuccessResponse | EditListAccessSuccessResponse | AddItemsSuccessResponse | ShareListSuccessResponse;
|
|
13
16
|
export declare class OpenListMenuHandler extends IntentHandler<"open:list-menu" | "edit:list" | "delete:list" | "edit:list-access" | "initiate:share"> {
|
|
14
17
|
invoke(data: OpenListMenuIntentData): Promise<IntentResponse<"open:list-menu" | "edit:list" | "delete:list" | "edit:list-access" | "initiate:share">>;
|
|
15
18
|
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IntentHandler } from "../intent-handler";
|
|
2
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
3
|
+
export interface SaveCartLineIntentData {
|
|
4
|
+
items: Array<{
|
|
5
|
+
productId: number;
|
|
6
|
+
variantId: number;
|
|
7
|
+
quantity: number;
|
|
8
|
+
title?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
variantTitle?: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export type SaveCartLineSuccessResponse = SuccessIntentResponse<SaveCartLineIntentData["items"], "save:cart-line">;
|
|
14
|
+
export declare class SaveCartLineHandler extends IntentHandler<"save:cart-line"> {
|
|
15
|
+
invoke(data: SaveCartLineIntentData): Promise<IntentResponse<"save:cart-line">>;
|
|
16
|
+
}
|
|
@@ -19,6 +19,14 @@ export interface IntentOptions {
|
|
|
19
19
|
createCartLine: {
|
|
20
20
|
afterComplete?: (response: IntentResponse<"create:cart-line">) => void;
|
|
21
21
|
};
|
|
22
|
+
removeCartLine: {
|
|
23
|
+
saveCartLine: boolean;
|
|
24
|
+
};
|
|
25
|
+
saveCartLine: {
|
|
26
|
+
confirm: boolean;
|
|
27
|
+
showFeedback: boolean;
|
|
28
|
+
afterComplete?: (response: IntentResponse<"save:cart-line">) => void;
|
|
29
|
+
};
|
|
22
30
|
}
|
|
23
31
|
export declare class Intents {
|
|
24
32
|
private readonly swish;
|
|
@@ -37,5 +45,6 @@ export declare class Intents {
|
|
|
37
45
|
parseIntentFromHash(hash: string): Intent | null;
|
|
38
46
|
handleIntent<I extends Intent>(intent: I, data: IntentToData<I>): Promise<IntentResponse<I>>;
|
|
39
47
|
initIntentHooks(): void;
|
|
48
|
+
private initCartChangeListener;
|
|
40
49
|
initIntentWatcher(): void;
|
|
41
50
|
}
|
package/dist/intents/types.d.ts
CHANGED
|
@@ -21,12 +21,13 @@ import type { OpenQuickBuyIntentData, OpenQuickBuySuccessResponse } from "./hand
|
|
|
21
21
|
import { OpenSavesSuccessResponse } from "./handlers/open-saves-handler";
|
|
22
22
|
import type { OpenSignInIntentData, OpenSignInSuccessResponse } from "./handlers/open-sign-in-handler";
|
|
23
23
|
import type { InitiateSignInIntentData, InitiateSignInSuccessResponse } from "./handlers/initiate-sign-in-handler";
|
|
24
|
+
import type { SaveCartLineIntentData, SaveCartLineSuccessResponse } from "./handlers/save-cart-line-handler";
|
|
24
25
|
import type { SaveItemIntentData, SaveItemSuccessResponse } from "./handlers/save-item-handler";
|
|
25
26
|
import type { ShareListIntentData, ShareListSuccessResponse } from "./handlers/share-list-handler";
|
|
26
27
|
import { ToastIntentData, ToastSuccessResponse } from "./handlers/show-toast-handler";
|
|
27
28
|
import type { UnsaveItemIntentData, UnsaveItemSuccessResponse } from "./handlers/unsave-item-handler";
|
|
28
|
-
export type { CreateCartLineSuccessResponse, InitiateCheckoutSuccessResponse, CreateListSuccessResponse, DeleteListSuccessResponse, EditItemListsSuccessResponse, EditItemVariantSuccessResponse, EditListAccessSuccessResponse, EditListSuccessResponse, SaveItemSuccessResponse, ShareListSuccessResponse, ToastSuccessResponse, UnsaveItemSuccessResponse, };
|
|
29
|
-
export type Intent = "create:cart-line" | "initiate:checkout" | "save:item" | "edit:item-variant" | "edit:item-lists" | "unsave:item" | "edit:list" | "edit:list-access" | "delete:list" | "create:list" | "initiate:share" | "open:home" | "open:list" | "open:lists" | "open:orders" | "open:order" | "open:saves" | "open:notifications" | "open:profile" | "open:product" | "open:list-menu" | "open:order-menu" | "open:list-detail-page-menu" | "initiate:sign-in" | "open:sign-in" | "open:quick-buy" | "show:toast";
|
|
29
|
+
export type { CreateCartLineSuccessResponse, InitiateCheckoutSuccessResponse, CreateListSuccessResponse, DeleteListSuccessResponse, EditItemListsSuccessResponse, EditItemVariantSuccessResponse, EditListAccessSuccessResponse, EditListSuccessResponse, SaveCartLineSuccessResponse, SaveItemSuccessResponse, ShareListSuccessResponse, ToastSuccessResponse, UnsaveItemSuccessResponse, };
|
|
30
|
+
export type Intent = "create:cart-line" | "initiate:checkout" | "save:item" | "edit:item-variant" | "edit:item-lists" | "unsave:item" | "edit:list" | "edit:list-access" | "delete:list" | "create:list" | "initiate:share" | "open:home" | "open:list" | "open:lists" | "open:orders" | "open:order" | "open:saves" | "open:notifications" | "open:profile" | "open:product" | "open:list-menu" | "open:order-menu" | "open:list-detail-page-menu" | "initiate:sign-in" | "open:sign-in" | "open:quick-buy" | "save:cart-line" | "show:toast";
|
|
30
31
|
export type IntentQueryParam = `${string}=${string}`;
|
|
31
32
|
export type IntentQueryWithParams = `${Intent},${IntentQueryParam}`;
|
|
32
33
|
export type IntentResponse<I extends Intent = Intent> = ClosedIntentResponse<I> | ErrorIntentResponse<I> | IntentToSuccessResponse<I>;
|
|
@@ -79,6 +80,7 @@ interface IntentDataMap {
|
|
|
79
80
|
"initiate:sign-in": InitiateSignInIntentData;
|
|
80
81
|
"open:sign-in": OpenSignInIntentData | undefined;
|
|
81
82
|
"open:quick-buy": OpenQuickBuyIntentData;
|
|
83
|
+
"save:cart-line": SaveCartLineIntentData;
|
|
82
84
|
"show:toast": ToastIntentData;
|
|
83
85
|
}
|
|
84
86
|
interface IntentSuccessResponseMap {
|
|
@@ -108,6 +110,7 @@ interface IntentSuccessResponseMap {
|
|
|
108
110
|
"initiate:sign-in": InitiateSignInSuccessResponse;
|
|
109
111
|
"open:sign-in": OpenSignInSuccessResponse;
|
|
110
112
|
"open:quick-buy": OpenQuickBuySuccessResponse;
|
|
113
|
+
"save:cart-line": SaveCartLineSuccessResponse;
|
|
111
114
|
"show:toast": ToastSuccessResponse;
|
|
112
115
|
}
|
|
113
116
|
export type IntentToData<I extends Intent> = I extends keyof IntentDataMap ? IntentDataMap[I] : never;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import type { LanguageCode as I18nLanguageCode } from "@swishapp/i18n";
|
|
1
2
|
import { IntentOptions } from "../intents/intents";
|
|
2
3
|
import { StorefrontApiOptions, SwishClientConfig } from "../swish";
|
|
3
|
-
import { StorefrontContext, SwishFeaturesOptions,
|
|
4
|
+
import { StorefrontContext, SwishFeaturesOptions, SwishOptions, SwishProductsMetafieldOptions, SwishProductTransformOptions, SwishUiOptions } from "./types";
|
|
4
5
|
export type SwishOptionsInput = {
|
|
5
6
|
storefrontApi: StorefrontApiOptions;
|
|
6
7
|
storefrontContext: StorefrontContext;
|
|
8
|
+
translations?: Record<I18nLanguageCode, Record<string, string>>;
|
|
7
9
|
swishApi?: SwishClientConfig & {
|
|
8
10
|
version: string;
|
|
9
11
|
};
|
|
10
12
|
swishUi?: SwishUiOptions;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
products?: {
|
|
14
|
+
metafields?: SwishProductsMetafieldOptions;
|
|
15
|
+
transform?: SwishProductTransformOptions;
|
|
16
|
+
};
|
|
13
17
|
features?: SwishFeaturesOptions;
|
|
14
|
-
intents?: IntentOptions
|
|
18
|
+
intents?: Partial<IntentOptions>;
|
|
15
19
|
};
|
|
16
20
|
export declare const createSwishOptions: (options: SwishOptionsInput) => SwishOptions;
|
package/dist/options/types.d.ts
CHANGED
|
@@ -1,27 +1,55 @@
|
|
|
1
|
+
import type { LanguageCode as I18nLanguageCode } from "@swishapp/i18n";
|
|
1
2
|
import { IntentOptions } from "../intents/intents";
|
|
2
3
|
import { CountryCode, LanguageCode } from "../storefront-api/types/storefront.types";
|
|
3
|
-
import {
|
|
4
|
+
import { Intent, StorefrontApiOptions, SwishClientConfig } from "../swish";
|
|
5
|
+
import type { Product, ProductVariant } from "../types";
|
|
4
6
|
export interface SwishOptions {
|
|
7
|
+
products: SwishProductsOptions;
|
|
8
|
+
translations?: Record<I18nLanguageCode, Record<string, string>>;
|
|
5
9
|
storefrontApi: StorefrontApiOptions;
|
|
6
10
|
storefrontContext: StorefrontContext;
|
|
7
|
-
swishApi: SwishClientConfig
|
|
8
|
-
version: string;
|
|
9
|
-
};
|
|
11
|
+
swishApi: SwishClientConfig;
|
|
10
12
|
swishUi: SwishUiOptions;
|
|
11
13
|
features: SwishFeaturesOptions;
|
|
12
14
|
intents: IntentOptions;
|
|
13
|
-
metafields: SwishMetafieldOptions;
|
|
14
|
-
productOptions: SwishProductOptions;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export type Badge = {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
style?: Record<string, string | number>;
|
|
20
|
+
};
|
|
21
|
+
export interface SwishProductsMetafieldOptions {
|
|
17
22
|
product: `${string}.${string}`[];
|
|
18
23
|
productVariant: `${string}.${string}`[];
|
|
19
24
|
}
|
|
20
|
-
export interface
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
export interface SwishProductTransformOptions {
|
|
26
|
+
badges?: (args: {
|
|
27
|
+
product: Product;
|
|
28
|
+
variant?: ProductVariant;
|
|
29
|
+
defaultBadges: string[];
|
|
30
|
+
}) => (string | Badge)[];
|
|
31
|
+
title?: (args: {
|
|
32
|
+
product: Product;
|
|
33
|
+
}) => string;
|
|
34
|
+
description?: (args: {
|
|
35
|
+
product: Product;
|
|
36
|
+
}) => string;
|
|
37
|
+
variantTitle?: (args: {
|
|
38
|
+
variant: ProductVariant;
|
|
39
|
+
}) => string;
|
|
40
|
+
optionValues?: (args: {
|
|
41
|
+
option: NonNullable<Product>["options"][number];
|
|
42
|
+
optionValues: NonNullable<Product>["options"][number]["optionValues"];
|
|
43
|
+
}) => NonNullable<Product>["options"][number]["optionValues"];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolved version of SwishProductTransformOptions where all properties are required.
|
|
47
|
+
* This is the type used after createSwishOptions processes the input.
|
|
48
|
+
*/
|
|
49
|
+
export type SwishProductTransformOptionsResolved = Required<SwishProductTransformOptions>;
|
|
50
|
+
export interface SwishProductsOptions {
|
|
51
|
+
metafields: SwishProductsMetafieldOptions;
|
|
52
|
+
transform: SwishProductTransformOptionsResolved;
|
|
25
53
|
}
|
|
26
54
|
export interface SwishUiDesignOptions {
|
|
27
55
|
appearance?: {
|
|
@@ -91,7 +119,6 @@ export interface SwishUiOptions {
|
|
|
91
119
|
components: SwishComponentOptions;
|
|
92
120
|
css: (string | URL)[];
|
|
93
121
|
design: SwishUiDesignOptions;
|
|
94
|
-
version: string;
|
|
95
122
|
}
|
|
96
123
|
export interface SwishFeaturesOptions {
|
|
97
124
|
accounts: boolean;
|
|
@@ -113,9 +140,7 @@ export interface StorefrontContext {
|
|
|
113
140
|
market: string;
|
|
114
141
|
};
|
|
115
142
|
myshopifyDomain: string;
|
|
116
|
-
|
|
117
|
-
newCustomerAccounts: boolean;
|
|
118
|
-
};
|
|
143
|
+
newCustomerAccounts: boolean;
|
|
119
144
|
routes: {
|
|
120
145
|
accountUrl: string;
|
|
121
146
|
rootUrl: string;
|
|
@@ -169,6 +194,7 @@ export interface SwishDrawerNavigationItem {
|
|
|
169
194
|
export interface SwishDrawerNavigationOptions {
|
|
170
195
|
enabled: boolean;
|
|
171
196
|
variant: SwishDrawerNavigationVariant;
|
|
197
|
+
showIcons: boolean;
|
|
172
198
|
items: SwishDrawerNavigationItem[];
|
|
173
199
|
}
|
|
174
200
|
export interface SwishDrawerMiniMenuItem {
|
|
@@ -16,8 +16,8 @@ export interface LoadProductImagesArgs {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const loadProductImages: (client: StorefrontApiClient, { items, country, language }: LoadProductImagesArgs) => Promise<{
|
|
18
18
|
data: (Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash"> | undefined)[];
|
|
19
|
-
|
|
19
|
+
errors: null;
|
|
20
20
|
} | {
|
|
21
21
|
data: null;
|
|
22
|
-
|
|
22
|
+
errors: Error;
|
|
23
23
|
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { StorefrontApiClient, StorefrontApiResponse } from "./storefront-api-client";
|
|
2
|
+
import type { CountryCode, HasMetafieldsIdentifier, LanguageCode } from "./types/storefront.types";
|
|
3
|
+
import type { Product, ProductVariant } from "../types";
|
|
4
|
+
export type LoadProductResponse = StorefrontApiResponse<{
|
|
5
|
+
product: Product | null;
|
|
6
|
+
variant: ProductVariant | null;
|
|
7
|
+
}>;
|
|
8
|
+
export type { GetProductQueryVariables } from "./types/storefront.generated";
|
|
9
|
+
export interface LoadProductArgs {
|
|
10
|
+
productId?: string;
|
|
11
|
+
productHandle?: string;
|
|
12
|
+
variantId?: string;
|
|
13
|
+
selectedOptions?: {
|
|
14
|
+
name: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
productMetafields?: HasMetafieldsIdentifier[];
|
|
18
|
+
variantMetafields?: HasMetafieldsIdentifier[];
|
|
19
|
+
country: CountryCode;
|
|
20
|
+
language: LanguageCode;
|
|
21
|
+
}
|
|
22
|
+
export declare const loadProduct: (client: StorefrontApiClient, { productId, productHandle, variantId, selectedOptions, productMetafields, variantMetafields, country, language, }: LoadProductArgs) => Promise<{
|
|
23
|
+
data: {
|
|
24
|
+
product: (Pick<import("./types/storefront.types").Product, "title" | "id" | "availableForSale" | "description" | "descriptionHtml" | "encodedVariantAvailability" | "encodedVariantExistence" | "handle" | "isGiftCard" | "onlineStoreUrl" | "productType" | "tags"> & {
|
|
25
|
+
variant?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductVariant, "id" | "availableForSale" | "currentlyNotInStock" | "sku" | "title"> & {
|
|
26
|
+
compareAtPrice?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">>;
|
|
27
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
28
|
+
price: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
29
|
+
selectedOptions: Array<Pick<import("./types/storefront.types").SelectedOption, "name" | "value">>;
|
|
30
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
31
|
+
}>;
|
|
32
|
+
category?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").TaxonomyCategory, "id" | "name">>;
|
|
33
|
+
compareAtPriceRange: {
|
|
34
|
+
maxVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
35
|
+
minVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
36
|
+
};
|
|
37
|
+
featuredImage?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
38
|
+
images: {
|
|
39
|
+
nodes: Array<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
40
|
+
};
|
|
41
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
42
|
+
selectedOrFirstAvailableVariant?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductVariant, "id" | "availableForSale" | "currentlyNotInStock" | "sku" | "title"> & {
|
|
43
|
+
compareAtPrice?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">>;
|
|
44
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
45
|
+
price: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
46
|
+
selectedOptions: Array<Pick<import("./types/storefront.types").SelectedOption, "name" | "value">>;
|
|
47
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
48
|
+
}>;
|
|
49
|
+
options: Array<Pick<import("./types/storefront.types").ProductOption, "id" | "name"> & {
|
|
50
|
+
optionValues: Array<Pick<import("./types/storefront.types").ProductOptionValue, "name"> & {
|
|
51
|
+
swatch?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductOptionValueSwatch, "color"> & {
|
|
52
|
+
image?: import("./types/storefront.types").Maybe<{
|
|
53
|
+
previewImage?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "url">>;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
firstSelectableVariant?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductVariant, "id"> & {
|
|
57
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
}>;
|
|
61
|
+
priceRange: {
|
|
62
|
+
maxVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
63
|
+
minVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
64
|
+
};
|
|
65
|
+
variantsCount?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Count, "count" | "precision">>;
|
|
66
|
+
}) | null;
|
|
67
|
+
variant: (Pick<import("./types/storefront.types").ProductVariant, "title" | "id" | "availableForSale" | "currentlyNotInStock" | "sku"> & {
|
|
68
|
+
compareAtPrice?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">>;
|
|
69
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
70
|
+
price: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
71
|
+
selectedOptions: Array<Pick<import("./types/storefront.types").SelectedOption, "name" | "value">>;
|
|
72
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
73
|
+
}) | null;
|
|
74
|
+
};
|
|
75
|
+
errors: import("@shopify/graphql-client").ResponseErrors | null;
|
|
76
|
+
}>;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export declare const PRODUCT_IMAGE_FIELDS = "\n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n";
|
|
2
2
|
export declare const SAVE_INTENT_DATA_FIELDS = "\n fragment saveIntentProductFields on Product {\n id\n availableForSale\n featuredImage {\n ...productImageFields\n }\n handle\n title\n variantsCount {\n count\n }\n selectedOrFirstAvailableVariant {\n ...saveIntentVariantFields\n }\n }\n fragment saveIntentVariantFields on ProductVariant {\n id\n availableForSale\n currentlyNotInStock\n image {\n ...productImageFields\n }\n title\n }\n";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const PRODUCT_FIELDS = "\n fragment productFields on Product {\n id\n availableForSale\n category {\n id\n name\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n description\n descriptionHtml\n encodedVariantAvailability\n encodedVariantExistence\n featuredImage {\n ...productImageFields\n }\n handle\n images(first: 20) {\n nodes {\n ...productImageFields\n }\n }\n isGiftCard\n metafields(identifiers: $productMetafields) {\n key\n namespace\n value\n }\n onlineStoreUrl\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions) {\n ...productVariantDataFields\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n productType\n tags\n title\n variantsCount {\n count\n precision\n }\n # totalInventory\n }\n";
|
|
4
4
|
export declare const PRODUCT_VARIANT_DATA_FIELDS = "\n fragment productVariantDataFields on ProductVariant {\n id\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n currentlyNotInStock\n image {\n ...productImageFields\n }\n price {\n amount\n currencyCode\n }\n # quantityAvailable\n selectedOptions {\n name\n value\n }\n sku\n title\n metafields(identifiers: $variantMetafields) {\n key\n namespace\n value\n }\n }\n";
|
|
5
|
-
export declare const PRODUCT_OPTIONS_VARIANT_FIELDS = "\n fragment productOptionsVariantFields on ProductVariant {\n id\n selectedOptions {\n name\n value\n }\n }\n";
|
|
6
|
-
export declare const SELECTED_VARIANT_FIELDS = "\n fragment selectedVariantFields on Product {\n id\n availableForSale\n title\n handle\n featuredImage {\n ...productImageFields\n }\n variantBySelectedOptions(selectedOptions: $selectedOptions) {\n id\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n currentlyNotInStock\n image {\n ...productImageFields\n }\n price {\n amount\n currencyCode\n }\n title\n selectedOptions {\n name\n value\n }\n }\n }\n";
|
|
7
|
-
export declare const PRODUCT_OPTIONS_FIELDS = "\n fragment productOptionsFields on Product {\n id\n availableForSale\n title\n featuredImage {\n ...productImageFields\n }\n encodedVariantAvailability\n encodedVariantExistence\n variantsCount {\n count\n precision\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n }\n";
|
|
8
|
-
export declare const PRODUCT_IMAGES_FIELDS = "\n fragment productImagesFields on Product {\n images(first: 20) {\n nodes {\n ...productImageFields\n }\n }\n }\n";
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
export declare const GET_SAVE_INTENT_DATA_BY_ID = "\n query GetSaveIntentData(\n $productId: ID!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...saveIntentProductFields\n }\n }\n \n fragment saveIntentProductFields on Product {\n id\n availableForSale\n featuredImage {\n ...productImageFields\n }\n handle\n title\n variantsCount {\n count\n }\n selectedOrFirstAvailableVariant {\n ...saveIntentVariantFields\n }\n }\n fragment saveIntentVariantFields on ProductVariant {\n id\n availableForSale\n currentlyNotInStock\n image {\n ...productImageFields\n }\n title\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
2
2
|
export declare const GET_SAVE_INTENT_DATA_BY_ID_WITH_VARIANT = "\n query GetSaveIntentDataWithVariant(\n $productId: ID!\n $variantId: ID!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...saveIntentProductFields\n }\n variant: node(id: $variantId) {\n ...saveIntentVariantFields\n }\n }\n \n fragment saveIntentProductFields on Product {\n id\n availableForSale\n featuredImage {\n ...productImageFields\n }\n handle\n title\n variantsCount {\n count\n }\n selectedOrFirstAvailableVariant {\n ...saveIntentVariantFields\n }\n }\n fragment saveIntentVariantFields on ProductVariant {\n id\n availableForSale\n currentlyNotInStock\n image {\n ...productImageFields\n }\n title\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const GET_PRODUCT_OPTIONS_BY_ID = "\n query GetProductOptions(\n $productId: ID!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...productOptionsFields\n }\n }\n \n fragment productOptionsFields on Product {\n id\n availableForSale\n title\n featuredImage {\n ...productImageFields\n }\n encodedVariantAvailability\n encodedVariantExistence\n variantsCount {\n count\n precision\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
6
|
-
export declare const GET_PRODUCT_OPTIONS_BY_HANDLE = "\n query GetProductOptionsByHandle(\n $handle: String!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...productOptionsFields\n }\n }\n \n fragment productOptionsFields on Product {\n id\n availableForSale\n title\n featuredImage {\n ...productImageFields\n }\n encodedVariantAvailability\n encodedVariantExistence\n variantsCount {\n count\n precision\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
7
|
-
export declare const GET_PRODUCT_OPTIONS_BY_ID_WITH_VARIANT = "\n query GetProductOptionsWithVariant(\n $productId: ID!\n $variantId: ID!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...productOptionsFields\n }\n variant: node(id: $variantId) {\n ...productOptionsVariantFields\n }\n }\n \n fragment productOptionsFields on Product {\n id\n availableForSale\n title\n featuredImage {\n ...productImageFields\n }\n encodedVariantAvailability\n encodedVariantExistence\n variantsCount {\n count\n precision\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n }\n\n \n fragment productOptionsVariantFields on ProductVariant {\n id\n selectedOptions {\n name\n value\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
8
|
-
export declare const GET_PRODUCT_OPTIONS_BY_HANDLE_WITH_VARIANT = "\n query GetProductOptionsByHandleWithVariant(\n $handle: String!\n $variantId: ID!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...productOptionsFields\n }\n variant: node(id: $variantId) {\n ...productOptionsVariantFields\n }\n }\n \n fragment productOptionsFields on Product {\n id\n availableForSale\n title\n featuredImage {\n ...productImageFields\n }\n encodedVariantAvailability\n encodedVariantExistence\n variantsCount {\n count\n precision\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n }\n\n \n fragment productOptionsVariantFields on ProductVariant {\n id\n selectedOptions {\n name\n value\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
9
|
-
export declare const GET_SELECTED_VARIANT = "\n query GetSelectedVariant(\n $productId: ID!\n $selectedOptions: [SelectedOptionInput!]!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...selectedVariantFields\n }\n }\n \n fragment selectedVariantFields on Product {\n id\n availableForSale\n title\n handle\n featuredImage {\n ...productImageFields\n }\n variantBySelectedOptions(selectedOptions: $selectedOptions) {\n id\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n currentlyNotInStock\n image {\n ...productImageFields\n }\n price {\n amount\n currencyCode\n }\n title\n selectedOptions {\n name\n value\n }\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
10
|
-
export declare const GET_SELECTED_VARIANT_BY_HANDLE = "\n query GetSelectedVariantByHandle(\n $handle: String!\n $selectedOptions: [SelectedOptionInput!]!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...selectedVariantFields\n }\n }\n \n fragment selectedVariantFields on Product {\n id\n availableForSale\n title\n handle\n featuredImage {\n ...productImageFields\n }\n variantBySelectedOptions(selectedOptions: $selectedOptions) {\n id\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n currentlyNotInStock\n image {\n ...productImageFields\n }\n price {\n amount\n currencyCode\n }\n title\n selectedOptions {\n name\n value\n }\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
11
|
-
export declare const GET_PRODUCT_DETAIL_DATA_BY_ID = "\n query GetProductDetailData(\n $productId: ID!\n $productMetafields: [HasMetafieldsIdentifier!]!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...productCardDataFields\n ...productOptionsFields\n ...productImagesFields\n }\n }\n \n fragment productCardDataFields on Product {\n id\n availableForSale\n category {\n id\n name\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n ...productImageFields\n }\n isGiftCard\n onlineStoreUrl\n description\n descriptionHtml\n handle\n options {\n id\n name\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n productType\n tags\n title\n variantsCount {\n count\n }\n # totalInventory\n metafields(identifiers: $productMetafields) {\n key\n namespace\n value\n }\n }\n\n \n fragment productOptionsFields on Product {\n id\n availableForSale\n title\n featuredImage {\n ...productImageFields\n }\n encodedVariantAvailability\n encodedVariantExistence\n variantsCount {\n count\n precision\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n }\n\n \n fragment productImagesFields on Product {\n images(first: 20) {\n nodes {\n ...productImageFields\n }\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
12
|
-
export declare const GET_PRODUCT_DETAIL_DATA_BY_ID_WITH_VARIANT = "\n query GetProductDetailDataWithVariant(\n $productId: ID!\n $variantId: ID!\n $productMetafields: [HasMetafieldsIdentifier!]!\n $variantMetafields: [HasMetafieldsIdentifier!]!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...productCardDataFields\n ...productOptionsFields\n ...productImagesFields\n }\n variant: node(id: $variantId) {\n ...productVariantDataFields\n }\n }\n \n fragment productCardDataFields on Product {\n id\n availableForSale\n category {\n id\n name\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n ...productImageFields\n }\n isGiftCard\n onlineStoreUrl\n description\n descriptionHtml\n handle\n options {\n id\n name\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n productType\n tags\n title\n variantsCount {\n count\n }\n # totalInventory\n metafields(identifiers: $productMetafields) {\n key\n namespace\n value\n }\n }\n\n \n fragment productOptionsFields on Product {\n id\n availableForSale\n title\n featuredImage {\n ...productImageFields\n }\n encodedVariantAvailability\n encodedVariantExistence\n variantsCount {\n count\n precision\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n }\n\n \n fragment productVariantDataFields on ProductVariant {\n id\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n currentlyNotInStock\n image {\n ...productImageFields\n }\n price {\n amount\n currencyCode\n }\n # quantityAvailable\n selectedOptions {\n name\n value\n }\n sku\n title\n metafields(identifiers: $variantMetafields) {\n key\n namespace\n value\n }\n }\n\n \n fragment productImagesFields on Product {\n images(first: 20) {\n nodes {\n ...productImageFields\n }\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
3
|
+
export declare const GET_PRODUCT_BY_ID = "\n query GetProduct(\n $productId: ID!\n $variantId: ID!\n $selectedOptions: [SelectedOptionInput!]!\n $productMetafields: [HasMetafieldsIdentifier!]!\n $variantMetafields: [HasMetafieldsIdentifier!]!\n $includeVariantById: Boolean!\n $includeVariantBySelectedOptions: Boolean!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(id: $productId) {\n ...productFields\n variant: variantBySelectedOptions(selectedOptions: $selectedOptions)\n @include(if: $includeVariantBySelectedOptions) {\n ...productVariantDataFields\n }\n }\n variantNode: node(id: $variantId) @include(if: $includeVariantById) {\n ... on ProductVariant {\n ...productVariantDataFields\n }\n }\n }\n \n fragment productFields on Product {\n id\n availableForSale\n category {\n id\n name\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n description\n descriptionHtml\n encodedVariantAvailability\n encodedVariantExistence\n featuredImage {\n ...productImageFields\n }\n handle\n images(first: 20) {\n nodes {\n ...productImageFields\n }\n }\n isGiftCard\n metafields(identifiers: $productMetafields) {\n key\n namespace\n value\n }\n onlineStoreUrl\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions) {\n ...productVariantDataFields\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n productType\n tags\n title\n variantsCount {\n count\n precision\n }\n # totalInventory\n }\n\n \n fragment productVariantDataFields on ProductVariant {\n id\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n currentlyNotInStock\n image {\n ...productImageFields\n }\n price {\n amount\n currencyCode\n }\n # quantityAvailable\n selectedOptions {\n name\n value\n }\n sku\n title\n metafields(identifiers: $variantMetafields) {\n key\n namespace\n value\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
4
|
+
export declare const GET_PRODUCT_BY_HANDLE = "\n query GetProductByHandle(\n $handle: String!\n $variantId: ID!\n $selectedOptions: [SelectedOptionInput!]!\n $productMetafields: [HasMetafieldsIdentifier!]!\n $variantMetafields: [HasMetafieldsIdentifier!]!\n $includeVariantById: Boolean!\n $includeVariantBySelectedOptions: Boolean!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n product(handle: $handle) {\n ...productFields\n variant: variantBySelectedOptions(selectedOptions: $selectedOptions)\n @include(if: $includeVariantBySelectedOptions) {\n ...productVariantDataFields\n }\n }\n variantNode: node(id: $variantId) @include(if: $includeVariantById) {\n ... on ProductVariant {\n ...productVariantDataFields\n }\n }\n }\n \n fragment productFields on Product {\n id\n availableForSale\n category {\n id\n name\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n description\n descriptionHtml\n encodedVariantAvailability\n encodedVariantExistence\n featuredImage {\n ...productImageFields\n }\n handle\n images(first: 20) {\n nodes {\n ...productImageFields\n }\n }\n isGiftCard\n metafields(identifiers: $productMetafields) {\n key\n namespace\n value\n }\n onlineStoreUrl\n selectedOrFirstAvailableVariant(selectedOptions: $selectedOptions) {\n ...productVariantDataFields\n }\n options {\n id\n name\n optionValues {\n name\n swatch {\n color\n image {\n previewImage {\n url\n }\n }\n }\n firstSelectableVariant {\n id\n image {\n ...productImageFields\n }\n }\n }\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n productType\n tags\n title\n variantsCount {\n count\n precision\n }\n # totalInventory\n }\n\n \n fragment productVariantDataFields on ProductVariant {\n id\n availableForSale\n compareAtPrice {\n amount\n currencyCode\n }\n currentlyNotInStock\n image {\n ...productImageFields\n }\n price {\n amount\n currencyCode\n }\n # quantityAvailable\n selectedOptions {\n name\n value\n }\n sku\n title\n metafields(identifiers: $variantMetafields) {\n key\n namespace\n value\n }\n }\n\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
13
5
|
export declare const GET_PRODUCT_IMAGES_BY_ID = "\n query GetProductImagesById(\n $ids: [ID!]!\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n nodes(ids: $ids) {\n ... on Product {\n featuredImage {\n ...productImageFields\n }\n }\n ... on ProductVariant {\n image {\n ...productImageFields\n }\n product {\n featuredImage {\n ...productImageFields\n }\n }\n }\n }\n }\n \n fragment productImageFields on Image {\n id\n altText\n url\n thumbhash\n }\n\n";
|
|
14
6
|
export declare const GET_PRODUCT_RECOMMENDATIONS_BY_ID = "\n query GetProductRecommendationsById(\n $productId: ID!\n $intent: ProductRecommendationIntent\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n productRecommendations(productId: $productId, intent: $intent) {\n id\n }\n }\n";
|
|
15
7
|
export declare const GET_PRODUCT_RECOMMENDATIONS_BY_HANDLE = "\n query GetProductRecommendationsByHandle(\n $handle: String!\n $intent: ProductRecommendationIntent\n $country: CountryCode!\n $language: LanguageCode!\n ) @inContext(country: $country, language: $language) {\n productRecommendations(productHandle: $handle, intent: $intent) {\n id\n }\n }\n";
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import type { ResponseErrors } from "@shopify/graphql-client";
|
|
2
|
-
import { StorefrontContext,
|
|
3
|
-
import {
|
|
4
|
-
import { LoadProductDetailDataArgs } from "./load-product-detail-data";
|
|
2
|
+
import { StorefrontContext, SwishProductsMetafieldOptions } from "../options/types";
|
|
3
|
+
import { LoadProductArgs } from "./load-product";
|
|
5
4
|
import { LoadProductIdArgs } from "./load-product-id";
|
|
6
5
|
import { LoadProductImagesArgs } from "./load-product-images";
|
|
7
|
-
import { LoadProductOptionsArgs } from "./load-product-options";
|
|
8
6
|
import { LoadProductRecommendationsArgs } from "./load-product-recommendations";
|
|
9
7
|
import { LoadSaveIntentDataArgs } from "./load-save-intent-data";
|
|
10
|
-
|
|
11
|
-
export * from "./load-product-card-data";
|
|
12
|
-
export * from "./load-product-options";
|
|
8
|
+
export * from "./load-product";
|
|
13
9
|
export * from "./load-product-recommendations";
|
|
14
|
-
export * from "./load-selected-variant";
|
|
15
10
|
export * from "./types/storefront.generated";
|
|
11
|
+
export type { SelectedOptionInput } from "./types/storefront.types";
|
|
16
12
|
export interface StorefrontApiResponse<TData> {
|
|
17
13
|
data: TData;
|
|
18
14
|
errors: ResponseErrors;
|
|
19
15
|
}
|
|
20
|
-
export declare const API_VERSION = "2026-
|
|
16
|
+
export declare const API_VERSION = "2026-04";
|
|
21
17
|
export interface StorefrontApiOptions {
|
|
22
18
|
storeDomain: string;
|
|
23
19
|
accessToken: string;
|
|
@@ -29,35 +25,73 @@ export declare class StorefrontApiClient {
|
|
|
29
25
|
private readonly options;
|
|
30
26
|
private readonly context;
|
|
31
27
|
private readonly metafields;
|
|
32
|
-
|
|
33
|
-
constructor(options: StorefrontApiOptions, context: StorefrontContext, productOptions: SwishProductOptions, metafields?: SwishMetafieldOptions);
|
|
28
|
+
constructor(options: StorefrontApiOptions, context: StorefrontContext, metafields?: SwishProductsMetafieldOptions);
|
|
34
29
|
fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
35
30
|
query: <TData, TVariables extends Record<string, unknown>>(query: string, variables: TVariables) => Promise<{
|
|
36
31
|
data: (TData extends undefined ? any : TData) | undefined;
|
|
37
32
|
errors: ResponseErrors | null;
|
|
38
33
|
}>;
|
|
39
|
-
|
|
40
|
-
data:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
34
|
+
loadProduct: (args: ArgsWithoutDefaults<LoadProductArgs>) => Promise<{
|
|
35
|
+
data: {
|
|
36
|
+
product: (Pick<import("./types/storefront.types").Product, "title" | "id" | "availableForSale" | "description" | "descriptionHtml" | "encodedVariantAvailability" | "encodedVariantExistence" | "handle" | "isGiftCard" | "onlineStoreUrl" | "productType" | "tags"> & {
|
|
37
|
+
variant?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductVariant, "id" | "availableForSale" | "currentlyNotInStock" | "sku" | "title"> & {
|
|
38
|
+
compareAtPrice?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">>;
|
|
39
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
40
|
+
price: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
41
|
+
selectedOptions: Array<Pick<import("./types/storefront.types").SelectedOption, "name" | "value">>;
|
|
42
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
43
|
+
}>;
|
|
44
|
+
category?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").TaxonomyCategory, "id" | "name">>;
|
|
45
|
+
compareAtPriceRange: {
|
|
46
|
+
maxVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
47
|
+
minVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
48
|
+
};
|
|
49
|
+
featuredImage?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
50
|
+
images: {
|
|
51
|
+
nodes: Array<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
52
|
+
};
|
|
53
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
54
|
+
selectedOrFirstAvailableVariant?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductVariant, "id" | "availableForSale" | "currentlyNotInStock" | "sku" | "title"> & {
|
|
55
|
+
compareAtPrice?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">>;
|
|
56
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
57
|
+
price: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
58
|
+
selectedOptions: Array<Pick<import("./types/storefront.types").SelectedOption, "name" | "value">>;
|
|
59
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
60
|
+
}>;
|
|
61
|
+
options: Array<Pick<import("./types/storefront.types").ProductOption, "id" | "name"> & {
|
|
62
|
+
optionValues: Array<Pick<import("./types/storefront.types").ProductOptionValue, "name"> & {
|
|
63
|
+
swatch?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductOptionValueSwatch, "color"> & {
|
|
64
|
+
image?: import("./types/storefront.types").Maybe<{
|
|
65
|
+
previewImage?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "url">>;
|
|
66
|
+
}>;
|
|
67
|
+
}>;
|
|
68
|
+
firstSelectableVariant?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").ProductVariant, "id"> & {
|
|
69
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
70
|
+
}>;
|
|
71
|
+
}>;
|
|
72
|
+
}>;
|
|
73
|
+
priceRange: {
|
|
74
|
+
maxVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
75
|
+
minVariantPrice: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
76
|
+
};
|
|
77
|
+
variantsCount?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Count, "count" | "precision">>;
|
|
78
|
+
}) | null;
|
|
79
|
+
variant: (Pick<import("./types/storefront.types").ProductVariant, "title" | "id" | "availableForSale" | "currentlyNotInStock" | "sku"> & {
|
|
80
|
+
compareAtPrice?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">>;
|
|
81
|
+
image?: import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash">>;
|
|
82
|
+
price: Pick<import("./types/storefront.types").MoneyV2, "amount" | "currencyCode">;
|
|
83
|
+
selectedOptions: Array<Pick<import("./types/storefront.types").SelectedOption, "name" | "value">>;
|
|
84
|
+
metafields: Array<import("./types/storefront.types").Maybe<Pick<import("./types/storefront.types").Metafield, "key" | "namespace" | "value">>>;
|
|
85
|
+
}) | null;
|
|
86
|
+
};
|
|
53
87
|
errors: ResponseErrors | null;
|
|
54
88
|
}>;
|
|
55
89
|
loadProductImages: (args: ArgsWithoutDefaults<LoadProductImagesArgs>) => Promise<{
|
|
56
90
|
data: (Pick<import("./types/storefront.types").Image, "id" | "altText" | "url" | "thumbhash"> | undefined)[];
|
|
57
|
-
|
|
91
|
+
errors: null;
|
|
58
92
|
} | {
|
|
59
93
|
data: null;
|
|
60
|
-
|
|
94
|
+
errors: Error;
|
|
61
95
|
}>;
|
|
62
96
|
loadProductRecommendations: (args: ArgsWithoutDefaults<LoadProductRecommendationsArgs>) => Promise<{
|
|
63
97
|
data: {
|