@scayle/storefront-core 8.32.0 → 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 +74 -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,21 @@
|
|
|
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
|
+
|
|
17
|
+
## 8.32.1
|
|
18
|
+
|
|
3
19
|
## 8.32.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -17,23 +33,23 @@
|
|
|
17
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.
|
|
18
34
|
|
|
19
35
|
```ts
|
|
20
|
-
const { data } = useRpc(
|
|
36
|
+
const { data } = useRpc('getFilters', 'getFiltersKey', () => ({
|
|
21
37
|
where: {
|
|
22
38
|
minReduction: 10,
|
|
23
39
|
maxReduction: 20,
|
|
24
40
|
},
|
|
25
|
-
}))
|
|
41
|
+
}))
|
|
26
42
|
|
|
27
43
|
const { data } = useRpc(
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
'getProductsByCategory',
|
|
45
|
+
'getProductsByCategoryKey',
|
|
30
46
|
() => ({
|
|
31
47
|
where: {
|
|
32
48
|
minReduction: 10,
|
|
33
49
|
maxReduction: 20,
|
|
34
50
|
},
|
|
35
51
|
}),
|
|
36
|
-
)
|
|
52
|
+
)
|
|
37
53
|
```
|
|
38
54
|
|
|
39
55
|
## 8.30.3
|
|
@@ -64,28 +80,28 @@ No changes in this release.
|
|
|
64
80
|
|
|
65
81
|
```ts
|
|
66
82
|
export const existingHandlerWithoutParams = async (_context: RpcContext) => {
|
|
67
|
-
return
|
|
68
|
-
}
|
|
83
|
+
return 'existing handler'
|
|
84
|
+
}
|
|
69
85
|
|
|
70
86
|
export const existingHandlerWithParams = async (
|
|
71
87
|
{ name }: { name: string },
|
|
72
88
|
_context: RpcContext,
|
|
73
89
|
) => {
|
|
74
|
-
return name
|
|
75
|
-
}
|
|
90
|
+
return name
|
|
91
|
+
}
|
|
76
92
|
|
|
77
93
|
// will become
|
|
78
94
|
|
|
79
95
|
export const existingHandlerWithoutParams = defineRpcHandler(
|
|
80
96
|
async (_context: RpcContext) => {
|
|
81
|
-
return
|
|
97
|
+
return 'existing handler'
|
|
82
98
|
},
|
|
83
|
-
)
|
|
99
|
+
)
|
|
84
100
|
export const existingHandlerWithParams = defineRpcHandler(
|
|
85
101
|
async ({ name }: { name: string }, _context: RpcContext) => {
|
|
86
|
-
return name
|
|
102
|
+
return name
|
|
87
103
|
},
|
|
88
|
-
)
|
|
104
|
+
)
|
|
89
105
|
```
|
|
90
106
|
|
|
91
107
|
### Patch Changes
|
|
@@ -102,15 +118,15 @@ No changes in this release.
|
|
|
102
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.
|
|
103
119
|
|
|
104
120
|
```ts
|
|
105
|
-
import { rpcMethods } from
|
|
121
|
+
import { rpcMethods } from '@scayle/storefront-core'
|
|
106
122
|
|
|
107
|
-
rpcMethods.getCategoryTree({ hideEmptyCategories: true }, rpcContext)
|
|
123
|
+
rpcMethods.getCategoryTree({ hideEmptyCategories: true }, rpcContext)
|
|
108
124
|
```
|
|
109
125
|
|
|
110
126
|
or
|
|
111
127
|
|
|
112
128
|
```ts
|
|
113
|
-
import { useCategoryTree } from
|
|
129
|
+
import { useCategoryTree } from '#storefront/composables'
|
|
114
130
|
|
|
115
131
|
const { data: rootCategories, status } = useCategoryTree(
|
|
116
132
|
{
|
|
@@ -118,8 +134,8 @@ No changes in this release.
|
|
|
118
134
|
hideEmptyCategories: true,
|
|
119
135
|
},
|
|
120
136
|
},
|
|
121
|
-
|
|
122
|
-
)
|
|
137
|
+
'category-navigation-tree',
|
|
138
|
+
)
|
|
123
139
|
```
|
|
124
140
|
|
|
125
141
|
### Patch Changes
|
|
@@ -551,12 +567,12 @@ To get the default campaign key, you can call the RPC method:
|
|
|
551
567
|
```typescript
|
|
552
568
|
// Before
|
|
553
569
|
async function rpcMethod(context) {
|
|
554
|
-
const campaignKey = { context }
|
|
570
|
+
const campaignKey = { context }
|
|
555
571
|
// ...
|
|
556
572
|
}
|
|
557
573
|
// After
|
|
558
574
|
async function rpcMethod(context) {
|
|
559
|
-
const campaignKey = await context.callRpc?.(
|
|
575
|
+
const campaignKey = await context.callRpc?.('getCampaignKey')
|
|
560
576
|
// ...
|
|
561
577
|
}
|
|
562
578
|
```
|
|
@@ -745,43 +761,43 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
745
761
|
|
|
746
762
|
```ts
|
|
747
763
|
const BadgeLabel = {
|
|
748
|
-
NEW:
|
|
749
|
-
SOLD_OUT:
|
|
750
|
-
ONLINE_EXCLUSIVE:
|
|
751
|
-
SUSTAINABLE:
|
|
752
|
-
PREMIUM:
|
|
753
|
-
DEFAULT:
|
|
754
|
-
} 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
|
|
755
771
|
|
|
756
772
|
type BadgeLabelParamsKeys =
|
|
757
|
-
|
|
|
758
|
-
|
|
|
759
|
-
|
|
|
760
|
-
|
|
|
761
|
-
|
|
|
762
|
-
type BadgeLabelParams = Partial<Record<BadgeLabelParamsKeys, boolean
|
|
773
|
+
| 'isNew'
|
|
774
|
+
| 'isSoldOut'
|
|
775
|
+
| 'isOnlineOnly'
|
|
776
|
+
| 'isSustainable'
|
|
777
|
+
| 'isPremium'
|
|
778
|
+
type BadgeLabelParams = Partial<Record<BadgeLabelParamsKeys, boolean>>
|
|
763
779
|
|
|
764
780
|
const getBadgeLabel = (params: BadgeLabelParams = {}): string => {
|
|
765
781
|
if (!params) {
|
|
766
|
-
return BadgeLabel.DEFAULT
|
|
782
|
+
return BadgeLabel.DEFAULT
|
|
767
783
|
}
|
|
768
784
|
const { isNew, isSoldOut, isOnlineOnly, isSustainable, isPremium } =
|
|
769
|
-
params
|
|
785
|
+
params
|
|
770
786
|
|
|
771
787
|
if (isNew) {
|
|
772
|
-
return BadgeLabel.NEW
|
|
788
|
+
return BadgeLabel.NEW
|
|
773
789
|
} else if (isSoldOut) {
|
|
774
|
-
return BadgeLabel.SOLD_OUT
|
|
790
|
+
return BadgeLabel.SOLD_OUT
|
|
775
791
|
} else if (isOnlineOnly) {
|
|
776
|
-
return BadgeLabel.ONLINE_EXCLUSIVE
|
|
792
|
+
return BadgeLabel.ONLINE_EXCLUSIVE
|
|
777
793
|
} else if (isSustainable) {
|
|
778
|
-
return BadgeLabel.SUSTAINABLE
|
|
794
|
+
return BadgeLabel.SUSTAINABLE
|
|
779
795
|
} else if (isPremium) {
|
|
780
|
-
return BadgeLabel.PREMIUM
|
|
796
|
+
return BadgeLabel.PREMIUM
|
|
781
797
|
} else {
|
|
782
|
-
return BadgeLabel.DEFAULT
|
|
798
|
+
return BadgeLabel.DEFAULT
|
|
783
799
|
}
|
|
784
|
-
}
|
|
800
|
+
}
|
|
785
801
|
```
|
|
786
802
|
|
|
787
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`.
|
|
@@ -797,15 +813,15 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
797
813
|
storefront: {
|
|
798
814
|
// ...
|
|
799
815
|
bapi: {
|
|
800
|
-
host:
|
|
801
|
-
token:
|
|
816
|
+
host: '...',
|
|
817
|
+
token: '...',
|
|
802
818
|
},
|
|
803
819
|
// ...
|
|
804
820
|
},
|
|
805
821
|
// ...
|
|
806
822
|
},
|
|
807
823
|
// ...
|
|
808
|
-
}
|
|
824
|
+
}
|
|
809
825
|
```
|
|
810
826
|
|
|
811
827
|
- _Legacy Environment Variables:_
|
|
@@ -825,15 +841,15 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
825
841
|
storefront: {
|
|
826
842
|
// ...
|
|
827
843
|
sapi: {
|
|
828
|
-
host:
|
|
829
|
-
token:
|
|
844
|
+
host: '...',
|
|
845
|
+
token: '...',
|
|
830
846
|
},
|
|
831
847
|
// ...
|
|
832
848
|
},
|
|
833
849
|
// ...
|
|
834
850
|
},
|
|
835
851
|
// ...
|
|
836
|
-
}
|
|
852
|
+
}
|
|
837
853
|
```
|
|
838
854
|
|
|
839
855
|
- _New Environment Variables:_
|
|
@@ -851,19 +867,19 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
851
867
|
|
|
852
868
|
```ts
|
|
853
869
|
const { data, fetching, fetch, error, status } = useUser(
|
|
854
|
-
|
|
870
|
+
'getUser',
|
|
855
871
|
// ...
|
|
856
|
-
)
|
|
857
|
-
data.value.user.authentication.storefrontAccessToken
|
|
872
|
+
)
|
|
873
|
+
data.value.user.authentication.storefrontAccessToken
|
|
858
874
|
```
|
|
859
875
|
|
|
860
876
|
- _Current Usage of dedicated `getAccessToken` RPC method:_
|
|
861
877
|
|
|
862
878
|
```ts
|
|
863
879
|
const { data: accessToken } = useRpc(
|
|
864
|
-
|
|
880
|
+
'getAccessToken',
|
|
865
881
|
// ...
|
|
866
|
-
)
|
|
882
|
+
)
|
|
867
883
|
```
|
|
868
884
|
|
|
869
885
|
- **\[💥 BREAKING\]** We've enhanced security for basket and wishlist keys by switching the default hashing algorithm from MD5 to the more robust SHA256.
|
|
@@ -886,7 +902,7 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
886
902
|
// ...
|
|
887
903
|
},
|
|
888
904
|
// ...
|
|
889
|
-
})
|
|
905
|
+
})
|
|
890
906
|
```
|
|
891
907
|
|
|
892
908
|
- **\[💥 BREAKING\]** The attribute `loginShopId` is removed from the `ShopUser` interface as the shop now uses session cookies.
|
|
@@ -895,23 +911,23 @@ See [Overriding core RPC Methods](https://scayle.dev/en/storefront-guide/develop
|
|
|
895
911
|
- _Previous Usage of `searchProducts` RPC method:_
|
|
896
912
|
|
|
897
913
|
```ts
|
|
898
|
-
const getSearchSuggestionsRpc = useRpcCall(
|
|
914
|
+
const getSearchSuggestionsRpc = useRpcCall('searchProducts')
|
|
899
915
|
|
|
900
916
|
data.value = await searchProducts({
|
|
901
917
|
term: String(searchQuery.value),
|
|
902
918
|
...params,
|
|
903
|
-
})
|
|
919
|
+
})
|
|
904
920
|
```
|
|
905
921
|
|
|
906
922
|
- _Current Usage of `getSearchSuggestions` RPC method:_
|
|
907
923
|
|
|
908
924
|
```ts
|
|
909
|
-
const getSearchSuggestionsRpc = useRpcCall(
|
|
925
|
+
const getSearchSuggestionsRpc = useRpcCall('getSearchSuggestions')
|
|
910
926
|
|
|
911
927
|
data.value = await getSearchSuggestionsRpc({
|
|
912
928
|
term: String(searchQuery.value),
|
|
913
929
|
...params,
|
|
914
|
-
})
|
|
930
|
+
})
|
|
915
931
|
```
|
|
916
932
|
|
|
917
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"
|