@shopware/composables 1.12.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { CSSProperties, ComputedRef, AnchorHTMLAttributes, ImgHTMLAttributes, App, EffectScope, Ref } from 'vue';
2
+ import { CSSProperties, ComputedRef, AnchorHTMLAttributes, ImgHTMLAttributes, MaybeRefOrGetter, App, EffectScope, Ref } from 'vue';
3
3
  import { createAPIClient, ApiError } from '@shopware/api-client';
4
4
  import { components, operations as operations$1 } from '@shopware/api-client/store-api-types';
5
5
  import * as _shopware_api_client_api_types from '@shopware/api-client/api-types';
@@ -33,6 +33,7 @@ type CmsBlockImageHighlightRow = BlockType<THREE_COLUMNS>;
33
33
  type CmsBlockImageSimpleGrid = BlockType<"left-top" | "left-bottom" | "right">;
34
34
  type CmsBlockImageSlider = BlockType<"imageSlider">;
35
35
  type CmsBlockImageGallery = BlockType<"imageGallery">;
36
+ type CmsBlockVideo = BlockType<"video">;
36
37
  type CmsBlockYoutubeVideo = BlockType<"video">;
37
38
  type CmsBlockVimeoVideo = BlockType<"video">;
38
39
  type CmsBlockImageText = BlockType<TWO_COLUMNS>;
@@ -44,6 +45,7 @@ type CmsBlockImageTextBubble = BlockType<"left-image" | "left-text" | "center-im
44
45
  type CmsBlockTextOnImage = BlockType<"content">;
45
46
  type CmsBlockSidebarFilter = BlockType<"content">;
46
47
  type CmsBlockCategoryNavigation = BlockType<"content">;
48
+ type CmsBlockCategoryHeading = BlockType<"content">;
47
49
  type CmsBlockProductHeading = BlockType<TWO_COLUMNS>;
48
50
  type CmsBlockProductThreeColumn = BlockType<THREE_COLUMNS>;
49
51
  type CmsBlockProductListing = BlockType<"content">;
@@ -54,10 +56,20 @@ type CmsBlockCrossSelling = BlockType<"content">;
54
56
  type CmsBlockForm = BlockType<"content">;
55
57
  type CmsBlockHtml = BlockType<"content">;
56
58
  type CmsBlockImageGalleryBig = BlockType<"imageGallery">;
59
+ type CmsBlockAppRenderer = BlockType<string> & {
60
+ type: "app-renderer";
61
+ customFields?: {
62
+ appBlockName?: string;
63
+ slotLayout?: {
64
+ grid?: string | null;
65
+ };
66
+ } | null;
67
+ };
57
68
 
58
69
  type SourceType = "static" | "mapped";
59
70
  type Position = "left" | "center" | "right";
60
71
  type DisplayMode = Exclude<CSSProperties["objectFit"], undefined> | "standard";
72
+ type MediaDisplayMode = "standard" | "stretch" | "cover";
61
73
  type BoxLayout = "standard" | "image" | "minimal";
62
74
  type VerticalAlign = "flex-start" | "center" | "flex-end" | "";
