@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 2.0.33-rc.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 143be2b9d: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
8
+ - d99a6a7d5: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
9
+ - e18836b2: ZERO-4160: Restore scope in Sentry addon configuration in akinon.json
10
+
3
11
  ## 2.0.32
4
12
 
5
13
  ## 2.0.31
@@ -7,6 +7,7 @@ NEXT_PUBLIC_URL=http://localhost:3000
7
7
  SERVICE_BACKEND_URL=https://02fde10fee4440269e695aa10707dfaf.lb.akinoncloud.com
8
8
  SITEMAP_S3_BUCKET_NAME=0fb534
9
9
  NEXT_PUBLIC_VIRTUAL_TRY_ON_API_URL=https://d2a26507c7094f359aba349b96a96881.lb.akinoncloud.com
10
+ NEXT_PUBLIC_ENABLE_IMAGE_SEARCH=true
10
11
 
11
12
  # LOG_LEVEL_DEV=debug # For more details, please refer to the Logging documentation.
12
13
 
@@ -1,3 +1,11 @@
1
+ <!-- BEGIN:nextjs-agent-rules -->
2
+
3
+ # Next.js: ALWAYS read docs before coding
4
+
5
+ Before any Next.js work, find and read the relevant doc in `node_modules/next/dist/docs/`. Your training data is outdated — the docs are the source of truth.
6
+
7
+ <!-- END:nextjs-agent-rules -->
8
+
1
9
  # Project Zero Next.js - Developer Instructions
2
10
 
3
11
  ## 📚 Available Instruction Files
@@ -1,9 +1,86 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 2.0.33-rc.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 1a8622a9b: ZERO-3392: Implemented AI Search functionality and update env
8
+ - b55acb768: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
9
+ - 143be2b9d: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
10
+ - 9f8cd3bc5: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
11
+ - d99a6a7d5: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
12
+ - ccf21475: ZERO-4404: Add Next.js 16.2 AI improvements
13
+ - c0228aff: ZERO-4159: Upgrade the package versions
14
+ - b05c35435: ZERO-2570: Category filters routes to absolute url
15
+ - e18836b2: ZERO-4160: Restore scope in Sentry addon configuration in akinon.json
16
+ - c3244a31: ZERO-4013: Update runtime version to node:25-alpine in project configuration
17
+ - Updated dependencies [a3e2acbf]
18
+ - Updated dependencies [0cf9ea23]
19
+ - Updated dependencies [324f97d5]
20
+ - Updated dependencies [51ea0688]
21
+ - Updated dependencies
22
+ - Updated dependencies [c97525a3]
23
+ - Updated dependencies [eba125b2]
24
+ - Updated dependencies [823a4449]
25
+ - Updated dependencies [b55acb768]
26
+ - Updated dependencies [760258c1]
27
+ - Updated dependencies [5da13fff]
28
+ - Updated dependencies [143be2b9d]
29
+ - Updated dependencies [7889b08f]
30
+ - Updated dependencies [fb4aa9b4]
31
+ - Updated dependencies [9f8cd3bc5]
32
+ - Updated dependencies [d51fa68e]
33
+ - Updated dependencies [bfafa3f4]
34
+ - Updated dependencies [00b9f488]
35
+ - Updated dependencies [57d7eb30]
36
+ - Updated dependencies [d99a6a7d5]
37
+ - Updated dependencies [9db81a71]
38
+ - Updated dependencies [591e345e]
39
+ - Updated dependencies [0df6bc1f]
40
+ - Updated dependencies [4de5303c5]
41
+ - Updated dependencies [63a72000]
42
+ - Updated dependencies [95b139dc1]
43
+ - Updated dependencies [1d00f2d0]
44
+ - Updated dependencies [4ac7b2a1]
45
+ - Updated dependencies [4998a963]
46
+ - Updated dependencies [804d2bd6]
47
+ - Updated dependencies [c0228aff]
48
+ - Updated dependencies [3909d3224]
49
+ - Updated dependencies [6a3d8a63]
50
+ - Updated dependencies [e18836b2]
51
+ - @akinon/pz-tabby-extension@2.0.33-rc.0
52
+ - @akinon/next@2.0.33-rc.0
53
+ - @akinon/pz-checkout-gift-pack@2.0.33-rc.0
54
+ - @akinon/pz-one-click-checkout@2.0.33-rc.0
55
+ - @akinon/pz-basket-gift-pack@2.0.33-rc.0
56
+ - @akinon/pz-masterpass-rest@2.0.33-rc.0
57
+ - @akinon/pz-pay-on-delivery@2.0.33-rc.0
58
+ - @akinon/pz-credit-payment@2.0.33-rc.0
59
+ - @akinon/pz-click-collect@2.0.33-rc.0
60
+ - @akinon/pz-multi-basket@2.0.33-rc.0
61
+ - @akinon/pz-masterpass@2.0.33-rc.0
62
+ - @akinon/pz-gpay@2.0.33-rc.0
63
+ - @akinon/pz-b2b@2.0.33-rc.0
64
+ - @akinon/pz-bkm@2.0.33-rc.0
65
+ - @akinon/pz-otp@2.0.33-rc.0
66
+ - @akinon/pz-similar-products@2.0.33-rc.0
67
+ - @akinon/pz-virtual-try-on@2.0.33-rc.0
68
+ - @akinon/pz-theme@2.0.33-rc.0
69
+ - @akinon/pz-akifast@2.0.33-rc.0
70
+ - @akinon/pz-apple-pay@2.0.33-rc.0
71
+ - @akinon/pz-cybersource-uc@2.0.33-rc.0
72
+ - @akinon/pz-flow-payment@2.0.33-rc.0
73
+ - @akinon/pz-google-pay@2.0.33-rc.0
74
+ - @akinon/pz-haso@2.0.33-rc.0
75
+ - @akinon/pz-hepsipay@2.0.33-rc.0
76
+ - @akinon/pz-saved-card@2.0.33-rc.0
77
+ - @akinon/pz-tamara-extension@2.0.33-rc.0
78
+
3
79
  ## 2.0.32
4
80
 
5
81
  ### Patch Changes
6
82
 
83
+ - 275fca44: ZERO-4429: Add settings-driven checkout variant system
7
84
  - Updated dependencies [239aa9d0]
8
85
  - @akinon/next@2.0.32
9
86
  - @akinon/pz-theme@2.0.32
@@ -12,6 +12,30 @@ Run `cp .env.example .env && yarn` command at project root and all dependencies
12
12
 
13
13
  - `SITEMAP_S3_BUCKET_NAME`: S3 bucket name for XML sitemaps (e.g., "0fb534"). This is required for the sitemap route to function correctly.
14
14
 
15
+ ### Optional Environment Variables
16
+
17
+ - `NEXT_PUBLIC_ENABLE_IMAGE_SEARCH`: Set to `true` to enable image search feature for all users. If not set or `false`, the feature will only be visible to users who have enabled it via localStorage.
18
+
19
+ ## Image Search Feature
20
+
21
+ The image search functionality allows users to search for similar products by uploading images or cropping existing product images.
22
+
23
+ ### Feature Visibility Control
24
+
25
+ The image search feature can be controlled in two ways:
26
+
27
+ 1. **Environment Variable (Global)**: Set `NEXT_PUBLIC_ENABLE_IMAGE_SEARCH=true` to enable for all users
28
+ 2. **localStorage (Individual Users)**: Users can enable it locally using browser developer tools
29
+
30
+ ````
31
+
32
+ ### Feature Locations
33
+
34
+ When enabled, the image search feature appears in:
35
+
36
+ - **Header Search**: Camera icon next to the search input
37
+ - **Product Detail Page**: "View Similar Styles" button on product images
38
+
15
39
  ### Build
16
40
 
17
41
  To build the app, run the following command:
@@ -19,7 +43,7 @@ To build the app, run the following command:
19
43
  ```bash
20
44
  cd projectzeronext # Project root
21
45
  yarn build
22
- ```
46
+ ````
23
47
 
24
48
  ### Develop
25
49
 
@@ -38,6 +38,9 @@ const nextConfig = {
38
38
  ]
39
39
  }
40
40
  ];
41
+ },
42
+ logging: {
43
+ browserToTerminal: 'error'
41
44
  }
42
45
  };
43
46
 
@@ -50,9 +53,12 @@ const withSerwist = withSerwistInit({
50
53
  const sentryConfig = {
51
54
  silent: true,
52
55
  dryRun: !process.env.SENTRY_DSN,
53
- org: 'akinon'
56
+ org: 'akinon',
54
57
  // project: 'enter_your_project_name_here',
55
58
  // authToken: 'enter_your_auth_token_here'
59
+ sourcemaps: {
60
+ deleteSourcemapsAfterUpload: true
61
+ }
56
62
  };
57
63
 
58
64
  const enhancedConfig = withPzConfig(nextConfig);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "2.0.32",
3
+ "version": "2.0.33-rc.0",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -24,33 +24,33 @@
24
24
  "test:middleware": "jest middleware-matcher.test.ts --bail"
25
25
  },
26
26
  "dependencies": {
27
- "@akinon/next": "2.0.32",
28
- "@akinon/pz-akifast": "2.0.32",
29
- "@akinon/pz-apple-pay": "2.0.32",
30
- "@akinon/pz-b2b": "2.0.32",
31
- "@akinon/pz-basket-gift-pack": "2.0.32",
32
- "@akinon/pz-bkm": "2.0.32",
33
- "@akinon/pz-checkout-gift-pack": "2.0.32",
34
- "@akinon/pz-click-collect": "2.0.32",
35
- "@akinon/pz-credit-payment": "2.0.32",
36
- "@akinon/pz-cybersource-uc": "2.0.32",
37
- "@akinon/pz-flow-payment": "2.0.32",
38
- "@akinon/pz-google-pay": "2.0.32",
39
- "@akinon/pz-gpay": "2.0.32",
40
- "@akinon/pz-haso": "2.0.32",
41
- "@akinon/pz-hepsipay": "2.0.32",
42
- "@akinon/pz-masterpass": "2.0.32",
43
- "@akinon/pz-masterpass-rest": "2.0.32",
44
- "@akinon/pz-multi-basket": "2.0.32",
45
- "@akinon/pz-one-click-checkout": "2.0.32",
46
- "@akinon/pz-otp": "2.0.32",
47
- "@akinon/pz-pay-on-delivery": "2.0.32",
48
- "@akinon/pz-saved-card": "2.0.32",
49
- "@akinon/pz-similar-products": "2.0.32",
50
- "@akinon/pz-tabby-extension": "2.0.32",
51
- "@akinon/pz-tamara-extension": "2.0.32",
52
- "@akinon/pz-theme": "2.0.32",
53
- "@akinon/pz-virtual-try-on": "2.0.32",
27
+ "@akinon/next": "2.0.33-rc.0",
28
+ "@akinon/pz-akifast": "2.0.33-rc.0",
29
+ "@akinon/pz-apple-pay": "2.0.33-rc.0",
30
+ "@akinon/pz-b2b": "2.0.33-rc.0",
31
+ "@akinon/pz-basket-gift-pack": "2.0.33-rc.0",
32
+ "@akinon/pz-bkm": "2.0.33-rc.0",
33
+ "@akinon/pz-checkout-gift-pack": "2.0.33-rc.0",
34
+ "@akinon/pz-click-collect": "2.0.33-rc.0",
35
+ "@akinon/pz-credit-payment": "2.0.33-rc.0",
36
+ "@akinon/pz-cybersource-uc": "2.0.33-rc.0",
37
+ "@akinon/pz-flow-payment": "2.0.33-rc.0",
38
+ "@akinon/pz-google-pay": "2.0.33-rc.0",
39
+ "@akinon/pz-gpay": "2.0.33-rc.0",
40
+ "@akinon/pz-haso": "2.0.33-rc.0",
41
+ "@akinon/pz-hepsipay": "2.0.33-rc.0",
42
+ "@akinon/pz-masterpass": "2.0.33-rc.0",
43
+ "@akinon/pz-masterpass-rest": "2.0.33-rc.0",
44
+ "@akinon/pz-multi-basket": "2.0.33-rc.0",
45
+ "@akinon/pz-one-click-checkout": "2.0.33-rc.0",
46
+ "@akinon/pz-otp": "2.0.33-rc.0",
47
+ "@akinon/pz-pay-on-delivery": "2.0.33-rc.0",
48
+ "@akinon/pz-saved-card": "2.0.33-rc.0",
49
+ "@akinon/pz-similar-products": "2.0.33-rc.0",
50
+ "@akinon/pz-tabby-extension": "2.0.33-rc.0",
51
+ "@akinon/pz-tamara-extension": "2.0.33-rc.0",
52
+ "@akinon/pz-theme": "2.0.33-rc.0",
53
+ "@akinon/pz-virtual-try-on": "2.0.33-rc.0",
54
54
  "@hookform/resolvers": "2.9.0",
55
55
  "@next/third-parties": "16.2.6",
56
56
  "@react-google-maps/api": "2.17.1",
@@ -59,7 +59,7 @@
59
59
  "next": "16.2.6",
60
60
  "@serwist/next": "9.5.11",
61
61
  "next-auth": "5.0.0-beta.30",
62
- "pino": "8.11.0",
62
+ "pino": "8.21.0",
63
63
  "serwist": "9.5.11",
64
64
  "postcss": "8.4.49",
65
65
  "react": "19.2.5",
@@ -67,14 +67,14 @@
67
67
  "react-google-recaptcha": "2.1.0",
68
68
  "react-hook-form": "7.71.2",
69
69
  "react-intersection-observer": "9.4.0",
70
- "react-multi-carousel": "2.8.4",
71
- "react-string-replace": "1.1.0",
72
- "start-server-and-test": "2.0.3",
73
- "tailwind-merge": "1.8.0",
70
+ "react-multi-carousel": "2.8.5",
71
+ "react-string-replace": "1.1.1",
72
+ "start-server-and-test": "2.0.8",
73
+ "tailwind-merge": "1.14.0",
74
74
  "yup": "0.32.11"
75
75
  },
76
76
  "devDependencies": {
77
- "@akinon/eslint-plugin-projectzero": "2.0.32",
77
+ "@akinon/eslint-plugin-projectzero": "2.0.33-rc.0",
78
78
  "@semantic-release/changelog": "6.0.2",
79
79
  "@semantic-release/exec": "6.0.3",
80
80
  "@semantic-release/git": "10.0.1",
@@ -89,25 +89,25 @@
89
89
  "@types/react": "19.2.14",
90
90
  "@types/react-dom": "19.2.3",
91
91
  "client-only": "0.0.1",
92
- "clsx": "1.1.1",
92
+ "clsx": "1.2.1",
93
93
  "currency-symbol-map": "5.1.0",
94
94
  "eslint": "9.39.4",
95
95
  "eslint-config-next": "16.2.4",
96
96
  "eslint-config-prettier": "10.1.1",
97
97
  "husky": "8.0.0",
98
98
  "jest": "29.7.0",
99
- "jest-css-modules-transform": "4.3.0",
99
+ "jest-css-modules-transform": "4.4.2",
100
100
  "jest-environment-jsdom": "29.7.0",
101
- "lint-staged": "13.1.0",
102
- "prettier": "2.6.2",
101
+ "lint-staged": "13.3.0",
102
+ "prettier": "2.8.8",
103
103
  "react-number-format": "5.3.4",
104
- "sass": "1.49.9",
104
+ "sass": "1.83.0",
105
105
  "semantic-release": "19.0.5",
106
106
  "server-only": "0.0.1",
107
- "stylelint": "14.6.0",
107
+ "stylelint": "14.16.1",
108
108
  "stylelint-config-sass-guidelines": "9.0.1",
109
109
  "stylelint-config-standard": "25.0.0",
110
- "stylelint-scss": "4.2.0",
110
+ "stylelint-scss": "4.7.0",
111
111
  "stylelint-selector-bem-pattern": "2.1.1",
112
112
  "tailwindcss": "4.2.0",
113
113
  "ts-jest": "29.2.6",
@@ -161,5 +161,55 @@
161
161
  "processing": "Processing...",
162
162
  "pay_button": "Pay with Apple Pay",
163
163
  "payment_failed": "Payment failed"
164
+ },
165
+ "one_page": {
166
+ "edit": "Edit",
167
+ "continue_to_shipping": "Continue to shipping",
168
+ "continue_to_payment": "Continue to payment",
169
+ "contact": {
170
+ "title": "Contact information",
171
+ "guest_user": "Guest user",
172
+ "guest_badge": "Guest",
173
+ "guest_note": "You are continuing checkout as a guest."
174
+ },
175
+ "address": {
176
+ "title": "Delivery & billing address",
177
+ "shipping_label": "Delivery address",
178
+ "billing_label": "Billing address",
179
+ "use_for_billing": "Use the same address for billing",
180
+ "same_as_shipping": "Same as shipping",
181
+ "pick_different_billing": "Pick a different address if you'd like a separate billing destination."
182
+ },
183
+ "shipping": {
184
+ "title": "Shipping method"
185
+ },
186
+ "payment": {
187
+ "title": "Payment",
188
+ "select_method": "Please select a payment method to continue.",
189
+ "no_options": "No payment options are available at the moment."
190
+ },
191
+ "summary": {
192
+ "show_summary": "Show order summary",
193
+ "hide_summary": "Hide order summary",
194
+ "review_title": "Order details",
195
+ "deliver_to": "Deliver to",
196
+ "shipping_method": "Shipping method",
197
+ "payment_method": "Payment method"
198
+ },
199
+ "trust": {
200
+ "secure_title": "Secure checkout",
201
+ "secure_note": "Your payment is encrypted and processed securely. We never store your card details."
202
+ },
203
+ "basket": {
204
+ "title": "Your cart",
205
+ "empty": "Your cart is empty.",
206
+ "show": "Show items",
207
+ "hide": "Hide items",
208
+ "quantity": "Quantity",
209
+ "increase": "Increase quantity",
210
+ "decrease": "Decrease quantity",
211
+ "remove": "Remove from cart",
212
+ "update_error": "Could not update the cart. Please try again."
213
+ }
164
214
  }
165
215
  }
