@akinon/projectzero 2.0.32 → 2.0.33-rc.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/app-template/.env.example +1 -0
  3. package/app-template/AGENTS.md +8 -0
  4. package/app-template/CHANGELOG.md +77 -0
  5. package/app-template/README.md +25 -1
  6. package/app-template/next.config.mjs +7 -1
  7. package/app-template/package.json +41 -41
  8. package/app-template/public/locales/en/checkout.json +50 -0
  9. package/app-template/public/locales/tr/checkout.json +50 -0
  10. package/app-template/src/app/[pz]/basket/page.tsx +33 -6
  11. package/app-template/src/app/[pz]/orders/checkout/page.tsx +57 -92
  12. package/app-template/src/app/api/theme-settings/route.ts +21 -2
  13. package/app-template/src/app/global-error.tsx +22 -0
  14. package/app-template/src/data/server/theme.ts +6 -25
  15. package/app-template/src/hooks/index.ts +2 -0
  16. package/app-template/src/plugins.js +1 -0
  17. package/app-template/src/proxy.ts +2 -1
  18. package/app-template/src/views/checkout/variants/basket-and-checkout/basket-section.tsx +149 -0
  19. package/app-template/src/views/checkout/variants/basket-and-checkout/index.tsx +132 -0
  20. package/app-template/src/views/checkout/variants/multi-step/index.tsx +73 -0
  21. package/app-template/src/views/checkout/variants/one-page/accordion-section.tsx +140 -0
  22. package/app-template/src/views/checkout/variants/one-page/hooks/use-checkout-funnel-gtm.ts +60 -0
  23. package/app-template/src/views/checkout/variants/one-page/hooks/use-section-state.ts +99 -0
  24. package/app-template/src/views/checkout/variants/one-page/index.tsx +125 -0
  25. package/app-template/src/views/checkout/variants/one-page/mobile-summary-sheet.tsx +109 -0
  26. package/app-template/src/views/checkout/variants/one-page/one-page-summary.tsx +237 -0
  27. package/app-template/src/views/checkout/variants/one-page/payment-options-grid.tsx +201 -0
  28. package/app-template/src/views/checkout/variants/one-page/sections/address-section.tsx +318 -0
  29. package/app-template/src/views/checkout/variants/one-page/sections/contact-section.tsx +62 -0
  30. package/app-template/src/views/checkout/variants/one-page/sections/payment-section.tsx +71 -0
  31. package/app-template/src/views/checkout/variants/one-page/sections/shipping-section.tsx +298 -0
  32. package/app-template/src/views/checkout/variants/one-page/skeletons/address-skeleton.tsx +25 -0
  33. package/app-template/src/views/checkout/variants/one-page/skeletons/checkout-skeleton.tsx +27 -0
  34. package/app-template/src/views/checkout/variants/one-page/skeletons/index.ts +6 -0
  35. package/app-template/src/views/checkout/variants/one-page/skeletons/payment-skeleton.tsx +23 -0
  36. package/app-template/src/views/checkout/variants/one-page/skeletons/section-skeleton.tsx +47 -0
  37. package/app-template/src/views/checkout/variants/one-page/skeletons/shipping-skeleton.tsx +20 -0
  38. package/app-template/src/views/checkout/variants/one-page/skeletons/summary-skeleton.tsx +38 -0
  39. package/app-template/src/views/checkout/variants/one-page/trust-badges.tsx +30 -0
  40. package/app-template/src/views/checkout/variants/registry.ts +32 -0
  41. package/app-template/src/views/checkout/variants/types.ts +30 -0
  42. package/app-template/src/views/checkout/variants/use-resolved-config.ts +89 -0
  43. package/app-template/src/views/header/search/index.tsx +13 -5
  44. package/app-template/src/views/product/slider.tsx +85 -38
  45. package/commands/plugins.ts +4 -0
  46. package/dist/commands/plugins.js +4 -0
  47. package/package.json +1 -1
@@ -4,8 +4,7 @@ import { useEffect, useRef, useState } from 'react';
4
4
  import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
5
5
  import { closeSearch } from '@akinon/next/redux/reducers/header';
6
6
  import clsx from 'clsx';