63
75
  type ElementConfig<VALUE_TYPE> = {
@@ -99,9 +111,11 @@ type ImageElementConfig = {
99
111
  media: ElementConfig<string>;
100
112
  newTab: ElementConfig<boolean>;
101
113
  product: ElementConfig<string>;
114
+ ariaLabel?: ElementConfig<string | null>;
102
115
  boxLayout: ElementConfig<BoxLayout>;
103
116
  displayMode: ElementConfig<DisplayMode>;
104
117
  minHeight: ElementConfig<string | number>;
118
+ isDecorative?: ElementConfig<boolean>;
105
119
  verticalAlign: ElementConfig<VerticalAlign>;
106
120
  horizontalAlign: ElementConfig<VerticalAlign>;
107
121
  };
@@ -112,6 +126,7 @@ type CmsElementImage = Omit<Schemas["CmsSlot"], "config"> & {
112
126
  mediaId: string;
113
127
  url: string;
114
128
  newTab: boolean;
129
+ ariaLabel?: string | null;
115
130
  apiAlias: "cms_image";
116
131
  media: Schemas["Media"];
117
132
  };
@@ -121,8 +136,8 @@ type SliderElementConfig = {
121
136
  minHeight: ElementConfig<string | number>;
122
137
  verticalAlign?: ElementConfig<VerticalAlign>;
123
138
  displayMode?: ElementConfig<"standard" | "cover" | "contain">;
124
- navigationDots?: ElementConfig<"outside" | "inside" | "">;
125
- navigationArrows?: ElementConfig<"outside" | "inside" | "">;
139
+ navigationDots?: ElementConfig<"outside" | "inside" | "none" | "">;
140
+ navigationArrows?: ElementConfig<"outside" | "inside" | "none" | "">;
126
141
  };
127
142
  type ImageSliderElementConfig = ImageElementConfig & SliderElementConfig & {
128
143
  sliderItems: ElementConfig<Array<{
@@ -168,6 +183,36 @@ type CmsElementImageGallery = Omit<Schemas["CmsSlot"], "config"> & {
168
183
  } | Schemas["ProductMedia"]>;
169
184
  };
170
185
  };
186
+ type VideoElementConfig = {
187
+ media: ElementConfig<string | null>;
188
+ displayMode: ElementConfig<MediaDisplayMode>;
189
+ minHeight: ElementConfig<string | null>;
190
+ verticalAlign: ElementConfig<VerticalAlign | null>;
191
+ horizontalAlign: ElementConfig<VerticalAlign | null>;
192
+ ariaLabel: ElementConfig<string | null>;
193
+ autoPlay: ElementConfig<boolean>;
194
+ muted: ElementConfig<boolean>;
195
+ loop: ElementConfig<boolean>;
196
+ playsInline: ElementConfig<boolean>;
197
+ showControls: ElementConfig<boolean>;
198
+ showCover: ElementConfig<boolean>;
199
+ };
200
+ type CmsElementVideo = Omit<Schemas["CmsSlot"], "config"> & {
201
+ type: "video";
202
+ config: VideoElementConfig;
203
+ data: {
204
+ mediaId: string | null;
205
+ url: string | null;
206
+ newTab: boolean | null;
207
+ ariaLabel: string | null;
208
+ apiAlias: "cms_video";
209
+ media: (Schemas["Media"] & {
210
+ extensions?: {
211
+ videoCoverMedia?: Schemas["Media"];
212
+ };
213
+ }) | null;
214
+ };
215
+ };
171
216
  type YouTubeVideoElementConfig = {
172
217
  end: ElementConfig<string>;
173
218
  url: ElementConfig<string>;
@@ -356,6 +401,18 @@ type CmsElementProductName = Omit<Schemas["CmsSlot"], "config"> & {
356
401
  config: TextElementConfig;
357
402
  };
358
403
  };
404
+ type CategoryNameElementConfig = {
405
+ content: ElementConfig<string>;
406
+ verticalAlign?: ElementConfig<VerticalAlign | null>;
407
+ };
408
+ type CmsElementCategoryName = Omit<Schemas["CmsSlot"], "config"> & {
409
+ type: "category-name";
410
+ config: CategoryNameElementConfig;
411
+ data: {
412
+ content: string | null;
413
+ apiAlias: "cms_text";
414
+ };
415
+ };
359
416
  type CmsElementManufacturerLogo = Omit<Schemas["CmsSlot"], "config"> & {
360
417
  type: "manufacturer-logo";
361
418
  config: ImageElementConfig;
@@ -363,6 +420,7 @@ type CmsElementManufacturerLogo = Omit<Schemas["CmsSlot"], "config"> & {
363
420
  mediaId: string;
364
421
  url: string;
365
422
  newTab: boolean;
423
+ ariaLabel?: string | null;
366
424
  apiAlias: "cms_manufacturer_logo";
367
425
  media: Schemas["Media"];
368
426
  };
@@ -391,6 +449,8 @@ type UseCmsElementImage = {
391
449
  newTab: boolean;
392
450
  url: string;
393
451
  }>;
452
+ ariaLabel: ComputedRef<string>;
453
+ isDecorative: ComputedRef<boolean>;
394
454
  displayMode: ComputedRef<DisplayMode>;
395
455
  isVideoElement: ComputedRef<boolean>;
396
456
  mimeType: ComputedRef<string | undefined>;
@@ -405,16 +465,15 @@ declare function useCmsElementImage(element: CmsElementImage | CmsElementManufac
405
465
  /**
406
466
  * Composable to get cms element config
407
467
  *
468
+ * `getConfigValue` reads the element on every call, so it follows a `ref` or
469
+ * getter passed as `element`.
470
+ *
408
471
  * @category CMS (Shopping Experiences)
409
472
  */
410
473
  declare function useCmsElementConfig<T extends Omit<Schemas["CmsSlot"], "config"> & {
411
- config: T["config"] extends {
412
- [key in infer X extends keyof T["config"]]: ElementConfig<unknown>;
413
- } ? {
414
- [key in X]: ElementConfig<T["config"][key]["value"]>;
415
- } : never;
416
- }>(element: T): {
417
- getConfigValue: <ELEMENT_CONFIG extends keyof T["config"]>(key: ELEMENT_CONFIG) => (typeof element.config)[ELEMENT_CONFIG]["value"];
474
+ config: Record<string, ElementConfig<unknown> | undefined>;
475
+ }>(element: MaybeRefOrGetter<T>): {
476
+ getConfigValue: <ELEMENT_CONFIG extends keyof T["config"]>(key: ELEMENT_CONFIG) => NonNullable<T["config"][ELEMENT_CONFIG]>["value"];
418
477
  };
419
478
 
420
479
  declare function createShopwareContext(app: App, options: {
@@ -854,11 +913,18 @@ declare function useCheckout(): UseCheckoutReturn;
854
913
  type ArrayElement$1<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
855
914
  type UseCmsBlockReturn = {
856
915
  /**
857
- * Cms block content
916
+ * Cms block content, as it was when the composable was called.
858
917
  */
859
918
  block: Schemas["CmsBlock"];
860
919
  /**
861
- * Get slot content by slot name (identifier)
920
+ * Get slot content by slot name (identifier).
921
+ *
922
+ * Reads the block on every call, so it follows a `ref` or getter passed as
923
+ * `content`.
924
+ *
925
+ * A block does not have to carry every slot its layout allows: the lookup
926
+ * returns `undefined` at runtime for a slot that is not there, which the
927
+ * return type does not express yet. Guard on the result.
862
928
  * @example getSlotContent("main")
863
929
  */
864
930
  getSlotContent(slotName: string): ArrayElement$1<Schemas["CmsBlock"]["slots"]>;
@@ -868,7 +934,7 @@ type UseCmsBlockReturn = {
868
934
  * @public
869
935
  * @category CMS (Shopping Experiences)
870
936
  */
871
- declare function useCmsBlock<BLOCK_TYPE extends Schemas["CmsBlock"]>(content: BLOCK_TYPE): UseCmsBlockReturn;
937
+ declare function useCmsBlock<BLOCK_TYPE extends Schemas["CmsBlock"]>(content: MaybeRefOrGetter<BLOCK_TYPE>): UseCmsBlockReturn;
872
938
 
873
939
  type UseCmsMetaReturn = {
874
940
  /**
@@ -892,11 +958,14 @@ declare function useCmsMeta(entity: Schemas["Category"] | Schemas["Product"] | S
892
958
  type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
893
959
  type UseCmsSectionType = {
894
960
  /**
895
- * CMS section
961
+ * CMS section, as it was when the composable was called.
896
962
  */
897
963
  section: Schemas["CmsSection"];
898
964
  /**
899
- * Position of the section
965
+ * Blocks of the section placed on the given position.
966
+ *
967
+ * Reads the section on every call, so it follows a `ref` or getter passed as
968
+ * `content`.
900
969
  */
901
970
  getPositionContent(position: ArrayElement<Schemas["CmsSection"]["blocks"]>["sectionPosition"]): Array<Schemas["CmsBlock"]>;
902
971
  };
@@ -905,7 +974,7 @@ type UseCmsSectionType = {
905
974
  * @public
906
975
  * @category CMS (Shopping Experiences)
907
976
  */
908
- declare function useCmsSection<SECTION_TYPE extends Schemas["CmsSection"]>(content: SECTION_TYPE): UseCmsSectionType;
977
+ declare function useCmsSection<SECTION_TYPE extends Schemas["CmsSection"]>(content: MaybeRefOrGetter<SECTION_TYPE>): UseCmsSectionType;
909
978
 
910
979
  /**
911
980
  * @category CMS (Shopping Experiences)
@@ -1138,7 +1207,7 @@ type UseListingReturn = {
1138
1207
  /**
1139
1208
  * Available sorting orders
1140
1209
  */
1141
- getSortingOrders: ComputedRef<Schemas["ProductSorting"][] | {
1210
+ getSortingOrders: ComputedRef<Schemas["ProductListingResult"]["availableSortings"] | {
1142
1211
  key: string;
1143
1212
  label: string;
1144
1213
  }[] | undefined>;
@@ -1424,6 +1493,15 @@ type UseNewsletterReturn = {
1424
1493
  declare function useNewsletter(): UseNewsletterReturn;
1425
1494
 
1426
1495
  type NotificationType = "info" | "warning" | "success" | "danger";
1496
+ /**
1497
+ * Optional CTA rendered next to a notification message (e.g. "View cart").
1498
+ *
1499
+ * @private
1500
+ */
1501
+ type NotificationAction = {
1502
+ label: string;
1503
+ to: string;
1504
+ };
1427
1505
  /**
1428
1506
  * @private
1429
1507
  */
@@ -1431,6 +1509,7 @@ type Notification = {
1431
1509
  type: NotificationType;
1432
1510
  message: string;
1433
1511
  id: number;
1512
+ action?: NotificationAction;
1434
1513
  };
1435
1514
  /**
1436
1515
  * @private
@@ -1442,6 +1521,7 @@ type NotificationOptions = {
1442
1521
  type?: NotificationType;
1443
1522
  timeout?: number;
1444
1523
  persistent?: boolean;
1524
+ action?: NotificationAction;
1445
1525
  };
1446
1526
  /**
1447
1527
  * @public
@@ -1841,7 +1921,7 @@ declare function useProductReviews(product: Ref<Schemas["Product"]>): UseProduct
1841
1921
  type UseProductSearchReturnOptions = {
1842
1922
  withCmsAssociations?: boolean;
1843
1923
  criteria?: Partial<Schemas["Criteria"]>;
1844
- associations?: Partial<Schemas["Association"]>;
1924
+ associations?: Partial<Schemas["Associations"]>;
1845
1925
  };
1846
1926
  type UseProductSearchReturn = {
1847
1927
  /**
@@ -2290,13 +2370,36 @@ declare function useWishlist(): UseWishlistReturn;
2290
2370
  type UseB2bQuoteManagement = {
2291
2371
  getQuoteList: () => Promise<Schemas["Quote"][]>;
2292
2372
  getQuote: (quoteId: string) => Promise<Schemas["Quote"]>;
2373
+ /**
2374
+ * @deprecated use `declineQuoteWithComment` instead — it sends the
2375
+ * `lineItemId` and `versionId` that `POST /quote/{id}/decline` expects.
2376
+ * A `comment`-only body is still accepted at runtime on 6.7.12+: the API
2377
+ * schema marks `lineItemId` and `versionId` as required, but the endpoint
2378
+ * does not validate the request body, so existing callers keep working.
2379
+ * Removed in v2.
2380
+ */
2293
2381
  declineQuote: (quoteId: string, comment: string) => Promise<void>;
2382
+ declineQuoteWithComment: (quoteId: string, params: DeclineQuoteParams) => Promise<void>;
2383
+ createDraftQuoteVersion: (quoteId: string) => Promise<string>;
2384
+ deleteDraftQuoteVersion: (quoteId: string, versionId: string) => Promise<void>;
2294
2385
  requestChangeQuote: (quoteId: string, comment: string) => Promise<void>;
2295
2386
  requestQuote: (comment: string) => Promise<Schemas["Quote"]>;
2296
2387
  createOrderFromQuote: (quoteId: string, comment: string) => Promise<Schemas["Order"]>;
2297
2388
  changeShippingMethod: (quoteId: string, shippingMethodId: string) => Promise<void>;
2298
2389
  changePaymentMethod: (quoteId: string, paymentMethodId: string) => Promise<void>;
2299
2390
  };
2391
+ type DeclineQuoteParams = {
2392
+ /** Message content */
2393
+ comment: string;
2394
+ /** Identifier of the quote line item that owns the new comment */
2395
+ lineItemId: string;
2396
+ /**
2397
+ * Draft version identifier of the quote currently shown in storefront,
2398
+ * as returned by `createDraftQuoteVersion`. This is not the `versionId`
2399
+ * property of the quote entity.
2400
+ */
2401
+ versionId: string;
2402
+ };
2300
2403
  type ChangePaymentShippingMethodParams = {
2301
2404
  quoteId: string;
2302
2405
  paymentMethodId?: string;
@@ -2308,7 +2411,8 @@ type ChangePaymentShippingMethodParams = {
2308
2411
  * With this composable you can:
2309
2412
  * - Get list of quotes
2310
2413
  * - Get quote details
2311
- * - Decline quote
2414
+ * - Create and delete a storefront draft version of the quote
2415
+ * - Decline quote, with or without a line item comment
2312
2416
  * - Request change of the quote
2313
2417
  * - Change shipping method
2314
2418
  * - Change payment method
@@ -2359,12 +2463,18 @@ declare function resolveCmsComponent(content: Schemas["CmsSection"] | Schemas["C
2359
2463
  componentNameToResolve: never;
2360
2464
  isResolved: boolean;
2361
2465
  resolvedComponent: vue.ConcreteComponent<{}, any, any, vue.ComputedOptions, vue.MethodOptions, {}, any> | undefined;
2466
+ /**
2467
+ * @deprecated Use `isResolved` instead. Kept so the error shape is unchanged.
2468
+ */
2362
2469
  resolved?: undefined;
2363
2470
  error?: undefined;
2364
2471
  } | {
2365
2472
  componentName: string;
2366
2473
  componentNameToResolve: never;
2367
2474
  resolvedComponent: undefined;
2475
+ /**
2476
+ * @deprecated Use `isResolved` instead. Kept so the error shape is unchanged.
2477
+ */
2368
2478
  resolved: boolean;
2369
2479
  isResolved: boolean;
2370
2480
  error: string;
@@ -2374,4 +2484,4 @@ declare function getDefaultApiParams(): {
2374
2484
  };
2375
2485
 
2376
2486
  export { createCategoryListingContext, createListingComposable, createShopwareContext, getDefaultApiParams, resolveCmsComponent, useAddToCart, useAddress, useB2bQuoteManagement, useBreadcrumbs, useCart, useCartErrorParamsResolver, useCartFunction, useCartItem, useCartNotification, 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 };
2377
- export type { BoxLayout, Breadcrumb, ChangePaymentShippingMethodParams, CmsBlockCategoryNavigation, CmsBlockCenterText, CmsBlockCrossSelling, CmsBlockForm, CmsBlockGalleryBuybox, CmsBlockHtml, CmsBlockImage, CmsBlockImageBubbleRow, CmsBlockImageCover, CmsBlockImageFourColumn, CmsBlockImageGallery, CmsBlockImageGalleryBig, CmsBlockImageHighlightRow, CmsBlockImageSimpleGrid, CmsBlockImageSlider, CmsBlockImageText, CmsBlockImageTextBubble, CmsBlockImageTextCover, CmsBlockImageTextGallery, CmsBlockImageTextRow, CmsBlockImageThreeColumn, CmsBlockImageThreeCover, CmsBlockImageTwoColumn, CmsBlockProductDescriptionReviews, CmsBlockProductHeading, CmsBlockProductListing, CmsBlockProductSlider, CmsBlockProductThreeColumn, CmsBlockSidebarFilter, CmsBlockText, CmsBlockTextHero, CmsBlockTextOnImage, CmsBlockTextTeaser, CmsBlockTextTeaserSection, CmsBlockTextThreeColumn, CmsBlockTextTwoColumn, CmsBlockVimeoVideo, CmsBlockYoutubeVideo, CmsElementBuyBox, CmsElementCategoryNavigation, CmsElementCrossSelling, CmsElementForm, CmsElementHtml, CmsElementImage, CmsElementImageGallery, CmsElementImageSlider, CmsElementManufacturerLogo, CmsElementProductBox, CmsElementProductDescriptionReviews, CmsElementProductListing, CmsElementProductName, CmsElementProductSlider, CmsElementSidebarFilter, CmsElementText, CmsElementVimeoVideo, CmsElementYoutubeVideo, CmsSectionBlock, CmsSectionDefault, CmsSectionSidebar, DisplayMode, ElementConfig, ErrorObjectParam, ImageContainerAttrs, ListingType, Notification, NotificationOptions, Position, RouteObject, ShopwareContext, ShortcutFilterParam, SliderElementConfig, SourceType, UseAddToCartReturn, UseAddressReturn, UseBreadcrumbsReturn, UseCartErrorParamsResolver, UseCartItemReturn, UseCartReturn, UseCategoryReturn, UseCategorySearchReturn, UseCheckoutReturn, UseCmsBlockReturn, UseCmsElementImage, UseCmsMetaReturn, UseCountriesReturn, UseCustomerOrdersReturn, UseCustomerPasswordReturn, UseInternationalizationReturn, UseLandingSearchReturn, UseListingReturn, UseLocalWishlistReturn, UseNavigationContextReturn, UseNavigationReturn, UseNavigationSearchReturn, UseNewsletterReturn, UseNotificationsReturn, UseOrderDetailsReturn, UseOrderPaymentReturn, UsePriceReturn, UseProductAssociationsReturn, UseProductConfiguratorReturn, UseProductPriceReturn, UseProductReturn, UseProductReviewsReturn, UseProductSearchReturn, UseProductSearchSuggestReturn, UseProductWishlistReturn, UseSalutationsReturn, UseSessionContextReturn, UseSyncWishlistReturn, UseUserReturn, UseWishlistReturn, VerticalAlign, useCartNotificationReturn };
2487
+ export type { BoxLayout, Breadcrumb, ChangePaymentShippingMethodParams, CmsBlockAppRenderer, CmsBlockCategoryHeading, CmsBlockCategoryNavigation, CmsBlockCenterText, CmsBlockCrossSelling, CmsBlockForm, CmsBlockGalleryBuybox, CmsBlockHtml, CmsBlockImage, CmsBlockImageBubbleRow, CmsBlockImageCover, CmsBlockImageFourColumn, CmsBlockImageGallery, CmsBlockImageGalleryBig, CmsBlockImageHighlightRow, CmsBlockImageSimpleGrid, CmsBlockImageSlider, CmsBlockImageText, CmsBlockImageTextBubble, CmsBlockImageTextCover, CmsBlockImageTextGallery, CmsBlockImageTextRow, CmsBlockImageThreeColumn, CmsBlockImageThreeCover, CmsBlockImageTwoColumn, CmsBlockProductDescriptionReviews, CmsBlockProductHeading, CmsBlockProductListing, CmsBlockProductSlider, CmsBlockProductThreeColumn, CmsBlockSidebarFilter, CmsBlockText, CmsBlockTextHero, CmsBlockTextOnImage, CmsBlockTextTeaser, CmsBlockTextTeaserSection, CmsBlockTextThreeColumn, CmsBlockTextTwoColumn, CmsBlockVideo, CmsBlockVimeoVideo, CmsBlockYoutubeVideo, CmsElementBuyBox, CmsElementCategoryName, CmsElementCategoryNavigation, CmsElementCrossSelling, CmsElementForm, CmsElementHtml, CmsElementImage, CmsElementImageGallery, CmsElementImageSlider, CmsElementManufacturerLogo, CmsElementProductBox, CmsElementProductDescriptionReviews, CmsElementProductListing, CmsElementProductName, CmsElementProductSlider, CmsElementSidebarFilter, CmsElementText, CmsElementVideo, CmsElementVimeoVideo, CmsElementYoutubeVideo, CmsSectionBlock, CmsSectionDefault, CmsSectionSidebar, DeclineQuoteParams, DisplayMode, ElementConfig, ErrorObjectParam, ImageContainerAttrs, ListingType, MediaDisplayMode, Notification, NotificationAction, NotificationOptions, Position, RouteObject, ShopwareContext, ShortcutFilterParam, SliderElementConfig, SourceType, UseAddToCartReturn, UseAddressReturn, UseBreadcrumbsReturn, UseCartErrorParamsResolver, UseCartItemReturn, UseCartReturn, UseCategoryReturn, UseCategorySearchReturn, UseCheckoutReturn, UseCmsBlockReturn, UseCmsElementImage, UseCmsMetaReturn, UseCountriesReturn, UseCustomerOrdersReturn, UseCustomerPasswordReturn, UseInternationalizationReturn, UseLandingSearchReturn, UseListingReturn, UseLocalWishlistReturn, UseNavigationContextReturn, UseNavigationReturn, UseNavigationSearchReturn, UseNewsletterReturn, UseNotificationsReturn, UseOrderDetailsReturn, UseOrderPaymentReturn, UsePriceReturn, UseProductAssociationsReturn, UseProductConfiguratorReturn, UseProductPriceReturn, UseProductReturn, UseProductReviewsReturn, UseProductSearchReturn, UseProductSearchSuggestReturn, UseProductWishlistReturn, UseSalutationsReturn, UseSessionContextReturn, UseSyncWishlistReturn, UseUserReturn, UseWishlistReturn, VerticalAlign, useCartNotificationReturn };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { pascalCase } from 'scule';
2
- import { computed, effectScope, reactive, markRaw, inject, ref, provide, unref, onMounted, watch, resolveComponent } from 'vue';
3
- import { urlIsAbsolute, relativeUrlSlash, getSrcSetForMedia, getMainImageUrl, getTranslatedProperty, getListingFilters, isTechnicalPath, normalizePath, getRouteFromPathInfo, getProductTierPrices, buildUrlPrefix } from '@shopware/helpers';
2
+ import { computed, toValue, effectScope, reactive, markRaw, inject, ref, provide, unref, onMounted, watch, resolveComponent } from 'vue';
3
+ import { urlIsAbsolute, relativeUrlSlash, getSrcSetForMedia, getTranslatedProperty, getMainImageUrl, getListingFilters, isTechnicalPath, normalizePath, getRouteFromPathInfo, getProductTierPrices, buildUrlPrefix } from '@shopware/helpers';
4
4
  import { ApiClientError } from '@shopware/api-client';
5
5
  import { createSharedComposable, injectLocal, provideLocal, createInjectionState, syncRefs } from '@vueuse/core';
6
6
  import { encodeForQuery } from '@shopware/api-client/helpers';
@@ -30,9 +30,13 @@ function useCmsElementImage(element) {
30
30
  }
31
31
  return attr;
32
32
  });
33
+ const ariaLabel = computed(
34
+ () => element.data?.ariaLabel || getConfigValue("ariaLabel") || ""
35
+ );
36
+ const isDecorative = computed(() => !!getConfigValue("isDecorative"));
33
37
  const imageAttrs = computed(() => ({
34
38
  src: element.data?.media?.url,
35
- alt: element.data?.media?.alt || "",
39
+ alt: isDecorative.value ? "" : getTranslatedProperty(element.data?.media, "alt"),
36
40
  srcset: getSrcSetForMedia(element.data?.media)
37
41
  }));
38
42
  const displayMode = computed(
@@ -50,6 +54,8 @@ function useCmsElementImage(element) {
50
54
  imageAttrs,
51
55
  imageContainerAttrs,
52
56
  imageLink,
57
+ ariaLabel,
58
+ isDecorative,
53
59
  displayMode,
54
60
  isVideoElement,
55
61
  mimeType
@@ -58,10 +64,11 @@ function useCmsElementImage(element) {
58
64
 
59
65
  function useCmsElementConfig(element) {
60
66
  const getConfigValue = (key) => {
61
- if (!element?.config) {
67
+ const config = toValue(element)?.config;
68
+ if (!config) {
62
69
  return void 0;
63
70
  }
64
- return element.config[key]?.source !== "mapped" && element.config[key]?.value;
71
+ return config[key]?.source !== "mapped" && config[key]?.value;
65
72
  };
66
73
  return {
67
74
  getConfigValue
@@ -527,7 +534,7 @@ const cmsAssociations = {
527
534
  function useCategorySearch() {
528
535
  const { apiClient, cacheableReads } = useShopwareContext();
529
536
  async function search(categoryId, options) {
530
- const associations = options?.withCmsAssociations ? cmsAssociations : {};
537
+ const associations = options?.withCmsAssociations ? cmsAssociations.associations : {};
531
538
  const criteria = {
532
539
  associations,
533
540
  ...options?.query
@@ -654,10 +661,12 @@ function useCheckout() {
654
661
 
655
662
  function useCmsBlock(content) {
656
663
  function getSlotContent(slotName) {
657
- return content.slots.find((slot) => slot.slot === slotName);
664
+ return toValue(content).slots.find(
665
+ (slot) => slot.slot === slotName
666
+ );
658
667
  }
659
668
  return {
660
- block: content,
669
+ block: toValue(content),
661
670
  getSlotContent
662
671
  };
663
672
  }
@@ -687,12 +696,12 @@ function useCmsMeta(entity) {
687
696
 
688
697
  function useCmsSection(content) {
689
698
  function getPositionContent(position) {
690
- return content.blocks.filter(
699
+ return toValue(content).blocks.filter(
691
700
  (block) => block.sectionPosition === position
692
701
  );
693
702
  }
694
703
  return {
695
- section: content,
704
+ section: toValue(content),
696
705
  getPositionContent
697
706
  };
698
707
  }
@@ -854,13 +863,27 @@ function useDefaultOrderAssociations() {
854
863
 
855
864
  function useInternationalization(pathResolver) {
856
865
  const { devStorefrontUrl, apiClient, cacheableReads } = useShopwareContext();
866
+ const { sessionContext } = useSessionContext();
857
867
  const _storeLanguages = useContext("swLanguages");
858
868
  const _storeCurrentLanguage = useContext(
859
869
  "swLanguagesCurrentLanguage"
860
870
  );
861
871
  const _storeCurrentPrefix = useContext("swLanguagesCurrentPrefix");
862
872
  function getStorefrontUrl() {
863
- return devStorefrontUrl ?? window.location.origin ?? "";
873
+ const preferred = devStorefrontUrl ?? window.location.origin ?? "";
874
+ const domains = sessionContext?.value?.salesChannel?.domains ?? [];
875
+ if (!domains.length) return preferred;
876
+ const normalizedPreferred = preferred.replace(/\/$/, "");
877
+ const matchingDomain = domains.find(
878
+ (domain) => domain.url?.replace(/\/$/, "") === normalizedPreferred
879
+ );
880
+ if (matchingDomain?.url) return matchingDomain.url;
881
+ const languageId = sessionContext?.value?.context?.languageIdChain?.[0] ?? sessionContext?.value?.salesChannel?.languageId;
882
+ const languageDomain = domains.find(
883
+ (domain) => domain.languageId === languageId && domain.url
884
+ );
885
+ if (languageDomain?.url) return languageDomain.url;
886
+ return domains.find((domain) => domain.url)?.url ?? preferred;
864
887
  }
865
888
  async function getAvailableLanguages() {
866
889
  const { data } = cacheableReads ? await apiClient.invoke("readLanguagesGet get /language") : await apiClient.invoke("readLanguages post /language");
@@ -1453,14 +1476,15 @@ function useNotifications() {
1453
1476
  return +`${(/* @__PURE__ */ new Date()).getTime()}${Math.random() * 1e3}`;
1454
1477
  }
1455
1478
  async function pushNotification(message, options) {
1456
- const timeout = options.timeout || 2500;
1479
+ const timeout = options.timeout || (options.action ? 5e3 : 2500);
1457
1480
  const persistent = !!options.persistent;
1458
1481
  _notifications.value = _notifications.value || [];
1459
1482
  const messageId = geterateId();
1460
1483
  _notifications.value.push({
1461
1484
  id: messageId,
1462
1485
  type: options.type,
1463
- message
1486
+ message,
1487
+ ...options.action ? { action: options.action } : {}
1464
1488
  });
1465
1489
  if (!persistent) {
1466
1490
  setTimeout(() => {
@@ -2407,6 +2431,7 @@ function useUser() {
2407
2431
  _user.value = data;
2408
2432
  }
2409
2433
  await refreshSessionContext();
2434
+ await refreshCart();
2410
2435
  return data;
2411
2436
  }
2412
2437
  async function logout() {
@@ -2605,31 +2630,64 @@ function useB2bQuoteManagement() {
2605
2630
  return response.data.elements ?? [];
2606
2631
  };
2607
2632
  const getQuote = async (quoteId) => {
2633
+ const response = await apiClient.invoke("readQuote post /quote/{id}", {
2634
+ pathParams: {
2635
+ id: quoteId
2636
+ },
2637
+ body: {
2638
+ associations: {
2639
+ lineItems: {},
2640
+ comments: {},
2641
+ stateMachineState: {}
2642
+ }
2643
+ }
2644
+ });
2645
+ return response.data;
2646
+ };
2647
+ async function createDraftQuoteVersion(quoteId) {
2608
2648
  const response = await apiClient.invoke(
2609
- "readQuote post /quote/detail/{id}",
2649
+ "createDraftQuoteVersion post /quote/{id}/draft-version",
2610
2650
  {
2611
2651
  pathParams: {
2612
2652
  id: quoteId
2613
- },
2614
- body: {
2615
- associations: {
2616
- lineItems: {},
2617
- comments: {},
2618
- stateMachineState: {}
2619
- }
2620
2653
  }
2621
2654
  }
2622
2655
  );
2623
- return response.data;
2624
- };
2656
+ if (!response.data.versionId) {
2657
+ throw new Error(
2658
+ `Could not create a draft version for quote "${quoteId}": the API returned no versionId.`
2659
+ );
2660
+ }
2661
+ return response.data.versionId;
2662
+ }
2663
+ async function deleteDraftQuoteVersion(quoteId, versionId) {
2664
+ await apiClient.invoke(
2665
+ "deleteDraftQuoteVersion delete /quote/{id}/draft-version",
2666
+ {
2667
+ pathParams: {
2668
+ id: quoteId
2669
+ },
2670
+ body: { versionId }
2671
+ }
2672
+ );
2673
+ }
2625
2674
  async function declineQuote(quoteId, comment) {
2626
2675
  await apiClient.invoke("declineQuote post /quote/{id}/decline", {
2627
2676
  pathParams: {
2628
2677
  id: quoteId
2629
2678
  },
2630
- body: {
2631
- comment
2632
- }
2679
+ // The 6.7.12 schema marks `lineItemId` and `versionId` as required, so a
2680
+ // comment-only body no longer matches the generated type. Sent as-is to
2681
+ // keep the pre-6.7.12 behaviour of this deprecated method unchanged.
2682
+ body: { comment }
2683
+ });
2684
+ }
2685
+ async function declineQuoteWithComment(quoteId, params) {
2686
+ await apiClient.invoke("declineQuote post /quote/{id}/decline", {
2687
+ pathParams: {
2688
+ id: quoteId
2689
+ },
2690
+ body: params
2633
2691
  });
2634
2692
  }
2635
2693
  async function requestChangeQuote(quoteId, comment) {
@@ -2671,7 +2729,7 @@ function useB2bQuoteManagement() {
2671
2729
  }
2672
2730
  const createOrderFromQuote = async (quoteId, comment) => {
2673
2731
  const response = await apiClient.invoke(
2674
- "createOrderFromQuote post /quote/order/{id}",
2732
+ "createOrderFromQuote post /quote/{id}/order",
2675
2733
  {
2676
2734
  pathParams: { id: quoteId },
2677
2735
  body: { customerComment: comment }
@@ -2683,6 +2741,9 @@ function useB2bQuoteManagement() {
2683
2741
  getQuoteList,
2684
2742
  getQuote,
2685
2743
  declineQuote,
2744
+ declineQuoteWithComment,
2745
+ createDraftQuoteVersion,
2746
+ deleteDraftQuoteVersion,
2686
2747
  requestChangeQuote,
2687
2748
  changeShippingMethod,
2688
2749
  changePaymentMethod,
@@ -2781,18 +2842,22 @@ function resolveCmsComponent(content) {
2781
2842
  const type = content.apiAlias === "cms_block" ? "Block" : content.apiAlias === "cms_section" ? "Section" : "Element";
2782
2843
  const componentNameToResolve = pascalCase(`Cms-${type}-${componentName}`);
2783
2844
  try {
2784
- const resolvedComponent = resolveComponent(componentNameToResolve);
2845
+ const component = resolveComponent(componentNameToResolve);
2846
+ const resolvedComponent = typeof component !== "string" ? component : void 0;
2785
2847
  return {
2786
2848
  componentName,
2787
2849
  componentNameToResolve,
2788
- isResolved: resolvedComponent !== componentName,
2789
- resolvedComponent: typeof resolvedComponent !== "string" ? resolvedComponent : void 0
2850
+ isResolved: resolvedComponent !== void 0,
2851
+ resolvedComponent
2790
2852
  };
2791
2853
  } catch (e) {
2792
2854
  return {
2793
2855
  componentName,
2794
2856
  componentNameToResolve,
2795
2857
  resolvedComponent: void 0,
2858
+ /**
2859
+ * @deprecated Use `isResolved` instead. Kept so the error shape is unchanged.
2860
+ */
2796
2861
  resolved: false,
2797
2862
  isResolved: false,
2798
2863
  error: e.message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/composables",
3
- "version": "1.12.1",
3
+ "version": "1.14.0",
4
4
  "description": "Shopware Frontends composables for Vue",
5
5
  "author": "Shopware",
6
6
  "repository": {
@@ -52,22 +52,23 @@
52
52
  "app.config.ts"
53
53
  ],
54
54
  "dependencies": {
55
- "@vueuse/core": "14.4.0",
55
+ "@vueuse/core": "15.0.0",
56
56
  "defu": "6.1.7",
57
57
  "scule": "1.3.0",
58
- "@shopware/helpers": "1.7.2",
59
- "@shopware/api-client": "1.5.1"
58
+ "@shopware/helpers": "1.8.0",
59
+ "@shopware/api-client": "1.7.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@nuxt/kit": "4.4.8",
62
+ "@nuxt/kit": "4.5.2",
63
63
  "@typescript/native-preview": "7.0.0-dev.20260205.1",
64
- "@vitest/coverage-v8": "4.1.10",
65
- "@vue/test-utils": "2.4.11",
66
- "happy-dom": "20.10.6",
64
+ "@vitest/coverage-v8": "5.0.0",
65
+ "@vue/test-utils": "2.5.1",
66
+ "happy-dom": "20.14.5",
67
+ "pathe": "2.0.3",
67
68
  "typescript": "5.9.3",
68
69
  "unbuild": "3.6.1",
69
- "vitest": "4.1.10",
70
- "vue": "3.5.39",
70
+ "vitest": "5.0.0",
71
+ "vue": "3.5.43",
71
72
  "tsconfig": "0.0.0"
72
73
  },
73
74
  "scripts": {