@lightspeed/crane-api 1.1.0 → 1.1.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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +151 -11
- package/dist/index.d.ts +151 -11
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -185,7 +185,7 @@ interface ButtonContentData {
|
|
|
185
185
|
/**
|
|
186
186
|
* Raw category selector data from the editor.
|
|
187
187
|
*
|
|
188
|
-
* @see {@link
|
|
188
|
+
* @see {@link CategorySelectorContent}
|
|
189
189
|
*/
|
|
190
190
|
interface CategorySelectorData {
|
|
191
191
|
readonly categories: {
|
|
@@ -205,7 +205,7 @@ interface CategorySelectorData {
|
|
|
205
205
|
* @see {@link useCategorySelectorElementContent}
|
|
206
206
|
* @see {@link CategorySelectorData}
|
|
207
207
|
*/
|
|
208
|
-
interface
|
|
208
|
+
interface CategorySelectorContent {
|
|
209
209
|
/** Array of selected category objects with id, name, imageUrl, etc. */
|
|
210
210
|
categories: CategoryListComponentItem[];
|
|
211
211
|
/** `true` if at least one category is selected */
|
|
@@ -222,10 +222,12 @@ declare enum EditorTypes {
|
|
|
222
222
|
BUTTON = "BUTTON",
|
|
223
223
|
IMAGE = "IMAGE",
|
|
224
224
|
TOGGLE = "TOGGLE",
|
|
225
|
-
SELECTBOX = "SELECTBOX"
|
|
225
|
+
SELECTBOX = "SELECTBOX",
|
|
226
|
+
CATEGORY_SELECTOR = "CATEGORY_SELECTOR",
|
|
227
|
+
PRODUCT_SELECTOR = "PRODUCT_SELECTOR"
|
|
226
228
|
}
|
|
227
229
|
/** Gets a reactive reference to a field within a DECK card. */
|
|
228
|
-
declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string): {
|
|
230
|
+
declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string, storeData?: StoreData): {
|
|
229
231
|
readonly hasContent: boolean;
|
|
230
232
|
readonly value: string | undefined;
|
|
231
233
|
} | {
|
|
@@ -249,6 +251,140 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
249
251
|
hasTitle?: boolean | undefined;
|
|
250
252
|
hasLink?: boolean | undefined;
|
|
251
253
|
performAction?: (() => void) | undefined;
|
|
254
|
+
} | {
|
|
255
|
+
categories: {
|
|
256
|
+
readonly id: number;
|
|
257
|
+
readonly name: string;
|
|
258
|
+
readonly url: string;
|
|
259
|
+
readonly imageUrl?: string | undefined;
|
|
260
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
261
|
+
readonly imageBorderInfo?: {
|
|
262
|
+
readonly homogeneity?: boolean | undefined;
|
|
263
|
+
readonly dominatingColor?: {
|
|
264
|
+
readonly red?: number | undefined;
|
|
265
|
+
readonly green?: number | undefined;
|
|
266
|
+
readonly blue?: number | undefined;
|
|
267
|
+
readonly alpha?: number | undefined;
|
|
268
|
+
} | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
readonly alt?: string | undefined;
|
|
271
|
+
readonly productsCount: number;
|
|
272
|
+
}[];
|
|
273
|
+
hasCategories: boolean;
|
|
274
|
+
categoryIds: Array<number>;
|
|
275
|
+
hasContent: boolean;
|
|
276
|
+
} | {
|
|
277
|
+
products: {
|
|
278
|
+
readonly id: number;
|
|
279
|
+
readonly name: string;
|
|
280
|
+
readonly url: string;
|
|
281
|
+
readonly imageUrl?: string | undefined;
|
|
282
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
283
|
+
readonly fullImageUrl?: string | undefined;
|
|
284
|
+
readonly imageBorderInfo: {
|
|
285
|
+
readonly homogeneity?: boolean | undefined;
|
|
286
|
+
readonly dominatingColor?: {
|
|
287
|
+
readonly red?: number | undefined;
|
|
288
|
+
readonly green?: number | undefined;
|
|
289
|
+
readonly blue?: number | undefined;
|
|
290
|
+
readonly alpha?: number | undefined;
|
|
291
|
+
} | undefined;
|
|
292
|
+
};
|
|
293
|
+
readonly alternativeProductImage?: {
|
|
294
|
+
readonly imageUrl?: string | undefined;
|
|
295
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
296
|
+
readonly fullImageUrl?: string | undefined;
|
|
297
|
+
readonly imageBorderInfo?: {
|
|
298
|
+
readonly homogeneity?: boolean | undefined;
|
|
299
|
+
readonly dominatingColor?: {
|
|
300
|
+
readonly red?: number | undefined;
|
|
301
|
+
readonly green?: number | undefined;
|
|
302
|
+
readonly blue?: number | undefined;
|
|
303
|
+
readonly alpha?: number | undefined;
|
|
304
|
+
} | undefined;
|
|
305
|
+
} | undefined;
|
|
306
|
+
readonly alt?: string | undefined;
|
|
307
|
+
} | undefined;
|
|
308
|
+
readonly description?: string | undefined;
|
|
309
|
+
readonly price: number;
|
|
310
|
+
readonly comparePrice?: number | undefined;
|
|
311
|
+
readonly formattedPrice: string;
|
|
312
|
+
readonly formattedComparePrice?: string | undefined;
|
|
313
|
+
readonly lowestPrice?: {
|
|
314
|
+
readonly priceFormatted: string;
|
|
315
|
+
readonly label: string;
|
|
316
|
+
readonly countDateFromCreate: string;
|
|
317
|
+
} | undefined;
|
|
318
|
+
readonly zeroPrice?: boolean | undefined;
|
|
319
|
+
readonly inStock: boolean;
|
|
320
|
+
readonly subtitle?: string | undefined;
|
|
321
|
+
readonly sku?: string | undefined;
|
|
322
|
+
readonly quantity?: number | undefined;
|
|
323
|
+
readonly ribbon?: {
|
|
324
|
+
readonly text: string;
|
|
325
|
+
readonly color: {
|
|
326
|
+
red: number;
|
|
327
|
+
green: number;
|
|
328
|
+
blue: number;
|
|
329
|
+
alpha: number;
|
|
330
|
+
};
|
|
331
|
+
} | undefined;
|
|
332
|
+
readonly nameYourPriceEnabled?: boolean | undefined;
|
|
333
|
+
readonly attributeValues?: string[] | undefined;
|
|
334
|
+
readonly legalInfos?: {
|
|
335
|
+
readonly type: ProductLegalInfoType;
|
|
336
|
+
readonly text: string;
|
|
337
|
+
readonly url?: string | undefined;
|
|
338
|
+
readonly urlTarget?: string | undefined;
|
|
339
|
+
}[] | undefined;
|
|
340
|
+
readonly isSampleProduct?: boolean | undefined;
|
|
341
|
+
readonly subscriptionSettings?: {
|
|
342
|
+
readonly subscriptionAllowed: boolean;
|
|
343
|
+
readonly oneTimePurchaseAllowed: boolean;
|
|
344
|
+
readonly recurringChargeSettings: {
|
|
345
|
+
readonly subscriptionPriceWithSignUpFee?: number | undefined;
|
|
346
|
+
readonly subscriptionPriceWithSignUpFeeFormatted?: string | undefined;
|
|
347
|
+
}[];
|
|
348
|
+
readonly oneTimePurchasePrice?: number | undefined;
|
|
349
|
+
readonly oneTimePurchasePriceFormatted?: string | undefined;
|
|
350
|
+
readonly oneTimePurchaseMarkupPercent?: number | undefined;
|
|
351
|
+
} | undefined;
|
|
352
|
+
readonly preorder?: boolean | undefined;
|
|
353
|
+
readonly alt?: string | undefined;
|
|
354
|
+
readonly productRating?: {
|
|
355
|
+
readonly rating?: number | undefined;
|
|
356
|
+
readonly reviewsPublished?: number | undefined;
|
|
357
|
+
readonly isHideRating?: boolean | undefined;
|
|
358
|
+
readonly isHideCount?: boolean | undefined;
|
|
359
|
+
readonly isHideReviewFullStars?: boolean | undefined;
|
|
360
|
+
} | undefined;
|
|
361
|
+
readonly categoryName?: string | undefined;
|
|
362
|
+
readonly enabled?: boolean | undefined;
|
|
363
|
+
readonly isOnSale: boolean;
|
|
364
|
+
readonly defaultCategoryId?: number | undefined;
|
|
365
|
+
readonly categoryIds?: number[] | undefined;
|
|
366
|
+
}[];
|
|
367
|
+
hasProducts: boolean;
|
|
368
|
+
categories: {
|
|
369
|
+
readonly id: number;
|
|
370
|
+
readonly name: string;
|
|
371
|
+
readonly url: string;
|
|
372
|
+
readonly imageUrl?: string | undefined;
|
|
373
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
374
|
+
readonly imageBorderInfo?: {
|
|
375
|
+
readonly homogeneity?: boolean | undefined;
|
|
376
|
+
readonly dominatingColor?: {
|
|
377
|
+
readonly red?: number | undefined;
|
|
378
|
+
readonly green?: number | undefined;
|
|
379
|
+
readonly blue?: number | undefined;
|
|
380
|
+
readonly alpha?: number | undefined;
|
|
381
|
+
} | undefined;
|
|
382
|
+
} | undefined;
|
|
383
|
+
readonly alt?: string | undefined;
|
|
384
|
+
readonly productsCount: number;
|
|
385
|
+
}[];
|
|
386
|
+
categoryId?: number | undefined;
|
|
387
|
+
hasContent: boolean;
|
|
252
388
|
} | undefined;
|
|
253
389
|
/**
|
|
254
390
|
* Composable for accessing DECK content (card collection, up to 10 items).
|
|
@@ -734,7 +870,7 @@ interface MenuContentData {
|
|
|
734
870
|
/**
|
|
735
871
|
* Raw product selector data from the editor.
|
|
736
872
|
*
|
|
737
|
-
* @see {@link
|
|
873
|
+
* @see {@link ProductSelectorContent}
|
|
738
874
|
*/
|
|
739
875
|
interface ProductSelectorData {
|
|
740
876
|
/** Single product selection (legacy) */
|
|
@@ -759,7 +895,7 @@ interface ProductSelectorData {
|
|
|
759
895
|
* @see {@link useProductSelectorElementContent}
|
|
760
896
|
* @see {@link ProductSelectorData}
|
|
761
897
|
*/
|
|
762
|
-
interface
|
|
898
|
+
interface ProductSelectorContent {
|
|
763
899
|
/** Array of selected product objects with id, name, price, imageUrl, etc. */
|
|
764
900
|
products: ProductListComponentItem[];
|
|
765
901
|
/** `true` if at least one product is selected */
|
|
@@ -1667,13 +1803,15 @@ declare function useButtonElementContent<CONTENT>(elementName: string, externalC
|
|
|
1667
1803
|
* @template CONTENT - The content type from `type.ts`
|
|
1668
1804
|
* @param elementName - The name of the element in content settings
|
|
1669
1805
|
*
|
|
1806
|
+
* @param externalContent
|
|
1807
|
+
* @param externalStoreData
|
|
1670
1808
|
* @returns `Reactive<CategorySelector>` — reactive object with:
|
|
1671
1809
|
* - `categories: ComputedRef<CategoryListComponentItem[]>` — array of category objects with `id`, `name`, `url`, `imageUrl`, etc.
|
|
1672
1810
|
* - `categoryIds: ComputedRef<Array<number>>` — array of selected category IDs
|
|
1673
1811
|
* - `hasContent: ComputedRef<boolean>` — `true` if selector data exists
|
|
1674
1812
|
* - `hasCategories: ComputedRef<boolean>` — `true` if at least one category is selected
|
|
1675
1813
|
*
|
|
1676
|
-
* @see {@link
|
|
1814
|
+
* @see {@link CategorySelectorContent}
|
|
1677
1815
|
* @see {@link CategorySelectorData} — raw data type from editor
|
|
1678
1816
|
*
|
|
1679
1817
|
* @example
|
|
@@ -1699,7 +1837,7 @@ declare function useButtonElementContent<CONTENT>(elementName: string, externalC
|
|
|
1699
1837
|
* </div>
|
|
1700
1838
|
* ```
|
|
1701
1839
|
*/
|
|
1702
|
-
declare function useCategorySelectorElementContent<CONTENT>(elementName: string): Reactive<
|
|
1840
|
+
declare function useCategorySelectorElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>, externalStoreData?: StoreData): Reactive<CategorySelectorContent>;
|
|
1703
1841
|
|
|
1704
1842
|
/**
|
|
1705
1843
|
* Composable for accessing IMAGE content with multiple resolutions.
|
|
@@ -1890,6 +2028,8 @@ declare function useNavigationMenuElementContent<CONTENT>(): {
|
|
|
1890
2028
|
* @template CONTENT - The content type from `type.ts`
|
|
1891
2029
|
* @param elementName - The name of the element in content settings
|
|
1892
2030
|
*
|
|
2031
|
+
* @param externalContent
|
|
2032
|
+
* @param externalStoreData
|
|
1893
2033
|
* @returns `Reactive<ProductSelector>` — reactive object with:
|
|
1894
2034
|
* - `products: ComputedRef<ProductListComponentItem[]>` — array of product objects with `id`, `name`, `price`, `imageUrl`, etc.
|
|
1895
2035
|
* - `categories: ComputedRef<CategoryListComponentItem[]>` — array of categories (when using category selection)
|
|
@@ -1897,7 +2037,7 @@ declare function useNavigationMenuElementContent<CONTENT>(): {
|
|
|
1897
2037
|
* - `hasContent: ComputedRef<boolean>` — `true` if selector data exists
|
|
1898
2038
|
* - `hasProducts: ComputedRef<boolean>` — `true` if at least one product is selected
|
|
1899
2039
|
*
|
|
1900
|
-
* @see {@link
|
|
2040
|
+
* @see {@link ProductSelectorContent}
|
|
1901
2041
|
* @see {@link ProductSelectorData} — raw data type from editor
|
|
1902
2042
|
*
|
|
1903
2043
|
* @example
|
|
@@ -1924,7 +2064,7 @@ declare function useNavigationMenuElementContent<CONTENT>(): {
|
|
|
1924
2064
|
* </div>
|
|
1925
2065
|
* ```
|
|
1926
2066
|
*/
|
|
1927
|
-
declare function useProductSelectorElementContent<CONTENT>(elementName: string): Reactive<
|
|
2067
|
+
declare function useProductSelectorElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>, externalStoreData?: StoreData): Reactive<ProductSelectorContent>;
|
|
1928
2068
|
|
|
1929
2069
|
/**
|
|
1930
2070
|
* Composable for accessing SELECTBOX content (dropdown).
|
|
@@ -2467,4 +2607,4 @@ declare function useTextareaElementDesign<DESIGN>(elementName: keyof DESIGN): Re
|
|
|
2467
2607
|
declare function useToggleElementDesign<DESIGN>(elementName: keyof DESIGN): Reactive<ToggleDesignData>;
|
|
2468
2608
|
|
|
2469
2609
|
export { ActionLinkTypeEnum, BackgroundStyleEnum, ButtonAppearanceEnum, ButtonShapeEnum, ButtonSizeEnum, ButtonTypeEnum, CatalogLayoutSlot, CategoryLayoutSlot, ConfigTypeEnum, DesignEditorType, EditorTypes, ImageSet, InstantsiteJsEvent, OverlayTypeEnum, PluginTypeEnum, ProductLayoutSlot, ReservedTemplatePageNameEnum, SectionTypeEnum, TemplateCategoriesList, TemplatePageEnum, ValidationTypeEnum, createVueClientApp, createVueServerApp, useBackgroundElementDesign, useButtonElementContent, useButtonElementDesign, useCategorySelectorElementContent, useDeckElementContent, useImageElementContent, useImageElementDesign, useInputboxElementContent, useInstantsiteJsApi, useLayoutElementDesign, useLogoElementContent, useLogoElementDesign, useMenuElementContent, useNavigationMenuElementContent, useProductSelectorElementContent, useSelectboxElementContent, useSelectboxElementDesign, useTextElementDesign, useTextareaElementContent, useTextareaElementDesign, useToggleElementContent, useToggleElementDesign, useTranslation, useVueBaseProps };
|
|
2470
|
-
export type { ActionLink, AppBaseContext, AppBaseData, AppBaseState, Background, BackgroundDesignData$1 as BackgroundDesignData, BackgroundDesignEditor, BackgroundDesignEditorDefaults, BackgroundDesignEditorDefaultsTransformed, BackgroundType, ButtonAppearance, ButtonContentData, ButtonContentEditor, ButtonDesignData, ButtonDesignEditor, ButtonDesignEditorDefaults, ButtonDesignEditorDefaultsTransformed, ButtonSize, ButtonStyle, CapitalizationType, Card,
|
|
2610
|
+
export type { ActionLink, AppBaseContext, AppBaseData, AppBaseState, Background, BackgroundDesignData$1 as BackgroundDesignData, BackgroundDesignEditor, BackgroundDesignEditorDefaults, BackgroundDesignEditorDefaultsTransformed, BackgroundType, ButtonAppearance, ButtonContentData, ButtonContentEditor, ButtonDesignData, ButtonDesignEditor, ButtonDesignEditorDefaults, ButtonDesignEditorDefaultsTransformed, ButtonSize, ButtonStyle, CapitalizationType, Card, CategorySelectorContent, CategorySelectorContentEditor, CategorySelectorContentEditorDefaults, CategorySelectorData, Color$1 as Color, ColorPickerDesignEditor, ColorPickerDesignEditorDefaults, ColorPickerDesignEditorDefaultsTransformed, ContentEditor, ContentSettings, CustomPageMetadata, Deck, DeckContent, DeckContentEditor, DefaultSectionId, DesignEditor, DesignEditorDefaults, DesignEditorDefaultsTransformed, DesignSettings, DividerDesignEditor, Font, Frame, GlobalColorsString, GlobalDesign$1 as GlobalDesign, GlobalFontsString, GlobalTextSizeString, GradientColor, HSLColor, ImageBorderInfoData, ImageContent, ImageContentData, ImageContentEditor, ImageContentEditorDefaults, ImageDesignData$1 as ImageDesignData, ImageDesignEditor, ImageDesignEditorDefaults, ImageDesignEditorDefaultsTransformed, ImageInfoData, InputBoxContent, InputboxContentEditor, InputboxContentEditorDefaults, InstantsiteJSAPI$1 as InstantsiteJSAPI, InstantsiteTilePromise$1 as InstantsiteTilePromise, LayoutDesignData, LayoutDesignOverride, LayoutSettings, LogoContent, LogoContentData, LogoContentEditor, LogoContentEditorDefaults, LogoDesignData$1 as LogoDesignData, LogoDesignEditor, LogoDesignEditorDefaults, LogoDesignEditorDefaultsTransformed, LogoType, MandatoryContentSettings, MandatoryDesignSettings, MenuContent, MenuContentData, MenuContentEditor, NavigationMenuContentEditor, Overlay, OverlayType, ProductSelectorContent, ProductSelectorContentEditor, ProductSelectorContentEditorDefaults, ProductSelectorData, RGBAColor, SelectBoxContent, SelectboxContentEditor, SelectboxContentOption, SelectboxDesignData, SelectboxDesignEditor, Showcase, ShowcaseOverride, SolidColor, StorePageConfiguration, StorefrontSectionId, TemplateCategory, TemplateConfiguration, TemplateConfigurationType, TemplateCustomSection, TemplateDefaultSection, TemplateMetadata, TemplateMultiPageConfiguration, TemplatePage, TemplateSection, TemplateSettings, TemplateSinglePageConfiguration, TemplateStorefrontSection, TextAreaContent, TextDesignData$1 as TextDesignData, TextDesignEditor, TextDesignEditorDefaults, TextDesignEditorDefaultsTransformed, TextSize, TextareaContentEditor, TextareaContentEditorDefaults, TextareaDesignData$1 as TextareaDesignData, ToggleContent, ToggleContentData, ToggleContentEditor, ToggleDesignData, ToggleDesignEditor, TransformedFrame, TranslationSettings, VuegaPageId };
|
package/dist/index.d.ts
CHANGED
|
@@ -185,7 +185,7 @@ interface ButtonContentData {
|
|
|
185
185
|
/**
|
|
186
186
|
* Raw category selector data from the editor.
|
|
187
187
|
*
|
|
188
|
-
* @see {@link
|
|
188
|
+
* @see {@link CategorySelectorContent}
|
|
189
189
|
*/
|
|
190
190
|
interface CategorySelectorData {
|
|
191
191
|
readonly categories: {
|
|
@@ -205,7 +205,7 @@ interface CategorySelectorData {
|
|
|
205
205
|
* @see {@link useCategorySelectorElementContent}
|
|
206
206
|
* @see {@link CategorySelectorData}
|
|
207
207
|
*/
|
|
208
|
-
interface
|
|
208
|
+
interface CategorySelectorContent {
|
|
209
209
|
/** Array of selected category objects with id, name, imageUrl, etc. */
|
|
210
210
|
categories: CategoryListComponentItem[];
|
|
211
211
|
/** `true` if at least one category is selected */
|
|
@@ -222,10 +222,12 @@ declare enum EditorTypes {
|
|
|
222
222
|
BUTTON = "BUTTON",
|
|
223
223
|
IMAGE = "IMAGE",
|
|
224
224
|
TOGGLE = "TOGGLE",
|
|
225
|
-
SELECTBOX = "SELECTBOX"
|
|
225
|
+
SELECTBOX = "SELECTBOX",
|
|
226
|
+
CATEGORY_SELECTOR = "CATEGORY_SELECTOR",
|
|
227
|
+
PRODUCT_SELECTOR = "PRODUCT_SELECTOR"
|
|
226
228
|
}
|
|
227
229
|
/** Gets a reactive reference to a field within a DECK card. */
|
|
228
|
-
declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string): {
|
|
230
|
+
declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string, storeData?: StoreData): {
|
|
229
231
|
readonly hasContent: boolean;
|
|
230
232
|
readonly value: string | undefined;
|
|
231
233
|
} | {
|
|
@@ -249,6 +251,140 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
249
251
|
hasTitle?: boolean | undefined;
|
|
250
252
|
hasLink?: boolean | undefined;
|
|
251
253
|
performAction?: (() => void) | undefined;
|
|
254
|
+
} | {
|
|
255
|
+
categories: {
|
|
256
|
+
readonly id: number;
|
|
257
|
+
readonly name: string;
|
|
258
|
+
readonly url: string;
|
|
259
|
+
readonly imageUrl?: string | undefined;
|
|
260
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
261
|
+
readonly imageBorderInfo?: {
|
|
262
|
+
readonly homogeneity?: boolean | undefined;
|
|
263
|
+
readonly dominatingColor?: {
|
|
264
|
+
readonly red?: number | undefined;
|
|
265
|
+
readonly green?: number | undefined;
|
|
266
|
+
readonly blue?: number | undefined;
|
|
267
|
+
readonly alpha?: number | undefined;
|
|
268
|
+
} | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
readonly alt?: string | undefined;
|
|
271
|
+
readonly productsCount: number;
|
|
272
|
+
}[];
|
|
273
|
+
hasCategories: boolean;
|
|
274
|
+
categoryIds: Array<number>;
|
|
275
|
+
hasContent: boolean;
|
|
276
|
+
} | {
|
|
277
|
+
products: {
|
|
278
|
+
readonly id: number;
|
|
279
|
+
readonly name: string;
|
|
280
|
+
readonly url: string;
|
|
281
|
+
readonly imageUrl?: string | undefined;
|
|
282
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
283
|
+
readonly fullImageUrl?: string | undefined;
|
|
284
|
+
readonly imageBorderInfo: {
|
|
285
|
+
readonly homogeneity?: boolean | undefined;
|
|
286
|
+
readonly dominatingColor?: {
|
|
287
|
+
readonly red?: number | undefined;
|
|
288
|
+
readonly green?: number | undefined;
|
|
289
|
+
readonly blue?: number | undefined;
|
|
290
|
+
readonly alpha?: number | undefined;
|
|
291
|
+
} | undefined;
|
|
292
|
+
};
|
|
293
|
+
readonly alternativeProductImage?: {
|
|
294
|
+
readonly imageUrl?: string | undefined;
|
|
295
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
296
|
+
readonly fullImageUrl?: string | undefined;
|
|
297
|
+
readonly imageBorderInfo?: {
|
|
298
|
+
readonly homogeneity?: boolean | undefined;
|
|
299
|
+
readonly dominatingColor?: {
|
|
300
|
+
readonly red?: number | undefined;
|
|
301
|
+
readonly green?: number | undefined;
|
|
302
|
+
readonly blue?: number | undefined;
|
|
303
|
+
readonly alpha?: number | undefined;
|
|
304
|
+
} | undefined;
|
|
305
|
+
} | undefined;
|
|
306
|
+
readonly alt?: string | undefined;
|
|
307
|
+
} | undefined;
|
|
308
|
+
readonly description?: string | undefined;
|
|
309
|
+
readonly price: number;
|
|
310
|
+
readonly comparePrice?: number | undefined;
|
|
311
|
+
readonly formattedPrice: string;
|
|
312
|
+
readonly formattedComparePrice?: string | undefined;
|
|
313
|
+
readonly lowestPrice?: {
|
|
314
|
+
readonly priceFormatted: string;
|
|
315
|
+
readonly label: string;
|
|
316
|
+
readonly countDateFromCreate: string;
|
|
317
|
+
} | undefined;
|
|
318
|
+
readonly zeroPrice?: boolean | undefined;
|
|
319
|
+
readonly inStock: boolean;
|
|
320
|
+
readonly subtitle?: string | undefined;
|
|
321
|
+
readonly sku?: string | undefined;
|
|
322
|
+
readonly quantity?: number | undefined;
|
|
323
|
+
readonly ribbon?: {
|
|
324
|
+
readonly text: string;
|
|
325
|
+
readonly color: {
|
|
326
|
+
red: number;
|
|
327
|
+
green: number;
|
|
328
|
+
blue: number;
|
|
329
|
+
alpha: number;
|
|
330
|
+
};
|
|
331
|
+
} | undefined;
|
|
332
|
+
readonly nameYourPriceEnabled?: boolean | undefined;
|
|
333
|
+
readonly attributeValues?: string[] | undefined;
|
|
334
|
+
readonly legalInfos?: {
|
|
335
|
+
readonly type: ProductLegalInfoType;
|
|
336
|
+
readonly text: string;
|
|
337
|
+
readonly url?: string | undefined;
|
|
338
|
+
readonly urlTarget?: string | undefined;
|
|
339
|
+
}[] | undefined;
|
|
340
|
+
readonly isSampleProduct?: boolean | undefined;
|
|
341
|
+
readonly subscriptionSettings?: {
|
|
342
|
+
readonly subscriptionAllowed: boolean;
|
|
343
|
+
readonly oneTimePurchaseAllowed: boolean;
|
|
344
|
+
readonly recurringChargeSettings: {
|
|
345
|
+
readonly subscriptionPriceWithSignUpFee?: number | undefined;
|
|
346
|
+
readonly subscriptionPriceWithSignUpFeeFormatted?: string | undefined;
|
|
347
|
+
}[];
|
|
348
|
+
readonly oneTimePurchasePrice?: number | undefined;
|
|
349
|
+
readonly oneTimePurchasePriceFormatted?: string | undefined;
|
|
350
|
+
readonly oneTimePurchaseMarkupPercent?: number | undefined;
|
|
351
|
+
} | undefined;
|
|
352
|
+
readonly preorder?: boolean | undefined;
|
|
353
|
+
readonly alt?: string | undefined;
|
|
354
|
+
readonly productRating?: {
|
|
355
|
+
readonly rating?: number | undefined;
|
|
356
|
+
readonly reviewsPublished?: number | undefined;
|
|
357
|
+
readonly isHideRating?: boolean | undefined;
|
|
358
|
+
readonly isHideCount?: boolean | undefined;
|
|
359
|
+
readonly isHideReviewFullStars?: boolean | undefined;
|
|
360
|
+
} | undefined;
|
|
361
|
+
readonly categoryName?: string | undefined;
|
|
362
|
+
readonly enabled?: boolean | undefined;
|
|
363
|
+
readonly isOnSale: boolean;
|
|
364
|
+
readonly defaultCategoryId?: number | undefined;
|
|
365
|
+
readonly categoryIds?: number[] | undefined;
|
|
366
|
+
}[];
|
|
367
|
+
hasProducts: boolean;
|
|
368
|
+
categories: {
|
|
369
|
+
readonly id: number;
|
|
370
|
+
readonly name: string;
|
|
371
|
+
readonly url: string;
|
|
372
|
+
readonly imageUrl?: string | undefined;
|
|
373
|
+
readonly thumbnailImageUrl?: string | undefined;
|
|
374
|
+
readonly imageBorderInfo?: {
|
|
375
|
+
readonly homogeneity?: boolean | undefined;
|
|
376
|
+
readonly dominatingColor?: {
|
|
377
|
+
readonly red?: number | undefined;
|
|
378
|
+
readonly green?: number | undefined;
|
|
379
|
+
readonly blue?: number | undefined;
|
|
380
|
+
readonly alpha?: number | undefined;
|
|
381
|
+
} | undefined;
|
|
382
|
+
} | undefined;
|
|
383
|
+
readonly alt?: string | undefined;
|
|
384
|
+
readonly productsCount: number;
|
|
385
|
+
}[];
|
|
386
|
+
categoryId?: number | undefined;
|
|
387
|
+
hasContent: boolean;
|
|
252
388
|
} | undefined;
|
|
253
389
|
/**
|
|
254
390
|
* Composable for accessing DECK content (card collection, up to 10 items).
|
|
@@ -734,7 +870,7 @@ interface MenuContentData {
|
|
|
734
870
|
/**
|
|
735
871
|
* Raw product selector data from the editor.
|
|
736
872
|
*
|
|
737
|
-
* @see {@link
|
|
873
|
+
* @see {@link ProductSelectorContent}
|
|
738
874
|
*/
|
|
739
875
|
interface ProductSelectorData {
|
|
740
876
|
/** Single product selection (legacy) */
|
|
@@ -759,7 +895,7 @@ interface ProductSelectorData {
|
|
|
759
895
|
* @see {@link useProductSelectorElementContent}
|
|
760
896
|
* @see {@link ProductSelectorData}
|
|
761
897
|
*/
|
|
762
|
-
interface
|
|
898
|
+
interface ProductSelectorContent {
|
|
763
899
|
/** Array of selected product objects with id, name, price, imageUrl, etc. */
|
|
764
900
|
products: ProductListComponentItem[];
|
|
765
901
|
/** `true` if at least one product is selected */
|
|
@@ -1667,13 +1803,15 @@ declare function useButtonElementContent<CONTENT>(elementName: string, externalC
|
|
|
1667
1803
|
* @template CONTENT - The content type from `type.ts`
|
|
1668
1804
|
* @param elementName - The name of the element in content settings
|
|
1669
1805
|
*
|
|
1806
|
+
* @param externalContent
|
|
1807
|
+
* @param externalStoreData
|
|
1670
1808
|
* @returns `Reactive<CategorySelector>` — reactive object with:
|
|
1671
1809
|
* - `categories: ComputedRef<CategoryListComponentItem[]>` — array of category objects with `id`, `name`, `url`, `imageUrl`, etc.
|
|
1672
1810
|
* - `categoryIds: ComputedRef<Array<number>>` — array of selected category IDs
|
|
1673
1811
|
* - `hasContent: ComputedRef<boolean>` — `true` if selector data exists
|
|
1674
1812
|
* - `hasCategories: ComputedRef<boolean>` — `true` if at least one category is selected
|
|
1675
1813
|
*
|
|
1676
|
-
* @see {@link
|
|
1814
|
+
* @see {@link CategorySelectorContent}
|
|
1677
1815
|
* @see {@link CategorySelectorData} — raw data type from editor
|
|
1678
1816
|
*
|
|
1679
1817
|
* @example
|
|
@@ -1699,7 +1837,7 @@ declare function useButtonElementContent<CONTENT>(elementName: string, externalC
|
|
|
1699
1837
|
* </div>
|
|
1700
1838
|
* ```
|
|
1701
1839
|
*/
|
|
1702
|
-
declare function useCategorySelectorElementContent<CONTENT>(elementName: string): Reactive<
|
|
1840
|
+
declare function useCategorySelectorElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>, externalStoreData?: StoreData): Reactive<CategorySelectorContent>;
|
|
1703
1841
|
|
|
1704
1842
|
/**
|
|
1705
1843
|
* Composable for accessing IMAGE content with multiple resolutions.
|
|
@@ -1890,6 +2028,8 @@ declare function useNavigationMenuElementContent<CONTENT>(): {
|
|
|
1890
2028
|
* @template CONTENT - The content type from `type.ts`
|
|
1891
2029
|
* @param elementName - The name of the element in content settings
|
|
1892
2030
|
*
|
|
2031
|
+
* @param externalContent
|
|
2032
|
+
* @param externalStoreData
|
|
1893
2033
|
* @returns `Reactive<ProductSelector>` — reactive object with:
|
|
1894
2034
|
* - `products: ComputedRef<ProductListComponentItem[]>` — array of product objects with `id`, `name`, `price`, `imageUrl`, etc.
|
|
1895
2035
|
* - `categories: ComputedRef<CategoryListComponentItem[]>` — array of categories (when using category selection)
|
|
@@ -1897,7 +2037,7 @@ declare function useNavigationMenuElementContent<CONTENT>(): {
|
|
|
1897
2037
|
* - `hasContent: ComputedRef<boolean>` — `true` if selector data exists
|
|
1898
2038
|
* - `hasProducts: ComputedRef<boolean>` — `true` if at least one product is selected
|
|
1899
2039
|
*
|
|
1900
|
-
* @see {@link
|
|
2040
|
+
* @see {@link ProductSelectorContent}
|
|
1901
2041
|
* @see {@link ProductSelectorData} — raw data type from editor
|
|
1902
2042
|
*
|
|
1903
2043
|
* @example
|
|
@@ -1924,7 +2064,7 @@ declare function useNavigationMenuElementContent<CONTENT>(): {
|
|
|
1924
2064
|
* </div>
|
|
1925
2065
|
* ```
|
|
1926
2066
|
*/
|
|
1927
|
-
declare function useProductSelectorElementContent<CONTENT>(elementName: string): Reactive<
|
|
2067
|
+
declare function useProductSelectorElementContent<CONTENT>(elementName: string, externalContent?: Record<string, unknown>, externalStoreData?: StoreData): Reactive<ProductSelectorContent>;
|
|
1928
2068
|
|
|
1929
2069
|
/**
|
|
1930
2070
|
* Composable for accessing SELECTBOX content (dropdown).
|
|
@@ -2467,4 +2607,4 @@ declare function useTextareaElementDesign<DESIGN>(elementName: keyof DESIGN): Re
|
|
|
2467
2607
|
declare function useToggleElementDesign<DESIGN>(elementName: keyof DESIGN): Reactive<ToggleDesignData>;
|
|
2468
2608
|
|
|
2469
2609
|
export { ActionLinkTypeEnum, BackgroundStyleEnum, ButtonAppearanceEnum, ButtonShapeEnum, ButtonSizeEnum, ButtonTypeEnum, CatalogLayoutSlot, CategoryLayoutSlot, ConfigTypeEnum, DesignEditorType, EditorTypes, ImageSet, InstantsiteJsEvent, OverlayTypeEnum, PluginTypeEnum, ProductLayoutSlot, ReservedTemplatePageNameEnum, SectionTypeEnum, TemplateCategoriesList, TemplatePageEnum, ValidationTypeEnum, createVueClientApp, createVueServerApp, useBackgroundElementDesign, useButtonElementContent, useButtonElementDesign, useCategorySelectorElementContent, useDeckElementContent, useImageElementContent, useImageElementDesign, useInputboxElementContent, useInstantsiteJsApi, useLayoutElementDesign, useLogoElementContent, useLogoElementDesign, useMenuElementContent, useNavigationMenuElementContent, useProductSelectorElementContent, useSelectboxElementContent, useSelectboxElementDesign, useTextElementDesign, useTextareaElementContent, useTextareaElementDesign, useToggleElementContent, useToggleElementDesign, useTranslation, useVueBaseProps };
|
|
2470
|
-
export type { ActionLink, AppBaseContext, AppBaseData, AppBaseState, Background, BackgroundDesignData$1 as BackgroundDesignData, BackgroundDesignEditor, BackgroundDesignEditorDefaults, BackgroundDesignEditorDefaultsTransformed, BackgroundType, ButtonAppearance, ButtonContentData, ButtonContentEditor, ButtonDesignData, ButtonDesignEditor, ButtonDesignEditorDefaults, ButtonDesignEditorDefaultsTransformed, ButtonSize, ButtonStyle, CapitalizationType, Card,
|
|
2610
|
+
export type { ActionLink, AppBaseContext, AppBaseData, AppBaseState, Background, BackgroundDesignData$1 as BackgroundDesignData, BackgroundDesignEditor, BackgroundDesignEditorDefaults, BackgroundDesignEditorDefaultsTransformed, BackgroundType, ButtonAppearance, ButtonContentData, ButtonContentEditor, ButtonDesignData, ButtonDesignEditor, ButtonDesignEditorDefaults, ButtonDesignEditorDefaultsTransformed, ButtonSize, ButtonStyle, CapitalizationType, Card, CategorySelectorContent, CategorySelectorContentEditor, CategorySelectorContentEditorDefaults, CategorySelectorData, Color$1 as Color, ColorPickerDesignEditor, ColorPickerDesignEditorDefaults, ColorPickerDesignEditorDefaultsTransformed, ContentEditor, ContentSettings, CustomPageMetadata, Deck, DeckContent, DeckContentEditor, DefaultSectionId, DesignEditor, DesignEditorDefaults, DesignEditorDefaultsTransformed, DesignSettings, DividerDesignEditor, Font, Frame, GlobalColorsString, GlobalDesign$1 as GlobalDesign, GlobalFontsString, GlobalTextSizeString, GradientColor, HSLColor, ImageBorderInfoData, ImageContent, ImageContentData, ImageContentEditor, ImageContentEditorDefaults, ImageDesignData$1 as ImageDesignData, ImageDesignEditor, ImageDesignEditorDefaults, ImageDesignEditorDefaultsTransformed, ImageInfoData, InputBoxContent, InputboxContentEditor, InputboxContentEditorDefaults, InstantsiteJSAPI$1 as InstantsiteJSAPI, InstantsiteTilePromise$1 as InstantsiteTilePromise, LayoutDesignData, LayoutDesignOverride, LayoutSettings, LogoContent, LogoContentData, LogoContentEditor, LogoContentEditorDefaults, LogoDesignData$1 as LogoDesignData, LogoDesignEditor, LogoDesignEditorDefaults, LogoDesignEditorDefaultsTransformed, LogoType, MandatoryContentSettings, MandatoryDesignSettings, MenuContent, MenuContentData, MenuContentEditor, NavigationMenuContentEditor, Overlay, OverlayType, ProductSelectorContent, ProductSelectorContentEditor, ProductSelectorContentEditorDefaults, ProductSelectorData, RGBAColor, SelectBoxContent, SelectboxContentEditor, SelectboxContentOption, SelectboxDesignData, SelectboxDesignEditor, Showcase, ShowcaseOverride, SolidColor, StorePageConfiguration, StorefrontSectionId, TemplateCategory, TemplateConfiguration, TemplateConfigurationType, TemplateCustomSection, TemplateDefaultSection, TemplateMetadata, TemplateMultiPageConfiguration, TemplatePage, TemplateSection, TemplateSettings, TemplateSinglePageConfiguration, TemplateStorefrontSection, TextAreaContent, TextDesignData$1 as TextDesignData, TextDesignEditor, TextDesignEditorDefaults, TextDesignEditorDefaultsTransformed, TextSize, TextareaContentEditor, TextareaContentEditorDefaults, TextareaDesignData$1 as TextareaDesignData, ToggleContent, ToggleContentData, ToggleContentEditor, ToggleDesignData, ToggleDesignEditor, TransformedFrame, TranslationSettings, VuegaPageId };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSSRApp as re,getCurrentInstance as ie,ref as O,computed as o,reactive as T}from"vue";import{renderToString as le}from"vue/server-renderer";function y(e){return{app:re(e)}}const R=new Map;function d(){const e=(r,i,l,v,c,s,u)=>{R.set(r._uid,{context:O(i),content:O(l),design:O(v),defaults:O(c),site:O(s?.site??{}),category:O(s?.category),storeData:O(s?.storeData),globalDesign:O(u)})},t=(r,i,l,v,c,s)=>{const u=R.get(r._uid);u!==void 0&&(u.content.value=i,u.design.value=l,u.defaults.value=v,u.site.value=c.site??{},u.category.value=c.category,u.globalDesign.value=s,u.storeData.value=c.storeData)},n=ie()?.appContext.app._uid??-1,a=R.get(n);return{init:e,update:t,context:a?.context,content:a?.content,design:a?.design,defaults:a?.defaults,site:a?.site,category:a?.category,storeData:a?.storeData,globalDesign:a?.globalDesign}}function ue(e,t){return{init:()=>{const{app:n}=y(e);return t?.init?.(n),{mount:(a,r)=>{d().init(n,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent,r.context.globalDesign),t?.mount?.(n,a,r),n.mount(a)},update:a=>{d().update(n,a.data.content,a.data.design,a.data.defaults,a.data.externalContent,a.context.globalDesign),t?.update?.(n,a)},unmount:()=>{t?.unmount?.(n),n.unmount()}}}}}function se(){return globalThis.window.instantsite}function ce(e,t){return{init:()=>{const{app:n}=y(e);return t?.init?.(n),{render:async(a,r)=>(d().init(n,a,r.content,r.design,r.defaults,r.externalContent,a.globalDesign),t?.render?.(n,a,r),{html:await le(n,{context:a}),state:{context:a,data:r}})}}}}var A=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(A||{}),G=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e.NONE="NONE",e))(G||{}),D=(e=>(e.SOLID="SOLID",e.OUTLINE="OUTLINE",e.TEXT="TEXT",e))(D||{}),N=(e=>(e.SMALL="SMALL",e.MEDIUM="MEDIUM",e.LARGE="LARGE",e))(N||{}),h=(e=>(e.ROUND_CORNER="ROUND_CORNER",e.RECTANGLE="RECTANGLE",e.PILL="PILL",e))(h||{}),w=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e))(w||{}),M=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(M||{}),B=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(B||{}),U=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e))(U||{}),P=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(P||{}),ve=(e=>(e.TEXTAREA="TEXTAREA",e.INPUTBOX="INPUTBOX",e.SELECTBOX="SELECTBOX",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.BUTTON="BUTTON",e.DECK="DECK",e.MENU="MENU",e.NAVIGATION_MENU="NAVIGATION_MENU",e.LOGO="LOGO",e.INFO="INFO",e.DIVIDER="DIVIDER",e))(ve||{}),x=(e=>(e.TEXT="TEXT",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e.BACKGROUND="BACKGROUND",e.COLOR_PICKER="COLOR_PICKER",e.LOGO="LOGO",e.DIVIDER="DIVIDER",e))(x||{}),k=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(k||{}),K=(e=>(e.HOME="home",e.CATALOG="catalog",e.CATEGORY="category",e.PRODUCT="product",e))(K||{}),$=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))($||{}),z=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(z||{}),X=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(X||{});const de={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"},ge={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Te={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Ee={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},p={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};function fe(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function pe(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function Oe(e){if("pageUrl"in e)return e.pageUrl;switch(pe(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}function me(e){if("categoryId"in e)return e.categoryId}const Y=(e,t,n)=>{if(!e||t)return;const{type:a,link:r,email:i,phone:l}=e,v=Oe(e),c=me(e);switch(a){case p.HYPER_LINK:if(r)return()=>window.open(r,"_blank");break;case p.GO_TO_STORE:case p.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case p.GO_TO_CATEGORY:case p.GO_TO_CATEGORY_LINK:const s=n?.find(u=>u.id===c)?.url;return s===void 0?()=>window.open("/404","_self"):()=>window.open(s,"_self");case p.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case p.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case p.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const u=fe(e);document.getElementById(`tile-${u}`)?.scrollIntoView()};break;case p.GO_TO_PAGE:if(v)return()=>window.open(v,"_self");break;default:console.error(`Unknown type of ActionLink: ${a}`)}};function Ie(e){return"title"in e&&"type"in e}function Le(e,t,n,a){const r=o(()=>{const b=e.value[t];if(b!==void 0){if(Ie(b))return b;throw new Error(`Element ${t} is not action link`)}}),i=o(()=>r.value?.title),l=o(()=>r.value?.type),v=o(()=>r.value?.link),c=o(()=>r.value?.email),s=o(()=>r.value?.phone),u=o(()=>r.value?.tileId?`tile-${r.value?.tileId}`:null),g=o(()=>r.value?.type==="GO_TO_STORE_LINK"?"products":r.value?.pageId),E=o(()=>r.value?.pageUrl),m=o(()=>!!i.value),I=o(()=>!!v.value),ae=Y(r.value,n,a);return T({title:i,type:l,link:v,email:c,phone:s,tileDivId:u,pageId:g,pageUrl:E,hasTitle:m,hasLink:I,performAction:ae})}function F(e,t){const n=d(),a=o(()=>!!n.site?.value?.isPreviewMode),r=o(()=>n.category?.value?.categories??[]),i=o(()=>t!==void 0?t:n.content.value!==void 0?n.content.value:{});return Le(i,e,a.value,r.value)}function W({content:e,elementName:t,errorMessage:n,validatorFn:a}){return o(()=>{const r=e.value?.[t];if(r!==void 0){if(a(r))return r;throw new Error(n)}})}function _e(e){return typeof e=="object"&&e!==null&&"categories"in e}function Ce(e){return o(()=>e.value.reduce((t,n)=>(t[n.id]=n,t),{}))}function be(e){return e!==void 0}function Re(e){return!!e?.trim()}function Se({name:e,customName:t,selectionType:n}){return n==="ROOT"?e:Re(t)?t:e}function ye(e,t){return be(e)&&t}function H({itemId:e,id:t,alt:n,name:a,nameTranslated:r,customName:i,enabled:l,productsCount:v,url:c,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:g,selectionType:E}){return{itemId:e||t.toString(),id:t,alt:n,name:Se({name:a,customName:i,selectionType:E}),nameTranslated:r,label:a,enabled:l,url:c,productsCount:v,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:g,showCategory:ye(t,l)}}function Ae(e){const t=d(),n=o(()=>t.content.value),a=W({content:n,elementName:e,errorMessage:`Element ${e} is not a category selector type`,validatorFn:_e}),r=o(()=>t.storeData?.value),i=o(()=>a.value?.categories.selectionType??"ROOT"),l=o(()=>r.value?.categories??[]),v=o(()=>a.value?.categories?.categoryIds??[]),c=o(()=>{const g=Ce(l);return i.value==="MANUAL"?a.value?.categories?.items?.map(E=>{const m=g.value[E.id];return H({...E,...m,selectionType:i.value})})??[]:r?.value?.categories.map(E=>H({...E,selectionType:i.value}))??[]}),s=o(()=>a.value!==void 0),u=o(()=>c.value!==void 0&&c.value.length>0);return T({categories:c,categoryIds:v,hasContent:s,hasCategories:u})}function Ge(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function L(e,t){const n=new RegExp(/^https?:\/\//);return e!=null&&n.test(e)?e:`${t}/${e}`}function De(e,t){const n=o(()=>{const s=e.value[t];if(s!==void 0){if(Ge(s))return s;throw new Error(`Element ${t} is not image`)}}),a=o(()=>n.value===void 0?"":d().context.value.imageBuckets?.[n.value?.bucket]),r=o(()=>n.value!==void 0),i=o(()=>L(n.value?.set?.["cropped-webp-100x200"]?.url,a.value)),l=o(()=>L(n.value?.set?.["cropped-webp-1000x2000"]?.url,a.value)),v=o(()=>L(n.value?.set?.["webp-200x200"]?.url,a.value)),c=o(()=>L(n.value?.set?.["webp-2000x2000"]?.url,a.value));return T({hasContent:r,lowResolutionMobileImage:i,highResolutionMobileImage:l,lowResolutionDesktopImage:v,highResolutionDesktopImage:c})}function V(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return De(a,e)}function Ne(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not inputbox`)}}),a=o(()=>n.value!==void 0&&n.value.length>0),r=o(()=>n.value);return T({hasContent:a,value:r})}function j(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Ne(a,e)}function he(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not selectbox`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return T({hasContent:a,value:r})}function J(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return he(a,e)}function we(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not textarea`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return T({hasContent:a,value:r})}function q(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return we(a,e)}function Me(e){return"enabled"in e}function Be(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(Me(i))return i;throw new Error(`Element ${t} is not toggle`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value?.enabled);return T({hasContent:a,value:r})}function Q(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Be(a,e)}function Ue(e){if(typeof e!="object"||e===null)return!1;const t=e;return Array.isArray(t.cards)&&t.cards.every(n=>typeof n.settings=="object"&&n.settings!==null)}var Z=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(Z||{});function Pe(e,t,n){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const a=e.settings[n];if(a===void 0)return a;switch(t){case"TEXTAREA":return q(n,e.settings);case"INPUTBOX":return j(n,e.settings);case"SELECTBOX":return J(n,e.settings);case"IMAGE":return V(n,e.settings);case"TOGGLE":return Q(n,e.settings);case"BUTTON":return F(n,e.settings);default:return}}function xe(e){const t=d(),n=o(()=>{const i=t.content.value[e];if(i!==void 0){if(Ue(i))return i;throw new Error(`Element ${e} is not of DECK type`)}}),a=o(()=>n.value!==void 0&&n.value.cards.length>0),r=o(()=>n.value?.cards);return T({hasContent:a,cards:r,getReactiveRef:Pe})}function ke(e){return"type"in e&&("text"in e||"image"in e)}function _(e,t){const n=new RegExp(/^https?:\/\//);return e!==void 0&&n.test(e)?e:`${t}/${e}`}function Ke(){const e=d(),t=o(()=>{const l=e.content.value.logo;if(l!==void 0){if(ke(l))return l;throw new Error("Element logo is not LOGO")}}),n=o(()=>t.value?.type),a=o(()=>t.value?.text),r=o(()=>t.value?.image===void 0?"":e.context.value.imageBuckets?.[t.value.image.bucket]),i=o(()=>({lowResolutionMobileImage:_(t.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:_(t.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:_(t.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:_(t.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return T({type:n,text:a,image:i})}function $e(e){return e!==null&&"items"in e}function ee(e){const t=d(),n=o(()=>{const l=t.content.value[e];if(l!==void 0){if($e(l))return l;throw new Error(`Element ${e} is not an menu`)}}),a=o(()=>!!t.site?.value?.isPreviewMode),r=o(()=>n.value!==void 0),i=o(()=>n.value?.items?n.value.items.map(l=>({...l,performAction:Y(l,a.value)})):[]);return T({hasContent:r,items:i})}const ze="menu";function Xe(){return ee(ze)}function Ye(e){return typeof e=="object"&&e!==null&&("products"in e||"product"in e)}function Fe(e){const t=d(),n=o(()=>t.content.value),a=W({content:n,elementName:e,errorMessage:`Element ${e} is not a product selector type`,validatorFn:Ye}),r=o(()=>t.storeData?.value),i=o(()=>a.value?.products?.selectionType??"MANUAL"),l=o(()=>a.value?.products?.productIds??[]),v=o(()=>a.value?.product?.id),c=o(()=>a.value?.categoryId?parseInt(a.value.categoryId,10):void 0),s=o(()=>{if(l.value&&c.value&&i.value==="CATEGORY")return r?.value?.products.filter(I=>I?.defaultCategoryId===c.value)??[];if(typeof c.value=="number"&&c.value===0&&i.value==="CATEGORY")return r?.value?.products??[];const m=v.value?[v.value]:l.value??[];return r?.value?.products.filter(I=>m.includes(I.id))??[]}),u=o(()=>r?.value?.categories.filter(m=>m.id===c?.value)??[]),g=o(()=>a.value!==void 0),E=o(()=>s.value!==void 0&&s.value.length>0);return T({products:s,categories:u,categoryId:c,hasContent:g,hasProducts:E})}function We(){return globalThis.craneSharedTranslation??{}}function He(){const e=d(),t=o(()=>e.site?.value),n=o(()=>We()),a=o(()=>{const r=t.value?.languages;return r?r.find(i=>i.selected)?.code??r.find(i=>i.main)?.code??"en":"en"});return{t:r=>{const i=n.value;if(!i||Object.keys(i).length===0)return r;const l=a.value,v=i[l]?.[r];if(v!==void 0)return v;if(l!=="en"){const c=i.en?.[r];if(c!==void 0)return c}return r},currentLanguageCode:a}}function te(e,t){if(t===void 0)return;if(!t.startsWith("global."))return t.replaceAll("_"," ");const n=t.split(".").at(2);if(n!==void 0)return e.fontFamily?e.fontFamily[n].replaceAll("_"," "):void 0}function C(e,t,n){return t?te(e,t):te(e,n)}function ne(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.textSize?e.textSize[n]:void 0}function S(e,t,n){return t?ne(e,t):ne(e,n)}function oe(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.color?e.color[n]:void 0}function f(e,t,n){return t?oe(e,t):oe(e,n)}function Ve(e,t,n){return{visible:t?.visible??n?.visible??!1,width:t?.width??n?.width??1,color:f(e,t?.color,n?.color)}}function je(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e],l=t.globalDesign.value;return{background:{type:r?.background?.type??i?.background?.type,solid:{color:f(l,r?.background?.solid?.color,i?.background?.solid?.color)},gradient:{fromColor:f(l,r?.background?.gradient?.fromColor,i?.background?.gradient?.fromColor),toColor:f(l,r?.background?.gradient?.toColor,i?.background?.gradient?.toColor)}}}}),a=o(()=>n.value?.background);return T({background:a})}function Je(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],g=t.globalDesign.value;return{appearance:s?.appearance??u?.appearance,font:C(g,s?.font,u?.font),size:s?.size??u?.size,style:s?.style??u?.style,color:f(g,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.appearance),r=o(()=>n.value?.font),i=o(()=>n.value?.size),l=o(()=>n.value?.style),v=o(()=>n.value?.color),c=o(()=>n.value?.visible);return T({appearance:a,font:r,size:i,style:l,color:v,visible:c})}function qe(e){const t=d(),n=o(()=>{const i=t.design.value[e],l=t.defaults.value[e],v=t.globalDesign.value;return{overlay:{type:i?.overlay?.type??l?.overlay?.type,solid:{color:f(v,i?.overlay?.solid?.color,l?.overlay?.solid?.color)},gradient:{fromColor:f(v,i?.overlay?.gradient?.fromColor,l?.overlay?.gradient?.fromColor),toColor:f(v,i?.overlay?.gradient?.toColor,l?.overlay?.gradient?.toColor)}},visible:i?.visible??l?.visible??!1}}),a=o(()=>n.value?.overlay),r=o(()=>n.value?.visible);return T({overlay:a,visible:r})}function Qe(){const e=d(),t=o(()=>e.design.value.layout),n=o(()=>t.value);return T({layout:n})}function Ze(){const e=d();return o(()=>{const t=e.design.value.logo,n=e.defaults.value.logo,a=e.globalDesign.value;return{font:C(a,t?.font,n?.font),size:S(a,t?.size,n?.size),bold:t?.bold??n?.bold,italic:t?.italic??n?.italic,color:f(a,t?.color,n?.color),visible:t?.visible??n?.visible??!1,spacing:t?.spacing??n?.spacing??0,capitalization:t?.capitalization??n?.capitalization??"none",frame:Ve(a,t?.frame,n?.frame)}})}function et(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{value:r?.value??i?.value}}),a=o(()=>n.value?.value);return T({value:a})}function tt(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],g=t.globalDesign.value;return{font:C(g,s?.font,u?.font),size:S(g,s?.size,u?.size),bold:s?.bold??u?.bold,italic:s?.italic??u?.italic,color:f(g,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),v=o(()=>n.value?.color),c=o(()=>n.value?.visible);return T({font:a,size:r,bold:i,italic:l,color:v,visible:c})}function nt(e){const t=d(),n=o(()=>{const u=t.design.value[e],g=t.defaults.value[e],E=t.globalDesign.value;return{font:C(E,u?.font,g?.font),size:S(E,u?.size,g?.size),bold:u?.bold??g?.bold,italic:u?.italic??g?.italic,color:f(E,u?.color,g?.color),visible:u?.visible??g?.visible??!1,whiteSpace:"pre-wrap"}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),v=o(()=>n.value?.color),c=o(()=>n.value?.visible),s=o(()=>n.value?.whiteSpace);return T({font:a,size:r,bold:i,italic:l,color:v,visible:c,whiteSpace:s})}function ot(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{enabled:r?.enabled??i?.enabled}}),a=o(()=>n.value?.enabled);return T({enabled:a})}export{P as ActionLinkTypeEnum,w as BackgroundStyleEnum,D as ButtonAppearanceEnum,h as ButtonShapeEnum,N as ButtonSizeEnum,A as ButtonTypeEnum,ge as CatalogLayoutSlot,Te as CategoryLayoutSlot,U as ConfigTypeEnum,x as DesignEditorType,Z as EditorTypes,z as ImageSet,X as InstantsiteJsEvent,G as OverlayTypeEnum,B as PluginTypeEnum,Ee as ProductLayoutSlot,K as ReservedTemplatePageNameEnum,M as SectionTypeEnum,de as TemplateCategoriesList,k as TemplatePageEnum,$ as ValidationTypeEnum,ue as createVueClientApp,ce as createVueServerApp,je as useBackgroundElementDesign,F as useButtonElementContent,Je as useButtonElementDesign,Ae as useCategorySelectorElementContent,xe as useDeckElementContent,V as useImageElementContent,qe as useImageElementDesign,j as useInputboxElementContent,se as useInstantsiteJsApi,Qe as useLayoutElementDesign,Ke as useLogoElementContent,Ze as useLogoElementDesign,ee as useMenuElementContent,Xe as useNavigationMenuElementContent,Fe as useProductSelectorElementContent,J as useSelectboxElementContent,et as useSelectboxElementDesign,tt as useTextElementDesign,q as useTextareaElementContent,nt as useTextareaElementDesign,Q as useToggleElementContent,ot as useToggleElementDesign,He as useTranslation,d as useVueBaseProps};
|
|
1
|
+
import{createSSRApp as le,getCurrentInstance as ue,ref as m,computed as o,reactive as T}from"vue";import{renderToString as se}from"vue/server-renderer";function y(e){return{app:le(e)}}const b=new Map;function d(){const e=(r,i,l,c,v,s,u)=>{b.set(r._uid,{context:m(i),content:m(l),design:m(c),defaults:m(v),site:m(s?.site??{}),category:m(s?.category),storeData:m(s?.storeData),globalDesign:m(u)})},t=(r,i,l,c,v,s)=>{const u=b.get(r._uid);u!==void 0&&(u.content.value=i,u.design.value=l,u.defaults.value=c,u.site.value=v.site??{},u.category.value=v.category,u.globalDesign.value=s,u.storeData.value=v.storeData)},n=ue()?.appContext.app._uid??-1,a=b.get(n);return{init:e,update:t,context:a?.context,content:a?.content,design:a?.design,defaults:a?.defaults,site:a?.site,category:a?.category,storeData:a?.storeData,globalDesign:a?.globalDesign}}function ce(e,t){return{init:()=>{const{app:n}=y(e);return t?.init?.(n),{mount:(a,r)=>{d().init(n,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent,r.context.globalDesign),t?.mount?.(n,a,r),n.mount(a)},update:a=>{d().update(n,a.data.content,a.data.design,a.data.defaults,a.data.externalContent,a.context.globalDesign),t?.update?.(n,a)},unmount:()=>{t?.unmount?.(n),n.unmount()}}}}}function ve(){return globalThis.window.instantsite}function de(e,t){return{init:()=>{const{app:n}=y(e);return t?.init?.(n),{render:async(a,r)=>(d().init(n,a,r.content,r.design,r.defaults,r.externalContent,a.globalDesign),t?.render?.(n,a,r),{html:await se(n,{context:a}),state:{context:a,data:r}})}}}}var D=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(D||{}),G=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e.NONE="NONE",e))(G||{}),N=(e=>(e.SOLID="SOLID",e.OUTLINE="OUTLINE",e.TEXT="TEXT",e))(N||{}),h=(e=>(e.SMALL="SMALL",e.MEDIUM="MEDIUM",e.LARGE="LARGE",e))(h||{}),w=(e=>(e.ROUND_CORNER="ROUND_CORNER",e.RECTANGLE="RECTANGLE",e.PILL="PILL",e))(w||{}),M=(e=>(e.COLOR="COLOR",e.GRADIENT="GRADIENT",e))(M||{}),U=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(U||{}),P=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(P||{}),B=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e))(B||{}),x=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(x||{}),Ee=(e=>(e.TEXTAREA="TEXTAREA",e.INPUTBOX="INPUTBOX",e.SELECTBOX="SELECTBOX",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.BUTTON="BUTTON",e.DECK="DECK",e.MENU="MENU",e.NAVIGATION_MENU="NAVIGATION_MENU",e.LOGO="LOGO",e.INFO="INFO",e.DIVIDER="DIVIDER",e.CATEGORY_SELECTOR="CATEGORY_SELECTOR",e.PRODUCT_SELECTOR="PRODUCT_SELECTOR",e))(Ee||{}),k=(e=>(e.TEXT="TEXT",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e.BACKGROUND="BACKGROUND",e.COLOR_PICKER="COLOR_PICKER",e.LOGO="LOGO",e.DIVIDER="DIVIDER",e))(k||{}),K=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(K||{}),$=(e=>(e.HOME="home",e.CATALOG="catalog",e.CATEGORY="category",e.PRODUCT="product",e))($||{}),Y=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(Y||{}),z=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(z||{}),X=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(X||{});const Te={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"},ge={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},fe={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Oe={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},O={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};function pe(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function me(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function Le(e){if("pageUrl"in e)return e.pageUrl;switch(me(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}function _e(e){if("categoryId"in e)return e.categoryId}const F=(e,t,n)=>{if(!e||t)return;const{type:a,link:r,email:i,phone:l}=e,c=Le(e),v=_e(e);switch(a){case O.HYPER_LINK:if(r)return()=>window.open(r,"_blank");break;case O.GO_TO_STORE:case O.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case O.GO_TO_CATEGORY:case O.GO_TO_CATEGORY_LINK:const s=n?.find(u=>u.id===v)?.url;return s===void 0?()=>window.open("/404","_self"):()=>window.open(s,"_self");case O.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case O.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case O.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const u=pe(e);document.getElementById(`tile-${u}`)?.scrollIntoView()};break;case O.GO_TO_PAGE:if(c)return()=>window.open(c,"_self");break;default:console.error(`Unknown type of ActionLink: ${a}`)}};function Ie(e){return"title"in e&&"type"in e}function Ce(e,t,n,a){const r=o(()=>{const _=e.value[t];if(_!==void 0){if(Ie(_))return _;throw new Error(`Element ${t} is not action link`)}}),i=o(()=>r.value?.title),l=o(()=>r.value?.type),c=o(()=>r.value?.link),v=o(()=>r.value?.email),s=o(()=>r.value?.phone),u=o(()=>r.value?.tileId?`tile-${r.value?.tileId}`:null),E=o(()=>r.value?.type==="GO_TO_STORE_LINK"?"products":r.value?.pageId),g=o(()=>r.value?.pageUrl),I=o(()=>!!i.value),p=o(()=>!!c.value),L=F(r.value,n,a);return T({title:i,type:l,link:c,email:v,phone:s,tileDivId:u,pageId:E,pageUrl:g,hasTitle:I,hasLink:p,performAction:L})}function W(e,t){const n=d(),a=o(()=>!!n.site?.value?.isPreviewMode),r=o(()=>n.category?.value?.categories??[]),i=o(()=>t!==void 0?t:n.content.value!==void 0?n.content.value:{});return Ce(i,e,a.value,r.value)}function H({content:e,elementName:t,errorMessage:n,validatorFn:a}){return o(()=>{const r=e.value?.[t];if(r!==void 0){if(a(r))return r;throw new Error(n)}})}function Re(e){return typeof e=="object"&&e!==null&&"categories"in e}function Se(e){return o(()=>e.value.reduce((t,n)=>(t[n.id]=n,t),{}))}function be(e){return e!==void 0}function Ae(e){return!!e?.trim()}function ye({name:e,customName:t,selectionType:n}){return n==="ROOT"?e:Ae(t)?t:e}function De(e,t){return be(e)&&t}function V({itemId:e,id:t,alt:n,name:a,nameTranslated:r,customName:i,enabled:l,productsCount:c,url:v,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:E,selectionType:g}){return{itemId:e||t.toString(),id:t,alt:n,name:ye({name:a,customName:i,selectionType:g}),nameTranslated:r,label:a,enabled:l,url:v,productsCount:c,imageUrl:s,thumbnailImageUrl:u,imageBorderInfo:E,showCategory:De(t,l)}}function j(e,t,n){const a=d(),r=o(()=>t!==void 0?t:a.content.value),i=H({content:r,elementName:e,errorMessage:`Element ${e} is not a category selector type`,validatorFn:Re}),l=o(()=>n??a.storeData?.value),c=o(()=>i.value?.categories.selectionType??"ROOT"),v=o(()=>l.value?.categories??[]),s=o(()=>i.value?.categories?.categoryIds??[]),u=o(()=>{const I=Se(v);return c.value==="MANUAL"?i.value?.categories?.items?.map(p=>{const L=I.value[p.id];return V({...p,...L,selectionType:c.value})})??[]:l?.value?.categories.map(p=>V({...p,selectionType:c.value}))??[]}),E=o(()=>i.value!==void 0),g=o(()=>u.value!==void 0&&u.value.length>0);return T({categories:u,categoryIds:s,hasContent:E,hasCategories:g})}function Ge(e){return typeof e=="object"&&e!==null&&("products"in e||"product"in e)}function J(e,t,n){const a=d(),r=o(()=>t!==void 0?t:a.content.value),i=H({content:r,elementName:e,errorMessage:`Element ${e} is not a product selector type`,validatorFn:Ge}),l=o(()=>n??a.storeData?.value),c=o(()=>i.value?.products?.selectionType??"MANUAL"),v=o(()=>i.value?.products?.productIds??[]),s=o(()=>i.value?.product?.id),u=o(()=>i.value?.categoryId?parseInt(i.value.categoryId,10):void 0),E=o(()=>{if(v.value&&u.value&&c.value==="CATEGORY")return l?.value?.products.filter(_=>_?.defaultCategoryId===u.value)??[];if(typeof u.value=="number"&&u.value===0&&c.value==="CATEGORY")return l?.value?.products??[];const L=s.value?[s.value]:v.value??[];return l?.value?.products?.filter(_=>L.includes(_.id))??[]}),g=o(()=>l?.value?.categories.filter(L=>L.id===u?.value)??[]),I=o(()=>i.value!==void 0&&E.value.length>0),p=o(()=>E.value!==void 0&&E.value.length>0);return T({products:E,categories:g,categoryId:u,hasContent:I,hasProducts:p})}function Ne(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function C(e,t){const n=new RegExp(/^https?:\/\//);return e!=null&&n.test(e)?e:`${t}/${e}`}function he(e,t){const n=o(()=>{const s=e.value[t];if(s!==void 0){if(Ne(s))return s;throw new Error(`Element ${t} is not image`)}}),a=o(()=>n.value===void 0?"":d().context.value.imageBuckets?.[n.value?.bucket]),r=o(()=>n.value!==void 0),i=o(()=>C(n.value?.set?.["cropped-webp-100x200"]?.url,a.value)),l=o(()=>C(n.value?.set?.["cropped-webp-1000x2000"]?.url,a.value)),c=o(()=>C(n.value?.set?.["webp-200x200"]?.url,a.value)),v=o(()=>C(n.value?.set?.["webp-2000x2000"]?.url,a.value));return T({hasContent:r,lowResolutionMobileImage:i,highResolutionMobileImage:l,lowResolutionDesktopImage:c,highResolutionDesktopImage:v})}function q(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return he(a,e)}function we(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not inputbox`)}}),a=o(()=>n.value!==void 0&&n.value.length>0),r=o(()=>n.value);return T({hasContent:a,value:r})}function Q(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return we(a,e)}function Me(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not selectbox`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return T({hasContent:a,value:r})}function Z(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Me(a,e)}function Ue(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not textarea`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value);return T({hasContent:a,value:r})}function ee(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Ue(a,e)}function Pe(e){return"enabled"in e}function Be(e,t){const n=o(()=>{const i=e.value[t];if(i!==void 0){if(Pe(i))return i;throw new Error(`Element ${t} is not toggle`)}}),a=o(()=>n.value!==void 0),r=o(()=>n.value?.enabled);return T({hasContent:a,value:r})}function te(e,t){const n=d(),a=o(()=>t!==void 0?t:n.content.value);return Be(a,e)}var ne=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e.CATEGORY_SELECTOR="CATEGORY_SELECTOR",e.PRODUCT_SELECTOR="PRODUCT_SELECTOR",e))(ne||{});function xe(e){if(typeof e!="object"||e===null)return!1;const t=e;return Array.isArray(t.cards)&&t.cards.every(n=>typeof n.settings=="object"&&n.settings!==null)}function ke(e,t,n,a){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const r=e.settings[n];if(r===void 0)return r;switch(t){case"TEXTAREA":return ee(n,e.settings);case"INPUTBOX":return Q(n,e.settings);case"SELECTBOX":return Z(n,e.settings);case"IMAGE":return q(n,e.settings);case"TOGGLE":return te(n,e.settings);case"BUTTON":return W(n,e.settings);case"CATEGORY_SELECTOR":return j(n,e.settings,a);case"PRODUCT_SELECTOR":return J(n,e.settings,a);default:return}}function Ke(e){const t=d(),n=o(()=>t.storeData?.value),a=o(()=>{const l=t.content.value[e];if(l!==void 0){if(xe(l))return l;throw new Error(`Element ${e} is not of DECK type`)}}),r=o(()=>a.value!==void 0&&a.value.cards.length>0),i=o(()=>a.value?.cards);return T({hasContent:r,cards:i,getReactiveRef:(l,c,v)=>ke(l,c,v,n.value)})}function $e(e){return"type"in e&&("text"in e||"image"in e)}function R(e,t){const n=new RegExp(/^https?:\/\//);return e!==void 0&&n.test(e)?e:`${t}/${e}`}function Ye(){const e=d(),t=o(()=>{const l=e.content.value.logo;if(l!==void 0){if($e(l))return l;throw new Error("Element logo is not LOGO")}}),n=o(()=>t.value?.type),a=o(()=>t.value?.text),r=o(()=>t.value?.image===void 0?"":e.context.value.imageBuckets?.[t.value.image.bucket]),i=o(()=>({lowResolutionMobileImage:R(t.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:R(t.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:R(t.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:R(t.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return T({type:n,text:a,image:i})}function ze(e){return e!==null&&"items"in e}function oe(e){const t=d(),n=o(()=>{const l=t.content.value[e];if(l!==void 0){if(ze(l))return l;throw new Error(`Element ${e} is not an menu`)}}),a=o(()=>!!t.site?.value?.isPreviewMode),r=o(()=>n.value!==void 0),i=o(()=>n.value?.items?n.value.items.map(l=>({...l,performAction:F(l,a.value)})):[]);return T({hasContent:r,items:i})}const Xe="menu";function Fe(){return oe(Xe)}function We(){return globalThis.craneSharedTranslation??{}}function He(){const e=d(),t=o(()=>e.site?.value),n=o(()=>We()),a=o(()=>{const r=t.value?.languages;return r?r.find(i=>i.selected)?.code??r.find(i=>i.main)?.code??"en":"en"});return{t:r=>{const i=n.value;if(!i||Object.keys(i).length===0)return r;const l=a.value,c=i[l]?.[r];if(c!==void 0)return c;if(l!=="en"){const v=i.en?.[r];if(v!==void 0)return v}return r},currentLanguageCode:a}}function ae(e,t){if(t===void 0)return;if(!t.startsWith("global."))return t.replaceAll("_"," ");const n=t.split(".").at(2);if(n!==void 0)return e.fontFamily?e.fontFamily[n].replaceAll("_"," "):void 0}function S(e,t,n){return t?ae(e,t):ae(e,n)}function re(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.textSize?e.textSize[n]:void 0}function A(e,t,n){return t?re(e,t):re(e,n)}function ie(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.color?e.color[n]:void 0}function f(e,t,n){return t?ie(e,t):ie(e,n)}function Ve(e,t,n){return{visible:t?.visible??n?.visible??!1,width:t?.width??n?.width??1,color:f(e,t?.color,n?.color)}}function je(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e],l=t.globalDesign.value;return{background:{type:r?.background?.type??i?.background?.type,solid:{color:f(l,r?.background?.solid?.color,i?.background?.solid?.color)},gradient:{fromColor:f(l,r?.background?.gradient?.fromColor,i?.background?.gradient?.fromColor),toColor:f(l,r?.background?.gradient?.toColor,i?.background?.gradient?.toColor)}}}}),a=o(()=>n.value?.background);return T({background:a})}function Je(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],E=t.globalDesign.value;return{appearance:s?.appearance??u?.appearance,font:S(E,s?.font,u?.font),size:s?.size??u?.size,style:s?.style??u?.style,color:f(E,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.appearance),r=o(()=>n.value?.font),i=o(()=>n.value?.size),l=o(()=>n.value?.style),c=o(()=>n.value?.color),v=o(()=>n.value?.visible);return T({appearance:a,font:r,size:i,style:l,color:c,visible:v})}function qe(e){const t=d(),n=o(()=>{const i=t.design.value[e],l=t.defaults.value[e],c=t.globalDesign.value;return{overlay:{type:i?.overlay?.type??l?.overlay?.type,solid:{color:f(c,i?.overlay?.solid?.color,l?.overlay?.solid?.color)},gradient:{fromColor:f(c,i?.overlay?.gradient?.fromColor,l?.overlay?.gradient?.fromColor),toColor:f(c,i?.overlay?.gradient?.toColor,l?.overlay?.gradient?.toColor)}},visible:i?.visible??l?.visible??!1}}),a=o(()=>n.value?.overlay),r=o(()=>n.value?.visible);return T({overlay:a,visible:r})}function Qe(){const e=d(),t=o(()=>e.design.value.layout),n=o(()=>t.value);return T({layout:n})}function Ze(){const e=d();return o(()=>{const t=e.design.value.logo,n=e.defaults.value.logo,a=e.globalDesign.value;return{font:S(a,t?.font,n?.font),size:A(a,t?.size,n?.size),bold:t?.bold??n?.bold,italic:t?.italic??n?.italic,color:f(a,t?.color,n?.color),visible:t?.visible??n?.visible??!1,spacing:t?.spacing??n?.spacing??0,capitalization:t?.capitalization??n?.capitalization??"none",frame:Ve(a,t?.frame,n?.frame)}})}function et(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{value:r?.value??i?.value}}),a=o(()=>n.value?.value);return T({value:a})}function tt(e){const t=d(),n=o(()=>{const s=t.design.value[e],u=t.defaults.value[e],E=t.globalDesign.value;return{font:S(E,s?.font,u?.font),size:A(E,s?.size,u?.size),bold:s?.bold??u?.bold,italic:s?.italic??u?.italic,color:f(E,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),c=o(()=>n.value?.color),v=o(()=>n.value?.visible);return T({font:a,size:r,bold:i,italic:l,color:c,visible:v})}function nt(e){const t=d(),n=o(()=>{const u=t.design.value[e],E=t.defaults.value[e],g=t.globalDesign.value;return{font:S(g,u?.font,E?.font),size:A(g,u?.size,E?.size),bold:u?.bold??E?.bold,italic:u?.italic??E?.italic,color:f(g,u?.color,E?.color),visible:u?.visible??E?.visible??!1,whiteSpace:"pre-wrap"}}),a=o(()=>n.value?.font),r=o(()=>n.value?.size),i=o(()=>n.value?.bold),l=o(()=>n.value?.italic),c=o(()=>n.value?.color),v=o(()=>n.value?.visible),s=o(()=>n.value?.whiteSpace);return T({font:a,size:r,bold:i,italic:l,color:c,visible:v,whiteSpace:s})}function ot(e){const t=d(),n=o(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{enabled:r?.enabled??i?.enabled}}),a=o(()=>n.value?.enabled);return T({enabled:a})}export{x as ActionLinkTypeEnum,M as BackgroundStyleEnum,N as ButtonAppearanceEnum,w as ButtonShapeEnum,h as ButtonSizeEnum,D as ButtonTypeEnum,ge as CatalogLayoutSlot,fe as CategoryLayoutSlot,B as ConfigTypeEnum,k as DesignEditorType,ne as EditorTypes,z as ImageSet,X as InstantsiteJsEvent,G as OverlayTypeEnum,P as PluginTypeEnum,Oe as ProductLayoutSlot,$ as ReservedTemplatePageNameEnum,U as SectionTypeEnum,Te as TemplateCategoriesList,K as TemplatePageEnum,Y as ValidationTypeEnum,ce as createVueClientApp,de as createVueServerApp,je as useBackgroundElementDesign,W as useButtonElementContent,Je as useButtonElementDesign,j as useCategorySelectorElementContent,Ke as useDeckElementContent,q as useImageElementContent,qe as useImageElementDesign,Q as useInputboxElementContent,ve as useInstantsiteJsApi,Qe as useLayoutElementDesign,Ye as useLogoElementContent,Ze as useLogoElementDesign,oe as useMenuElementContent,Fe as useNavigationMenuElementContent,J as useProductSelectorElementContent,Z as useSelectboxElementContent,et as useSelectboxElementDesign,tt as useTextElementDesign,ee as useTextareaElementContent,nt as useTextareaElementDesign,te as useToggleElementContent,ot as useToggleElementDesign,He as useTranslation,d as useVueBaseProps};
|