@akinon/projectzero 2.0.0-beta.20 → 2.0.0-beta.21
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 +8 -0
- package/app-template/CHANGELOG.md +138 -0
- package/app-template/next.config.mjs +0 -1
- package/app-template/package.json +31 -30
- package/app-template/src/app/[pz]/[...prettyurl]/page.tsx +2 -2
- package/app-template/src/app/[pz]/account/layout.tsx +2 -1
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/blog/[slug]/page.tsx +4 -2
- package/app-template/src/app/[pz]/category/[pk]/page.tsx +11 -1
- package/app-template/src/app/[pz]/group-product/[pk]/page.tsx +2 -2
- package/app-template/src/app/[pz]/layout.tsx +3 -1
- package/app-template/src/app/[pz]/list/page.tsx +11 -1
- package/app-template/src/app/[pz]/page.tsx +13 -35
- package/app-template/src/app/[pz]/pages/[slug]/page.tsx +19 -0
- package/app-template/src/app/[pz]/product/[pk]/page.tsx +2 -2
- package/app-template/src/app/api/barcode-search/route.ts +1 -1
- package/app-template/src/app/api/cache/route.ts +1 -1
- package/app-template/src/app/api/image-proxy/route.ts +1 -1
- package/app-template/src/app/api/logout/route.ts +1 -1
- package/app-template/src/app/api/product-categories/route.ts +1 -1
- package/app-template/src/app/api/similar-product-list/route.ts +1 -1
- package/app-template/src/app/api/similar-products/route.ts +1 -1
- package/app-template/src/app/api/virtual-try-on/route.ts +1 -1
- package/app-template/src/app/api/web-vitals/route.ts +1 -1
- package/app-template/src/components/quantity-selector.tsx +16 -4
- package/app-template/src/components/widget-content.tsx +3 -3
- package/app-template/src/routes/index.ts +6 -6
- package/app-template/src/utils/__tests__/theme-page-context.test.ts +145 -0
- package/app-template/src/utils/theme-page-context.ts +309 -0
- package/app-template/src/views/basket/basket-item.tsx +107 -691
- package/app-template/src/views/basket/index.ts +0 -2
- package/app-template/src/views/basket/summary.tsx +75 -496
- package/app-template/src/views/breadcrumb.tsx +38 -13
- package/app-template/src/views/category/category-header.tsx +66 -289
- package/app-template/src/views/category/category-info.tsx +24 -173
- package/app-template/src/views/category/filters/index.tsx +48 -208
- package/app-template/src/views/category/layout.tsx +5 -7
- package/app-template/src/views/checkout/index.tsx +0 -5
- package/app-template/src/views/checkout/steps/payment/index.tsx +2 -5
- package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +1 -72
- package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +40 -171
- package/app-template/src/views/checkout/steps/shipping/address-box.tsx +12 -74
- package/app-template/src/views/checkout/steps/shipping/addresses.tsx +45 -128
- package/app-template/src/views/checkout/steps/shipping/shipping-options.tsx +27 -232
- package/app-template/src/views/checkout/summary.tsx +29 -303
- package/app-template/src/views/footer.tsx +13 -415
- package/app-template/src/views/guest-login/index.tsx +1 -1
- package/app-template/src/views/header/action-menu.tsx +45 -277
- package/app-template/src/views/header/band.tsx +21 -6
- package/app-template/src/views/header/index.tsx +47 -109
- package/app-template/src/views/header/mini-basket.tsx +45 -820
- package/app-template/src/views/header/navbar.tsx +111 -178
- package/app-template/src/views/header/search/index.tsx +32 -71
- package/app-template/src/views/header/search/results.tsx +65 -127
- package/app-template/src/views/product/accordion-wrapper.tsx +43 -135
- package/app-template/src/views/product/index.ts +1 -1
- package/app-template/src/views/product/layout.tsx +7 -2
- package/app-template/src/views/product/misc-buttons.tsx +25 -339
- package/app-template/src/views/product/product-actions.tsx +8 -137
- package/app-template/src/views/product/product-info.tsx +31 -69
- package/app-template/src/views/product/product-share.tsx +8 -11
- package/app-template/src/views/product/slider.tsx +79 -117
- package/app-template/src/views/product-item/index.tsx +46 -119
- package/app-template/src/widgets/footer-social.tsx +16 -47
- package/app-template/src/widgets/footer-subscription/index.tsx +17 -183
- package/dist/commands/plugins.js +23 -2
- package/package.json +1 -1
- package/app-template/src/app/[commerce]/[locale]/[currency]/pages/[slug]/page.tsx +0 -15
- package/app-template/src/views/basket/basket-summary-context.tsx +0 -560
- package/app-template/src/views/basket/designer-context.tsx +0 -617
- package/app-template/src/views/breadcrumb/breadcrumb-client.tsx +0 -190
- package/app-template/src/views/breadcrumb/breadcrumb-registrar.tsx +0 -286
- package/app-template/src/views/breadcrumb/constants.ts +0 -15
- package/app-template/src/views/breadcrumb/index.tsx +0 -127
- package/app-template/src/views/category/native-widget-context.tsx +0 -257
- package/app-template/src/views/category/product-list-registrar.tsx +0 -665
- package/app-template/src/views/checkout/checkout-address-registrar.tsx +0 -254
- package/app-template/src/views/checkout/checkout-buttons-registrar.tsx +0 -183
- package/app-template/src/views/checkout/checkout-delivery-method-registrar.tsx +0 -259
- package/app-template/src/views/checkout/checkout-payment-options-registrar.tsx +0 -253
- package/app-template/src/views/checkout/checkout-summary-registrar.tsx +0 -183
- package/app-template/src/views/checkout/constants.ts +0 -5
- package/app-template/src/views/checkout/steps/payment/options/masterpass-rest.tsx +0 -15
- package/app-template/src/views/checkout/steps/payment/options/saved-card.tsx +0 -18
- package/app-template/src/views/footer/footer-app-banner-context.tsx +0 -326
- package/app-template/src/views/footer/footer-bottom-context.tsx +0 -215
- package/app-template/src/views/footer/footer-bottom-wrapper.tsx +0 -74
- package/app-template/src/views/footer/footer-layout-constants.ts +0 -35
- package/app-template/src/views/footer/footer-layout-registrar.tsx +0 -342
- package/app-template/src/views/footer/footer-layout-switcher.tsx +0 -110
- package/app-template/src/views/footer/footer-menu-context.tsx +0 -211
- package/app-template/src/views/footer/footer-native-widgets.tsx +0 -60
- package/app-template/src/views/footer/footer-social-context.tsx +0 -254
- package/app-template/src/views/footer/footer-subscription-context.tsx +0 -210
- package/app-template/src/views/footer/footer-utils.ts +0 -43
- package/app-template/src/views/footer/footer-value-props-context.tsx +0 -326
- package/app-template/src/views/footer/logo-settings.ts +0 -183
- package/app-template/src/views/footer/native-widget-config.ts +0 -262
- package/app-template/src/views/footer/subscription-settings.ts +0 -122
- package/app-template/src/views/footer/use-footer-logo.ts +0 -162
- package/app-template/src/views/header/designer-context.tsx +0 -261
- package/app-template/src/views/header/header-announcement-registrar.tsx +0 -267
- package/app-template/src/views/header/header-client-wrapper.tsx +0 -496
- package/app-template/src/views/header/header-content.tsx +0 -1026
- package/app-template/src/views/header/header-currency-registrar.tsx +0 -348
- package/app-template/src/views/header/header-icons-context.tsx +0 -262
- package/app-template/src/views/header/header-language-registrar.tsx +0 -348
- package/app-template/src/views/header/header-layout-context.tsx +0 -143
- package/app-template/src/views/header/header-layout-registrar.tsx +0 -658
- package/app-template/src/views/header/header-logo-context.tsx +0 -228
- package/app-template/src/views/header/header-logo.tsx +0 -118
- package/app-template/src/views/header/header-mini-basket-context.tsx +0 -524
- package/app-template/src/views/header/header-search-registrar.tsx +0 -511
- package/app-template/src/views/header/header-text-slider-registrar.tsx +0 -382
- package/app-template/src/views/header/inline-search.tsx +0 -262
- package/app-template/src/views/header/navbar-menu-context.tsx +0 -219
- package/app-template/src/views/header/search/search-input.tsx +0 -61
- package/app-template/src/views/header/server-settings-parser.ts +0 -1105
- package/app-template/src/views/header/use-header-icons.ts +0 -241
- package/app-template/src/views/header/use-header-logo.ts +0 -213
- package/app-template/src/views/header/use-navbar-menu.ts +0 -179
- package/app-template/src/views/product/accordion-section.tsx +0 -61
- package/app-template/src/views/product/custom-button-group.tsx +0 -69
- package/app-template/src/views/product/favorites-button-section.tsx +0 -69
- package/app-template/src/views/product/find-in-store-section.tsx +0 -60
- package/app-template/src/views/product/product-info-section.tsx +0 -140
- package/app-template/src/views/product/quantity-section.tsx +0 -73
- package/app-template/src/views/product/sale-tag.tsx +0 -10
- package/app-template/src/views/product/share-section.tsx +0 -357
- package/app-template/src/views/product/variants-section.tsx +0 -126
- package/app-template/src/views/product-detail/constants.ts +0 -272
- package/app-template/src/views/product-detail/index.ts +0 -10
- package/app-template/src/views/product-detail/product-detail-registrar.tsx +0 -616
- package/app-template/src/widgets/footer-app-banner.tsx +0 -444
- package/app-template/src/widgets/footer-bottom.tsx +0 -127
- package/app-template/src/widgets/footer-menu-compact.tsx +0 -238
- package/app-template/src/widgets/footer-menu-two.tsx +0 -298
- package/app-template/src/widgets/footer-social-client.tsx +0 -251
- package/app-template/src/widgets/footer-value-props.tsx +0 -201
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
createContext,
|
|
5
|
-
useContext,
|
|
6
|
-
useEffect,
|
|
7
|
-
useState,
|
|
8
|
-
PropsWithChildren
|
|
9
|
-
} from 'react';
|
|
10
|
-
import { useGetWidgetQuery } from '@akinon/next/data/client/misc';
|
|
11
|
-
|
|
12
|
-
// Constants
|
|
13
|
-
export const PLACEHOLDER_ID = 'product-list-page';
|
|
14
|
-
export const FILTERS_SECTION_ID = 'filters-section';
|
|
15
|
-
export const PRODUCTS_SECTION_ID = 'products-section';
|
|
16
|
-
export const PRODUCT_ITEM_SECTION_ID = 'product-item-section';
|
|
17
|
-
export const PAGINATION_SECTION_ID = 'pagination-section';
|
|
18
|
-
export const WIDGET_SLUG = 'product-list-page-styles';
|
|
19
|
-
|
|
20
|
-
interface NativeWidgetContextValue {
|
|
21
|
-
filterStyles: Record<string, unknown>;
|
|
22
|
-
filterProperties: Record<string, unknown>;
|
|
23
|
-
productsProperties: Record<string, unknown>;
|
|
24
|
-
productsStyles: Record<string, unknown>;
|
|
25
|
-
productItemProperties: Record<string, unknown>;
|
|
26
|
-
productItemStyles: Record<string, unknown>;
|
|
27
|
-
paginationProperties: Record<string, unknown>;
|
|
28
|
-
paginationStyles: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const NativeWidgetContext = createContext<NativeWidgetContextValue>({
|
|
32
|
-
filterStyles: {},
|
|
33
|
-
filterProperties: {
|
|
34
|
-
layout: 'top',
|
|
35
|
-
'item-padding-y': 6,
|
|
36
|
-
'item-padding-x': 0,
|
|
37
|
-
'item-margin-bottom': 0
|
|
38
|
-
},
|
|
39
|
-
productsProperties: {
|
|
40
|
-
'show-layout-buttons': true,
|
|
41
|
-
'available-layouts': ['2', '3', '4']
|
|
42
|
-
},
|
|
43
|
-
productsStyles: {},
|
|
44
|
-
productItemProperties: {
|
|
45
|
-
'show-fav-button': true,
|
|
46
|
-
'fav-button-position': 'top-right'
|
|
47
|
-
},
|
|
48
|
-
productItemStyles: {},
|
|
49
|
-
paginationProperties: {
|
|
50
|
-
type: 'list'
|
|
51
|
-
},
|
|
52
|
-
paginationStyles: {}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
export function NativeWidgetProvider({ children }: PropsWithChildren) {
|
|
56
|
-
const [filterStyles, setFilterStyles] = useState<Record<string, unknown>>({});
|
|
57
|
-
const [filterProperties, setFilterProperties] = useState<
|
|
58
|
-
Record<string, unknown>
|
|
59
|
-
>({
|
|
60
|
-
layout: 'top',
|
|
61
|
-
'item-padding-y': 6,
|
|
62
|
-
'item-padding-x': 0,
|
|
63
|
-
'item-margin-bottom': 0
|
|
64
|
-
});
|
|
65
|
-
const [productsProperties, setProductsProperties] = useState<
|
|
66
|
-
Record<string, unknown>
|
|
67
|
-
>({
|
|
68
|
-
'show-layout-buttons': true,
|
|
69
|
-
'available-layouts': ['2', '3', '4']
|
|
70
|
-
});
|
|
71
|
-
const [productsStyles, setProductsStyles] = useState<Record<string, unknown>>(
|
|
72
|
-
{}
|
|
73
|
-
);
|
|
74
|
-
const [productItemProperties, setProductItemProperties] = useState<
|
|
75
|
-
Record<string, unknown>
|
|
76
|
-
>({
|
|
77
|
-
'show-fav-button': true,
|
|
78
|
-
'fav-button-position': 'top-right'
|
|
79
|
-
});
|
|
80
|
-
const [productItemStyles, setProductItemStyles] = useState<
|
|
81
|
-
Record<string, unknown>
|
|
82
|
-
>({});
|
|
83
|
-
const [paginationProperties, setPaginationProperties] = useState<
|
|
84
|
-
Record<string, unknown>
|
|
85
|
-
>({
|
|
86
|
-
type: 'list'
|
|
87
|
-
});
|
|
88
|
-
const [paginationStyles, setPaginationStyles] = useState<
|
|
89
|
-
Record<string, unknown>
|
|
90
|
-
>({});
|
|
91
|
-
|
|
92
|
-
// Fetch styles from widget
|
|
93
|
-
const { data: widgetData } = useGetWidgetQuery(WIDGET_SLUG);
|
|
94
|
-
|
|
95
|
-
// Load styles from widget (initial load)
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (!widgetData) return;
|
|
98
|
-
|
|
99
|
-
const attributes = widgetData.attributes || {};
|
|
100
|
-
|
|
101
|
-
// Load filters section
|
|
102
|
-
const filtersData = attributes[FILTERS_SECTION_ID];
|
|
103
|
-
if (filtersData) {
|
|
104
|
-
let parsedData: unknown;
|
|
105
|
-
if (typeof filtersData === 'string') {
|
|
106
|
-
try {
|
|
107
|
-
parsedData = JSON.parse(filtersData);
|
|
108
|
-
} catch {
|
|
109
|
-
// ignore
|
|
110
|
-
}
|
|
111
|
-
} else if (typeof filtersData === 'object' && 'value' in filtersData) {
|
|
112
|
-
try {
|
|
113
|
-
parsedData = JSON.parse((filtersData as { value: string }).value);
|
|
114
|
-
} catch {
|
|
115
|
-
// ignore
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
parsedData = filtersData;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (parsedData && typeof parsedData === 'object') {
|
|
122
|
-
const data = parsedData as Record<string, unknown>;
|
|
123
|
-
setFilterStyles((data.styles as Record<string, string>) || {});
|
|
124
|
-
setFilterProperties(
|
|
125
|
-
(data.properties as Record<string, unknown>) || {
|
|
126
|
-
layout: 'top',
|
|
127
|
-
'item-padding-y': 6,
|
|
128
|
-
'item-padding-x': 0,
|
|
129
|
-
'item-margin-bottom': 0
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Load products section
|
|
136
|
-
const productsData = attributes[PRODUCTS_SECTION_ID];
|
|
137
|
-
if (productsData) {
|
|
138
|
-
let parsedData: unknown;
|
|
139
|
-
if (typeof productsData === 'string') {
|
|
140
|
-
try {
|
|
141
|
-
parsedData = JSON.parse(productsData);
|
|
142
|
-
} catch {
|
|
143
|
-
// ignore
|
|
144
|
-
}
|
|
145
|
-
} else if (typeof productsData === 'object' && 'value' in productsData) {
|
|
146
|
-
try {
|
|
147
|
-
parsedData = JSON.parse((productsData as { value: string }).value);
|
|
148
|
-
} catch {
|
|
149
|
-
// ignore
|
|
150
|
-
}
|
|
151
|
-
} else {
|
|
152
|
-
parsedData = productsData;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (parsedData && typeof parsedData === 'object') {
|
|
156
|
-
const data = parsedData as Record<string, unknown>;
|
|
157
|
-
setProductsStyles((data.styles as Record<string, string>) || {});
|
|
158
|
-
setProductsProperties(
|
|
159
|
-
(data.properties as Record<string, unknown>) || {
|
|
160
|
-
'show-layout-buttons': true,
|
|
161
|
-
'available-layouts': ['2', '3', '4']
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Load product-item section
|
|
168
|
-
const productItemData = attributes[PRODUCT_ITEM_SECTION_ID];
|
|
169
|
-
if (productItemData) {
|
|
170
|
-
let parsedData: unknown;
|
|
171
|
-
if (typeof productItemData === 'string') {
|
|
172
|
-
try {
|
|
173
|
-
parsedData = JSON.parse(productItemData);
|
|
174
|
-
} catch {
|
|
175
|
-
// ignore
|
|
176
|
-
}
|
|
177
|
-
} else if (
|
|
178
|
-
typeof productItemData === 'object' &&
|
|
179
|
-
'value' in productItemData
|
|
180
|
-
) {
|
|
181
|
-
try {
|
|
182
|
-
parsedData = JSON.parse((productItemData as { value: string }).value);
|
|
183
|
-
} catch {
|
|
184
|
-
// ignore
|
|
185
|
-
}
|
|
186
|
-
} else {
|
|
187
|
-
parsedData = productItemData;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (parsedData && typeof parsedData === 'object') {
|
|
191
|
-
const data = parsedData as Record<string, unknown>;
|
|
192
|
-
setProductItemStyles((data.styles as Record<string, string>) || {});
|
|
193
|
-
setProductItemProperties(
|
|
194
|
-
(data.properties as Record<string, unknown>) || {
|
|
195
|
-
'show-fav-button': true,
|
|
196
|
-
'fav-button-position': 'top-right'
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Load pagination section
|
|
203
|
-
const paginationData = attributes[PAGINATION_SECTION_ID];
|
|
204
|
-
if (paginationData) {
|
|
205
|
-
let parsedData: unknown;
|
|
206
|
-
if (typeof paginationData === 'string') {
|
|
207
|
-
try {
|
|
208
|
-
parsedData = JSON.parse(paginationData);
|
|
209
|
-
} catch {
|
|
210
|
-
// ignore
|
|
211
|
-
}
|
|
212
|
-
} else if (
|
|
213
|
-
typeof paginationData === 'object' &&
|
|
214
|
-
'value' in paginationData
|
|
215
|
-
) {
|
|
216
|
-
try {
|
|
217
|
-
parsedData = JSON.parse((paginationData as { value: string }).value);
|
|
218
|
-
} catch {
|
|
219
|
-
// ignore
|
|
220
|
-
}
|
|
221
|
-
} else {
|
|
222
|
-
parsedData = paginationData;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (parsedData && typeof parsedData === 'object') {
|
|
226
|
-
const data = parsedData as Record<string, unknown>;
|
|
227
|
-
setPaginationStyles((data.styles as Record<string, string>) || {});
|
|
228
|
-
setPaginationProperties(
|
|
229
|
-
(data.properties as Record<string, unknown>) || {
|
|
230
|
-
type: 'list'
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}, [widgetData]);
|
|
236
|
-
|
|
237
|
-
const value: NativeWidgetContextValue = {
|
|
238
|
-
filterStyles,
|
|
239
|
-
filterProperties,
|
|
240
|
-
productsProperties,
|
|
241
|
-
productsStyles,
|
|
242
|
-
productItemProperties,
|
|
243
|
-
productItemStyles,
|
|
244
|
-
paginationProperties,
|
|
245
|
-
paginationStyles
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
return (
|
|
249
|
-
<NativeWidgetContext.Provider value={value}>
|
|
250
|
-
{children}
|
|
251
|
-
</NativeWidgetContext.Provider>
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export function useNativeWidget() {
|
|
256
|
-
return useContext(NativeWidgetContext);
|
|
257
|
-
}
|