@swell/apps-sdk 1.0.107 → 1.0.109

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.
@@ -1,4 +1,5 @@
1
- import { ShopifyCompatibility } from '../shopify';
2
- import { ShopifyResource } from './resource';
3
1
  import type { SwellData } from 'types/swell';
4
- export default function ShopifyLocalization(instance: ShopifyCompatibility, store: SwellData, request: SwellData): ShopifyResource;
2
+ import type { ShopifyCompatibility } from '../shopify';
3
+ import type { ShopifyCountry, ShopifyLocalization } from 'types/shopify';
4
+ export default function ShopifyLocalization(instance: ShopifyCompatibility, store: SwellData, request: SwellData): ShopifyLocalization;
5
+ export declare function isLikeShopifyCountry(value: unknown): value is ShopifyCountry;
@@ -2,7 +2,6 @@ import { Swell } from '@/api';
2
2
  import { ThemeFont } from '@/liquid/font';
3
3
  import { ThemeForm } from '@/liquid/form';
4
4
  import { SwellTheme } from '@/theme';
5
- import { ShopifyResource } from './shopify-objects';
6
5
  import type { ThemeGlobals, ThemeSettings, ThemePresetSchema, ThemeEditorSchema, ThemeSectionSchemaData, ThemeLocaleConfig, SwellData, SwellMenu, SwellAppShopifyCompatibilityConfig, SwellSettingsGeo } from '../../types/swell';
7
6
  import type { ShopifySettingsData, ShopifySettingsSchema, ShopifySectionSchema, ShopifyPageResourceMap, ShopifyObjectResourceMap, ShopifyFormResourceMap, ShopifyQueryParamsMap } from '../../types/shopify';
