@akinon/projectzero 1.32.0 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/app-template/.editorconfig +7 -0
- package/app-template/.env.example +9 -0
- package/app-template/.eslintignore +1 -0
- package/app-template/.eslintrc.js +31 -0
- package/app-template/.gitattributes +18 -0
- package/app-template/.husky/pre-commit +4 -0
- package/app-template/.lintstagedrc.js +12 -0
- package/app-template/.prettierrc +13 -0
- package/app-template/.releaserc.json +49 -0
- package/app-template/.stylelintrc.json +37 -0
- package/app-template/.vscode/extensions.json +11 -0
- package/app-template/.vscode/launch.json +29 -0
- package/app-template/.yarnrc +1 -0
- package/app-template/CHANGELOG.md +636 -0
- package/app-template/LICENSE +21 -0
- package/app-template/Procfile +1 -0
- package/app-template/README.md +29 -0
- package/app-template/akinon.json +28 -0
- package/app-template/bitbucket-pipelines.yml +54 -0
- package/app-template/build.sh +7 -0
- package/app-template/docs/CHANGELOG.md +85 -0
- package/app-template/docs/advanced-usage.md +43 -0
- package/app-template/docs/basic-setup.md +59 -0
- package/app-template/docs/data-fetching/client/account.md +1064 -0
- package/app-template/docs/data-fetching/client/address.md +805 -0
- package/app-template/docs/data-fetching/client/basket.md +107 -0
- package/app-template/docs/data-fetching/client/checkout.md +904 -0
- package/app-template/docs/data-fetching/client/misc.md +135 -0
- package/app-template/docs/data-fetching/client/product.md +284 -0
- package/app-template/docs/data-fetching/client/user.md +56 -0
- package/app-template/docs/data-fetching/client/wishlist.md +111 -0
- package/app-template/docs/data-fetching/server/category.md +324 -0
- package/app-template/docs/data-fetching/server/flat-page.md +42 -0
- package/app-template/docs/data-fetching/server/list.md +353 -0
- package/app-template/docs/data-fetching/server/menu.md +363 -0
- package/app-template/docs/data-fetching/server/product.md +131 -0
- package/app-template/docs/data-fetching/server/seo.md +44 -0
- package/app-template/docs/data-fetching/server/special-page.md +79 -0
- package/app-template/docs/data-fetching/server/widget.md +218 -0
- package/app-template/docs/delete-account.md +25 -0
- package/app-template/docs/deployment.md +46 -0
- package/app-template/docs/dynamic-route.md +33 -0
- package/app-template/docs/icons.md +52 -0
- package/app-template/docs/localization.md +204 -0
- package/app-template/docs/logging.md +48 -0
- package/app-template/docs/plugins.md +76 -0
- package/app-template/docs/seo-management.md +125 -0
- package/app-template/docs/static-assets.md +36 -0
- package/app-template/docs/widgets.md +127 -0
- package/app-template/global.d.ts +1 -0
- package/app-template/jest.config.ts +34 -0
- package/app-template/next-env.d.ts +6 -0
- package/app-template/next.config.mjs +34 -0
- package/app-template/package.json +97 -0
- package/app-template/plugins.d.ts +1 -0
- package/app-template/postcss.config.js +6 -0
- package/app-template/public/404.png +0 -0
- package/app-template/public/500.png +0 -0
- package/app-template/public/apple-splash-1125-2436.jpg +0 -0
- package/app-template/public/apple-splash-1136-640.jpg +0 -0
- package/app-template/public/apple-splash-1170-2532.jpg +0 -0
- package/app-template/public/apple-splash-1242-2208.jpg +0 -0
- package/app-template/public/apple-splash-1242-2688.jpg +0 -0
- package/app-template/public/apple-splash-1284-2778.jpg +0 -0
- package/app-template/public/apple-splash-1334-750.jpg +0 -0
- package/app-template/public/apple-splash-1536-2048.jpg +0 -0
- package/app-template/public/apple-splash-1620-2160.jpg +0 -0
- package/app-template/public/apple-splash-1668-2224.jpg +0 -0
- package/app-template/public/apple-splash-1668-2388.jpg +0 -0
- package/app-template/public/apple-splash-1792-828.jpg +0 -0
- package/app-template/public/apple-splash-2048-1536.jpg +0 -0
- package/app-template/public/apple-splash-2048-2732.jpg +0 -0
- package/app-template/public/apple-splash-2160-1620.jpg +0 -0
- package/app-template/public/apple-splash-2208-1242.jpg +0 -0
- package/app-template/public/apple-splash-2224-1668.jpg +0 -0
- package/app-template/public/apple-splash-2388-1668.jpg +0 -0
- package/app-template/public/apple-splash-2436-1125.jpg +0 -0
- package/app-template/public/apple-splash-2532-1170.jpg +0 -0
- package/app-template/public/apple-splash-2688-1242.jpg +0 -0
- package/app-template/public/apple-splash-2732-2048.jpg +0 -0
- package/app-template/public/apple-splash-2778-1284.jpg +0 -0
- package/app-template/public/apple-splash-640-1136.jpg +0 -0
- package/app-template/public/apple-splash-750-1334.jpg +0 -0
- package/app-template/public/apple-splash-828-1792.jpg +0 -0
- package/app-template/public/apple-touch-icon-152x152.png +0 -0
- package/app-template/public/apple-touch-icon-167x167.png +0 -0
- package/app-template/public/apple-touch-icon-180x180.png +0 -0
- package/app-template/public/apple-touch-icon.png +0 -0
- package/app-template/public/apple.svg +47 -0
- package/app-template/public/cvv.jpg +0 -0
- package/app-template/public/facebook.svg +3 -0
- package/app-template/public/google.svg +12 -0
- package/app-template/public/icon-192x192.png +0 -0
- package/app-template/public/icon-256x256.png +0 -0
- package/app-template/public/icon-384x384.png +0 -0
- package/app-template/public/icon-512x512.png +0 -0
- package/app-template/public/icon-sprite.svg +528 -0
- package/app-template/public/locales/en/account.json +490 -0
- package/app-template/public/locales/en/auth.json +100 -0
- package/app-template/public/locales/en/basket.json +50 -0
- package/app-template/public/locales/en/category.json +26 -0
- package/app-template/public/locales/en/checkout.json +152 -0
- package/app-template/public/locales/en/common.json +65 -0
- package/app-template/public/locales/en/forgot_password.json +41 -0
- package/app-template/public/locales/en/form.json +5 -0
- package/app-template/public/locales/en/product.json +39 -0
- package/app-template/public/locales/tr/account.json +490 -0
- package/app-template/public/locales/tr/auth.json +100 -0
- package/app-template/public/locales/tr/basket.json +50 -0
- package/app-template/public/locales/tr/category.json +26 -0
- package/app-template/public/locales/tr/checkout.json +152 -0
- package/app-template/public/locales/tr/common.json +65 -0
- package/app-template/public/locales/tr/forgot_password.json +41 -0
- package/app-template/public/locales/tr/form.json +5 -0
- package/app-template/public/locales/tr/product.json +39 -0
- package/app-template/public/logo.svg +29 -0
- package/app-template/public/manifest.json +35 -0
- package/app-template/public/mastercard.png +0 -0
- package/app-template/public/mastersecure.png +0 -0
- package/app-template/public/mfs-client.min.js +3 -0
- package/app-template/public/noimage.jpg +0 -0
- package/app-template/public/safari-pinned-tab.svg +320 -0
- package/app-template/public/ssl-secure.png +0 -0
- package/app-template/public/vbv.png +0 -0
- package/app-template/public/visa.png +0 -0
- package/app-template/public/zepto.min.js +2 -0
- package/app-template/sentry.client.config.ts +16 -0
- package/app-template/sentry.edge.config.ts +3 -0
- package/app-template/sentry.properties +4 -0
- package/app-template/sentry.server.config.ts +3 -0
- package/app-template/setupTests.ts +4 -0
- package/app-template/src/__tests__/index.test.tsx +7 -0
- package/app-template/src/__tests__/tsconfig.json +7 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/address/page.tsx +74 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/change-email/page.tsx +174 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/change-password/page.tsx +206 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/contact/page.tsx +7 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/coupons/page.tsx +210 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/email-verification/page.tsx +5 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/faq/page.tsx +23 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/favourite-products/page.tsx +32 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/layout.tsx +28 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/my-quotations/page.tsx +7 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/cancellation/page.tsx +255 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/layout.tsx +5 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/page.tsx +309 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/page.tsx +137 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/page.tsx +226 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/account/profile/page.tsx +399 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/address/stores/page.tsx +271 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/anonymous-tracking/page.tsx +33 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/auth/oauth-login/page.tsx +3 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/auth/page.tsx +76 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/basket/page.tsx +77 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/basket-b2b/page.tsx +7 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/loading.tsx +53 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/page.tsx +16 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/client-root.tsx +9 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/contact-us/page.tsx +11 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/error.tsx +20 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/loading.tsx +5 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/page.tsx +18 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/forms/[pk]/generate/page.tsx +48 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/loading.tsx +5 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/page.tsx +72 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/loading.tsx +5 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/page.tsx +23 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/layout.tsx +78 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/list/loading.tsx +53 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/list/page.tsx +16 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/orders/checkout/page.tsx +140 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/layout.tsx +5 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/page.tsx +284 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/page.tsx +50 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/loading.tsx +67 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/page.tsx +81 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/loading.tsx +53 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/page.tsx +25 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/template.tsx +75 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/users/email-set-primary/[[...id]]/page.tsx +43 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/users/password/reset/page.tsx +79 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/users/registration/account-confirm-email/[[...id]]/page.tsx +43 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/users/reset/[[...id]]/page.tsx +110 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/xml-sitemap/[node]/route.ts +25 -0
- package/app-template/src/app/[commerce]/[locale]/[currency]/xml-sitemap/route.ts +37 -0
- package/app-template/src/app/api/cache/route.ts +1 -0
- package/app-template/src/app/api/client/[...slug]/route.ts +1 -0
- package/app-template/src/app/api/form/[...id]/route.ts +7 -0
- package/app-template/src/app/api/logout/route.ts +1 -0
- package/app-template/src/app/api/sentry/route.ts +9 -0
- package/app-template/src/app/api/web-vitals/route.ts +1 -0
- package/app-template/src/app/favicon.ico +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Black.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Black.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Black.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Black.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Bold.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Bold.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Bold.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Bold.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Italic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Italic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Italic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Italic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Light.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Light.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Light.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Light.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-LightItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-LightItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-LightItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-LightItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Medium.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Medium.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Medium.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Medium.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Regular.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Regular.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Regular.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Regular.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBold.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBold.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBold.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBold.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Thin.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Thin.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Thin.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-Thin.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.eot +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.ttf +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.woff +0 -0
- package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.woff2 +0 -0
- package/app-template/src/assets/fonts/Jost/index.scss +269 -0
- package/app-template/src/assets/fonts/index.scss +1 -0
- package/app-template/src/assets/fonts/pz-icon.css +154 -0
- package/app-template/src/assets/fonts/pz-icon.eot +0 -0
- package/app-template/src/assets/fonts/pz-icon.html +456 -0
- package/app-template/src/assets/fonts/pz-icon.scss +300 -0
- package/app-template/src/assets/fonts/pz-icon.svg +144 -0
- 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 +65 -0
- package/app-template/src/assets/icons/akinon.svg +11 -0
- package/app-template/src/assets/icons/arrow-up.svg +11 -0
- package/app-template/src/assets/icons/bell.svg +1 -0
- package/app-template/src/assets/icons/cart.svg +13 -0
- package/app-template/src/assets/icons/check.svg +19 -0
- package/app-template/src/assets/icons/chevron-down.svg +8 -0
- package/app-template/src/assets/icons/chevron-end.svg +8 -0
- package/app-template/src/assets/icons/chevron-start.svg +8 -0
- package/app-template/src/assets/icons/chevron-up.svg +8 -0
- package/app-template/src/assets/icons/close.svg +12 -0
- package/app-template/src/assets/icons/cvc.svg +54 -0
- package/app-template/src/assets/icons/default.svg +6 -0
- package/app-template/src/assets/icons/directions.svg +14 -0
- package/app-template/src/assets/icons/eye-off.svg +10 -0
- package/app-template/src/assets/icons/eye-on.svg +17 -0
- package/app-template/src/assets/icons/facebook-login.svg +11 -0
- package/app-template/src/assets/icons/facebook.svg +9 -0
- package/app-template/src/assets/icons/giftbox.svg +22 -0
- package/app-template/src/assets/icons/globe.svg +12 -0
- package/app-template/src/assets/icons/google-login.svg +19 -0
- package/app-template/src/assets/icons/google.svg +9 -0
- package/app-template/src/assets/icons/hamburger.svg +5 -0
- package/app-template/src/assets/icons/heart-full.svg +20 -0
- package/app-template/src/assets/icons/heart-stroke.svg +22 -0
- package/app-template/src/assets/icons/info.svg +1 -0
- package/app-template/src/assets/icons/instagram.svg +14 -0
- package/app-template/src/assets/icons/layout-2.svg +7 -0
- package/app-template/src/assets/icons/layout-3.svg +4 -0
- package/app-template/src/assets/icons/logo.svg +24 -0
- package/app-template/src/assets/icons/mail.svg +1 -0
- package/app-template/src/assets/icons/minus.svg +4 -0
- package/app-template/src/assets/icons/money.svg +4 -0
- package/app-template/src/assets/icons/mp-otp.svg +1 -0
- package/app-template/src/assets/icons/pin.svg +16 -0
- package/app-template/src/assets/icons/pinterest.svg +12 -0
- package/app-template/src/assets/icons/plus.svg +5 -0
- package/app-template/src/assets/icons/search.svg +13 -0
- package/app-template/src/assets/icons/share.svg +10 -0
- package/app-template/src/assets/icons/spinner.svg +6 -0
- package/app-template/src/assets/icons/store-pin.svg +14 -0
- package/app-template/src/assets/icons/track-order.svg +1 -0
- package/app-template/src/assets/icons/twitter.svg +11 -0
- package/app-template/src/assets/icons/user.svg +14 -0
- package/app-template/src/assets/icons/whatsapp.svg +45 -0
- package/app-template/src/components/__tests__/Modal.test.tsx +103 -0
- package/app-template/src/components/__tests__/accordion.test.tsx +65 -0
- package/app-template/src/components/__tests__/badge.test.tsx +20 -0
- package/app-template/src/components/__tests__/button.test.tsx +59 -0
- package/app-template/src/components/__tests__/checkbox.test.tsx +57 -0
- package/app-template/src/components/__tests__/file-input.test.tsx +42 -0
- package/app-template/src/components/__tests__/icon.test.tsx +39 -0
- package/app-template/src/components/__tests__/input.test.tsx +69 -0
- package/app-template/src/components/__tests__/language-select.test.tsx +81 -0
- package/app-template/src/components/__tests__/link.test.tsx +65 -0
- package/app-template/src/components/__tests__/price.test.tsx +72 -0
- package/app-template/src/components/__tests__/radio.test.tsx +52 -0
- package/app-template/src/components/__tests__/select.test.tsx +115 -0
- package/app-template/src/components/__tests__/tab.test.tsx +101 -0
- package/app-template/src/components/accordion.tsx +64 -0
- package/app-template/src/components/badge.tsx +21 -0
- package/app-template/src/components/button.tsx +46 -0
- package/app-template/src/components/canonical-url.tsx +21 -0
- package/app-template/src/components/carousel-core.tsx +42 -0
- package/app-template/src/components/checkbox.tsx +28 -0
- package/app-template/src/components/currency-select.tsx +81 -0
- package/app-template/src/components/custom-loader.tsx +21 -0
- package/app-template/src/components/dynamic-form.tsx +17 -0
- package/app-template/src/components/file-input.tsx +8 -0
- package/app-template/src/components/generate-form-fields.tsx +349 -0
- package/app-template/src/components/icon.tsx +18 -0
- package/app-template/src/components/index.ts +41 -0
- package/app-template/src/components/input.tsx +110 -0
- package/app-template/src/components/language-select.tsx +33 -0
- package/app-template/src/components/link.tsx +53 -0
- package/app-template/src/components/loader-spinner.tsx +23 -0
- package/app-template/src/components/modal.tsx +66 -0
- package/app-template/src/components/pagination.tsx +267 -0
- package/app-template/src/components/password-rules-feedback.tsx +60 -0
- package/app-template/src/components/price.tsx +54 -0
- package/app-template/src/components/pwa-tags.tsx +233 -0
- package/app-template/src/components/radio.tsx +18 -0
- package/app-template/src/components/react-portal.tsx +47 -0
- package/app-template/src/components/select.tsx +70 -0
- package/app-template/src/components/shimmer.tsx +21 -0
- package/app-template/src/components/skeleton-article.tsx +15 -0
- package/app-template/src/components/skeleton-product.tsx +14 -0
- package/app-template/src/components/skeleton-profile.tsx +19 -0
- package/app-template/src/components/skeleton-wrapper.tsx +19 -0
- package/app-template/src/components/skeleton.tsx +37 -0
- package/app-template/src/components/source.tsx +12 -0
- package/app-template/src/components/tab-panel.tsx +10 -0
- package/app-template/src/components/tab.tsx +58 -0
- package/app-template/src/components/tabs.tsx +58 -0
- package/app-template/src/components/types/index.ts +89 -0
- package/app-template/src/hooks/index.ts +1 -0
- package/app-template/src/hooks/use-add-product-to-basket.ts +48 -0
- package/app-template/src/hooks/use-contract.tsx +58 -0
- package/app-template/src/hooks/use-fav-button.tsx +99 -0
- package/app-template/src/instrumentation.ts +1 -0
- package/app-template/src/middleware.ts +33 -0
- package/app-template/src/pages/_error.js +14 -0
- package/app-template/src/pages/api/auth/[...nextauth].ts +3 -0
- package/app-template/src/plugins.js +14 -0
- package/app-template/src/redux/middlewares/category.ts +42 -0
- package/app-template/src/redux/reducers/category.ts +67 -0
- package/app-template/src/redux/store.ts +47 -0
- package/app-template/src/routes/index.ts +46 -0
- package/app-template/src/settings.js +62 -0
- package/app-template/src/theme.js +1 -0
- package/app-template/src/types/index.ts +72 -0
- package/app-template/src/types/next-auth.d.ts +24 -0
- package/app-template/src/types/widgets.ts +115 -0
- package/app-template/src/utils/convert-facet-search-params.ts +15 -0
- package/app-template/src/utils/generate-jsonld.ts +23 -0
- package/app-template/src/utils/gtm.ts +247 -0
- package/app-template/src/utils/index.ts +60 -0
- package/app-template/src/views/account/account-menu.tsx +117 -0
- package/app-template/src/views/account/address-card.tsx +157 -0
- package/app-template/src/views/account/address-form.tsx +374 -0
- package/app-template/src/views/account/back-button.tsx +27 -0
- package/app-template/src/views/account/contact-form.tsx +283 -0
- package/app-template/src/views/account/content-header.tsx +52 -0
- package/app-template/src/views/account/faq/faq-footer.tsx +30 -0
- package/app-template/src/views/account/faq/faq-search.tsx +35 -0
- package/app-template/src/views/account/faq/faq-tabs.tsx +54 -0
- package/app-template/src/views/account/faq/index.ts +3 -0
- package/app-template/src/views/account/favorite-item.tsx +191 -0
- package/app-template/src/views/account/favourite-products/favourite-products-list.tsx +65 -0
- package/app-template/src/views/account/index.ts +4 -0
- package/app-template/src/views/account/order.tsx +89 -0
- package/app-template/src/views/account/orders/order-cancellation-item.tsx +99 -0
- package/app-template/src/views/account/orders/order-detail-header.tsx +39 -0
- package/app-template/src/views/anonymous-tracking/index.tsx +109 -0
- package/app-template/src/views/anonymous-tracking/order-detail/index.tsx +318 -0
- package/app-template/src/views/basket/basket-item.tsx +231 -0
- package/app-template/src/views/basket/index.ts +2 -0
- package/app-template/src/views/basket/summary.tsx +220 -0
- package/app-template/src/views/breadcrumb.tsx +35 -0
- package/app-template/src/views/category/category-active-filters.tsx +98 -0
- package/app-template/src/views/category/category-banner.tsx +34 -0
- package/app-template/src/views/category/category-header.tsx +143 -0
- package/app-template/src/views/category/category-info.tsx +123 -0
- package/app-template/src/views/category/filters/index.tsx +163 -0
- package/app-template/src/views/category/filters/size-filter.tsx +27 -0
- package/app-template/src/views/category/layout.tsx +38 -0
- package/app-template/src/views/checkout/auth.tsx +54 -0
- package/app-template/src/views/checkout/index.tsx +3 -0
- package/app-template/src/views/checkout/layout/footer.tsx +48 -0
- package/app-template/src/views/checkout/layout/header.tsx +38 -0
- package/app-template/src/views/checkout/step-button.tsx +69 -0
- package/app-template/src/views/checkout/step-list.tsx +51 -0
- package/app-template/src/views/checkout/steps/payment/agreements.tsx +42 -0
- package/app-template/src/views/checkout/steps/payment/index.tsx +31 -0
- package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +382 -0
- package/app-template/src/views/checkout/steps/payment/options/credit-card/installments.tsx +100 -0
- package/app-template/src/views/checkout/steps/payment/options/credit-payment.tsx +14 -0
- package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +174 -0
- package/app-template/src/views/checkout/steps/payment/options/loyalty.tsx +19 -0
- package/app-template/src/views/checkout/steps/payment/options/pay-on-delivery.tsx +15 -0
- package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +94 -0
- package/app-template/src/views/checkout/steps/payment/payment-header.tsx +17 -0
- package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +73 -0
- package/app-template/src/views/checkout/steps/shipping/address-box.tsx +244 -0
- package/app-template/src/views/checkout/steps/shipping/addresses.tsx +189 -0
- package/app-template/src/views/checkout/steps/shipping/index.tsx +27 -0
- package/app-template/src/views/checkout/steps/shipping/shipping-options.tsx +72 -0
- package/app-template/src/views/checkout/summary.tsx +181 -0
- package/app-template/src/views/coupon-item/index.tsx +80 -0
- package/app-template/src/views/find-in-store/index.tsx +183 -0
- package/app-template/src/views/footer.tsx +21 -0
- package/app-template/src/views/guest-login/index.tsx +130 -0
- package/app-template/src/views/header/action-menu.tsx +117 -0
- package/app-template/src/views/header/band.tsx +32 -0
- package/app-template/src/views/header/index.tsx +66 -0
- package/app-template/src/views/header/mini-basket.tsx +267 -0
- package/app-template/src/views/header/mobile-hamburger-button.tsx +35 -0
- package/app-template/src/views/header/mobile-menu.tsx +144 -0
- package/app-template/src/views/header/navbar.tsx +186 -0
- package/app-template/src/views/header/pwa-back-button.tsx +60 -0
- package/app-template/src/views/header/search/index.tsx +82 -0
- package/app-template/src/views/header/search/results.tsx +123 -0
- package/app-template/src/views/header/user-menu.tsx +72 -0
- package/app-template/src/views/index.tsx +2 -0
- package/app-template/src/views/installment-options/index.tsx +127 -0
- package/app-template/src/views/login/index.tsx +233 -0
- package/app-template/src/views/otp-login/index.tsx +152 -0
- package/app-template/src/views/page-loader-spinner/index.tsx +9 -0
- package/app-template/src/views/product/accordion-wrapper.tsx +59 -0
- package/app-template/src/views/product/combine-product-card.tsx +82 -0
- package/app-template/src/views/product/index.ts +8 -0
- package/app-template/src/views/product/layout.tsx +40 -0
- package/app-template/src/views/product/misc-buttons.tsx +65 -0
- package/app-template/src/views/product/price-wrapper.tsx +41 -0
- package/app-template/src/views/product/product-group-info.tsx +63 -0
- package/app-template/src/views/product/product-info.tsx +273 -0
- package/app-template/src/views/product/slider.tsx +124 -0
- package/app-template/src/views/product/variant.tsx +104 -0
- package/app-template/src/views/product-item/index.tsx +96 -0
- package/app-template/src/views/product-pointer-banner-item.tsx +243 -0
- package/app-template/src/views/register/index.tsx +417 -0
- package/app-template/src/views/root-modal.tsx +21 -0
- package/app-template/src/views/sales-contract-modal/index.tsx +288 -0
- package/app-template/src/views/share/index.tsx +71 -0
- package/app-template/src/views/widgets/home-hero-slider-content.tsx +54 -0
- package/app-template/src/views/widgets/recommendation-content.tsx +86 -0
- package/app-template/src/widgets/footer-copyright.tsx +25 -0
- package/app-template/src/widgets/footer-info.tsx +78 -0
- package/app-template/src/widgets/footer-menu.tsx +258 -0
- package/app-template/src/widgets/footer-social.tsx +53 -0
- package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +110 -0
- package/app-template/src/widgets/footer-subscription/index.tsx +30 -0
- package/app-template/src/widgets/header-band-text.tsx +21 -0
- package/app-template/src/widgets/home-discovery.tsx +191 -0
- package/app-template/src/widgets/home-hero-slider.tsx +36 -0
- package/app-template/src/widgets/home-product-recommendation.tsx +18 -0
- package/app-template/src/widgets/home-single-banner.tsx +87 -0
- package/app-template/src/widgets/home-stories-eng.tsx +112 -0
- package/app-template/src/widgets/index.ts +25 -0
- package/app-template/src/widgets/product-pointer-banners.tsx +35 -0
- package/app-template/src/widgets/special-page-banner.tsx +49 -0
- package/app-template/src/widgets/special-page-carousel.tsx +68 -0
- package/app-template/src/widgets/widget-order.tsx +1 -0
- package/app-template/tailwind.config.js +170 -0
- package/app-template/tsconfig.json +44 -0
- package/app-template/tsconfig.test.json +6 -0
- package/app-template/yarn.lock +11278 -0
- package/commands/create.ts +49 -118
- package/dist/commands/create.js +32 -68
- package/package.json +1 -1
- package/tsconfig.json +9 -8
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
2
|
+
import CheckoutAgreements from '../agreements';
|
|
3
|
+
|
|
4
|
+
export default function PayOnDelivery() {
|
|
5
|
+
return (
|
|
6
|
+
<PluginModule
|
|
7
|
+
component={Component.PayOnDelivery}
|
|
8
|
+
props={{
|
|
9
|
+
agreementCheckbox: (
|
|
10
|
+
<CheckoutAgreements control={null} error={null} fieldId="agreement" />
|
|
11
|
+
)
|
|
12
|
+
}}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCompleteRedirectionPaymentMutation } from '@akinon/next/data/client/checkout';
|
|
4
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
5
|
+
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
6
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
7
|
+
import { Button, Checkbox } from '@theme/components';
|
|
8
|
+
import { useForm } from 'react-hook-form';
|
|
9
|
+
import { twMerge } from 'tailwind-merge';
|
|
10
|
+
import * as yup from 'yup';
|
|
11
|
+
import PaymentOptionButtons from '../payment-option-buttons';
|
|
12
|
+
import { useEffect, useState } from 'react';
|
|
13
|
+
import { getPosError } from '@akinon/next/utils';
|
|
14
|
+
|
|
15
|
+
interface FormValues {
|
|
16
|
+
agreement: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const formSchema = (t) =>
|
|
20
|
+
yup.object().shape({
|
|
21
|
+
agreement: yup
|
|
22
|
+
.boolean()
|
|
23
|
+
.required('This field is required')
|
|
24
|
+
.oneOf([true], 'This field is required')
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default function RedirectionPayment() {
|
|
28
|
+
const { payment_option } = useAppSelector((state) => state.checkout.preOrder);
|
|
29
|
+
const [formError, setFormError] = useState(null);
|
|
30
|
+
|
|
31
|
+
const { t } = useLocalization();
|
|
32
|
+
const {
|
|
33
|
+
register,
|
|
34
|
+
handleSubmit,
|
|
35
|
+
formState: { errors }
|
|
36
|
+
} = useForm<FormValues>({
|
|
37
|
+
resolver: yupResolver(formSchema(t))
|
|
38
|
+
});
|
|
39
|
+
const [completeRedirectionPayment] = useCompleteRedirectionPaymentMutation();
|
|
40
|
+
|
|
41
|
+
const onSubmit = async () => {
|
|
42
|
+
completeRedirectionPayment();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const posErrors = getPosError();
|
|
47
|
+
|
|
48
|
+
if (posErrors) {
|
|
49
|
+
setFormError(posErrors);
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<form onSubmit={handleSubmit(onSubmit)} className="lg-5 space-y-5 lg:p-10">
|
|
55
|
+
<h1 className="text-2xl font-bold px-4 md:px-0">
|
|
56
|
+
Pay With {payment_option.name}
|
|
57
|
+
</h1>
|
|
58
|
+
|
|
59
|
+
<p className="px-4 md:px-0">
|
|
60
|
+
You can quickly and easily pay and complete your order with{' '}
|
|
61
|
+
{payment_option.name}.
|
|
62
|
+
</p>
|
|
63
|
+
|
|
64
|
+
<Checkbox
|
|
65
|
+
className="px-4 md:px-0"
|
|
66
|
+
{...register('agreement')}
|
|
67
|
+
error={errors.agreement}
|
|
68
|
+
>
|
|
69
|
+
Check here to indicate that you have read and agree to the all terms.
|
|
70
|
+
</Checkbox>
|
|
71
|
+
|
|
72
|
+
{formError?.non_field_errors && (
|
|
73
|
+
<div
|
|
74
|
+
className="w-full text-xs text-start px-1 mt-3 text-error"
|
|
75
|
+
data-testid="checkout-form-error"
|
|
76
|
+
>
|
|
77
|
+
{formError.non_field_errors}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
{formError?.status && (
|
|
81
|
+
<div
|
|
82
|
+
className="w-full text-xs text-start px-1 mt-3 text-error"
|
|
83
|
+
data-testid="checkout-form-error"
|
|
84
|
+
>
|
|
85
|
+
{formError.status}
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
88
|
+
|
|
89
|
+
<Button className={twMerge('w-full md:w-36 px-4 md:px-0')}>
|
|
90
|
+
{payment_option.name}
|
|
91
|
+
</Button>
|
|
92
|
+
</form>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export type PaymentHeaderProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const PaymentHeader = ({ title }: PaymentHeaderProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex justify-start items-center border-solid border-gray-400 px-4 py-2 sm:px-6 sm:py-3 sm:min-h-15">
|
|
10
|
+
<span className="text-black-800 text-lg font-medium sm:text-2xl">
|
|
11
|
+
{title}
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default PaymentHeader;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
3
|
+
import { RootState } from '@theme/redux/store';
|
|
4
|
+
import { useSetPaymentOptionMutation } from '@akinon/next/data/client/checkout';
|
|
5
|
+
import { CheckoutPaymentOption } from '@akinon/next/types';
|
|
6
|
+
import { Radio } from '@theme/components';
|
|
7
|
+
import { usePaymentOptions } from '@akinon/next/hooks/use-payment-options';
|
|
8
|
+
|
|
9
|
+
const PaymentOptionButtons = () => {
|
|
10
|
+
const { preOrder } = useAppSelector((state: RootState) => state.checkout);
|
|
11
|
+
const [setPaymentOption] = useSetPaymentOptionMutation();
|
|
12
|
+
const { filteredPaymentOptions } = usePaymentOptions();
|
|
13
|
+
|
|
14
|
+
const onClickHandler = (option: CheckoutPaymentOption) => {
|
|
15
|
+
setPaymentOption(option.pk);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const scrollToTop = () => {
|
|
19
|
+
window.scrollTo({
|
|
20
|
+
top: 0,
|
|
21
|
+
behavior: 'smooth'
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<div className="w-full space-y-4 px-4 flex flex-col mb-8 md:hidden">
|
|
28
|
+
{filteredPaymentOptions.map((option) => (
|
|
29
|
+
<label
|
|
30
|
+
key={`payment-option-${option.pk}`}
|
|
31
|
+
className="border px-4 py-3 mt-3 flex h-12"
|
|
32
|
+
onClick={scrollToTop}
|
|
33
|
+
>
|
|
34
|
+
<Radio
|
|
35
|
+
type="radio"
|
|
36
|
+
name="payment-option"
|
|
37
|
+
value={option.pk}
|
|
38
|
+
checked={preOrder?.payment_option?.pk === option.pk}
|
|
39
|
+
onChange={() => onClickHandler(option)}
|
|
40
|
+
className="mr-2 mt-1"
|
|
41
|
+
/>
|
|
42
|
+
<span className="flex text-primary-800 font-light text-lg">
|
|
43
|
+
{option.name}
|
|
44
|
+
</span>
|
|
45
|
+
</label>
|
|
46
|
+
))}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div className="hidden md:flex">
|
|
50
|
+
{filteredPaymentOptions.map((option) => (
|
|
51
|
+
<button
|
|
52
|
+
key={`payment-option-${option.pk}`}
|
|
53
|
+
onClick={() => onClickHandler(option)}
|
|
54
|
+
className={clsx(
|
|
55
|
+
'flex items-center justify-center border-r border-b border-solid',
|
|
56
|
+
'border-gray-400 text-xs uppercase text-black-800 font-medium',
|
|
57
|
+
'text-opacity-60 bg-white h-11 px-5 transition-colors sm:h-15 sm:px-8 sm:py-8 hover:text-secondary',
|
|
58
|
+
{
|
|
59
|
+
'text-opacity-100 border-b-transparent':
|
|
60
|
+
preOrder?.payment_option?.pk === option.pk
|
|
61
|
+
}
|
|
62
|
+
)}
|
|
63
|
+
data-testid={`checkout-payment-tab-${option.pk}`}
|
|
64
|
+
>
|
|
65
|
+
{option.name}
|
|
66
|
+
</button>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default PaymentOptionButtons;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
4
|
+
import { RootState } from '@theme/redux/store';
|
|
5
|
+
import {
|
|
6
|
+
useEditAddressMutation,
|
|
7
|
+
useRemoveAddressMutation
|
|
8
|
+
} from '@akinon/next/data/client/address';
|
|
9
|
+
import {
|
|
10
|
+
useSetAddressesMutation,
|
|
11
|
+
useSetRetailStoreMutation,
|
|
12
|
+
useSetShippingOptionMutation
|
|
13
|
+
} from '@akinon/next/data/client/checkout';
|
|
14
|
+
import { Address, CheckoutAddressType } from '@akinon/next/types';
|
|
15
|
+
import { Button, Modal, Radio } from '@theme/components';
|
|
16
|
+
import { resetCheckoutState } from '@akinon/next/redux/reducers/checkout';
|
|
17
|
+
import { AddressForm } from '@theme/views/account/address-form';
|
|
18
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
19
|
+
|
|
20
|
+
interface AddressBoxProps {
|
|
21
|
+
addressType: CheckoutAddressType;
|
|
22
|
+
address: Address;
|
|
23
|
+
isBillingAddressSame: boolean;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const AddressBox = ({
|
|
28
|
+
addressType,
|
|
29
|
+
address,
|
|
30
|
+
isBillingAddressSame,
|
|
31
|
+
disabled
|
|
32
|
+
}: AddressBoxProps) => {
|
|
33
|
+
const { t } = useLocalization();
|
|
34
|
+
const [isEditAddressModalOpen, setIsEditAddressModalOpen] = useState(false);
|
|
35
|
+
const [isRemoveAddressModalOpen, setRemoveAddressModalOpen] = useState(false);
|
|
36
|
+
const { shipping_address, billing_address, delivery_option, retail_store } =
|
|
37
|
+
useAppSelector((state: RootState) => state.checkout.preOrder) ?? {};
|
|
38
|
+
const addressList = useAppSelector(
|
|
39
|
+
(state: RootState) => state.checkout.addressList
|
|
40
|
+
);
|
|
41
|
+
const [setShippingOption] = useSetShippingOptionMutation();
|
|
42
|
+
const [setRetailStore] = useSetRetailStoreMutation();
|
|
43
|
+
const [setAddresses] = useSetAddressesMutation();
|
|
44
|
+
const [editAddress] = useEditAddressMutation();
|
|
45
|
+
const [removeAddress, { isLoading: removeAddressLoading }] =
|
|
46
|
+
useRemoveAddressMutation();
|
|
47
|
+
const dispatch = useAppDispatch();
|
|
48
|
+
|
|
49
|
+
const handleAddressClick = (
|
|
50
|
+
addressType: CheckoutAddressType,
|
|
51
|
+
address: Address
|
|
52
|
+
) => {
|
|
53
|
+
if (addressType.value === address.pk) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const addresses = {
|
|
58
|
+
shippingAddressPk: shipping_address?.pk,
|
|
59
|
+
billingAddressPk: billing_address?.pk
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (isBillingAddressSame) {
|
|
63
|
+
Object.keys(addresses).forEach((key) => {
|
|
64
|
+
addresses[key] = address.pk;
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
addresses[addressType.requestParam] = address.pk;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!delivery_option) {
|
|
71
|
+
console.warn(
|
|
72
|
+
'The delivery option was not found, please add one or more options from Omnitron.'
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (delivery_option?.delivery_option_type === 'retail_store') {
|
|
77
|
+
setShippingOption(delivery_option.pk).unwrap();
|
|
78
|
+
setRetailStore({
|
|
79
|
+
retailStorePk: retail_store.pk,
|
|
80
|
+
billingAddressPk: address.pk
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
setAddresses(addresses);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const onSubmit = (data) => {
|
|
88
|
+
editAddress(data)
|
|
89
|
+
.unwrap()
|
|
90
|
+
.then((editAddressResponse) => {
|
|
91
|
+
handleAddressClick(addressType, editAddressResponse);
|
|
92
|
+
})
|
|
93
|
+
.catch();
|
|
94
|
+
|
|
95
|
+
setIsEditAddressModalOpen(false);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const handleRemoveAddress = async (addressPk: number) => {
|
|
99
|
+
await removeAddress(addressPk);
|
|
100
|
+
setRemoveAddressModalOpen(false);
|
|
101
|
+
dispatch(resetCheckoutState());
|
|
102
|
+
|
|
103
|
+
if (
|
|
104
|
+
addressPk === shipping_address?.pk ||
|
|
105
|
+
addressPk === billing_address?.pk
|
|
106
|
+
) {
|
|
107
|
+
const newAddressList = addressList.filter((address) => {
|
|
108
|
+
if (address.pk !== addressPk) {
|
|
109
|
+
return address.pk;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const addresses = {
|
|
114
|
+
shippingAddressPk:
|
|
115
|
+
addressPk === shipping_address?.pk
|
|
116
|
+
? newAddressList[0]?.pk
|
|
117
|
+
: shipping_address?.pk,
|
|
118
|
+
billingAddressPk:
|
|
119
|
+
addressPk === billing_address?.pk
|
|
120
|
+
? newAddressList[0]?.pk
|
|
121
|
+
: billing_address?.pk
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
setAddresses(addresses);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div
|
|
130
|
+
onClick={() => handleAddressClick(addressType, address)}
|
|
131
|
+
key={address.pk}
|
|
132
|
+
className={clsx(
|
|
133
|
+
'cursor-pointer relative w-full border shadow p-4 min-h-[8rem]',
|
|
134
|
+
"hover:after:content-[''] hover:after:border-4 hover:after:opacity-30 hover:after:transition-opacity",
|
|
135
|
+
'after:border-secondary-400 after:absolute after:inset-0 after:duration-150 after:-z-10',
|
|
136
|
+
{
|
|
137
|
+
'after:opacity-0': addressType.value !== address.pk
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
'after:border-4 after:opacity-100': addressType.value === address.pk
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
'opacity-30 select-none pointer-events-none': disabled
|
|
144
|
+
}
|
|
145
|
+
)}
|
|
146
|
+
>
|
|
147
|
+
<Radio
|
|
148
|
+
className="mb-2"
|
|
149
|
+
name={addressType.label}
|
|
150
|
+
checked={addressType.value === address.pk}
|
|
151
|
+
onChange={() => null}
|
|
152
|
+
>
|
|
153
|
+
<span className="text-xs font-normal italic">
|
|
154
|
+
{t('checkout.address.box.shipping_to')}:
|
|
155
|
+
</span>
|
|
156
|
+
</Radio>
|
|
157
|
+
<div className="text-xs mb-3 leading-4">
|
|
158
|
+
<p>{address.title}</p>
|
|
159
|
+
<p>{address.phone_number}</p>
|
|
160
|
+
<p className="overflow-hidden text-ellipsis whitespace-nowrap">
|
|
161
|
+
{address.line}
|
|
162
|
+
</p>
|
|
163
|
+
<p>
|
|
164
|
+
{address.township.name} / {address.city.name}
|
|
165
|
+
</p>
|
|
166
|
+
</div>
|
|
167
|
+
<div className="text-xs flex justify-between">
|
|
168
|
+
<Button
|
|
169
|
+
appearance="ghost"
|
|
170
|
+
className="italic underline hover:text-secondary-500 hover:!bg-white hover:!border-white p-0 h-auto"
|
|
171
|
+
onClick={() => setIsEditAddressModalOpen(true)}
|
|
172
|
+
data-testid="checkout-address-edit"
|
|
173
|
+
>
|
|
174
|
+
{t('checkout.address.box.edit')}
|
|
175
|
+
</Button>
|
|
176
|
+
<Modal
|
|
177
|
+
portalId={`checkout-shipping-edit-address-modal-${address.pk}`}
|
|
178
|
+
title={t('checkout.address.modal.edit_address')}
|
|
179
|
+
open={isEditAddressModalOpen}
|
|
180
|
+
setOpen={setIsEditAddressModalOpen}
|
|
181
|
+
className="w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto"
|
|
182
|
+
>
|
|
183
|
+
<AddressForm
|
|
184
|
+
data={{
|
|
185
|
+
...address,
|
|
186
|
+
country: address.country?.pk,
|
|
187
|
+
city: address.city?.pk,
|
|
188
|
+
township: address.township?.pk,
|
|
189
|
+
district: address.district?.pk
|
|
190
|
+
}}
|
|
191
|
+
onSubmit={onSubmit}
|
|
192
|
+
/>
|
|
193
|
+
</Modal>
|
|
194
|
+
<Button
|
|
195
|
+
appearance="ghost"
|
|
196
|
+
className="italic underline hover:text-secondary-500 hover:!bg-white hover:!border-white p-0 h-auto"
|
|
197
|
+
onClick={() => setRemoveAddressModalOpen(true)}
|
|
198
|
+
data-testid="checkout-address-remove"
|
|
199
|
+
>
|
|
200
|
+
{t('checkout.address.box.remove')}
|
|
201
|
+
</Button>
|
|
202
|
+
</div>
|
|
203
|
+
<Modal
|
|
204
|
+
portalId="remove-address-item"
|
|
205
|
+
className="w-4/5 sm:w-96 max-h-[90vh] overflow-y-auto"
|
|
206
|
+
open={isRemoveAddressModalOpen}
|
|
207
|
+
setOpen={setRemoveAddressModalOpen}
|
|
208
|
+
showCloseButton={false}
|
|
209
|
+
>
|
|
210
|
+
<div className="text-center px-6 py-10">
|
|
211
|
+
<p className="mb-4">
|
|
212
|
+
{t('account.address_book.modal.delete_description')}
|
|
213
|
+
</p>
|
|
214
|
+
<div className="space-x-3 flex justify-center">
|
|
215
|
+
<Button
|
|
216
|
+
appearance="outlined"
|
|
217
|
+
onClick={() => {
|
|
218
|
+
setRemoveAddressModalOpen(false);
|
|
219
|
+
}}
|
|
220
|
+
data-testid="remove-address-modal-cancel"
|
|
221
|
+
>
|
|
222
|
+
{t('account.address_book.modal.close')}
|
|
223
|
+
</Button>
|
|
224
|
+
<Button
|
|
225
|
+
appearance="filled"
|
|
226
|
+
disabled={removeAddressLoading}
|
|
227
|
+
onClick={() => {
|
|
228
|
+
handleRemoveAddress(address.pk);
|
|
229
|
+
}}
|
|
230
|
+
className={
|
|
231
|
+
removeAddressLoading && 'opacity-50 cursor-not-allowed'
|
|
232
|
+
}
|
|
233
|
+
data-testid="remove-address-modal-delete"
|
|
234
|
+
>
|
|
235
|
+
{t('account.address_book.modal.delete_address')}
|
|
236
|
+
</Button>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</Modal>
|
|
240
|
+
</div>
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export default AddressBox;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
4
|
+
import { RootState } from '@theme/redux/store';
|
|
5
|
+
import { useSetAddressesMutation } from '@akinon/next/data/client/checkout';
|
|
6
|
+
import { CheckoutAddressType } from '@akinon/next/types';
|
|
7
|
+
import { Checkbox, Icon, Modal } from '@theme/components';
|
|
8
|
+
import AddressBox from './address-box';
|
|
9
|
+
import { useAddAddressMutation } from '@akinon/next/data/client/address';
|
|
10
|
+
import { AddressForm } from '@theme/views/account/address-form';
|
|
11
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
12
|
+
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
13
|
+
import { Trans } from '@akinon/next/components/trans';
|
|
14
|
+
|
|
15
|
+
const Addresses = () => {
|
|
16
|
+
const { t } = useLocalization();
|
|
17
|
+
|
|
18
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
19
|
+
const addressList = useAppSelector(
|
|
20
|
+
(state: RootState) => state.checkout.addressList
|
|
21
|
+
);
|
|
22
|
+
const {
|
|
23
|
+
shipping_address,
|
|
24
|
+
billing_address,
|
|
25
|
+
billing_and_shipping_same,
|
|
26
|
+
delivery_option
|
|
27
|
+
} = useAppSelector((state: RootState) => state.checkout.preOrder) ?? {};
|
|
28
|
+
|
|
29
|
+
const [isBillingAddressSame, setIsBillingAddressSame] = useState(
|
|
30
|
+
billing_and_shipping_same
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const addressTypes: CheckoutAddressType[] = useMemo(
|
|
34
|
+
() => [
|
|
35
|
+
{
|
|
36
|
+
label: 'Delivery',
|
|
37
|
+
text: t('checkout.address.delivery'),
|
|
38
|
+
value: shipping_address?.pk,
|
|
39
|
+
requestParam: 'shippingAddressPk'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: 'Billing',
|
|
43
|
+
text: t('checkout.address.billing'),
|
|
44
|
+
value: billing_address?.pk,
|
|
45
|
+
requestParam: 'billingAddressPk'
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
[shipping_address?.pk, billing_address?.pk, t]
|
|
49
|
+
);
|
|
50
|
+
const [setAddresses] = useSetAddressesMutation();
|
|
51
|
+
const [addAddress] = useAddAddressMutation();
|
|
52
|
+
|
|
53
|
+
const handleSameBillingAddressChange = () => {
|
|
54
|
+
setIsBillingAddressSame((prevValue) => {
|
|
55
|
+
if (!prevValue) {
|
|
56
|
+
setAddresses({
|
|
57
|
+
shippingAddressPk: shipping_address?.pk,
|
|
58
|
+
billingAddressPk: shipping_address?.pk
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return !prevValue;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const setSelectAddresses = (pk: number) => {
|
|
67
|
+
const addresses = {
|
|
68
|
+
shippingAddressPk: pk,
|
|
69
|
+
billingAddressPk: pk
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
setAddresses(addresses);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
setIsBillingAddressSame(billing_and_shipping_same);
|
|
77
|
+
}, [billing_and_shipping_same]);
|
|
78
|
+
|
|
79
|
+
const onSubmit = (data) => {
|
|
80
|
+
addAddress(data)
|
|
81
|
+
.unwrap()
|
|
82
|
+
.then((addAddressResponse) => {
|
|
83
|
+
if (addressList.length === 0) {
|
|
84
|
+
setSelectAddresses(addAddressResponse.pk);
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
.catch();
|
|
88
|
+
|
|
89
|
+
setIsModalOpen(false);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const AddressType = (props) => {
|
|
93
|
+
return props.title;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div className="w-full lg:w-3/5 lg:border-r lg:border-gray-400">
|
|
98
|
+
{addressTypes
|
|
99
|
+
.filter((addressType) =>
|
|
100
|
+
isBillingAddressSame ? addressType.label !== 'Billing' : true
|
|
101
|
+
)
|
|
102
|
+
.map((addressType) => (
|
|
103
|
+
<div key={addressType.label}>
|
|
104
|
+
<div className="flex items-center justify-between border-b border-gray-400 px-8 py-4">
|
|
105
|
+
<h2 className="text-2xl">
|
|
106
|
+
{addressType.text} {t('checkout.address.address')}
|
|
107
|
+
</h2>
|
|
108
|
+
|
|
109
|
+
{addressType.label === 'Delivery' &&
|
|
110
|
+
delivery_option?.delivery_option_type !== 'retail_store' && (
|
|
111
|
+
<Checkbox
|
|
112
|
+
checked={isBillingAddressSame}
|
|
113
|
+
onChange={handleSameBillingAddressChange}
|
|
114
|
+
data-testid="checkout-billing-checkbox"
|
|
115
|
+
>
|
|
116
|
+
{t('checkout.address.use_for_billing')}
|
|
117
|
+
</Checkbox>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
<div className="px-8 py-4 border-gray-400">
|
|
121
|
+
<p className="text-xs mb-4">
|
|
122
|
+
<Trans
|
|
123
|
+
i18nKey="checkout.address.content"
|
|
124
|
+
components={{
|
|
125
|
+
addressType: (
|
|
126
|
+
<AddressType title={addressType.text.toLowerCase()} />
|
|
127
|
+
)
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
130
|
+
</p>
|
|
131
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
132
|
+
{addressList.map((address) => (
|
|
133
|
+
<AddressBox
|
|
134
|
+
key={address.pk}
|
|
135
|
+
addressType={addressType}
|
|
136
|
+
address={address}
|
|
137
|
+
isBillingAddressSame={isBillingAddressSame}
|
|
138
|
+
data-testid={`checkout-address-${address.pk}`}
|
|
139
|
+
disabled={
|
|
140
|
+
delivery_option?.delivery_option_type ===
|
|
141
|
+
'retail_store' &&
|
|
142
|
+
addressType.requestParam === 'shippingAddressPk'
|
|
143
|
+
}
|
|
144
|
+
/>
|
|
145
|
+
))}
|
|
146
|
+
|
|
147
|
+
<PluginModule
|
|
148
|
+
component={Component.ClickCollect}
|
|
149
|
+
props={{ addressTypeParam: addressType.requestParam }}
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
<div
|
|
153
|
+
role="button"
|
|
154
|
+
onClick={() => setIsModalOpen(true)}
|
|
155
|
+
className={clsx(
|
|
156
|
+
'relative cursor-pointer w-full min-h-[8rem] border shadow p-4',
|
|
157
|
+
"hover:after:content-[''] hover:after:border-4 hover:after:opacity-30 hover:after:transition-opacity",
|
|
158
|
+
'after:border-secondary-400 after:absolute after:inset-0 after:opacity-0 after:duration-150 after:-z-10',
|
|
159
|
+
{
|
|
160
|
+
'opacity-30 select-none pointer-events-none':
|
|
161
|
+
delivery_option?.delivery_option_type === 'retail_store'
|
|
162
|
+
}
|
|
163
|
+
)}
|
|
164
|
+
>
|
|
165
|
+
<div className="text-xs flex justify-center items-center h-full gap-x-2">
|
|
166
|
+
<Icon name="plus" size={12} />
|
|
167
|
+
<span data-testid="checkout-add-new-address">
|
|
168
|
+
{t('checkout.address.add_new_address')}
|
|
169
|
+
</span>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
<Modal
|
|
173
|
+
portalId="orders-checkout-new-address-modal"
|
|
174
|
+
title={t('checkout.address.add_new_address')}
|
|
175
|
+
open={isModalOpen}
|
|
176
|
+
setOpen={setIsModalOpen}
|
|
177
|
+
className="w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto"
|
|
178
|
+
>
|
|
179
|
+
<AddressForm onSubmit={onSubmit} />
|
|
180
|
+
</Modal>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
))}
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export default Addresses;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
3
|
+
import { RootState } from '@theme/redux/store';
|
|
4
|
+
import Addresses from './addresses';
|
|
5
|
+
import ShippingOptions from './shipping-options';
|
|
6
|
+
|
|
7
|
+
const ShippingStep = () => {
|
|
8
|
+
const isShippingStepBusy = useAppSelector(
|
|
9
|
+
(state: RootState) => state.checkout.steps.shipping.busy
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
className={clsx(
|
|
15
|
+
'flex flex-col border border-gray-400 w-full lg:flex-row',
|
|
16
|
+
{
|
|
17
|
+
'pointer-events-none opacity-30': isShippingStepBusy
|
|
18
|
+
}
|
|
19
|
+
)}
|
|
20
|
+
>
|
|
21
|
+
<Addresses />
|
|
22
|
+
<ShippingOptions />
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default ShippingStep;
|