@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,11 +1,7 @@
|
|
|
1
1
|
import 'server-only';
|
|
2
2
|
|
|
3
|
+
import { Link, Icon } from '@theme/components';
|
|
3
4
|
import { getWidgetData } from '@akinon/next/data/server';
|
|
4
|
-
import FooterSocialClient from './footer-social-client';
|
|
5
|
-
|
|
6
|
-
type ThemeConfig = {
|
|
7
|
-
theme_settings: string | object;
|
|
8
|
-
};
|
|
9
5
|
|
|
10
6
|
type TargetBlank = {
|
|
11
7
|
value: string;
|
|
@@ -35,50 +31,23 @@ type FooterSocialType = {
|
|
|
35
31
|
};
|
|
36
32
|
|
|
37
33
|
export default async function FooterSocial() {
|
|
38
|
-
const themeConfig = await getWidgetData<ThemeConfig>({
|
|
39
|
-
slug: 'theme-config'
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
let socialNetworks = {};
|
|
43
|
-
try {
|
|
44
|
-
if (themeConfig?.attributes?.theme_settings) {
|
|
45
|
-
const settingsRaw = themeConfig.attributes.theme_settings;
|
|
46
|
-
let settings;
|
|
47
|
-
|
|
48
|
-
if (typeof settingsRaw === 'string') {
|
|
49
|
-
settings = JSON.parse(settingsRaw);
|
|
50
|
-
} else if (
|
|
51
|
-
typeof settingsRaw === 'object' &&
|
|
52
|
-
settingsRaw !== null &&
|
|
53
|
-
'value' in settingsRaw
|
|
54
|
-
) {
|
|
55
|
-
const value = (settingsRaw as any).value;
|
|
56
|
-
settings = typeof value === 'string' ? JSON.parse(value) : value;
|
|
57
|
-
} else {
|
|
58
|
-
settings = settingsRaw;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
socialNetworks = settings.socialNetworks || {};
|
|
62
|
-
}
|
|
63
|
-
} catch (e) {
|
|
64
|
-
console.error('Error parsing theme settings:', e);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const activeNetworks = Object.entries(socialNetworks)
|
|
68
|
-
.filter(([_, value]: [string, any]) => value.icon)
|
|
69
|
-
.map(([key, value]: [string, any]) => ({
|
|
70
|
-
key,
|
|
71
|
-
url: value.url || '#',
|
|
72
|
-
icon: value.icon
|
|
73
|
-
}));
|
|
74
|
-
|
|
75
34
|
const data = await getWidgetData<FooterSocialType>({ slug: 'footer-social' });
|
|
76
|
-
const socialItems = data?.attributes?.social_items || [];
|
|
77
35
|
|
|
78
36
|
return (
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
37
|
+
<div className="flex flex-wrap items-center justify-around py-4 border-t border-gray md:justify-center">
|
|
38
|
+
{data?.attributes?.social_items?.map((item, i) => (
|
|
39
|
+
<Link
|
|
40
|
+
key={i}
|
|
41
|
+
href={item?.value?.redirect_url}
|
|
42
|
+
className="p-2 border rounded-full border-gray md:mr-1 md:last:mr-0"
|
|
43
|
+
target={item?.value?.is_target_blank === 'true' ? '_blank' : '_self'}
|
|
44
|
+
>
|
|
45
|
+
<Icon
|
|
46
|
+
size={18}
|
|
47
|
+
name={item?.value?.icon_class?.replace('pz-icon-', '')}
|
|
48
|
+
/>
|
|
49
|
+
</Link>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
83
52
|
);
|
|
84
53
|
}
|
|
@@ -1,196 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import 'server-only';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
import { useDesignerFeatures } from '@akinon/next/components/theme-editor/hooks/use-designer-features';
|
|
3
|
+
import { getWidgetData } from '@akinon/next/data/server';
|
|
6
4
|
|
|
7
5
|
import FooterSubscriptionForm from './footer-subscription-form';
|
|
8
|
-
import {
|
|
9
|
-
FOOTER_PLACEHOLDER_ID,
|
|
10
|
-
FOOTER_SUBSCRIPTION_SECTION_ID
|
|
11
|
-
} from '../../views/footer/native-widget-config';
|
|
12
|
-
import {
|
|
13
|
-
FOOTER_SUBSCRIPTION_BLOCKS,
|
|
14
|
-
FOOTER_SUBSCRIPTION_DEFAULT_CONTENT
|
|
15
|
-
} from '../../views/footer/subscription-settings';
|
|
16
|
-
import { useFooterSubscriptionDesigner } from '../../views/footer/footer-subscription-context';
|
|
17
6
|
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const extractTextValue = (value: unknown): string | undefined => {
|
|
27
|
-
if (value == null) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
32
|
-
return String(value);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (typeof value === 'object') {
|
|
36
|
-
const record = value as Record<string, unknown>;
|
|
37
|
-
const candidateKeys = [
|
|
38
|
-
'content',
|
|
39
|
-
'value',
|
|
40
|
-
'text',
|
|
41
|
-
'label',
|
|
42
|
-
'default',
|
|
43
|
-
'desktop',
|
|
44
|
-
'mobile',
|
|
45
|
-
'tablet'
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
for (const key of candidateKeys) {
|
|
49
|
-
const candidate = record[key];
|
|
50
|
-
if (typeof candidate === 'string' && candidate.trim().length > 0) {
|
|
51
|
-
return candidate;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (const objValue of Object.values(record)) {
|
|
56
|
-
if (typeof objValue === 'string' && objValue.trim().length > 0) {
|
|
57
|
-
return objValue;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return undefined;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const kebabToCamel = (str: string): string =>
|
|
66
|
-
str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
67
|
-
|
|
68
|
-
const normalizeStyles = (
|
|
69
|
-
styles: Record<string, unknown> | undefined
|
|
70
|
-
): CSSProperties => {
|
|
71
|
-
if (!styles) return {};
|
|
72
|
-
|
|
73
|
-
const result: Record<string, string | number> = {};
|
|
74
|
-
|
|
75
|
-
for (const [key, value] of Object.entries(styles)) {
|
|
76
|
-
if (value == null) continue;
|
|
77
|
-
|
|
78
|
-
const camelKey = kebabToCamel(key);
|
|
79
|
-
let resolved: unknown = value;
|
|
80
|
-
|
|
81
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
82
|
-
const responsive = value as Record<string, unknown>;
|
|
83
|
-
resolved = responsive.desktop ?? responsive.mobile ?? responsive.tablet;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (resolved != null) {
|
|
87
|
-
if (typeof resolved === 'number') {
|
|
88
|
-
result[camelKey] = resolved;
|
|
89
|
-
} else if (typeof resolved === 'string') {
|
|
90
|
-
result[camelKey] = resolved;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return result as CSSProperties;
|
|
7
|
+
type FooterSubscriptionType = {
|
|
8
|
+
description: {
|
|
9
|
+
value: string;
|
|
10
|
+
};
|
|
11
|
+
title: {
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
96
14
|
};
|
|
97
15
|
|
|
98
|
-
function
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const blockState = blockVersion >= 0 ? getBlock(blockConfig.id) : undefined;
|
|
102
|
-
const styles = normalizeStyles(blockState?.styles as Record<string, unknown>);
|
|
103
|
-
const { handleClick } = useDesignerFeatures({
|
|
104
|
-
blockId: blockConfig.id,
|
|
105
|
-
placeholderId: FOOTER_PLACEHOLDER_ID,
|
|
106
|
-
sectionId: FOOTER_SUBSCRIPTION_SECTION_ID,
|
|
107
|
-
isDesigner,
|
|
108
|
-
blockInfo: {
|
|
109
|
-
id: blockConfig.id,
|
|
110
|
-
type: blockConfig.type,
|
|
111
|
-
label: blockConfig.label
|
|
112
|
-
}
|
|
16
|
+
export default async function FooterSubscription() {
|
|
17
|
+
const data = await getWidgetData<FooterSubscriptionType>({
|
|
18
|
+
slug: 'footer-subscription'
|
|
113
19
|
});
|
|
114
20
|
|
|
115
|
-
return {
|
|
116
|
-
styles,
|
|
117
|
-
isDesigner,
|
|
118
|
-
isSelected: selectedBlockId === blockConfig.id,
|
|
119
|
-
onClick: isDesigner ? handleClick : undefined,
|
|
120
|
-
content: extractTextValue(blockState?.value)
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export default function FooterSubscription({
|
|
125
|
-
title,
|
|
126
|
-
description
|
|
127
|
-
}: FooterSubscriptionProps) {
|
|
128
|
-
const titleBlock = useSubscriptionBlock(FOOTER_SUBSCRIPTION_BLOCKS.TITLE);
|
|
129
|
-
const descriptionBlock = useSubscriptionBlock(
|
|
130
|
-
FOOTER_SUBSCRIPTION_BLOCKS.DESCRIPTION
|
|
131
|
-
);
|
|
132
|
-
const formBlock = useSubscriptionBlock(FOOTER_SUBSCRIPTION_BLOCKS.FORM);
|
|
133
|
-
const displayTitle =
|
|
134
|
-
titleBlock.content || title || FOOTER_SUBSCRIPTION_DEFAULT_CONTENT.title;
|
|
135
|
-
const displayDescription =
|
|
136
|
-
descriptionBlock.content ||
|
|
137
|
-
description ||
|
|
138
|
-
FOOTER_SUBSCRIPTION_DEFAULT_CONTENT.description;
|
|
139
|
-
const shouldRenderDescription =
|
|
140
|
-
descriptionBlock.isDesigner || Boolean(displayDescription);
|
|
141
|
-
|
|
142
21
|
return (
|
|
143
|
-
<div className="
|
|
144
|
-
<h3
|
|
145
|
-
|
|
146
|
-
data-block-id={
|
|
147
|
-
titleBlock.isDesigner
|
|
148
|
-
? FOOTER_SUBSCRIPTION_BLOCKS.TITLE.id
|
|
149
|
-
: undefined
|
|
150
|
-
}
|
|
151
|
-
onClick={titleBlock.onClick}
|
|
152
|
-
className={clsx(
|
|
153
|
-
'mb-4 text-lg text-[#121212]',
|
|
154
|
-
titleBlock.isDesigner && 'cursor-pointer',
|
|
155
|
-
titleBlock.isSelected && 'ring-2 ring-blue-500 ring-offset-2 rounded'
|
|
156
|
-
)}
|
|
157
|
-
>
|
|
158
|
-
{displayTitle}
|
|
22
|
+
<div className="py-4 border-t md:border-t-0 lg:pl-7">
|
|
23
|
+
<h3 className="mb-1 text-xs font-medium">
|
|
24
|
+
{data?.attributes?.title?.value}
|
|
159
25
|
</h3>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<p
|
|
163
|
-
style={descriptionBlock.styles}
|
|
164
|
-
data-block-id={
|
|
165
|
-
descriptionBlock.isDesigner
|
|
166
|
-
? FOOTER_SUBSCRIPTION_BLOCKS.DESCRIPTION.id
|
|
167
|
-
: undefined
|
|
168
|
-
}
|
|
169
|
-
onClick={descriptionBlock.onClick}
|
|
170
|
-
className={clsx(
|
|
171
|
-
'text-sm text-[#121212] text-opacity-75 mb-6 leading-relaxed',
|
|
172
|
-
descriptionBlock.isDesigner && 'cursor-pointer',
|
|
173
|
-
descriptionBlock.isSelected &&
|
|
174
|
-
'ring-2 ring-blue-500 ring-offset-2 rounded'
|
|
175
|
-
)}
|
|
176
|
-
>
|
|
177
|
-
{displayDescription}
|
|
178
|
-
</p>
|
|
179
|
-
)}
|
|
180
|
-
|
|
181
|
-
<div
|
|
182
|
-
style={formBlock.styles}
|
|
183
|
-
data-block-id={
|
|
184
|
-
formBlock.isDesigner ? FOOTER_SUBSCRIPTION_BLOCKS.FORM.id : undefined
|
|
185
|
-
}
|
|
186
|
-
onClick={formBlock.onClick}
|
|
187
|
-
className={clsx(
|
|
188
|
-
formBlock.isDesigner && 'cursor-pointer inline-block',
|
|
189
|
-
formBlock.isSelected && 'ring-2 ring-blue-500 ring-offset-2 rounded'
|
|
190
|
-
)}
|
|
191
|
-
>
|
|
192
|
-
<FooterSubscriptionForm />
|
|
193
|
-
</div>
|
|
26
|
+
<p className="mb-2 text-xs">{data?.attributes?.description?.value}</p>
|
|
27
|
+
<FooterSubscriptionForm />
|
|
194
28
|
</div>
|
|
195
29
|
);
|
|
196
30
|
}
|
package/dist/commands/plugins.js
CHANGED
|
@@ -60,7 +60,10 @@ function checkVersion(pkg) {
|
|
|
60
60
|
const pkgInfo = (yield response.json());
|
|
61
61
|
const latestVersion = pkgInfo['dist-tags'].latest;
|
|
62
62
|
if (!semver_1.default.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
63
|
-
console.warn(`\x1b[
|
|
63
|
+
console.warn(`\x1b[43m Warning: The "${packageName}" package is currently at`, `\x1b[41m version ${pkg.dependencies['@akinon/next']}`, `\x1b[43m Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`, '\x1b[0m\n');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.log(`\x1b[42m Info: The package "${packageName}" is currently in the current version (${latestVersion}).`, '\x1b[0m\n');
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
catch (error) {
|
|
@@ -82,7 +85,25 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
82
85
|
throw new Error('plugins.js was not found in either of the expected locations.');
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
|
-
|
|
88
|
+
function findPackageJson() {
|
|
89
|
+
const packageJsonPaths = [
|
|
90
|
+
path_1.default.resolve(rootDir, './package.json'),
|
|
91
|
+
path_1.default.resolve(rootDir, './apps/projectzeronext/package.json')
|
|
92
|
+
];
|
|
93
|
+
for (const packageJsonPath of packageJsonPaths) {
|
|
94
|
+
try {
|
|
95
|
+
const pkg = require(packageJsonPath);
|
|
96
|
+
if (pkg.dependencies['@akinon/next']) {
|
|
97
|
+
return pkg;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
throw new Error('Could not find package.json with @akinon/next dependency');
|
|
105
|
+
}
|
|
106
|
+
const pkg = findPackageJson();
|
|
86
107
|
yield checkVersion(pkg);
|
|
87
108
|
const pluginsFilePath = findPluginsFilePath();
|
|
88
109
|
let installedPlugins = [];
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import ThemePlaceholder from '@akinon/next/components/theme-editor/theme-placeholder';
|
|
2
|
-
import { withSegmentDefaults } from '@akinon/next/hocs/server';
|
|
3
|
-
import { PageProps } from '@akinon/next/types';
|
|
4
|
-
|
|
5
|
-
export const dynamic = 'force-dynamic';
|
|
6
|
-
|
|
7
|
-
async function Page({ params }: PageProps<{ slug: string }>) {
|
|
8
|
-
return (
|
|
9
|
-
<div className="min-h-screen">
|
|
10
|
-
<ThemePlaceholder slug={`page-${params.slug}`} />
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default withSegmentDefaults(Page, { segmentType: 'page' });
|