@akinon/projectzero 2.0.0-beta.9 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/CHANGELOG.md +191 -17
  2. package/app-template/.env.example +3 -0
  3. package/app-template/.github/instructions/account.instructions.md +749 -0
  4. package/app-template/.github/instructions/checkout.instructions.md +678 -0
  5. package/app-template/.github/instructions/default.instructions.md +279 -0
  6. package/app-template/.github/instructions/edge-cases.instructions.md +73 -0
  7. package/app-template/.github/instructions/routing.instructions.md +603 -0
  8. package/app-template/.github/instructions/settings.instructions.md +338 -0
  9. package/app-template/.gitignore +3 -0
  10. package/app-template/AGENTS.md +7 -0
  11. package/app-template/CHANGELOG.md +2065 -232
  12. package/app-template/Procfile +1 -1
  13. package/app-template/akinon.json +1 -4
  14. package/app-template/build.sh +10 -0
  15. package/app-template/docs/advanced-usage.md +111 -0
  16. package/app-template/docs/plugins.md +60 -25
  17. package/app-template/docs/sentry-usage.md +35 -0
  18. package/app-template/jest.config.ts +2 -2
  19. package/app-template/next-env.d.ts +1 -0
  20. package/app-template/{next.config.ts → next.config.mjs} +6 -7
  21. package/app-template/package.json +58 -50
  22. package/app-template/postcss.config.mjs +1 -4
  23. package/app-template/public/amex.svg +12 -0
  24. package/app-template/public/apple-pay.svg +16 -0
  25. package/app-template/public/assets/images/product-placeholder-1.jpg +0 -0
  26. package/app-template/public/assets/images/product-placeholder-2.jpg +0 -0
  27. package/app-template/public/assets/images/product-placeholder-3.jpg +0 -0
  28. package/app-template/public/assets/images/product-placeholder-4.jpg +0 -0
  29. package/app-template/public/google-pay.svg +16 -0
  30. package/app-template/public/locales/en/account.json +9 -4
  31. package/app-template/public/locales/en/auth.json +6 -7
  32. package/app-template/public/locales/en/basket.json +6 -6
  33. package/app-template/public/locales/en/blog.json +7 -0
  34. package/app-template/public/locales/en/category.json +3 -1
  35. package/app-template/public/locales/en/checkout.json +17 -4
  36. package/app-template/public/locales/en/common.json +61 -3
  37. package/app-template/public/locales/en/forgot_password.json +6 -7
  38. package/app-template/public/locales/en/product.json +84 -4
  39. package/app-template/public/locales/tr/account.json +9 -4
  40. package/app-template/public/locales/tr/auth.json +16 -17
  41. package/app-template/public/locales/tr/basket.json +4 -4
  42. package/app-template/public/locales/tr/blog.json +7 -0
  43. package/app-template/public/locales/tr/category.json +3 -1
  44. package/app-template/public/locales/tr/checkout.json +48 -36
  45. package/app-template/public/locales/tr/common.json +60 -2
  46. package/app-template/public/locales/tr/forgot_password.json +12 -13
  47. package/app-template/public/locales/tr/product.json +82 -0
  48. package/app-template/public/logo.svg +3 -27
  49. package/app-template/public/mastercard.svg +14 -0
  50. package/app-template/public/masterpass-javascript-sdk-web.min.js +1 -0
  51. package/app-template/public/promotion-banner.jpg +0 -0
  52. package/app-template/public/shop-pay.svg +12 -0
  53. package/app-template/public/visa.svg +12 -0
  54. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/[...prettyurl]/page.tsx +11 -11
  55. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/layout.tsx +4 -3
  56. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/cancellation/page.tsx +13 -10
  57. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/page.tsx +73 -51
  58. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/page.tsx +1 -1
  59. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/profile/page.tsx +2 -2
  60. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/address/stores/page.tsx +2 -2
  61. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/auth/page.tsx +1 -1
  62. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/basket/page.tsx +2 -2
  63. package/app-template/src/app/[pz]/blog/[slug]/page.tsx +120 -0
  64. package/app-template/src/app/[pz]/category/[pk]/page.tsx +37 -0
  65. package/app-template/src/app/[pz]/flat-page/[pk]/page.tsx +23 -0
  66. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/forms/[pk]/generate/page.tsx +2 -3
  67. package/app-template/src/app/[pz]/group-product/[pk]/page.tsx +93 -0
  68. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/landing-page/[pk]/page.tsx +2 -4
  69. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/layout.tsx +6 -11
  70. package/app-template/src/app/[pz]/list/page.tsx +26 -0
  71. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/not-found.tsx +5 -7
  72. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/completed/[token]/page.tsx +6 -4
  73. package/app-template/src/app/[pz]/page.tsx +28 -0
  74. package/app-template/src/app/[pz]/pages/[slug]/page.tsx +19 -0
  75. package/app-template/src/app/[pz]/product/[pk]/page.tsx +102 -0
  76. package/app-template/src/app/[pz]/special-page/[pk]/page.tsx +35 -0
  77. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/email-set-primary/[[...id]]/page.tsx +3 -4
  78. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/registration/account-confirm-email/[[...id]]/page.tsx +3 -3
  79. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/reset/[[...id]]/page.tsx +41 -5
  80. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/xml-sitemap/[node]/route.ts +8 -6
  81. package/app-template/src/app/api/auth/[...nextauth]/route.ts +3 -0
  82. package/app-template/src/app/api/barcode-search/route.ts +1 -0
  83. package/app-template/src/app/api/cache/route.ts +1 -1
  84. package/app-template/src/app/api/form/[...id]/route.ts +1 -7
  85. package/app-template/src/app/api/image-proxy/route.ts +1 -0
  86. package/app-template/src/app/api/logout/route.ts +1 -1
  87. package/app-template/src/app/api/product-categories/route.ts +1 -0
  88. package/app-template/src/app/api/similar-product-list/route.ts +1 -0
  89. package/app-template/src/app/api/similar-products/route.ts +1 -0
  90. package/app-template/src/app/api/theme-settings/route.ts +12 -0
  91. package/app-template/src/app/api/virtual-try-on/limited-categories/route.ts +1 -0
  92. package/app-template/src/app/api/virtual-try-on/route.ts +1 -0
  93. package/app-template/src/app/api/web-vitals/route.ts +1 -1
  94. package/app-template/src/assets/fonts/pz-icon.css +211 -49
  95. package/app-template/src/assets/fonts/pz-icon.eot +0 -0
  96. package/app-template/src/assets/fonts/pz-icon.html +486 -0
  97. package/app-template/src/assets/fonts/pz-icon.scss +373 -49
  98. package/app-template/src/assets/fonts/pz-icon.svg +215 -53
  99. package/app-template/src/assets/fonts/pz-icon.ttf +0 -0
  100. package/app-template/src/assets/fonts/pz-icon.woff +0 -0
  101. package/app-template/src/assets/fonts/pz-icon.woff2 +0 -0
  102. package/app-template/src/assets/globals.scss +8 -133
  103. package/app-template/src/assets/icons/arrow-right.svg +3 -0
  104. package/app-template/src/assets/icons/cart.svg +4 -12
  105. package/app-template/src/assets/icons/check.svg +2 -18
  106. package/app-template/src/assets/icons/chevron-down.svg +2 -7
  107. package/app-template/src/assets/icons/delete.svg +3 -0
  108. package/app-template/src/assets/icons/facebook.svg +2 -8
  109. package/app-template/src/assets/icons/fav-off.svg +5 -0
  110. package/app-template/src/assets/icons/fav-on.svg +5 -0
  111. package/app-template/src/assets/icons/filter-and-sort.svg +3 -0
  112. package/app-template/src/assets/icons/heart.svg +3 -0
  113. package/app-template/src/assets/icons/instagram.svg +2 -13
  114. package/app-template/src/assets/icons/materials.svg +3 -0
  115. package/app-template/src/assets/icons/person.svg +4 -0
  116. package/app-template/src/assets/icons/pinterest.svg +5 -11
  117. package/app-template/src/assets/icons/ruler.svg +3 -0
  118. package/app-template/src/assets/icons/search.svg +8 -11
  119. package/app-template/src/assets/icons/share.svg +2 -9
  120. package/app-template/src/assets/icons/snapchat.svg +3 -0
  121. package/app-template/src/assets/icons/tiktok.svg +3 -0
  122. package/app-template/src/assets/icons/tumblr.svg +6 -0
  123. package/app-template/src/assets/icons/twitter.svg +2 -10
  124. package/app-template/src/assets/icons/vimeo.svg +3 -0
  125. package/app-template/src/assets/icons/youtube.svg +3 -0
  126. package/app-template/src/assets/icons/zoom.svg +8 -0
  127. package/app-template/src/auth.ts +3 -0
  128. package/app-template/src/components/__tests__/badge.test.tsx +2 -2
  129. package/app-template/src/components/__tests__/link.test.tsx +2 -0
  130. package/app-template/src/components/accordion.tsx +48 -23
  131. package/app-template/src/components/action-tooltip.tsx +160 -0
  132. package/app-template/src/components/button.tsx +1 -1
  133. package/app-template/src/components/carousel-core.tsx +4 -11
  134. package/app-template/src/components/checkbox.tsx +2 -1
  135. package/app-template/src/components/currency-select.tsx +150 -4
  136. package/app-template/src/components/file-input.tsx +27 -7
  137. package/app-template/src/components/generate-form-fields.tsx +49 -10
  138. package/app-template/src/components/icon.tsx +5 -6
  139. package/app-template/src/components/index.ts +4 -1
  140. package/app-template/src/components/input.tsx +11 -5
  141. package/app-template/src/components/language-select.tsx +88 -2
  142. package/app-template/src/components/modal.tsx +34 -16
  143. package/app-template/src/components/pagination.tsx +133 -20
  144. package/app-template/src/components/price.tsx +1 -1
  145. package/app-template/src/components/pwa-tags.tsx +1 -0
  146. package/app-template/src/components/quantity-input.tsx +63 -0
  147. package/app-template/src/components/quantity-selector.tsx +215 -0
  148. package/app-template/src/components/route-handler.tsx +50 -0
  149. package/app-template/src/components/select.tsx +86 -54
  150. package/app-template/src/components/shimmer.tsx +1 -1
  151. package/app-template/src/components/types/index.ts +51 -1
  152. package/app-template/src/components/widget-content.tsx +323 -0
  153. package/app-template/src/data/server/theme.ts +70 -0
  154. package/app-template/src/hooks/use-fav-button.tsx +9 -10
  155. package/app-template/src/hooks/use-product-cart.ts +80 -0
  156. package/app-template/src/hooks/use-stock-alert.ts +74 -0
  157. package/app-template/src/hooks/use-theme-settings.ts +42 -0
  158. package/app-template/src/lib/fonts.ts +149 -0
  159. package/app-template/src/plugins.js +12 -2
  160. package/app-template/src/{middleware.ts → proxy.ts} +3 -3
  161. package/app-template/src/redux/middlewares/category.ts +5 -4
  162. package/app-template/src/redux/store.ts +21 -1
  163. package/app-template/src/routes/index.ts +8 -7
  164. package/app-template/src/settings.js +6 -3
  165. package/app-template/src/types/hookform-resolvers-yup.d.ts +28 -0
  166. package/app-template/src/types/index.ts +74 -3
  167. package/app-template/src/types/next-auth.d.ts +2 -2
  168. package/app-template/src/types/widget.ts +169 -0
  169. package/app-template/src/utils/__tests__/theme-page-context.test.ts +145 -0
  170. package/app-template/src/utils/formatDate.ts +48 -0
  171. package/app-template/src/utils/styles.ts +71 -0
  172. package/app-template/src/utils/theme-page-context.ts +309 -0
  173. package/app-template/src/utils/variant-validation.ts +41 -0
  174. package/app-template/src/views/account/address-form.tsx +8 -4
  175. package/app-template/src/views/account/contact-form.tsx +148 -131
  176. package/app-template/src/views/account/content-header.tsx +4 -3
  177. package/app-template/src/views/account/faq/faq-tabs.tsx +8 -2
  178. package/app-template/src/views/account/favorite-item.tsx +1 -1
  179. package/app-template/src/views/account/order.tsx +11 -9
  180. package/app-template/src/views/account/orders/order-cancellation-item.tsx +1 -1
  181. package/app-template/src/views/account/orders/order-detail-header.tsx +1 -1
  182. package/app-template/src/views/anonymous-tracking/order-detail/index.tsx +45 -38
  183. package/app-template/src/views/basket/basket-item.tsx +6 -1
  184. package/app-template/src/views/basket/summary.tsx +16 -0
  185. package/app-template/src/views/breadcrumb.tsx +2 -2
  186. package/app-template/src/views/category/category-banner.tsx +4 -23
  187. package/app-template/src/views/category/category-info.tsx +2 -1
  188. package/app-template/src/views/category/filters/filter-item.tsx +138 -42
  189. package/app-template/src/views/category/filters/index.tsx +1 -1
  190. package/app-template/src/views/category/layout.tsx +1 -0
  191. package/app-template/src/views/checkout/auth.tsx +64 -40
  192. package/app-template/src/views/checkout/layout/header.tsx +10 -6
  193. package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +22 -6
  194. package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +25 -5
  195. package/app-template/src/views/checkout/steps/payment/options/loyalty.tsx +21 -2
  196. package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +27 -5
  197. package/app-template/src/views/checkout/steps/payment/options/store-credit.tsx +464 -0
  198. package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +4 -4
  199. package/app-template/src/views/checkout/steps/shipping/address-box.tsx +33 -20
  200. package/app-template/src/views/checkout/steps/shipping/addresses.tsx +2 -2
  201. package/app-template/src/views/checkout/summary.tsx +12 -2
  202. package/app-template/src/views/find-in-store/index.tsx +2 -2
  203. package/app-template/src/views/guest-login/index.tsx +62 -58
  204. package/app-template/src/views/header/action-menu.tsx +1 -1
  205. package/app-template/src/views/header/band.tsx +2 -2
  206. package/app-template/src/views/header/index.tsx +1 -1
  207. package/app-template/src/views/header/mini-basket.tsx +3 -3
  208. package/app-template/src/views/header/mobile-hamburger-button.tsx +5 -8
  209. package/app-template/src/views/header/mobile-menu.tsx +18 -6
  210. package/app-template/src/views/header/navbar.tsx +1 -1
  211. package/app-template/src/views/header/pwa-back-button.tsx +1 -1
  212. package/app-template/src/views/header/search/index.tsx +13 -3
  213. package/app-template/src/views/header/search/results.tsx +1 -1
  214. package/app-template/src/views/header/user-menu.tsx +1 -3
  215. package/app-template/src/views/login/index.tsx +66 -57
  216. package/app-template/src/views/otp-login/index.tsx +11 -6
  217. package/app-template/src/views/product/index.ts +1 -0
  218. package/app-template/src/views/product/layout.tsx +26 -6
  219. package/app-template/src/views/product/price-wrapper.tsx +3 -24
  220. package/app-template/src/views/product/product-actions.tsx +165 -0
  221. package/app-template/src/views/product/product-info.tsx +76 -238
  222. package/app-template/src/views/product/product-share.tsx +58 -0
  223. package/app-template/src/views/product/product-variants.tsx +26 -0
  224. package/app-template/src/views/product/slider.tsx +22 -1
  225. package/app-template/src/views/product/variant.tsx +69 -41
  226. package/app-template/src/views/product-pointer-banner-item.tsx +1 -1
  227. package/app-template/src/views/register/index.tsx +31 -46
  228. package/app-template/src/views/sales-contract-modal/index.tsx +17 -17
  229. package/app-template/src/views/share/index.tsx +9 -6
  230. package/app-template/src/views/widgets/home-hero-slider-content.tsx +41 -39
  231. package/app-template/src/widgets/flatpages/about-us/index.tsx +78 -0
  232. package/app-template/src/widgets/flatpages/blog-list/index.tsx +129 -0
  233. package/app-template/src/widgets/footer-info.tsx +1 -1
  234. package/app-template/src/widgets/footer-menu.tsx +7 -3
  235. package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +17 -14
  236. package/app-template/src/widgets/footer-subscription/index.tsx +1 -1
  237. package/app-template/src/widgets/home-stories-eng.tsx +43 -35
  238. package/app-template/src/widgets/index.ts +7 -0
  239. package/app-template/src/widgets/schemas/about-us.json +46 -0
  240. package/app-template/src/widgets/schemas/blog-list.json +37 -0
  241. package/app-template/src/widgets/schemas/blog.json +29 -0
  242. package/app-template/tailwind.config.js +155 -7
  243. package/app-template/tsconfig.json +29 -11
  244. package/codemods/migrate-auth-v5/index.js +339 -0
  245. package/codemods/migrate-auth-v5/transform.js +86 -0
  246. package/codemods/migrate-segments/index.js +591 -0
  247. package/codemods/update-tailwind-config/index.js +30 -0
  248. package/codemods/update-tailwind-config/transform.js +102 -0
  249. package/codemods/upgrade-to-2/index.js +549 -0
  250. package/commands/codemod.ts +0 -1
  251. package/commands/plugins.ts +111 -46
  252. package/dist/commands/codemod.js +0 -1
  253. package/dist/commands/plugins.js +104 -36
  254. package/package.json +3 -2
  255. package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/page.tsx +0 -22
  256. package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/page.tsx +0 -20
  257. package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/page.tsx +0 -74
  258. package/app-template/src/app/[commerce]/[locale]/[currency]/list/page.tsx +0 -18
  259. package/app-template/src/app/[commerce]/[locale]/[currency]/page.tsx +0 -50
  260. package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/page.tsx +0 -84
  261. package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/page.tsx +0 -27
  262. package/app-template/src/pages/api/auth/[...nextauth].ts +0 -3
  263. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/address/page.tsx +0 -0
  264. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/change-email/page.tsx +0 -0
  265. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/change-password/page.tsx +0 -0
  266. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/contact/page.tsx +0 -0
  267. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/coupons/page.tsx +0 -0
  268. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/email-verification/page.tsx +0 -0
  269. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/faq/page.tsx +0 -0
  270. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/favourite-products/page.tsx +0 -0
  271. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/my-quotations/page.tsx +0 -0
  272. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/[id]/layout.tsx +0 -0
  273. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/account/orders/page.tsx +0 -0
  274. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/anonymous-tracking/page.tsx +0 -0
  275. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/auth/oauth-login/page.tsx +0 -0
  276. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/basket-b2b/page.tsx +0 -0
  277. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/category/[pk]/loading.tsx +0 -0
  278. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/client-root.tsx +0 -0
  279. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/contact-us/page.tsx +0 -0
  280. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/error.tsx +0 -0
  281. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/flat-page/[pk]/loading.tsx +0 -0
  282. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/group-product/[pk]/loading.tsx +0 -0
  283. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/landing-page/[pk]/loading.tsx +0 -0
  284. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/list/loading.tsx +0 -0
  285. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/checkout/page.tsx +0 -0
  286. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/orders/completed/[token]/layout.tsx +0 -0
  287. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/special-page/[pk]/loading.tsx +0 -0
  288. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/template.tsx +0 -0
  289. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/users/password/reset/page.tsx +0 -0
  290. /package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/xml-sitemap/route.ts +0 -0
@@ -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[43mWarning: The "${packageName}" package is currently at version ${pkg.dependencies['@akinon/next']}. Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`,
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
- const pkg: PackageJson = require(path.resolve(rootDir, './package.json'));
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: 'Click & Collect',
79
- value: 'pz-click-collect'
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: 'One Click Checkout',
87
- value: 'pz-one-click-checkout'
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: 'Pay On Delivery',
95
- value: 'pz-pay-on-delivery'
136
+ name: 'Masterpass',
137
+ value: 'pz-masterpass'
96
138
  },
97
139
  {
98
- name: 'Otp',
99
- value: 'pz-otp'
140
+ name: 'Multi Basket',
141
+ value: 'pz-multi-basket'
100
142
  },
101
143
  {
102
- name: 'BKM Express',
103
- value: 'pz-bkm'
144
+ name: 'One Click Checkout',
145
+ value: 'pz-one-click-checkout'
104
146
  },
105
147
  {
106
- name: 'Credit Payment',
107
- value: 'pz-credit-payment'
148
+ name: 'Otp',
149
+ value: 'pz-otp'
108
150
  },
109
151
  {
110
- name: 'Multi Basket',
111
- value: 'pz-multi-basket'
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
- const prompt = new Prompt({
124
- name: 'plugins',
125
- message: 'Please check/uncheck plugins to install/uninstall.',
126
- type: 'checkbox',
127
- default: installedPlugins.map((p) =>
128
- definedPlugins.findIndex((dp) => dp.value === p)
129
- ),
130
- choices: definedPlugins.map((p, index) => `${index + 1}) ${p.name}`)
131
- });
132
-
133
- prompt.ask(async (answers: Array<string>) => {
134
- const formattedAnswers = answers.map((answer) =>
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(values)};\n`,
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
- formattedAnswers.length
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
  };