7
-
8
- import { Icon } from '@theme/components';
7
+ import { Icon, Input } from '@theme/components';
9
8
  import Results from './results';
10
9
  import { ROUTES } from '@theme/routes';
11
10
  import { useLocalization, useRouter } from '@akinon/next/hooks';
@@ -42,6 +41,14 @@ export default function Search() {
42
41
  };
43
42
  }, [isSearchOpen, dispatch]);
44
43
 
44
+ const handleSearchTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
45
+ setSearchText(e.target.value);
46
+ };
47
+
48
+ const handleCloseSearch = () => {
49
+ dispatch(closeSearch());
50
+ };
51
+
45
52
  return (
46
53
  <>
47
54
  <div
@@ -67,9 +74,9 @@ export default function Search() {
67
74
  {t('common.search.results_for')}
68
75
  </span>
69
76
  <div className="flex items-center">
70
- <input
77
+ <Input
71
78
  value={searchText}
72
- onChange={(e) => setSearchText(e.target.value)}
79
+ onChange={handleSearchTextChange}
73
80
  onKeyDown={(e) => {
74
81
  if (e.key === 'Enter' && searchText.trim() !== '') {
75
82
  router.push(`${ROUTES.LIST}/?search_text=${searchText}`);
@@ -91,11 +98,12 @@ export default function Search() {
91
98
  <Icon
92
99
  name="close"
93
100
  size={14}
94
- onClick={() => dispatch(closeSearch())}
101
+ onClick={handleCloseSearch}
95
102
  className="cursor-pointer"
96
103
  />
97
104
  </div>
98
105
  </div>
106
+
99
107
  <Results searchText={searchText} />
100
108
  </div>
101
109
  </div>
@@ -36,53 +36,100 @@ export default function ProductInfoSlider({ product }: ProductSliderItem) {
36
36
  carouselRef.current?.next();
37
37
  };
38
38
 
39
- const handleThumbnailClick = (index) => {
39
+ const handleThumbnailClick = (index: number) => {
40
40
  setActiveIndex(index);
41
41
  carouselRef.current?.goToSlide(index);
42
42
  };
43
43
 
44
44
  return (
45
- <div className="lg:grid lg:grid-cols-6">
46
- <div className="lg:col-span-1">
47
- <div className="flex flex-col items-center justify-center md:mr-[6px]">
48
- <button
49
- onClick={goToPrev}
50
- className={twMerge(
51
- 'hidden justify-center p-2 mb-3 border border-gray-100 rounded-full cursor-pointer lg:block',
52
- [activeIndex === 0 && 'cursor-not-allowed opacity-45']
53
- )}
54
- disabled={activeIndex === 0}
45
+ <>
46
+ <div className="lg:grid lg:grid-cols-6">
47
+ <div className="lg:col-span-1">
48
+ <div className="flex flex-col items-center justify-center md:mr-[6px]">
49
+ <button
50
+ onClick={goToPrev}
51
+ className={twMerge(
52
+ 'hidden justify-center p-2 mb-3 border border-gray-100 rounded-full cursor-pointer lg:block',
53
+ [activeIndex === 0 && 'cursor-not-allowed opacity-45']
54
+ )}
55
+ disabled={activeIndex === 0}
56
+ >
57
+ <Icon name="chevron-up" size={15} className="fill-[#000000]" />
58
+ </button>
59
+ <div className="hidden flex-col items-center overflow-scroll w-[80px] max-h-[620px] lg:block">
60
+ {product?.productimage_set?.map((item, index) => (
61
+ <Image
62
+ key={index}
63
+ src={item.image}
64
+ alt={`Thumbnail ${index}`}
65
+ width={80}
66
+ height={128}
67
+ aspectRatio={80 / 128}
68
+ className={twMerge('cursor-pointer', [
69
+ activeIndex === index && 'border-2 border-primary'
70
+ ])}
71
+ onClick={() => handleThumbnailClick(index)}
72
+ />
73
+ ))}
74
+ </div>
75
+ <button
76
+ onClick={goToNext}
77
+ className={twMerge(
78
+ 'hidden justify-center p-2 mt-3 border border-gray-100 rounded-full cursor-pointer lg:block',
79
+ [
80
+ activeIndex === product.productimage_set.length - 1 &&
81
+ 'cursor-not-allowed opacity-45'
82
+ ]
83
+ )}
84
+ disabled={activeIndex === product.productimage_set.length - 1}
85
+ >
86
+ <Icon name="chevron-down" size={15} className="fill-[#000000]" />
87
+ </button>
88
+ </div>
89
+ </div>
90
+
91
+ <div className="relative lg:col-span-5">
92
+ <FavButton className="absolute right-8 top-6 z-[20] sm:hidden" />
93
+
94
+ <PluginModule
95
+ component={Component.ProductImageSearchFeature}
96
+ props={{
97
+ product,
98
+ activeIndex,
99
+ showResetButton: true
100
+ }}
101
+ />
102
+
103
+ <CarouselCore
104
+ responsive={{
105
+ all: {
106
+ breakpoint: { max: 5000, min: 0 },
107
+ items: 1
108
+ }
109
+ }}
110
+ arrows={false}
111
+ swipeable={true}
112
+ ref={carouselRef}
113
+ afterChange={(previousSlide, { currentSlide }) => {
114
+ setActiveIndex(currentSlide);
115
+ }}
116
+ containerAspectRatio={{ mobile: 520 / 798, desktop: 484 / 726 }}
55
117
  >
56
- <Icon name="chevron-up" size={15} className="fill-[#000000]" />
57
- </button>
58
- <div className="hidden flex-col items-center overflow-scroll w-[80px] max-h-[620px] lg:block">
59
- {product?.productimage_set?.map((item, index) => (
118
+ {product?.productimage_set?.map((item, i) => (
60
119
  <Image
61
- key={index}
120
+ key={i}
62
121
  src={item.image}
63
- alt={`Thumbnail ${index}`}
64
- width={80}
65
- height={128}
66
- className={twMerge('cursor-pointer', [
67
- activeIndex === index && 'border-2 border-primary'
68
- ])}
69
- onClick={() => handleThumbnailClick(index)}
122
+ alt={product?.name || 'Product image'}
123
+ draggable={false}
124
+ aspectRatio={484 / 726}
125
+ sizes="(min-width: 425px) 512px,
126
+ (min-width: 601px) 576px,
127
+ (min-width: 768px) 336px,
128
+ (min-width: 1024px) 484px, 368px"
129
+ fill
70
130
  />
71
131
  ))}
72
- </div>
73
- <button
74
- onClick={goToNext}
75
- className={twMerge(
76
- 'hidden justify-center p-2 mt-3 border border-gray-100 rounded-full cursor-pointer lg:block',
77
- [
78
- activeIndex === product.productimage_set.length - 1 &&
79
- 'cursor-not-allowed opacity-45'
80
- ]
81
- )}
82
- disabled={activeIndex === product.productimage_set.length - 1}
83
- >
84
- <Icon name="chevron-down" size={15} className="fill-[#000000]" />
85
- </button>
132
+ </CarouselCore>
86
133
  </div>
87
134
  </div>
88
135
 
@@ -140,6 +187,6 @@ export default function ProductInfoSlider({ product }: ProductSliderItem) {
140
187
  ))}
141
188
  </CarouselCore>
142
189
  </div>
143
- </div>
190
+ </>
144
191
  );
145
192
  }
@@ -164,6 +164,10 @@ export default async () => {
164
164
  name: 'Tamara Payment Extension',
165
165
  value: 'pz-tamara-extension'
166
166
  },
167
+ {
168
+ name: 'Similar Products',
169
+ value: 'pz-similar-products'
170
+ },
167
171
  {
168
172
  name: 'Hepsipay',
169
173
  value: 'pz-hepsipay'
@@ -183,6 +183,10 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
183
183
  name: 'Tamara Payment Extension',
184
184
  value: 'pz-tamara-extension'
185
185
  },
186
+ {
187
+ name: 'Similar Products',
188
+ value: 'pz-similar-products'
189
+ },
186
190
  {
187
191
  name: 'Hepsipay',
188
192
  value: 'pz-hepsipay'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "2.0.32",
3
+ "version": "2.0.33-rc.0",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {