@swell/apps-sdk 1.0.105 → 1.0.107

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.
@@ -3,8 +3,8 @@ import { ThemeFont } from '@/liquid/font';
3
3
  import { ThemeForm } from '@/liquid/form';
4
4
  import { SwellTheme } from '@/theme';
5
5
  import { ShopifyResource } from './shopify-objects';
6
- import type { ThemeGlobals, ThemeSettings, ThemePresetSchema, ThemeEditorSchema, ThemeSectionSchemaData, SwellData, SwellMenu, SwellAppShopifyCompatibilityConfig, SwellSettingsGeo } from '../../types/swell';
7
- import type { ShopifySettingsData, ShopifySettingsSchema, ShopifySectionSchema, ShopifyPageResourceMap, ShopifyObjectResourceMap, ShopifyFormResourceMap, ShopifyQueryParamsMap, ShopifyLocalizationConfig } from '../../types/shopify';
6
+ import type { ThemeGlobals, ThemeSettings, ThemePresetSchema, ThemeEditorSchema, ThemeSectionSchemaData, ThemeLocaleConfig, SwellData, SwellMenu, SwellAppShopifyCompatibilityConfig, SwellSettingsGeo } from '../../types/swell';
7
+ import type { ShopifySettingsData, ShopifySettingsSchema, ShopifySectionSchema, ShopifyPageResourceMap, ShopifyObjectResourceMap, ShopifyFormResourceMap, ShopifyQueryParamsMap } from '../../types/shopify';
8
8
  /**
9
9
  * This class is meant to be extended by a storefront app to provide compatibility with Shopify's Liquid
10
10
  */
