@websolutespa/bom-mixer-models 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -68
- package/dist/index.d.ts +257 -246
- package/dist/index.js +4 -2
- package/dist/index.mjs +4 -2
- package/package.json +6 -6
- package/src/application/application.ts +8 -1
- package/src/lazy/lazy.ts +6 -1
- package/src/page/page.service.ts +5 -5
- package/src/route/route.service.ts +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,68 +1,80 @@
|
|
|
1
|
-
# @websolutespa/bom-mixer-models
|
|
2
|
-
|
|
3
|
-
## 1.1
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- Added:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- Modified
|
|
21
|
-
|
|
22
|
-
## 0.
|
|
23
|
-
|
|
24
|
-
### Patch Changes
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
## 0.
|
|
29
|
-
|
|
30
|
-
###
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
## 0.4.
|
|
35
|
-
|
|
36
|
-
###
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
## 0.
|
|
41
|
-
|
|
42
|
-
###
|
|
43
|
-
|
|
44
|
-
- Added:
|
|
45
|
-
|
|
46
|
-
## 0.
|
|
47
|
-
|
|
48
|
-
### Minor Changes
|
|
49
|
-
|
|
50
|
-
- Added:
|
|
51
|
-
|
|
52
|
-
## 0.
|
|
53
|
-
|
|
54
|
-
###
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
## 0.
|
|
59
|
-
|
|
60
|
-
### Minor Changes
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
## 0.
|
|
65
|
-
|
|
66
|
-
### Patch Changes
|
|
67
|
-
|
|
68
|
-
-
|
|
1
|
+
# @websolutespa/bom-mixer-models
|
|
2
|
+
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Added: IAppProps, ILazyProps.
|
|
8
|
+
|
|
9
|
+
## 1.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Updating: next 13.
|
|
14
|
+
|
|
15
|
+
## 1.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- Added: storeApi.
|
|
20
|
+
- Modified: SiteMapService.
|
|
21
|
+
|
|
22
|
+
## 1.0.1
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Added: env ROOT_CATEGORY.
|
|
27
|
+
|
|
28
|
+
## 0.5.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- Modified routes, added redirects.
|
|
33
|
+
|
|
34
|
+
## 0.4.2
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Fixing: avoid categories circular reference.
|
|
39
|
+
|
|
40
|
+
## 0.4.1
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- Added: source files.
|
|
45
|
+
|
|
46
|
+
## 0.4.0
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- Added: splat routes.
|
|
51
|
+
|
|
52
|
+
## 0.3.0
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- Added: @websolutespa/bom-core.
|
|
57
|
+
|
|
58
|
+
## 0.2.0
|
|
59
|
+
|
|
60
|
+
### Minor Changes
|
|
61
|
+
|
|
62
|
+
- Added: LazyComponent Types.
|
|
63
|
+
|
|
64
|
+
## 0.1.1
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Modified: page service.
|
|
69
|
+
|
|
70
|
+
## 0.1.0
|
|
71
|
+
|
|
72
|
+
### Minor Changes
|
|
73
|
+
|
|
74
|
+
- mock refactor.
|
|
75
|
+
|
|
76
|
+
## 0.0.2
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- Added: first release.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,309 +1,320 @@
|
|
|
1
1
|
import { ILayout, IPage, IRouteParams, ISchema, IEquatable, IMedia, QueryParams, ICategory, ICategorized, IOption, INamedEntity, ILabel, ILocale, IMarket, IMenu, ValueOf, IPageResult, IRoute, IRouteLink, IQuerable, IRedirect, IEntity } from '@websolutespa/bom-core';
|
|
2
2
|
import { AppProps } from 'next/app';
|
|
3
|
-
import { ComponentType, ComponentProps } from 'react';
|
|
3
|
+
import { FC, ReactNode, ComponentType, ComponentProps } from 'react';
|
|
4
4
|
import { HtmlProps } from 'next/dist/shared/lib/html-context';
|
|
5
5
|
import { RenderPageResult } from 'next/dist/shared/lib/utils';
|
|
6
6
|
import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
|
|
7
7
|
import { GetServerSideProps } from 'next';
|
|
8
8
|
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
9
|
+
type IAppProps<T> = AppProps<T> & {
|
|
10
|
+
Component: {
|
|
11
|
+
Layout?: FC<{
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
type IApplicationProps = Record<string, any> & {
|
|
17
|
+
layout: ILayout;
|
|
18
|
+
page: IPage;
|
|
19
|
+
params: IRouteParams;
|
|
20
|
+
};
|
|
21
|
+
type IApplication = IAppProps<IApplicationProps>;
|
|
15
22
|
|
|
16
|
-
type ICartItem = ISchema & {
|
|
17
|
-
id: IEquatable;
|
|
18
|
-
schema: string;
|
|
19
|
-
media: IMedia;
|
|
20
|
-
title: string;
|
|
21
|
-
abstract?: string;
|
|
22
|
-
href: string;
|
|
23
|
-
price: number;
|
|
24
|
-
qty: number;
|
|
25
|
-
};
|
|
23
|
+
type ICartItem = ISchema & {
|
|
24
|
+
id: IEquatable;
|
|
25
|
+
schema: string;
|
|
26
|
+
media: IMedia;
|
|
27
|
+
title: string;
|
|
28
|
+
abstract?: string;
|
|
29
|
+
href: string;
|
|
30
|
+
price: number;
|
|
31
|
+
qty: number;
|
|
32
|
+
};
|
|
26
33
|
type ICartAddItem = Omit<ICartItem, 'qty'>;
|
|
27
34
|
|
|
28
|
-
declare function getCategories(params?: QueryParams): Promise<ICategory[]>;
|
|
29
|
-
declare function getCategory(id: IEquatable, params?: QueryParams): Promise<ICategory | undefined>;
|
|
35
|
+
declare function getCategories(params?: QueryParams): Promise<ICategory[]>;
|
|
36
|
+
declare function getCategory(id: IEquatable, params?: QueryParams): Promise<ICategory | undefined>;
|
|
30
37
|
declare function getSegments(item: ICategorized, params?: QueryParams): Promise<ICategory[]>;
|
|
31
38
|
|
|
32
|
-
type IUserLogin = {
|
|
33
|
-
email: string;
|
|
34
|
-
password: string;
|
|
35
|
-
rememberMe: boolean;
|
|
36
|
-
};
|
|
37
|
-
type IUserRegister = {
|
|
38
|
-
firstName: string;
|
|
39
|
-
lastName: string;
|
|
40
|
-
email: string;
|
|
41
|
-
password: string;
|
|
42
|
-
confirmPassword: string;
|
|
43
|
-
privacy: boolean;
|
|
44
|
-
};
|
|
45
|
-
type IUserForgot = {
|
|
46
|
-
email: string;
|
|
47
|
-
};
|
|
48
|
-
type IUserChangePassword = {
|
|
49
|
-
oldPassword: string;
|
|
50
|
-
newPassword: string;
|
|
51
|
-
confirmNewPassword: string;
|
|
52
|
-
};
|
|
53
|
-
type IUser = ISchema & {
|
|
54
|
-
id: IEquatable;
|
|
55
|
-
firstName: string;
|
|
56
|
-
lastName: string;
|
|
57
|
-
email: string;
|
|
58
|
-
};
|
|
59
|
-
type IAddress = {
|
|
60
|
-
name: string;
|
|
61
|
-
firstName: string;
|
|
62
|
-
lastName: string;
|
|
63
|
-
address: string;
|
|
64
|
-
streetNumber: string;
|
|
65
|
-
zipCode: string;
|
|
66
|
-
city: string;
|
|
67
|
-
country: IOption;
|
|
68
|
-
region?: IOption;
|
|
69
|
-
province?: IOption;
|
|
70
|
-
email: string;
|
|
71
|
-
phoneNumber: string;
|
|
72
|
-
};
|
|
73
|
-
type IAddressOptions = {
|
|
74
|
-
countries: IOption[];
|
|
75
|
-
regions: IOption[];
|
|
76
|
-
provinces: IOption[];
|
|
77
|
-
};
|
|
78
|
-
type IUserAddress = Omit<IAddress, 'name'>;
|
|
39
|
+
type IUserLogin = {
|
|
40
|
+
email: string;
|
|
41
|
+
password: string;
|
|
42
|
+
rememberMe: boolean;
|
|
43
|
+
};
|
|
44
|
+
type IUserRegister = {
|
|
45
|
+
firstName: string;
|
|
46
|
+
lastName: string;
|
|
47
|
+
email: string;
|
|
48
|
+
password: string;
|
|
49
|
+
confirmPassword: string;
|
|
50
|
+
privacy: boolean;
|
|
51
|
+
};
|
|
52
|
+
type IUserForgot = {
|
|
53
|
+
email: string;
|
|
54
|
+
};
|
|
55
|
+
type IUserChangePassword = {
|
|
56
|
+
oldPassword: string;
|
|
57
|
+
newPassword: string;
|
|
58
|
+
confirmNewPassword: string;
|
|
59
|
+
};
|
|
60
|
+
type IUser = ISchema & {
|
|
61
|
+
id: IEquatable;
|
|
62
|
+
firstName: string;
|
|
63
|
+
lastName: string;
|
|
64
|
+
email: string;
|
|
65
|
+
};
|
|
66
|
+
type IAddress = {
|
|
67
|
+
name: string;
|
|
68
|
+
firstName: string;
|
|
69
|
+
lastName: string;
|
|
70
|
+
address: string;
|
|
71
|
+
streetNumber: string;
|
|
72
|
+
zipCode: string;
|
|
73
|
+
city: string;
|
|
74
|
+
country: IOption;
|
|
75
|
+
region?: IOption;
|
|
76
|
+
province?: IOption;
|
|
77
|
+
email: string;
|
|
78
|
+
phoneNumber: string;
|
|
79
|
+
};
|
|
80
|
+
type IAddressOptions = {
|
|
81
|
+
countries: IOption[];
|
|
82
|
+
regions: IOption[];
|
|
83
|
+
provinces: IOption[];
|
|
84
|
+
};
|
|
85
|
+
type IUserAddress = Omit<IAddress, 'name'>;
|
|
79
86
|
type ICompanyAddress = Omit<IAddress, 'firstName' | 'lastName'>;
|
|
80
87
|
|
|
81
|
-
type ICheckout = {
|
|
82
|
-
items: ICheckoutItem[];
|
|
83
|
-
user?: Partial<IUser>;
|
|
84
|
-
shippingAddress: IUserAddress;
|
|
85
|
-
hasInvoice?: boolean;
|
|
86
|
-
hasBilling?: boolean;
|
|
87
|
-
billingAddress?: IUserAddress;
|
|
88
|
-
delivery: ICheckoutDelivery;
|
|
89
|
-
store: ICheckoutStore;
|
|
90
|
-
discounts: ICheckoutDiscount[];
|
|
91
|
-
payment: ICheckoutPayment;
|
|
92
|
-
subTotal: number;
|
|
93
|
-
subTotalFull: number;
|
|
94
|
-
taxes: number;
|
|
95
|
-
total: number;
|
|
96
|
-
};
|
|
97
|
-
type ICheckoutPartial = Partial<ICheckout>;
|
|
98
|
-
type ICheckoutItem = ICartItem & {
|
|
99
|
-
fullPrice: number;
|
|
100
|
-
};
|
|
101
|
-
type ICheckoutInfo = {
|
|
102
|
-
user?: Partial<IUser>;
|
|
103
|
-
shippingAddress: IUserAddress;
|
|
104
|
-
hasInvoice?: boolean;
|
|
105
|
-
hasBilling?: boolean;
|
|
106
|
-
billingAddress?: IUserAddress;
|
|
107
|
-
};
|
|
108
|
-
type ICheckoutDelivery = IOption & {
|
|
109
|
-
abstract: string;
|
|
110
|
-
price: number;
|
|
111
|
-
fullPrice: number;
|
|
112
|
-
};
|
|
113
|
-
type ICheckoutStore = Partial<ICompanyAddress> & IOption & {
|
|
114
|
-
category?: IOption;
|
|
115
|
-
timetable?: string[];
|
|
116
|
-
position?: {
|
|
117
|
-
latitude: number;
|
|
118
|
-
longitude: number;
|
|
119
|
-
};
|
|
120
|
-
distance?: number;
|
|
121
|
-
rank?: number;
|
|
122
|
-
};
|
|
123
|
-
type ICheckoutDiscount = IOption & {
|
|
124
|
-
abstract?: string;
|
|
125
|
-
price: number;
|
|
126
|
-
validFrom: Date | string;
|
|
127
|
-
validTo: Date | string;
|
|
128
|
-
};
|
|
129
|
-
type ICheckoutPayment = IOption & {
|
|
130
|
-
abstract?: string;
|
|
131
|
-
media?: IMedia;
|
|
132
|
-
};
|
|
133
|
-
type ICheckoutPaymentRedirect = {
|
|
134
|
-
redirectUrl: string;
|
|
88
|
+
type ICheckout = {
|
|
89
|
+
items: ICheckoutItem[];
|
|
90
|
+
user?: Partial<IUser>;
|
|
91
|
+
shippingAddress: IUserAddress;
|
|
92
|
+
hasInvoice?: boolean;
|
|
93
|
+
hasBilling?: boolean;
|
|
94
|
+
billingAddress?: IUserAddress;
|
|
95
|
+
delivery: ICheckoutDelivery;
|
|
96
|
+
store: ICheckoutStore;
|
|
97
|
+
discounts: ICheckoutDiscount[];
|
|
98
|
+
payment: ICheckoutPayment;
|
|
99
|
+
subTotal: number;
|
|
100
|
+
subTotalFull: number;
|
|
101
|
+
taxes: number;
|
|
102
|
+
total: number;
|
|
103
|
+
};
|
|
104
|
+
type ICheckoutPartial = Partial<ICheckout>;
|
|
105
|
+
type ICheckoutItem = ICartItem & {
|
|
106
|
+
fullPrice: number;
|
|
107
|
+
};
|
|
108
|
+
type ICheckoutInfo = {
|
|
109
|
+
user?: Partial<IUser>;
|
|
110
|
+
shippingAddress: IUserAddress;
|
|
111
|
+
hasInvoice?: boolean;
|
|
112
|
+
hasBilling?: boolean;
|
|
113
|
+
billingAddress?: IUserAddress;
|
|
114
|
+
};
|
|
115
|
+
type ICheckoutDelivery = IOption & {
|
|
116
|
+
abstract: string;
|
|
117
|
+
price: number;
|
|
118
|
+
fullPrice: number;
|
|
119
|
+
};
|
|
120
|
+
type ICheckoutStore = Partial<ICompanyAddress> & IOption & {
|
|
121
|
+
category?: IOption;
|
|
122
|
+
timetable?: string[];
|
|
123
|
+
position?: {
|
|
124
|
+
latitude: number;
|
|
125
|
+
longitude: number;
|
|
126
|
+
};
|
|
127
|
+
distance?: number;
|
|
128
|
+
rank?: number;
|
|
129
|
+
};
|
|
130
|
+
type ICheckoutDiscount = IOption & {
|
|
131
|
+
abstract?: string;
|
|
132
|
+
price: number;
|
|
133
|
+
validFrom: Date | string;
|
|
134
|
+
validTo: Date | string;
|
|
135
|
+
};
|
|
136
|
+
type ICheckoutPayment = IOption & {
|
|
137
|
+
abstract?: string;
|
|
138
|
+
media?: IMedia;
|
|
139
|
+
};
|
|
140
|
+
type ICheckoutPaymentRedirect = {
|
|
141
|
+
redirectUrl: string;
|
|
135
142
|
};
|
|
136
143
|
|
|
137
|
-
declare function getItems(items: ICartItem[], market: string, locale: string, user?: IUser): Promise<ICheckoutItem[]>;
|
|
138
|
-
declare function getInfo(checkout: ICheckoutPartial, market: string, locale: string): Promise<IAddressOptions>;
|
|
139
|
-
declare function getDeliveries(checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutDelivery[]>;
|
|
140
|
-
declare function getStores(checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutStore[]>;
|
|
141
|
-
declare function getPayments(checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutPayment[]>;
|
|
142
|
-
declare function updateCheckout(checkout: ICheckoutPartial, action: string, market: string, locale: string): Promise<ICheckoutPartial>;
|
|
143
|
-
declare function setDiscountCode(discountCode: string, checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutPartial>;
|
|
144
|
+
declare function getItems(items: ICartItem[], market: string, locale: string, user?: IUser): Promise<ICheckoutItem[]>;
|
|
145
|
+
declare function getInfo(checkout: ICheckoutPartial, market: string, locale: string): Promise<IAddressOptions>;
|
|
146
|
+
declare function getDeliveries(checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutDelivery[]>;
|
|
147
|
+
declare function getStores(checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutStore[]>;
|
|
148
|
+
declare function getPayments(checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutPayment[]>;
|
|
149
|
+
declare function updateCheckout(checkout: ICheckoutPartial, action: string, market: string, locale: string): Promise<ICheckoutPartial>;
|
|
150
|
+
declare function setDiscountCode(discountCode: string, checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutPartial>;
|
|
144
151
|
declare function getPayment(checkout: ICheckoutPartial, market: string, locale: string): Promise<ICheckoutPaymentRedirect>;
|
|
145
152
|
|
|
146
|
-
declare function getCountries(locale?: string): Promise<INamedEntity[]>;
|
|
153
|
+
declare function getCountries(locale?: string): Promise<INamedEntity[]>;
|
|
147
154
|
declare function getCountry(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
148
155
|
|
|
149
|
-
type IFeatureType = {
|
|
150
|
-
id: string;
|
|
151
|
-
schema?: string;
|
|
152
|
-
title: string;
|
|
153
|
-
mode: string;
|
|
154
|
-
features?: {
|
|
155
|
-
id: IEquatable;
|
|
156
|
-
title: string;
|
|
157
|
-
[key: string]: unknown;
|
|
158
|
-
}[];
|
|
156
|
+
type IFeatureType = {
|
|
157
|
+
id: string;
|
|
158
|
+
schema?: string;
|
|
159
|
+
title: string;
|
|
160
|
+
mode: string;
|
|
161
|
+
features?: {
|
|
162
|
+
id: IEquatable;
|
|
163
|
+
title: string;
|
|
164
|
+
[key: string]: unknown;
|
|
165
|
+
}[];
|
|
159
166
|
};
|
|
160
167
|
|
|
161
|
-
declare function getFeatureTypes(params?: QueryParams): Promise<IFeatureType[]>;
|
|
168
|
+
declare function getFeatureTypes(params?: QueryParams): Promise<IFeatureType[]>;
|
|
162
169
|
declare function getFeatureType(id: IEquatable, params?: QueryParams): Promise<IFeatureType | undefined>;
|
|
163
170
|
|
|
164
|
-
declare function getLabels(params?: QueryParams): Promise<ILabel[]>;
|
|
165
|
-
declare function getLabel(id: IEquatable, params?: QueryParams): Promise<ILabel | undefined>;
|
|
171
|
+
declare function getLabels(params?: QueryParams): Promise<ILabel[]>;
|
|
172
|
+
declare function getLabel(id: IEquatable, params?: QueryParams): Promise<ILabel | undefined>;
|
|
166
173
|
declare function resolveLabel(labels: ILabel[], id: string): string;
|
|
167
174
|
|
|
168
175
|
declare function getLayout(market: string, locale: string): Promise<ILayout>;
|
|
169
176
|
|
|
170
|
-
type ILazyComponent = {
|
|
171
|
-
schema: string;
|
|
172
|
-
[key: string]: unknown;
|
|
173
|
-
};
|
|
174
|
-
type
|
|
175
|
-
item: ILazyComponent;
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
type ILazyComponent = {
|
|
178
|
+
schema: string;
|
|
179
|
+
[key: string]: unknown;
|
|
180
|
+
};
|
|
181
|
+
type ILazyProps<T> = {
|
|
182
|
+
item: T & ILazyComponent;
|
|
183
|
+
children?: ReactNode;
|
|
184
|
+
};
|
|
185
|
+
type ILazyComponentProps = {
|
|
186
|
+
item: ILazyComponent;
|
|
187
|
+
};
|
|
188
|
+
type IGenericLazyComponentProps = ILazyComponentProps & any;
|
|
178
189
|
type ILazyModules = Record<string, ComponentType<ComponentProps<IGenericLazyComponentProps>>>;
|
|
179
190
|
|
|
180
|
-
type ILink = {
|
|
181
|
-
href: string;
|
|
182
|
-
title: string;
|
|
183
|
-
type?: string;
|
|
184
|
-
secure?: boolean;
|
|
191
|
+
type ILink = {
|
|
192
|
+
href: string;
|
|
193
|
+
title: string;
|
|
194
|
+
type?: string;
|
|
195
|
+
secure?: boolean;
|
|
185
196
|
};
|
|
186
197
|
|
|
187
|
-
type IList = INamedEntity & {
|
|
188
|
-
key?: string;
|
|
189
|
-
listId?: IEquatable;
|
|
190
|
-
items?: IList[];
|
|
191
|
-
};
|
|
192
|
-
type IKeyedList = IList & {
|
|
193
|
-
key: string;
|
|
198
|
+
type IList = INamedEntity & {
|
|
199
|
+
key?: string;
|
|
200
|
+
listId?: IEquatable;
|
|
201
|
+
items?: IList[];
|
|
202
|
+
};
|
|
203
|
+
type IKeyedList = IList & {
|
|
204
|
+
key: string;
|
|
194
205
|
};
|
|
195
206
|
|
|
196
|
-
declare function getLists(locale?: string): Promise<IList[]>;
|
|
197
|
-
declare function getListByKeys(keys: string[], locale?: string): Promise<{
|
|
198
|
-
[key: string]: IList[];
|
|
207
|
+
declare function getLists(locale?: string): Promise<IList[]>;
|
|
208
|
+
declare function getListByKeys(keys: string[], locale?: string): Promise<{
|
|
209
|
+
[key: string]: IList[];
|
|
199
210
|
}>;
|
|
200
211
|
|
|
201
|
-
declare function getLocales(params?: QueryParams): Promise<ILocale[]>;
|
|
202
|
-
declare function getLocale(id: IEquatable, params?: QueryParams): Promise<ILocale | undefined>;
|
|
212
|
+
declare function getLocales(params?: QueryParams): Promise<ILocale[]>;
|
|
213
|
+
declare function getLocale(id: IEquatable, params?: QueryParams): Promise<ILocale | undefined>;
|
|
203
214
|
declare function getLocaleFromProps(props: (RenderPageResult & HtmlProps) | undefined): string | undefined;
|
|
204
215
|
|
|
205
|
-
declare function getMarkets(params?: QueryParams): Promise<IMarket[]>;
|
|
216
|
+
declare function getMarkets(params?: QueryParams): Promise<IMarket[]>;
|
|
206
217
|
declare function getMarket(id: IEquatable, params?: QueryParams): Promise<IMarket | undefined>;
|
|
207
218
|
|
|
208
|
-
declare function getMenus(params?: QueryParams): Promise<IMenu[]>;
|
|
219
|
+
declare function getMenus(params?: QueryParams): Promise<IMenu[]>;
|
|
209
220
|
declare function getMenu(id: IEquatable, params?: QueryParams): Promise<IMenu | undefined>;
|
|
210
221
|
|
|
211
|
-
declare const IOrderStatus: {
|
|
212
|
-
Pending: string;
|
|
213
|
-
AwaitingPayment: string;
|
|
214
|
-
AwaitingFulfillment: string;
|
|
215
|
-
AwaitingShipment: string;
|
|
216
|
-
AwaitingPickup: string;
|
|
217
|
-
PartiallyShipped: string;
|
|
218
|
-
Completed: string;
|
|
219
|
-
Shipped: string;
|
|
220
|
-
Cancelled: string;
|
|
221
|
-
Declined: string;
|
|
222
|
-
Refunded: string;
|
|
223
|
-
Disputed: string;
|
|
224
|
-
ManualVerificationRequired: string;
|
|
225
|
-
PartiallyRefunded: string;
|
|
226
|
-
};
|
|
227
|
-
type IOrderStatusValue = ValueOf<typeof IOrderStatus>;
|
|
228
|
-
type IOrder = ICheckout & {
|
|
229
|
-
id: IEquatable;
|
|
230
|
-
date: Date | string;
|
|
231
|
-
status: IOrderStatusValue;
|
|
232
|
-
};
|
|
233
|
-
type IOrderDetail = IOrder & {
|
|
234
|
-
href: string;
|
|
222
|
+
declare const IOrderStatus: {
|
|
223
|
+
Pending: string;
|
|
224
|
+
AwaitingPayment: string;
|
|
225
|
+
AwaitingFulfillment: string;
|
|
226
|
+
AwaitingShipment: string;
|
|
227
|
+
AwaitingPickup: string;
|
|
228
|
+
PartiallyShipped: string;
|
|
229
|
+
Completed: string;
|
|
230
|
+
Shipped: string;
|
|
231
|
+
Cancelled: string;
|
|
232
|
+
Declined: string;
|
|
233
|
+
Refunded: string;
|
|
234
|
+
Disputed: string;
|
|
235
|
+
ManualVerificationRequired: string;
|
|
236
|
+
PartiallyRefunded: string;
|
|
237
|
+
};
|
|
238
|
+
type IOrderStatusValue = ValueOf<typeof IOrderStatus>;
|
|
239
|
+
type IOrder = ICheckout & {
|
|
240
|
+
id: IEquatable;
|
|
241
|
+
date: Date | string;
|
|
242
|
+
status: IOrderStatusValue;
|
|
243
|
+
};
|
|
244
|
+
type IOrderDetail = IOrder & {
|
|
245
|
+
href: string;
|
|
235
246
|
};
|
|
236
247
|
|
|
237
|
-
declare function getOrders(market: string, locale: string): Promise<IOrderDetail[]>;
|
|
248
|
+
declare function getOrders(market: string, locale: string): Promise<IOrderDetail[]>;
|
|
238
249
|
declare function getOrder(id: IEquatable, market: string, locale: string): Promise<IOrderDetail | null>;
|
|
239
250
|
|
|
240
|
-
declare function findOnePage<T extends ICategorized = ICategorized>(schema: string, id: IEquatable, params?: QueryParams): Promise<T | undefined>;
|
|
241
|
-
declare function findManyPages<T extends ICategorized = ICategorized>(schema: string, params?: QueryParams): Promise<T[]>;
|
|
242
|
-
declare function getPage<T extends ICategorized = ICategorized>(schema: string, id: IEquatable, market?: string, locale?: string): Promise<IPageResult<T> | undefined>;
|
|
243
|
-
declare function getPageRoutes(schema: string, id: IEquatable): Promise<IRoute[]>;
|
|
244
|
-
declare function getPageCategory<T extends IPage>(schema: string, page?: IPage, market?: string, locale?: string): Promise<T | undefined>;
|
|
245
|
-
declare function getErrorPageLayout(): Promise<{
|
|
246
|
-
layout: ILayout;
|
|
247
|
-
page: IPage;
|
|
251
|
+
declare function findOnePage<T extends ICategorized = ICategorized>(schema: string, id: IEquatable, params?: QueryParams): Promise<T | undefined>;
|
|
252
|
+
declare function findManyPages<T extends ICategorized = ICategorized>(schema: string, params?: QueryParams): Promise<T[]>;
|
|
253
|
+
declare function getPage<T extends ICategorized = ICategorized>(schema: string, id: IEquatable, market?: string, locale?: string): Promise<IPageResult<T> | undefined>;
|
|
254
|
+
declare function getPageRoutes(schema: string, id: IEquatable, market?: string, locale?: string): Promise<IRoute[]>;
|
|
255
|
+
declare function getPageCategory<T extends IPage>(schema: string, page?: IPage, market?: string, locale?: string): Promise<T | undefined>;
|
|
256
|
+
declare function getErrorPageLayout(): Promise<{
|
|
257
|
+
layout: ILayout;
|
|
258
|
+
page: IPage;
|
|
248
259
|
}>;
|
|
249
260
|
|
|
250
|
-
declare function getProvinces(locale?: string): Promise<INamedEntity[]>;
|
|
261
|
+
declare function getProvinces(locale?: string): Promise<INamedEntity[]>;
|
|
251
262
|
declare function getProvince(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
252
263
|
|
|
253
|
-
declare function getRegions(locale?: string): Promise<INamedEntity[]>;
|
|
264
|
+
declare function getRegions(locale?: string): Promise<INamedEntity[]>;
|
|
254
265
|
declare function getRegion(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
255
266
|
|
|
256
267
|
declare function routeRevalidateHandler(): any;
|
|
257
268
|
|
|
258
|
-
declare function routeInterceptor(request: NextRequest, next: NextFetchEvent): Promise<NextResponse | undefined>;
|
|
269
|
+
declare function routeInterceptor(request: NextRequest, next: NextFetchEvent): Promise<NextResponse<unknown> | undefined>;
|
|
259
270
|
|
|
260
|
-
type StaticPath = {
|
|
261
|
-
params: {
|
|
262
|
-
[key: string]: string;
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
declare function getRoutes(params?: QueryParams): Promise<IRoute[]>;
|
|
266
|
-
declare function getRoute(id: string): Promise<IRoute | undefined>;
|
|
267
|
-
declare function getRoutesForSchemas(schemas: string[], market?: string, locale?: string): Promise<{
|
|
268
|
-
[key: string]: string;
|
|
269
|
-
}>;
|
|
270
|
-
declare function getRoutesForTemplates(templates: string[], market?: string, locale?: string): Promise<{
|
|
271
|
-
[key: string]: string;
|
|
272
|
-
}>;
|
|
273
|
-
declare function getStaticPathsForSchema(schema: string): Promise<StaticPath[]>;
|
|
274
|
-
declare function getBreadcrumbFromSegments(segments: ICategory[], market?: string, locale?: string): Promise<IRouteLink[]>;
|
|
275
|
-
declare function getRouteLinkTree(market?: string, locale?: string): Promise<IRouteLink | undefined>;
|
|
276
|
-
declare function categoryToRouteLink(routes: IRoute[], categories: ICategory[], category: ICategory, locale?: string): IRouteLink;
|
|
277
|
-
declare function resolveRoute(route: IRoute & {
|
|
278
|
-
splat?: string;
|
|
271
|
+
type StaticPath = {
|
|
272
|
+
params: {
|
|
273
|
+
[key: string]: string;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
declare function getRoutes(params?: QueryParams): Promise<IRoute[]>;
|
|
277
|
+
declare function getRoute(id: string): Promise<IRoute | undefined>;
|
|
278
|
+
declare function getRoutesForSchemas(schemas: string[], market?: string, locale?: string): Promise<{
|
|
279
|
+
[key: string]: string;
|
|
280
|
+
}>;
|
|
281
|
+
declare function getRoutesForTemplates(templates: string[], market?: string, locale?: string): Promise<{
|
|
282
|
+
[key: string]: string;
|
|
283
|
+
}>;
|
|
284
|
+
declare function getStaticPathsForSchema(schema: string): Promise<StaticPath[]>;
|
|
285
|
+
declare function getBreadcrumbFromSegments(segments: ICategory[], market?: string, locale?: string): Promise<IRouteLink[]>;
|
|
286
|
+
declare function getRouteLinkTree(market?: string, locale?: string): Promise<IRouteLink | undefined>;
|
|
287
|
+
declare function categoryToRouteLink(routes: IRoute[], categories: ICategory[], category: ICategory, locale?: string): IRouteLink;
|
|
288
|
+
declare function resolveRoute(route: IRoute & {
|
|
289
|
+
splat?: string;
|
|
279
290
|
}): string;
|
|
280
291
|
|
|
281
|
-
declare const getSiteMapIndexProps: GetServerSideProps;
|
|
282
|
-
declare const getSiteMapXMLProps: GetServerSideProps;
|
|
292
|
+
declare const getSiteMapIndexProps: GetServerSideProps;
|
|
293
|
+
declare const getSiteMapXMLProps: GetServerSideProps;
|
|
283
294
|
declare const getSiteMapXSLProps: GetServerSideProps;
|
|
284
295
|
|
|
285
|
-
type ISiteMap = {
|
|
286
|
-
id: string;
|
|
287
|
-
updatedAt?: Date;
|
|
288
|
-
};
|
|
289
|
-
declare function getSiteMapIndex(origin: string): Promise<string>;
|
|
290
|
-
declare function getSiteMapXML(origin: string, marketId?: string, localeId?: string): Promise<string>;
|
|
296
|
+
type ISiteMap = {
|
|
297
|
+
id: string;
|
|
298
|
+
updatedAt?: Date;
|
|
299
|
+
};
|
|
300
|
+
declare function getSiteMapIndex(origin: string): Promise<string>;
|
|
301
|
+
declare function getSiteMapXML(origin: string, marketId?: string, localeId?: string): Promise<string>;
|
|
291
302
|
declare function getSiteMapXSL(): Promise<string>;
|
|
292
303
|
|
|
293
|
-
type IModelStore = {
|
|
294
|
-
category: IQuerable<ICategory>;
|
|
295
|
-
feature_type: IQuerable<IFeatureType>;
|
|
296
|
-
label: IQuerable<ILabel>;
|
|
297
|
-
list: IQuerable<IList>;
|
|
298
|
-
locale: IQuerable<ILocale>;
|
|
299
|
-
market: IQuerable<IMarket>;
|
|
300
|
-
menu: IQuerable<IMenu>;
|
|
301
|
-
redirect: IQuerable<IRedirect>;
|
|
302
|
-
route: IQuerable<IRoute>;
|
|
303
|
-
i18n_country: IQuerable<INamedEntity>;
|
|
304
|
-
i18n_province: IQuerable<INamedEntity>;
|
|
305
|
-
i18n_region: IQuerable<INamedEntity>;
|
|
306
|
-
[key: string]: IQuerable<IEntity>;
|
|
304
|
+
type IModelStore = {
|
|
305
|
+
category: IQuerable<ICategory>;
|
|
306
|
+
feature_type: IQuerable<IFeatureType>;
|
|
307
|
+
label: IQuerable<ILabel>;
|
|
308
|
+
list: IQuerable<IList>;
|
|
309
|
+
locale: IQuerable<ILocale>;
|
|
310
|
+
market: IQuerable<IMarket>;
|
|
311
|
+
menu: IQuerable<IMenu>;
|
|
312
|
+
redirect: IQuerable<IRedirect>;
|
|
313
|
+
route: IQuerable<IRoute>;
|
|
314
|
+
i18n_country: IQuerable<INamedEntity>;
|
|
315
|
+
i18n_province: IQuerable<INamedEntity>;
|
|
316
|
+
i18n_region: IQuerable<INamedEntity>;
|
|
317
|
+
[key: string]: IQuerable<IEntity>;
|
|
307
318
|
};
|
|
308
319
|
|
|
309
|
-
export { IAddress, IAddressOptions, IApplication, IApplicationProps, ICartAddItem, ICartItem, ICheckout, ICheckoutDelivery, ICheckoutDiscount, ICheckoutInfo, ICheckoutItem, ICheckoutPartial, ICheckoutPayment, ICheckoutPaymentRedirect, ICheckoutStore, ICompanyAddress, IFeatureType, IGenericLazyComponentProps, IKeyedList, ILazyComponent, ILazyComponentProps, ILazyModules, ILink, IList, IModelStore, IOrder, IOrderDetail, IOrderStatus, IOrderStatusValue, ISiteMap, IUser, IUserAddress, IUserChangePassword, IUserForgot, IUserLogin, IUserRegister, StaticPath, categoryToRouteLink, findManyPages, findOnePage, getBreadcrumbFromSegments, getCategories, getCategory, getCountries, getCountry, getDeliveries, getErrorPageLayout, getFeatureType, getFeatureTypes, getInfo, getItems, getLabel, getLabels, getLayout, getListByKeys, getLists, getLocale, getLocaleFromProps, getLocales, getMarket, getMarkets, getMenu, getMenus, getOrder, getOrders, getPage, getPageCategory, getPageRoutes, getPayment, getPayments, getProvince, getProvinces, getRegion, getRegions, getRoute, getRouteLinkTree, getRoutes, getRoutesForSchemas, getRoutesForTemplates, getSegments, getSiteMapIndex, getSiteMapIndexProps, getSiteMapXML, getSiteMapXMLProps, getSiteMapXSL, getSiteMapXSLProps, getStaticPathsForSchema, getStores, resolveLabel, resolveRoute, routeInterceptor, routeRevalidateHandler, setDiscountCode, updateCheckout };
|
|
320
|
+
export { IAddress, IAddressOptions, IAppProps, IApplication, IApplicationProps, ICartAddItem, ICartItem, ICheckout, ICheckoutDelivery, ICheckoutDiscount, ICheckoutInfo, ICheckoutItem, ICheckoutPartial, ICheckoutPayment, ICheckoutPaymentRedirect, ICheckoutStore, ICompanyAddress, IFeatureType, IGenericLazyComponentProps, IKeyedList, ILazyComponent, ILazyComponentProps, ILazyModules, ILazyProps, ILink, IList, IModelStore, IOrder, IOrderDetail, IOrderStatus, IOrderStatusValue, ISiteMap, IUser, IUserAddress, IUserChangePassword, IUserForgot, IUserLogin, IUserRegister, StaticPath, categoryToRouteLink, findManyPages, findOnePage, getBreadcrumbFromSegments, getCategories, getCategory, getCountries, getCountry, getDeliveries, getErrorPageLayout, getFeatureType, getFeatureTypes, getInfo, getItems, getLabel, getLabels, getLayout, getListByKeys, getLists, getLocale, getLocaleFromProps, getLocales, getMarket, getMarkets, getMenu, getMenus, getOrder, getOrders, getPage, getPageCategory, getPageRoutes, getPayment, getPayments, getProvince, getProvinces, getRegion, getRegions, getRoute, getRouteLinkTree, getRoutes, getRoutesForSchemas, getRoutesForTemplates, getSegments, getSiteMapIndex, getSiteMapIndexProps, getSiteMapXML, getSiteMapXMLProps, getSiteMapXSL, getSiteMapXSLProps, getStaticPathsForSchema, getStores, resolveLabel, resolveRoute, routeInterceptor, routeRevalidateHandler, setDiscountCode, updateCheckout };
|
package/dist/index.js
CHANGED
|
@@ -1091,7 +1091,7 @@ async function getPage(schema, id, market, locale) {
|
|
|
1091
1091
|
return;
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
|
-
async function getPageRoutes(schema, id) {
|
|
1094
|
+
async function getPageRoutes(schema, id, market, locale) {
|
|
1095
1095
|
const store = await (0, import_bom_mixer_store12.getStore)();
|
|
1096
1096
|
let routes = [];
|
|
1097
1097
|
try {
|
|
@@ -1103,7 +1103,9 @@ async function getPageRoutes(schema, id) {
|
|
|
1103
1103
|
schema: {
|
|
1104
1104
|
equals: schema
|
|
1105
1105
|
}
|
|
1106
|
-
}
|
|
1106
|
+
},
|
|
1107
|
+
market,
|
|
1108
|
+
locale
|
|
1107
1109
|
});
|
|
1108
1110
|
} catch (error) {
|
|
1109
1111
|
console.error("No routes found for page " + schema + ":" + id);
|
package/dist/index.mjs
CHANGED
|
@@ -1008,7 +1008,7 @@ async function getPage(schema, id, market, locale) {
|
|
|
1008
1008
|
return;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
async function getPageRoutes(schema, id) {
|
|
1011
|
+
async function getPageRoutes(schema, id, market, locale) {
|
|
1012
1012
|
const store = await getStore12();
|
|
1013
1013
|
let routes = [];
|
|
1014
1014
|
try {
|
|
@@ -1020,7 +1020,9 @@ async function getPageRoutes(schema, id) {
|
|
|
1020
1020
|
schema: {
|
|
1021
1021
|
equals: schema
|
|
1022
1022
|
}
|
|
1023
|
-
}
|
|
1023
|
+
},
|
|
1024
|
+
market,
|
|
1025
|
+
locale
|
|
1024
1026
|
});
|
|
1025
1027
|
} catch (error) {
|
|
1026
1028
|
console.error("No routes found for page " + schema + ":" + id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-mixer-models",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Mixer Models module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@websolutespa/bom-core": "*",
|
|
24
24
|
"@websolutespa/bom-mixer-store": "*",
|
|
25
|
-
"next": ">=
|
|
25
|
+
"next": ">= 13.4.19"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/react": "^18.
|
|
29
|
-
"@types/react-dom": "^18.
|
|
28
|
+
"@types/react": "^18.2.18",
|
|
29
|
+
"@types/react-dom": "^18.2.7",
|
|
30
30
|
"@websolutespa/bom-cli": "*",
|
|
31
31
|
"@websolutespa/test": "*",
|
|
32
32
|
"@websolutespa/tsconfig": "*",
|
|
33
|
-
"eslint": "^8.
|
|
33
|
+
"eslint": "^8.46.0",
|
|
34
34
|
"eslint-config-websolute": "*",
|
|
35
35
|
"npm-run-all": "^4.1.5",
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"ts-node": "^10.9.1",
|
|
38
38
|
"tsup": "^6.7.0",
|
|
39
|
-
"typescript": "^
|
|
39
|
+
"typescript": "^5.1.6"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { ILayout, IPage, IRouteParams } from '@websolutespa/bom-core';
|
|
2
2
|
import { AppProps } from 'next/app';
|
|
3
|
+
import { FC, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export type IAppProps<T> = AppProps<T> & {
|
|
6
|
+
Component: {
|
|
7
|
+
Layout?: FC<{ children?: ReactNode }>
|
|
8
|
+
}
|
|
9
|
+
};
|
|
3
10
|
|
|
4
11
|
export type IApplicationProps = Record<string, any> & {
|
|
5
12
|
layout: ILayout;
|
|
@@ -7,4 +14,4 @@ export type IApplicationProps = Record<string, any> & {
|
|
|
7
14
|
params: IRouteParams;
|
|
8
15
|
};
|
|
9
16
|
|
|
10
|
-
export type IApplication =
|
|
17
|
+
export type IApplication = IAppProps<IApplicationProps>;
|
package/src/lazy/lazy.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { ComponentProps, ComponentType } from 'react';
|
|
1
|
+
import { ComponentProps, ComponentType, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
export type ILazyComponent = {
|
|
4
4
|
schema: string;
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
export type ILazyProps<T> = {
|
|
9
|
+
item: T & ILazyComponent;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
|
|
8
13
|
export type ILazyComponentProps = {
|
|
9
14
|
item: ILazyComponent;
|
|
10
15
|
};
|
package/src/page/page.service.ts
CHANGED
|
@@ -55,7 +55,7 @@ export async function getPage<T extends ICategorized = ICategorized>(schema: str
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export async function getPageRoutes(schema: string, id: IEquatable): Promise<IRoute[]> {
|
|
58
|
+
export async function getPageRoutes(schema: string, id: IEquatable, market?: string, locale?: string): Promise<IRoute[]> {
|
|
59
59
|
const store = await getStore<IModelStore>();
|
|
60
60
|
let routes: IRoute[] = [];
|
|
61
61
|
try {
|
|
@@ -67,7 +67,7 @@ export async function getPageRoutes(schema: string, id: IEquatable): Promise<IRo
|
|
|
67
67
|
schema: {
|
|
68
68
|
equals: schema,
|
|
69
69
|
},
|
|
70
|
-
}
|
|
70
|
+
}, market, locale,
|
|
71
71
|
});
|
|
72
72
|
} catch (error: any) {
|
|
73
73
|
console.error('No routes found for page ' + schema + ':' + id);
|
|
@@ -84,8 +84,8 @@ export async function getPageCategory<T extends IPage>(schema: string, page?: IP
|
|
|
84
84
|
where: {
|
|
85
85
|
category: {
|
|
86
86
|
equals: typeof page.category === 'object' ? page.category.id : page.category,
|
|
87
|
-
}
|
|
88
|
-
}, market, locale
|
|
87
|
+
},
|
|
88
|
+
}, market, locale,
|
|
89
89
|
});
|
|
90
90
|
const category = pages.length ? pages[0] : null;
|
|
91
91
|
// console.log(page, market, locale, category);
|
|
@@ -98,7 +98,7 @@ export async function getPageCategory<T extends IPage>(schema: string, page?: IP
|
|
|
98
98
|
page: {
|
|
99
99
|
equals: category.id,
|
|
100
100
|
},
|
|
101
|
-
}
|
|
101
|
+
},
|
|
102
102
|
});
|
|
103
103
|
const currentRoute = routes.find((x: IRoute) => x.market === market && x.locale === locale);
|
|
104
104
|
if (!currentRoute) {
|
|
@@ -30,7 +30,7 @@ export async function getRoutesForSchemas(schemas: string[], market?: string, lo
|
|
|
30
30
|
locale: {
|
|
31
31
|
equals: locale,
|
|
32
32
|
},
|
|
33
|
-
}, market, locale
|
|
33
|
+
}, market, locale,
|
|
34
34
|
});
|
|
35
35
|
const items: {
|
|
36
36
|
[key: string]: string;
|
|
@@ -54,7 +54,7 @@ export async function getRoutesForTemplates(templates: string[], market?: string
|
|
|
54
54
|
locale: {
|
|
55
55
|
equals: locale,
|
|
56
56
|
},
|
|
57
|
-
}, market, locale
|
|
57
|
+
}, market, locale,
|
|
58
58
|
});
|
|
59
59
|
const items: {
|
|
60
60
|
[key: string]: string;
|
|
@@ -72,9 +72,9 @@ export async function getStaticPathsForSchema(schema: string): Promise<StaticPat
|
|
|
72
72
|
const routes = await store.route.findMany({
|
|
73
73
|
where: {
|
|
74
74
|
schema: {
|
|
75
|
-
equals: schema
|
|
76
|
-
}
|
|
77
|
-
}
|
|
75
|
+
equals: schema,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
78
|
});
|
|
79
79
|
return routes.map((x: any) => ({ params: { id: x.page.toString(), market: x.market, locale: x.locale } }));
|
|
80
80
|
}
|
|
@@ -83,12 +83,12 @@ export async function getBreadcrumbFromSegments(segments: ICategory[], market: s
|
|
|
83
83
|
const routes: IRoute[] = await getRoutes({
|
|
84
84
|
where: {
|
|
85
85
|
market: {
|
|
86
|
-
equals: market
|
|
86
|
+
equals: market,
|
|
87
87
|
},
|
|
88
88
|
locale: {
|
|
89
|
-
equals: locale
|
|
89
|
+
equals: locale,
|
|
90
90
|
},
|
|
91
|
-
}
|
|
91
|
+
},
|
|
92
92
|
});
|
|
93
93
|
const tree: IRouteLink[] = segments.map(segment => {
|
|
94
94
|
const route = routes.find(r =>
|
|
@@ -121,7 +121,7 @@ export async function getRouteLinkTree(market: string = 'ww', locale: string = '
|
|
|
121
121
|
locale: {
|
|
122
122
|
equals: locale,
|
|
123
123
|
},
|
|
124
|
-
}, market, locale
|
|
124
|
+
}, market, locale,
|
|
125
125
|
});
|
|
126
126
|
// console.log('getRouteLinkTree.routes');
|
|
127
127
|
const categories = await store.category.findMany();
|