@@ -160,5 +160,55 @@
160
160
  "processing": "İşleniyor...",
161
161
  "pay_button": "Apple Pay ile Öde",
162
162
  "payment_failed": "Ödeme başarısız oldu"
163
+ },
164
+ "one_page": {
165
+ "edit": "Düzenle",
166
+ "continue_to_shipping": "Kargo seçimine geç",
167
+ "continue_to_payment": "Ödemeye geç",
168
+ "contact": {
169
+ "title": "İletişim bilgileri",
170
+ "guest_user": "Misafir kullanıcı",
171
+ "guest_badge": "Misafir",
172
+ "guest_note": "Alışverişe misafir olarak devam ediyorsunuz."
173
+ },
174
+ "address": {
175
+ "title": "Teslimat ve fatura adresi",
176
+ "shipping_label": "Teslimat adresi",
177
+ "billing_label": "Fatura adresi",
178
+ "use_for_billing": "Fatura adresi olarak da kullan",
179
+ "same_as_shipping": "Teslimat adresiyle aynı",
180
+ "pick_different_billing": "Faturayı farklı bir adrese istiyorsanız aşağıdan seçin."
181
+ },
182
+ "shipping": {
183
+ "title": "Kargo seçimi"
184
+ },
185
+ "payment": {
186
+ "title": "Ödeme",
187
+ "select_method": "Devam etmek için bir ödeme yöntemi seçin.",
188
+ "no_options": "Şu anda kullanılabilir bir ödeme yöntemi bulunmuyor."
189
+ },
190
+ "summary": {
191
+ "show_summary": "Sipariş özetini göster",
192
+ "hide_summary": "Sipariş özetini gizle",
193
+ "review_title": "Sipariş detayları",
194
+ "deliver_to": "Teslim adresi",
195
+ "shipping_method": "Kargo yöntemi",
196
+ "payment_method": "Ödeme yöntemi"
197
+ },
198
+ "trust": {
199
+ "secure_title": "Güvenli ödeme",
200
+ "secure_note": "Ödemeniz şifrelenir ve güvenli olarak işlenir. Kart bilgileriniz saklanmaz."
201
+ },
202
+ "basket": {
203
+ "title": "Sepetiniz",
204
+ "empty": "Sepetiniz boş.",
205
+ "show": "Ürünleri göster",
206
+ "hide": "Ürünleri gizle",
207
+ "quantity": "Adet",
208
+ "increase": "Adedi artır",
209
+ "decrease": "Adedi azalt",
210
+ "remove": "Sepetten çıkar",
211
+ "update_error": "Sepet güncellenemedi. Lütfen tekrar deneyin."
212
+ }
163
213
  }
