@swell/apps-sdk 1.0.95 → 1.0.97

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.
Files changed (47) hide show
  1. package/dist/index.cjs +49 -49
  2. package/dist/index.cjs.map +4 -4
  3. package/dist/index.js +48 -48
  4. package/dist/index.js.map +4 -4
  5. package/dist/index.mjs +49 -49
  6. package/dist/index.mjs.map +4 -4
  7. package/dist/src/api.d.ts +1 -3
  8. package/dist/src/cache/cache.d.ts +12 -2
  9. package/dist/src/cache/request-cache.d.ts +2 -1
  10. package/dist/src/cache/resource-cache.d.ts +1 -2
  11. package/dist/src/cache/theme-cache.d.ts +2 -7
  12. package/dist/src/compatibility/drops/object-handles.d.ts +1 -1
  13. package/dist/src/compatibility/shopify-configs.d.ts +4 -8
  14. package/dist/src/compatibility/shopify-objects/resource.d.ts +1 -1
  15. package/dist/src/compatibility/shopify.d.ts +6 -2
  16. package/dist/src/constants.d.ts +2 -2
  17. package/dist/src/easyblocks/config.d.ts +9 -3
  18. package/dist/src/liquid/filters/asset_url.d.ts +3 -2
  19. package/dist/src/liquid/filters/default_errors.d.ts +3 -2
  20. package/dist/src/liquid/filters/index.d.ts +4 -2
  21. package/dist/src/liquid/filters/json.d.ts +3 -2
  22. package/dist/src/liquid/filters/json_pretty.d.ts +3 -2
  23. package/dist/src/liquid/filters/script_tag.d.ts +3 -0
  24. package/dist/src/liquid/filters/stylesheet_tag.d.ts +3 -2
  25. package/dist/src/liquid/filters/translate.d.ts +3 -2
  26. package/dist/src/liquid/index.d.ts +15 -19
  27. package/dist/src/liquid/tags/case.d.ts +1 -1
  28. package/dist/src/liquid/tags/for.d.ts +1 -1
  29. package/dist/src/liquid/tags/form.d.ts +1 -1
  30. package/dist/src/liquid/tags/inline_editable.d.ts +1 -1
  31. package/dist/src/liquid/tags/javascript.d.ts +1 -1
  32. package/dist/src/liquid/tags/layout.d.ts +1 -1
  33. package/dist/src/liquid/tags/paginate.d.ts +1 -1
  34. package/dist/src/liquid/tags/render.d.ts +1 -1
  35. package/dist/src/liquid/tags/section.d.ts +1 -1
  36. package/dist/src/liquid/tags/sections.d.ts +1 -1
  37. package/dist/src/liquid/tags/shopify/include.d.ts +1 -1
  38. package/dist/src/liquid/tags/style.d.ts +1 -1
  39. package/dist/src/liquid/test-helpers.d.ts +2 -0
  40. package/dist/src/liquid/utils.d.ts +6 -14
  41. package/dist/src/menus.d.ts +1 -1
  42. package/dist/src/theme/theme-loader.d.ts +5 -1
  43. package/dist/src/theme.d.ts +15 -15
  44. package/dist/src/utils/index.d.ts +1 -1
  45. package/dist/types/shopify.d.ts +19 -15
  46. package/dist/types/swell.d.ts +15 -5
  47. package/package.json +2 -2
