@swishapp/sdk 0.61.0 → 0.71.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/open-quick-buy-handler.d.ts +1 -1
- package/dist/intents/intent-handler.d.ts +3 -1
- package/dist/intents/intent-hook.d.ts +6 -4
- package/dist/intents/intents.d.ts +15 -5
- package/dist/options/swish-options.d.ts +14 -0
- package/dist/options/types.d.ts +118 -0
- package/dist/state/index.d.ts +1 -0
- package/dist/storefront-api/load-product-card-data.d.ts +4 -2
- package/dist/storefront-api/load-product-detail-data.d.ts +4 -2
- package/dist/storefront-api/load-product-images.d.ts +4 -1
- package/dist/storefront-api/load-product-options.d.ts +4 -1
- package/dist/storefront-api/load-product-recommendations.d.ts +4 -2
- package/dist/storefront-api/load-save-intent-data.d.ts +8 -7
- package/dist/storefront-api/load-selected-variant.d.ts +4 -2
- package/dist/storefront-api/storefront-api-client.d.ts +120 -10
- package/dist/storefront-api/types/storefront.types.d.ts +107 -1
- package/dist/swish-api/swish-api-client.d.ts +4 -8
- package/dist/swish-ui/swish-ui-element.d.ts +3 -1
- package/dist/swish-ui/swish-ui.d.ts +54 -0
- package/dist/swish-ui/{swish-ui-utils.d.ts → types.d.ts} +4 -37
- package/dist/swish.d.ts +28 -20
- package/dist/swish.js +78 -78
- package/dist/types.d.ts +2 -45
- package/dist/utils/shop-bridge.d.ts +4 -2
- package/dist/utils/shopify-badge-utils.d.ts +22 -0
- package/package.json +9 -9
- package/dist/index.d.ts +0 -9
package/dist/types.d.ts
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
import type { SwishClientConfig } from "@swishapp/api-client";
|
|
2
1
|
import type { SwishApp } from "./swish";
|
|
3
|
-
import type { StorefrontConfig } from "./storefront-api/storefront-api-client";
|
|
4
|
-
import { SwishApiConfig } from "./swish-api/swish-api-client";
|
|
5
|
-
export interface SwishAppOptions {
|
|
6
|
-
loadProfile?: SwishApiConfig["loadProfile"];
|
|
7
|
-
storeProfile?: SwishApiConfig["storeProfile"];
|
|
8
|
-
deleteProfile?: SwishApiConfig["deleteProfile"];
|
|
9
|
-
loadAuthToken?: SwishApiConfig["loadAuthToken"];
|
|
10
|
-
storeAuthToken?: SwishApiConfig["storeAuthToken"];
|
|
11
|
-
deleteAuthToken?: SwishApiConfig["deleteAuthToken"];
|
|
12
|
-
proxy: {
|
|
13
|
-
baseUrl: string;
|
|
14
|
-
};
|
|
15
|
-
swishApi?: SwishClientConfig & {
|
|
16
|
-
version?: string;
|
|
17
|
-
};
|
|
18
|
-
ui?: SwishUiOptions;
|
|
19
|
-
storefront: StorefrontConfig;
|
|
20
|
-
}
|
|
21
|
-
export interface SwishUiOptions {
|
|
22
|
-
baseUrl: string;
|
|
23
|
-
version: string;
|
|
24
|
-
}
|
|
25
2
|
export interface SwishUiManifest {
|
|
26
3
|
scripts: Record<string, string>;
|
|
27
4
|
prerender: Record<string, string>;
|
|
28
|
-
|
|
5
|
+
styles: {
|
|
29
6
|
critical: string;
|
|
30
|
-
};
|
|
31
|
-
stylesheets: {
|
|
32
7
|
nonCritical: string;
|
|
8
|
+
theme: string;
|
|
33
9
|
};
|
|
34
10
|
version: string;
|
|
35
11
|
}
|
|
@@ -37,25 +13,6 @@ export interface SwishUiElementSpec {
|
|
|
37
13
|
script: string;
|
|
38
14
|
template: string;
|
|
39
15
|
}
|
|
40
|
-
export interface SwishEmbedData {
|
|
41
|
-
customer: {
|
|
42
|
-
id: string | null;
|
|
43
|
-
email: string | null;
|
|
44
|
-
firstName: string | null;
|
|
45
|
-
lastName: string | null;
|
|
46
|
-
b2b: boolean | null;
|
|
47
|
-
};
|
|
48
|
-
localization: {
|
|
49
|
-
country: string;
|
|
50
|
-
language: string;
|
|
51
|
-
market: number;
|
|
52
|
-
};
|
|
53
|
-
routes: {
|
|
54
|
-
accountUrl: string;
|
|
55
|
-
accountLoginUrl: string;
|
|
56
|
-
rootUrl: string;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
16
|
declare global {
|
|
60
17
|
interface Window {
|
|
61
18
|
swish: SwishApp;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const BaseElement: typeof HTMLElement;
|
|
2
|
+
export declare class ShopBridge extends BaseElement {
|
|
3
|
+
get swish(): import("../swish").SwishApp | undefined;
|
|
3
4
|
private readonly emailInput;
|
|
4
5
|
private readonly shopModalObserver;
|
|
5
6
|
constructor();
|
|
@@ -27,3 +28,4 @@ declare global {
|
|
|
27
28
|
};
|
|
28
29
|
}
|
|
29
30
|
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GetProductCardDataQuery, GetProductCardDataWithVariantQuery } from "../swish";
|
|
2
|
+
export type GetBadgesFunction = (args: GetBadgesArgs) => GetBadgesResult;
|
|
3
|
+
export type GetBadgesArgs = {
|
|
4
|
+
product: GetProductCardDataQuery["product"];
|
|
5
|
+
variant?: GetProductCardDataWithVariantQuery["variant"];
|
|
6
|
+
defaultBadges: string[];
|
|
7
|
+
};
|
|
8
|
+
export type GetBadgesResult = (string | Badge)[];
|
|
9
|
+
export interface Badge {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
style?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export declare class ShopifyBadgesUtils {
|
|
15
|
+
#private;
|
|
16
|
+
constructor({ getBadges }: {
|
|
17
|
+
getBadges?: GetBadgesFunction;
|
|
18
|
+
});
|
|
19
|
+
getBadges({ product, variant }: Omit<GetBadgesArgs, "defaultBadges">): Badge[];
|
|
20
|
+
getDefaultBadges({ product, variant }: Omit<GetBadgesArgs, "defaultBadges">): string[];
|
|
21
|
+
mapBadges(badges: (string | Badge)[]): Badge[];
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swishapp/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0",
|
|
4
4
|
"description": "JS SDK for Swish.",
|
|
5
5
|
"author": "Swish",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"rimraf": "6.0.1",
|
|
34
34
|
"typescript": "5.9.3"
|
|
35
35
|
},
|
|
36
|
-
"main": "./dist/
|
|
37
|
-
"module": "./dist/
|
|
38
|
-
"types": "./dist/
|
|
36
|
+
"main": "./dist/swish.js",
|
|
37
|
+
"module": "./dist/swish.js",
|
|
38
|
+
"types": "./dist/swish.d.ts",
|
|
39
39
|
"exports": {
|
|
40
40
|
".": {
|
|
41
41
|
"module": {
|
|
42
|
-
"types": "./dist/
|
|
43
|
-
"default": "./dist/
|
|
42
|
+
"types": "./dist/swish.d.ts",
|
|
43
|
+
"default": "./dist/swish.js"
|
|
44
44
|
},
|
|
45
45
|
"import": {
|
|
46
|
-
"types": "./dist/
|
|
47
|
-
"default": "./dist/
|
|
46
|
+
"types": "./dist/swish.d.ts",
|
|
47
|
+
"default": "./dist/swish.js"
|
|
48
48
|
},
|
|
49
|
-
"default": "./dist/
|
|
49
|
+
"default": "./dist/swish.js"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type * from "@swishapp/api-client";
|
|
2
|
-
export type * from "./ajax-api/ajax-api-client";
|
|
3
|
-
export type { EventName } from "./events/event-bus";
|
|
4
|
-
export type * from "./storefront-api/storefront-api-client";
|
|
5
|
-
export type * from "./intents/types";
|
|
6
|
-
export { SwishApp } from "./swish";
|
|
7
|
-
export type { Ref, SwishUiElement } from "./swish-ui/swish-ui-element";
|
|
8
|
-
export type { Toast, ToastManager, UnsaveAlertSubmitData, ListSelectSubmitData, VariantSelectSubmitData, UnsaveAlertOptions, ListSelectOptions, VariantSelectOptions, QuickBuySubmitData, QuickBuyOptions, } from "./swish-ui/swish-ui-utils";
|
|
9
|
-
export type { ShopBridge } from "./utils/shop-bridge";
|