@akinon/projectzero 1.115.0-snapshot-ZERO-3895-20251210115756 → 1.116.0-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 (29) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/app-template/.env.example +1 -0
  3. package/app-template/CHANGELOG.md +90 -0
  4. package/app-template/README.md +25 -1
  5. package/app-template/package.json +27 -25
  6. package/app-template/public/locales/en/account.json +3 -1
  7. package/app-template/public/locales/en/common.json +42 -1
  8. package/app-template/public/locales/en/product.json +3 -3
  9. package/app-template/public/locales/tr/account.json +3 -1
  10. package/app-template/public/locales/tr/common.json +42 -1
  11. package/app-template/public/locales/tr/product.json +1 -1
  12. package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/page.tsx +20 -1
  13. package/app-template/src/app/api/image-proxy/route.ts +1 -0
  14. package/app-template/src/app/api/product-categories/route.ts +1 -0
  15. package/app-template/src/app/api/similar-product-list/route.ts +1 -0
  16. package/app-template/src/app/api/similar-products/route.ts +1 -0
  17. package/app-template/src/components/modal.tsx +2 -0
  18. package/app-template/src/components/select.tsx +1 -1
  19. package/app-template/src/hooks/index.ts +2 -0
  20. package/app-template/src/plugins.js +4 -1
  21. package/app-template/src/routes/index.ts +2 -1
  22. package/app-template/src/views/account/orders/order-detail-header.tsx +1 -1
  23. package/app-template/src/views/checkout/steps/shipping/address-box.tsx +30 -17
  24. package/app-template/src/views/checkout/steps/shipping/addresses.tsx +1 -1
  25. package/app-template/src/views/header/search/index.tsx +23 -5
  26. package/app-template/src/views/product/slider.tsx +95 -37
  27. package/commands/plugins.ts +12 -0
  28. package/dist/commands/plugins.js +250 -172
  29. package/package.json +1 -1
@@ -4,11 +4,11 @@ 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';
11
+ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
12
12
 
13
13
  export default function Search() {
14
14
  const { t } = useLocalization();
@@ -41,6 +41,14 @@ export default function Search() {
41
41
  };
42
42
  }, [isSearchOpen, dispatch]);
43
43
 
44
+ const handleSearchTextChange = (e: React.ChangeEvent<HTMLInputElement>) => {
45
+ setSearchText(e.target.value);
46
+ };
47
+
48
+ const handleCloseSearch = () => {
49
+ dispatch(closeSearch());
50
+ };
51
+
44
52
  return (
45
53
  <>
46
54
  <div
@@ -66,9 +74,9 @@ export default function Search() {
66
74
  {t('common.search.results_for')}
67
75
  </span>
68
76
  <div className="flex items-center">
69
- <input
77
+ <Input
70
78
  value={searchText}
71
- onChange={(e) => setSearchText(e.target.value)}
79
+ onChange={handleSearchTextChange}
72
80
  onKeyDown={(e) => {
73
81
  if (e.key === 'Enter' && searchText.trim() !== '') {
74
82
  router.push(`${ROUTES.LIST}/?search_text=${searchText}`);
@@ -78,14 +86,24 @@ export default function Search() {
78
86
  placeholder={t('common.search.placeholder')}
79
87
  ref={inputRef}
80
88
  />
89
+
90
+ <PluginModule
91
+ component={Component.HeaderImageSearchFeature}
92
+ props={{
93
+ enableTextSearch: true,
94
+ isEnabled: true
95
+ }}
96
+ />
97
+
81
98
  <Icon
82
99
  name="close"
83
100
  size={14}
84
- onClick={() => dispatch(closeSearch())}
101
+ onClick={handleCloseSearch}
85
102
  className="cursor-pointer"
86
103
  />
87
104
  </div>
88
105
  </div>
106
+
89
107
  <Results searchText={searchText} />
90
108
  </div>
91
109
  </div>
@@ -36,59 +36,117 @@ 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
 
89
136
  <div className="relative lg:col-span-5">
90
137
  <FavButton className="absolute right-8 top-6 z-[20] sm:hidden" />
91
138
 
139
+ <PluginModule
140
+ component={Component.ProductImageSearchFeature}
141
+ props={{
142
+ product,
143
+ activeIndex,
144
+ showResetButton: true,
145
+ enableTextSearch: true,
146
+ isEnabled: true
147
+ }}
148
+ />
149
+
92
150
  <PluginModule
93
151
  component={Component.VirtualTryOnPlugin}
94
152
  props={{
@@ -137,6 +137,10 @@ export default async () => {
137
137
  name: 'Tamara Payment Extension',
138
138
  value: 'pz-tamara-extension'
139
139
  },
140
+ {
141
+ name: 'Similar Products',
142
+ value: 'pz-similar-products'
143
+ },
140
144
  {
141
145
  name: 'Hepsipay',
142
146
  value: 'pz-hepsipay'
@@ -152,6 +156,14 @@ export default async () => {
152
156
  {
153
157
  name: 'Masterpass Rest',
154
158
  value: 'pz-masterpass-rest'
159
+ },
160
+ {
161
+ name: 'Similar Products',
162
+ value: 'pz-similar-products'
163
+ },
164
+ {
165
+ name: 'Haso Payment Gateway',
166
+ value: 'pz-haso'
155
167
  }
156
168
  ];
157
169