@shopware/composables 1.9.1 → 1.10.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/README.md +33 -5
- package/dist/index.d.mts +94 -28
- package/dist/index.d.ts +94 -28
- package/dist/index.mjs +95 -57
- package/package.json +10 -10
- package/src/cms/cmsAssociations.ts +5 -1
- package/src/cms/useCmsElementConfig.ts +1 -1
- package/src/types/cmsBlockTypes.ts +2 -0
- package/src/types/cmsElementTypes.ts +24 -18
- package/src/useCart/useCart.test.ts +12 -0
- package/src/useCart/useCart.ts +17 -0
- package/src/useCustomerOrders/useCustomerOrders.ts +1 -1
- package/src/useDefaultOrderAssociations/useDefaultOrderAssociations.test.ts +19 -21
- package/src/useDefaultOrderAssociations/useDefaultOrderAssociations.ts +23 -30
- package/src/useLandingSearch/useLandingSearch.test.ts +1 -1
- package/src/useLandingSearch/useLandingSearch.ts +1 -1
- package/src/useListing/useListing.test.ts +73 -0
- package/src/useListing/useListing.ts +10 -3
- package/src/useNewsletter/useNewsletter.ts +13 -0
- package/src/useOrderDetails/useOrderDetails.ts +5 -11
- package/src/useOrderPayment/useOrderPayment.ts +1 -0
- package/src/useProductWishlist/useProductWishlist.ts +2 -2
- package/src/useSessionContext/useSessionContext.ts +1 -1
- package/src/useSyncWishlist/useSyncWishlist.test.ts +34 -17
- package/src/useSyncWishlist/useSyncWishlist.ts +27 -8
- package/src/useUser/useUser.test.ts +126 -3
- package/src/useUser/useUser.ts +6 -1
- package/src/useWishlist/useWishlist.test.ts +9 -0
- package/src/useWishlist/useWishlist.ts +22 -6
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as vue from 'vue';
|
|
|
2
2
|
import { CSSProperties, ComputedRef, AnchorHTMLAttributes, ImgHTMLAttributes, App, EffectScope, Ref } from 'vue';
|
|
3
3
|
import { createAPIClient, ApiError } from '@shopware/api-client';
|
|
4
4
|
import { operations as operations$1, components } from '@shopware/api-client/store-api-types';
|
|
5
|
+
import * as _shopware_api_client_api_types from '@shopware/api-client/api-types';
|
|
5
6
|
import { getListingFilters, TierPrice } from '@shopware/helpers';
|
|
6
7
|
|
|
7
8
|
type operations = operations$1;
|
|
@@ -52,6 +53,7 @@ type CmsBlockProductDescriptionReviews = BlockType<"content">;
|
|
|
52
53
|
type CmsBlockCrossSelling = BlockType<"content">;
|
|
53
54
|
type CmsBlockForm = BlockType<"content">;
|
|
54
55
|
type CmsBlockHtml = BlockType<"content">;
|
|
56
|
+
type CmsBlockImageGalleryBig = BlockType<"imageGallery">;
|
|
55
57
|
|
|
56
58
|
type SourceType = "static" | "mapped";
|
|
57
59
|
type Position = "left" | "center" | "right";
|
|
@@ -72,7 +74,7 @@ type ElementFieldConfig = {
|
|
|
72
74
|
value: string | null;
|
|
73
75
|
apiAlias: string;
|
|
74
76
|
};
|
|
75
|
-
type CmsElementText = Schemas["CmsSlot"] & {
|
|
77
|
+
type CmsElementText = Omit<Schemas["CmsSlot"], "config"> & {
|
|
76
78
|
type: "text" | typeof String;
|
|
77
79
|
slot: typeof String;
|
|
78
80
|
config: TextElementConfig;
|
|
@@ -85,7 +87,7 @@ type CmsElementText = Schemas["CmsSlot"] & {
|
|
|
85
87
|
config: TextElementConfig;
|
|
86
88
|
};
|
|
87
89
|
};
|
|
88
|
-
type CmsElementHtml = Schemas["CmsSlot"] & {
|
|
90
|
+
type CmsElementHtml = Omit<Schemas["CmsSlot"], "config"> & {
|
|
89
91
|
type: "html";
|
|
90
92
|
data: {
|
|
91
93
|
content: string;
|
|
@@ -103,7 +105,7 @@ type ImageElementConfig = {
|
|
|
103
105
|
verticalAlign: ElementConfig<VerticalAlign>;
|
|
104
106
|
horizontalAlign: ElementConfig<VerticalAlign>;
|
|
105
107
|
};
|
|
106
|
-
type CmsElementImage = Schemas["CmsSlot"] & {
|
|
108
|
+
type CmsElementImage = Omit<Schemas["CmsSlot"], "config"> & {
|
|
107
109
|
type: "image";
|
|
108
110
|
config: ImageElementConfig;
|
|
109
111
|
data: {
|
|
@@ -130,7 +132,7 @@ type ImageSliderElementConfig = ImageElementConfig & SliderElementConfig & {
|
|
|
130
132
|
mediaUrl: string;
|
|
131
133
|
}>>;
|
|
132
134
|
};
|
|
133
|
-
type CmsElementImageSlider = Schemas["CmsSlot"] & {
|
|
135
|
+
type CmsElementImageSlider = Omit<Schemas["CmsSlot"], "config"> & {
|
|
134
136
|
type: "image-slider";
|
|
135
137
|
config: ImageSliderElementConfig;
|
|
136
138
|
data: {
|
|
@@ -152,7 +154,7 @@ type ImageGalleryElementConfig = ImageSliderElementConfig & {
|
|
|
152
154
|
fullScreen: ElementConfig<boolean>;
|
|
153
155
|
zoom: ElementConfig<boolean>;
|
|
154
156
|
};
|
|
155
|
-
type CmsElementImageGallery = Schemas["CmsSlot"] & {
|
|
157
|
+
type CmsElementImageGallery = Omit<Schemas["CmsSlot"], "config"> & {
|
|
156
158
|
type: "image-gallery";
|
|
157
159
|
config: ImageGalleryElementConfig;
|
|
158
160
|
data: {
|
|
@@ -179,7 +181,7 @@ type YouTubeVideoElementConfig = {
|
|
|
179
181
|
needsConfirmation: ElementConfig<boolean>;
|
|
180
182
|
advancedPrivacyMode: ElementConfig<boolean>;
|
|
181
183
|
};
|
|
182
|
-
type CmsElementYoutubeVideo = Schemas["CmsSlot"] & {
|
|
184
|
+
type CmsElementYoutubeVideo = Omit<Schemas["CmsSlot"], "config"> & {
|
|
183
185
|
type: "youtube-video";
|
|
184
186
|
config: YouTubeVideoElementConfig;
|
|
185
187
|
data: {
|
|
@@ -204,7 +206,7 @@ type VimeoVideoElementConfig = {
|
|
|
204
206
|
previewMedia: ElementConfig<string>;
|
|
205
207
|
needsConfirmation: ElementConfig<boolean>;
|
|
206
208
|
};
|
|
207
|
-
type CmsElementVimeoVideo = Schemas["CmsSlot"] & {
|
|
209
|
+
type CmsElementVimeoVideo = Omit<Schemas["CmsSlot"], "config"> & {
|
|
208
210
|
type: "vimeo-video";
|
|
209
211
|
config: VimeoVideoElementConfig;
|
|
210
212
|
data: {
|
|
@@ -219,7 +221,7 @@ type ProductBoxElementConfig = {
|
|
|
219
221
|
boxLayout: ElementConfig<BoxLayout>;
|
|
220
222
|
product: ElementConfig<string>;
|
|
221
223
|
};
|
|
222
|
-
type CmsElementProductBox = Schemas["CmsSlot"] & {
|
|
224
|
+
type CmsElementProductBox = Omit<Schemas["CmsSlot"], "config"> & {
|
|
223
225
|
type: "product-box";
|
|
224
226
|
config: ProductBoxElementConfig;
|
|
225
227
|
data: {
|
|
@@ -241,7 +243,7 @@ type ProductSliderElementConfig = {
|
|
|
241
243
|
productStream: ElementConfig<string>;
|
|
242
244
|
productStreamSorting: ElementConfig<string>;
|
|
243
245
|
};
|
|
244
|
-
type CmsElementProductSlider = Schemas["CmsSlot"] & {
|
|
246
|
+
type CmsElementProductSlider = Omit<Schemas["CmsSlot"], "config"> & {
|
|
245
247
|
type: "product-slider";
|
|
246
248
|
config: ProductSliderElementConfig;
|
|
247
249
|
data: {
|
|
@@ -259,7 +261,7 @@ type CmsSidebarFilterElementConfig = {
|
|
|
259
261
|
url: ElementConfig<string>;
|
|
260
262
|
verticalAlign: ElementConfig<VerticalAlign>;
|
|
261
263
|
};
|
|
262
|
-
type CmsElementSidebarFilter = Schemas["CmsSlot"] & {
|
|
264
|
+
type CmsElementSidebarFilter = Omit<Schemas["CmsSlot"], "config"> & {
|
|
263
265
|
type: "sidebar-filter";
|
|
264
266
|
config: CmsSidebarFilterElementConfig;
|
|
265
267
|
};
|
|
@@ -272,7 +274,7 @@ type CmsProductListingElementConfig = {
|
|
|
272
274
|
availableSortings: ElementConfig<string[]>;
|
|
273
275
|
propertyWhitelist: ElementConfig<string[]>;
|
|
274
276
|
};
|
|
275
|
-
type CmsElementProductListing = Schemas["CmsSlot"] & {
|
|
277
|
+
type CmsElementProductListing = Omit<Schemas["CmsSlot"], "config"> & {
|
|
276
278
|
type: "product-listing";
|
|
277
279
|
config: CmsProductListingElementConfig;
|
|
278
280
|
data: {
|
|
@@ -281,7 +283,7 @@ type CmsElementProductListing = Schemas["CmsSlot"] & {
|
|
|
281
283
|
};
|
|
282
284
|
};
|
|
283
285
|
type CategoryNavigationElementConfig = unknown;
|
|
284
|
-
type CmsElementCategoryNavigation = Schemas["CmsSlot"] & {
|
|
286
|
+
type CmsElementCategoryNavigation = Omit<Schemas["CmsSlot"], "config"> & {
|
|
285
287
|
type: "category-navigation";
|
|
286
288
|
config: CategoryNavigationElementConfig;
|
|
287
289
|
};
|
|
@@ -289,7 +291,7 @@ type ProductDescriptionReviewsElementConfig = {
|
|
|
289
291
|
product: ElementConfig<string>;
|
|
290
292
|
alignment: ElementConfig<VerticalAlign>;
|
|
291
293
|
};
|
|
292
|
-
type CmsElementProductDescriptionReviews = Schemas["CmsSlot"] & {
|
|
294
|
+
type CmsElementProductDescriptionReviews = Omit<Schemas["CmsSlot"], "config"> & {
|
|
293
295
|
type: "product-description-reviews";
|
|
294
296
|
config: ProductDescriptionReviewsElementConfig;
|
|
295
297
|
data: {
|
|
@@ -303,7 +305,7 @@ type CmsElementProductDescriptionReviews = Schemas["CmsSlot"] & {
|
|
|
303
305
|
};
|
|
304
306
|
};
|
|
305
307
|
type BuyBoxElementConfig = ProductDescriptionReviewsElementConfig;
|
|
306
|
-
type CmsElementBuyBox = Schemas["CmsSlot"] & {
|
|
308
|
+
type CmsElementBuyBox = Omit<Schemas["CmsSlot"], "config"> & {
|
|
307
309
|
type: "buy-box";
|
|
308
310
|
config: BuyBoxElementConfig;
|
|
309
311
|
data: {
|
|
@@ -322,7 +324,7 @@ type CrossSellingElementConfig = {
|
|
|
322
324
|
elMinWidth: ElementConfig<string>;
|
|
323
325
|
displayMode: ElementConfig<DisplayMode>;
|
|
324
326
|
};
|
|
325
|
-
type CmsElementCrossSelling = Schemas["CmsSlot"] & {
|
|
327
|
+
type CmsElementCrossSelling = Omit<Schemas["CmsSlot"], "config"> & {
|
|
326
328
|
type: "cross-selling";
|
|
327
329
|
config: CrossSellingElementConfig;
|
|
328
330
|
data: {
|
|
@@ -337,12 +339,12 @@ type FormElementConfig = {
|
|
|
337
339
|
confirmationText: ElementConfig<string>;
|
|
338
340
|
defaultMailReceiver: ElementConfig<boolean>;
|
|
339
341
|
};
|
|
340
|
-
type CmsElementForm = Schemas["CmsSlot"] & {
|
|
342
|
+
type CmsElementForm = Omit<Schemas["CmsSlot"], "config"> & {
|
|
341
343
|
type: "form";
|
|
342
344
|
config: FormElementConfig;
|
|
343
345
|
data: Schemas["Salutation"][];
|
|
344
346
|
};
|
|
345
|
-
type CmsElementProductName = Schemas["CmsSlot"] & {
|
|
347
|
+
type CmsElementProductName = Omit<Schemas["CmsSlot"], "config"> & {
|
|
346
348
|
type: "product-name";
|
|
347
349
|
config: TextElementConfig;
|
|
348
350
|
fieldConfig: ElementFieldConfig[];
|
|
@@ -354,7 +356,7 @@ type CmsElementProductName = Schemas["CmsSlot"] & {
|
|
|
354
356
|
config: TextElementConfig;
|
|
355
357
|
};
|
|
356
358
|
};
|
|
357
|
-
type CmsElementManufacturerLogo = Schemas["CmsSlot"] & {
|
|
359
|
+
type CmsElementManufacturerLogo = Omit<Schemas["CmsSlot"], "config"> & {
|
|
358
360
|
type: "manufacturer-logo";
|
|
359
361
|
config: ImageElementConfig;
|
|
360
362
|
data: {
|
|
@@ -405,7 +407,7 @@ declare function useCmsElementImage(element: CmsElementImage | CmsElementManufac
|
|
|
405
407
|
*
|
|
406
408
|
* @category CMS (Shopping Experiences)
|
|
407
409
|
*/
|
|
408
|
-
declare function useCmsElementConfig<T extends Schemas["CmsSlot"] & {
|
|
410
|
+
declare function useCmsElementConfig<T extends Omit<Schemas["CmsSlot"], "config"> & {
|
|
409
411
|
config: T["config"] extends {
|
|
410
412
|
[key in infer X extends keyof T["config"]]: ElementConfig<unknown>;
|
|
411
413
|
} ? {
|
|
@@ -623,6 +625,10 @@ type UseCartReturn = {
|
|
|
623
625
|
* Removes the provided LineItem from the cart
|
|
624
626
|
*/
|
|
625
627
|
removeItem(lineItem: Schemas["LineItem"]): Promise<Schemas["Cart"]>;
|
|
628
|
+
/**
|
|
629
|
+
* Removes the item with the provided id from the cart
|
|
630
|
+
*/
|
|
631
|
+
removeItemById(id: string): Promise<Schemas["Cart"]>;
|
|
626
632
|
/**
|
|
627
633
|
* The total price of the cart (including calculated costs like shipping)
|
|
628
634
|
*/
|
|
@@ -981,15 +987,12 @@ type UseCustomerPasswordReturn = {
|
|
|
981
987
|
*/
|
|
982
988
|
declare function useCustomerPassword(): UseCustomerPasswordReturn;
|
|
983
989
|
|
|
984
|
-
type UseDefaultOrderAssociationsReturn = Schemas["Criteria"] & {
|
|
985
|
-
checkPromotion?: boolean;
|
|
986
|
-
};
|
|
987
990
|
/**
|
|
988
991
|
* Returns default order associations. You can override this composable in your project.
|
|
989
992
|
* @public
|
|
990
993
|
* @category Order
|
|
991
994
|
*/
|
|
992
|
-
declare function useDefaultOrderAssociations():
|
|
995
|
+
declare function useDefaultOrderAssociations(): Schemas["Criteria"]["associations"];
|
|
993
996
|
|
|
994
997
|
type UseInternationalizationReturn = {
|
|
995
998
|
/**
|
|
@@ -1205,8 +1208,42 @@ declare function useListing(params?: {
|
|
|
1205
1208
|
listingType: ListingType;
|
|
1206
1209
|
categoryId?: string;
|
|
1207
1210
|
defaultSearchCriteria?: operations["searchPage post /search"]["body"];
|
|
1211
|
+
initialListing?: Schemas["ProductListingResult"] | null;
|
|
1208
1212
|
}): UseListingReturn;
|
|
1209
|
-
declare const createCategoryListingContext: (
|
|
1213
|
+
declare const createCategoryListingContext: (initialListing?: ({
|
|
1214
|
+
aggregations?: _shopware_api_client_api_types.GenericRecord[];
|
|
1215
|
+
entity?: string;
|
|
1216
|
+
limit?: number;
|
|
1217
|
+
page?: number;
|
|
1218
|
+
total?: number;
|
|
1219
|
+
} & {
|
|
1220
|
+
apiAlias: "product_listing";
|
|
1221
|
+
availableSortings: {
|
|
1222
|
+
apiAlias: "product_sorting";
|
|
1223
|
+
key: string;
|
|
1224
|
+
label: string;
|
|
1225
|
+
priority: number;
|
|
1226
|
+
translated: {
|
|
1227
|
+
key: string;
|
|
1228
|
+
label: string;
|
|
1229
|
+
};
|
|
1230
|
+
}[];
|
|
1231
|
+
currentFilters: {
|
|
1232
|
+
manufacturer: string[];
|
|
1233
|
+
navigationId: string;
|
|
1234
|
+
price: {
|
|
1235
|
+
max: number;
|
|
1236
|
+
min: number;
|
|
1237
|
+
};
|
|
1238
|
+
properties: string[];
|
|
1239
|
+
rating: number | null;
|
|
1240
|
+
search?: string;
|
|
1241
|
+
"shipping-free": boolean;
|
|
1242
|
+
};
|
|
1243
|
+
elements: _shopware_api_client_api_types.components["schemas"]["Product"][];
|
|
1244
|
+
entity?: "product";
|
|
1245
|
+
sorting?: string;
|
|
1246
|
+
}) | null | undefined) => UseListingReturn;
|
|
1210
1247
|
/**
|
|
1211
1248
|
* Temporary workaround over `useListing` to support shared data. This composable API will change in the future.
|
|
1212
1249
|
*
|
|
@@ -1225,10 +1262,11 @@ declare const useProductSearchListing: () => UseListingReturn;
|
|
|
1225
1262
|
*
|
|
1226
1263
|
* @public
|
|
1227
1264
|
*/
|
|
1228
|
-
declare function createListingComposable({ searchMethod, searchDefaults, listingKey, }: {
|
|
1265
|
+
declare function createListingComposable({ searchMethod, searchDefaults, listingKey, initialListing, }: {
|
|
1229
1266
|
searchMethod(searchParams: operations["readProductListing post /product-listing/{categoryId}"]["body"] | operations["searchPage post /search"]["body"]): Promise<Schemas["ProductListingResult"]>;
|
|
1230
1267
|
searchDefaults: operations["searchPage post /search"]["body"];
|
|
1231
1268
|
listingKey: string;
|
|
1269
|
+
initialListing?: Schemas["ProductListingResult"] | null;
|
|
1232
1270
|
}): UseListingReturn;
|
|
1233
1271
|
|
|
1234
1272
|
type UseLocalWishlistReturn = {
|
|
@@ -1360,6 +1398,14 @@ type UseNewsletterReturn = {
|
|
|
1360
1398
|
* Inform about newsletter confirmation
|
|
1361
1399
|
*/
|
|
1362
1400
|
confirmationNeeded: ComputedRef<boolean>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Subscribe key
|
|
1403
|
+
*/
|
|
1404
|
+
SUBSRIBE_KEY: string;
|
|
1405
|
+
/**
|
|
1406
|
+
* Unsubscribe key
|
|
1407
|
+
*/
|
|
1408
|
+
UNSUBSCRIBE_KEY: string;
|
|
1363
1409
|
};
|
|
1364
1410
|
/**
|
|
1365
1411
|
* Composable for newsletter subscription.
|
|
@@ -1844,7 +1890,7 @@ type UseProductWishlistReturn = {
|
|
|
1844
1890
|
/**
|
|
1845
1891
|
* Indicates whether a product is in wishlist
|
|
1846
1892
|
*/
|
|
1847
|
-
isInWishlist:
|
|
1893
|
+
isInWishlist: ComputedRef<boolean>;
|
|
1848
1894
|
};
|
|
1849
1895
|
/**
|
|
1850
1896
|
* Manage wishlist for a single product.
|
|
@@ -1959,7 +2005,7 @@ type UseSessionContextReturn = {
|
|
|
1959
2005
|
/**
|
|
1960
2006
|
* current context's customer object
|
|
1961
2007
|
*/
|
|
1962
|
-
userFromContext: ComputedRef<Schemas["Customer"] | undefined>;
|
|
2008
|
+
userFromContext: ComputedRef<Schemas["Customer"] | undefined | null>;
|
|
1963
2009
|
};
|
|
1964
2010
|
/**
|
|
1965
2011
|
* Composable for session management.
|
|
@@ -2016,6 +2062,18 @@ type UseSyncWishlistReturn = {
|
|
|
2016
2062
|
* Current page number
|
|
2017
2063
|
*/
|
|
2018
2064
|
currentPage: ComputedRef<number>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Limit number of products per page
|
|
2067
|
+
*/
|
|
2068
|
+
limit: ComputedRef<number>;
|
|
2069
|
+
/**
|
|
2070
|
+
* Wishlist products
|
|
2071
|
+
*/
|
|
2072
|
+
products: ComputedRef<Schemas["Product"][]>;
|
|
2073
|
+
/**
|
|
2074
|
+
* Indicates if the wishlist is loading
|
|
2075
|
+
*/
|
|
2076
|
+
isLoading: Ref<boolean>;
|
|
2019
2077
|
};
|
|
2020
2078
|
/**
|
|
2021
2079
|
* Composable to manage wishlist via API
|
|
@@ -2167,6 +2225,14 @@ type UseWishlistReturn = {
|
|
|
2167
2225
|
* Indicates if the wishlist can be synced
|
|
2168
2226
|
*/
|
|
2169
2227
|
canSyncWishlist: ComputedRef<boolean>;
|
|
2228
|
+
/**
|
|
2229
|
+
* Wishlist products
|
|
2230
|
+
*/
|
|
2231
|
+
products: ComputedRef<Schemas["Product"][]>;
|
|
2232
|
+
/**
|
|
2233
|
+
* Limit number of products per page
|
|
2234
|
+
*/
|
|
2235
|
+
limit: ComputedRef<number>;
|
|
2170
2236
|
};
|
|
2171
2237
|
/**
|
|
2172
2238
|
* Composable to manage wishlist
|
|
@@ -2261,4 +2327,4 @@ declare function getDefaultApiParams(): {
|
|
|
2261
2327
|
[composableName: string]: unknown;
|
|
2262
2328
|
};
|
|
2263
2329
|
|
|
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
|
|
2330
|
+
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 CmsBlockImageGalleryBig, 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 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
|
@@ -292,6 +292,17 @@ function useCartFunction() {
|
|
|
292
292
|
setCartErrors(data);
|
|
293
293
|
return data;
|
|
294
294
|
}
|
|
295
|
+
async function removeItemById(id) {
|
|
296
|
+
const { data } = await apiClient.invoke(
|
|
297
|
+
"removeLineItem post /checkout/cart/line-item/delete",
|
|
298
|
+
{
|
|
299
|
+
body: { ids: [id] }
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
_storeCart.value = data;
|
|
303
|
+
setCartErrors(data);
|
|
304
|
+
return data;
|
|
305
|
+
}
|
|
295
306
|
async function changeProductQuantity(params) {
|
|
296
307
|
const { data } = await apiClient.invoke(
|
|
297
308
|
"updateLineItem patch /checkout/cart/line-item",
|
|
@@ -388,6 +399,7 @@ function useCartFunction() {
|
|
|
388
399
|
count,
|
|
389
400
|
refreshCart,
|
|
390
401
|
removeItem,
|
|
402
|
+
removeItemById,
|
|
391
403
|
totalPrice,
|
|
392
404
|
shippingTotal,
|
|
393
405
|
subtotal,
|
|
@@ -475,7 +487,11 @@ function useCategory(category) {
|
|
|
475
487
|
|
|
476
488
|
const cmsAssociations = {
|
|
477
489
|
associations: {
|
|
478
|
-
media: {
|
|
490
|
+
media: {
|
|
491
|
+
associations: {
|
|
492
|
+
media: {}
|
|
493
|
+
}
|
|
494
|
+
},
|
|
479
495
|
cmsPage: {
|
|
480
496
|
associations: {
|
|
481
497
|
sections: {
|
|
@@ -786,31 +802,29 @@ function useCustomerPassword() {
|
|
|
786
802
|
|
|
787
803
|
function useDefaultOrderAssociations() {
|
|
788
804
|
const orderAssociations = {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
media: {}
|
|
797
|
-
}
|
|
805
|
+
stateMachineState: {},
|
|
806
|
+
lineItems: {
|
|
807
|
+
associations: {
|
|
808
|
+
cover: {},
|
|
809
|
+
downloads: {
|
|
810
|
+
associations: {
|
|
811
|
+
media: {}
|
|
798
812
|
}
|
|
799
813
|
}
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
addresses: {},
|
|
817
|
+
deliveries: {
|
|
818
|
+
associations: {
|
|
819
|
+
shippingMethod: {},
|
|
820
|
+
shippingOrderAddress: {},
|
|
821
|
+
stateMachineState: {}
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
transactions: {
|
|
825
|
+
associations: {
|
|
826
|
+
paymentMethod: {},
|
|
827
|
+
stateMachineState: {}
|
|
814
828
|
}
|
|
815
829
|
}
|
|
816
830
|
};
|
|
@@ -880,7 +894,7 @@ function useInternationalization(pathResolver) {
|
|
|
880
894
|
function useLandingSearch() {
|
|
881
895
|
const { apiClient } = useShopwareContext();
|
|
882
896
|
const search = async (navigationId, options) => {
|
|
883
|
-
const associations = options?.withCmsAssociations ? cmsAssociations : {};
|
|
897
|
+
const associations = options?.withCmsAssociations ? cmsAssociations.associations : {};
|
|
884
898
|
const result = await apiClient.invoke(
|
|
885
899
|
"readLandingPage post /landing-page/{landingPageId}",
|
|
886
900
|
{
|
|
@@ -960,13 +974,17 @@ function useListing(params) {
|
|
|
960
974
|
return createListingComposable({
|
|
961
975
|
listingKey: listingType,
|
|
962
976
|
searchMethod,
|
|
963
|
-
searchDefaults: params?.defaultSearchCriteria || {}
|
|
977
|
+
searchDefaults: params?.defaultSearchCriteria || {},
|
|
964
978
|
//getDefaults(),
|
|
979
|
+
initialListing: params?.initialListing
|
|
965
980
|
});
|
|
966
981
|
}
|
|
967
982
|
const [_createCategoryListingContext, _categoryListingContext] = createInjectionState(
|
|
968
|
-
() => {
|
|
969
|
-
return useListing({
|
|
983
|
+
(initialListing) => {
|
|
984
|
+
return useListing({
|
|
985
|
+
listingType: "categoryListing",
|
|
986
|
+
initialListing
|
|
987
|
+
});
|
|
970
988
|
},
|
|
971
989
|
{
|
|
972
990
|
injectionKey: "categoryListing"
|
|
@@ -988,17 +1006,18 @@ const useProductSearchListing = createSharedComposable(
|
|
|
988
1006
|
function createListingComposable({
|
|
989
1007
|
searchMethod,
|
|
990
1008
|
searchDefaults,
|
|
991
|
-
listingKey
|
|
1009
|
+
listingKey,
|
|
1010
|
+
initialListing
|
|
992
1011
|
}) {
|
|
993
1012
|
const loading = ref(false);
|
|
994
1013
|
const loadingMore = ref(false);
|
|
995
|
-
const _storeInitialListing = inject(`useListingInitial-${listingKey}`, ref(null));
|
|
1014
|
+
const _storeInitialListing = inject(`useListingInitial-${listingKey}`, ref(initialListing ?? null));
|
|
996
1015
|
provide(`useListingInitial-${listingKey}`, _storeInitialListing);
|
|
997
1016
|
const _storeAppliedListing = inject(`useListingApplied-${listingKey}`, ref(null));
|
|
998
1017
|
provide(`useListingApplied-${listingKey}`, _storeAppliedListing);
|
|
999
1018
|
const getInitialListing = computed(() => _storeInitialListing.value);
|
|
1000
|
-
const setInitialListing = async (
|
|
1001
|
-
_storeInitialListing.value =
|
|
1019
|
+
const setInitialListing = async (initialListing2) => {
|
|
1020
|
+
_storeInitialListing.value = initialListing2;
|
|
1002
1021
|
_storeAppliedListing.value = null;
|
|
1003
1022
|
};
|
|
1004
1023
|
const initSearch = async (criteria) => {
|
|
@@ -1317,6 +1336,8 @@ function useNavigationSearch() {
|
|
|
1317
1336
|
}
|
|
1318
1337
|
|
|
1319
1338
|
function useNewsletter() {
|
|
1339
|
+
const SUBSRIBE_KEY = "subscribe";
|
|
1340
|
+
const UNSUBSCRIBE_KEY = "unsubscribe";
|
|
1320
1341
|
const { apiClient } = useShopwareContext();
|
|
1321
1342
|
const { getStorefrontUrl } = useInternationalization();
|
|
1322
1343
|
const newsletterStatus = ref("undefined");
|
|
@@ -1359,7 +1380,9 @@ function useNewsletter() {
|
|
|
1359
1380
|
isNewsletterSubscriber,
|
|
1360
1381
|
getNewsletterStatus,
|
|
1361
1382
|
newsletterStatus,
|
|
1362
|
-
confirmationNeeded
|
|
1383
|
+
confirmationNeeded,
|
|
1384
|
+
SUBSRIBE_KEY,
|
|
1385
|
+
UNSUBSCRIBE_KEY
|
|
1363
1386
|
};
|
|
1364
1387
|
}
|
|
1365
1388
|
|
|
@@ -1453,14 +1476,8 @@ function useOrderDetails(orderId, associations) {
|
|
|
1453
1476
|
associations ? associations : {}
|
|
1454
1477
|
);
|
|
1455
1478
|
const params = {
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
type: "equals",
|
|
1459
|
-
field: "id",
|
|
1460
|
-
value: orderId
|
|
1461
|
-
}
|
|
1462
|
-
],
|
|
1463
|
-
associations: mergedAssociations.associations,
|
|
1479
|
+
ids: [orderId],
|
|
1480
|
+
associations: mergedAssociations,
|
|
1464
1481
|
checkPromotion: true
|
|
1465
1482
|
};
|
|
1466
1483
|
const orderDetailsResponse = await apiClient.invoke(
|
|
@@ -1585,7 +1602,10 @@ function useOrderPayment(order) {
|
|
|
1585
1602
|
const paymentUrl = ref();
|
|
1586
1603
|
const state = computed(() => activeTransaction.value?.stateMachineState);
|
|
1587
1604
|
const isAsynchronous = computed(
|
|
1588
|
-
() =>
|
|
1605
|
+
() => (
|
|
1606
|
+
// @ts-expect-error TODO: [MAJOR] Removed since 6.7
|
|
1607
|
+
activeTransaction.value?.paymentMethod?.asynchronous && activeTransaction.value?.paymentMethod?.afterOrderEnabled
|
|
1608
|
+
)
|
|
1589
1609
|
);
|
|
1590
1610
|
async function handlePayment(finishUrl, errorUrl) {
|
|
1591
1611
|
if (!order.value) {
|
|
@@ -2171,8 +2191,11 @@ function useShopwareContext() {
|
|
|
2171
2191
|
}
|
|
2172
2192
|
|
|
2173
2193
|
const _wishlistItems = ref([]);
|
|
2194
|
+
const _wishlistProducts = ref([]);
|
|
2174
2195
|
const _currentPage = ref(1);
|
|
2196
|
+
const _limit = ref(15);
|
|
2175
2197
|
const totalWishlistItemsCount = ref(0);
|
|
2198
|
+
const isLoading = ref(false);
|
|
2176
2199
|
function useSyncWishlist() {
|
|
2177
2200
|
const { apiClient } = useShopwareContext();
|
|
2178
2201
|
async function addToWishlistSync(id) {
|
|
@@ -2200,13 +2223,15 @@ function useSyncWishlist() {
|
|
|
2200
2223
|
_wishlistItems.value = [
|
|
2201
2224
|
...response.data.products.elements.map((element) => element.id)
|
|
2202
2225
|
];
|
|
2226
|
+
_wishlistProducts.value = response.data.products.elements;
|
|
2203
2227
|
totalWishlistItemsCount.value = response.data.products.total ?? 0;
|
|
2204
2228
|
_currentPage.value = response.data.products.page ?? 1;
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2229
|
+
_limit.value = response.data.products.limit ?? 15;
|
|
2230
|
+
} catch (error) {
|
|
2231
|
+
console.error("[useSyncWishlist][getWishlistProducts][error]:", error);
|
|
2232
|
+
_wishlistItems.value = [];
|
|
2233
|
+
_wishlistProducts.value = [];
|
|
2234
|
+
totalWishlistItemsCount.value = 0;
|
|
2210
2235
|
}
|
|
2211
2236
|
}
|
|
2212
2237
|
async function mergeWishlistProducts(productIds) {
|
|
@@ -2220,14 +2245,19 @@ function useSyncWishlist() {
|
|
|
2220
2245
|
const items = computed(() => _wishlistItems.value);
|
|
2221
2246
|
const count = computed(() => totalWishlistItemsCount.value);
|
|
2222
2247
|
const currentPage = computed(() => _currentPage.value);
|
|
2248
|
+
const products = computed(() => _wishlistProducts.value);
|
|
2249
|
+
const limit = computed(() => _limit.value);
|
|
2223
2250
|
return {
|
|
2224
2251
|
getWishlistProducts,
|
|
2225
2252
|
addToWishlistSync,
|
|
2226
2253
|
removeFromWishlistSync,
|
|
2227
2254
|
mergeWishlistProducts,
|
|
2255
|
+
products,
|
|
2228
2256
|
items,
|
|
2229
2257
|
count,
|
|
2230
|
-
currentPage
|
|
2258
|
+
currentPage,
|
|
2259
|
+
isLoading,
|
|
2260
|
+
limit
|
|
2231
2261
|
};
|
|
2232
2262
|
}
|
|
2233
2263
|
|
|
@@ -2263,7 +2293,8 @@ function useUser() {
|
|
|
2263
2293
|
const { getStorefrontUrl } = useInternationalization();
|
|
2264
2294
|
const { refreshCart } = useCart();
|
|
2265
2295
|
const userDefaultPaymentMethod = computed(
|
|
2266
|
-
() => user.value?.
|
|
2296
|
+
() => user.value?.lastPaymentMethod?.translated || // @ts-expect-error TODO: [MAJOR] Removed since 6.7
|
|
2297
|
+
user.value?.defaultPaymentMethod?.translated || null
|
|
2267
2298
|
);
|
|
2268
2299
|
const userDefaultBillingAddress = computed(
|
|
2269
2300
|
() => user.value?.defaultBillingAddress || null
|
|
@@ -2366,6 +2397,7 @@ function useUser() {
|
|
|
2366
2397
|
}
|
|
2367
2398
|
async function setDefaultPaymentMethod(paymentMethodId) {
|
|
2368
2399
|
await apiClient.invoke(
|
|
2400
|
+
// @ts-expect-error TODO: [MAJOR] Removed since 6.7
|
|
2369
2401
|
"changePaymentMethod post /account/change-payment-method/{paymentMethodId}",
|
|
2370
2402
|
{
|
|
2371
2403
|
pathParams: { paymentMethodId }
|
|
@@ -2425,19 +2457,23 @@ function useWishlist() {
|
|
|
2425
2457
|
mergeWishlistProducts: mergeWishlistProductsSync,
|
|
2426
2458
|
removeFromWishlistSync,
|
|
2427
2459
|
count: countSync,
|
|
2428
|
-
currentPage
|
|
2460
|
+
currentPage,
|
|
2461
|
+
products,
|
|
2462
|
+
limit: limitSync
|
|
2429
2463
|
} = useSyncWishlist();
|
|
2430
2464
|
const limit = ref(15);
|
|
2431
2465
|
const getWishlistProducts = async (query) => {
|
|
2432
|
-
|
|
2466
|
+
let wishlistQuery = {
|
|
2467
|
+
limit: limit.value
|
|
2468
|
+
};
|
|
2433
2469
|
if (query) {
|
|
2434
|
-
defu(
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2470
|
+
wishlistQuery = defu(query, wishlistQuery);
|
|
2471
|
+
if (query.limit) {
|
|
2472
|
+
limit.value = query.limit;
|
|
2473
|
+
}
|
|
2438
2474
|
}
|
|
2439
2475
|
if (canSyncWishlist.value) {
|
|
2440
|
-
await getWishlistProductsSync(
|
|
2476
|
+
await getWishlistProductsSync(wishlistQuery);
|
|
2441
2477
|
} else {
|
|
2442
2478
|
getWishlistProductsLocal();
|
|
2443
2479
|
}
|
|
@@ -2475,7 +2511,9 @@ function useWishlist() {
|
|
|
2475
2511
|
currentPage,
|
|
2476
2512
|
totalPagesCount,
|
|
2477
2513
|
count,
|
|
2478
|
-
canSyncWishlist
|
|
2514
|
+
canSyncWishlist,
|
|
2515
|
+
products,
|
|
2516
|
+
limit: limitSync
|
|
2479
2517
|
};
|
|
2480
2518
|
}
|
|
2481
2519
|
|