@swishapp/sdk 0.90.2 → 0.96.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/intents/handlers/delete-item-handler.d.ts +1 -1
- package/dist/intents/handlers/delete-list-handler.d.ts +1 -1
- package/dist/intents/handlers/edit-item-lists-handler.d.ts +1 -1
- package/dist/intents/handlers/edit-item-variant-handler.d.ts +1 -1
- package/dist/intents/handlers/edit-list-handler.d.ts +1 -1
- package/dist/intents/handlers/open-list-detail-page-menu-handler.d.ts +11 -0
- package/dist/intents/handlers/open-list-handler.d.ts +11 -0
- package/dist/intents/handlers/open-list-menu-handler.d.ts +1 -1
- package/dist/intents/handlers/open-lists-handler.d.ts +6 -0
- package/dist/intents/handlers/open-notifications-handler.d.ts +6 -0
- package/dist/intents/handlers/open-order-handler.d.ts +11 -0
- package/dist/intents/handlers/open-order-menu-handler.d.ts +11 -0
- package/dist/intents/handlers/open-orders-handler.d.ts +6 -0
- package/dist/intents/handlers/open-product-handler.d.ts +12 -0
- package/dist/intents/handlers/open-profile-handler.d.ts +6 -0
- package/dist/intents/handlers/open-quick-buy-handler.d.ts +3 -3
- package/dist/intents/handlers/open-saves-handler.d.ts +6 -0
- package/dist/intents/handlers/open-sign-in-handler.d.ts +1 -1
- package/dist/intents/handlers/{create-item-handler.d.ts → save-item-handler.d.ts} +6 -6
- package/dist/intents/handlers/show-toast-handler.d.ts +1 -1
- package/dist/intents/hooks/after-save-item-hook.d.ts +5 -0
- package/dist/intents/types.d.ts +35 -5
- package/dist/options/types.d.ts +3 -2
- package/dist/swish-api/swish-api-client.d.ts +1 -0
- package/dist/swish-ui/swish-ui.d.ts +3 -1
- package/dist/swish-ui/types.d.ts +17 -4
- package/dist/swish.js +52 -52
- package/package.json +1 -1
- package/dist/intents/hooks/after-create-item-hook.d.ts +0 -5
|
@@ -4,7 +4,7 @@ import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
|
4
4
|
export declare const DeleteItemIntentDataSchema: v.ObjectSchema<{
|
|
5
5
|
readonly itemId: v.StringSchema<undefined>;
|
|
6
6
|
}, undefined>;
|
|
7
|
-
export type DeleteItemIntentData = v.
|
|
7
|
+
export type DeleteItemIntentData = v.InferInput<typeof DeleteItemIntentDataSchema>;
|
|
8
8
|
export type DeleteItemSuccessResponse = SuccessIntentResponse<{
|
|
9
9
|
itemId: string;
|
|
10
10
|
}>;
|
|
@@ -4,7 +4,7 @@ import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
|
4
4
|
export declare const DeleteListIntentDataSchema: v.ObjectSchema<{
|
|
5
5
|
readonly listId: v.StringSchema<undefined>;
|
|
6
6
|
}, undefined>;
|
|
7
|
-
export type DeleteListIntentData = v.
|
|
7
|
+
export type DeleteListIntentData = v.InferInput<typeof DeleteListIntentDataSchema>;
|
|
8
8
|
export type DeleteListSuccessResponse = SuccessIntentResponse<{
|
|
9
9
|
listId: string;
|
|
10
10
|
}>;
|
|
@@ -13,7 +13,7 @@ export type EditItemListsSuccessResponse = SuccessIntentResponse<{
|
|
|
13
13
|
product: GetSaveIntentDataQuery["product"];
|
|
14
14
|
variant: GetSaveIntentDataWithVariantQuery["variant"];
|
|
15
15
|
}>;
|
|
16
|
-
export type EditItemListsIntentDataValidated = v.
|
|
16
|
+
export type EditItemListsIntentDataValidated = v.InferInput<typeof EditItemListsIntentDataSchema>;
|
|
17
17
|
export declare class EditItemListsHandler extends IntentHandler<"edit:item-lists" | "delete:item"> {
|
|
18
18
|
invoke(data: EditItemListsIntentData): Promise<IntentResponse<"edit:item-lists" | "delete:item">>;
|
|
19
19
|
}
|
|
@@ -12,7 +12,7 @@ export interface EditItemVariantIntentData extends Omit<EditItemVariantIntentDat
|
|
|
12
12
|
productId: number | string;
|
|
13
13
|
variantId?: number | string;
|
|
14
14
|
}
|
|
15
|
-
export type EditItemVariantIntentDataValidated = v.
|
|
15
|
+
export type EditItemVariantIntentDataValidated = v.InferInput<typeof EditItemVariantIntentDataSchema>;
|
|
16
16
|
export type EditItemVariantSuccessResponse = SuccessIntentResponse<{
|
|
17
17
|
item: Item;
|
|
18
18
|
product: GetSaveIntentDataQuery["product"];
|
|
@@ -5,7 +5,7 @@ import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
|
5
5
|
export declare const EditListIntentDataSchema: v.ObjectSchema<{
|
|
6
6
|
readonly listId: v.StringSchema<undefined>;
|
|
7
7
|
}, undefined>;
|
|
8
|
-
export type EditListIntentData = v.
|
|
8
|
+
export type EditListIntentData = v.InferInput<typeof EditListIntentDataSchema>;
|
|
9
9
|
export type EditListSuccessResponse = SuccessIntentResponse<{
|
|
10
10
|
list: List;
|
|
11
11
|
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { IntentHandler } from "../intent-handler";
|
|
3
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
4
|
+
export declare const OpenListDetailPageMenuIntentDataSchema: v.ObjectSchema<{
|
|
5
|
+
readonly listId: v.StringSchema<undefined>;
|
|
6
|
+
}, undefined>;
|
|
7
|
+
export type OpenListDetailPageMenuIntentData = v.InferInput<typeof OpenListDetailPageMenuIntentDataSchema>;
|
|
8
|
+
export type OpenListDetailPageMenuSuccessResponse = SuccessIntentResponse<void>;
|
|
9
|
+
export declare class OpenListDetailPageMenuHandler extends IntentHandler<"open:list-detail-page-menu"> {
|
|
10
|
+
invoke(data: OpenListDetailPageMenuIntentData): Promise<IntentResponse<"open:list-detail-page-menu">>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { IntentHandler } from "../intent-handler";
|
|
3
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
4
|
+
export declare const OpenListIntentDataSchema: v.ObjectSchema<{
|
|
5
|
+
readonly listId: v.StringSchema<undefined>;
|
|
6
|
+
}, undefined>;
|
|
7
|
+
export type OpenListIntentData = v.InferInput<typeof OpenListIntentDataSchema>;
|
|
8
|
+
export type OpenListSuccessResponse = SuccessIntentResponse<void>;
|
|
9
|
+
export declare class OpenListHandler extends IntentHandler<"open:list"> {
|
|
10
|
+
invoke(data: OpenListIntentData): Promise<IntentResponse<"open:list">>;
|
|
11
|
+
}
|
|
@@ -6,7 +6,7 @@ import { DeleteListSuccessResponse } from "./delete-list-handler";
|
|
|
6
6
|
export declare const OpenListMenuIntentDataSchema: v.ObjectSchema<{
|
|
7
7
|
readonly listId: v.StringSchema<undefined>;
|
|
8
8
|
}, undefined>;
|
|
9
|
-
export type OpenListMenuIntentData = v.
|
|
9
|
+
export type OpenListMenuIntentData = v.InferInput<typeof OpenListMenuIntentDataSchema>;
|
|
10
10
|
export type OpenListMenuSuccessResponse = EditListSuccessResponse | DeleteListSuccessResponse;
|
|
11
11
|
export declare class OpenListMenuHandler extends IntentHandler<"open:list-menu" | "edit:list" | "delete:list"> {
|
|
12
12
|
invoke(data: OpenListMenuIntentData): Promise<IntentResponse<"open:list-menu" | "edit:list" | "delete:list">>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IntentHandler } from "../intent-handler";
|
|
2
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
3
|
+
export type OpenListsSuccessResponse = SuccessIntentResponse<void>;
|
|
4
|
+
export declare class OpenListsHandler extends IntentHandler<"open:lists"> {
|
|
5
|
+
invoke(data?: void): Promise<IntentResponse<"open:lists">>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IntentHandler } from "../intent-handler";
|
|
2
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
3
|
+
export type OpenNotificationsSuccessResponse = SuccessIntentResponse<void>;
|
|
4
|
+
export declare class OpenNotificationsHandler extends IntentHandler<"open:notifications"> {
|
|
5
|
+
invoke(data?: void): Promise<IntentResponse<"open:notifications">>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { IntentHandler } from "../intent-handler";
|
|
3
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
4
|
+
export declare const OpenOrderIntentDataSchema: v.ObjectSchema<{
|
|
5
|
+
readonly orderId: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<string | number, number>, v.NumberSchema<undefined>]>;
|
|
6
|
+
}, undefined>;
|
|
7
|
+
export type OpenOrderIntentData = v.InferInput<typeof OpenOrderIntentDataSchema>;
|
|
8
|
+
export type OpenOrderSuccessResponse = SuccessIntentResponse<void>;
|
|
9
|
+
export declare class OpenOrderHandler extends IntentHandler<"open:order"> {
|
|
10
|
+
invoke(data: OpenOrderIntentData): Promise<IntentResponse<"open:order">>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { IntentHandler } from "../intent-handler";
|
|
3
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
4
|
+
export declare const OpenOrderMenuIntentDataSchema: v.ObjectSchema<{
|
|
5
|
+
readonly orderId: v.StringSchema<undefined>;
|
|
6
|
+
}, undefined>;
|
|
7
|
+
export type OpenOrderMenuIntentData = v.InferInput<typeof OpenOrderMenuIntentDataSchema>;
|
|
8
|
+
export type OpenOrderMenuSuccessResponse = SuccessIntentResponse<void>;
|
|
9
|
+
export declare class OpenOrderMenuHandler extends IntentHandler<"open:order-menu"> {
|
|
10
|
+
invoke(data: OpenOrderMenuIntentData): Promise<IntentResponse<"open:order-menu">>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IntentHandler } from "../intent-handler";
|
|
2
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
3
|
+
export type OpenOrdersSuccessResponse = SuccessIntentResponse<void>;
|
|
4
|
+
export declare class OpenOrdersHandler extends IntentHandler<"open:orders"> {
|
|
5
|
+
invoke(data?: void): Promise<IntentResponse<"open:orders">>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { IntentHandler } from "../intent-handler";
|
|
3
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
4
|
+
export declare const OpenProductIntentDataSchema: v.ObjectSchema<{
|
|
5
|
+
readonly productId: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<string | number, number>, v.NumberSchema<undefined>]>;
|
|
6
|
+
readonly variantId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.NumberSchema<undefined>]>, undefined>;
|
|
7
|
+
}, undefined>;
|
|
8
|
+
export type OpenProductIntentData = v.InferInput<typeof OpenProductIntentDataSchema>;
|
|
9
|
+
export type OpenProductSuccessResponse = SuccessIntentResponse<void>;
|
|
10
|
+
export declare class OpenProductHandler extends IntentHandler<"open:product"> {
|
|
11
|
+
invoke(data: OpenProductIntentData): Promise<IntentResponse<"open:product">>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IntentHandler } from "../intent-handler";
|
|
2
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
3
|
+
export type OpenProfileSuccessResponse = SuccessIntentResponse<void>;
|
|
4
|
+
export declare class OpenProfileHandler extends IntentHandler<"open:profile"> {
|
|
5
|
+
invoke(data?: void): Promise<IntentResponse<"open:profile">>;
|
|
6
|
+
}
|
|
@@ -3,10 +3,10 @@ import { QuickBuySubmitData } from "../../swish";
|
|
|
3
3
|
import { IntentHandler } from "../intent-handler";
|
|
4
4
|
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
5
5
|
export declare const OpenQuickBuyIntentDataSchema: v.ObjectSchema<{
|
|
6
|
-
readonly productId: v.StringSchema<undefined>;
|
|
7
|
-
readonly variantId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
6
|
+
readonly productId: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<string | number, number>, v.NumberSchema<undefined>]>;
|
|
7
|
+
readonly variantId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.NumberSchema<undefined>]>, undefined>;
|
|
8
8
|
}, undefined>;
|
|
9
|
-
export type OpenQuickBuyIntentData = v.
|
|
9
|
+
export type OpenQuickBuyIntentData = v.InferInput<typeof OpenQuickBuyIntentDataSchema>;
|
|
10
10
|
export type OpenQuickBuySuccessResponse = SuccessIntentResponse<QuickBuySubmitData>;
|
|
11
11
|
export declare class OpenQuickBuyHandler extends IntentHandler<"open:quick-buy"> {
|
|
12
12
|
invoke(data: OpenQuickBuyIntentData): Promise<IntentResponse<"open:quick-buy">>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IntentHandler } from "../intent-handler";
|
|
2
|
+
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
3
|
+
export type OpenSavesSuccessResponse = SuccessIntentResponse<void>;
|
|
4
|
+
export declare class OpenSavesHandler extends IntentHandler<"open:saves"> {
|
|
5
|
+
invoke(data?: void): Promise<IntentResponse<"open:saves">>;
|
|
6
|
+
}
|
|
@@ -4,7 +4,7 @@ import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
|
4
4
|
export declare const OpenSignInIntentDataSchema: v.ObjectSchema<{
|
|
5
5
|
readonly returnTo: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
6
6
|
}, undefined>;
|
|
7
|
-
export type OpenSignInIntentData = v.
|
|
7
|
+
export type OpenSignInIntentData = v.InferInput<typeof OpenSignInIntentDataSchema>;
|
|
8
8
|
export type OpenSignInSuccessResponse = SuccessIntentResponse<void>;
|
|
9
9
|
export declare class OpenSignInHandler extends IntentHandler<"open:sign-in"> {
|
|
10
10
|
invoke(data: OpenSignInIntentData | undefined): Promise<IntentResponse<"open:sign-in">>;
|
|
@@ -3,22 +3,22 @@ import * as v from "valibot";
|
|
|
3
3
|
import { GetSaveIntentDataQuery, GetSaveIntentDataWithVariantQuery } from "../../storefront-api/storefront-api-client";
|
|
4
4
|
import { IntentHandler } from "../intent-handler";
|
|
5
5
|
import { IntentResponse, SuccessIntentResponse } from "../types";
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const SaveItemIntentDataSchema: v.ObjectSchema<{
|
|
7
7
|
readonly productId: v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<string | number, number>, v.NumberSchema<undefined>]>;
|
|
8
8
|
readonly variantId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, string>]>, v.NumberSchema<undefined>], undefined>, v.TransformAction<any, number>, v.NumberSchema<undefined>]>, undefined>;
|
|
9
9
|
readonly quantity: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
10
10
|
readonly tags: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
11
11
|
}, undefined>;
|
|
12
|
-
export interface
|
|
12
|
+
export interface SaveItemIntentData extends Omit<SaveItemIntentDataValidated, "productId" | "variantId"> {
|
|
13
13
|
productId: number | string;
|
|
14
14
|
variantId?: number | string;
|
|
15
15
|
}
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
16
|
+
export type SaveItemIntentDataValidated = v.InferInput<typeof SaveItemIntentDataSchema>;
|
|
17
|
+
export type SaveItemSuccessResponse = SuccessIntentResponse<{
|
|
18
18
|
item: Item;
|
|
19
19
|
product: GetSaveIntentDataQuery["product"];
|
|
20
20
|
variant: GetSaveIntentDataWithVariantQuery["variant"];
|
|
21
21
|
}>;
|
|
22
|
-
export declare class
|
|
23
|
-
invoke(data:
|
|
22
|
+
export declare class SaveItemHandler extends IntentHandler<"save:item"> {
|
|
23
|
+
invoke(data: SaveItemIntentData): Promise<IntentResponse<"save:item">>;
|
|
24
24
|
}
|
|
@@ -10,7 +10,7 @@ export declare const ToastIntentDataSchema: v.ObjectSchema<{
|
|
|
10
10
|
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
11
11
|
}, undefined>, undefined>;
|
|
12
12
|
}, undefined>;
|
|
13
|
-
export type ToastIntentData = v.
|
|
13
|
+
export type ToastIntentData = v.InferInput<typeof ToastIntentDataSchema>;
|
|
14
14
|
export type ToastSuccessResponse = SuccessIntentResponse<void>;
|
|
15
15
|
export declare class ShowToastHandler extends IntentHandler<"show:toast"> {
|
|
16
16
|
invoke(data: IntentToData<"show:toast">): Promise<IntentResponse<"show:toast">>;
|
package/dist/intents/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SaveItemIntentData, SaveItemSuccessResponse } from "./handlers/save-item-handler";
|
|
2
2
|
import type { DeleteItemIntentData, DeleteItemSuccessResponse } from "./handlers/delete-item-handler";
|
|
3
3
|
import type { EditItemVariantIntentData, EditItemVariantSuccessResponse } from "./handlers/edit-item-variant-handler";
|
|
4
4
|
import type { EditItemListsIntentData, EditItemListsSuccessResponse } from "./handlers/edit-item-lists-handler";
|
|
@@ -9,9 +9,19 @@ import type { OpenHomeSuccessResponse } from "./handlers/open-home-handler";
|
|
|
9
9
|
import type { OpenListMenuIntentData, OpenListMenuSuccessResponse } from "./handlers/open-list-menu-handler";
|
|
10
10
|
import type { OpenSignInIntentData, OpenSignInSuccessResponse } from "./handlers/open-sign-in-handler";
|
|
11
11
|
import type { OpenQuickBuyIntentData, OpenQuickBuySuccessResponse } from "./handlers/open-quick-buy-handler";
|
|
12
|
+
import type { OpenListDetailPageMenuIntentData, OpenListDetailPageMenuSuccessResponse } from "./handlers/open-list-detail-page-menu-handler";
|
|
12
13
|
import { ToastIntentData, ToastSuccessResponse } from "./handlers/show-toast-handler";
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
import { OpenListsSuccessResponse } from "./handlers/open-lists-handler";
|
|
15
|
+
import { OpenOrdersSuccessResponse } from "./handlers/open-orders-handler";
|
|
16
|
+
import { OpenSavesSuccessResponse } from "./handlers/open-saves-handler";
|
|
17
|
+
import { OpenNotificationsSuccessResponse } from "./handlers/open-notifications-handler";
|
|
18
|
+
import { OpenProfileSuccessResponse } from "./handlers/open-profile-handler";
|
|
19
|
+
import { OpenListIntentData, OpenListSuccessResponse } from "./handlers/open-list-handler";
|
|
20
|
+
import { OpenProductIntentData, OpenProductSuccessResponse } from "./handlers/open-product-handler";
|
|
21
|
+
import { OpenOrderIntentData, OpenOrderSuccessResponse } from "./handlers/open-order-handler";
|
|
22
|
+
import type { OpenOrderMenuIntentData, OpenOrderMenuSuccessResponse } from "./handlers/open-order-menu-handler";
|
|
23
|
+
export type { DeleteItemSuccessResponse, EditItemVariantSuccessResponse, EditItemListsSuccessResponse, SaveItemSuccessResponse, EditListSuccessResponse, DeleteListSuccessResponse, CreateListSuccessResponse, ToastSuccessResponse, };
|
|
24
|
+
export type Intent = "save:item" | "edit:item-variant" | "edit:item-lists" | "delete:item" | "edit:list" | "delete:list" | "create:list" | "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" | "open:sign-in" | "open:quick-buy" | "show:toast";
|
|
15
25
|
export type IntentQueryParam = `${string}=${string}`;
|
|
16
26
|
export type IntentQueryWithParams = `${Intent},${IntentQueryParam}`;
|
|
17
27
|
export type IntentResponse<I extends Intent = Intent> = ClosedIntentResponse<I> | ErrorIntentResponse<I> | IntentToSuccessResponse<I>;
|
|
@@ -38,7 +48,7 @@ export interface SuccessIntentResponse<T, I extends Intent = Intent> extends Int
|
|
|
38
48
|
data: T;
|
|
39
49
|
}
|
|
40
50
|
interface IntentDataMap {
|
|
41
|
-
"
|
|
51
|
+
"save:item": SaveItemIntentData;
|
|
42
52
|
"edit:item-variant": EditItemVariantIntentData;
|
|
43
53
|
"edit:item-lists": EditItemListsIntentData;
|
|
44
54
|
"delete:item": DeleteItemIntentData;
|
|
@@ -46,13 +56,23 @@ interface IntentDataMap {
|
|
|
46
56
|
"delete:list": DeleteListIntentData;
|
|
47
57
|
"create:list": CreateListIntentData;
|
|
48
58
|
"open:home": void;
|
|
59
|
+
"open:list": OpenListIntentData;
|
|
60
|
+
"open:lists": void;
|
|
61
|
+
"open:orders": void;
|
|
62
|
+
"open:order": OpenOrderIntentData;
|
|
63
|
+
"open:saves": void;
|
|
64
|
+
"open:notifications": void;
|
|
65
|
+
"open:profile": void;
|
|
66
|
+
"open:product": OpenProductIntentData;
|
|
49
67
|
"open:list-menu": OpenListMenuIntentData;
|
|
68
|
+
"open:order-menu": OpenOrderMenuIntentData;
|
|
69
|
+
"open:list-detail-page-menu": OpenListDetailPageMenuIntentData;
|
|
50
70
|
"open:sign-in": OpenSignInIntentData | undefined;
|
|
51
71
|
"open:quick-buy": OpenQuickBuyIntentData;
|
|
52
72
|
"show:toast": ToastIntentData;
|
|
53
73
|
}
|
|
54
74
|
interface IntentSuccessResponseMap {
|
|
55
|
-
"
|
|
75
|
+
"save:item": SaveItemSuccessResponse;
|
|
56
76
|
"edit:item-variant": EditItemVariantSuccessResponse;
|
|
57
77
|
"edit:item-lists": EditItemListsSuccessResponse | DeleteItemSuccessResponse;
|
|
58
78
|
"delete:item": DeleteItemSuccessResponse;
|
|
@@ -60,7 +80,17 @@ interface IntentSuccessResponseMap {
|
|
|
60
80
|
"delete:list": DeleteListSuccessResponse;
|
|
61
81
|
"create:list": CreateListSuccessResponse;
|
|
62
82
|
"open:home": OpenHomeSuccessResponse;
|
|
83
|
+
"open:list": OpenListSuccessResponse;
|
|
84
|
+
"open:lists": OpenListsSuccessResponse;
|
|
85
|
+
"open:orders": OpenOrdersSuccessResponse;
|
|
86
|
+
"open:order": OpenOrderSuccessResponse;
|
|
87
|
+
"open:saves": OpenSavesSuccessResponse;
|
|
88
|
+
"open:notifications": OpenNotificationsSuccessResponse;
|
|
89
|
+
"open:profile": OpenProfileSuccessResponse;
|
|
90
|
+
"open:product": OpenProductSuccessResponse;
|
|
63
91
|
"open:list-menu": OpenListMenuSuccessResponse;
|
|
92
|
+
"open:order-menu": OpenOrderMenuSuccessResponse;
|
|
93
|
+
"open:list-detail-page-menu": OpenListDetailPageMenuSuccessResponse;
|
|
64
94
|
"open:sign-in": OpenSignInSuccessResponse;
|
|
65
95
|
"open:quick-buy": OpenQuickBuySuccessResponse;
|
|
66
96
|
"show:toast": ToastSuccessResponse;
|
package/dist/options/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IntentOptions } from "../intents/intents";
|
|
2
2
|
import { CountryCode, LanguageCode } from "../storefront-api/types/storefront.types";
|
|
3
|
-
import { GetProductCardDataQuery, GetProductCardDataWithVariantQuery, StorefrontApiOptions, SwishClientConfig } from "../swish";
|
|
3
|
+
import { GetProductCardDataQuery, GetProductCardDataWithVariantQuery, Intent, StorefrontApiOptions, SwishClientConfig } from "../swish";
|
|
4
4
|
import { Badge } from "../utils/shopify-badge-utils";
|
|
5
5
|
export interface SwishOptions {
|
|
6
6
|
storefrontApi: StorefrontApiOptions;
|
|
@@ -56,6 +56,7 @@ export interface SwishComponentOptions {
|
|
|
56
56
|
productDetail: SwishProductDetailOptions;
|
|
57
57
|
variantSelect: SwishVariantSelectOptions;
|
|
58
58
|
imageSlider: SwishImageSliderOptions;
|
|
59
|
+
icons: Record<string, string>;
|
|
59
60
|
images: SwishImageOptions;
|
|
60
61
|
buyButtons: SwishBuyButtonsOptions;
|
|
61
62
|
drawer: SwishDrawerOptions;
|
|
@@ -90,7 +91,7 @@ export type SwishDrawerNavigationVariant = "floating" | "docked";
|
|
|
90
91
|
export interface SwishDrawerNavigationItem {
|
|
91
92
|
id: string;
|
|
92
93
|
enabled: boolean;
|
|
93
|
-
|
|
94
|
+
intent: Intent;
|
|
94
95
|
}
|
|
95
96
|
export interface SwishDrawerNavigationOptions {
|
|
96
97
|
variant: SwishDrawerNavigationVariant;
|
|
@@ -11,6 +11,7 @@ export declare class SwishApi {
|
|
|
11
11
|
private readonly config;
|
|
12
12
|
private readonly itemsLoader;
|
|
13
13
|
private readonly auth;
|
|
14
|
+
private readonly storefrontContext;
|
|
14
15
|
constructor(config: SwishApiConfig, context: StorefrontContext, eventBus: EventBus, cacheKeyPrefix: string);
|
|
15
16
|
private fetchFunction;
|
|
16
17
|
private requestInterceptor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StorefrontContext, SwishUiOptions } from "../options/types";
|
|
2
2
|
import type { SwishUiElement } from "./swish-ui-element";
|
|
3
|
-
import { DeleteListAlertOptions, DrawerOptions, ListDetailPageOptions, ListEditorOptions, ListEditorSubmitData, ListMenuOptions, ListMenuResponse, ListSelectOptions, ListSelectResponse, QuickBuyOptions, QuickBuySubmitData, RequireUiComponentOptions, SignInOptions, Toast, UiResponse, UnsaveAlertOptions, UnsaveAlertSubmitData, VariantSelectOptions, VariantSelectSubmitData } from "./types";
|
|
3
|
+
import { DeleteListAlertOptions, DrawerOptions, ListDetailPageOptions, ListDetailPageMenuOptions, ListEditorOptions, ListEditorSubmitData, ListMenuOptions, ListMenuResponse, ListSelectOptions, ListSelectResponse, OrderMenuOptions, OrderMenuResponse, QuickBuyOptions, QuickBuySubmitData, RequireUiComponentOptions, SignInOptions, Toast, UiResponse, UnsaveAlertOptions, UnsaveAlertSubmitData, VariantSelectOptions, VariantSelectSubmitData } from "./types";
|
|
4
4
|
export declare class SwishUi {
|
|
5
5
|
private storefrontContext;
|
|
6
6
|
private swishUiOptions;
|
|
@@ -17,6 +17,8 @@ export declare class SwishUi {
|
|
|
17
17
|
showDeleteListAlert(options: DeleteListAlertOptions): Promise<UiResponse<void>>;
|
|
18
18
|
showDrawer(options?: DrawerOptions): Promise<UiResponse<void>>;
|
|
19
19
|
showListMenu(options: ListMenuOptions): Promise<ListMenuResponse>;
|
|
20
|
+
showOrderMenu(options: OrderMenuOptions): Promise<OrderMenuResponse>;
|
|
21
|
+
showListDetailPageMenu(options: ListDetailPageMenuOptions): Promise<UiResponse<void>>;
|
|
20
22
|
showListSelect(options: ListSelectOptions): Promise<ListSelectResponse>;
|
|
21
23
|
initListDetailPage(options: ListDetailPageOptions, refElement: HTMLElement): Promise<void>;
|
|
22
24
|
showToast(toast: Toast): Promise<import("./types").ClosedUiResponse | import("./types").SuccessUiResponse<void>>;
|
package/dist/swish-ui/types.d.ts
CHANGED
|
@@ -39,10 +39,18 @@ export interface DeleteListAlertOptions {
|
|
|
39
39
|
listId: string;
|
|
40
40
|
}
|
|
41
41
|
export interface DrawerOptions {
|
|
42
|
+
view?: "home" | "list" | "lists" | "saves" | "order" | "orders" | "notifications" | "profile" | "product";
|
|
43
|
+
listId?: string;
|
|
44
|
+
productId?: string;
|
|
45
|
+
variantId?: string;
|
|
46
|
+
orderId?: string;
|
|
42
47
|
}
|
|
43
48
|
export interface ListMenuOptions {
|
|
44
49
|
listId: string;
|
|
45
50
|
}
|
|
51
|
+
export interface OrderMenuOptions {
|
|
52
|
+
orderId: string;
|
|
53
|
+
}
|
|
46
54
|
export type ListEditorSubmitData = ExtractSuccessData<EditListSuccessResponse>;
|
|
47
55
|
export type ListMenuResponse = UiResponse<{
|
|
48
56
|
action: "edit";
|
|
@@ -50,6 +58,10 @@ export type ListMenuResponse = UiResponse<{
|
|
|
50
58
|
} | {
|
|
51
59
|
action: "delete";
|
|
52
60
|
}>;
|
|
61
|
+
export type OrderMenuResponse = UiResponse<void>;
|
|
62
|
+
export interface ListDetailPageMenuOptions {
|
|
63
|
+
listId: string;
|
|
64
|
+
}
|
|
53
65
|
export interface ListDetailPageOptions {
|
|
54
66
|
listId?: string;
|
|
55
67
|
}
|
|
@@ -66,14 +78,15 @@ export type ListSelectResponse = UiResponse<{
|
|
|
66
78
|
}>;
|
|
67
79
|
export interface VariantSelectOptions {
|
|
68
80
|
itemId?: string;
|
|
69
|
-
productId?:
|
|
81
|
+
productId?: number;
|
|
70
82
|
productHandle?: string;
|
|
71
|
-
variantId?:
|
|
83
|
+
variantId?: number;
|
|
72
84
|
}
|
|
73
85
|
export type VariantSelectSubmitData = ExtractSuccessData<EditItemVariantSuccessResponse>;
|
|
74
86
|
export interface QuickBuyOptions {
|
|
75
|
-
productId?:
|
|
76
|
-
|
|
87
|
+
productId?: number;
|
|
88
|
+
productHandle?: string;
|
|
89
|
+
variantId?: number;
|
|
77
90
|
}
|
|
78
91
|
export interface QuickBuySubmitData {
|
|
79
92
|
product: VariantSelectSubmitData["product"];
|