@swell/apps-sdk 1.0.19 → 1.0.21
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/index.cjs +19 -19
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +19 -19
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +19 -19
- package/dist/index.mjs.map +4 -4
- package/dist/jest.config.d.ts +14 -0
- package/dist/src/api.d.ts +15 -9
- package/dist/src/cache.d.ts +1 -1
- package/dist/src/compatibility/shopify.d.ts +4 -2
- package/dist/src/easyblocks/config.d.ts +6 -0
- package/dist/src/easyblocks/utils.d.ts +2 -0
- package/dist/src/editor/resources.d.ts +9 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/liquid/color.d.ts +1 -1
- package/dist/src/liquid/filters/color_desaturate.d.ts +1 -1
- package/dist/src/liquid/filters/color_lighten.d.ts +1 -1
- package/dist/src/liquid/filters/color_mix.d.ts +1 -1
- package/dist/src/liquid/filters/color_saturate.d.ts +1 -1
- package/dist/src/liquid/filters/date.d.ts +3 -6
- package/dist/src/liquid/filters/divided_by.d.ts +2 -0
- package/dist/src/liquid/filters/font_face.d.ts +1 -1
- package/dist/src/liquid/filters/image_tag.d.ts +1 -1
- package/dist/src/liquid/filters/image_url.d.ts +1 -1
- package/dist/src/liquid/filters/index.d.ts +3 -1
- package/dist/src/liquid/filters/money.d.ts +1 -1
- package/dist/src/liquid/filters/time_tag.d.ts +1 -1
- package/dist/src/liquid/filters/translate.d.ts +1 -1
- package/dist/src/liquid/utils.d.ts +1 -1
- package/dist/src/resources.d.ts +2 -1
- package/dist/src/theme.d.ts +2 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/test/liquid/filters/asset_url.test.d.ts +1 -0
- package/dist/test/liquid/filters/brightness_difference.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_brightness.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_contrast.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_darken.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_desaturate.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_difference.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_extract.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_lighten.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_mix.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_modify.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_saturate.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_to_hex.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_to_hsl.test.d.ts +1 -0
- package/dist/test/liquid/filters/color_to_rgb.test.d.ts +1 -0
- package/dist/test/liquid/filters/date.test.d.ts +1 -0
- package/dist/test/liquid/filters/default_errors.test.d.ts +1 -0
- package/dist/test/liquid/filters/divided_by.test.d.ts +1 -0
- package/dist/test/liquid/filters/font_face.test.d.ts +1 -0
- package/dist/test/liquid/filters/font_modify.test.d.ts +1 -0
- package/dist/test/liquid/filters/font_url.test.d.ts +1 -0
- package/dist/test/liquid/filters/format_address.test.d.ts +1 -0
- package/dist/test/liquid/filters/image_tag.test.d.ts +1 -0
- package/dist/test/liquid/filters/image_url.test.d.ts +1 -0
- package/dist/test/liquid/filters/inline_editable.test.d.ts +1 -0
- package/dist/test/liquid/filters/json.test.d.ts +1 -0
- package/dist/test/liquid/filters/json_pretty.test.d.ts +1 -0
- package/dist/test/liquid/filters/money.test.d.ts +1 -0
- package/dist/test/liquid/filters/money_with_currency.test.d.ts +1 -0
- package/dist/test/liquid/filters/money_without_currency.test.d.ts +1 -0
- package/dist/test/liquid/filters/money_without_trailing_zeros.test.d.ts +1 -0
- package/dist/test/liquid/filters/stylesheet_tag.test.d.ts +1 -0
- package/dist/test/liquid/filters/time_tag.test.d.ts +1 -0
- package/dist/test/liquid/filters/translate.test.d.ts +1 -0
- package/dist/test/liquid/filters/where.test.d.ts +1 -0
- package/dist/test/liquid/helpers.d.ts +6 -0
- package/dist/test/liquid/tags/case.test.d.ts +1 -0
- package/dist/test/liquid/tags/for.test.d.ts +1 -0
- package/dist/test/liquid/tags/form.test.d.ts +1 -0
- package/dist/test/liquid/tags/inline_editable.test.d.ts +1 -0
- package/dist/test/liquid/tags/javascript.test.d.ts +1 -0
- package/dist/test/liquid/tags/style.test.d.ts +1 -0
- package/dist/types/shopify.d.ts +1 -1
- package/dist/types/swell.d.ts +34 -9
- package/package.json +6 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let roots: string[];
|
|
3
|
+
let transform: {
|
|
4
|
+
'^.+\\.(ts|js)$': string;
|
|
5
|
+
};
|
|
6
|
+
let testEnvironment: string;
|
|
7
|
+
let moduleFileExtensions: string[];
|
|
8
|
+
let moduleNameMapper: {
|
|
9
|
+
'^@/(.*)$': string;
|
|
10
|
+
};
|
|
11
|
+
let extensionsToTreatAsEsm: string[];
|
|
12
|
+
let transformIgnorePatterns: string[];
|
|
13
|
+
}
|
|
14
|
+
export default _default;
|
package/dist/src/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import SwellJS from 'swell-js';
|
|
2
2
|
import { Cache } from './cache';
|
|
3
3
|
export * from './resources';
|
|
4
|
-
import type { SwellAppConfig, SwellErrorOptions, SwellMenu, SwellData, CFThemeEnv } from '../types/swell';
|
|
4
|
+
import type { SwellAppConfig, SwellErrorOptions, SwellMenu, SwellData, CFThemeEnv, SwellAppShopifyCompatibilityConfig } from '../types/swell';
|
|
5
5
|
export declare class Swell {
|
|
6
6
|
url: URL;
|
|
7
7
|
headers: SwellData;
|
|
@@ -9,6 +9,7 @@ export declare class Swell {
|
|
|
9
9
|
queryParams: SwellData;
|
|
10
10
|
workerEnv?: CFThemeEnv;
|
|
11
11
|
config?: SwellAppConfig;
|
|
12
|
+
shopifyCompatibilityConfig?: SwellAppShopifyCompatibilityConfig;
|
|
12
13
|
backend?: SwellBackendAPI;
|
|
13
14
|
storefront: typeof SwellJS;
|
|
14
15
|
instanceId: string;
|
|
@@ -16,9 +17,11 @@ export declare class Swell {
|
|
|
16
17
|
isEditor: boolean;
|
|
17
18
|
sentResponse: boolean;
|
|
18
19
|
static cache: Map<string, Cache>;
|
|
20
|
+
storefront_url?: string;
|
|
19
21
|
constructor(params: {
|
|
20
22
|
url: URL | string;
|
|
21
23
|
config?: SwellAppConfig;
|
|
24
|
+
shopifyCompatibilityConfig?: SwellAppShopifyCompatibilityConfig;
|
|
22
25
|
headers?: SwellData;
|
|
23
26
|
swellHeaders?: SwellData;
|
|
24
27
|
serverHeaders?: Headers | SwellData;
|
|
@@ -52,18 +55,21 @@ export declare class Swell {
|
|
|
52
55
|
};
|
|
53
56
|
getStorefrontInstance(params: SwellData): typeof SwellJS;
|
|
54
57
|
isStorefrontRequestCacheable(method: string, url: string): boolean;
|
|
55
|
-
getCacheableStorefrontRequestHandler(storefront: typeof SwellJS): (method: string, url: string, id?: any, data?: any, opt?: any) =>
|
|
58
|
+
getCacheableStorefrontRequestHandler<T>(storefront: typeof SwellJS): (method: string, url: string, id?: any, data?: any, opt?: any) => T | Promise<T | undefined> | undefined;
|
|
56
59
|
getCacheInstance(): Cache;
|
|
57
|
-
setCacheValues(values:
|
|
60
|
+
setCacheValues(values: any[]): void;
|
|
58
61
|
getCacheKeyPrefix(): string;
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
getCacheKey(key: string, args?: unknown[]): string;
|
|
63
|
+
setCachedSync(key: string, args: unknown[], value: unknown, timeout?: number, isSync?: boolean): void | Promise<void>;
|
|
64
|
+
getCachedSync<T>(key: string, args?: unknown[] | (() => Promise<T> | T), handler?: () => Promise<T> | T, timeout?: number, isSync?: boolean): Promise<T | undefined> | T | undefined;
|
|
61
65
|
resolveCacheHandler<T>(cacheInstance: Cache, cacheKey: string, cacheHandler: () => Promise<T> | T, timeout?: number, isSync?: boolean): Promise<T> | T | undefined;
|
|
62
|
-
setCached(key: string, args:
|
|
63
|
-
getCached<T>(key: string, args
|
|
64
|
-
|
|
66
|
+
setCached(key: string, args: unknown[], value: unknown, timeout?: number): Promise<any>;
|
|
67
|
+
getCached<T>(key: string, args?: unknown[] | (() => Promise<T> | T), handler?: () => Promise<T> | T, timeout?: number): Promise<T | undefined>;
|
|
68
|
+
getCachedVersion<T>(key: string[], version: string, handler: () => Promise<T> | T, timeout?: number): Promise<T | undefined>;
|
|
69
|
+
getCachedResource<T>(key: string, args: unknown[] | (() => Promise<T>), handler?: () => Promise<T>, timeout?: number): Promise<T | undefined>;
|
|
65
70
|
updateCacheModified(cacheModified: string): Promise<void>;
|
|
66
|
-
|
|
71
|
+
deleteCachedVersion(key: string): Promise<void>;
|
|
72
|
+
clearCache(prefix: string): Promise<void>;
|
|
67
73
|
getAppSettings(): Promise<SwellData>;
|
|
68
74
|
getStorefrontSettings(): Promise<SwellData>;
|
|
69
75
|
getStorefrontMenus(): SwellMenu[];
|
package/dist/src/cache.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class Cache {
|
|
|
12
12
|
setSync(key: string, value: any, timeout?: number): void;
|
|
13
13
|
delete(key: string): Promise<void>;
|
|
14
14
|
deleteSync(key: string): void;
|
|
15
|
-
has
|
|
15
|
+
has(key: string): Promise<boolean>;
|
|
16
16
|
hasSync(key: string): boolean;
|
|
17
17
|
clear(prefix?: string): Promise<void>;
|
|
18
18
|
}
|
|
@@ -2,7 +2,8 @@ import { Swell } from '../api';
|
|
|
2
2
|
import { SwellTheme } from '../theme';
|
|
3
3
|
import { ThemeFont } from '../liquid/font';
|
|
4
4
|
import { ThemeForm } from '../liquid/form';
|
|
5
|
-
import
|
|
5
|
+
import { ShopifyResource } from './shopify-objects';
|
|
6
|
+
import type { ThemeGlobals, ThemeSettings, ThemePresetSchema, ThemeEditorSchema, ThemeSectionSchema, SwellData, SwellMenu, SwellRecord, SwellAppShopifyCompatibilityConfig } from '../../types/swell';
|
|
6
7
|
import type { ShopifySettingsData, ShopifySettingsSchema, ShopifySectionSchema, ShopifyPageResourceMap, ShopifyObjectResourceMap, ShopifyFormResourceMap, ShopifyQueryParamsMap } from '../../types/shopify';
|
|
7
8
|
export declare class ShopifyCompatibility {
|
|
8
9
|
theme: SwellTheme;
|
|
@@ -15,6 +16,7 @@ export declare class ShopifyCompatibility {
|
|
|
15
16
|
editorLocaleConfig: {
|
|
16
17
|
[key: string]: any;
|
|
17
18
|
} | undefined;
|
|
19
|
+
shopifyCompatibilityConfig?: SwellAppShopifyCompatibilityConfig;
|
|
18
20
|
constructor(theme: SwellTheme);
|
|
19
21
|
adaptGlobals(globals: ThemeGlobals): void;
|
|
20
22
|
adaptPageData(pageData: SwellData): void;
|
|
@@ -60,7 +62,7 @@ export declare class ShopifyCompatibility {
|
|
|
60
62
|
root_url: string;
|
|
61
63
|
search_url: string;
|
|
62
64
|
};
|
|
63
|
-
getLocalizationObject(store: SwellData, request: SwellData):
|
|
65
|
+
getLocalizationObject(store: SwellData, request: SwellData): ShopifyResource;
|
|
64
66
|
getAdaptedPageUrl(url: string): string | undefined;
|
|
65
67
|
getThemeFilePath(type: string, name: string): string;
|
|
66
68
|
getPageResourceMap(): ShopifyPageResourceMap;
|
|
@@ -104,6 +104,12 @@ export declare function getEasyblocksPagePropsWithConfigs(themeGlobals: ThemeGlo
|
|
|
104
104
|
id: string;
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
|
+
swell_paragraph: {
|
|
108
|
+
type: string;
|
|
109
|
+
widget: {
|
|
110
|
+
id: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
107
113
|
swell_editor: {
|
|
108
114
|
type: string;
|
|
109
115
|
widget: {
|
|
@@ -29,8 +29,10 @@ export declare function schemaToEasyblocksValue(fields: ThemeSettingFieldSchema[
|
|
|
29
29
|
export declare function getThemeSettingsFromProps(props: any, editorSchema: any[]): any;
|
|
30
30
|
export declare function getSectionSettingsFromProps(props: any, sectionSchema: any): {
|
|
31
31
|
settings: any;
|
|
32
|
+
id: any;
|
|
32
33
|
blocks: any;
|
|
33
34
|
} | {
|
|
34
35
|
settings?: undefined;
|
|
36
|
+
id?: undefined;
|
|
35
37
|
blocks?: undefined;
|
|
36
38
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Swell } from '@/api';
|
|
2
|
+
import { SwellStorefrontRecord, SwellStorefrontSingleton } from '@/resources';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
export declare class MockRecordResource extends SwellStorefrontRecord {
|
|
5
|
+
constructor(swell: Swell, slug: string, query?: SwellData);
|
|
6
|
+
}
|
|
7
|
+
export declare class MockRecordSingleton extends SwellStorefrontSingleton {
|
|
8
|
+
constructor(swell: Swell, slug: string, query?: SwellData);
|
|
9
|
+
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LiquidSwell, ThemeColor } from
|
|
1
|
+
import { LiquidSwell, ThemeColor } from '..';
|
|
2
2
|
export default function bind(_liquidSwell: LiquidSwell): (color: string | ThemeColor, value: number) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LiquidSwell, ThemeColor } from
|
|
1
|
+
import { LiquidSwell, ThemeColor } from '..';
|
|
2
2
|
export default function bind(_liquidSwell: LiquidSwell): (color: string | ThemeColor, percent: number) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LiquidSwell, ThemeColor } from
|
|
1
|
+
import { LiquidSwell, ThemeColor } from '..';
|
|
2
2
|
export default function bind(_liquidSwell: LiquidSwell): (color1: string | ThemeColor, color2: string | ThemeColor, ratio: number) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LiquidSwell, ThemeColor } from
|
|
1
|
+
import { LiquidSwell, ThemeColor } from '..';
|
|
2
2
|
export default function bind(_liquidSwell: LiquidSwell): (color: string | ThemeColor, value: number) => string;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { LiquidSwell } from '..';
|
|
2
|
-
export default function bind(_liquidSwell: LiquidSwell): (dateValue: string,
|
|
2
|
+
export default function bind(_liquidSwell: LiquidSwell): (dateValue: string, ...params: any[]) => string;
|
|
3
3
|
export declare function ensureDate(dateValue: string | Date): Date;
|
|
4
|
-
export declare function getDateFilterParams(
|
|
5
|
-
format: unknown;
|
|
6
|
-
datetime: unknown;
|
|
7
|
-
strFormat: string | undefined;
|
|
8
|
-
};
|
|
4
|
+
export declare function getDateFilterParams(params: any[]): Record<string, unknown>;
|
|
9
5
|
export declare function applyDateFormat(type: string, date: Date): string;
|
|
6
|
+
export declare function isCustomDateFormat(format: string): boolean;
|
|
10
7
|
export declare function applyStrftimeFormat(format: string, date: Date): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LiquidSwell } from '..';
|
|
2
|
-
export default function bind(_liquidSwell: LiquidSwell): (fontSetting: any, params: any[]) => string | null;
|
|
2
|
+
export default function bind(_liquidSwell: LiquidSwell): (fontSetting: any, ...params: any[]) => string | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LiquidSwell } from '..';
|
|
2
|
-
export default function bind(_liquidSwell: LiquidSwell): (imageUrl: string, params: any[]) => string;
|
|
2
|
+
export default function bind(_liquidSwell: LiquidSwell): (imageUrl: string, ...params: any[]) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LiquidSwell } from '..';
|
|
2
2
|
declare const _default: {
|
|
3
|
-
bind(_liquidSwell: LiquidSwell): (imageField: any, params: any[]) => Promise<string>;
|
|
3
|
+
bind(_liquidSwell: LiquidSwell): (imageField: any, ...params: any[]) => Promise<string>;
|
|
4
4
|
resolve: string[][];
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
|
@@ -16,6 +16,7 @@ import color_to_hsl from './color_to_hsl';
|
|
|
16
16
|
import color_to_rgb from './color_to_rgb';
|
|
17
17
|
import date from './date';
|
|
18
18
|
import default_errors from './default_errors';
|
|
19
|
+
import divided_by from './divided_by';
|
|
19
20
|
import font_face from './font_face';
|
|
20
21
|
import font_modify from './font_modify';
|
|
21
22
|
import font_url from './font_url';
|
|
@@ -53,6 +54,7 @@ export declare const filters: {
|
|
|
53
54
|
color_to_rgb: typeof color_to_rgb;
|
|
54
55
|
date: typeof date;
|
|
55
56
|
default_errors: typeof default_errors;
|
|
57
|
+
divided_by: typeof divided_by;
|
|
56
58
|
font_face: typeof font_face;
|
|
57
59
|
font_modify: typeof font_modify;
|
|
58
60
|
font_url: typeof font_url;
|
|
@@ -62,7 +64,7 @@ export declare const filters: {
|
|
|
62
64
|
};
|
|
63
65
|
image_tag: typeof image_tag;
|
|
64
66
|
image_url: {
|
|
65
|
-
bind(_liquidSwell: LiquidSwell): (imageField: any, params: any[]) => Promise<string>;
|
|
67
|
+
bind(_liquidSwell: LiquidSwell): (imageField: any, ...params: any[]) => Promise<string>;
|
|
66
68
|
resolve: string[][];
|
|
67
69
|
};
|
|
68
70
|
json: typeof json;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LiquidSwell } from
|
|
1
|
+
import { LiquidSwell } from '..';
|
|
2
2
|
export default function bind(liquidSwell: LiquidSwell): (value: number) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LiquidSwell } from '..';
|
|
2
|
-
export default function bind(_liquidSwell: LiquidSwell): (dateValue: string,
|
|
2
|
+
export default function bind(_liquidSwell: LiquidSwell): (dateValue: string, ...params: any[]) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LiquidSwell } from
|
|
1
|
+
import { LiquidSwell } from '..';
|
|
2
2
|
export default function bind(liquidSwell: LiquidSwell): (key: string, params?: any[]) => Promise<string>;
|
|
@@ -27,7 +27,7 @@ export declare function isString(value: unknown): value is string;
|
|
|
27
27
|
export declare function isNumber(value: unknown): value is number;
|
|
28
28
|
export declare function isFunction(value: unknown): value is Function;
|
|
29
29
|
export declare function toLiquid(value: unknown): unknown;
|
|
30
|
-
export declare function isNil(value: unknown): value is
|
|
30
|
+
export declare function isNil(value: unknown): value is undefined | null;
|
|
31
31
|
export declare function isUndefined(value: unknown): value is undefined;
|
|
32
32
|
export declare function isArray<T>(value: unknown): value is Array<T>;
|
|
33
33
|
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
package/dist/src/resources.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare class StorefrontResource<T extends SwellData = SwellData> {
|
|
|
17
17
|
_setGetter(getter: StorefrontResourceGetter<T>): void;
|
|
18
18
|
_resolve(): Promise<T | null | undefined>;
|
|
19
19
|
_isResultResolved(): boolean;
|
|
20
|
-
resolve(): Promise<any>;
|
|
20
|
+
resolve(resolveStorefrontResources?: boolean, resourceMetadata?: boolean): Promise<any>;
|
|
21
21
|
toObject(): {} | null;
|
|
22
22
|
toJSON(): {} | null;
|
|
23
23
|
valueOf(): Promise<any>;
|
|
@@ -45,6 +45,7 @@ export declare class SwellStorefrontCollection<T extends SwellCollection = Swell
|
|
|
45
45
|
pages?: SwellCollectionPages;
|
|
46
46
|
page_count?: number;
|
|
47
47
|
limit: number;
|
|
48
|
+
name?: string;
|
|
48
49
|
constructor(swell: Swell, collection: string, query?: SwellData, getter?: StorefrontResourceGetter<T>);
|
|
49
50
|
_getProxy(): SwellStorefrontCollection<T>;
|
|
50
51
|
_initQuery(query: SwellData): SwellData;
|
package/dist/src/theme.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Swell, StorefrontResource, SwellStorefrontCollection, SwellStorefrontRecord, SwellStorefrontSingleton } from './api';
|
|
2
2
|
import { LiquidSwell, ThemeFont, ThemeForm } from './liquid';
|
|
3
3
|
import { ShopifyCompatibility } from './compatibility/shopify';
|
|
4
|
-
import type { ThemeGlobals, ThemeConfigs, ThemeSettings, ThemeResources, ThemeFormConfig, ThemeFormErrorMessages, ThemePresetSchema, ThemeSectionGroup, ThemeSectionSchema, ThemeSectionConfig, ThemeSectionSettings, ThemeSettingFieldSchema, ThemeSettingSectionSchema, ThemePageSectionSchema, ThemePageTemplateConfig, ThemeLayoutSectionGroupConfig, SwellData, SwellMenu, SwellAppConfig, SwellThemeConfig, SwellAppStorefrontThemeProps } from '../types/swell';
|
|
4
|
+
import type { ThemeGlobals, ThemeConfigs, ThemeSettings, ThemeResources, ThemeFormConfig, ThemeFormErrorMessages, ThemePresetSchema, ThemeSectionGroup, ThemeSectionSchema, ThemeSectionConfig, ThemeSectionSettings, ThemeSettingFieldSchema, ThemeSettingSectionSchema, ThemePageSectionSchema, ThemePageTemplateConfig, ThemeLayoutSectionGroupConfig, SwellData, SwellMenu, SwellAppConfig, SwellThemeConfig, SwellAppStorefrontThemeProps, SwellAppShopifyCompatibilityConfig } from '../types/swell';
|
|
5
5
|
export declare class SwellTheme {
|
|
6
6
|
swell: Swell;
|
|
7
7
|
props: SwellAppStorefrontThemeProps;
|
|
@@ -14,6 +14,7 @@ export declare class SwellTheme {
|
|
|
14
14
|
pageId: string | undefined;
|
|
15
15
|
shopifyCompatibility: ShopifyCompatibility | null;
|
|
16
16
|
shopifyCompatibilityClass: typeof ShopifyCompatibility;
|
|
17
|
+
shopifyCompatibilityConfig: SwellAppShopifyCompatibilityConfig | null;
|
|
17
18
|
formData: Record<string, ThemeForm>;
|
|
18
19
|
globalData: SwellData;
|
|
19
20
|
constructor(swell: Swell, options?: {
|
|
@@ -15,5 +15,5 @@ export declare function forEachKeyDeep(obj: any, fn: (key: string, value: any) =
|
|
|
15
15
|
export declare function findCircularReferences(value: any): unknown[];
|
|
16
16
|
export declare function removeCircularReferences(value: any): any;
|
|
17
17
|
export declare function dehydrateSwellRefsInStorefrontResources(obj: any): any;
|
|
18
|
-
export declare function resolveAsyncResources(response: any, resolveStorefrontResources?: boolean): Promise<any>;
|
|
18
|
+
export declare function resolveAsyncResources(response: any, resolveStorefrontResources?: boolean, resolveWithResourceMetadata?: boolean): Promise<any>;
|
|
19
19
|
export declare function stringifyQueryParams(queryParams: SwellData): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LiquidSwell } from '@/liquid';
|
|
2
|
+
type DescribeLiquidCallbackType = (render: (template: string, data?: any) => Promise<string>, liquid: LiquidSwell) => void;
|
|
3
|
+
export declare function describeFilter(name: string, callback: DescribeLiquidCallbackType): void;
|
|
4
|
+
export declare function describeTag(name: string, callback: DescribeLiquidCallbackType): void;
|
|
5
|
+
export declare function removeSpaces(value: string): string;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/shopify.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ShopifyResource } from '../src/compatibility/shopify-objects/resou
|
|
|
3
3
|
import type { ShopifyCompatibility } from '../src/compatibility/shopify';
|
|
4
4
|
import type { StorefrontResource } from '../src/resources';
|
|
5
5
|
export type ShopifyBasicInputType = 'text' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'number' | 'range';
|
|
6
|
-
export type ShopifySpecializedInputType = 'article' | 'blog' | 'collection' | 'collection_list' | 'color' | 'color_background' | 'color_scheme' | 'color_scheme_group' | 'font_picker' | 'header' | 'html' | 'image_picker' | 'inline_richtext' | 'link_list' | 'liquid' | 'page' | 'page' | 'product' | 'product_list' | 'richtext' | 'text_alignment' | 'url' | 'video' | 'video_url';
|
|
6
|
+
export type ShopifySpecializedInputType = 'article' | 'blog' | 'collection' | 'collection_list' | 'color' | 'color_background' | 'color_scheme' | 'color_scheme_group' | 'font_picker' | 'header' | 'paragraph' | 'html' | 'image_picker' | 'inline_richtext' | 'link_list' | 'liquid' | 'page' | 'page' | 'product' | 'product_list' | 'richtext' | 'text_alignment' | 'url' | 'video' | 'video_url';
|
|
7
7
|
export interface ShopifyBgStyleSchema {
|
|
8
8
|
solid: string;
|
|
9
9
|
gradient: string;
|
package/dist/types/swell.d.ts
CHANGED
|
@@ -11,6 +11,32 @@ export interface SwellAppConfig {
|
|
|
11
11
|
theme: SwellAppStorefrontThemeProps;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
export interface SwellAppShopifyCompatibilityConfig {
|
|
15
|
+
page_types: Record<string, string>;
|
|
16
|
+
page_routes: Record<string, {
|
|
17
|
+
page_id?: string;
|
|
18
|
+
} | string>;
|
|
19
|
+
page_resources: Array<{
|
|
20
|
+
page: string;
|
|
21
|
+
resources: Array<{
|
|
22
|
+
from: string;
|
|
23
|
+
to: string;
|
|
24
|
+
object: string;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
object_resources: Array<{
|
|
28
|
+
from: string;
|
|
29
|
+
object: string;
|
|
30
|
+
}>;
|
|
31
|
+
forms: Array<{
|
|
32
|
+
id: string;
|
|
33
|
+
shopify_type: string;
|
|
34
|
+
client_params: Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
value: string;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
14
40
|
export interface SwellAppStorefrontThemePage {
|
|
15
41
|
id: string;
|
|
16
42
|
url: string;
|
|
@@ -19,17 +45,16 @@ export interface SwellAppStorefrontThemePage {
|
|
|
19
45
|
icon?: string;
|
|
20
46
|
templates?: boolean;
|
|
21
47
|
collection?: string;
|
|
48
|
+
json?: boolean;
|
|
22
49
|
}
|
|
23
50
|
export interface SwellAppStorefrontThemeProps {
|
|
24
51
|
provider: 'app';
|
|
25
52
|
pages: Array<SwellAppStorefrontThemePage>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
};
|
|
53
|
+
resources?: SwellAppStorefrontThemeResources;
|
|
54
|
+
}
|
|
55
|
+
export interface SwellAppStorefrontThemeResources {
|
|
56
|
+
singletons: Record<string, string>;
|
|
57
|
+
records: Record<string, string>;
|
|
33
58
|
}
|
|
34
59
|
export interface SwellErrorOptions {
|
|
35
60
|
status?: number;
|
|
@@ -194,7 +219,7 @@ export interface ThemeSectionSchema {
|
|
|
194
219
|
presets?: ThemePresetSchema[];
|
|
195
220
|
default?: ShopifySettingSchema;
|
|
196
221
|
}
|
|
197
|
-
export type ThemeSettingBasicInputType = 'short_text' | 'long_text' | 'boolean' | 'number' | 'date' | 'select' | 'asset' | 'tags' | 'collection' | 'color' | 'color_scheme' | 'color_scheme_group' | 'font' | 'header' | 'lookup' | 'generic_lookup' | 'menu' | 'icon' | 'field_group';
|
|
222
|
+
export type ThemeSettingBasicInputType = 'short_text' | 'long_text' | 'paragraph' | 'boolean' | 'number' | 'date' | 'select' | 'asset' | 'tags' | 'collection' | 'color' | 'color_scheme' | 'color_scheme_group' | 'font' | 'header' | 'lookup' | 'generic_lookup' | 'menu' | 'icon' | 'field_group';
|
|
198
223
|
export type ThemeSettingAliasInputType = 'text' | 'textarea' | 'rich_text' | 'asset' | 'phone' | 'email' | 'url' | 'slug' | 'basic_html' | 'rich_html' | 'markdown' | 'liquid' | 'checkbox' | 'toggle' | 'image' | 'document' | 'video' | 'radio' | 'dropdown' | 'checkboxes' | 'integer' | 'float' | 'currency' | 'percent' | 'slider' | 'time' | 'datetime' | 'child_collection' | 'product_lookup' | 'category_lookup' | 'customer_lookup';
|
|
199
224
|
export interface OptionItem {
|
|
200
225
|
label: string;
|
|
@@ -337,7 +362,7 @@ export interface ThemeFormErrorMessage {
|
|
|
337
362
|
field_label?: string;
|
|
338
363
|
}
|
|
339
364
|
export type ThemeFormErrorMessages = Array<ThemeFormErrorMessage>;
|
|
340
|
-
export type CFWorkerKVGetType =
|
|
365
|
+
export type CFWorkerKVGetType = 'text' | 'json' | 'arrayBuffer' | 'stream';
|
|
341
366
|
export interface CFWorkerKVGetOptions<T extends CFWorkerKVGetType> {
|
|
342
367
|
cacheTtl: number;
|
|
343
368
|
type: T;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swell/apps-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.21",
|
|
5
5
|
"description": "Swell SDK for building isomorphic apps.",
|
|
6
6
|
"author": "Swell",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,17 +32,21 @@
|
|
|
32
32
|
"prebuild": "rimraf dist",
|
|
33
33
|
"build": "node scripts/build.mjs",
|
|
34
34
|
"postbuild": "tsc --project tsconfig.build.json",
|
|
35
|
-
"watch": "node scripts/build.mjs watch"
|
|
35
|
+
"watch": "node scripts/build.mjs watch",
|
|
36
|
+
"test": "jest --config=./jest.config.js"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@kruining/waterlogged": "^1.1.45",
|
|
39
40
|
"@types/color": "^3.0.6",
|
|
41
|
+
"@types/jest": "29.5.14",
|
|
40
42
|
"@types/lodash-es": "^4.17.12",
|
|
41
43
|
"@types/qs": "^6.9.15",
|
|
42
44
|
"@types/react": "^18.2.64",
|
|
43
45
|
"@types/react-dom": "^18.2.21",
|
|
44
46
|
"@types/strftime": "^0.9.8",
|
|
45
47
|
"esbuild": "0.20.2",
|
|
48
|
+
"esbuild-jest": "0.5.0",
|
|
49
|
+
"jest": "29.7.0",
|
|
46
50
|
"rimraf": "^6.0.1",
|
|
47
51
|
"typescript": "^5.3.3"
|
|
48
52
|
},
|