@@ -17,7 +17,7 @@ export declare class ShopifyCompatibility {
17
17
  formResourceMap: ShopifyFormResourceMap;
18
18
  queryParamsMap: ShopifyQueryParamsMap;
19
19
  shopifyCompatibilityConfig?: SwellAppShopifyCompatibilityConfig;
20
- editorLocaleConfig?: Record<string, ShopifyLocalizationConfig | undefined>;
20
+ editorLocaleConfig?: Record<string, ThemeLocaleConfig | undefined>;
21
21
  constructor(theme: SwellTheme);
22
22
  initGlobals(globals: ThemeGlobals): void;
23
23
  adaptGlobals(globals: Partial<ThemeGlobals>, prevGlobals: ThemeGlobals): void;
@@ -85,10 +85,9 @@ export declare class ShopifyCompatibility {
85
85
  getPresetsConfig(settingsData: ShopifySettingsData): ThemePresetSchema[];
86
86
  getEditorConfig(settingsSchema: ShopifySettingsSchema): ThemeEditorSchema;
87
87
  getSectionConfigSchema(sectionSchema: ShopifySectionSchema): ThemeSectionSchemaData;
88
- getLocaleConfig(theme: SwellTheme, localeCode?: string, suffix?: string): Promise<ShopifyLocalizationConfig>;
89
- getEditorLocaleConfig(theme: SwellTheme, localeCode: string): Promise<ShopifyLocalizationConfig>;
88
+ getEditorLocaleConfig(theme: SwellTheme, localeCode: string): Promise<ThemeLocaleConfig>;
90
89
  renderSchemaTranslations<T>(theme: SwellTheme, schema: T, localeCode?: string): Promise<T>;
91
- renderSchemaTranslationValue<T>(theme: SwellTheme, schemaValue: T, localCode: string, editorLocaleConfig: ShopifyLocalizationConfig): Promise<T>;
90
+ renderSchemaTranslationValue<T>(theme: SwellTheme, schemaValue: T, localCode: string, editorLocaleConfig: ThemeLocaleConfig): Promise<T>;
92
91
  getPageType(pageId: string): string;
93
92
  getPageRouteUrl(pageId: string): string;
94
93
  getPageRoutes(): {
@@ -17,4 +17,6 @@ interface PageSectionComponentProps {
17
17
  [key: string]: unknown;
18
18
  }
19
19
  export declare function getSectionSettingsFromProps(props: PageSectionComponentProps, sectionSchema?: ThemeSectionSchema): ThemeSectionBase | undefined;
20
+ export declare function toEasyblocksFieldId(fieldId?: string): string;
21
+ export declare function toSchemaFieldId(fieldId?: string): string;
20
22
  export {};
@@ -3,7 +3,7 @@ import { ShopifyCompatibility } from './compatibility/shopify';
3
3
  import { LiquidSwell, ThemeFont, ThemeForm } from './liquid';
4
4
  import { ThemeLoader } from './theme/theme-loader';
5
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
+ import type { ThemeGlobals, ThemeConfigs, ThemeSettings, ThemeResources, ThemeFormConfig, ThemeFormErrorMessages, ThemeLocaleConfig, 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';
7
7
  export declare class SwellTheme {
8
8
  swell: Swell;
9
9
  props: SwellAppStorefrontThemeProps;
@@ -91,9 +91,10 @@ export declare class SwellTheme {
91
91
  updateSettings(form: Record<string, {
92
92
  value: unknown;
93
93
  } | undefined>, config: Record<string, unknown>): ThemeSettings;
94
- resolveTranslationLocale(translationsConfig: ThemeSettings, locale?: string): ThemeSettings;
94
+ resolveTranslationLocale(languageConfig: ThemeSettings, locale?: string): ThemeSettings;
95
95
  setCompatibilityConfigs(configs: ThemeConfigs): Promise<void>;
96
96
  setCompatibilityData(pageData: SwellData): void;
97
+ getLocaleConfig(localeCode?: string, suffix?: string): Promise<ThemeLocaleConfig>;
97
98
  resolveLookupSetting(setting: ThemeSettingFieldSchema, value: any): SwellData | SwellStorefrontRecord | SwellStorefrontCollection | null;
98
99
  resolveLookupResource(collection: string, id: string): StorefrontResource<SwellRecord>;
99
100
  resolveMenuSettings(): Promise<Record<string, SwellMenu | undefined>>;
@@ -128,10 +128,4 @@ export interface ShopifyQueryParams {
128
128
  to: string | ((param: string, value: string) => SwellData);
129
129
  }
130
130
  export type ShopifyQueryParamsMap = ShopifyQueryParams[];
131
- export interface ShopifyLocalizationSection {
132
- [key: string]: string | ShopifyLocalizationSection;
133
- }
134
- export interface ShopifyLocalizationConfig {
135
- [key: string]: ShopifyLocalizationSection;
136
- }
137
131
  export {};
@@ -263,7 +263,7 @@ export interface ThemeGlobals extends SwellData {
263
263
  customer?: SwellStorefrontSingleton | null;
264
264
  geo: SwellSettingsGeo;
265
265
  configs: ThemeConfigs;
266
- translations: Record<string, unknown>;
266
+ language: Record<string, unknown>;
267
267
  canonical_url: string;
268
268
  shopify_compatibility: boolean;
269
269
  [key: string]: any;
@@ -272,7 +272,7 @@ export interface ThemeConfigs {
272
272
  editor: ThemeEditorSchema;
273
273
  theme: ThemeSettings;
274
274
  presets: ThemePresetSchema[];
275
- translations: ThemeSettings;
275
+ language: ThemeSettings;
276
276
  [key: string]: any;
277
277
  settings_schema?: ShopifySettingsSchema;
278
278
  settings_data?: ShopifySettingsData;
@@ -290,6 +290,12 @@ export interface ThemeResources {
290
290
  };
291
291
  records?: Record<string, ThemeLookupResourceFactory>;
292
292
  }
293
+ export interface ThemeLocaleSection {
294
+ [key: string]: string | ThemeLocaleSection;
295
+ }
296
+ export interface ThemeLocaleConfig {
297
+ [key: string]: ThemeLocaleSection;
298
+ }
293
299
  export interface ThemeEditorSchema {
294
300
  settings?: ThemeSettingSectionSchema[];
295
301
  menus?: any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@swell/apps-sdk",
3
3
  "type": "module",
4
- "version": "1.0.105",
4
+ "version": "1.0.107",
5
5
  "description": "Swell SDK for building isomorphic apps.",
6
6
  "author": "Swell",
7
7
  "license": "MIT",