@akinon/projectzero 2.0.0-beta.9 → 2.0.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 +183 -17
- package/app-template/.env.example +3 -0
- package/app-template/.github/instructions/account.instructions.md +749 -0
- package/app-template/.github/instructions/checkout.instructions.md +678 -0
- package/app-template/.github/instructions/default.instructions.md +279 -0
- package/app-template/.github/instructions/edge-cases.instructions.md +73 -0
- package/app-template/.github/instructions/routing.instructions.md +603 -0
- package/app-template/.github/instructions/settings.instructions.md +338 -0
- package/app-template/.gitignore +3 -0
- package/app-template/AGENTS.md +7 -0
- package/app-template/CHANGELOG.md +2033 -232
- package/app-template/Procfile +1 -1
- package/app-template/akinon.json +1 -4
- package/app-template/build.sh +10 -0
- package/app-template/docs/advanced-usage.md +111 -0
- package/app-template/docs/plugins.md +60 -25
- package/app-template/docs/sentry-usage.md +35 -0
- package/app-template/jest.config.ts +2 -2
- package/app-template/next-env.d.ts +1 -0
- package/app-template/{next.config.ts → next.config.mjs} +6 -7
- package/app-template/package.json +58 -50
- package/app-template/postcss.config.mjs +1 -4
- package/app-template/public/amex.svg +12 -0
- package/app-template/public/apple-pay.svg +16 -0
- package/app-template/public/assets/images/product-placeholder-1.jpg +0 -0
- package/app-template/public/assets/images/product-placeholder-2.jpg +0 -0
- package/app-template/public/assets/images/product-placeholder-3.jpg +0 -0
- package/app-template/public/assets/images/product-placeholder-4.jpg +0 -0
- package/app-template/public/google-pay.svg +16 -0
- package/app-template/public/locales/en/account.json +9 -4
- package/app-template/public/locales/en/auth.json +6 -7
- package/app-template/public/locales/en/basket.json +6 -6
- package/app-template/public/locales/en/blog.json +7 -0
- package/app-template/public/locales/en/category.json +3 -1
- package/app-template/public/locales/en/checkout.json +17 -4
- package/app-template/public/locales/en/common.json +61 -3
- package/app-template/public/locales/en/forgot_password.json +6 -7
- package/app-template/public/locales/en/product.json +84 -4
- package/app-template/public/locales/tr/account.json +9 -4
- package/app-template/public/locales/tr/auth.json +16 -17
- package/app-template/public/locales/tr/basket.json +4 -4
- package/app-template/public/locales/tr/blog.json +7 -0
- package/app-template/public/locales/tr/category.json +3 -1
- package/app-template/public/locales/tr/checkout.json +48 -36
- package/app-template/public/locales/tr/common.json +60 -2
- package/app-template/public/locales/tr/forgot_password.json +12 -13
- package/app-template/public/locales/tr/product.json +82 -0
- package/app-template/public/logo.svg +3 -27
- package/app-template/public/mastercard.svg +14 -0
- package/app-template/public/masterpass-javascript-sdk-web.min.js +1 -0
- package/app-template/public/promotion-banner.jpg +0 -0
- package/app-template/public/shop-pay.svg +12 -0
- package/app-template/public/visa.svg +12 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/[...prettyurl]/page.tsx +11 -11
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/layout.tsx +4 -3
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/cancellation/page.tsx +13 -10
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/page.tsx +73 -51
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/page.tsx +1 -1
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/profile/page.tsx +2 -2
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/address/stores/page.tsx +2 -2
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/auth/page.tsx +1 -1
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/basket/page.tsx +2 -2
- package/app-template/src/app/[pz]/blog/[slug]/page.tsx +120 -0
- package/app-template/src/app/[pz]/category/[pk]/page.tsx +37 -0
- package/app-template/src/app/[pz]/flat-page/[pk]/page.tsx +23 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/forms/[pk]/generate/page.tsx +2 -3
- package/app-template/src/app/[pz]/group-product/[pk]/page.tsx +93 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/landing-page/[pk]/page.tsx +2 -4
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/layout.tsx +6 -11
- package/app-template/src/app/[pz]/list/page.tsx +26 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/not-found.tsx +5 -7
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/completed/[token]/page.tsx +6 -4
- package/app-template/src/app/[pz]/page.tsx +28 -0
- package/app-template/src/app/[pz]/pages/[slug]/page.tsx +19 -0
- package/app-template/src/app/[pz]/product/[pk]/page.tsx +102 -0
- package/app-template/src/app/[pz]/special-page/[pk]/page.tsx +35 -0
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/email-set-primary/[[...id]]/page.tsx +3 -4
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/registration/account-confirm-email/[[...id]]/page.tsx +3 -3
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/reset/[[...id]]/page.tsx +41 -5
- package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/xml-sitemap/[node]/route.ts +8 -6
- package/app-template/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/app-template/src/app/api/barcode-search/route.ts +1 -0
- package/app-template/src/app/api/cache/route.ts +1 -1
- package/app-template/src/app/api/form/[...id]/route.ts +1 -7
- package/app-template/src/app/api/image-proxy/route.ts +1 -0
- package/app-template/src/app/api/logout/route.ts +1 -1
- package/app-template/src/app/api/product-categories/route.ts +1 -0
- package/app-template/src/app/api/similar-product-list/route.ts +1 -0
- package/app-template/src/app/api/similar-products/route.ts +1 -0
- package/app-template/src/app/api/theme-settings/route.ts +12 -0
- package/app-template/src/app/api/virtual-try-on/limited-categories/route.ts +1 -0
- package/app-template/src/app/api/virtual-try-on/route.ts +1 -0
- package/app-template/src/app/api/web-vitals/route.ts +1 -1
- package/app-template/src/assets/fonts/pz-icon.css +211 -49
- package/app-template/src/assets/fonts/pz-icon.eot +0 -0
- package/app-template/src/assets/fonts/pz-icon.html +486 -0
- package/app-template/src/assets/fonts/pz-icon.scss +373 -49
- package/app-template/src/assets/fonts/pz-icon.svg +215 -53
- package/app-template/src/assets/fonts/pz-icon.ttf +0 -0
- package/app-template/src/assets/fonts/pz-icon.woff +0 -0
- package/app-template/src/assets/fonts/pz-icon.woff2 +0 -0
- package/app-template/src/assets/globals.scss +8 -133
- package/app-template/src/assets/icons/arrow-right.svg +3 -0
- package/app-template/src/assets/icons/cart.svg +4 -12
- package/app-template/src/assets/icons/check.svg +2 -18
- package/app-template/src/assets/icons/chevron-down.svg +2 -7
- package/app-template/src/assets/icons/delete.svg +3 -0
- package/app-template/src/assets/icons/facebook.svg +2 -8
- package/app-template/src/assets/icons/fav-off.svg +5 -0
- package/app-template/src/assets/icons/fav-on.svg +5 -0
- package/app-template/src/assets/icons/filter-and-sort.svg +3 -0
- package/app-template/src/assets/icons/heart.svg +3 -0
- package/app-template/src/assets/icons/instagram.svg +2 -13
- package/app-template/src/assets/icons/materials.svg +3 -0
- package/app-template/src/assets/icons/person.svg +4 -0
- package/app-template/src/assets/icons/pinterest.svg +5 -11
- package/app-template/src/assets/icons/ruler.svg +3 -0
- package/app-template/src/assets/icons/search.svg +8 -11
- package/app-template/src/assets/icons/share.svg +2 -9
- package/app-template/src/assets/icons/snapchat.svg +3 -0
- package/app-template/src/assets/icons/tiktok.svg +3 -0
- package/app-template/src/assets/icons/tumblr.svg +6 -0
- package/app-template/src/assets/icons/twitter.svg +2 -10
- package/app-template/src/assets/icons/vimeo.svg +3 -0
- package/app-template/src/assets/icons/youtube.svg +3 -0
- package/app-template/src/assets/icons/zoom.svg +8 -0
- package/app-template/src/auth.ts +3 -0
- package/app-template/src/components/__tests__/badge.test.tsx +2 -2
- package/app-template/src/components/__tests__/link.test.tsx +2 -0
- package/app-template/src/components/accordion.tsx +48 -23
- package/app-template/src/components/action-tooltip.tsx +160 -0
- package/app-template/src/components/button.tsx +1 -1
- package/app-template/src/components/carousel-core.tsx +4 -11
- package/app-template/src/components/checkbox.tsx +2 -1
- package/app-template/src/components/currency-select.tsx +150 -4
- package/app-template/src/components/file-input.tsx +27 -7
- package/app-template/src/components/generate-form-fields.tsx +49 -10
- package/app-template/src/components/icon.tsx +5 -6
- package/app-template/src/components/index.ts +4 -1
- package/app-template/src/components/input.tsx +11 -5
- package/app-template/src/components/language-select.tsx +88 -2
- package/app-template/src/components/modal.tsx +34 -16
- package/app-template/src/components/pagination.tsx +133 -20
- package/app-template/src/components/price.tsx +1 -1
- package/app-template/src/components/pwa-tags.tsx +1 -0
- package/app-template/src/components/quantity-input.tsx +63 -0
- package/app-template/src/components/quantity-selector.tsx +215 -0
- package/app-template/src/components/route-handler.tsx +50 -0
- package/app-template/src/components/select.tsx +86 -54
- package/app-template/src/components/shimmer.tsx +1 -1
- package/app-template/src/components/types/index.ts +51 -1
- package/app-template/src/components/widget-content.tsx +323 -0
- package/app-template/src/data/server/theme.ts +70 -0
- package/app-template/src/hooks/use-fav-button.tsx +9 -10
- package/app-template/src/hooks/use-product-cart.ts +80 -0
- package/app-template/src/hooks/use-stock-alert.ts +74 -0
- package/app-template/src/hooks/use-theme-settings.ts +42 -0
- package/app-template/src/lib/fonts.ts +149 -0
- package/app-template/src/plugins.js +12 -2
- package/app-template/src/{middleware.ts → proxy.ts} +3 -3
- package/app-template/src/redux/middlewares/category.ts +5 -4
- package/app-template/src/redux/store.ts +21 -1
- package/app-template/src/routes/index.ts +8 -7
- package/app-template/src/settings.js +6 -3
- package/app-template/src/types/hookform-resolvers-yup.d.ts +28 -0
- package/app-template/src/types/index.ts +74 -3
- package/app-template/src/types/next-auth.d.ts +2 -2
- package/app-template/src/types/widget.ts +169 -0
- package/app-template/src/utils/__tests__/theme-page-context.test.ts +145 -0
- package/app-template/src/utils/formatDate.ts +48 -0
- package/app-template/src/utils/styles.ts +71 -0
- package/app-template/src/utils/theme-page-context.ts +309 -0
- package/app-template/src/utils/variant-validation.ts +41 -0
- package/app-template/src/views/account/address-form.tsx +8 -4
- package/app-template/src/views/account/contact-form.tsx +148 -131
- package/app-template/src/views/account/content-header.tsx +4 -3
- package/app-template/src/views/account/faq/faq-tabs.tsx +8 -2
- package/app-template/src/views/account/favorite-item.tsx +1 -1
- package/app-template/src/views/account/order.tsx +11 -9
- package/app-template/src/views/account/orders/order-cancellation-item.tsx +1 -1
- package/app-template/src/views/account/orders/order-detail-header.tsx +1 -1
- package/app-template/src/views/anonymous-tracking/order-detail/index.tsx +45 -38
- package/app-template/src/views/basket/basket-item.tsx +6 -1
- package/app-template/src/views/basket/summary.tsx +16 -0
- package/app-template/src/views/breadcrumb.tsx +2 -2
- package/app-template/src/views/category/category-banner.tsx +4 -23
- package/app-template/src/views/category/category-info.tsx +2 -1
- package/app-template/src/views/category/filters/filter-item.tsx +138 -42
- package/app-template/src/views/category/filters/index.tsx +1 -1
- package/app-template/src/views/category/layout.tsx +1 -0
- package/app-template/src/views/checkout/auth.tsx +64 -40
- package/app-template/src/views/checkout/layout/header.tsx +10 -6
- package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +22 -6
- package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +25 -5
- package/app-template/src/views/checkout/steps/payment/options/loyalty.tsx +21 -2
- package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +27 -5
- package/app-template/src/views/checkout/steps/payment/options/store-credit.tsx +464 -0
- package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +4 -4
- package/app-template/src/views/checkout/steps/shipping/address-box.tsx +33 -20
- package/app-template/src/views/checkout/steps/shipping/addresses.tsx +2 -2
- package/app-template/src/views/checkout/summary.tsx +12 -2
- package/app-template/src/views/find-in-store/index.tsx +2 -2
- package/app-template/src/views/guest-login/index.tsx +62 -58
- package/app-template/src/views/header/action-menu.tsx +1 -1
- package/app-template/src/views/header/band.tsx +2 -2
- package/app-template/src/views/header/index.tsx +1 -1
- package/app-template/src/views/header/mini-basket.tsx +3 -3
- package/app-template/src/views/header/mobile-hamburger-button.tsx +5 -8
- package/app-template/src/views/header/mobile-menu.tsx +18 -6
- package/app-template/src/views/header/navbar.tsx +1 -1
- package/app-template/src/views/header/pwa-back-button.tsx +1 -1
- package/app-template/src/views/header/search/index.tsx +13 -3
- package/app-template/src/views/header/search/results.tsx +1 -1
- package/app-template/src/views/header/user-menu.tsx +1 -3
- package/app-template/src/views/login/index.tsx +66 -57
- package/app-template/src/views/otp-login/index.tsx +11 -6
- package/app-template/src/views/product/index.ts +1 -0
- package/app-template/src/views/product/layout.tsx +26 -6
- package/app-template/src/views/product/price-wrapper.tsx +3 -24
- package/app-template/src/views/product/product-actions.tsx +165 -0
- package/app-template/src/views/product/product-info.tsx +76 -238
- package/app-template/src/views/product/product-share.tsx +58 -0
- package/app-template/src/views/product/product-variants.tsx +26 -0
- package/app-template/src/views/product/slider.tsx +22 -1
- package/app-template/src/views/product/variant.tsx +69 -41
- package/app-template/src/views/product-pointer-banner-item.tsx +1 -1
- package/app-template/src/views/register/index.tsx +31 -46
- package/app-template/src/views/sales-contract-modal/index.tsx +17 -17
- package/app-template/src/views/share/index.tsx +9 -6
- package/app-template/src/views/widgets/home-hero-slider-content.tsx +41 -39
- package/app-template/src/widgets/flatpages/about-us/index.tsx +78 -0
- package/app-template/src/widgets/flatpages/blog-list/index.tsx +129 -0
- package/app-template/src/widgets/footer-info.tsx +1 -1
- package/app-template/src/widgets/footer-menu.tsx +7 -3
- package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +17 -14
- package/app-template/src/widgets/footer-subscription/index.tsx +1 -1
- package/app-template/src/widgets/home-stories-eng.tsx +43 -35
- package/app-template/src/widgets/index.ts +7 -0
- package/app-template/src/widgets/schemas/about-us.json +46 -0
- package/app-template/src/widgets/schemas/blog-list.json +37 -0
- package/app-template/src/widgets/schemas/blog.json +29 -0
- package/app-template/tailwind.config.js +155 -7
- package/app-template/tsconfig.json +29 -11
- package/codemods/migrate-auth-v5/index.js +339 -0
- package/codemods/migrate-auth-v5/transform.js +86 -0
- package/codemods/migrate-segments/index.js +591 -0
- package/codemods/update-tailwind-config/index.js +30 -0
- package/codemods/update-tailwind-config/transform.js +102 -0
- package/codemods/upgrade-to-2/index.js +549 -0
- package/commands/codemod.ts +0 -1
- package/commands/plugins.ts +111 -46
- package/dist/commands/codemod.js +0 -1
- package/dist/commands/plugins.js +104 -36
- package/package.json +3 -2
- package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/page.tsx +0 -22
- package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/page.tsx +0 -20
- package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/page.tsx +0 -74
- package/app-template/src/app/[commerce]/[locale]/[currency]/list/page.tsx +0 -18
- package/app-template/src/app/[commerce]/[locale]/[currency]/page.tsx +0 -50
- package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/page.tsx +0 -84
- package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/page.tsx +0 -27
- package/app-template/src/pages/api/auth/[...nextauth].ts +0 -3
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/address/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/change-email/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/change-password/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/contact/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/coupons/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/email-verification/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/faq/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/favourite-products/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/my-quotations/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/layout.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/anonymous-tracking/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/auth/oauth-login/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/basket-b2b/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/category/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/client-root.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/contact-us/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/error.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/flat-page/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/group-product/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/landing-page/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/list/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/checkout/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/completed/[token]/layout.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/special-page/[pk]/loading.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/template.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/password/reset/page.tsx +0 -0
- /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/xml-sitemap/route.ts +0 -0
package/commands/plugins.ts
CHANGED
|
@@ -2,8 +2,7 @@ import * as fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
4
|
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
const Prompt = require('prompt-checkbox');
|
|
5
|
+
import { checkbox } from '@inquirer/prompts';
|
|
7
6
|
|
|
8
7
|
const rootDir = path.resolve(process.cwd());
|
|
9
8
|
|
|
@@ -30,7 +29,14 @@ async function checkVersion(pkg: PackageJson) {
|
|
|
30
29
|
|
|
31
30
|
if (!semver.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
32
31
|
console.warn(
|
|
33
|
-
`\x1b[
|
|
32
|
+
`\x1b[43m Warning: The "${packageName}" package is currently at`,
|
|
33
|
+
`\x1b[41m version ${pkg.dependencies['@akinon/next']}`,
|
|
34
|
+
`\x1b[43m Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`,
|
|
35
|
+
'\x1b[0m\n'
|
|
36
|
+
);
|
|
37
|
+
} else {
|
|
38
|
+
console.log(
|
|
39
|
+
`\x1b[42m Info: The package "${packageName}" is currently in the current version (${latestVersion}).`,
|
|
34
40
|
'\x1b[0m\n'
|
|
35
41
|
);
|
|
36
42
|
}
|
|
@@ -55,7 +61,27 @@ export default async () => {
|
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
function findPackageJson(): PackageJson {
|
|
65
|
+
const packageJsonPaths = [
|
|
66
|
+
path.resolve(rootDir, './package.json'),
|
|
67
|
+
path.resolve(rootDir, './apps/projectzeronext/package.json')
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
for (const packageJsonPath of packageJsonPaths) {
|
|
71
|
+
try {
|
|
72
|
+
const pkg = require(packageJsonPath);
|
|
73
|
+
if (pkg.dependencies['@akinon/next']) {
|
|
74
|
+
return pkg;
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
throw new Error('Could not find package.json with @akinon/next dependency');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const pkg = findPackageJson();
|
|
59
85
|
await checkVersion(pkg);
|
|
60
86
|
|
|
61
87
|
const pluginsFilePath = findPluginsFilePath();
|
|
@@ -70,45 +96,65 @@ export default async () => {
|
|
|
70
96
|
}
|
|
71
97
|
|
|
72
98
|
const definedPlugins = [
|
|
99
|
+
{
|
|
100
|
+
name: 'Akifast',
|
|
101
|
+
value: 'pz-akifast'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Apple Pay',
|
|
105
|
+
value: 'pz-apple-pay'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'B2B',
|
|
109
|
+
value: 'pz-b2b'
|
|
110
|
+
},
|
|
73
111
|
{
|
|
74
112
|
name: 'Basket Gift Pack',
|
|
75
113
|
value: 'pz-basket-gift-pack'
|
|
76
114
|
},
|
|
77
115
|
{
|
|
78
|
-
name: '
|
|
79
|
-
value: 'pz-
|
|
116
|
+
name: 'BKM Express',
|
|
117
|
+
value: 'pz-bkm'
|
|
80
118
|
},
|
|
81
119
|
{
|
|
82
120
|
name: 'Checkout Gift Pack',
|
|
83
121
|
value: 'pz-checkout-gift-pack'
|
|
84
122
|
},
|
|
85
123
|
{
|
|
86
|
-
name: '
|
|
87
|
-
value: 'pz-
|
|
124
|
+
name: 'Click & Collect',
|
|
125
|
+
value: 'pz-click-collect'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'Credit Payment',
|
|
129
|
+
value: 'pz-credit-payment'
|
|
88
130
|
},
|
|
89
131
|
{
|
|
90
132
|
name: 'Garanti Pay',
|
|
91
133
|
value: 'pz-gpay'
|
|
92
134
|
},
|
|
93
135
|
{
|
|
94
|
-
name: '
|
|
95
|
-
value: 'pz-
|
|
136
|
+
name: 'Masterpass',
|
|
137
|
+
value: 'pz-masterpass'
|
|
96
138
|
},
|
|
97
139
|
{
|
|
98
|
-
name: '
|
|
99
|
-
value: 'pz-
|
|
140
|
+
name: 'Multi Basket',
|
|
141
|
+
value: 'pz-multi-basket'
|
|
100
142
|
},
|
|
101
143
|
{
|
|
102
|
-
name: '
|
|
103
|
-
value: 'pz-
|
|
144
|
+
name: 'One Click Checkout',
|
|
145
|
+
value: 'pz-one-click-checkout'
|
|
104
146
|
},
|
|
105
147
|
{
|
|
106
|
-
name: '
|
|
107
|
-
value: 'pz-
|
|
148
|
+
name: 'Otp',
|
|
149
|
+
value: 'pz-otp'
|
|
108
150
|
},
|
|
109
151
|
{
|
|
110
|
-
name: '
|
|
111
|
-
value: 'pz-
|
|
152
|
+
name: 'Pay On Delivery',
|
|
153
|
+
value: 'pz-pay-on-delivery'
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'Saved Card',
|
|
157
|
+
value: 'pz-saved-card'
|
|
112
158
|
},
|
|
113
159
|
{
|
|
114
160
|
name: 'Tabby Payment Extension',
|
|
@@ -117,39 +163,56 @@ export default async () => {
|
|
|
117
163
|
{
|
|
118
164
|
name: 'Tamara Payment Extension',
|
|
119
165
|
value: 'pz-tamara-extension'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'Hepsipay',
|
|
169
|
+
value: 'pz-hepsipay'
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'Flow Payment',
|
|
173
|
+
value: 'pz-flow-payment'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'Virtual Try-On',
|
|
177
|
+
value: 'pz-virtual-try-on'
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'Masterpass Rest',
|
|
181
|
+
value: 'pz-masterpass-rest'
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'Similar Products',
|
|
185
|
+
value: 'pz-similar-products'
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'Haso Payment Gateway',
|
|
189
|
+
value: 'pz-haso'
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'Google Pay',
|
|
193
|
+
value: 'pz-google-pay'
|
|
120
194
|
}
|
|
121
195
|
];
|
|
122
196
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
answer.replace(/\d\)\s/, '')
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const values = formattedAnswers.map(
|
|
139
|
-
(answer) => definedPlugins.find((p) => p.name === answer)?.value
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
if (formattedAnswers.length) {
|
|
143
|
-
console.log(`\nInstalling ${formattedAnswers.join(', ')}.`);
|
|
144
|
-
} else {
|
|
145
|
-
console.log(`\nUninstalling all plugins.`);
|
|
197
|
+
try {
|
|
198
|
+
const answers = await checkbox({
|
|
199
|
+
message: 'Please check/uncheck plugins to install/uninstall.',
|
|
200
|
+
choices: definedPlugins.map((plugin) => ({
|
|
201
|
+
name: plugin.name,
|
|
202
|
+
value: plugin.value,
|
|
203
|
+
checked: installedPlugins.includes(plugin.value)
|
|
204
|
+
}))
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (!answers.length) {
|
|
208
|
+
console.log('\x1b[33m%s\x1b[0m', `\nUninstalling all plugins.`);
|
|
146
209
|
}
|
|
147
210
|
|
|
148
|
-
console.log(`\nPlease wait...`);
|
|
211
|
+
console.log('\x1b[36m%s\x1b[0m', `\nPlease wait...`);
|
|
149
212
|
|
|
150
213
|
fs.writeFileSync(
|
|
151
214
|
pluginsFilePath,
|
|
152
|
-
`module.exports = ${JSON.stringify(
|
|
215
|
+
`module.exports = ${JSON.stringify(answers)};\n`,
|
|
153
216
|
{
|
|
154
217
|
encoding: 'utf-8'
|
|
155
218
|
}
|
|
@@ -159,11 +222,13 @@ export default async () => {
|
|
|
159
222
|
|
|
160
223
|
console.log(
|
|
161
224
|
'\x1b[32m%s\x1b[0m',
|
|
162
|
-
`\n
|
|
163
|
-
|
|
225
|
+
`\n✓ ${
|
|
226
|
+
answers.length
|
|
164
227
|
? 'Installed selected plugins'
|
|
165
228
|
: 'Uninstalled all plugins'
|
|
166
229
|
}.\n`
|
|
167
230
|
);
|
|
168
|
-
})
|
|
231
|
+
} catch (error) {
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
169
234
|
};
|
package/dist/commands/codemod.js
CHANGED
|
@@ -8,7 +8,6 @@ const yargs = require('yargs/yargs');
|
|
|
8
8
|
const { hideBin } = require('yargs/helpers');
|
|
9
9
|
const args = yargs(hideBin(process.argv)).argv;
|
|
10
10
|
exports.default = () => {
|
|
11
|
-
const workingDir = path_1.default.resolve(process.cwd());
|
|
12
11
|
const codemodName = args.codemod;
|
|
13
12
|
const codemodPath = path_1.default.resolve(__dirname, `../../codemods/${codemodName}/index.js`);
|
|
14
13
|
const codemod = require(codemodPath);
|
package/dist/commands/plugins.js
CHANGED
|
@@ -49,7 +49,7 @@ const fs = __importStar(require("fs"));
|
|
|
49
49
|
const path_1 = __importDefault(require("path"));
|
|
50
50
|
const child_process_1 = require("child_process");
|
|
51
51
|
const semver_1 = __importDefault(require("semver"));
|
|
52
|
-
const
|
|
52
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
53
53
|
const rootDir = path_1.default.resolve(process.cwd());
|
|
54
54
|
function checkVersion(pkg) {
|
|
55
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -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 = [];
|
|
@@ -94,45 +115,65 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
94
115
|
process.exit(1);
|
|
95
116
|
}
|
|
96
117
|
const definedPlugins = [
|
|
118
|
+
{
|
|
119
|
+
name: 'Akifast',
|
|
120
|
+
value: 'pz-akifast'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'Apple Pay',
|
|
124
|
+
value: 'pz-apple-pay'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'B2B',
|
|
128
|
+
value: 'pz-b2b'
|
|
129
|
+
},
|
|
97
130
|
{
|
|
98
131
|
name: 'Basket Gift Pack',
|
|
99
132
|
value: 'pz-basket-gift-pack'
|
|
100
133
|
},
|
|
101
134
|
{
|
|
102
|
-
name: '
|
|
103
|
-
value: 'pz-
|
|
135
|
+
name: 'BKM Express',
|
|
136
|
+
value: 'pz-bkm'
|
|
104
137
|
},
|
|
105
138
|
{
|
|
106
139
|
name: 'Checkout Gift Pack',
|
|
107
140
|
value: 'pz-checkout-gift-pack'
|
|
108
141
|
},
|
|
109
142
|
{
|
|
110
|
-
name: '
|
|
111
|
-
value: 'pz-
|
|
143
|
+
name: 'Click & Collect',
|
|
144
|
+
value: 'pz-click-collect'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'Credit Payment',
|
|
148
|
+
value: 'pz-credit-payment'
|
|
112
149
|
},
|
|
113
150
|
{
|
|
114
151
|
name: 'Garanti Pay',
|
|
115
152
|
value: 'pz-gpay'
|
|
116
153
|
},
|
|
117
154
|
{
|
|
118
|
-
name: '
|
|
119
|
-
value: 'pz-
|
|
155
|
+
name: 'Masterpass',
|
|
156
|
+
value: 'pz-masterpass'
|
|
120
157
|
},
|
|
121
158
|
{
|
|
122
|
-
name: '
|
|
123
|
-
value: 'pz-
|
|
159
|
+
name: 'Multi Basket',
|
|
160
|
+
value: 'pz-multi-basket'
|
|
124
161
|
},
|
|
125
162
|
{
|
|
126
|
-
name: '
|
|
127
|
-
value: 'pz-
|
|
163
|
+
name: 'One Click Checkout',
|
|
164
|
+
value: 'pz-one-click-checkout'
|
|
128
165
|
},
|
|
129
166
|
{
|
|
130
|
-
name: '
|
|
131
|
-
value: 'pz-
|
|
167
|
+
name: 'Otp',
|
|
168
|
+
value: 'pz-otp'
|
|
132
169
|
},
|
|
133
170
|
{
|
|
134
|
-
name: '
|
|
135
|
-
value: 'pz-
|
|
171
|
+
name: 'Pay On Delivery',
|
|
172
|
+
value: 'pz-pay-on-delivery'
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'Saved Card',
|
|
176
|
+
value: 'pz-saved-card'
|
|
136
177
|
},
|
|
137
178
|
{
|
|
138
179
|
name: 'Tabby Payment Extension',
|
|
@@ -141,31 +182,58 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
141
182
|
{
|
|
142
183
|
name: 'Tamara Payment Extension',
|
|
143
184
|
value: 'pz-tamara-extension'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'Hepsipay',
|
|
188
|
+
value: 'pz-hepsipay'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'Flow Payment',
|
|
192
|
+
value: 'pz-flow-payment'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'Virtual Try-On',
|
|
196
|
+
value: 'pz-virtual-try-on'
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'Masterpass Rest',
|
|
200
|
+
value: 'pz-masterpass-rest'
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: 'Similar Products',
|
|
204
|
+
value: 'pz-similar-products'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: 'Haso Payment Gateway',
|
|
208
|
+
value: 'pz-haso'
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'Google Pay',
|
|
212
|
+
value: 'pz-google-pay'
|
|
144
213
|
}
|
|
145
214
|
];
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
console.log(`\nInstalling ${formattedAnswers.join(', ')}.`);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
console.log(`\nUninstalling all plugins.`);
|
|
215
|
+
try {
|
|
216
|
+
const answers = yield (0, prompts_1.checkbox)({
|
|
217
|
+
message: 'Please check/uncheck plugins to install/uninstall.',
|
|
218
|
+
choices: definedPlugins.map((plugin) => ({
|
|
219
|
+
name: plugin.name,
|
|
220
|
+
value: plugin.value,
|
|
221
|
+
checked: installedPlugins.includes(plugin.value)
|
|
222
|
+
}))
|
|
223
|
+
});
|
|
224
|
+
if (!answers.length) {
|
|
225
|
+
console.log('\x1b[33m%s\x1b[0m', `\nUninstalling all plugins.`);
|
|
161
226
|
}
|
|
162
|
-
console.log(`\nPlease wait...`);
|
|
163
|
-
fs.writeFileSync(pluginsFilePath, `module.exports = ${JSON.stringify(
|
|
227
|
+
console.log('\x1b[36m%s\x1b[0m', `\nPlease wait...`);
|
|
228
|
+
fs.writeFileSync(pluginsFilePath, `module.exports = ${JSON.stringify(answers)};\n`, {
|
|
164
229
|
encoding: 'utf-8'
|
|
165
230
|
});
|
|
166
231
|
(0, child_process_1.execSync)('yarn install', { stdio: 'pipe' });
|
|
167
|
-
console.log('\x1b[32m%s\x1b[0m', `\n
|
|
232
|
+
console.log('\x1b[32m%s\x1b[0m', `\n✓ ${answers.length
|
|
168
233
|
? 'Installed selected plugins'
|
|
169
234
|
: 'Uninstalled all plugins'}.\n`);
|
|
170
|
-
}
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
171
239
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/projectzero",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI tool to manage your Project Zero Next project",
|
|
6
6
|
"bin": {
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"@types/temp": "0.9.4"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"jscodeshift": "^0.15.1",
|
|
23
|
+
"@inquirer/prompts": "7.5.0",
|
|
22
24
|
"loading-spinner": "1.2.1",
|
|
23
|
-
"prompt-checkbox": "2.2.0",
|
|
24
25
|
"semver": "7.6.2",
|
|
25
26
|
"temp": "0.9.4",
|
|
26
27
|
"yargs": "^17.6.0"
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getCategoryData } from '@akinon/next/data/server';
|
|
2
|
-
import { withSegmentDefaults } from '@akinon/next/hocs/server';
|
|
3
|
-
import { PageProps } from '@akinon/next/types';
|
|
4
|
-
import CategoryLayout from '@theme/views/category/layout';
|
|
5
|
-
|
|
6
|
-
async function Page(props: PageProps<{ pk: number }>) {
|
|
7
|
-
const params = await props.params;
|
|
8
|
-
const searchParams = await props.searchParams;
|
|
9
|
-
|
|
10
|
-
const { data, breadcrumbData } = await getCategoryData({
|
|
11
|
-
pk: params.pk,
|
|
12
|
-
searchParams
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<>
|
|
17
|
-
<CategoryLayout data={data} breadcrumbData={breadcrumbData} />
|
|
18
|
-
</>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { getFlatPageData } from '@akinon/next/data/server';
|
|
2
|
-
import { withSegmentDefaults } from '@akinon/next/hocs/server';
|
|
3
|
-
import { PageProps } from '@akinon/next/types';
|
|
4
|
-
|
|
5
|
-
async function Page(props: PageProps<{ pk: number }>) {
|
|
6
|
-
const params = await props.params;
|
|
7
|
-
|
|
8
|
-
const data = await getFlatPageData({ pk: params.pk });
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<div className="container mx-auto py-6">
|
|
12
|
-
<div
|
|
13
|
-
className="mx-auto prose prose-headings:text-primary"
|
|
14
|
-
dangerouslySetInnerHTML={{ __html: data.flat_page.content }}
|
|
15
|
-
/>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import ProductLayout from '@theme/views/product/layout';
|
|
2
|
-
import { ProductGroupInfo } from '@theme/views/product';
|
|
3
|
-
import { getProductData, getWidgetData } from '@akinon/next/data/server';
|
|
4
|
-
import { withSegmentDefaults } from '@akinon/next/hocs/server';
|
|
5
|
-
import { PageProps, Metadata } from '@akinon/next/types';
|
|
6
|
-
import { generateJsonLd } from '@theme/utils/generate-jsonld';
|
|
7
|
-
|
|
8
|
-
export async function generateMetadata(props: PageProps): Promise<Metadata> {
|
|
9
|
-
let result: Metadata = {};
|
|
10
|
-
const searchParams = await props.searchParams;
|
|
11
|
-
const params = await props.params;
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const {
|
|
15
|
-
data: { product }
|
|
16
|
-
} = await getProductData({
|
|
17
|
-
pk: params.pk,
|
|
18
|
-
searchParams,
|
|
19
|
-
groupProduct: true
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
result = {
|
|
23
|
-
title: product.name,
|
|
24
|
-
description: String(product.attributes.description),
|
|
25
|
-
twitter: {
|
|
26
|
-
title: product.name,
|
|
27
|
-
description: String(product.attributes.description)
|
|
28
|
-
},
|
|
29
|
-
openGraph: {
|
|
30
|
-
title: product.name,
|
|
31
|
-
description: String(product.attributes.description),
|
|
32
|
-
images: product.productimage_set?.map((item) => ({
|
|
33
|
-
url: item.image
|
|
34
|
-
}))
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
// eslint-disable-next-line no-empty
|
|
38
|
-
} catch (error) {}
|
|
39
|
-
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async function Page(props: PageProps<{ pk: number }>) {
|
|
44
|
-
const params = await props.params;
|
|
45
|
-
const searchParams = await props.searchParams;
|
|
46
|
-
|
|
47
|
-
const [{ data, breadcrumbData }, deliveryReturn] = await Promise.all([
|
|
48
|
-
getProductData({
|
|
49
|
-
pk: params.pk,
|
|
50
|
-
searchParams,
|
|
51
|
-
groupProduct: true
|
|
52
|
-
}),
|
|
53
|
-
getWidgetData({ slug: 'product-delivery-returns' })
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
const jsonLd = generateJsonLd(data.product);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<>
|
|
60
|
-
<ProductLayout data={data} breadcrumbData={breadcrumbData}>
|
|
61
|
-
<ProductGroupInfo
|
|
62
|
-
data={data}
|
|
63
|
-
deliveryReturn={deliveryReturn?.attributes}
|
|
64
|
-
/>
|
|
65
|
-
</ProductLayout>
|
|
66
|
-
<script
|
|
67
|
-
type="application/ld+json"
|
|
68
|
-
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
|
|
69
|
-
/>
|
|
70
|
-
</>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getListData } from '@akinon/next/data/server';
|
|
2
|
-
import { withSegmentDefaults } from '@akinon/next/hocs/server';
|
|
3
|
-
import { PageProps } from '@akinon/next/types';
|
|
4
|
-
import CategoryLayout from '@theme/views/category/layout';
|
|
5
|
-
|
|
6
|
-
async function Page(props: PageProps) {
|
|
7
|
-
const searchParams = await props.searchParams;
|
|
8
|
-
|
|
9
|
-
const data = await getListData({ searchParams });
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<>
|
|
13
|
-
<CategoryLayout data={data} />
|
|
14
|
-
</>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default withSegmentDefaults(Page, { segmentType: 'page' });
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import 'server-only';
|
|
2
|
-
|
|
3
|
-
import { HOME_WIDGETS } from '@theme/widgets';
|
|
4
|
-
import { getWidgetData } from '@akinon/next/data/server';
|
|
5
|
-
import { withSegmentDefaults } from '@akinon/next/hocs/server';
|
|
6
|
-
import LazyComponent from '@akinon/next/components/lazy-component';
|
|
7
|
-
|
|
8
|
-
type HomeWidgetOrderType = {
|
|
9
|
-
widget_order: Array<{
|
|
10
|
-
value: { item_slug: string };
|
|
11
|
-
kwargs: { value: object; data_type: string };
|
|
12
|
-
}>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const dynamic = 'force-static';
|
|
16
|
-
export const revalidate = 600;
|
|
17
|
-
|
|
18
|
-
async function Page() {
|
|
19
|
-
const data = await getWidgetData<HomeWidgetOrderType>({
|
|
20
|
-
slug: 'home-widget-order'
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (!data?.attributes?.widget_order) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return data.attributes.widget_order.map((widget, index) => {
|
|
28
|
-
const Widget = HOME_WIDGETS[widget.value.item_slug];
|
|
29
|
-
|
|
30
|
-
if (Widget) {
|
|
31
|
-
if (index > 2) {
|
|
32
|
-
return (
|
|
33
|
-
<LazyComponent key={widget.value.item_slug} className="min-h-[150px]">
|
|
34
|
-
<Widget />
|
|
35
|
-
</LazyComponent>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return <Widget key={widget.value.item_slug} />;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return null;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function generateStaticParams() {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default withSegmentDefaults(Page, { segmentType: 'page' });
|