164
214
  }
@@ -1,28 +1,55 @@
1
1
  'use client';
2
2
 
3
- import { useEffect } from 'react';
4
- import { ROUTES } from '@theme/routes';
3
+ import { useEffect, useMemo } from 'react';
4
+ import { ROUTES, ORDER_ROUTES } from '@theme/routes';
5
5
  import { useGetBasketQuery } from '@akinon/next/data/client/basket';
6
6
  import { pushCartView } from '@theme/utils/gtm';
7
7
  import { Button, LoaderSpinner, Link } from '@theme/components';
8
8
  import { BasketItem, Summary } from '@theme/views/basket';
9
- import { useLocalization } from '@akinon/next/hooks';
9
+ import { useLocalization, useRouter } from '@akinon/next/hooks';
10
10
  import PluginModule, { Component } from '@akinon/next/components/plugin-module';
11
11
  import settings from '@theme/settings';
12
+ import { UNIFIED_VARIANTS } from '@theme/views/checkout/variants/registry';
12
13
 
13
14
  export default function Page() {
14
15
  const { data: basket, isLoading, isSuccess } = useGetBasketQuery();
15
16
  const { t } = useLocalization();
17
+ const router = useRouter();
16
18
  const multiBasket = settings.plugins?.multiBasket ?? false;
17
19
 
20
+ const checkoutVariant = (settings as { checkout?: { variant?: string } })
21
+ ?.checkout?.variant;
22
+ const isUnifiedCheckout = useMemo(
23
+ () => UNIFIED_VARIANTS.has(checkoutVariant ?? ''),
24
+ [checkoutVariant]
25
+ );
26
+
27
+ const hasItems = Boolean(
28
+ basket?.basketitem_set && basket.basketitem_set.length > 0
29
+ );
30
+
18
31
  useEffect(() => {
19
- if (isSuccess) {
32
+ if (isUnifiedCheckout && isSuccess && hasItems) {
33
+ router.replace(ORDER_ROUTES.CHECKOUT);
34
+ }
35
+ }, [isUnifiedCheckout, isSuccess, hasItems, router]);
36
+
37
+ useEffect(() => {
38
+ if (isSuccess && hasItems) {
20
39
  const products = basket.basketitem_set.map((basketItem) => ({
21
40
  ...basketItem.product
22
41
  }));
23
42
  pushCartView(products);
24
43
  }
25
- }, [basket, isSuccess]);
44
+ }, [basket, isSuccess, hasItems]);
45
+
46
+ if (isUnifiedCheckout && (isLoading || (isSuccess && hasItems))) {
47
+ return (
48
+ <div className="flex w-full justify-center py-20">
49
+ <LoaderSpinner />
50
+ </div>
51
+ );
52
+ }
26
53
 
27
54
  return (
28
55
  <div className="max-w-screen-xl p-4 flex flex-col text-primary-800 lg:p-8 xl:flex-row xl:mx-auto">
@@ -32,7 +59,7 @@ export default function Page() {
32
59
  </div>
33
60
  )}
34
61
  {isSuccess &&
35
- (basket && basket.basketitem_set && basket.basketitem_set.length > 0 ? (
62
+ (hasItems ? (
36
63
  <>
37
64
  <div className="flex-1 xl:mr-16">
38
65
  <div className="flex items-center justify-between py-2 border-b border-gray-200 lg:py-3">