@@ -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);
@@ -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 Prompt = require('prompt-checkbox');
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[43mWarning: The "${packageName}" package is currently at version ${pkg.dependencies['@akinon/next']}. Please upgrade it to the latest version (${latestVersion}) to ensure plugin compatibility.`, '\x1b[0m\n');
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
- const pkg = require(path_1.default.resolve(rootDir, './package.json'));
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: 'Click & Collect',
103
- value: 'pz-click-collect'
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: 'One Click Checkout',
111
- value: 'pz-one-click-checkout'
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: 'Pay On Delivery',
119
- value: 'pz-pay-on-delivery'
155
+ name: 'Masterpass',
156
+ value: 'pz-masterpass'
120
157
  },
121
158
  {
122
- name: 'Otp',
123
- value: 'pz-otp'
159
+ name: 'Multi Basket',
160
+ value: 'pz-multi-basket'
124
161
  },
125
162
  {
126
- name: 'BKM Express',
127
- value: 'pz-bkm'
163
+ name: 'One Click Checkout',
164
+ value: 'pz-one-click-checkout'
128
165
  },
129
166
  {
130
- name: 'Credit Payment',
131
- value: 'pz-credit-payment'
167
+ name: 'Otp',
168
+ value: 'pz-otp'
132
169
  },
133
170
  {
134
- name: 'Multi Basket',
135
- value: 'pz-multi-basket'
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
- const prompt = new Prompt({
147
- name: 'plugins',
148
- message: 'Please check/uncheck plugins to install/uninstall.',
149
- type: 'checkbox',
150
- default: installedPlugins.map((p) => definedPlugins.findIndex((dp) => dp.value === p)),
151
- choices: definedPlugins.map((p, index) => `${index + 1}) ${p.name}`)
152
- });
153
- prompt.ask((answers) => __awaiter(void 0, void 0, void 0, function* () {
154
- const formattedAnswers = answers.map((answer) => answer.replace(/\d\)\s/, ''));
155
- const values = formattedAnswers.map((answer) => { var _a; return (_a = definedPlugins.find((p) => p.name === answer)) === null || _a === void 0 ? void 0 : _a.value; });
156
- if (formattedAnswers.length) {
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(values)};\n`, {
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 ✓ ${formattedAnswers.length
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-beta.9",
3
+ "version": "2.0.1",
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' });