@swishapp/sdk 0.105.0 → 0.106.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 +1 -1
- package/dist/dom/create-placement.d.ts +114 -0
- package/dist/dom/dom-utils.d.ts +2 -1
- package/dist/intents/handlers/create-cart-line-handler.d.ts +21 -0
- package/dist/intents/handlers/edit-item-lists-handler.d.ts +2 -2
- package/dist/intents/handlers/edit-list-access-handler.d.ts +15 -0
- package/dist/intents/handlers/open-list-menu-handler.d.ts +6 -4
- package/dist/intents/handlers/share-list-handler.d.ts +16 -0
- package/dist/intents/handlers/show-toast-handler.d.ts +2 -0
- package/dist/intents/handlers/unsave-item-handler.d.ts +14 -0
- package/dist/intents/hooks/after-edit-list-access-hook.d.ts +5 -0
- package/dist/intents/hooks/after-share-list-hook.d.ts +5 -0
- package/dist/intents/intents.d.ts +12 -12
- package/dist/intents/types.d.ts +28 -19
- package/dist/options/swish-options.d.ts +6 -3
- package/dist/options/types.d.ts +84 -5
- package/dist/swish-api/swish-api-client.d.ts +4 -1
- package/dist/swish-ui/swish-ui-element.d.ts +1 -0
- package/dist/swish-ui/swish-ui.d.ts +14 -8
- package/dist/swish-ui/types.d.ts +21 -5
- package/dist/swish.d.ts +20 -1
- package/dist/swish.js +64 -64
- package/dist/utils/build-share-list-url.d.ts +4 -0
- package/dist/utils/copy-to-clipboard.d.ts +6 -0
- package/dist/utils/is-mobile-device.d.ts +1 -0
- package/dist/utils/shopify-id-schema.d.ts +2 -0
- package/package.json +1 -1
- package/dist/intents/handlers/delete-item-handler.d.ts +0 -13
package/dist/swish-ui/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { Ref } from "../swish";
|
|
1
|
+
import type { UnsaveItemSuccessResponse, EditItemListsSuccessResponse, EditItemVariantSuccessResponse, EditListSuccessResponse } from "../intents/types";
|
|
2
|
+
import { Ref, SwishUiElement } from "../swish";
|
|
3
3
|
type ExtractSuccessData<T> = T extends {
|
|
4
4
|
code: "ok";
|
|
5
5
|
data: infer D;
|
|
@@ -27,6 +27,8 @@ export interface Toast {
|
|
|
27
27
|
action?: {
|
|
28
28
|
label: string;
|
|
29
29
|
};
|
|
30
|
+
variant?: "compact" | "full";
|
|
31
|
+
icon?: string;
|
|
30
32
|
}
|
|
31
33
|
export interface SignInOptions {
|
|
32
34
|
returnTo?: string;
|
|
@@ -34,10 +36,17 @@ export interface SignInOptions {
|
|
|
34
36
|
export interface UnsaveAlertOptions {
|
|
35
37
|
itemId: string;
|
|
36
38
|
}
|
|
37
|
-
export type UnsaveAlertSubmitData = ExtractSuccessData<
|
|
39
|
+
export type UnsaveAlertSubmitData = ExtractSuccessData<UnsaveItemSuccessResponse>;
|
|
38
40
|
export interface DeleteListAlertOptions {
|
|
39
41
|
listId: string;
|
|
40
42
|
}
|
|
43
|
+
export interface ConfirmDialogOptions {
|
|
44
|
+
titleKey?: string;
|
|
45
|
+
descriptionKey?: string;
|
|
46
|
+
confirmLabelKey?: string;
|
|
47
|
+
cancelLabelKey?: string;
|
|
48
|
+
danger?: boolean;
|
|
49
|
+
}
|
|
41
50
|
export interface DrawerOptions {
|
|
42
51
|
view?: "home" | "list" | "lists" | "saves" | "order" | "orders" | "notifications" | "profile" | "product";
|
|
43
52
|
listId?: string;
|
|
@@ -52,11 +61,19 @@ export interface OrderMenuOptions {
|
|
|
52
61
|
orderId: string;
|
|
53
62
|
}
|
|
54
63
|
export type ListEditorSubmitData = ExtractSuccessData<EditListSuccessResponse>;
|
|
64
|
+
export interface ListMenuEditAccessData {
|
|
65
|
+
currentListAccess: "public" | "private";
|
|
66
|
+
}
|
|
55
67
|
export type ListMenuResponse = UiResponse<{
|
|
56
68
|
action: "edit";
|
|
57
69
|
data: ListEditorSubmitData;
|
|
58
70
|
} | {
|
|
59
71
|
action: "delete";
|
|
72
|
+
} | {
|
|
73
|
+
action: "edit-access";
|
|
74
|
+
data?: ListMenuEditAccessData;
|
|
75
|
+
} | {
|
|
76
|
+
action: "share";
|
|
60
77
|
}>;
|
|
61
78
|
export type OrderMenuResponse = UiResponse<void>;
|
|
62
79
|
export interface ListDetailPageMenuOptions {
|
|
@@ -95,8 +112,7 @@ export interface QuickBuySubmitData {
|
|
|
95
112
|
export interface ListEditorOptions {
|
|
96
113
|
listId?: string;
|
|
97
114
|
}
|
|
98
|
-
export interface RequireUiComponentOptions<TComponent> {
|
|
99
|
-
instance?: string;
|
|
115
|
+
export interface RequireUiComponentOptions<TComponent = SwishUiElement> {
|
|
100
116
|
onHydrated?: (ref: Ref<TComponent>) => void;
|
|
101
117
|
refElement?: HTMLElement;
|
|
102
118
|
}
|
package/dist/swish.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AjaxApiClient } from "./ajax-api/ajax-api-client";
|
|
2
|
+
import { PlacementSpec } from "./dom/create-placement";
|
|
2
3
|
import { createElementLocator, createLocationObserver } from "./dom/dom-utils";
|
|
3
4
|
import { EventBus } from "./events/event-bus";
|
|
4
5
|
import { Intents } from "./intents/intents";
|
|
@@ -7,6 +8,9 @@ import { SwishOptions } from "./options/types";
|
|
|
7
8
|
import { computed, effect, signal } from "./state";
|
|
8
9
|
import { StorefrontApiClient } from "./storefront-api/storefront-api-client";
|
|
9
10
|
import { SwishApi } from "./swish-api/swish-api-client";
|
|
11
|
+
import { SwishUiElement } from "./swish-ui/swish-ui-element";
|
|
12
|
+
import { copyToClipboard } from "./utils/copy-to-clipboard";
|
|
13
|
+
import { RequireUiComponentOptions } from "./swish-ui/types";
|
|
10
14
|
import { ShopifyBadgesUtils } from "./utils/shopify-badge-utils";
|
|
11
15
|
export declare const VERSION: string;
|
|
12
16
|
export declare const swishSdkUrl: string;
|
|
@@ -32,7 +36,20 @@ declare class SwishApp {
|
|
|
32
36
|
get shopUrl(): string;
|
|
33
37
|
readonly dom: {
|
|
34
38
|
createElementLocator: typeof createElementLocator;
|
|
35
|
-
|
|
39
|
+
createLocationObserver: typeof createLocationObserver;
|
|
40
|
+
createPlacement: (spec: PlacementSpec) => {
|
|
41
|
+
mount(): void;
|
|
42
|
+
unmount(): void;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly ui: {
|
|
46
|
+
createElement: (name: string, options?: RequireUiComponentOptions) => Promise<SwishUiElement>;
|
|
47
|
+
};
|
|
48
|
+
readonly utils: {
|
|
49
|
+
copyToClipboard: typeof copyToClipboard;
|
|
50
|
+
createShareUrl: (args: {
|
|
51
|
+
publicListId: string;
|
|
52
|
+
}) => URL;
|
|
36
53
|
};
|
|
37
54
|
readonly state: {
|
|
38
55
|
itemContext: (source?: HTMLElement) => import("@preact/signals-core").Signal<import("./state").ItemContext>;
|
|
@@ -82,6 +99,8 @@ export type * from "./options/types";
|
|
|
82
99
|
export type * from "./storefront-api/storefront-api-client";
|
|
83
100
|
export type { Ref, SwishUiElement } from "./swish-ui/swish-ui-element";
|
|
84
101
|
export type { ListSelectOptions, ListSelectSubmitData, QuickBuyOptions, QuickBuySubmitData, Toast, ToastManager, UnsaveAlertOptions, UnsaveAlertSubmitData, VariantSelectOptions, VariantSelectSubmitData, } from "./swish-ui/types";
|
|
102
|
+
export { copyToClipboard } from "./utils/copy-to-clipboard";
|
|
103
|
+
export { buildShareListUrl } from "./utils/build-share-list-url";
|
|
85
104
|
export type * from "./types";
|
|
86
105
|
export type { SwishApp };
|
|
87
106
|
declare global {
|