@storepecker/editor-bridge 1.0.1
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.d.mts +556 -0
- package/dist/index.d.ts +556 -0
- package/dist/index.js +587 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +545 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
|
|
5
|
+
interface LandingPageConfig {
|
|
6
|
+
store: number;
|
|
7
|
+
theme: ThemeInfo;
|
|
8
|
+
navbar: NavbarConfig;
|
|
9
|
+
color_scheme: ColorSchemeConfig;
|
|
10
|
+
hero: HeroConfig;
|
|
11
|
+
sections: SectionItem[];
|
|
12
|
+
footer: FooterConfig;
|
|
13
|
+
social_links: SocialLinksConfig;
|
|
14
|
+
font_styles: FontStylesConfig;
|
|
15
|
+
logo: string;
|
|
16
|
+
secondary_logo: string;
|
|
17
|
+
favicon: string;
|
|
18
|
+
social_image?: string;
|
|
19
|
+
store_name: string;
|
|
20
|
+
store_description: string;
|
|
21
|
+
store_url: string;
|
|
22
|
+
custom_css: string;
|
|
23
|
+
custom_js: string;
|
|
24
|
+
start_head_tag: string;
|
|
25
|
+
end_head_tag: string;
|
|
26
|
+
start_body_tag: string;
|
|
27
|
+
end_body_tag: string;
|
|
28
|
+
google_tag_manager_id: string;
|
|
29
|
+
facebook_pixel_id: string;
|
|
30
|
+
video_banners?: any[];
|
|
31
|
+
privacy_policy?: string;
|
|
32
|
+
terms_and_condition?: string;
|
|
33
|
+
refund_policy?: string;
|
|
34
|
+
}
|
|
35
|
+
interface ThemeInfo {
|
|
36
|
+
id: number;
|
|
37
|
+
name: string;
|
|
38
|
+
slug: string;
|
|
39
|
+
color_scheme?: Record<string, string>;
|
|
40
|
+
is_active?: boolean;
|
|
41
|
+
}
|
|
42
|
+
interface NavbarConfig {
|
|
43
|
+
cart: boolean;
|
|
44
|
+
wishlist: boolean;
|
|
45
|
+
headerbg: string;
|
|
46
|
+
textColor: string;
|
|
47
|
+
logoPosition: string;
|
|
48
|
+
ribbonbar: RibbonBarConfig;
|
|
49
|
+
navElements: NavElement[];
|
|
50
|
+
}
|
|
51
|
+
interface RibbonBarConfig {
|
|
52
|
+
id: string;
|
|
53
|
+
type: string;
|
|
54
|
+
messages: Array<{
|
|
55
|
+
link: string;
|
|
56
|
+
message: string;
|
|
57
|
+
}>;
|
|
58
|
+
position: string;
|
|
59
|
+
animation: string;
|
|
60
|
+
textColor: string;
|
|
61
|
+
switchInterval: number;
|
|
62
|
+
}
|
|
63
|
+
interface NavElement {
|
|
64
|
+
key: string;
|
|
65
|
+
link?: string;
|
|
66
|
+
title: string;
|
|
67
|
+
enabled: boolean;
|
|
68
|
+
description?: string;
|
|
69
|
+
is_dropdown: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface ColorSchemeConfig {
|
|
72
|
+
primary: string;
|
|
73
|
+
secondary: string;
|
|
74
|
+
btnText: string;
|
|
75
|
+
palette?: string;
|
|
76
|
+
headerbg: string;
|
|
77
|
+
textColor: string;
|
|
78
|
+
textPrimary: string;
|
|
79
|
+
textPrimaryLight?: string;
|
|
80
|
+
textSecondary: string;
|
|
81
|
+
bodyBackground: string;
|
|
82
|
+
bodyBackground1?: string;
|
|
83
|
+
bodyBackgroundSecondary: string;
|
|
84
|
+
bodyBackgroundDark?: string;
|
|
85
|
+
borderBackground: string;
|
|
86
|
+
footerBgColor: string;
|
|
87
|
+
footerTextColor: string;
|
|
88
|
+
enableDarkMode: boolean;
|
|
89
|
+
themeBackground?: {
|
|
90
|
+
mobile: string;
|
|
91
|
+
desktop: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
interface HeroConfig {
|
|
95
|
+
cta: string;
|
|
96
|
+
title: string;
|
|
97
|
+
ctaLink: string;
|
|
98
|
+
showCTA: boolean;
|
|
99
|
+
heroImage: string;
|
|
100
|
+
showTitle: boolean;
|
|
101
|
+
bannerLink: string;
|
|
102
|
+
enableSlider: boolean;
|
|
103
|
+
showHeroBanner: boolean;
|
|
104
|
+
heroImageMobile: string;
|
|
105
|
+
sliderSettings: SliderSlide[];
|
|
106
|
+
switchInterval: number;
|
|
107
|
+
}
|
|
108
|
+
interface SliderSlide {
|
|
109
|
+
id: string;
|
|
110
|
+
cta: string;
|
|
111
|
+
title: string;
|
|
112
|
+
ctaLink: string;
|
|
113
|
+
bannerImage: string;
|
|
114
|
+
bannerImageMobile?: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
showContents: boolean;
|
|
117
|
+
}
|
|
118
|
+
interface FooterConfig {
|
|
119
|
+
showSocialLinks: boolean;
|
|
120
|
+
showNameWithLogo: boolean;
|
|
121
|
+
showContactDetails: boolean;
|
|
122
|
+
showWhatsappBubble: boolean;
|
|
123
|
+
showMadeWithStorepecker: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface SocialLinksConfig {
|
|
126
|
+
twitter?: string;
|
|
127
|
+
youtube?: string;
|
|
128
|
+
facebook?: string;
|
|
129
|
+
instagram?: string;
|
|
130
|
+
}
|
|
131
|
+
interface FontStylesConfig {
|
|
132
|
+
body: FontConfig;
|
|
133
|
+
heading: FontConfig;
|
|
134
|
+
}
|
|
135
|
+
interface FontConfig {
|
|
136
|
+
name: string;
|
|
137
|
+
font_family: string;
|
|
138
|
+
font_weight: number;
|
|
139
|
+
font_url: string;
|
|
140
|
+
label?: string;
|
|
141
|
+
value?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A section in the landing page sections[] array.
|
|
145
|
+
* The `type` field determines which component renders it.
|
|
146
|
+
* Each type has different additional fields — we use [key: string]: any
|
|
147
|
+
* because section types are extensible and vary by theme.
|
|
148
|
+
*/
|
|
149
|
+
interface SectionItem {
|
|
150
|
+
id: string;
|
|
151
|
+
type: string;
|
|
152
|
+
title?: string;
|
|
153
|
+
enabled?: boolean;
|
|
154
|
+
[key: string]: any;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface EditorProviderProps {
|
|
158
|
+
/**
|
|
159
|
+
* The config fetched by the Server Component from GET /store/store_settings/.
|
|
160
|
+
* Must be the EXACT JSON shape — no transformation needed.
|
|
161
|
+
*/
|
|
162
|
+
initialConfig: LandingPageConfig;
|
|
163
|
+
/**
|
|
164
|
+
* Allowed origin for postMessage. Set to the editor SPA domain in production.
|
|
165
|
+
* Default: "*" (accepts all — set NEXT_PUBLIC_EDITOR_ORIGIN in production!)
|
|
166
|
+
*/
|
|
167
|
+
editorOrigin?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Optional: custom CSS variable mapping. Override if your theme uses
|
|
170
|
+
* different CSS property names than the default Starter Theme.
|
|
171
|
+
* Map keys are color_scheme field names → values are CSS property names.
|
|
172
|
+
* Example: { primary: '--brand-color', secondary: '--accent-color' }
|
|
173
|
+
*/
|
|
174
|
+
cssVarOverrides?: Record<string, string>;
|
|
175
|
+
children: React__default.ReactNode;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Core provider component that enables Visual Editor Mode in Snapstore themes.
|
|
179
|
+
*
|
|
180
|
+
* In normal mode (customer visiting the store), this provider is dormant — it passes
|
|
181
|
+
* the server-fetched initialConfig through context unchanged with zero runtime overhead.
|
|
182
|
+
*
|
|
183
|
+
* In editor mode (?editor=true + loaded inside an iframe), it:
|
|
184
|
+
* 1. Activates editor mode and adds 'editor-mode-active' class to <body>
|
|
185
|
+
* 2. Listens for postMessage events from the parent editor SPA
|
|
186
|
+
* 3. Dispatches config changes through the reducer for immutable state updates
|
|
187
|
+
* 4. Syncs CSS custom properties on <html> when colors/fonts change
|
|
188
|
+
* 5. Reports section DOM positions to the editor for overlay alignment
|
|
189
|
+
* 6. Injects editor-specific CSS (hover outlines, disabled interactions)
|
|
190
|
+
*
|
|
191
|
+
* @param props.initialConfig - The full LandingPageConfig from GET /store/landing_page/.
|
|
192
|
+
* @param props.editorOrigin - Allowed postMessage origin. Defaults to "*"; set in production.
|
|
193
|
+
* @param props.cssVarOverrides - Optional map to override default CSS variable name mappings.
|
|
194
|
+
* @param props.children - Child components that consume editor context via hooks.
|
|
195
|
+
*/
|
|
196
|
+
declare function EditorProvider({ initialConfig, editorOrigin, cssVarOverrides, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Shape of the value provided by EditorContext.
|
|
200
|
+
* - isEditorMode: Whether the store is running inside the editor iframe with ?editor=true.
|
|
201
|
+
* - config: The current LandingPageConfig — either the original server-fetched config
|
|
202
|
+
* (normal mode) or a live-updating copy managed by the config reducer (editor mode).
|
|
203
|
+
*/
|
|
204
|
+
interface EditorContextValue {
|
|
205
|
+
isEditorMode: boolean;
|
|
206
|
+
config: LandingPageConfig;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* React Context that holds the editor state. Consumed by all useXxxConfig hooks.
|
|
210
|
+
* Defaults to null when no EditorProvider is present in the component tree.
|
|
211
|
+
*/
|
|
212
|
+
declare const EditorContext: React.Context<EditorContextValue | null>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Returns whether the store is currently running in editor mode.
|
|
216
|
+
* Editor mode is active when the page is loaded inside an iframe with ?editor=true.
|
|
217
|
+
* Returns { isEditorMode: false } when used outside of EditorProvider.
|
|
218
|
+
*/
|
|
219
|
+
declare function useEditorMode(): {
|
|
220
|
+
isEditorMode: boolean;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Returns the full LandingPageConfig object from EditorContext.
|
|
225
|
+
* In normal mode, this is the original server-fetched config.
|
|
226
|
+
* In editor mode, this is the live-updating copy that reflects changes from the editor SPA.
|
|
227
|
+
* Returns null when used outside of EditorProvider.
|
|
228
|
+
*/
|
|
229
|
+
declare function useLandingConfig(): LandingPageConfig | null;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Returns the hero banner configuration (title, CTA, images, slider settings).
|
|
233
|
+
* Updates live in editor mode when the editor SPA sends hero changes.
|
|
234
|
+
* Returns null when used outside of EditorProvider.
|
|
235
|
+
*/
|
|
236
|
+
declare function useHeroConfig(): HeroConfig | null;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Returns the ordered array of landing page sections from the config.
|
|
240
|
+
* Reflects live reordering, additions, removals, and toggles from the editor SPA.
|
|
241
|
+
* Memoized to prevent unnecessary re-renders when sections haven't changed.
|
|
242
|
+
* Returns an empty array when used outside of EditorProvider.
|
|
243
|
+
*/
|
|
244
|
+
declare function useSections(): SectionItem[];
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Finds and returns a single section by its unique ID from the sections array.
|
|
248
|
+
* Memoized to avoid re-computing on every render unless the sections array changes.
|
|
249
|
+
* Returns undefined if no section with the given ID exists.
|
|
250
|
+
*
|
|
251
|
+
* @param sectionId - The unique ID of the section to find (e.g., "categories-7kvobkg2g").
|
|
252
|
+
*/
|
|
253
|
+
declare function useSectionById(sectionId: string): SectionItem | undefined;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Returns the navbar configuration (logo position, cart/wishlist toggles, ribbon bar, nav elements).
|
|
257
|
+
* Updates live in editor mode when the editor SPA sends navbar changes.
|
|
258
|
+
* Returns null when used outside of EditorProvider.
|
|
259
|
+
*/
|
|
260
|
+
declare function useNavbarConfig(): NavbarConfig | null;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Returns the footer configuration (social links visibility, contact details, branding toggles).
|
|
264
|
+
* Updates live in editor mode when the editor SPA sends footer changes.
|
|
265
|
+
* Returns null when used outside of EditorProvider.
|
|
266
|
+
*/
|
|
267
|
+
declare function useFooterConfig(): FooterConfig | null;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Returns the color scheme configuration (primary, secondary, background, text, footer colors).
|
|
271
|
+
* When these values change in editor mode, EditorProvider also syncs CSS custom properties
|
|
272
|
+
* on <html> for instant visual updates across all SCSS-styled components.
|
|
273
|
+
* Returns null when used outside of EditorProvider.
|
|
274
|
+
*/
|
|
275
|
+
declare function useColorScheme(): ColorSchemeConfig | null;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Returns the font styles configuration (body and heading font family, weight, and Google Font URL).
|
|
279
|
+
* When fonts change in editor mode, EditorProvider syncs CSS custom properties and dynamically
|
|
280
|
+
* loads the new Google Font via <link> tag injection.
|
|
281
|
+
* Returns null when used outside of EditorProvider.
|
|
282
|
+
*/
|
|
283
|
+
declare function useFontStyles(): FontStylesConfig | null;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Returns branding-related fields (logo, secondary_logo, favicon, store_name, store_description).
|
|
287
|
+
* Memoized to only re-compute when one of these specific fields changes, avoiding unnecessary
|
|
288
|
+
* re-renders when other parts of the config update.
|
|
289
|
+
* Returns null when used outside of EditorProvider.
|
|
290
|
+
*/
|
|
291
|
+
declare function useBranding(): {
|
|
292
|
+
logo: string;
|
|
293
|
+
secondary_logo: string;
|
|
294
|
+
favicon: string;
|
|
295
|
+
store_name: string;
|
|
296
|
+
store_description: string;
|
|
297
|
+
} | null;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Returns social media link URLs (twitter, youtube, facebook, instagram).
|
|
301
|
+
* Updates live in editor mode when the editor SPA sends social link changes.
|
|
302
|
+
* Returns null when used outside of EditorProvider.
|
|
303
|
+
*/
|
|
304
|
+
declare function useSocialLinks(): SocialLinksConfig | null;
|
|
305
|
+
|
|
306
|
+
interface SectionWrapperProps {
|
|
307
|
+
sectionId: string;
|
|
308
|
+
sectionType: string;
|
|
309
|
+
enabled?: boolean;
|
|
310
|
+
className?: string;
|
|
311
|
+
children: React__default.ReactNode;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Wraps a landing page section with editor-aware behavior.
|
|
315
|
+
*
|
|
316
|
+
* In normal mode: renders children inside a <div> with data-section-id/data-section-type
|
|
317
|
+
* attributes. If enabled=false, returns null (section is hidden from customers).
|
|
318
|
+
*
|
|
319
|
+
* In editor mode: always renders (even disabled sections, shown dimmed at 0.35 opacity).
|
|
320
|
+
* Intercepts clicks and sends a 'store:section-clicked' postMessage to the parent editor SPA,
|
|
321
|
+
* allowing the editor to open the settings panel for the clicked section.
|
|
322
|
+
*
|
|
323
|
+
* @param props.sectionId - Unique section ID from the API (e.g., "categories-7kvobkg2g").
|
|
324
|
+
* @param props.sectionType - Section type string (e.g., "categories", "banner").
|
|
325
|
+
* @param props.enabled - Whether the section is visible. Defaults to true. Disabled sections
|
|
326
|
+
* are hidden in normal mode but shown dimmed in editor mode.
|
|
327
|
+
* @param props.className - Optional additional CSS class names.
|
|
328
|
+
* @param props.children - The actual section component to render inside the wrapper.
|
|
329
|
+
*/
|
|
330
|
+
declare function SectionWrapper({ sectionId, sectionType, enabled, className, children, }: SectionWrapperProps): react_jsx_runtime.JSX.Element | null;
|
|
331
|
+
|
|
332
|
+
interface MetaData {
|
|
333
|
+
meta_title: string;
|
|
334
|
+
meta_description: string;
|
|
335
|
+
favicon: string;
|
|
336
|
+
social_image?: string;
|
|
337
|
+
color_scheme: {
|
|
338
|
+
primary: string;
|
|
339
|
+
secondary: string;
|
|
340
|
+
bodyBackground: string;
|
|
341
|
+
bodyBackground1?: string;
|
|
342
|
+
bodyBackgroundSecondary: string;
|
|
343
|
+
bodyBackgroundDark?: string;
|
|
344
|
+
borderBackground: string;
|
|
345
|
+
textPrimary: string;
|
|
346
|
+
textPrimaryLight?: string;
|
|
347
|
+
textSecondary: string;
|
|
348
|
+
btnText: string;
|
|
349
|
+
};
|
|
350
|
+
google_tag_manager_id?: string;
|
|
351
|
+
facebook_pixel_id?: string;
|
|
352
|
+
font_styles?: FontStylesConfig;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
type EditorMessage = {
|
|
356
|
+
type: 'editor:init';
|
|
357
|
+
payload: {
|
|
358
|
+
config: LandingPageConfig;
|
|
359
|
+
};
|
|
360
|
+
} | {
|
|
361
|
+
type: 'editor:full-replace';
|
|
362
|
+
payload: {
|
|
363
|
+
config: LandingPageConfig;
|
|
364
|
+
};
|
|
365
|
+
} | {
|
|
366
|
+
type: 'editor:update';
|
|
367
|
+
payload: {
|
|
368
|
+
path: string;
|
|
369
|
+
value: any;
|
|
370
|
+
};
|
|
371
|
+
} | {
|
|
372
|
+
type: 'editor:hero-update';
|
|
373
|
+
payload: Partial<HeroConfig>;
|
|
374
|
+
} | {
|
|
375
|
+
type: 'editor:hero-slide-add';
|
|
376
|
+
payload: {
|
|
377
|
+
slide: SliderSlide;
|
|
378
|
+
position: number;
|
|
379
|
+
};
|
|
380
|
+
} | {
|
|
381
|
+
type: 'editor:hero-slide-remove';
|
|
382
|
+
payload: {
|
|
383
|
+
slideId: string;
|
|
384
|
+
};
|
|
385
|
+
} | {
|
|
386
|
+
type: 'editor:hero-slides-reorder';
|
|
387
|
+
payload: {
|
|
388
|
+
slideIds: string[];
|
|
389
|
+
};
|
|
390
|
+
} | {
|
|
391
|
+
type: 'editor:hero-slide-update';
|
|
392
|
+
payload: {
|
|
393
|
+
slideId: string;
|
|
394
|
+
data: Partial<SliderSlide>;
|
|
395
|
+
};
|
|
396
|
+
} | {
|
|
397
|
+
type: 'editor:sections-reorder';
|
|
398
|
+
payload: {
|
|
399
|
+
sectionIds: string[];
|
|
400
|
+
};
|
|
401
|
+
} | {
|
|
402
|
+
type: 'editor:section-add';
|
|
403
|
+
payload: {
|
|
404
|
+
section: SectionItem;
|
|
405
|
+
position: number;
|
|
406
|
+
};
|
|
407
|
+
} | {
|
|
408
|
+
type: 'editor:section-remove';
|
|
409
|
+
payload: {
|
|
410
|
+
sectionId: string;
|
|
411
|
+
};
|
|
412
|
+
} | {
|
|
413
|
+
type: 'editor:section-toggle';
|
|
414
|
+
payload: {
|
|
415
|
+
sectionId: string;
|
|
416
|
+
enabled: boolean;
|
|
417
|
+
};
|
|
418
|
+
} | {
|
|
419
|
+
type: 'editor:section-update';
|
|
420
|
+
payload: {
|
|
421
|
+
sectionId: string;
|
|
422
|
+
data: Partial<SectionItem>;
|
|
423
|
+
};
|
|
424
|
+
} | {
|
|
425
|
+
type: 'editor:navbar-update';
|
|
426
|
+
payload: Partial<LandingPageConfig['navbar']>;
|
|
427
|
+
} | {
|
|
428
|
+
type: 'editor:navbar-ribbon-update';
|
|
429
|
+
payload: Partial<RibbonBarConfig>;
|
|
430
|
+
} | {
|
|
431
|
+
type: 'editor:navbar-ribbon-message-add';
|
|
432
|
+
payload: {
|
|
433
|
+
message: {
|
|
434
|
+
link: string;
|
|
435
|
+
message: string;
|
|
436
|
+
};
|
|
437
|
+
position: number;
|
|
438
|
+
};
|
|
439
|
+
} | {
|
|
440
|
+
type: 'editor:navbar-ribbon-message-remove';
|
|
441
|
+
payload: {
|
|
442
|
+
index: number;
|
|
443
|
+
};
|
|
444
|
+
} | {
|
|
445
|
+
type: 'editor:navbar-ribbon-messages-reorder';
|
|
446
|
+
payload: {
|
|
447
|
+
messages: Array<{
|
|
448
|
+
link: string;
|
|
449
|
+
message: string;
|
|
450
|
+
}>;
|
|
451
|
+
};
|
|
452
|
+
} | {
|
|
453
|
+
type: 'editor:navbar-element-update';
|
|
454
|
+
payload: {
|
|
455
|
+
key: string;
|
|
456
|
+
data: Partial<NavElement>;
|
|
457
|
+
};
|
|
458
|
+
} | {
|
|
459
|
+
type: 'editor:navbar-element-add';
|
|
460
|
+
payload: {
|
|
461
|
+
element: NavElement;
|
|
462
|
+
position: number;
|
|
463
|
+
};
|
|
464
|
+
} | {
|
|
465
|
+
type: 'editor:navbar-element-remove';
|
|
466
|
+
payload: {
|
|
467
|
+
key: string;
|
|
468
|
+
};
|
|
469
|
+
} | {
|
|
470
|
+
type: 'editor:navbar-elements-reorder';
|
|
471
|
+
payload: {
|
|
472
|
+
elements: NavElement[];
|
|
473
|
+
};
|
|
474
|
+
} | {
|
|
475
|
+
type: 'editor:footer-update';
|
|
476
|
+
payload: Partial<FooterConfig>;
|
|
477
|
+
} | {
|
|
478
|
+
type: 'editor:color-scheme-update';
|
|
479
|
+
payload: Partial<ColorSchemeConfig>;
|
|
480
|
+
} | {
|
|
481
|
+
type: 'editor:font-styles-update';
|
|
482
|
+
payload: {
|
|
483
|
+
body?: Partial<FontConfig>;
|
|
484
|
+
heading?: Partial<FontConfig>;
|
|
485
|
+
};
|
|
486
|
+
} | {
|
|
487
|
+
type: 'editor:social-links-update';
|
|
488
|
+
payload: Partial<SocialLinksConfig>;
|
|
489
|
+
} | {
|
|
490
|
+
type: 'editor:branding-update';
|
|
491
|
+
payload: Partial<Pick<LandingPageConfig, 'logo' | 'secondary_logo' | 'favicon' | 'store_name' | 'store_description'>>;
|
|
492
|
+
} | {
|
|
493
|
+
type: 'editor:advanced-update';
|
|
494
|
+
payload: Partial<Pick<LandingPageConfig, 'custom_css' | 'custom_js' | 'start_head_tag' | 'end_head_tag' | 'start_body_tag' | 'end_body_tag' | 'google_tag_manager_id' | 'facebook_pixel_id'>>;
|
|
495
|
+
} | {
|
|
496
|
+
type: 'editor:highlight-section';
|
|
497
|
+
payload: {
|
|
498
|
+
sectionId: string | null;
|
|
499
|
+
};
|
|
500
|
+
} | {
|
|
501
|
+
type: 'editor:navigate';
|
|
502
|
+
payload: {
|
|
503
|
+
url: string;
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
type StoreMessage = {
|
|
507
|
+
type: 'store:ready';
|
|
508
|
+
payload: {
|
|
509
|
+
sections: SectionPosition[];
|
|
510
|
+
};
|
|
511
|
+
} | {
|
|
512
|
+
type: 'store:section-clicked';
|
|
513
|
+
payload: {
|
|
514
|
+
sectionId: string;
|
|
515
|
+
};
|
|
516
|
+
} | {
|
|
517
|
+
type: 'store:sections-updated';
|
|
518
|
+
payload: {
|
|
519
|
+
sections: SectionPosition[];
|
|
520
|
+
};
|
|
521
|
+
} | {
|
|
522
|
+
type: 'store:navigated';
|
|
523
|
+
payload: {
|
|
524
|
+
url: string;
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
interface SectionPosition {
|
|
528
|
+
id: string;
|
|
529
|
+
type: string;
|
|
530
|
+
rect: {
|
|
531
|
+
top: number;
|
|
532
|
+
left: number;
|
|
533
|
+
width: number;
|
|
534
|
+
height: number;
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Default mapping: color_scheme field name → CSS custom property name.
|
|
540
|
+
* These match what app/layout.tsx injects on <html style="...">.
|
|
541
|
+
*
|
|
542
|
+
* VERIFY against the actual layout.tsx in your theme!
|
|
543
|
+
* If your theme uses --brand-primary instead of --primary, pass
|
|
544
|
+
* cssVarOverrides to EditorProvider.
|
|
545
|
+
*/
|
|
546
|
+
declare const CSS_VAR_MAP: Record<string, string>;
|
|
547
|
+
/**
|
|
548
|
+
* Updates CSS custom properties on document.documentElement (<html>).
|
|
549
|
+
* Called by EditorProvider when color_scheme or font_styles change.
|
|
550
|
+
*
|
|
551
|
+
* This overwrites the same vars that layout.tsx set on initial SSR,
|
|
552
|
+
* so all SCSS that references var(--primary) etc. updates immediately.
|
|
553
|
+
*/
|
|
554
|
+
declare function syncCSSVars(colorScheme: ColorSchemeConfig, fontStyles: FontStylesConfig, overrides?: Record<string, string>): void;
|
|
555
|
+
|
|
556
|
+
export { CSS_VAR_MAP, type ColorSchemeConfig, EditorContext, type EditorContextValue, type EditorMessage, EditorProvider, type EditorProviderProps, type FontConfig, type FontStylesConfig, type FooterConfig, type HeroConfig, type LandingPageConfig, type MetaData, type NavElement, type NavbarConfig, type RibbonBarConfig, type SectionItem, type SectionPosition, SectionWrapper, type SectionWrapperProps, type SliderSlide, type SocialLinksConfig, type StoreMessage, type ThemeInfo, syncCSSVars, useBranding, useColorScheme, useEditorMode, useFontStyles, useFooterConfig, useHeroConfig, useLandingConfig, useNavbarConfig, useSectionById, useSections, useSocialLinks };
|