8
7
  /**
@@ -109,7 +108,7 @@ export declare class ShopifyCompatibility {
109
108
  root_url: string;
110
109
  search_url: string;
111
110
  };
112
- getLocalizationObject(store: SwellData, request: SwellData): ShopifyResource;
111
+ getLocalizationObject(store: SwellData, request: SwellData): import("../../types/shopify").ShopifyLocalization;
113
112
  getAdaptedPageUrl(url: string): string | undefined;
114
113
  getThemeFilePath(type: string, name: string): string;
115
114
  getPageResourceMap(): ShopifyPageResourceMap;
@@ -1,6 +1,7 @@
1
- import { LiquidSwell } from '..';
2
- declare const _default: {
3
- bind(_liquidSwell: LiquidSwell): (imageField: any, ...params: any[]) => Promise<string>;
1
+ import type { LiquidSwell } from '..';
2
+ import type { FilterHandler } from 'liquidjs/dist/template';
3
+ declare const filterDefinition: {
4
+ bind(liquidSwell: LiquidSwell): FilterHandler;
4
5
  resolve: string[][];
5
6
  };
6
- export default _default;
7
+ export default filterDefinition;
@@ -39,6 +39,7 @@ 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
41
  import type { LiquidSwell } from '..';
42
+ import type { FilterHandler } from 'liquidjs/dist/template';
42
43
  export declare const filters: {
43
44
  asset_url: typeof asset_url;
44
45
  brightness_difference: typeof brightness_difference;
@@ -67,7 +68,7 @@ export declare const filters: {
67
68
  };
68
69
  image_tag: typeof image_tag;
69
70
  image_url: {
70
- bind(_liquidSwell: LiquidSwell): (imageField: any, ...params: any[]) => Promise<string>;
71
+ bind(liquidSwell: LiquidSwell): FilterHandler;
71
72
  resolve: string[][];
72
73
  };
73
74
  inline_asset_content: typeof inline_asset_content;
@@ -11,6 +11,7 @@ import render from './render';
11
11
  import section from './section';
12
12
  import sections from './sections';
13
13
  import style from './style';
14
+ import stylesheet from './stylesheet';
14
15
  import include from './shopify/include';
15
16
  import schema from './shopify/schema';
16
17
  import inline_editable from './inline_editable';
@@ -29,6 +30,7 @@ export declare const tags: {
29
30
  style: typeof style;
30
31
  include: typeof include;
31
32
  schema: typeof schema;
33
+ stylesheet: typeof stylesheet;
32
34
  inline_editable: typeof inline_editable;
33
35
  };
34
36
  export declare function bindTags(liquidSwell: LiquidSwell): void;
@@ -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;
@@ -0,0 +1,3 @@
1
+ import type { LiquidSwell } from '..';
2
+ import type { TagClass } from 'liquidjs/dist/template';
3
+ export default function bind(_liquidSwell: LiquidSwell): TagClass;
@@ -1,4 +1,4 @@
1
- import type { SwellData, SwellThemeConfig, ThemeLayoutSectionGroupConfig, ThemePageSectionSchema, ThemeSectionConfig, ThemeSectionGroup, ThemeSectionSchema, ThemeSettings } from 'types/swell';
1
+ import type { SwellData, SwellLocale, SwellThemeConfig, ThemeLayoutSectionGroupConfig, ThemePageSectionSchema, ThemeSectionConfig, ThemeSectionGroup, ThemeSectionSchema, ThemeSettings } from 'types/swell';
2
2
  export * from './md5';
3
3
  export declare function getAllSections(themeConfigs: Map<string, SwellThemeConfig>, renderTemplateSchema: (config: SwellThemeConfig) => Promise<ThemeSectionSchema | undefined>): Promise<ThemePageSectionSchema[]>;
4
4
  export declare function getLayoutSectionGroups(allSections: Map<string, SwellThemeConfig>, renderTemplateSchema: (config: SwellThemeConfig) => Promise<Partial<ThemeSectionSchema> | undefined>): Promise<ThemeLayoutSectionGroupConfig[]>;
@@ -10,6 +10,7 @@ export declare function arrayToObject<T extends {
10
10
  [I in keyof T | K]?: T[I];
11
11
  }, K extends string = 'id'>(arr: T[], key?: K): Record<string, T | undefined>;
12
12
  export declare function getCountryCodeFromLocale(locale: string): string;
13
+ export declare function isLikeSwellLocale(value: unknown): value is SwellLocale;
13
14
  export declare function forEachKeyDeep(obj: Record<string, unknown>, fn: (key: string, value: unknown) => boolean | void): void;
14
15
  export declare function findCircularReferences(value: object): unknown[];
15
16
  export declare function removeCircularReferences(value: object): object;
@@ -128,4 +128,38 @@ export interface ShopifyQueryParams {
128
128
  to: string | ((param: string, value: string) => SwellData);
129
129
  }
130
130
  export type ShopifyQueryParamsMap = ShopifyQueryParams[];
131
+ export interface ShopifyLocale {
132
+ endonym_name: string;
133
+ iso_code: string;
134
+ name: string;
135
+ primary: boolean;
136
+ root_url: string;
137
+ }
138
+ export interface ShopifyCurrency {
139
+ iso_code: string;
140
+ name: string;
141
+ symbol: string;
142
+ }
143
+ export interface ShopifyMarket {
144
+ handle: string;
145
+ id: number;
146
+ metafields: Record<string, unknown>;
147
+ }
148
+ export interface ShopifyCountry {
149
+ available_languages: ShopifyLocale[];
150
+ continent: 'Africa' | 'Asia' | 'Central America' | 'Europe' | 'North America' | 'Oceania' | 'South America';
151
+ currency: ShopifyCurrency;
152
+ iso_code: string;
153
+ market: ShopifyMarket;
154
+ name: string;
155
+ 'popular?': boolean;
156
+ unit_system: 'imperial' | 'metric';
157
+ }
158
+ export interface ShopifyLocalization {
159
+ available_countries: ShopifyCountry[];
160
+ available_languages: ShopifyLocale[];
161
+ country: ShopifyCountry;
162
+ language: ShopifyLocale;
163
+ market: ShopifyMarket;
164
+ }
131
165
  export {};
@@ -98,6 +98,11 @@ export interface SwellSettingsGeo {
98
98
  states: SwellSettingsGeoState[];
99
99
  timezones: SwellSettingsGeoTimezone[];
100
100
  }
101
+ export interface SwellLocale {
102
+ code: string;
103
+ name: string;
104
+ fallback?: string | null;
105
+ }
101
106
  export interface SwellPageRequest {
102
107
  host: string;
103
108
  origin: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swell/apps-sdk",
3
3
  "type": "module",
4
- "version": "1.0.107",
4
+ "version": "1.0.109",
5
5
  "description": "Swell SDK for building isomorphic apps.",
6
6
  "author": "Swell",
7
7
  "license": "MIT",
@@ -43,6 +43,7 @@
43
43
  "cache-manager": "^6.3.2",
44
44
  "color": "^4.2.3",
45
45
  "country-flag-icons": "1.5.18",
46
+ "json5": "^2.2.3",
46
47
  "keyv": "^5.2.3",
47
48
  "liquidjs": "^10.21.0",
48
49
  "lodash": "^4.17.21",