@shopware/composables 1.8.1 → 1.9.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/README.md CHANGED
@@ -165,9 +165,11 @@ All composable functions are fully typed with TypeScript and they are registed g
165
165
 
166
166
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/composables/CHANGELOG.md)
167
167
 
168
- ### Latest changes: 1.8.1
168
+ ### Latest changes: 1.9.1
169
169
 
170
170
  ### Patch Changes
171
171
 
172
- - Updated dependencies [[`7324620`](https://github.com/shopware/frontends/commit/7324620a3f39c1b62f7cc294192a3e8b8b336d09)]:
173
- - @shopware/api-client@1.2.1
172
+ - [#1877](https://github.com/shopware/frontends/pull/1877) [`ab040bb`](https://github.com/shopware/frontends/commit/ab040bb6cc05541001a983c26d5cb6dbf3192394) Thanks [@mkucmus](https://github.com/mkucmus)! - Adjust `readSeoUrl` request in case of trailing slash when technical URL is used
173
+
174
+ - Updated dependencies [[`c8fa438`](https://github.com/shopware/frontends/commit/c8fa438b38de6dbc43a2895f2d1906907447c384)]:
175
+ - @shopware/helpers@1.5.0
package/dist/index.d.mts CHANGED
@@ -51,6 +51,7 @@ type CmsBlockGalleryBuybox = BlockType<TWO_COLUMNS>;
51
51
  type CmsBlockProductDescriptionReviews = BlockType<"content">;
52
52
  type CmsBlockCrossSelling = BlockType<"content">;
53
53
  type CmsBlockForm = BlockType<"content">;
54
+ type CmsBlockHtml = BlockType<"content">;
54
55
 
55
56
  type SourceType = "static" | "mapped";
56
57
  type Position = "left" | "center" | "right";
@@ -84,6 +85,13 @@ type CmsElementText = Schemas["CmsSlot"] & {
84
85
  config: TextElementConfig;
85
86
  };
86
87
  };
88
+ type CmsElementHtml = Schemas["CmsSlot"] & {
89
+ type: "html";
90
+ data: {
91
+ content: string;
92
+ apiAlias: "cms_html";
93
+ };
94
+ };
87
95
  type ImageElementConfig = {
88
96
  url: ElementConfig<string>;
89
97
  media: ElementConfig<string>;
@@ -169,7 +177,7 @@ type YouTubeVideoElementConfig = {
169
177
  previewMedia: ElementConfig<string>;
170
178
  showControls: ElementConfig<boolean>;
171
179
  needsConfirmation: ElementConfig<boolean>;
172
- advancePrivacyMode: ElementConfig<boolean>;
180
+ advancedPrivacyMode: ElementConfig<boolean>;
173
181
  };
174
182
  type CmsElementYoutubeVideo = Schemas["CmsSlot"] & {
175
183
  type: "youtube-video";
@@ -410,6 +418,7 @@ declare function useCmsElementConfig<T extends Schemas["CmsSlot"] & {
410
418
  declare function createShopwareContext(app: App, options: {
411
419
  devStorefrontUrl?: string | null;
412
420
  enableDevtools?: boolean;
421
+ browserLocale?: string;
413
422
  }): vue.Raw<{
414
423
  install(app: App): void;
415
424
  _a: App<any>;
@@ -418,6 +427,7 @@ declare function createShopwareContext(app: App, options: {
418
427
  state: {
419
428
  interceptors: {};
420
429
  } | undefined;
430
+ browserLocale: string;
421
431
  }>;
422
432
 
423
433
  type UseAddressReturn = {
@@ -907,6 +917,10 @@ type UseCountriesReturn = {
907
917
  getCountries: ComputedRef<Schemas["Country"][]>;
908
918
  fetchCountries(): Promise<operations["readCountry post /country"]["response"]>;
909
919
  getStatesForCountry(countryId: string): Schemas["CountryState"][] | null;
920
+ getCountriesOptions: ComputedRef<{
921
+ label: string;
922
+ value: string;
923
+ }[]>;
910
924
  };
911
925
  /**
912
926
  * Composable to manage countries
@@ -1579,13 +1593,17 @@ type UsePriceReturn = {
1579
1593
  * Update configuration
1580
1594
  */
1581
1595
  update(params: {
1582
- localeCode: string | undefined;
1596
+ localeCode?: string | undefined;
1583
1597
  currencyCode: string;
1584
1598
  }): void;
1585
1599
  /**
1586
1600
  * Currency code
1587
1601
  */
1588
1602
  currencyCode: ComputedRef<string>;
1603
+ /**
1604
+ * Currency locale
1605
+ */
1606
+ currencyLocale: ComputedRef<string>;
1589
1607
  };
1590
1608
  /**
1591
1609
  * Composable for getting formatted price
@@ -1595,7 +1613,7 @@ type UsePriceReturn = {
1595
1613
  * @category Product
1596
1614
  */
1597
1615
  declare function _usePrice(params?: {
1598
- localeCode: string | undefined;
1616
+ localeCode?: string | undefined;
1599
1617
  currencyCode: string;
1600
1618
  }): UsePriceReturn;
1601
1619
  /**
@@ -1957,6 +1975,11 @@ type ShopwareContext = {
1957
1975
  * Shopware API client
1958
1976
  */
1959
1977
  apiClient: ApiClient;
1978
+ /**
1979
+ * Browser locale, working in SSR
1980
+ * If not provided, it will be "en-US"
1981
+ */
1982
+ browserLocale: string;
1960
1983
  };
1961
1984
  /**
1962
1985
  * @public
@@ -2084,6 +2107,8 @@ type UseUserReturn = {
2084
2107
  */
2085
2108
  updateEmail(updateEmailData: operations["changeEmail post /account/change-email"]["body"]): Promise<void>;
2086
2109
  /**
2110
+ * @deprecated API endpoint is removed in Shopware 6.7
2111
+ *
2087
2112
  * Sets the default payment method for given id
2088
2113
  * @param paymentMethodId
2089
2114
  * @returns
@@ -2236,4 +2261,4 @@ declare function getDefaultApiParams(): {
2236
2261
  [composableName: string]: unknown;
2237
2262
  };
2238
2263
 
2239
- export { type BoxLayout, type Breadcrumb, type ChangePaymentShippingMethodParams, type CmsBlockCategoryNavigation, type CmsBlockCenterText, type CmsBlockCrossSelling, type CmsBlockForm, type CmsBlockGalleryBuybox, type CmsBlockImage, type CmsBlockImageBubbleRow, type CmsBlockImageCover, type CmsBlockImageFourColumn, type CmsBlockImageGallery, type CmsBlockImageHighlightRow, type CmsBlockImageSimpleGrid, type CmsBlockImageSlider, type CmsBlockImageText, type CmsBlockImageTextBubble, type CmsBlockImageTextCover, type CmsBlockImageTextGallery, type CmsBlockImageTextRow, type CmsBlockImageThreeColumn, type CmsBlockImageThreeCover, type CmsBlockImageTwoColumn, type CmsBlockProductDescriptionReviews, type CmsBlockProductHeading, type CmsBlockProductListing, type CmsBlockProductSlider, type CmsBlockProductThreeColumn, type CmsBlockSidebarFilter, type CmsBlockText, type CmsBlockTextHero, type CmsBlockTextOnImage, type CmsBlockTextTeaser, type CmsBlockTextTeaserSection, type CmsBlockTextThreeColumn, type CmsBlockTextTwoColumn, type CmsBlockVimeoVideo, type CmsBlockYoutubeVideo, type CmsElementBuyBox, type CmsElementCategoryNavigation, type CmsElementCrossSelling, type CmsElementForm, type CmsElementImage, type CmsElementImageGallery, type CmsElementImageSlider, type CmsElementManufacturerLogo, type CmsElementProductBox, type CmsElementProductDescriptionReviews, type CmsElementProductListing, type CmsElementProductName, type CmsElementProductSlider, type CmsElementSidebarFilter, type CmsElementText, type CmsElementVimeoVideo, type CmsElementYoutubeVideo, type CmsSectionBlock, type CmsSectionDefault, type CmsSectionSidebar, type DisplayMode, type ElementConfig, type ErrorObjectParam, type ImageContainerAttrs, type ListingType, type Notification, type NotificationOptions, type Position, type RouteObject, type ShopwareContext, type ShortcutFilterParam, type SliderElementConfig, type SourceType, type UseAddToCartReturn, type UseAddressReturn, type UseBreadcrumbsReturn, type UseCartErrorParamsResolver, type UseCartItemReturn, type UseCartReturn, type UseCategoryReturn, type UseCategorySearchReturn, type UseCheckoutReturn, type UseCmsBlockReturn, type UseCmsElementImage, type UseCmsMetaReturn, type UseCountriesReturn, type UseCustomerOrdersReturn, type UseCustomerPasswordReturn, type UseDefaultOrderAssociationsReturn, type UseInternationalizationReturn, type UseLandingSearchReturn, type UseListingReturn, type UseLocalWishlistReturn, type UseNavigationContextReturn, type UseNavigationReturn, type UseNavigationSearchReturn, type UseNewsletterReturn, type UseNotificationsReturn, type UseOrderDetailsReturn, type UseOrderPaymentReturn, type UsePriceReturn, type UseProductAssociationsReturn, type UseProductConfiguratorReturn, type UseProductPriceReturn, type UseProductReturn, type UseProductReviewsReturn, type UseProductSearchReturn, type UseProductSearchSuggestReturn, type UseProductWishlistReturn, type UseSalutationsReturn, type UseSessionContextReturn, type UseSyncWishlistReturn, type UseUserReturn, type UseWishlistReturn, type VerticalAlign, createCategoryListingContext, createListingComposable, createShopwareContext, getDefaultApiParams, resolveCmsComponent, useAddToCart, useAddress, useB2bQuoteManagement, useBreadcrumbs, useCart, useCartErrorParamsResolver, useCartFunction, useCartItem, useCartNotification, type useCartNotificationReturn, useCategory, useCategoryListing, useCategorySearch, useCheckout, useCmsBlock, useCmsElementConfig, useCmsElementImage, useCmsMeta, useCmsSection, useCmsTranslations, useContext, useCountries, useCustomerOrders, useCustomerPassword, useDefaultOrderAssociations, useInternationalization, useLandingSearch, useListing, useLocalWishlist, useNavigation, useNavigationContext, useNavigationSearch, useNewsletter, useNotifications, useOrderDetails, useOrderPayment, usePrice, useProduct, useProductAssociations, useProductConfigurator, useProductPrice, useProductReviews, useProductSearch, useProductSearchListing, useProductSearchSuggest, useProductWishlist, useSalutations, useSessionContext, useShopwareContext, useSyncWishlist, useUrlResolver, useUser, useWishlist };
2264
+ export { type BoxLayout, type Breadcrumb, type ChangePaymentShippingMethodParams, type CmsBlockCategoryNavigation, type CmsBlockCenterText, type CmsBlockCrossSelling, type CmsBlockForm, type CmsBlockGalleryBuybox, type CmsBlockHtml, type CmsBlockImage, type CmsBlockImageBubbleRow, type CmsBlockImageCover, type CmsBlockImageFourColumn, type CmsBlockImageGallery, type CmsBlockImageHighlightRow, type CmsBlockImageSimpleGrid, type CmsBlockImageSlider, type CmsBlockImageText, type CmsBlockImageTextBubble, type CmsBlockImageTextCover, type CmsBlockImageTextGallery, type CmsBlockImageTextRow, type CmsBlockImageThreeColumn, type CmsBlockImageThreeCover, type CmsBlockImageTwoColumn, type CmsBlockProductDescriptionReviews, type CmsBlockProductHeading, type CmsBlockProductListing, type CmsBlockProductSlider, type CmsBlockProductThreeColumn, type CmsBlockSidebarFilter, type CmsBlockText, type CmsBlockTextHero, type CmsBlockTextOnImage, type CmsBlockTextTeaser, type CmsBlockTextTeaserSection, type CmsBlockTextThreeColumn, type CmsBlockTextTwoColumn, type CmsBlockVimeoVideo, type CmsBlockYoutubeVideo, type CmsElementBuyBox, type CmsElementCategoryNavigation, type CmsElementCrossSelling, type CmsElementForm, type CmsElementHtml, type CmsElementImage, type CmsElementImageGallery, type CmsElementImageSlider, type CmsElementManufacturerLogo, type CmsElementProductBox, type CmsElementProductDescriptionReviews, type CmsElementProductListing, type CmsElementProductName, type CmsElementProductSlider, type CmsElementSidebarFilter, type CmsElementText, type CmsElementVimeoVideo, type CmsElementYoutubeVideo, type CmsSectionBlock, type CmsSectionDefault, type CmsSectionSidebar, type DisplayMode, type ElementConfig, type ErrorObjectParam, type ImageContainerAttrs, type ListingType, type Notification, type NotificationOptions, type Position, type RouteObject, type ShopwareContext, type ShortcutFilterParam, type SliderElementConfig, type SourceType, type UseAddToCartReturn, type UseAddressReturn, type UseBreadcrumbsReturn, type UseCartErrorParamsResolver, type UseCartItemReturn, type UseCartReturn, type UseCategoryReturn, type UseCategorySearchReturn, type UseCheckoutReturn, type UseCmsBlockReturn, type UseCmsElementImage, type UseCmsMetaReturn, type UseCountriesReturn, type UseCustomerOrdersReturn, type UseCustomerPasswordReturn, type UseDefaultOrderAssociationsReturn, type UseInternationalizationReturn, type UseLandingSearchReturn, type UseListingReturn, type UseLocalWishlistReturn, type UseNavigationContextReturn, type UseNavigationReturn, type UseNavigationSearchReturn, type UseNewsletterReturn, type UseNotificationsReturn, type UseOrderDetailsReturn, type UseOrderPaymentReturn, type UsePriceReturn, type UseProductAssociationsReturn, type UseProductConfiguratorReturn, type UseProductPriceReturn, type UseProductReturn, type UseProductReviewsReturn, type UseProductSearchReturn, type UseProductSearchSuggestReturn, type UseProductWishlistReturn, type UseSalutationsReturn, type UseSessionContextReturn, type UseSyncWishlistReturn, type UseUserReturn, type UseWishlistReturn, type VerticalAlign, createCategoryListingContext, createListingComposable, createShopwareContext, getDefaultApiParams, resolveCmsComponent, useAddToCart, useAddress, useB2bQuoteManagement, useBreadcrumbs, useCart, useCartErrorParamsResolver, useCartFunction, useCartItem, useCartNotification, type useCartNotificationReturn, useCategory, useCategoryListing, useCategorySearch, useCheckout, useCmsBlock, useCmsElementConfig, useCmsElementImage, useCmsMeta, useCmsSection, useCmsTranslations, useContext, useCountries, useCustomerOrders, useCustomerPassword, useDefaultOrderAssociations, useInternationalization, useLandingSearch, useListing, useLocalWishlist, useNavigation, useNavigationContext, useNavigationSearch, useNewsletter, useNotifications, useOrderDetails, useOrderPayment, usePrice, useProduct, useProductAssociations, useProductConfigurator, useProductPrice, useProductReviews, useProductSearch, useProductSearchListing, useProductSearchSuggest, useProductWishlist, useSalutations, useSessionContext, useShopwareContext, useSyncWishlist, useUrlResolver, useUser, useWishlist };
package/dist/index.d.ts CHANGED
@@ -51,6 +51,7 @@ type CmsBlockGalleryBuybox = BlockType<TWO_COLUMNS>;
51
51
  type CmsBlockProductDescriptionReviews = BlockType<"content">;
52
52
  type CmsBlockCrossSelling = BlockType<"content">;
53
53
  type CmsBlockForm = BlockType<"content">;
54
+ type CmsBlockHtml = BlockType<"content">;
54
55
 
55
56
  type SourceType = "static" | "mapped";
56
57
  type Position = "left" | "center" | "right";
@@ -84,6 +85,13 @@ type CmsElementText = Schemas["CmsSlot"] & {
84
85
  config: TextElementConfig;
85
86
  };
86
87
  };
88
+ type CmsElementHtml = Schemas["CmsSlot"] & {
89
+ type: "html";
90
+ data: {
91
+ content: string;
92
+ apiAlias: "cms_html";
93
+ };
94
+ };
87
95
  type ImageElementConfig = {
88
96
  url: ElementConfig<string>;
89
97
  media: ElementConfig<string>;
@@ -169,7 +177,7 @@ type YouTubeVideoElementConfig = {
169
177
  previewMedia: ElementConfig<string>;
170
178
  showControls: ElementConfig<boolean>;
171
179
  needsConfirmation: ElementConfig<boolean>;
172
- advancePrivacyMode: ElementConfig<boolean>;
180
+ advancedPrivacyMode: ElementConfig<boolean>;
173
181
  };
174
182
  type CmsElementYoutubeVideo = Schemas["CmsSlot"] & {
175
183
  type: "youtube-video";
@@ -410,6 +418,7 @@ declare function useCmsElementConfig<T extends Schemas["CmsSlot"] & {
410
418
  declare function createShopwareContext(app: App, options: {
411
419
  devStorefrontUrl?: string | null;
412
420
  enableDevtools?: boolean;
421
+ browserLocale?: string;
413
422
  }): vue.Raw<{
414
423
  install(app: App): void;
415
424
  _a: App<any>;
@@ -418,6 +427,7 @@ declare function createShopwareContext(app: App, options: {
418
427
  state: {
419
428
  interceptors: {};
420
429
  } | undefined;
430
+ browserLocale: string;
421
431
  }>;
422
432
 
423
433
  type UseAddressReturn = {
@@ -907,6 +917,10 @@ type UseCountriesReturn = {
907
917
  getCountries: ComputedRef<Schemas["Country"][]>;
908
918
  fetchCountries(): Promise<operations["readCountry post /country"]["response"]>;
909
919
  getStatesForCountry(countryId: string): Schemas["CountryState"][] | null;
920
+ getCountriesOptions: ComputedRef<{
921
+ label: string;
922
+ value: string;
923
+ }[]>;
910
924
  };
911
925
  /**
912
926
  * Composable to manage countries
@@ -1579,13 +1593,17 @@ type UsePriceReturn = {
1579
1593
  * Update configuration
1580
1594
  */
1581
1595
  update(params: {
1582
- localeCode: string | undefined;
1596
+ localeCode?: string | undefined;
1583
1597
  currencyCode: string;
1584
1598
  }): void;
1585
1599
  /**
1586
1600
  * Currency code
1587
1601
  */
1588
1602
  currencyCode: ComputedRef<string>;
1603
+ /**
1604
+ * Currency locale
1605
+ */
1606
+ currencyLocale: ComputedRef<string>;
1589
1607
  };
1590
1608
  /**
1591
1609
  * Composable for getting formatted price
@@ -1595,7 +1613,7 @@ type UsePriceReturn = {
1595
1613
  * @category Product
1596
1614
  */
1597
1615
  declare function _usePrice(params?: {
1598
- localeCode: string | undefined;
1616
+ localeCode?: string | undefined;
1599
1617
  currencyCode: string;
1600
1618
  }): UsePriceReturn;
1601
1619
  /**
@@ -1957,6 +1975,11 @@ type ShopwareContext = {
1957
1975
  * Shopware API client
1958
1976
  */
1959
1977
  apiClient: ApiClient;
1978
+ /**
1979
+ * Browser locale, working in SSR
1980
+ * If not provided, it will be "en-US"
1981
+ */
1982
+ browserLocale: string;
1960
1983
  };
1961
1984
  /**
1962
1985
  * @public
@@ -2084,6 +2107,8 @@ type UseUserReturn = {
2084
2107
  */
2085
2108
  updateEmail(updateEmailData: operations["changeEmail post /account/change-email"]["body"]): Promise<void>;
2086
2109
  /**
2110
+ * @deprecated API endpoint is removed in Shopware 6.7
2111
+ *
2087
2112
  * Sets the default payment method for given id
2088
2113
  * @param paymentMethodId
2089
2114
  * @returns
@@ -2236,4 +2261,4 @@ declare function getDefaultApiParams(): {
2236
2261
  [composableName: string]: unknown;
2237
2262
  };
2238
2263
 
2239
- export { type BoxLayout, type Breadcrumb, type ChangePaymentShippingMethodParams, type CmsBlockCategoryNavigation, type CmsBlockCenterText, type CmsBlockCrossSelling, type CmsBlockForm, type CmsBlockGalleryBuybox, type CmsBlockImage, type CmsBlockImageBubbleRow, type CmsBlockImageCover, type CmsBlockImageFourColumn, type CmsBlockImageGallery, type CmsBlockImageHighlightRow, type CmsBlockImageSimpleGrid, type CmsBlockImageSlider, type CmsBlockImageText, type CmsBlockImageTextBubble, type CmsBlockImageTextCover, type CmsBlockImageTextGallery, type CmsBlockImageTextRow, type CmsBlockImageThreeColumn, type CmsBlockImageThreeCover, type CmsBlockImageTwoColumn, type CmsBlockProductDescriptionReviews, type CmsBlockProductHeading, type CmsBlockProductListing, type CmsBlockProductSlider, type CmsBlockProductThreeColumn, type CmsBlockSidebarFilter, type CmsBlockText, type CmsBlockTextHero, type CmsBlockTextOnImage, type CmsBlockTextTeaser, type CmsBlockTextTeaserSection, type CmsBlockTextThreeColumn, type CmsBlockTextTwoColumn, type CmsBlockVimeoVideo, type CmsBlockYoutubeVideo, type CmsElementBuyBox, type CmsElementCategoryNavigation, type CmsElementCrossSelling, type CmsElementForm, type CmsElementImage, type CmsElementImageGallery, type CmsElementImageSlider, type CmsElementManufacturerLogo, type CmsElementProductBox, type CmsElementProductDescriptionReviews, type CmsElementProductListing, type CmsElementProductName, type CmsElementProductSlider, type CmsElementSidebarFilter, type CmsElementText, type CmsElementVimeoVideo, type CmsElementYoutubeVideo, type CmsSectionBlock, type CmsSectionDefault, type CmsSectionSidebar, type DisplayMode, type ElementConfig, type ErrorObjectParam, type ImageContainerAttrs, type ListingType, type Notification, type NotificationOptions, type Position, type RouteObject, type ShopwareContext, type ShortcutFilterParam, type SliderElementConfig, type SourceType, type UseAddToCartReturn, type UseAddressReturn, type UseBreadcrumbsReturn, type UseCartErrorParamsResolver, type UseCartItemReturn, type UseCartReturn, type UseCategoryReturn, type UseCategorySearchReturn, type UseCheckoutReturn, type UseCmsBlockReturn, type UseCmsElementImage, type UseCmsMetaReturn, type UseCountriesReturn, type UseCustomerOrdersReturn, type UseCustomerPasswordReturn, type UseDefaultOrderAssociationsReturn, type UseInternationalizationReturn, type UseLandingSearchReturn, type UseListingReturn, type UseLocalWishlistReturn, type UseNavigationContextReturn, type UseNavigationReturn, type UseNavigationSearchReturn, type UseNewsletterReturn, type UseNotificationsReturn, type UseOrderDetailsReturn, type UseOrderPaymentReturn, type UsePriceReturn, type UseProductAssociationsReturn, type UseProductConfiguratorReturn, type UseProductPriceReturn, type UseProductReturn, type UseProductReviewsReturn, type UseProductSearchReturn, type UseProductSearchSuggestReturn, type UseProductWishlistReturn, type UseSalutationsReturn, type UseSessionContextReturn, type UseSyncWishlistReturn, type UseUserReturn, type UseWishlistReturn, type VerticalAlign, createCategoryListingContext, createListingComposable, createShopwareContext, getDefaultApiParams, resolveCmsComponent, useAddToCart, useAddress, useB2bQuoteManagement, useBreadcrumbs, useCart, useCartErrorParamsResolver, useCartFunction, useCartItem, useCartNotification, type useCartNotificationReturn, useCategory, useCategoryListing, useCategorySearch, useCheckout, useCmsBlock, useCmsElementConfig, useCmsElementImage, useCmsMeta, useCmsSection, useCmsTranslations, useContext, useCountries, useCustomerOrders, useCustomerPassword, useDefaultOrderAssociations, useInternationalization, useLandingSearch, useListing, useLocalWishlist, useNavigation, useNavigationContext, useNavigationSearch, useNewsletter, useNotifications, useOrderDetails, useOrderPayment, usePrice, useProduct, useProductAssociations, useProductConfigurator, useProductPrice, useProductReviews, useProductSearch, useProductSearchListing, useProductSearchSuggest, useProductWishlist, useSalutations, useSessionContext, useShopwareContext, useSyncWishlist, useUrlResolver, useUser, useWishlist };
2264
+ export { type BoxLayout, type Breadcrumb, type ChangePaymentShippingMethodParams, type CmsBlockCategoryNavigation, type CmsBlockCenterText, type CmsBlockCrossSelling, type CmsBlockForm, type CmsBlockGalleryBuybox, type CmsBlockHtml, type CmsBlockImage, type CmsBlockImageBubbleRow, type CmsBlockImageCover, type CmsBlockImageFourColumn, type CmsBlockImageGallery, type CmsBlockImageHighlightRow, type CmsBlockImageSimpleGrid, type CmsBlockImageSlider, type CmsBlockImageText, type CmsBlockImageTextBubble, type CmsBlockImageTextCover, type CmsBlockImageTextGallery, type CmsBlockImageTextRow, type CmsBlockImageThreeColumn, type CmsBlockImageThreeCover, type CmsBlockImageTwoColumn, type CmsBlockProductDescriptionReviews, type CmsBlockProductHeading, type CmsBlockProductListing, type CmsBlockProductSlider, type CmsBlockProductThreeColumn, type CmsBlockSidebarFilter, type CmsBlockText, type CmsBlockTextHero, type CmsBlockTextOnImage, type CmsBlockTextTeaser, type CmsBlockTextTeaserSection, type CmsBlockTextThreeColumn, type CmsBlockTextTwoColumn, type CmsBlockVimeoVideo, type CmsBlockYoutubeVideo, type CmsElementBuyBox, type CmsElementCategoryNavigation, type CmsElementCrossSelling, type CmsElementForm, type CmsElementHtml, type CmsElementImage, type CmsElementImageGallery, type CmsElementImageSlider, type CmsElementManufacturerLogo, type CmsElementProductBox, type CmsElementProductDescriptionReviews, type CmsElementProductListing, type CmsElementProductName, type CmsElementProductSlider, type CmsElementSidebarFilter, type CmsElementText, type CmsElementVimeoVideo, type CmsElementYoutubeVideo, type CmsSectionBlock, type CmsSectionDefault, type CmsSectionSidebar, type DisplayMode, type ElementConfig, type ErrorObjectParam, type ImageContainerAttrs, type ListingType, type Notification, type NotificationOptions, type Position, type RouteObject, type ShopwareContext, type ShortcutFilterParam, type SliderElementConfig, type SourceType, type UseAddToCartReturn, type UseAddressReturn, type UseBreadcrumbsReturn, type UseCartErrorParamsResolver, type UseCartItemReturn, type UseCartReturn, type UseCategoryReturn, type UseCategorySearchReturn, type UseCheckoutReturn, type UseCmsBlockReturn, type UseCmsElementImage, type UseCmsMetaReturn, type UseCountriesReturn, type UseCustomerOrdersReturn, type UseCustomerPasswordReturn, type UseDefaultOrderAssociationsReturn, type UseInternationalizationReturn, type UseLandingSearchReturn, type UseListingReturn, type UseLocalWishlistReturn, type UseNavigationContextReturn, type UseNavigationReturn, type UseNavigationSearchReturn, type UseNewsletterReturn, type UseNotificationsReturn, type UseOrderDetailsReturn, type UseOrderPaymentReturn, type UsePriceReturn, type UseProductAssociationsReturn, type UseProductConfiguratorReturn, type UseProductPriceReturn, type UseProductReturn, type UseProductReviewsReturn, type UseProductSearchReturn, type UseProductSearchSuggestReturn, type UseProductWishlistReturn, type UseSalutationsReturn, type UseSessionContextReturn, type UseSyncWishlistReturn, type UseUserReturn, type UseWishlistReturn, type VerticalAlign, createCategoryListingContext, createListingComposable, createShopwareContext, getDefaultApiParams, resolveCmsComponent, useAddToCart, useAddress, useB2bQuoteManagement, useBreadcrumbs, useCart, useCartErrorParamsResolver, useCartFunction, useCartItem, useCartNotification, type useCartNotificationReturn, useCategory, useCategoryListing, useCategorySearch, useCheckout, useCmsBlock, useCmsElementConfig, useCmsElementImage, useCmsMeta, useCmsSection, useCmsTranslations, useContext, useCountries, useCustomerOrders, useCustomerPassword, useDefaultOrderAssociations, useInternationalization, useLandingSearch, useListing, useLocalWishlist, useNavigation, useNavigationContext, useNavigationSearch, useNewsletter, useNotifications, useOrderDetails, useOrderPayment, usePrice, useProduct, useProductAssociations, useProductConfigurator, useProductPrice, useProductReviews, useProductSearch, useProductSearchListing, useProductSearchSuggest, useProductWishlist, useSalutations, useSessionContext, useShopwareContext, useSyncWishlist, useUrlResolver, useUser, useWishlist };
package/dist/index.mjs CHANGED
@@ -82,7 +82,8 @@ function createShopwareContext(app, options) {
82
82
  _a: app,
83
83
  _e: scope,
84
84
  devStorefrontUrl: options.devStorefrontUrl,
85
- state
85
+ state,
86
+ browserLocale: options.browserLocale || "en-US"
86
87
  });
87
88
  if (options?.enableDevtools && typeof window !== "undefined") ;
88
89
  return shopwarePlugin;
@@ -186,8 +187,7 @@ function useAddToCart(product) {
186
187
  const { addProduct, cartItems } = useCart();
187
188
  const quantity = ref(1);
188
189
  async function addToCart() {
189
- if (!_product.value?.id)
190
- throw new Error("Product id is required");
190
+ if (!_product.value?.id) throw new Error("Product id is required");
191
191
  const addToCartResponse = await addProduct({
192
192
  id: _product.value?.id,
193
193
  quantity: quantity.value
@@ -224,10 +224,8 @@ function useBreadcrumbs(newBreadcrumbs) {
224
224
  _breadcrumbs.value = [];
225
225
  };
226
226
  const pushBreadcrumb = (breadcrumb) => {
227
- if (_breadcrumbs.value)
228
- _breadcrumbs.value.push(breadcrumb);
229
- else
230
- _breadcrumbs.value = [breadcrumb];
227
+ if (_breadcrumbs.value) _breadcrumbs.value.push(breadcrumb);
228
+ else _breadcrumbs.value = [breadcrumb];
231
229
  };
232
230
  const buildDynamicBreadcrumbs = async (breadcrumbs) => {
233
231
  _breadcrumbs.value = breadcrumbs.map((breadcrumb) => {
@@ -562,8 +560,7 @@ function useCheckout() {
562
560
  const shippingMethods = computed(() => storeShippingMethods.value || []);
563
561
  const paymentMethods = computed(() => storePaymentMethods.value || []);
564
562
  async function getShippingMethods({ forceReload } = { forceReload: false }, associations = {}) {
565
- if (shippingMethods.value.length && !forceReload)
566
- return shippingMethods;
563
+ if (shippingMethods.value.length && !forceReload) return shippingMethods;
567
564
  const mergedAssociations = defu(
568
565
  shippingMethodsAssociations,
569
566
  associations
@@ -585,8 +582,7 @@ function useCheckout() {
585
582
  return shippingMethods;
586
583
  }
587
584
  async function getPaymentMethods({ forceReload } = { forceReload: false }) {
588
- if (paymentMethods.value.length && !forceReload)
589
- return paymentMethods;
585
+ if (paymentMethods.value.length && !forceReload) return paymentMethods;
590
586
  const response = await apiClient.invoke(
591
587
  "readPaymentMethod post /payment-method",
592
588
  {
@@ -700,6 +696,12 @@ function useCountries() {
700
696
  const getCountries = computed(() => {
701
697
  return _sharedCountries.value ?? [];
702
698
  });
699
+ const getCountriesOptions = computed(() => {
700
+ return _sharedCountries.value?.map((element) => ({
701
+ label: element.translated.name,
702
+ value: element.id
703
+ })) ?? [];
704
+ });
703
705
  const mountedCallback = async () => {
704
706
  if (!_sharedCountries.value) {
705
707
  await fetchCountries();
@@ -715,7 +717,8 @@ function useCountries() {
715
717
  mountedCallback,
716
718
  fetchCountries,
717
719
  getStatesForCountry,
718
- getCountries
720
+ getCountries,
721
+ getCountriesOptions
719
722
  };
720
723
  }
721
724
 
@@ -849,11 +852,9 @@ function useInternationalization(pathResolver) {
849
852
  return devStorefrontUrl ? url.replace(`${current.protocol}//${current.host}`, devStorefrontUrl) : url;
850
853
  }
851
854
  function formatLink(link) {
852
- if (!pathResolver)
853
- return link;
855
+ if (!pathResolver) return link;
854
856
  if (typeof link === "string") {
855
- if (urlIsAbsolute(link))
856
- return link;
857
+ if (urlIsAbsolute(link)) return link;
857
858
  return pathResolver(link);
858
859
  }
859
860
  if (link.path) {
@@ -902,8 +903,7 @@ function isObject(item) {
902
903
  return item && typeof item === "object" && !Array.isArray(item);
903
904
  }
904
905
  function merge(target, ...sources) {
905
- if (!sources.length)
906
- return target;
906
+ if (!sources.length) return target;
907
907
  const source = sources.shift();
908
908
  if (source === void 0) {
909
909
  return target;
@@ -911,8 +911,7 @@ function merge(target, ...sources) {
911
911
  if (isObject(target) && isObject(source)) {
912
912
  for (const key in source) {
913
913
  if (isObject(source[key])) {
914
- if (!target[key])
915
- Object.assign(target, { [key]: {} });
914
+ if (!target[key]) Object.assign(target, { [key]: {} });
916
915
  merge(target[key], source[key]);
917
916
  } else {
918
917
  Object.assign(target, { [key]: source[key] });
@@ -1130,7 +1129,9 @@ function createListingComposable({
1130
1129
  properties: appliedFilters.properties?.split("|")
1131
1130
  };
1132
1131
  }
1133
- return search(appliedFilters);
1132
+ return search(
1133
+ appliedFilters
1134
+ );
1134
1135
  };
1135
1136
  const resetFilters = () => {
1136
1137
  const defaultFilters = Object.assign(
@@ -1296,7 +1297,7 @@ function useNavigationSearch() {
1296
1297
  };
1297
1298
  }
1298
1299
  const isTechnicalUrl = path.startsWith("/navigation/") || path.startsWith("/detail/") || path.startsWith("/landingPage/");
1299
- const normalizedPath = isTechnicalUrl ? path : path.substring(1);
1300
+ const normalizedPath = isTechnicalUrl ? path.endsWith("/") ? path.slice(0, -1) : path : path.substring(1);
1300
1301
  const seoResult = await apiClient.invoke("readSeoUrl post /seo-url", {
1301
1302
  body: {
1302
1303
  filter: [
@@ -1308,7 +1309,7 @@ function useNavigationSearch() {
1308
1309
  ]
1309
1310
  }
1310
1311
  });
1311
- return seoResult.data.elements?.[0];
1312
+ return seoResult.data.elements?.[0] ?? null;
1312
1313
  }
1313
1314
  return {
1314
1315
  resolvePath
@@ -1413,12 +1414,16 @@ function useOrderDetails(orderId, associations) {
1413
1414
  );
1414
1415
  provide("swOrderDetails", _sharedOrder);
1415
1416
  const orderAssociations = useDefaultOrderAssociations();
1416
- const paymentMethod = computed(
1417
- () => _sharedOrder.value?.transactions?.length ? _sharedOrder.value.transactions[_sharedOrder.value.transactions.length - 1].paymentMethod : void 0
1418
- );
1419
- const shippingMethod = computed(
1420
- () => _sharedOrder.value?.deliveries?.length ? _sharedOrder.value.deliveries[_sharedOrder.value.deliveries.length - 1].shippingMethod : void 0
1421
- );
1417
+ const paymentMethod = computed(() => {
1418
+ const transactions = _sharedOrder.value?.transactions;
1419
+ if (!transactions?.length) return void 0;
1420
+ return transactions[transactions.length - 1]?.paymentMethod;
1421
+ });
1422
+ const shippingMethod = computed(() => {
1423
+ const deliveries = _sharedOrder.value?.deliveries;
1424
+ if (!deliveries?.length) return void 0;
1425
+ return deliveries[deliveries.length - 1]?.shippingMethod;
1426
+ });
1422
1427
  const paymentUrl = ref();
1423
1428
  const personalDetails = computed(() => ({
1424
1429
  email: _sharedOrder.value?.orderCustomer?.email,
@@ -1464,7 +1469,7 @@ function useOrderDetails(orderId, associations) {
1464
1469
  body: params
1465
1470
  }
1466
1471
  );
1467
- _sharedOrder.value = orderDetailsResponse.data.orders?.elements?.[0] ?? null;
1472
+ _sharedOrder.value = orderDetailsResponse.data.orders?.elements?.[0] ?? void 0;
1468
1473
  paymentChangeableList.value = orderDetailsResponse.data.paymentChangeable ?? {};
1469
1474
  return orderDetailsResponse.data;
1470
1475
  }
@@ -1534,7 +1539,7 @@ function useOrderDetails(orderId, associations) {
1534
1539
  const hasDocuments = computed(() => !!_sharedOrder.value?.documents.length);
1535
1540
  const documents = computed(() => _sharedOrder.value?.documents || []);
1536
1541
  const paymentChangeable = computed(() => {
1537
- return Object.keys(paymentChangeableList.value).length ? paymentChangeableList.value[orderId] : false;
1542
+ return paymentChangeableList.value?.[orderId] ?? false;
1538
1543
  });
1539
1544
  const getPaymentMethods = async () => {
1540
1545
  const response = await apiClient.invoke(
@@ -1627,29 +1632,28 @@ function useOrderPayment(order) {
1627
1632
 
1628
1633
  function _usePrice(params) {
1629
1634
  const { sessionContext } = useSessionContext();
1630
- const currencyLocale = ref();
1635
+ const { browserLocale } = useShopwareContext();
1636
+ const currencyLocale = ref(browserLocale);
1631
1637
  const currencyCode = ref("");
1632
1638
  if (params) {
1633
1639
  currencyCode.value = params.currencyCode;
1634
- currencyLocale.value = params.localeCode;
1640
+ _setLocaleCode(params.localeCode);
1635
1641
  }
1636
1642
  function update(params2) {
1637
1643
  _setCurrencyCode(params2.currencyCode);
1638
- _setLocaleCode(
1639
- params2.localeCode || currencyLocale.value || typeof navigator !== "undefined" && navigator?.language || "en-US"
1640
- );
1644
+ _setLocaleCode(params2.localeCode);
1641
1645
  }
1642
1646
  function _setCurrencyCode(code) {
1643
1647
  currencyCode.value = code;
1644
1648
  }
1645
1649
  function _setLocaleCode(locale) {
1646
- currencyLocale.value = locale;
1650
+ currencyLocale.value = locale || currencyLocale.value;
1647
1651
  }
1648
1652
  function getFormattedPrice(value) {
1649
1653
  if (typeof value === "undefined") {
1650
1654
  return "";
1651
1655
  }
1652
- if (!currencyLocale.value) {
1656
+ if (!currencyLocale.value || !currencyCode.value) {
1653
1657
  return value.toString();
1654
1658
  }
1655
1659
  return new Intl.NumberFormat(currencyLocale.value, {
@@ -1673,7 +1677,8 @@ function _usePrice(params) {
1673
1677
  return {
1674
1678
  getFormattedPrice,
1675
1679
  update,
1676
- currencyCode: computed(() => currencyCode.value)
1680
+ currencyCode: computed(() => currencyCode.value),
1681
+ currencyLocale: computed(() => currencyLocale.value)
1677
1682
  };
1678
1683
  }
1679
1684
  const usePrice = createSharedComposable(_usePrice);
@@ -1789,6 +1794,7 @@ function useProductConfigurator() {
1789
1794
  return response.data.elements?.[0];
1790
1795
  } catch (e) {
1791
1796
  console.error("SwProductDetails:findVariantForSelectedOptions", e);
1797
+ return void 0;
1792
1798
  }
1793
1799
  }
1794
1800
  const handleChange = async (group, option, onChangeHandled) => {
@@ -2159,7 +2165,8 @@ function useShopwareContext() {
2159
2165
  }
2160
2166
  return {
2161
2167
  apiClient,
2162
- devStorefrontUrl: shopwareContext.devStorefrontUrl
2168
+ devStorefrontUrl: shopwareContext.devStorefrontUrl,
2169
+ browserLocale: shopwareContext.browserLocale || "en-US"
2163
2170
  };
2164
2171
  }
2165
2172
 
@@ -2197,8 +2204,7 @@ function useSyncWishlist() {
2197
2204
  _currentPage.value = response.data.products.page ?? 1;
2198
2205
  } catch (e) {
2199
2206
  if (e instanceof ApiClientError) {
2200
- if (e.status !== 404)
2201
- console.error(e);
2207
+ if (e.status !== 404) console.error(e);
2202
2208
  _wishlistItems.value = [];
2203
2209
  }
2204
2210
  }
@@ -2390,7 +2396,6 @@ function useUser() {
2390
2396
  logout,
2391
2397
  updateEmail,
2392
2398
  updatePersonalInfo,
2393
- setDefaultPaymentMethod,
2394
2399
  loadSalutation,
2395
2400
  salutation,
2396
2401
  loadCountry,
@@ -2399,6 +2404,7 @@ function useUser() {
2399
2404
  defaultShippingAddressId,
2400
2405
  userDefaultPaymentMethod,
2401
2406
  userDefaultBillingAddress,
2407
+ setDefaultPaymentMethod,
2402
2408
  userDefaultShippingAddress
2403
2409
  };
2404
2410
  }
@@ -2527,8 +2533,7 @@ function useB2bQuoteManagement() {
2527
2533
  };
2528
2534
  const changePaymentShippingMethod = async (params) => {
2529
2535
  const body = {};
2530
- if (params.paymentMethodId)
2531
- body.paymentMethodId = params.paymentMethodId;
2536
+ if (params.paymentMethodId) body.paymentMethodId = params.paymentMethodId;
2532
2537
  if (params.shippingMethodId)
2533
2538
  body.shippingMethodId = params.shippingMethodId;
2534
2539
  await apiClient.invoke(
@@ -2573,24 +2578,23 @@ function useCartNotification() {
2573
2578
  const { consumeCartErrors } = useCart();
2574
2579
  const codeErrorsNotification = () => {
2575
2580
  const errors = consumeCartErrors();
2576
- if (!errors || Array.isArray(errors))
2577
- return;
2581
+ if (!errors || Array.isArray(errors)) return;
2578
2582
  for (const element of Object.keys(errors)) {
2579
- if (successCodes.includes(errors[element].messageKey)) {
2580
- pushSuccess(errors[element].message);
2583
+ const error = errors[element];
2584
+ if (successCodes.includes(error.messageKey)) {
2585
+ pushSuccess(error.message);
2581
2586
  } else {
2582
- pushError(errors[element].message);
2587
+ pushError(error.message);
2583
2588
  }
2584
2589
  }
2585
2590
  };
2586
2591
  const getErrorsCodes = () => {
2587
2592
  const errors = consumeCartErrors();
2588
- if (!errors || Array.isArray(errors))
2589
- return [];
2593
+ if (!errors || Array.isArray(errors)) return [];
2590
2594
  return Object.keys(errors).reduce(
2591
2595
  (acc, element) => {
2592
- if (!successCodes.includes(errors[element].messageKey))
2593
- acc.push(errors[element]);
2596
+ const error = errors[element];
2597
+ if (!successCodes.includes(error.messageKey)) acc.push(error);
2594
2598
  return acc;
2595
2599
  },
2596
2600
  []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/composables",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "description": "Shopware Frontends composables for Vue",
5
5
  "author": "Shopware",
6
6
  "repository": {
@@ -51,22 +51,22 @@
51
51
  "types"
52
52
  ],
53
53
  "dependencies": {
54
- "@vueuse/core": "12.5.0",
54
+ "@vueuse/core": "13.3.0",
55
55
  "defu": "6.1.4",
56
56
  "scule": "1.3.0",
57
- "@shopware/helpers": "1.4.0",
58
- "@shopware/api-client": "1.2.1"
57
+ "@shopware/helpers": "1.5.0",
58
+ "@shopware/api-client": "1.3.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@biomejs/biome": "1.8.3",
62
- "@nuxt/kit": "3.15.4",
63
- "@vitest/coverage-v8": "3.0.5",
62
+ "@nuxt/kit": "3.17.5",
63
+ "@vitest/coverage-v8": "3.2.3",
64
64
  "@vue/test-utils": "2.4.6",
65
- "happy-dom": "17.1.0",
66
- "typescript": "5.6.3",
65
+ "happy-dom": "18.0.1",
66
+ "typescript": "5.8.3",
67
67
  "unbuild": "2.0.0",
68
- "vitest": "3.0.5",
69
- "vue": "3.5.13",
68
+ "vitest": "3.2.3",
69
+ "vue": "3.5.16",
70
70
  "tsconfig": "0.0.0"
71
71
  },
72
72
  "scripts": {
@@ -13,6 +13,7 @@ export function createShopwareContext(
13
13
  options: {
14
14
  devStorefrontUrl?: string | null;
15
15
  enableDevtools?: boolean;
16
+ browserLocale?: string;
16
17
  },
17
18
  ) {
18
19
  const scope: EffectScope = effectScope(true);
@@ -34,6 +35,7 @@ export function createShopwareContext(
34
35
  _e: scope,
35
36
  devStorefrontUrl: options.devStorefrontUrl,
36
37
  state,
38
+ browserLocale: options.browserLocale || "en-US",
37
39
  });
38
40
 
39
41
  if (options?.enableDevtools && typeof window !== "undefined") {
package/src/index.test.ts CHANGED
@@ -8,9 +8,10 @@ vi.mock("vue");
8
8
  describe("resolveCmsComponent", () => {
9
9
  vi.spyOn(vue, "resolveComponent").mockImplementation((element) => element);
10
10
  it("should resolve a cms component", () => {
11
- const result = resolveCmsComponent(
12
- CmsPage.cmsPage.sections[0].blocks[0] as unknown as Schemas["CmsBlock"],
13
- );
11
+ const section = CmsPage.cmsPage.sections?.[0];
12
+ const block = section?.blocks?.[0];
13
+
14
+ const result = resolveCmsComponent(block as unknown as Schemas["CmsBlock"]);
14
15
  expect(result.componentName).toBe("image-simple-grid");
15
16
  expect(result.componentNameToResolve).toBe("CmsBlockImageSimpleGrid");
16
17
  expect(result.isResolved).toBe(true);
@@ -78,3 +78,4 @@ export type CmsBlockProductDescriptionReviews = BlockType<"content">;
78
78
  export type CmsBlockCrossSelling = BlockType<"content">;
79
79
 
80
80
  export type CmsBlockForm = BlockType<"content">;
81
+ export type CmsBlockHtml = BlockType<"content">;