package/dist/src/api.d.ts CHANGED
@@ -29,13 +29,12 @@ export declare class Swell {
29
29
  * First attempts to fetch from cache.
30
30
  */
31
31
  getCachedResource<T>(key: string, args: unknown[], handler: () => T | Promise<T>): Promise<T | undefined>;
32
- updateCacheModified(cacheModified: string): Promise<void>;
33
32
  getAppSettings(): Promise<SwellData>;
34
33
  getStorefrontSettings(force?: boolean): Promise<SwellData>;
35
34
  getStorefrontMenus(): SwellMenu[];
36
35
  getStorefrontLocalization(): {
37
- currency: string;
38
36
  locale: string;
37
+ currency: string;
39
38
  };
40
39
  get<T = SwellData>(...args: Parameters<SwellBackendAPI['get']>): Promise<T | undefined>;
41
40
  put<T = SwellData>(...args: Parameters<SwellBackendAPI['put']>): Promise<T | undefined>;
@@ -56,7 +55,6 @@ export declare class Swell {
56
55
  * Caches client storefront API requests in memory.
57
56
  */
58
57
  private getRequestCache;
59
- private getCacheKey;
60
58
  }
61
59
  export declare class SwellBackendAPI {
62
60
  apiHost: string;
@@ -1,14 +1,24 @@
1
- import { type CreateCacheOptions } from 'cache-manager';
1
+ import { type CreateCacheOptions as OriginalCreateCacheOptions } from 'cache-manager';
2
+ import type { CFWorkerKV } from 'types/swell';
3
+ export type CreateCacheOptions = OriginalCreateCacheOptions & {
4
+ kvStore?: CFWorkerKV;
5
+ };
6
+ export declare const CF_KV_NAMESPACE = "THEME";
7
+ /**
8
+ * Cache supports memory or KV
9
+ * The KV layer supports namespacing and compression
10
+ */
2
11
  export declare class Cache {
3
12
  private client;
4
13
  constructor(options?: CreateCacheOptions);
5
14
  fetch<T>(key: string, fetchFn: () => T | Promise<T>): Promise<T>;
15
+ fetchSWR<T>(key: string, fetchFn: () => T | Promise<T>): Promise<T>;
6
16
  get<T>(key: string): Promise<T | null>;
7
17
  set<T>(key: string, value: T, ttl?: number): Promise<T>;
8
18
  flush(key: string): Promise<void>;
9
19
  /**
10
20
  * Flushes the entire cache.
11
- * Warning: If the cache store is shared among many cache clients,
21
+ * WARNING: If the cache store is shared among many cache clients,
12
22
  * this will flush entries for other clients.
13
23
  */
14
24
  flushAll(): Promise<void>;
@@ -1,4 +1,5 @@
1
+ import { type CreateCacheOptions } from './cache';
1
2
  import { Cache } from './cache';
2
3
  export declare class RequestCache extends Cache {
3
- constructor();
4
+ constructor(options?: CreateCacheOptions);
4
5
  }
@@ -1,5 +1,4 @@
1
- import { type CreateCacheOptions } from 'cache-manager';
2
- import { Cache } from './cache';
1
+ import { Cache, type CreateCacheOptions } from './cache';
3
2
  export declare class ResourceCache extends Cache {
4
3
  constructor(options?: CreateCacheOptions);
5
4
  }
@@ -1,9 +1,4 @@
1
- import type { CFWorkerKV } from 'types/swell';
2
- import { Cache } from './cache';
3
- /**
4
- * Theme cache is a 2-layer cache (memory, KV*)
5
- * The KV layer supports namespacing and compression.
6
- */
1
+ import { Cache, type CreateCacheOptions } from './cache';
7
2
  export declare class ThemeCache extends Cache {
8
- constructor(store?: CFWorkerKV);
3
+ constructor(options?: CreateCacheOptions);
9
4
  }
@@ -1,6 +1,6 @@
1
1
  import { Drop } from 'liquidjs';
2
2
  export default class ObjectHandlesDrop<T> extends Drop {
3
3
  #private;
4
- constructor(map?: Record<string, T> | Map<string, T>);
4
+ constructor(map?: Record<string, T | undefined> | Map<string, T>);
5
5
  liquidMethodMissing(key: unknown): T | undefined;
6
6
  }
@@ -1,10 +1,6 @@
1
- import type { ShopifySectionBlockSchema, ShopifySectionPresetSchema, ShopifySectionSchema, ShopifySettingSchema, ShopifySettingsData, ShopifySettingSection, ShopifySettingsSchema } from 'types/shopify';
2
- import type { ThemeBlockSchema, ThemeEditorSchema, ThemePresetSchema, ThemeSectionSchemaData, ThemeSettingFieldSchema, ThemeSettings, ThemeSettingSectionSchema } from 'types/swell';
3
- export declare function convertShopifySettingsSchema(settingsSchema: ShopifySettingsSchema): ThemeEditorSchema;
1
+ import type { ShopifySectionSchema, ShopifySettingsData, ShopifySettingsSchema } from 'types/shopify';
2
+ import type { ThemeEditorSchema, ThemePresetSchema, ThemeSectionSchemaData, ThemeSettings } from 'types/swell';
3
+ export declare function convertShopifySettingsSchema(settingsSchema: ShopifySettingsSchema, locale: string): ThemeEditorSchema;
4
4
  export declare function convertShopifySettingsData(settingsData: ShopifySettingsData): ThemeSettings;
5
5
  export declare function convertShopifySettingsPresets(settingsData: ShopifySettingsData): ThemePresetSchema[];
6
- export declare function convertShopifySectionSchema(sectionSchema: ShopifySectionSchema): ThemeSectionSchemaData;
7
- export declare function shopifySchemaBlockToSwellBlockSchema(block: ShopifySectionBlockSchema): ThemeBlockSchema;
8
- export declare function shopifySchemaPresetToSwellPresetSchema(preset: ShopifySectionPresetSchema): ThemePresetSchema;
9
- export declare function shopifySchemaSectionToSwellSettingSection(section: ShopifySettingSection): ThemeSettingSectionSchema;
10
- export declare function shopifySchemaSettingToSwellSettingField(setting: ShopifySettingSchema): ThemeSettingFieldSchema;
6
+ export declare function convertShopifySectionSchema(sectionSchema: ShopifySectionSchema, locale?: string): ThemeSectionSchemaData;
@@ -20,4 +20,4 @@ export declare function isResolvable(asyncProp: unknown): boolean;
20
20
  export declare function resolveAsyncProp<R extends SwellData>(asyncProp: unknown): Promise<R | R[] | null | undefined>;
21
21
  export declare function handleDeferredProp<T, R extends SwellData>(asyncProp: unknown, handler: (...value: R[]) => T): Promise<T | null>;
22
22
  export declare function deferWith<T, R extends SwellData = SwellData>(asyncProp: unknown, handler: (...value: R[]) => T): DeferredShopifyResource<T | null>;
23
- export declare function deferSwellCollectionWithShopifyResults<T extends Record<string, SwellStorefrontCollection>, R extends ShopifyResource>(instance: ShopifyCompatibility, asyncProp: unknown, key: string, ShopifyObject: (instance: ShopifyCompatibility, result: SwellRecord) => R, handler?: (shopifyResult: R, result: SwellRecord) => void): DeferredShopifyResource<SwellStorefrontCollection<import("types/swell").SwellCollection<SwellRecord>> | null>;
23
+ export declare function deferSwellCollectionWithShopifyResults<T extends Record<string, SwellStorefrontCollection>, R extends ShopifyResource>(instance: ShopifyCompatibility, asyncProp: unknown, key: string, ShopifyObject: (instance: ShopifyCompatibility, result: SwellRecord) => R, handler?: (shopifyResult: R, result: SwellRecord) => void): DeferredShopifyResource<SwellStorefrontCollection | null>;
@@ -5,6 +5,9 @@ import { SwellTheme } from '@/theme';
5
5
  import { ShopifyResource } from './shopify-objects';
6
6
  import type { ThemeGlobals, ThemeSettings, ThemePresetSchema, ThemeEditorSchema, ThemeSectionSchemaData, SwellData, SwellMenu, SwellAppShopifyCompatibilityConfig, SwellSettingsGeo } from '../../types/swell';
7
7
  import type { ShopifySettingsData, ShopifySettingsSchema, ShopifySectionSchema, ShopifyPageResourceMap, ShopifyObjectResourceMap, ShopifyFormResourceMap, ShopifyQueryParamsMap, ShopifyLocalizationConfig } from '../../types/shopify';
8
+ /**
9
+ * This class is meant to be extended by a storefront app to provide compatibility with Shopify's Liquid
10
+ */
8
11
  export declare class ShopifyCompatibility {
9
12
  theme: SwellTheme;
10
13
  swell: Swell;
@@ -16,7 +19,8 @@ export declare class ShopifyCompatibility {
16
19
  shopifyCompatibilityConfig?: SwellAppShopifyCompatibilityConfig;
17
20
  editorLocaleConfig?: Record<string, ShopifyLocalizationConfig | undefined>;
18
21
  constructor(theme: SwellTheme);
19
- adaptGlobals(globals: ThemeGlobals): void;
22
+ initGlobals(globals: ThemeGlobals): void;
23
+ adaptGlobals(globals: Partial<ThemeGlobals>, prevGlobals: ThemeGlobals): void;
20
24
  /**
21
25
  * Extracts values from the form according to the passed settings config
22
26
  *
@@ -71,7 +75,7 @@ export declare class ShopifyCompatibility {
71
75
  getAdaptedFormClientHtml(formType: string, scope: SwellData, arg?: any): Promise<string | undefined>;
72
76
  getAdaptedFormServerParams(formType: string, context: SwellData): Promise<SwellData | undefined>;
73
77
  getAdaptedFormServerResponse(formType: string, context: SwellData): Promise<SwellData | undefined>;
74
- getShopData({ store }: ThemeGlobals): {};
78
+ getShopData(store: SwellData): {};
75
79
  getContentForHeader(): string;
76
80
  getMenuData(menu: SwellMenu): SwellData;
77
81
  getFontData(font: ThemeFont): SwellData;
@@ -1,4 +1,4 @@
1
- import type { SwellData } from 'types/swell';
1
+ import type { SwellData, SwellSettingsGeo } from 'types/swell';
2
2
  export declare const FILE_DATA_INCLUDE_QUERY: SwellData;
3
- export declare const GEO_DATA: SwellData;
3
+ export declare const GEO_DATA: SwellSettingsGeo;
4
4
  export declare const LANG_TO_COUNTRY_CODES: Record<string, string | undefined>;
@@ -1,13 +1,13 @@
1
1
  import type { Backend, InternalTemplate, NoCodeComponentDefinition } from '@swell/easyblocks-core';
2
- import { SwellTheme } from '../theme';
2
+ import type { SwellTheme } from '../theme';
3
3
  import type { SwellThemeConfig, ThemeGlobals, ThemeLayoutSectionGroupConfig, ThemePageSectionSchema, ThemeSectionConfig, ThemeSectionGroup } from 'types/swell';
4
4
  export declare function getEasyblocksPropsFromThemeConfigs(theme: SwellTheme, themeConfigs: SwellThemeConfig[], pageId: string): Promise<{
5
- pageTemplate: ThemeSectionGroup | undefined;
5
+ pageTemplate: string | ThemeSectionGroup | undefined;
6
6
  allSections: import("types/swell").ThemeSectionSchema[];
7
7
  pageSections: ThemeSectionConfig[];
8
8
  layoutSectionGroups: ThemeLayoutSectionGroupConfig[];
9
9
  }>;
10
- export declare function getEasyblocksPageTemplate<T>(theme: SwellTheme, pageId: string): Promise<T | undefined>;
10
+ export declare function getEasyblocksPageTemplate<T>(theme: SwellTheme, pageId: string): Promise<T | string | undefined>;
11
11
  export declare function getEasyblocksPagePropsWithConfigs(themeGlobals: ThemeGlobals, allSections: ThemePageSectionSchema[], pageSections: ThemeSectionConfig[], layoutSectionGroups: ThemeLayoutSectionGroupConfig[], pageId: string): {
12
12
  easyblocksConfig: {
13
13
  components: NoCodeComponentDefinition<Record<string, any>, Record<string, any>>[];
@@ -105,6 +105,12 @@ export declare function getEasyblocksPagePropsWithConfigs(themeGlobals: ThemeGlo
105
105
  id: string;
106
106
  };
107
107
  };
108
+ swell_radio: {
109
+ type: string;
110
+ widget: {
111
+ id: string;
112
+ };
113
+ };
108
114
  swell_short_text: {
109
115
  type: string;
110
116
  widget: {
@@ -1,2 +1,3 @@
1
- import { LiquidSwell } from "..";
2
- export default function bind(liquidSwell: LiquidSwell): (assetPath: string) => Promise<string | null>;
1
+ import type { FilterHandler } from 'liquidjs/dist/template';
2
+ import type { LiquidSwell } from '..';
3
+ export default function bind(liquidSwell: LiquidSwell): FilterHandler;
@@ -1,2 +1,3 @@
1
- import { LiquidSwell } from '..';
2
- export default function bind(_liquidSwell: LiquidSwell): (errors: any) => Promise<string>;
1
+ import type { FilterHandler } from 'liquidjs/dist/template';
2
+ import type { LiquidSwell } from '..';
3
+ export default function bind(_liquidSwell: LiquidSwell): FilterHandler;
@@ -1,4 +1,3 @@
1
- import { LiquidSwell } from '..';
2
1
  import asset_url from './asset_url';
3
2
  import brightness_difference from './brightness_difference';
4
3
  import color_brightness from './color_brightness';
@@ -29,6 +28,7 @@ import money from './money';
29
28
  import money_with_currency from './money_with_currency';
30
29
  import money_without_currency from './money_without_currency';
31
30
  import money_without_trailing_zeros from './money_without_trailing_zeros';
31
+ import script_tag from './script_tag';
32
32
  import stylesheet_tag from './stylesheet_tag';
33
33
  import time_tag from './time_tag';
34
34
  import translate from './translate';
@@ -38,6 +38,7 @@ import payment_button from './shopify/payment_button';
38
38
  import payment_terms from './shopify/payment_terms';
39
39
  import placeholder_svg_tag from './shopify/placeholder_svg_tag';
40
40
  import inline_editable from './inline_editable';
41
+ import type { LiquidSwell } from '..';
41
42
  export declare const filters: {
42
43
  asset_url: typeof asset_url;
43
44
  brightness_difference: typeof brightness_difference;
@@ -77,6 +78,7 @@ export declare const filters: {
77
78
  money_with_currency: typeof money_with_currency;
78
79
  money_without_currency: typeof money_without_currency;
79
80
  money_without_trailing_zeros: typeof money_without_trailing_zeros;
81
+ script_tag: typeof script_tag;
80
82
  stylesheet_tag: typeof stylesheet_tag;
81
83
  time_tag: typeof time_tag;
82
84
  translate: typeof translate;
@@ -93,4 +95,4 @@ export declare const filters: {
93
95
  inline_editable: typeof inline_editable;
94
96
  };
95
97
  export declare function bindFilters(liquidSwell: LiquidSwell): void;
96
- export declare function resolveAsyncProps(propArg: any, resolveProps: boolean | Array<string>): Promise<any>;
98
+ export declare function resolveAsyncProps(propArg: unknown, resolveProps: boolean | string[]): Promise<unknown>;
@@ -1,2 +1,3 @@
1
- import { LiquidSwell } from '..';
2
- export default function bind(_liquidSwell: LiquidSwell): (input: unknown, space?: number) => Promise<string>;
1
+ import type { FilterHandler } from 'liquidjs/dist/template';
2
+ import type { LiquidSwell } from '..';
3
+ export default function bind(_liquidSwell: LiquidSwell): FilterHandler;
@@ -1,2 +1,3 @@
1
- import { LiquidSwell } from '..';
2
- export default function bind(_liquidSwell: LiquidSwell): (input: any, space?: number) => Promise<string>;
1
+ import type { FilterHandler } from 'liquidjs/dist/template';
2
+ import type { LiquidSwell } from '..';
3
+ export default function bind(_liquidSwell: LiquidSwell): FilterHandler;
@@ -0,0 +1,3 @@
1
+ import type { FilterHandler } from 'liquidjs/dist/template';
2
+ import type { LiquidSwell } from '..';
3
+ export default function bind(_liquidSwell: LiquidSwell): FilterHandler;
@@ -1,2 +1,3 @@
1
- import { LiquidSwell } from "..";
2
- export default function bind(_liquidSwell: LiquidSwell): (assetUrl: string) => string;
1
+ import type { FilterHandler } from 'liquidjs/dist/template';
2
+ import type { LiquidSwell } from '..';
3
+ export default function bind(_liquidSwell: LiquidSwell): FilterHandler;
@@ -1,2 +1,3 @@
1
- import { LiquidSwell } from '..';
2
- export default function bind(liquidSwell: LiquidSwell): (key: string, params?: any[]) => Promise<string>;
1
+ import type { FilterHandler } from 'liquidjs/dist/template';
2
+ import type { LiquidSwell } from '..';
3
+ export default function bind(liquidSwell: LiquidSwell): FilterHandler;
@@ -1,4 +1,4 @@
1
- import { Liquid, type FS } from 'liquidjs';
1
+ import { Liquid } from 'liquidjs';
2
2
  import { SwellTheme } from '../theme';
3
3
  import type { GetAssetUrl, GetThemeConfig, GetThemeTemplateConfigByType, RenderCurrency, RenderTemplate, RenderPageSections, RenderTemplateString, RenderTranslation, ThemeSectionSchema } from 'types/swell';
4
4
  export * from './color';
@@ -6,14 +6,14 @@ export * from './form';
6
6
  export * from './font';
7
7
  interface LiquidSwellOptions {
8
8
  theme: SwellTheme;
9
- getThemeConfig: GetThemeConfig;
9
+ getThemeConfig?: GetThemeConfig;
10
10
  getThemeTemplateConfigByType?: GetThemeTemplateConfigByType;
11
- getAssetUrl: GetAssetUrl;
12
- renderTemplate: RenderTemplate;
13
- renderTemplateString: RenderTemplateString;
14
- renderPageSections: RenderPageSections;
15
- renderTranslation: RenderTranslation;
16
- renderCurrency: RenderCurrency;
11
+ getAssetUrl?: GetAssetUrl;
12
+ renderTemplate?: RenderTemplate;
13
+ renderTemplateString?: RenderTemplateString;
14
+ renderPageSections?: RenderPageSections;
15
+ renderTranslation?: RenderTranslation;
16
+ renderCurrency?: RenderCurrency;
17
17
  isEditor: boolean;
18
18
  locale?: string;
19
19
  currency?: string;
@@ -25,27 +25,23 @@ interface LiquidSwellOptions {
25
25
  export declare class LiquidSwell extends Liquid {
26
26
  theme: SwellTheme;
27
27
  getThemeConfig: GetThemeConfig;
28
- getThemeTemplateConfigByType: GetThemeTemplateConfigByType | undefined;
28
+ getThemeTemplateConfigByType: GetThemeTemplateConfigByType;
29
29
  getAssetUrl: GetAssetUrl;
30
30
  renderTemplate: RenderTemplate;
31
31
  renderTemplateString: RenderTemplateString;
32
32
  renderPageSections: RenderPageSections;
33
33
  renderTranslation: RenderTranslation;
34
34
  renderCurrency: RenderCurrency;
35
- engine: Liquid;
36
35
  isEditor: boolean;
37
- locale: string | undefined;
38
- currency: string | undefined;
39
- layoutName: string | undefined;
40
- extName: string | undefined;
41
- componentsDir: string | undefined;
42
- sectionsDir: string | undefined;
36
+ locale: string;
37
+ currency: string;
38
+ layoutName: string;
39
+ extName: string;
40
+ componentsDir: string;
41
+ sectionsDir: string;
43
42
  lastSchema: ThemeSectionSchema | undefined;
44
43
  constructor({ theme, getThemeConfig, getThemeTemplateConfigByType, getAssetUrl, renderTemplate, renderTemplateString, renderPageSections, renderTranslation, renderCurrency, isEditor, locale, currency, layoutName, extName, componentsDir, sectionsDir, }: LiquidSwellOptions);
45
- initLiquidEngine(): Liquid;
46
- getLiquidFS(): FS;
47
44
  parseAndRender(template: string, data: any): Promise<string>;
48
- resolveFilePath(fileName: string, extName?: string): string;
49
45
  resolveFilePathByType(type: string, name: string): Promise<string | undefined>;
50
46
  getComponentPath(componentName: string): Promise<string>;
51
47
  getSectionPath(sectionName: string): Promise<string>;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(_liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(_liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(_liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '../..';
1
+ import type { LiquidSwell } from '../..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(liquidSwell: LiquidSwell): TagClass;
@@ -1,3 +1,3 @@
1
- import { LiquidSwell } from '..';
1
+ import type { LiquidSwell } from '..';
2
2
  import type { TagClass } from 'liquidjs/dist/template';
3
3
  export default function bind(_liquidSwell: LiquidSwell): TagClass;
@@ -1,6 +1,8 @@
1
1
  import { LiquidSwell } from './';
2
+ import type { Swell } from '@/api';
2
3
  type DescribeLiquidCallbackType = (render: (template: string, data?: any) => Promise<string>, liquid: LiquidSwell) => void;
3
4
  export declare function describeFilter(name: string, callback: DescribeLiquidCallbackType): void;
4
5
  export declare function describeTag(name: string, callback: DescribeLiquidCallbackType): void;
5
6
  export declare function removeSpaces(value: string): string;
7
+ export declare function setStorefrontLocalization(swell: Swell, locale: string, currency: string): void;
6
8
  export {};
@@ -1,12 +1,4 @@
1
- import { Context } from 'liquidjs';
2
- export declare const toString: () => string;
3
- export declare const hasOwnProperty: (v: PropertyKey) => boolean;
4
- /**
5
- * Utils used by liquidjs tags and filters
6
- */
7
- export declare class Drop {
8
- liquidMethodMissing(key: string): undefined;
9
- }
1
+ import { Context, Drop } from 'liquidjs';
10
2
  export declare class ForloopDrop extends Drop {
11
3
  i: number;
12
4
  length: number;
@@ -22,10 +14,10 @@ export declare class ForloopDrop extends Drop {
22
14
  next(): void;
23
15
  valueOf(): string;
24
16
  }
25
- export declare function toValue(value: any): any;
17
+ export declare function toValue(value: unknown): unknown;
26
18
  export declare function isString(value: unknown): value is string;
27
19
  export declare function isNumber(value: unknown): value is number;
28
- export declare function isFunction(value: unknown): value is Function;
20
+ export declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
29
21
  export declare function toLiquid(value: unknown): unknown;
30
22
  export declare function isNil(value: unknown): value is undefined | null;
31
23
  export declare function isUndefined(value: unknown): value is undefined;
@@ -33,8 +25,8 @@ export declare function isArray<T>(value: unknown): value is Array<T>;
33
25
  export declare function isObject(value: unknown): value is Record<string, unknown>;
34
26
  export declare function isIterable<T>(value: unknown): value is Iterable<T>;
35
27
  export declare function isLikePromise(value: unknown): value is Promise<unknown>;
36
- export declare function isTruthy(val: any, ctx: Context): boolean;
37
- export declare function isFalsy(val: any, ctx: Context): boolean;
28
+ export declare function isTruthy(val: unknown, ctx: Context): boolean;
29
+ export declare function isFalsy(val: unknown, ctx: Context): boolean;
38
30
  export interface Comparable {
39
31
  equals(rhs: unknown): boolean;
40
32
  gt(rhs: unknown): boolean;
@@ -46,5 +38,5 @@ export declare function isComparable(arg: unknown): arg is Comparable;
46
38
  export declare function toArray<T>(val: unknown): T[];
47
39
  export declare function toEnumerable<T>(val: unknown): T[];
48
40
  export declare function stringify(value: unknown): string;
49
- export declare function paramsToProps(params: string[] | Record<string, string>): Record<string, unknown>;
41
+ export declare function paramsToProps(params: (string | [string, unknown])[] | Record<string, string>): Record<string, unknown>;
50
42
  export declare function jsonStringifyAsync(input: unknown, space?: number): Promise<string>;
@@ -3,7 +3,7 @@ import { SwellStorefrontRecord, SwellStorefrontCollection } from './api';
3
3
  import { type SwellMenu, type SwellMenuItem } from '../types/swell';
4
4
  export declare function resolveMenuSettings(theme: SwellTheme, menus: SwellMenu[], options?: {
5
5
  currentUrl?: string;
6
- }): Promise<Record<string, SwellMenu>>;
6
+ }): Promise<Record<string, SwellMenu | undefined>>;
7
7
  export declare function resolveMenuItems(theme: SwellTheme, menuItems: SwellMenuItem[], options?: {
8
8
  currentUrl?: string;
9
9
  }): Promise<SwellMenuItem[]>;
@@ -1,4 +1,5 @@
1
1
  import { Swell } from '@/api';
2
+ import { ThemeCache } from '../cache';
2
3
  import type { SwellThemeConfig, SwellThemeVersion } from 'types/swell';
3
4
  /**
4
5
  * Responsible for loading a theme.
@@ -15,6 +16,10 @@ export declare class ThemeLoader {
15
16
  * Loads theme configs for this version.
16
17
  */
17
18
  loadTheme(): Promise<SwellThemeConfig[]>;
19
+ /**
20
+ * Returns the cache instance for this theme loader.
21
+ */
22
+ getCache(): ThemeCache;
18
23
  /**
19
24
  * Load theme configs from internal data, typically in the editor.
20
25
  */
@@ -67,5 +72,4 @@ export declare class ThemeLoader {
67
72
  * Generates a Swell API query filter for this theme version.
68
73
  */
69
74
  private themeVersionQueryFilter;
70
- private getCache;
71
75
  }
@@ -2,7 +2,8 @@ import { Swell, StorefrontResource, SwellStorefrontCollection, SwellStorefrontRe
2
2
  import { ShopifyCompatibility } from './compatibility/shopify';
3
3
  import { LiquidSwell, ThemeFont, ThemeForm } from './liquid';
4
4
  import { ThemeLoader } from './theme/theme-loader';
5
- import type { ThemeGlobals, ThemeConfigs, ThemeSettings, ThemeResources, ThemeFormConfig, ThemeFormErrorMessages, ThemePresetSchema, ThemeSectionGroup, ThemeSectionGroupInfo, ThemeSectionSchema, ThemeSectionConfig, ThemeSectionSettings, ThemeSettingFieldSchema, ThemeSettingSectionSchema, ThemePageSectionSchema, ThemePageTemplateConfig, ThemeLayoutSectionGroupConfig, SwellData, SwellMenu, SwellRecord, SwellAppConfig, SwellThemeConfig, SwellThemeVersion, SwellAppStorefrontThemeProps, SwellAppShopifyCompatibilityConfig } from 'types/swell';
5
+ import type { FormatInput } from 'swell-js';
6
+ import type { ThemeGlobals, ThemeConfigs, ThemeSettings, ThemeResources, ThemeFormConfig, ThemeFormErrorMessages, ThemePresetSchema, ThemeSectionGroup, ThemeSectionGroupInfo, ThemeSectionSchema, ThemeSectionConfig, ThemeSectionSettings, ThemeSettingFieldSchema, ThemeSettingSectionSchema, ThemePageSectionSchema, ThemePageTemplateConfig, ThemeLayoutSectionGroupConfig, SwellData, SwellMenu, SwellRecord, SwellAppConfig, SwellThemeConfig, SwellThemeVersion, SwellAppStorefrontThemeProps, SwellAppShopifyCompatibilityConfig, ThemePage, SwellPageRequest, SwellSettingsGeo } from 'types/swell';
6
7
  export declare class SwellTheme {
7
8
  swell: Swell;
8
9
  props: SwellAppStorefrontThemeProps;
@@ -12,7 +13,7 @@ export declare class SwellTheme {
12
13
  liquidSwell: LiquidSwell;
13
14
  themeLoader: ThemeLoader;
14
15
  themeConfigs: Map<string, SwellThemeConfig> | null;
15
- page: any;
16
+ page?: ThemeSettings;
16
17
  pageId: string | undefined;
17
18
  shopifyCompatibility: ShopifyCompatibility | null;
18
19
  shopifyCompatibilityClass: typeof ShopifyCompatibility;
@@ -27,18 +28,18 @@ export declare class SwellTheme {
27
28
  });
28
29
  getSwellAppThemeProps(swellConfig?: SwellAppConfig): SwellAppStorefrontThemeProps;
29
30
  initGlobals(pageId: string): Promise<void>;
30
- setGlobals(globals: SwellData): void;
31
+ setGlobals(globals: Partial<ThemeGlobals>): void;
31
32
  getSettingsAndConfigs(): Promise<{
32
33
  store: SwellData;
33
34
  session: SwellData;
34
- menus: Record<string, SwellMenu>;
35
- geo: SwellData;
35
+ menus: Record<string, SwellMenu | undefined>;
36
+ geo: SwellSettingsGeo;
36
37
  configs: ThemeConfigs;
37
38
  }>;
38
- resolvePageData(store: SwellData, configs: SwellData, pageId?: string): Promise<{
39
+ resolvePageData(store: SwellData, configs: ThemeConfigs, pageId?: string): Promise<{
39
40
  settings: ThemeSettings;
40
- request: ThemeSettings;
41
- page: ThemeSettings;
41
+ request: SwellPageRequest;
42
+ page: ThemePage;
42
43
  cart: SwellStorefrontSingleton | {};
43
44
  account: SwellStorefrontSingleton | null;
44
45
  customer?: SwellStorefrontSingleton | null;
@@ -95,7 +96,7 @@ export declare class SwellTheme {
95
96
  setCompatibilityData(pageData: SwellData): void;
96
97
  resolveLookupSetting(setting: ThemeSettingFieldSchema, value: any): SwellData | SwellStorefrontRecord | SwellStorefrontCollection | null;
97
98
  resolveLookupResource(collection: string, id: string): StorefrontResource<SwellRecord>;
98
- resolveMenuSettings(): Promise<Record<string, SwellMenu>>;
99
+ resolveMenuSettings(): Promise<Record<string, SwellMenu | undefined>>;
99
100
  resolveMenuSetting(value: string): SwellMenu | null;
100
101
  lang(key: string, data?: any, fallback?: string): Promise<string>;
101
102
  resolveFontSetting(value: string): ThemeFont;
@@ -116,13 +117,13 @@ export declare class SwellTheme {
116
117
  renderTemplateString(templateString: string, data?: SwellData): Promise<string>;
117
118
  getSectionSchema(sectionName: string): Promise<Partial<ThemeSectionSchema> | undefined>;
118
119
  getSectionConfigWithSchemaTagOnly(config: SwellThemeConfig): SwellThemeConfig | null;
120
+ renderThemeTemplate(filePath: `${string}.liquid`, data?: SwellData): Promise<string>;
121
+ renderThemeTemplate(filePath: `${string}.json`, data?: SwellData): Promise<ThemePageTemplateConfig>;
119
122
  renderThemeTemplate(filePath: string, data?: SwellData): Promise<string | ThemePageTemplateConfig>;
120
123
  renderLayoutTemplate(name: string, data?: SwellData): Promise<string>;
121
124
  renderPageTemplate(name: string, data?: SwellData, altTemplateId?: string): Promise<string | ThemePageTemplateConfig>;
122
125
  renderPage(pageData?: SwellData, altTemplateId?: string): Promise<string | ThemePageTemplateConfig>;
123
- renderAllSections(sectionsIds: string | Array<string>, pageData?: SwellData): Promise<{
124
- [key: string]: string;
125
- }>;
126
+ renderAllSections(sectionsIds: string | Array<string>, pageData?: SwellData): Promise<Record<string, string | undefined>>;
126
127
  renderSection(sectionId: string, pageData?: SwellData): Promise<string | ThemePageTemplateConfig>;
127
128
  renderLayout(data?: SwellData): Promise<string>;
128
129
  getContentForHeader(): string;
@@ -147,12 +148,11 @@ export declare class SwellTheme {
147
148
  renderSectionConfigs(sectionConfigs: ThemeSectionConfig[], data?: SwellData): Promise<ThemeSectionConfig[]>;
148
149
  renderTranslation(key: string, data?: unknown, fallback?: string): Promise<string>;
149
150
  renderTranslationValue(localeCode: string, langConfig: any, key: string, data?: any, fallback?: string): Promise<string>;
150
- renderCurrency(amount: number, params: any): string;
151
+ renderCurrency(amount: number, params?: FormatInput): string;
151
152
  }
152
- export declare class PageError {
153
+ export declare class PageError extends Error {
153
154
  title: string;
154
155
  status: number;
155
- message: string;
156
156
  description?: string;
157
157
  constructor(title?: string | Error, status?: number, description?: string);
158
158
  toString(): string;
@@ -8,7 +8,7 @@ export declare function isObject(value: unknown): value is Record<string, unknow
8
8
  export declare function toBase64(inputString: string): string;
9
9
  export declare function arrayToObject<T extends {
10
10
  [I in keyof T | K]?: T[I];
11
- }, K extends string = 'id'>(arr: T[], key?: K): Record<string, T>;
11
+ }, K extends string = 'id'>(arr: T[], key?: K): Record<string, T | undefined>;
12
12
  export declare function getCountryCodeFromLocale(locale: string): string;
13
13
  export declare function forEachKeyDeep(obj: Record<string, unknown>, fn: (key: string, value: unknown) => boolean | void): void;
14
14
  export declare function findCircularReferences(value: object): unknown[];