@scayle/storefront-core 8.32.1 → 8.33.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/CHANGELOG.md +72 -58
- package/dist/rpc/methods/checkout/checkout.mjs +1 -1
- package/dist/test/factories/index.d.ts +1 -0
- package/dist/test/factories/index.mjs +1 -0
- package/dist/test/factories/order.d.ts +8 -0
- package/dist/test/factories/order.mjs +362 -0
- package/dist/types/sapi/order.d.ts +9 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 8.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added test factories for order and all related types.
|
|
8
|
+
|
|
9
|
+
It is now possible to build orders with factory functions for testing purposes.
|
|
10
|
+
This will reduce the amount of boilerplate code needed to create test data.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependency `@scayle/storefront-api@18.9.0` to `@scayle/storefront-api@workspace:*`
|
|
15
|
+
- Updated dependency `@scayle/unstorage-scayle-kv-driver@1.0.2` to `@scayle/unstorage-scayle-kv-driver@workspace:*`
|
|
16
|
+
|
|
3
17
|
## 8.32.1
|
|
4
18
|
|
|
5
19
|
## 8.32.0
|
|
@@ -19,23 +33,23 @@
|
|
|
19
33
|
- Added `minReduction` and `maxReduction` filter parameters to `FetchProductsByCategoryParams.where` and `FetchFiltersParams.where` types, and updated the `getProductsByCategory` and `getFilters` RPC methods to accept and handle these new reduction-based filtering conditions.
|
|
20
34
|
|
|
21
35
|
```ts
|
|
22
|
-
const { data } = useRpc(
|
|
36
|
+
const { data } = useRpc('getFilters', 'getFiltersKey', () => ({
|
|
23
37
|
where: {
|
|
24
38
|
minReduction: 10,
|
|
25
39
|
maxReduction: 20,
|
|
26
40
|
},
|
|
27
|
-
}))
|
|
41
|
+
}))
|
|
28
42
|
|
|
29
43
|
const { data } = useRpc(
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
'getProductsByCategory',
|
|
45
|
+
'getProductsByCategoryKey',
|
|
32
46
|
() => ({
|
|
33
47
|
where: {
|
|
34
48
|
minReduction: 10,
|
|
35
49
|
maxReduction: 20,
|
|
36
50
|
},
|
|
37
51
|
}),
|
|
38
|
-
)
|
|
52
|
+
)
|
|
39
53
|
```
|
|
40
54
|
|
|
41
55
|
## 8.30.3
|
|
@@ -66,28 +80,28 @@ No changes in this release.
|
|
|
66
80
|
|
|
67
81
|
```ts
|
|
68
82
|
export const existingHandlerWithoutParams = async (_context: RpcContext) => {
|
|
69
|
-
return
|
|
70
|
-
}
|
|
83
|
+
return 'existing handler'
|
|
84
|
+
}
|
|
71
85
|
|
|
72
86
|
export const existingHandlerWithParams = async (
|
|
73
87
|
{ name }: { name: string },
|
|
74
88
|
_context: RpcContext,
|
|
75
89
|
) => {
|
|
76
|
-
return name
|
|
77
|
-
}
|
|
90
|
+
return name
|
|
91
|
+
}
|
|
78
92
|
|
|
79
93
|
// will become
|
|
80
94
|
|
|
81
95
|
export const existingHandlerWithoutParams = defineRpcHandler(
|
|
82
96
|
async (_context: RpcContext) => {
|
|
83
|
-
return
|
|
97
|
+
return 'existing handler'
|
|
84
98
|
},
|
|
85
|
-
)
|
|
99
|
+
)
|
|
86
100
|
export const existingHandlerWithParams = defineRpcHandler(
|
|
87
101
|
async ({ name }: { name: string }, _context: RpcContext) => {
|
|
88
|
-
return name
|
|
102
|
+
return name
|
|
89
103
|
},
|
|
90
|
-
)
|
|
104
|
+
)
|
|
91
105
|
```
|
|
92
106
|
|
|
93
107
|
### Patch Changes
|
|
@@ -104,15 +118,15 @@ No changes in this release.
|
|
|
104
118
|
- Added an optional `hideEmptyCategories` parameter to `getCategoryTree`. When enabled, the product count for each category is retrieved, and categories (including their children) without any products are removed. Enabling this option may increase response times, especially for large category trees.
|
|
105
119
|
|
|
106
120
|
```ts
|
|
107
|
-
import { rpcMethods } from
|
|
121
|
+
import { rpcMethods } from '@scayle/storefront-core'
|
|
108
122
|
|
|
109
|
-
rpcMethods.getCategoryTree({ hideEmptyCategories: true }, rpcContext)
|
|
123
|
+
rpcMethods.getCategoryTree({ hideEmptyCategories: true }, rpcContext)
|
|
110
124
|
```
|
|
111
125
|
|
|
112
126
|
or
|
|
113
127
|
|
|
114
128
|
```ts
|
|
115
|
-
import { useCategoryTree } from
|
|
129
|
+
import { useCategoryTree } from '#storefront/composables'
|
|
116
130
|
|
|
117
131
|
const { data: rootCategories, status } = useCategoryTree(
|
|
118
132
|
{
|
|
@@ -120,8 +134,8 @@ No changes in this release.
|
|
|
120
134
|
hideEmptyCategories: true,
|
|
121
135
|
},
|
|
122
136
|
},
|
|
123
|
-
|
|
124
|
-
)
|
|
137
|
+
'category-navigation-tree',
|
|
138
|
+
)
|
|
125
139
|
```
|
|
126
140
|
|
|
127
141
|
### Patch Changes
|
|
@@ -553,12 +567,12 @@ To get the default campaign key, you can call the RPC method:
|
|
|
553
567
|
```typescript
|
|
554
568
|
// Before
|
|
555
569
|
async function rpcMethod(context) {
|
|
556
|
-
const campaignKey = { context }
|
|
570
|
+
const campaignKey = { context }
|
|
557
571
|
// ...
|
|
558
572
|
}
|
|
559
573
|
// After
|
|
560
574
|
async function rpcMethod(context) {
|
|
561
|
-
const campaignKey = await context.callRpc?.(
|
|
575
|
+
const campaignKey = await context.callRpc?.('getCampaignKey')
|
|
562
576
|
// ...
|
|
563
577
|
}
|
|
564
578
|
```
|
|
@@ -747,43 +761,43 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
747
761
|
|
|
748
762
|
```ts
|
|
749
763
|
const BadgeLabel = {
|
|
750
|
-
NEW:
|
|
751
|
-
SOLD_OUT:
|
|
752
|
-
ONLINE_EXCLUSIVE:
|
|
753
|
-
SUSTAINABLE:
|
|
754
|
-
PREMIUM:
|
|
755
|
-
DEFAULT:
|
|
756
|
-
} as const
|
|
764
|
+
NEW: 'new',
|
|
765
|
+
SOLD_OUT: 'sold_out',
|
|
766
|
+
ONLINE_EXCLUSIVE: 'online_exclusive',
|
|
767
|
+
SUSTAINABLE: 'sustainable',
|
|
768
|
+
PREMIUM: 'premium',
|
|
769
|
+
DEFAULT: '',
|
|
770
|
+
} as const
|
|
757
771
|
|
|
758
772
|
type BadgeLabelParamsKeys =
|
|
759
|
-
|
|
|
760
|
-
|
|
|
761
|
-
|
|
|
762
|
-
|
|
|
763
|
-
|
|
|
764
|
-
type BadgeLabelParams = Partial<Record<BadgeLabelParamsKeys, boolean
|
|
773
|
+
| 'isNew'
|
|
774
|
+
| 'isSoldOut'
|
|
775
|
+
| 'isOnlineOnly'
|
|
776
|
+
| 'isSustainable'
|
|
777
|
+
| 'isPremium'
|
|
778
|
+
type BadgeLabelParams = Partial<Record<BadgeLabelParamsKeys, boolean>>
|
|
765
779
|
|
|
766
780
|
const getBadgeLabel = (params: BadgeLabelParams = {}): string => {
|
|
767
781
|
if (!params) {
|
|
768
|
-
return BadgeLabel.DEFAULT
|
|
782
|
+
return BadgeLabel.DEFAULT
|
|
769
783
|
}
|
|
770
784
|
const { isNew, isSoldOut, isOnlineOnly, isSustainable, isPremium } =
|
|
771
|
-
params
|
|
785
|
+
params
|
|
772
786
|
|
|
773
787
|
if (isNew) {
|
|
774
|
-
return BadgeLabel.NEW
|
|
788
|
+
return BadgeLabel.NEW
|
|
775
789
|
} else if (isSoldOut) {
|
|
776
|
-
return BadgeLabel.SOLD_OUT
|
|
790
|
+
return BadgeLabel.SOLD_OUT
|
|
777
791
|
} else if (isOnlineOnly) {
|
|
778
|
-
return BadgeLabel.ONLINE_EXCLUSIVE
|
|
792
|
+
return BadgeLabel.ONLINE_EXCLUSIVE
|
|
779
793
|
} else if (isSustainable) {
|
|
780
|
-
return BadgeLabel.SUSTAINABLE
|
|
794
|
+
return BadgeLabel.SUSTAINABLE
|
|
781
795
|
} else if (isPremium) {
|
|
782
|
-
return BadgeLabel.PREMIUM
|
|
796
|
+
return BadgeLabel.PREMIUM
|
|
783
797
|
} else {
|
|
784
|
-
return BadgeLabel.DEFAULT
|
|
798
|
+
return BadgeLabel.DEFAULT
|
|
785
799
|
}
|
|
786
|
-
}
|
|
800
|
+
}
|
|
787
801
|
```
|
|
788
802
|
|
|
789
803
|
- **\[💥 BREAKING\]** We've standardized our configuration to use `sapi` (Storefront API) throughout the codebase, replacing the deprecated `bapi` keyword. This change improves clarity and consistency by removing the `initBapi` function, replacing the `bapiClient` property with `sapiClient` within the `RPCContext`, and updating all code references accordingly. `BapiConfig` is not exported anymore and has been superseded by `SapiConfig`.
|
|
@@ -799,15 +813,15 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
799
813
|
storefront: {
|
|
800
814
|
// ...
|
|
801
815
|
bapi: {
|
|
802
|
-
host:
|
|
803
|
-
token:
|
|
816
|
+
host: '...',
|
|
817
|
+
token: '...',
|
|
804
818
|
},
|
|
805
819
|
// ...
|
|
806
820
|
},
|
|
807
821
|
// ...
|
|
808
822
|
},
|
|
809
823
|
// ...
|
|
810
|
-
}
|
|
824
|
+
}
|
|
811
825
|
```
|
|
812
826
|
|
|
813
827
|
- _Legacy Environment Variables:_
|
|
@@ -827,15 +841,15 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
827
841
|
storefront: {
|
|
828
842
|
// ...
|
|
829
843
|
sapi: {
|
|
830
|
-
host:
|
|
831
|
-
token:
|
|
844
|
+
host: '...',
|
|
845
|
+
token: '...',
|
|
832
846
|
},
|
|
833
847
|
// ...
|
|
834
848
|
},
|
|
835
849
|
// ...
|
|
836
850
|
},
|
|
837
851
|
// ...
|
|
838
|
-
}
|
|
852
|
+
}
|
|
839
853
|
```
|
|
840
854
|
|
|
841
855
|
- _New Environment Variables:_
|
|
@@ -853,19 +867,19 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
853
867
|
|
|
854
868
|
```ts
|
|
855
869
|
const { data, fetching, fetch, error, status } = useUser(
|
|
856
|
-
|
|
870
|
+
'getUser',
|
|
857
871
|
// ...
|
|
858
|
-
)
|
|
859
|
-
data.value.user.authentication.storefrontAccessToken
|
|
872
|
+
)
|
|
873
|
+
data.value.user.authentication.storefrontAccessToken
|
|
860
874
|
```
|
|
861
875
|
|
|
862
876
|
- _Current Usage of dedicated `getAccessToken` RPC method:_
|
|
863
877
|
|
|
864
878
|
```ts
|
|
865
879
|
const { data: accessToken } = useRpc(
|
|
866
|
-
|
|
880
|
+
'getAccessToken',
|
|
867
881
|
// ...
|
|
868
|
-
)
|
|
882
|
+
)
|
|
869
883
|
```
|
|
870
884
|
|
|
871
885
|
- **\[💥 BREAKING\]** We've enhanced security for basket and wishlist keys by switching the default hashing algorithm from MD5 to the more robust SHA256.
|
|
@@ -888,7 +902,7 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
888
902
|
// ...
|
|
889
903
|
},
|
|
890
904
|
// ...
|
|
891
|
-
})
|
|
905
|
+
})
|
|
892
906
|
```
|
|
893
907
|
|
|
894
908
|
- **\[💥 BREAKING\]** The attribute `loginShopId` is removed from the `ShopUser` interface as the shop now uses session cookies.
|
|
@@ -897,23 +911,23 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
897
911
|
- _Previous Usage of `searchProducts` RPC method:_
|
|
898
912
|
|
|
899
913
|
```ts
|
|
900
|
-
const getSearchSuggestionsRpc = useRpcCall(
|
|
914
|
+
const getSearchSuggestionsRpc = useRpcCall('searchProducts')
|
|
901
915
|
|
|
902
916
|
data.value = await searchProducts({
|
|
903
917
|
term: String(searchQuery.value),
|
|
904
918
|
...params,
|
|
905
|
-
})
|
|
919
|
+
})
|
|
906
920
|
```
|
|
907
921
|
|
|
908
922
|
- _Current Usage of `getSearchSuggestions` RPC method:_
|
|
909
923
|
|
|
910
924
|
```ts
|
|
911
|
-
const getSearchSuggestionsRpc = useRpcCall(
|
|
925
|
+
const getSearchSuggestionsRpc = useRpcCall('getSearchSuggestions')
|
|
912
926
|
|
|
913
927
|
data.value = await getSearchSuggestionsRpc({
|
|
914
928
|
term: String(searchQuery.value),
|
|
915
929
|
...params,
|
|
916
|
-
})
|
|
930
|
+
})
|
|
917
931
|
```
|
|
918
932
|
|
|
919
933
|
- **\[💥 BREAKING\]** Improved basket updating: Adding an item to your basket with a reduced quantity will now correctly update the basket contents.
|
|
@@ -36,7 +36,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
|
|
|
36
36
|
carrier,
|
|
37
37
|
basketId: context.basketKey,
|
|
38
38
|
campaignKey
|
|
39
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.
|
|
39
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"8.33.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
|
|
40
40
|
return {
|
|
41
41
|
accessToken: refreshedAccessToken,
|
|
42
42
|
checkoutJwt
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Factory } from 'fishery';
|
|
2
|
+
import type { Order, OrderItem, OrderAdvancedAttribute, OrderCategory } from '../../types/sapi/order';
|
|
3
|
+
export declare const orderCategoryFactory: Factory<OrderCategory>;
|
|
4
|
+
export declare const orderAdvancedAttributeFactory: Factory<OrderAdvancedAttribute>;
|
|
5
|
+
export declare const orderProductFactory: Factory<Record<string, unknown>>;
|
|
6
|
+
export declare const orderVariantFactory: Factory<Record<string, unknown>>;
|
|
7
|
+
export declare const orderItemFactory: Factory<OrderItem<Record<string, unknown>, Record<string, unknown>>>;
|
|
8
|
+
export declare const orderFactory: Factory<Order<Record<string, unknown>, Record<string, unknown>>>;
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { Factory } from "fishery";
|
|
2
|
+
import {
|
|
3
|
+
attributeGroupMultiFactory,
|
|
4
|
+
attributeGroupSingleFactory
|
|
5
|
+
} from "@scayle/storefront-api/dist/test/factories";
|
|
6
|
+
export const orderCategoryFactory = Factory.define(() => ({
|
|
7
|
+
categoryId: 1,
|
|
8
|
+
categoryName: "Frauen",
|
|
9
|
+
categoryHidden: false,
|
|
10
|
+
categoryUrl: "/frauen",
|
|
11
|
+
categorySlug: "frauen"
|
|
12
|
+
}));
|
|
13
|
+
export const orderAdvancedAttributeFactory = Factory.define(() => ({
|
|
14
|
+
key: "orderAttribute",
|
|
15
|
+
label: "Order advanced attribute",
|
|
16
|
+
values: [
|
|
17
|
+
{
|
|
18
|
+
fieldSet: [
|
|
19
|
+
[
|
|
20
|
+
{
|
|
21
|
+
value: "Order"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
],
|
|
25
|
+
groupSet: [
|
|
26
|
+
{
|
|
27
|
+
fieldSet: [
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
value: "Attribute value"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
],
|
|
34
|
+
groupSet: []
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}));
|
|
40
|
+
export const orderProductFactory = Factory.define(() => ({
|
|
41
|
+
id: 1,
|
|
42
|
+
advancedAttributes: {
|
|
43
|
+
advColor: orderAdvancedAttributeFactory.build({ key: "advColor" }),
|
|
44
|
+
productName: orderAdvancedAttributeFactory.build({
|
|
45
|
+
key: "productName"
|
|
46
|
+
})
|
|
47
|
+
},
|
|
48
|
+
attributes: {
|
|
49
|
+
brand: attributeGroupSingleFactory.build({ key: "brand" }),
|
|
50
|
+
brandLogo: attributeGroupSingleFactory.build({ key: "brandLogo" }),
|
|
51
|
+
category: attributeGroupMultiFactory.build({ key: "category" }),
|
|
52
|
+
color: attributeGroupSingleFactory.build({ key: "color" }),
|
|
53
|
+
colorHex: attributeGroupSingleFactory.build({ key: "colorHex" }),
|
|
54
|
+
name: attributeGroupSingleFactory.build({ key: "name" }),
|
|
55
|
+
description: attributeGroupSingleFactory.build({
|
|
56
|
+
key: "description"
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
categories: [[orderCategoryFactory.build({ categoryId: 1 })]],
|
|
60
|
+
images: [
|
|
61
|
+
{
|
|
62
|
+
hash: "9f6c628a98106dcce2bc5a4ac1de9c14"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
masterKey: "480306626-1",
|
|
66
|
+
name: "Chelsea Boots",
|
|
67
|
+
createdAt: "2018-01-20T09:30:15+00:00",
|
|
68
|
+
updatedAt: "2018-01-20T09:30:15+00:00"
|
|
69
|
+
}));
|
|
70
|
+
export const orderVariantFactory = Factory.define(() => ({
|
|
71
|
+
id: 1,
|
|
72
|
+
attributes: {
|
|
73
|
+
size: attributeGroupSingleFactory.build({ key: "size" })
|
|
74
|
+
},
|
|
75
|
+
images: [
|
|
76
|
+
{
|
|
77
|
+
hash: "9f6c628a98106dcce2bc5a4ac1de9c14"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
referenceKey: "563843898",
|
|
81
|
+
stock: {
|
|
82
|
+
warehouseId: 1,
|
|
83
|
+
isSellableWithoutStock: false,
|
|
84
|
+
quantity: 18,
|
|
85
|
+
supplierId: 271
|
|
86
|
+
},
|
|
87
|
+
createdAt: "2018-01-20T09:30:15+00:00",
|
|
88
|
+
updatedAt: "2018-01-20T09:30:15+00:00",
|
|
89
|
+
lowestPriorPrice: {
|
|
90
|
+
withTax: 23,
|
|
91
|
+
relativeDifferenceToPrice: 24
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
export const orderItemFactory = Factory.define(
|
|
95
|
+
() => ({
|
|
96
|
+
id: "1234",
|
|
97
|
+
availableQuantity: 20,
|
|
98
|
+
customData: {
|
|
99
|
+
key: "value"
|
|
100
|
+
},
|
|
101
|
+
deliveryForecast: {
|
|
102
|
+
subsequentDelivery: {
|
|
103
|
+
key: "christmas"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
key: "ac834d23e689u678",
|
|
107
|
+
packageId: 1,
|
|
108
|
+
price: {
|
|
109
|
+
appliedReductions: [
|
|
110
|
+
{
|
|
111
|
+
amount: {
|
|
112
|
+
absoluteWithTax: 100,
|
|
113
|
+
relative: 0.5
|
|
114
|
+
},
|
|
115
|
+
category: "sale",
|
|
116
|
+
type: "relative"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
reference: {
|
|
120
|
+
size: "100",
|
|
121
|
+
unit: "ml",
|
|
122
|
+
withTax: 595
|
|
123
|
+
},
|
|
124
|
+
tax: {
|
|
125
|
+
vat: {
|
|
126
|
+
amount: 190,
|
|
127
|
+
rate: 0.19
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
undiscountedWithOutTax: 1e3,
|
|
131
|
+
undiscountedWithTax: 1190,
|
|
132
|
+
withoutTax: 1e3,
|
|
133
|
+
withTax: 1190
|
|
134
|
+
},
|
|
135
|
+
product: orderProductFactory.build(),
|
|
136
|
+
variant: orderVariantFactory.build(),
|
|
137
|
+
reservationKey: "6nq69bzzkd5xufxliwg8",
|
|
138
|
+
status: "available",
|
|
139
|
+
createdAt: "2018-01-20T09:30:15+00:00",
|
|
140
|
+
updatedAt: "2018-01-20T09:30:15+00:00"
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
export const orderFactory = Factory.define(
|
|
144
|
+
() => ({
|
|
145
|
+
id: 1,
|
|
146
|
+
detailedStatus: {
|
|
147
|
+
order: {
|
|
148
|
+
code: "order_open",
|
|
149
|
+
name: "Order open"
|
|
150
|
+
},
|
|
151
|
+
shipping: {
|
|
152
|
+
code: "shipping_open",
|
|
153
|
+
name: "Shipping open"
|
|
154
|
+
},
|
|
155
|
+
billing: {
|
|
156
|
+
code: "billing_open",
|
|
157
|
+
name: "Billing open"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
address: {
|
|
161
|
+
billing: {
|
|
162
|
+
id: 998,
|
|
163
|
+
additional: "c/o SCAYLE",
|
|
164
|
+
city: "Hamburg",
|
|
165
|
+
countryCode: "DEU",
|
|
166
|
+
houseNumber: "12",
|
|
167
|
+
isDefault: {
|
|
168
|
+
billing: false,
|
|
169
|
+
shipping: false
|
|
170
|
+
},
|
|
171
|
+
recipient: {
|
|
172
|
+
firstName: "Anna",
|
|
173
|
+
gender: "m",
|
|
174
|
+
lastName: "Fischer",
|
|
175
|
+
type: "personal"
|
|
176
|
+
},
|
|
177
|
+
referenceKey: "InGidcPDmL8fGkv02a3sSAgAr7ySMBfa66iw4MriYgUNI3Boq369rBOZW3stlKLWSqIjB2dXCGNbCxoM5Xww4cI8cULUoGBFJHH0",
|
|
178
|
+
street: "Wolfgangsweg",
|
|
179
|
+
zipCode: "20459",
|
|
180
|
+
createdAt: "2018-11-29T05:20:13+01:00",
|
|
181
|
+
updatedAt: "2018-11-29T05:20:13+01:00"
|
|
182
|
+
},
|
|
183
|
+
forward: {
|
|
184
|
+
additional: "c/o SCAYLE",
|
|
185
|
+
city: "Hamburg",
|
|
186
|
+
countryCode: "DEU",
|
|
187
|
+
houseNumber: "12",
|
|
188
|
+
recipient: {
|
|
189
|
+
firstName: "Anna",
|
|
190
|
+
gender: "m",
|
|
191
|
+
lastName: "Fischer",
|
|
192
|
+
type: "personal"
|
|
193
|
+
},
|
|
194
|
+
street: "Wolfgangsweg",
|
|
195
|
+
zipCode: "20459",
|
|
196
|
+
createdAt: "2018-11-29T05:20:13+01:00",
|
|
197
|
+
updatedAt: "2018-11-29T05:20:13+01:00"
|
|
198
|
+
},
|
|
199
|
+
shipping: {
|
|
200
|
+
id: 998,
|
|
201
|
+
city: "Hamburg",
|
|
202
|
+
collectionPoint: {
|
|
203
|
+
customerKey: "bced-234-234",
|
|
204
|
+
description: "Pedro's Kiosk",
|
|
205
|
+
key: "12345-a",
|
|
206
|
+
type: "hermes_parcelshop"
|
|
207
|
+
},
|
|
208
|
+
countryCode: "DEU",
|
|
209
|
+
houseNumber: "10",
|
|
210
|
+
isDefault: {
|
|
211
|
+
billing: false,
|
|
212
|
+
shipping: true
|
|
213
|
+
},
|
|
214
|
+
recipient: {
|
|
215
|
+
firstName: "Anna",
|
|
216
|
+
gender: "m",
|
|
217
|
+
lastName: "Fischer",
|
|
218
|
+
type: "personal"
|
|
219
|
+
},
|
|
220
|
+
referenceKey: "InGidcPDmL8fGkv02a3sSAgAr7ySMBfa66iw4MriYgUNI3Boq369rBOZW3stlKLWSqIjB2dXCGNbCxoM5Xww4cI8cULUoGBFJHH0",
|
|
221
|
+
street: "Domstrasse",
|
|
222
|
+
zipCode: "20459",
|
|
223
|
+
createdAt: "2018-11-29T05:20:13+01:00",
|
|
224
|
+
updatedAt: "2018-11-29T05:20:13+01:00"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
basketKey: "basket-c6v7k4eer1",
|
|
228
|
+
confirmedAt: "2018-01-20T11:30:15+00:00",
|
|
229
|
+
cost: {
|
|
230
|
+
appliedFees: [
|
|
231
|
+
{
|
|
232
|
+
amount: {
|
|
233
|
+
withoutTax: 168,
|
|
234
|
+
withTax: 200
|
|
235
|
+
},
|
|
236
|
+
category: "delivery",
|
|
237
|
+
key: "hermes",
|
|
238
|
+
option: "express"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
amount: {
|
|
242
|
+
withoutTax: 168,
|
|
243
|
+
withTax: 200
|
|
244
|
+
},
|
|
245
|
+
category: "payment",
|
|
246
|
+
key: "computop_creditcard"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
amount: {
|
|
250
|
+
withoutTax: 168,
|
|
251
|
+
withTax: 200
|
|
252
|
+
},
|
|
253
|
+
category: "payment",
|
|
254
|
+
key: "computop_creditcard",
|
|
255
|
+
option: "paybreak"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
appliedReductions: [
|
|
259
|
+
{
|
|
260
|
+
amount: {
|
|
261
|
+
absoluteWithTax: 100,
|
|
262
|
+
relative: 0.5
|
|
263
|
+
},
|
|
264
|
+
category: "voucher",
|
|
265
|
+
type: "absolute"
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
tax: {},
|
|
269
|
+
withoutTax: 1168,
|
|
270
|
+
withTax: 1390
|
|
271
|
+
},
|
|
272
|
+
currencyCode: "EUR",
|
|
273
|
+
customData: {
|
|
274
|
+
score: {
|
|
275
|
+
generatedOn: "2018-05-20T19:45:15+00:00",
|
|
276
|
+
result: "green"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
customer: {
|
|
280
|
+
id: 9876,
|
|
281
|
+
authentication: {
|
|
282
|
+
type: "password"
|
|
283
|
+
},
|
|
284
|
+
birthDate: "1981-02-02",
|
|
285
|
+
customData: {
|
|
286
|
+
score: {
|
|
287
|
+
generatedOn: "2018-05-20T19:45:15+00:00",
|
|
288
|
+
result: "green"
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
email: "anna.fischer@scayle.com",
|
|
292
|
+
firstName: "Anna",
|
|
293
|
+
gender: "f",
|
|
294
|
+
groups: ["employee"],
|
|
295
|
+
lastName: "Fischer",
|
|
296
|
+
phone: "0049/1234567890",
|
|
297
|
+
publicKey: "666",
|
|
298
|
+
referenceKey: "InGidcPDmL8fGkv02a3sSAgAr7ySMBfa66iw4MriYgUNI3Boq369rBOZW3stlKLWSqIjB2dXCGNbCxoM5Xww4cI8cULUoGBFJHH0",
|
|
299
|
+
status: {
|
|
300
|
+
isActive: true,
|
|
301
|
+
isGuestCustomer: false,
|
|
302
|
+
isTestCustomer: false
|
|
303
|
+
},
|
|
304
|
+
title: "Prof.",
|
|
305
|
+
type: "personal",
|
|
306
|
+
createdAt: "2018-01-20T09:30:15+00:00",
|
|
307
|
+
updatedAt: "2018-01-20T09:30:15+00:00"
|
|
308
|
+
},
|
|
309
|
+
invoicedAt: "2018-01-22T11:30:15+00:00",
|
|
310
|
+
items: [orderItemFactory.build()],
|
|
311
|
+
packages: [
|
|
312
|
+
{
|
|
313
|
+
id: 1,
|
|
314
|
+
carrierKey: "dhl",
|
|
315
|
+
deliveryDate: {
|
|
316
|
+
maximum: "2018-02-05",
|
|
317
|
+
minimum: "2018-02-02"
|
|
318
|
+
},
|
|
319
|
+
deliveryStatus: "open",
|
|
320
|
+
shipmentKey: "shpmnt-123"
|
|
321
|
+
}
|
|
322
|
+
],
|
|
323
|
+
payment: [
|
|
324
|
+
{
|
|
325
|
+
amount: 1190,
|
|
326
|
+
data: {
|
|
327
|
+
CCBrand: "VISA",
|
|
328
|
+
CCExpiry: "202005",
|
|
329
|
+
IPCity: "charlottenburg",
|
|
330
|
+
IPLatitude: "52.5151",
|
|
331
|
+
IPLongitude: "13.3053",
|
|
332
|
+
IPState: "berlin",
|
|
333
|
+
IPZone: "276",
|
|
334
|
+
IPZoneA2: "de"
|
|
335
|
+
},
|
|
336
|
+
key: "computop_creditcard",
|
|
337
|
+
transactionKey: "creditcard-abcde"
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
publicKey: "666",
|
|
341
|
+
referenceKey: "InGidcPDmL8fGkv02a3sSAgAr7ySMBfa66iw4MriYgUNI3Boq369rBOZW3stlKLWSqIjB2dXCGNbCxoM5Xww4cI8cULUoGBFJHH0",
|
|
342
|
+
shipping: {
|
|
343
|
+
policy: "least_packages"
|
|
344
|
+
},
|
|
345
|
+
shop: {
|
|
346
|
+
id: 139,
|
|
347
|
+
country: "DEU",
|
|
348
|
+
language: "de"
|
|
349
|
+
},
|
|
350
|
+
status: "invoice_completed",
|
|
351
|
+
vouchers: [
|
|
352
|
+
{
|
|
353
|
+
id: 198234,
|
|
354
|
+
code: "fashion2020",
|
|
355
|
+
type: "absolute",
|
|
356
|
+
value: 1e3
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
createdAt: "2018-01-20T09:30:15+00:00",
|
|
360
|
+
updatedAt: "2018-01-20T09:30:15+00:00"
|
|
361
|
+
})
|
|
362
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Gender } from '../user';
|
|
2
|
-
import type { CentAmount } from './product';
|
|
2
|
+
import type { AdvancedAttribute, CentAmount } from './product';
|
|
3
3
|
/**
|
|
4
4
|
* Items are grouped by package, depending on the item's supplier configuration. The `packageId` references an entry in the packages list with delivery estimates and expected carrier.
|
|
5
5
|
*/
|
|
@@ -445,3 +445,11 @@ export interface Order<Product = Record<string, unknown>, Variant = Record<strin
|
|
|
445
445
|
createdAt: string;
|
|
446
446
|
updatedAt: string;
|
|
447
447
|
}
|
|
448
|
+
export type OrderAdvancedAttribute = Omit<AdvancedAttribute, 'id' | 'type'>;
|
|
449
|
+
export interface OrderCategory {
|
|
450
|
+
categoryHidden: boolean;
|
|
451
|
+
categoryId: number;
|
|
452
|
+
categoryName: string;
|
|
453
|
+
categorySlug: string;
|
|
454
|
+
categoryUrl: string;
|
|
455
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.33.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,32 +49,32 @@
|
|
|
49
49
|
"fishery": "^2.2.3"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@scayle/storefront-api": "18.9.0",
|
|
53
|
-
"@scayle/unstorage-scayle-kv-driver": "1.0.2",
|
|
54
52
|
"crypto-js": "^4.2.0",
|
|
55
53
|
"hookable": "^5.5.3",
|
|
56
54
|
"jose": "^6.0.8",
|
|
57
55
|
"slugify": "^1.6.6",
|
|
58
56
|
"ufo": "^1.5.3",
|
|
59
57
|
"uncrypto": "^0.1.3",
|
|
60
|
-
"utility-types": "^3.11.0"
|
|
58
|
+
"utility-types": "^3.11.0",
|
|
59
|
+
"@scayle/storefront-api": "18.9.0",
|
|
60
|
+
"@scayle/unstorage-scayle-kv-driver": "1.0.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@scayle/eslint-config-storefront": "4.5.12",
|
|
64
63
|
"@types/crypto-js": "4.2.2",
|
|
65
|
-
"@types/node": "22.
|
|
64
|
+
"@types/node": "22.16.0",
|
|
66
65
|
"@types/webpack-env": "1.18.8",
|
|
67
66
|
"@vitest/coverage-v8": "3.2.4",
|
|
68
67
|
"dprint": "0.50.1",
|
|
69
68
|
"eslint-formatter-gitlab": "6.0.1",
|
|
70
|
-
"eslint": "9.30.
|
|
69
|
+
"eslint": "9.30.1",
|
|
71
70
|
"fishery": "2.3.1",
|
|
72
71
|
"publint": "0.3.12",
|
|
73
72
|
"rimraf": "6.0.1",
|
|
74
73
|
"typescript": "5.8.3",
|
|
75
74
|
"unbuild": "3.5.0",
|
|
76
75
|
"unstorage": "1.16.0",
|
|
77
|
-
"vitest": "3.2.4"
|
|
76
|
+
"vitest": "3.2.4",
|
|
77
|
+
"@scayle/eslint-config-storefront": "4.5.12"
|
|
78
78
|
},
|
|
79
79
|
"volta": {
|
|
80
80
|
"node": "22.17.0"
|