@akinon/projectzero 2.0.0-beta.15 → 2.0.0-beta.17
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 +9 -0
- package/app-template/.env.example +2 -0
- package/app-template/CHANGELOG.md +96 -0
- package/app-template/docs/advanced-usage.md +10 -0
- package/app-template/package.json +28 -28
- package/app-template/public/locales/en/account.json +3 -1
- package/app-template/public/locales/en/checkout.json +1 -0
- package/app-template/public/locales/en/product.json +18 -0
- package/app-template/public/locales/tr/account.json +3 -1
- package/app-template/public/locales/tr/product.json +18 -0
- package/app-template/src/app/[pz]/account/orders/[id]/page.tsx +20 -1
- package/app-template/src/app/[pz]/users/reset/[[...id]]/page.tsx +45 -3
- package/app-template/src/app/[pz]/xml-sitemap/[node]/route.ts +6 -4
- package/app-template/src/app/api/barcode-search/route.ts +1 -0
- package/app-template/src/components/modal.tsx +2 -0
- package/app-template/src/components/select.tsx +1 -1
- package/app-template/src/views/account/orders/order-detail-header.tsx +1 -1
- package/app-template/src/views/checkout/steps/payment/options/store-credit.tsx +355 -12
- package/app-template/src/views/checkout/steps/shipping/address-box.tsx +30 -17
- package/app-template/src/views/checkout/steps/shipping/addresses.tsx +1 -1
- package/commands/plugins.ts +29 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @akinon/projectzero
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2a8ddcf6: ZERO-4111: Add total balance field to store credit localization and update related components
|
|
8
|
+
- c67942a4: ZERO-3423: Updated version control and debug messages for the package
|
|
9
|
+
|
|
10
|
+
## 2.0.0-beta.16
|
|
11
|
+
|
|
3
12
|
## 2.0.0-beta.15
|
|
4
13
|
|
|
5
14
|
## 2.0.0-beta.14
|
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2a8ddcf6: ZERO-4111: Add total balance field to store credit localization and update related components
|
|
8
|
+
- 36143125: ZERO-3987: Add barcode scanner functionality with modal and button
|
|
9
|
+
- f7e0f646: ZERO-4032: Add bfcache-headers middleware, integrate it into the default chain, and introduce a new environment variable for control.
|
|
10
|
+
- 5fb34b5c: ZERO-3955: Add aspect ratio validation and error handling for image cropping
|
|
11
|
+
- d76d3255: ZERO-4011: Refactor sitemap content generation to append locale suffix based on matched locale
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [4798959a]
|
|
16
|
+
- Updated dependencies [8218dafa]
|
|
17
|
+
- Updated dependencies [2a8ddcf6]
|
|
18
|
+
- Updated dependencies [8a7fd0f4]
|
|
19
|
+
- Updated dependencies [36143125]
|
|
20
|
+
- Updated dependencies [572f4f7b]
|
|
21
|
+
- Updated dependencies [f7e0f646]
|
|
22
|
+
- Updated dependencies [94a86fcc]
|
|
23
|
+
- Updated dependencies [bcaad120]
|
|
24
|
+
- Updated dependencies [5fb34b5c]
|
|
25
|
+
- Updated dependencies [88cb4f62]
|
|
26
|
+
- Updated dependencies [6b73b050]
|
|
27
|
+
- @akinon/pz-masterpass-rest@2.0.0-beta.17
|
|
28
|
+
- @akinon/next@2.0.0-beta.17
|
|
29
|
+
- @akinon/pz-virtual-try-on@2.0.0-beta.17
|
|
30
|
+
- @akinon/pz-masterpass@2.0.0-beta.17
|
|
31
|
+
- @akinon/pz-akifast@2.0.0-beta.17
|
|
32
|
+
- @akinon/pz-apple-pay@2.0.0-beta.17
|
|
33
|
+
- @akinon/pz-b2b@2.0.0-beta.17
|
|
34
|
+
- @akinon/pz-basket-gift-pack@2.0.0-beta.17
|
|
35
|
+
- @akinon/pz-bkm@2.0.0-beta.17
|
|
36
|
+
- @akinon/pz-checkout-gift-pack@2.0.0-beta.17
|
|
37
|
+
- @akinon/pz-click-collect@2.0.0-beta.17
|
|
38
|
+
- @akinon/pz-credit-payment@2.0.0-beta.17
|
|
39
|
+
- @akinon/pz-cybersource-uc@2.0.0-beta.17
|
|
40
|
+
- @akinon/pz-flow-payment@2.0.0-beta.17
|
|
41
|
+
- @akinon/pz-google-pay@2.0.0-beta.17
|
|
42
|
+
- @akinon/pz-gpay@2.0.0-beta.17
|
|
43
|
+
- @akinon/pz-haso@2.0.0-beta.17
|
|
44
|
+
- @akinon/pz-hepsipay@2.0.0-beta.17
|
|
45
|
+
- @akinon/pz-multi-basket@2.0.0-beta.17
|
|
46
|
+
- @akinon/pz-one-click-checkout@2.0.0-beta.17
|
|
47
|
+
- @akinon/pz-otp@2.0.0-beta.17
|
|
48
|
+
- @akinon/pz-pay-on-delivery@2.0.0-beta.17
|
|
49
|
+
- @akinon/pz-saved-card@2.0.0-beta.17
|
|
50
|
+
- @akinon/pz-similar-products@2.0.0-beta.17
|
|
51
|
+
- @akinon/pz-tabby-extension@2.0.0-beta.17
|
|
52
|
+
- @akinon/pz-tamara-extension@2.0.0-beta.17
|
|
53
|
+
|
|
54
|
+
## 2.0.0-beta.16
|
|
55
|
+
|
|
56
|
+
### Minor Changes
|
|
57
|
+
|
|
58
|
+
- 4449f3a3: ZERO-3681: Add order details localization and improve order handling in AccountOrderDetail
|
|
59
|
+
- b87517ff: ZERO-3680: Enhance select component styling to ensure focus state is consistent
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [823d82f9]
|
|
64
|
+
- Updated dependencies [d2c0e759]
|
|
65
|
+
- Updated dependencies [d35e8ac1]
|
|
66
|
+
- Updated dependencies [68bbcb27]
|
|
67
|
+
- Updated dependencies [9b7d0de6]
|
|
68
|
+
- Updated dependencies [2e436c13]
|
|
69
|
+
- Updated dependencies [9cfbf6cd]
|
|
70
|
+
- Updated dependencies [187208d2]
|
|
71
|
+
- Updated dependencies [5ec0faf8]
|
|
72
|
+
- @akinon/next@2.0.0-beta.16
|
|
73
|
+
- @akinon/pz-bkm@2.0.0-beta.16
|
|
74
|
+
- @akinon/pz-gpay@2.0.0-beta.16
|
|
75
|
+
- @akinon/pz-akifast@2.0.0-beta.16
|
|
76
|
+
- @akinon/pz-virtual-try-on@2.0.0-beta.16
|
|
77
|
+
- @akinon/pz-apple-pay@2.0.0-beta.16
|
|
78
|
+
- @akinon/pz-b2b@2.0.0-beta.16
|
|
79
|
+
- @akinon/pz-basket-gift-pack@2.0.0-beta.16
|
|
80
|
+
- @akinon/pz-checkout-gift-pack@2.0.0-beta.16
|
|
81
|
+
- @akinon/pz-click-collect@2.0.0-beta.16
|
|
82
|
+
- @akinon/pz-credit-payment@2.0.0-beta.16
|
|
83
|
+
- @akinon/pz-cybersource-uc@2.0.0-beta.16
|
|
84
|
+
- @akinon/pz-flow-payment@2.0.0-beta.16
|
|
85
|
+
- @akinon/pz-google-pay@2.0.0-beta.16
|
|
86
|
+
- @akinon/pz-haso@2.0.0-beta.16
|
|
87
|
+
- @akinon/pz-hepsipay@2.0.0-beta.16
|
|
88
|
+
- @akinon/pz-masterpass@2.0.0-beta.16
|
|
89
|
+
- @akinon/pz-masterpass-rest@2.0.0-beta.16
|
|
90
|
+
- @akinon/pz-multi-basket@2.0.0-beta.16
|
|
91
|
+
- @akinon/pz-one-click-checkout@2.0.0-beta.16
|
|
92
|
+
- @akinon/pz-otp@2.0.0-beta.16
|
|
93
|
+
- @akinon/pz-pay-on-delivery@2.0.0-beta.16
|
|
94
|
+
- @akinon/pz-saved-card@2.0.0-beta.16
|
|
95
|
+
- @akinon/pz-similar-products@2.0.0-beta.16
|
|
96
|
+
- @akinon/pz-tabby-extension@2.0.0-beta.16
|
|
97
|
+
- @akinon/pz-tamara-extension@2.0.0-beta.16
|
|
98
|
+
|
|
3
99
|
## 2.0.0-beta.15
|
|
4
100
|
|
|
5
101
|
### Minor Changes
|
|
@@ -142,3 +142,13 @@ This codemod will:
|
|
|
142
142
|
- Clean up middleware rewrite blocks
|
|
143
143
|
- Update path references in `tsconfig.json`, `next.config.js`, and source files
|
|
144
144
|
- Replace `params.locale` / `params.currency` / `params.url` usages with `parsePzParams`
|
|
145
|
+
|
|
146
|
+
## Enabling Browser Back/Forward Cache (bfcache)
|
|
147
|
+
|
|
148
|
+
By default, dynamic pages may include `Cache-Control: no-store` headers, which prevents browsers from using the back/forward cache (bfcache). To enable bfcache support, set the `BF_CACHE` environment variable to `true`:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
BF_CACHE=true
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
When enabled, a middleware wrapper overrides the `Cache-Control` header to `private, no-cache, max-age=0, must-revalidate`, allowing the browser to cache pages for instant back/forward navigation while still revalidating content on revisit.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.17",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -24,32 +24,32 @@
|
|
|
24
24
|
"test:middleware": "jest middleware-matcher.test.ts --bail"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@akinon/next": "2.0.0-beta.
|
|
28
|
-
"@akinon/pz-akifast": "2.0.0-beta.
|
|
29
|
-
"@akinon/pz-apple-pay": "2.0.0-beta.
|
|
30
|
-
"@akinon/pz-b2b": "2.0.0-beta.
|
|
31
|
-
"@akinon/pz-basket-gift-pack": "2.0.0-beta.
|
|
32
|
-
"@akinon/pz-bkm": "2.0.0-beta.
|
|
33
|
-
"@akinon/pz-checkout-gift-pack": "2.0.0-beta.
|
|
34
|
-
"@akinon/pz-click-collect": "2.0.0-beta.
|
|
35
|
-
"@akinon/pz-credit-payment": "2.0.0-beta.
|
|
36
|
-
"@akinon/pz-cybersource-uc": "2.0.0-beta.
|
|
37
|
-
"@akinon/pz-flow-payment": "2.0.0-beta.
|
|
38
|
-
"@akinon/pz-google-pay": "2.0.0-beta.
|
|
39
|
-
"@akinon/pz-gpay": "2.0.0-beta.
|
|
40
|
-
"@akinon/pz-haso": "2.0.0-beta.
|
|
41
|
-
"@akinon/pz-hepsipay": "2.0.0-beta.
|
|
42
|
-
"@akinon/pz-masterpass": "2.0.0-beta.
|
|
43
|
-
"@akinon/pz-masterpass-rest": "2.0.0-beta.
|
|
44
|
-
"@akinon/pz-multi-basket": "2.0.0-beta.
|
|
45
|
-
"@akinon/pz-one-click-checkout": "2.0.0-beta.
|
|
46
|
-
"@akinon/pz-otp": "2.0.0-beta.
|
|
47
|
-
"@akinon/pz-pay-on-delivery": "2.0.0-beta.
|
|
48
|
-
"@akinon/pz-saved-card": "2.0.0-beta.
|
|
49
|
-
"@akinon/pz-similar-products": "2.0.0-beta.
|
|
50
|
-
"@akinon/pz-tabby-extension": "2.0.0-beta.
|
|
51
|
-
"@akinon/pz-tamara-extension": "2.0.0-beta.
|
|
52
|
-
"@akinon/pz-virtual-try-on": "2.0.0-beta.
|
|
27
|
+
"@akinon/next": "2.0.0-beta.17",
|
|
28
|
+
"@akinon/pz-akifast": "2.0.0-beta.17",
|
|
29
|
+
"@akinon/pz-apple-pay": "2.0.0-beta.17",
|
|
30
|
+
"@akinon/pz-b2b": "2.0.0-beta.17",
|
|
31
|
+
"@akinon/pz-basket-gift-pack": "2.0.0-beta.17",
|
|
32
|
+
"@akinon/pz-bkm": "2.0.0-beta.17",
|
|
33
|
+
"@akinon/pz-checkout-gift-pack": "2.0.0-beta.17",
|
|
34
|
+
"@akinon/pz-click-collect": "2.0.0-beta.17",
|
|
35
|
+
"@akinon/pz-credit-payment": "2.0.0-beta.17",
|
|
36
|
+
"@akinon/pz-cybersource-uc": "2.0.0-beta.17",
|
|
37
|
+
"@akinon/pz-flow-payment": "2.0.0-beta.17",
|
|
38
|
+
"@akinon/pz-google-pay": "2.0.0-beta.17",
|
|
39
|
+
"@akinon/pz-gpay": "2.0.0-beta.17",
|
|
40
|
+
"@akinon/pz-haso": "2.0.0-beta.17",
|
|
41
|
+
"@akinon/pz-hepsipay": "2.0.0-beta.17",
|
|
42
|
+
"@akinon/pz-masterpass": "2.0.0-beta.17",
|
|
43
|
+
"@akinon/pz-masterpass-rest": "2.0.0-beta.17",
|
|
44
|
+
"@akinon/pz-multi-basket": "2.0.0-beta.17",
|
|
45
|
+
"@akinon/pz-one-click-checkout": "2.0.0-beta.17",
|
|
46
|
+
"@akinon/pz-otp": "2.0.0-beta.17",
|
|
47
|
+
"@akinon/pz-pay-on-delivery": "2.0.0-beta.17",
|
|
48
|
+
"@akinon/pz-saved-card": "2.0.0-beta.17",
|
|
49
|
+
"@akinon/pz-similar-products": "2.0.0-beta.17",
|
|
50
|
+
"@akinon/pz-tabby-extension": "2.0.0-beta.17",
|
|
51
|
+
"@akinon/pz-tamara-extension": "2.0.0-beta.17",
|
|
52
|
+
"@akinon/pz-virtual-try-on": "2.0.0-beta.17",
|
|
53
53
|
"@hookform/resolvers": "2.9.0",
|
|
54
54
|
"@next/third-parties": "16.1.6",
|
|
55
55
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"yup": "0.32.11"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@akinon/eslint-plugin-projectzero": "2.0.0-beta.
|
|
75
|
+
"@akinon/eslint-plugin-projectzero": "2.0.0-beta.17",
|
|
76
76
|
"@semantic-release/changelog": "6.0.2",
|
|
77
77
|
"@semantic-release/exec": "6.0.3",
|
|
78
78
|
"@semantic-release/git": "10.0.1",
|
|
@@ -242,7 +242,9 @@
|
|
|
242
242
|
"total": "Total",
|
|
243
243
|
"items": "items",
|
|
244
244
|
"packages": "Packages",
|
|
245
|
-
"package_no": "Package no"
|
|
245
|
+
"package_no": "Package no",
|
|
246
|
+
"back_to_orders": "Back to Orders",
|
|
247
|
+
"no_orders_found": "No orders found"
|
|
246
248
|
},
|
|
247
249
|
"return": {
|
|
248
250
|
"title": "Return Items",
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
"store_credit": {
|
|
144
144
|
"use_my_store_credits": "Use my pz-zero credits",
|
|
145
145
|
"available_balance": "Available Balance",
|
|
146
|
+
"total_balance": "Total Balance",
|
|
146
147
|
"insufficient_balance": "Your pz-zero credits are not sufficient to pay for the order, please select an additional payment method to cover the balance of <Amount/>"
|
|
147
148
|
}
|
|
148
149
|
},
|
|
@@ -86,6 +86,8 @@
|
|
|
86
86
|
"multiple_results_subtitle": "Try-on completed for {{count}} products",
|
|
87
87
|
"error_incompatible": "Image Not Compatible",
|
|
88
88
|
"error_auto_reported": "Error automatically reported",
|
|
89
|
+
"error_aspect_ratio_too_tall": "The image is too tall. Maximum allowed ratio is 9:16 (portrait). Please crop or use a different image.",
|
|
90
|
+
"error_aspect_ratio_too_wide": "The image is too wide. Maximum allowed ratio is 21:9 (landscape). Please crop or use a different image.",
|
|
89
91
|
"feedback_question": "How was the result?",
|
|
90
92
|
"feedback_success": "Success",
|
|
91
93
|
"feedback_failed": "Failed",
|
|
@@ -96,5 +98,21 @@
|
|
|
96
98
|
"starting": "Starting...",
|
|
97
99
|
"will_start": "will start virtual try-on for",
|
|
98
100
|
"products_count": "products"
|
|
101
|
+
},
|
|
102
|
+
"barcode_scanner": {
|
|
103
|
+
"title": "Scan Barcode",
|
|
104
|
+
"button_label": "Barcode Scanner",
|
|
105
|
+
"button_text": "Try on products in store",
|
|
106
|
+
"help_text": "Point your camera at the product barcode",
|
|
107
|
+
"scan_more_help": "To scan another product, point your camera at the new barcode.",
|
|
108
|
+
"searching": "Searching for product...",
|
|
109
|
+
"continue_to_vto": "Continue to Virtual Cabin",
|
|
110
|
+
"permission_denied_title": "Camera Permission Required",
|
|
111
|
+
"permission_denied_message": "You need to allow camera access for the barcode scanner.",
|
|
112
|
+
"try_again": "Try Again",
|
|
113
|
+
"errors": {
|
|
114
|
+
"product_not_found": "No product found for this barcode.",
|
|
115
|
+
"search_failed": "Search failed. Please try again."
|
|
116
|
+
}
|
|
99
117
|
}
|
|
100
118
|
}
|
|
@@ -242,7 +242,9 @@
|
|
|
242
242
|
"total": "Toplam",
|
|
243
243
|
"items": "adet",
|
|
244
244
|
"packages": "paket",
|
|
245
|
-
"package_no": "Paket no"
|
|
245
|
+
"package_no": "Paket no",
|
|
246
|
+
"back_to_orders": "Siparişlere geri dön",
|
|
247
|
+
"no_orders_found": "Sipariş bulunamadı"
|
|
246
248
|
},
|
|
247
249
|
"return": {
|
|
248
250
|
"title": "İade Ürünleri",
|
|
@@ -88,6 +88,8 @@
|
|
|
88
88
|
"multiple_results_subtitle": "{{count}} ürün için deneme tamamlandı",
|
|
89
89
|
"error_incompatible": "Görüntü Uyumlu Değil",
|
|
90
90
|
"error_auto_reported": "Hata otomatik olarak bildirildi",
|
|
91
|
+
"error_aspect_ratio_too_tall": "Görsel çok uzun. Dikey görseller için izin verilen maksimum oran 9:16'dır. Lütfen kırpın veya farklı bir görsel seçin.",
|
|
92
|
+
"error_aspect_ratio_too_wide": "Görsel çok geniş. Yatay görseller için izin verilen maksimum oran 21:9'dur. Lütfen kırpın veya farklı bir görsel seçin.",
|
|
91
93
|
"feedback_question": "Sonuç nasıldı?",
|
|
92
94
|
"feedback_success": "Başarılı",
|
|
93
95
|
"feedback_failed": "Başarısız",
|
|
@@ -98,5 +100,21 @@
|
|
|
98
100
|
"starting": "Başlatılıyor...",
|
|
99
101
|
"will_start": "için sanal deneme başlatılacak",
|
|
100
102
|
"products_count": "ürün"
|
|
103
|
+
},
|
|
104
|
+
"barcode_scanner": {
|
|
105
|
+
"title": "Barkodu Okut",
|
|
106
|
+
"button_label": "Barkod Tarayıcı",
|
|
107
|
+
"button_text": "Mağazadaki ürünü üstünde dene",
|
|
108
|
+
"help_text": "Ürün barkodunu kameraya yaklaştırın",
|
|
109
|
+
"scan_more_help": "Bir ürün daha okutmak isterseniz, yeni barkodu da kameranıza yaklaştırın.",
|
|
110
|
+
"searching": "Ürün aranıyor...",
|
|
111
|
+
"continue_to_vto": "Sanal Kabine Devam Et",
|
|
112
|
+
"permission_denied_title": "Kamera İzni Gerekli",
|
|
113
|
+
"permission_denied_message": "Barkod okuyucu için kamera erişimine izin vermeniz gerekmektedir.",
|
|
114
|
+
"try_again": "Tekrar Dene",
|
|
115
|
+
"errors": {
|
|
116
|
+
"product_not_found": "Bu barkoda ait ürün bulunamadı.",
|
|
117
|
+
"search_failed": "Arama başarısız oldu. Lütfen tekrar deneyin."
|
|
118
|
+
}
|
|
101
119
|
}
|
|
102
120
|
}
|
|
@@ -63,7 +63,26 @@ const AccountOrderDetail = () => {
|
|
|
63
63
|
}, [order, isSuccess, localeValue]);
|
|
64
64
|
|
|
65
65
|
if (isLoading && isFetching) {
|
|
66
|
-
return
|
|
66
|
+
return (
|
|
67
|
+
<div className="flex flex-col items-center justify-center h-96">
|
|
68
|
+
<LoaderSpinner />
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!order) {
|
|
74
|
+
return (
|
|
75
|
+
<div className="flex flex-col items-center justify-center h-96">
|
|
76
|
+
<p className="mt-5 text-start text-lg mb-4">
|
|
77
|
+
{t('account.my_orders.detail.no_orders_found')}
|
|
78
|
+
</p>
|
|
79
|
+
<Link href={`/account/orders/`}>
|
|
80
|
+
<Button className="px-4" appearance="filled">
|
|
81
|
+
{t('account.my_orders.detail.back_to_orders')}
|
|
82
|
+
</Button>
|
|
83
|
+
</Link>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
67
86
|
}
|
|
68
87
|
|
|
69
88
|
return (
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Button, Input, Link } from '@theme/components';
|
|
3
|
+
import { Button, Input, Link, LoaderSpinner } from '@theme/components';
|
|
4
4
|
import { useForm, SubmitHandler } from 'react-hook-form';
|
|
5
5
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
6
6
|
import * as yup from 'yup';
|
|
7
7
|
import {
|
|
8
8
|
usePasswordResetMutation,
|
|
9
|
+
useGetValidatePasswordResetTokenQuery,
|
|
9
10
|
PasswordResetType
|
|
10
11
|
} from '@akinon/next/data/client/account';
|
|
11
12
|
import { useLocalization } from '@akinon/next/hooks';
|
|
@@ -17,6 +18,16 @@ export default function NewPassword() {
|
|
|
17
18
|
const { t } = useLocalization();
|
|
18
19
|
const [newPassword, { isSuccess: formSuccess }] = usePasswordResetMutation();
|
|
19
20
|
|
|
21
|
+
const token = id?.join('/');
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
data: validationData,
|
|
25
|
+
isLoading: isValidating,
|
|
26
|
+
error: validationError
|
|
27
|
+
} = useGetValidatePasswordResetTokenQuery(token, {
|
|
28
|
+
skip: !token
|
|
29
|
+
});
|
|
30
|
+
|
|
20
31
|
const newPasswordFormSchema = (t) =>
|
|
21
32
|
yup.object().shape({
|
|
22
33
|
password: yup
|
|
@@ -26,7 +37,10 @@ export default function NewPassword() {
|
|
|
26
37
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z\d]).{6,}$/,
|
|
27
38
|
t('forgot_password.create_new_password.form.error.password_rule')
|
|
28
39
|
)
|
|
29
|
-
.max(
|
|
40
|
+
.max(
|
|
41
|
+
50,
|
|
42
|
+
t('forgot_password.create_new_password.form.error.password_max')
|
|
43
|
+
),
|
|
30
44
|
repeatPassword: yup
|
|
31
45
|
.string()
|
|
32
46
|
.required(t('forgot_password.create_new_password.form.error.required'))
|
|
@@ -47,6 +61,31 @@ export default function NewPassword() {
|
|
|
47
61
|
newPassword(data);
|
|
48
62
|
};
|
|
49
63
|
|
|
64
|
+
if (isValidating) {
|
|
65
|
+
return (
|
|
66
|
+
<div className="container my-12 flex flex-col items-center px-4">
|
|
67
|
+
<div className="w-full xl:w-5/12 text-center">
|
|
68
|
+
<LoaderSpinner />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (validationError || !validationData?.validlink) {
|
|
75
|
+
return (
|
|
76
|
+
<div className="container my-12 flex flex-col items-center px-4">
|
|
77
|
+
<div className="w-full xl:w-5/12 text-center">
|
|
78
|
+
<div className="text-2xl mb-4 text-error">
|
|
79
|
+
{t('account.password_reset.expired_link_message')}
|
|
80
|
+
</div>
|
|
81
|
+
<Link href="/users/password/reset" className="underline text-primary">
|
|
82
|
+
{t('account.password_reset.continue_password_reset')}
|
|
83
|
+
</Link>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
50
89
|
return (
|
|
51
90
|
<div className="container my-12 flex flex-col items-center px-4">
|
|
52
91
|
<div className="w-full xl:w-5/12 text-center">
|
|
@@ -81,7 +120,10 @@ export default function NewPassword() {
|
|
|
81
120
|
required
|
|
82
121
|
/>
|
|
83
122
|
|
|
84
|
-
<PasswordRulesFeedback
|
|
123
|
+
<PasswordRulesFeedback
|
|
124
|
+
password={passwordValue}
|
|
125
|
+
isVisible={errors?.password ? true : false}
|
|
126
|
+
/>
|
|
85
127
|
</div>
|
|
86
128
|
|
|
87
129
|
<div className="mb-2 text-left">
|
|
@@ -58,10 +58,12 @@ export async function GET(request: Request, context: { params: Promise<{ node: s
|
|
|
58
58
|
|
|
59
59
|
let sitemapContent = await sitemap.text();
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
if (matchedLocale?.[0]) {
|
|
62
|
+
const localeSuffix = matchedLocale[0];
|
|
63
|
+
const domainRegex = /(?<=<loc>\s*)https?:\/\/[^/<\s]+/g;
|
|
64
|
+
|
|
65
|
+
sitemapContent = sitemapContent.replace(domainRegex, `$&${localeSuffix}`);
|
|
66
|
+
}
|
|
65
67
|
|
|
66
68
|
return new Response(sitemapContent, {
|
|
67
69
|
headers: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@akinon/next/api/barcode-search';
|
|
@@ -41,12 +41,14 @@ export const Modal = (props: ModalProps) => {
|
|
|
41
41
|
'fixed top-0 left-0 w-screen h-screen bg-primary bg-opacity-60 z-50',
|
|
42
42
|
overlayClassName
|
|
43
43
|
)}
|
|
44
|
+
onClick={(e) => e.stopPropagation()}
|
|
44
45
|
/>
|
|
45
46
|
<section
|
|
46
47
|
className={twMerge(
|
|
47
48
|
'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-white',
|
|
48
49
|
className
|
|
49
50
|
)}
|
|
51
|
+
onClick={(e) => e.stopPropagation()}
|
|
50
52
|
>
|
|
51
53
|
{(showCloseButton || title) && (
|
|
52
54
|
<div
|
|
@@ -48,7 +48,7 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>((props, ref) => {
|
|
|
48
48
|
clsx(
|
|
49
49
|
'cursor-pointer truncate h-10 w-40 px-2.5 shrink-0 outline-none',
|
|
50
50
|
!borderless &&
|
|
51
|
-
'border border-gray-200 transition-all duration-150 hover:border-primary',
|
|
51
|
+
'border border-gray-200 transition-all duration-150 hover:border-primary focus:border-primary',
|
|
52
52
|
'appearance-none bg-transparent'
|
|
53
53
|
),
|
|
54
54
|
className
|
|
@@ -21,7 +21,7 @@ export const OrderDetailHeader = ({ title, order, children }: Props) => {
|
|
|
21
21
|
<div>
|
|
22
22
|
<span>{t('account.my_orders.detail.order_number')}</span>:{' '}
|
|
23
23
|
<span data-testid="account-orders-return-order-id">
|
|
24
|
-
{order
|
|
24
|
+
{order?.number}
|
|
25
25
|
</span>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
@@ -4,46 +4,198 @@ import {
|
|
|
4
4
|
usePayWithLoyaltyBalanceMutation
|
|
5
5
|
} from '@akinon/next/data/client/checkout';
|
|
6
6
|
import { useAppSelector } from '@akinon/next/redux/hooks';
|
|
7
|
-
import { useMemo, useState } from 'react';
|
|
7
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { useLocalization } from '@akinon/next/hooks';
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
10
10
|
import { Icon, Price } from '@theme/components';
|
|
11
11
|
import { Trans } from '@akinon/next/components';
|
|
12
12
|
import { LoaderSpinner } from '@theme/components';
|
|
13
|
+
import { AccountUsage, LoyaltyBalanceItem } from '@akinon/next/types';
|
|
13
14
|
|
|
14
15
|
export const StoreCredits = () => {
|
|
15
16
|
const { t } = useLocalization();
|
|
16
17
|
|
|
17
|
-
const [payWithLoyaltyBalance, { isLoading:
|
|
18
|
+
const [payWithLoyaltyBalance, { isLoading: isPayLoading }] =
|
|
18
19
|
usePayWithLoyaltyBalanceMutation();
|
|
19
20
|
|
|
20
|
-
const { loyaltyBalance, preOrder } = useAppSelector(
|
|
21
|
+
const { loyaltyBalance, loyaltyBalances, preOrder } = useAppSelector(
|
|
21
22
|
(state) => state.checkout
|
|
22
23
|
);
|
|
23
24
|
|
|
24
|
-
const { isLoading: isLoyaltyBalanceLoading } =
|
|
25
|
+
const { data: checkoutLoyaltyData, isLoading: isLoyaltyBalanceLoading } =
|
|
25
26
|
useGetCheckoutLoyaltyBalanceQuery(undefined, {
|
|
26
27
|
refetchOnMountOrArgChange: true,
|
|
27
28
|
skip: !preOrder?.payment_option
|
|
28
29
|
});
|
|
29
30
|
|
|
31
|
+
// New approach: read accounts from LoyaltyMoneyUsagePage context
|
|
32
|
+
const loyaltyAccounts: LoyaltyBalanceItem[] = useMemo(() => {
|
|
33
|
+
const loyaltyContext = checkoutLoyaltyData?.context_list?.find(
|
|
34
|
+
(ctx) => ctx.page_name === 'LoyaltyMoneyUsagePage'
|
|
35
|
+
);
|
|
36
|
+
return (
|
|
37
|
+
(loyaltyContext?.page_context?.accounts as LoyaltyBalanceItem[]) ?? []
|
|
38
|
+
);
|
|
39
|
+
}, [checkoutLoyaltyData]);
|
|
40
|
+
|
|
41
|
+
const selectableAccounts = useMemo(() => {
|
|
42
|
+
return loyaltyAccounts.filter((account) => parseFloat(account.balance) > 0);
|
|
43
|
+
}, [loyaltyAccounts]);
|
|
44
|
+
|
|
45
|
+
// Determine which mode to use:
|
|
46
|
+
// - "accounts" mode: backend returns page_context.accounts (new)
|
|
47
|
+
// - "legacy" mode: Redux loyaltyBalance/loyaltyBalances from page_context.balance/balances (old)
|
|
48
|
+
const hasAccounts = selectableAccounts.length > 0;
|
|
49
|
+
const hasLegacyGrouped = !hasAccounts && loyaltyBalances?.length > 0;
|
|
50
|
+
const hasLegacySingle =
|
|
51
|
+
!hasAccounts && !hasLegacyGrouped && parseFloat(loyaltyBalance || '0') > 0;
|
|
52
|
+
|
|
30
53
|
const isLoyaltyBalanceUsed = useMemo(() => {
|
|
31
54
|
return parseFloat(preOrder?.loyalty_money ?? '0') > 0;
|
|
32
55
|
}, [preOrder?.loyalty_money]);
|
|
33
56
|
|
|
57
|
+
// --- Accounts mode state ---
|
|
58
|
+
const [selectedAccountIds, setSelectedAccountIds] = useState<Set<string>>(
|
|
59
|
+
new Set()
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!hasAccounts) return;
|
|
64
|
+
const usages = preOrder?.loyalty_account_usages;
|
|
65
|
+
if (usages && Array.isArray(usages)) {
|
|
66
|
+
setSelectedAccountIds(
|
|
67
|
+
new Set(
|
|
68
|
+
usages
|
|
69
|
+
.filter((u) => parseFloat(String(u.amount)) > 0)
|
|
70
|
+
.map((u) => String(u.label_id))
|
|
71
|
+
)
|
|
72
|
+
);
|
|
73
|
+
} else if (
|
|
74
|
+
parseFloat(preOrder?.loyalty_money ?? '0') > 0 &&
|
|
75
|
+
selectableAccounts.length > 0
|
|
76
|
+
) {
|
|
77
|
+
setSelectedAccountIds(
|
|
78
|
+
new Set(selectableAccounts.map((a) => String(a.label_id)))
|
|
79
|
+
);
|
|
80
|
+
} else {
|
|
81
|
+
setSelectedAccountIds(new Set());
|
|
82
|
+
}
|
|
83
|
+
}, [
|
|
84
|
+
hasAccounts,
|
|
85
|
+
preOrder?.loyalty_account_usages,
|
|
86
|
+
preOrder?.loyalty_money,
|
|
87
|
+
selectableAccounts
|
|
88
|
+
]);
|
|
89
|
+
|
|
90
|
+
// --- Legacy grouped mode state ---
|
|
91
|
+
const [selectedLabels, setSelectedLabels] = useState<Record<string, boolean>>(
|
|
92
|
+
{}
|
|
93
|
+
);
|
|
94
|
+
|
|
34
95
|
const [isLoading, setIsLoading] = useState(false);
|
|
35
96
|
|
|
36
|
-
const
|
|
97
|
+
const totalGroupedBalance = useMemo(() => {
|
|
98
|
+
if (!loyaltyBalances) return 0;
|
|
99
|
+
return loyaltyBalances.reduce(
|
|
100
|
+
(sum, item) => sum + parseFloat(item.balance || '0'),
|
|
101
|
+
0
|
|
102
|
+
);
|
|
103
|
+
}, [loyaltyBalances]);
|
|
104
|
+
|
|
105
|
+
// --- Handlers ---
|
|
106
|
+
const handleToggleAccount = async (account: LoyaltyBalanceItem) => {
|
|
107
|
+
if (isLoading) return;
|
|
108
|
+
setIsLoading(true);
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const key = String(account.label_id);
|
|
112
|
+
const newSelected = new Set(selectedAccountIds);
|
|
113
|
+
|
|
114
|
+
if (newSelected.has(key)) {
|
|
115
|
+
newSelected.delete(key);
|
|
116
|
+
} else {
|
|
117
|
+
newSelected.add(key);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
setSelectedAccountIds(newSelected);
|
|
121
|
+
|
|
122
|
+
const accountUsages: AccountUsage[] = selectableAccounts
|
|
123
|
+
.filter((acc) => newSelected.has(String(acc.label_id)))
|
|
124
|
+
.map((acc) => ({
|
|
125
|
+
label_id: acc.label_id,
|
|
126
|
+
amount: parseFloat(acc.balance)
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
await payWithLoyaltyBalance({ account_usages: accountUsages });
|
|
130
|
+
} finally {
|
|
131
|
+
setIsLoading(false);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const handleToggleLegacyAll = async () => {
|
|
136
|
+
if (isLoading) return;
|
|
137
|
+
setIsLoading(true);
|
|
138
|
+
|
|
139
|
+
try {
|
|
140
|
+
if (isLoyaltyBalanceUsed) {
|
|
141
|
+
if (hasLegacyGrouped) {
|
|
142
|
+
const accountUsages: AccountUsage[] = loyaltyBalances.map((item) => ({
|
|
143
|
+
label_id: item.label_id,
|
|
144
|
+
amount: 0
|
|
145
|
+
}));
|
|
146
|
+
await payWithLoyaltyBalance({ account_usages: accountUsages });
|
|
147
|
+
setSelectedLabels({});
|
|
148
|
+
} else {
|
|
149
|
+
await payWithLoyaltyBalance('0');
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
if (hasLegacyGrouped) {
|
|
153
|
+
const accountUsages: AccountUsage[] = loyaltyBalances.map((item) => ({
|
|
154
|
+
label_id: item.label_id,
|
|
155
|
+
amount: parseFloat(item.balance)
|
|
156
|
+
}));
|
|
157
|
+
await payWithLoyaltyBalance({ account_usages: accountUsages });
|
|
158
|
+
const allSelected = loyaltyBalances.reduce(
|
|
159
|
+
(acc, item) => ({ ...acc, [String(item.label_id)]: true }),
|
|
160
|
+
{} as Record<string, boolean>
|
|
161
|
+
);
|
|
162
|
+
setSelectedLabels(allSelected);
|
|
163
|
+
} else {
|
|
164
|
+
await payWithLoyaltyBalance(loyaltyBalance);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} finally {
|
|
168
|
+
setIsLoading(false);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const handleToggleLegacyLabel = async (item: LoyaltyBalanceItem) => {
|
|
37
173
|
if (isLoading) return;
|
|
38
174
|
setIsLoading(true);
|
|
39
175
|
|
|
40
176
|
try {
|
|
41
|
-
|
|
177
|
+
const key = String(item.label_id);
|
|
178
|
+
const isCurrentlySelected = selectedLabels[key] ?? false;
|
|
179
|
+
const newSelectedLabels = {
|
|
180
|
+
...selectedLabels,
|
|
181
|
+
[key]: !isCurrentlySelected
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const accountUsages: AccountUsage[] = loyaltyBalances.map((b) => ({
|
|
185
|
+
label_id: b.label_id,
|
|
186
|
+
amount: newSelectedLabels[String(b.label_id)]
|
|
187
|
+
? parseFloat(b.balance)
|
|
188
|
+
: 0
|
|
189
|
+
}));
|
|
190
|
+
|
|
191
|
+
await payWithLoyaltyBalance({ account_usages: accountUsages });
|
|
192
|
+
setSelectedLabels(newSelectedLabels);
|
|
42
193
|
} finally {
|
|
43
194
|
setIsLoading(false);
|
|
44
195
|
}
|
|
45
196
|
};
|
|
46
197
|
|
|
198
|
+
// --- Early returns ---
|
|
47
199
|
if (preOrder?.is_guest) {
|
|
48
200
|
return null;
|
|
49
201
|
}
|
|
@@ -56,19 +208,207 @@ export const StoreCredits = () => {
|
|
|
56
208
|
);
|
|
57
209
|
}
|
|
58
210
|
|
|
59
|
-
if (
|
|
211
|
+
if (!hasAccounts && !hasLegacyGrouped && !hasLegacySingle) {
|
|
60
212
|
return null;
|
|
61
213
|
}
|
|
214
|
+
|
|
215
|
+
// --- Accounts mode render (new: from page_context.accounts) ---
|
|
216
|
+
if (hasAccounts) {
|
|
217
|
+
return (
|
|
218
|
+
<div
|
|
219
|
+
className={twMerge(
|
|
220
|
+
'flex flex-col w-full mb-4 border border-solid border-gray-400 px-0 md:p-4',
|
|
221
|
+
isPayLoading && 'pointer-events-none opacity-30'
|
|
222
|
+
)}
|
|
223
|
+
>
|
|
224
|
+
{selectableAccounts.map((account) => {
|
|
225
|
+
const isSelected = selectedAccountIds.has(String(account.label_id));
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<div
|
|
229
|
+
key={String(account.label_id) ?? 'default'}
|
|
230
|
+
className="mb-3 flex w-full items-center"
|
|
231
|
+
>
|
|
232
|
+
<button onClick={() => handleToggleAccount(account)}>
|
|
233
|
+
<span
|
|
234
|
+
className={clsx(
|
|
235
|
+
'flex h-5 w-5 items-center justify-center rounded border border-solid border-primary',
|
|
236
|
+
isSelected ? 'bg-primary' : 'bg-white'
|
|
237
|
+
)}
|
|
238
|
+
>
|
|
239
|
+
<Icon
|
|
240
|
+
name={isSelected ? 'check' : ''}
|
|
241
|
+
size={10}
|
|
242
|
+
className={clsx({ 'text-white': isSelected })}
|
|
243
|
+
/>
|
|
244
|
+
</span>
|
|
245
|
+
</button>
|
|
246
|
+
|
|
247
|
+
<div className="w-full pl-4 rtl:pr-4">
|
|
248
|
+
<p
|
|
249
|
+
className="cursor-pointer text-sm"
|
|
250
|
+
onClick={() => handleToggleAccount(account)}
|
|
251
|
+
>
|
|
252
|
+
{account.label ??
|
|
253
|
+
t('checkout.payment.store_credit.use_my_store_credits')}
|
|
254
|
+
</p>
|
|
255
|
+
<p className="flex text-sm text-[#606060]">
|
|
256
|
+
{t('checkout.payment.store_credit.available_balance')}:
|
|
257
|
+
<Price
|
|
258
|
+
value={account.balance}
|
|
259
|
+
currencyCode={
|
|
260
|
+
account.currency?.toUpperCase() ||
|
|
261
|
+
preOrder?.currency_type_label
|
|
262
|
+
}
|
|
263
|
+
className="pe-1 font-bold"
|
|
264
|
+
/>
|
|
265
|
+
</p>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
);
|
|
269
|
+
})}
|
|
270
|
+
|
|
271
|
+
{isLoyaltyBalanceUsed && parseFloat(preOrder?.unpaid_amount) > 0 && (
|
|
272
|
+
<p className="my-4 text-[15px] font-light italic text-[#707070] max-xs:text-xs">
|
|
273
|
+
<Trans
|
|
274
|
+
i18nKey="checkout.payment.store_credit.insufficient_balance"
|
|
275
|
+
components={{
|
|
276
|
+
Amount: (
|
|
277
|
+
<div className="inline-flex">
|
|
278
|
+
<Price
|
|
279
|
+
value={preOrder?.unpaid_amount}
|
|
280
|
+
currencyCode={preOrder?.currency_type_label}
|
|
281
|
+
className="text-primary"
|
|
282
|
+
/>
|
|
283
|
+
</div>
|
|
284
|
+
)
|
|
285
|
+
}}
|
|
286
|
+
/>
|
|
287
|
+
</p>
|
|
288
|
+
)}
|
|
289
|
+
</div>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// --- Legacy grouped mode render (from Redux loyaltyBalances) ---
|
|
294
|
+
if (hasLegacyGrouped) {
|
|
295
|
+
return (
|
|
296
|
+
<div
|
|
297
|
+
className={twMerge(
|
|
298
|
+
'flex flex-col w-full mb-4 border border-solid border-gray-400 px-0 md:p-4',
|
|
299
|
+
isPayLoading && 'pointer-events-none opacity-30'
|
|
300
|
+
)}
|
|
301
|
+
>
|
|
302
|
+
<div className="flex w-full items-center mb-3">
|
|
303
|
+
<button onClick={handleToggleLegacyAll}>
|
|
304
|
+
<span
|
|
305
|
+
className={clsx(
|
|
306
|
+
'flex h-5 w-5 items-center justify-center rounded border border-solid border-primary',
|
|
307
|
+
isLoyaltyBalanceUsed ? 'bg-primary' : 'bg-white'
|
|
308
|
+
)}
|
|
309
|
+
>
|
|
310
|
+
<Icon
|
|
311
|
+
name={isLoyaltyBalanceUsed ? 'check' : ''}
|
|
312
|
+
size={10}
|
|
313
|
+
className={clsx({ 'text-white': isLoyaltyBalanceUsed })}
|
|
314
|
+
/>
|
|
315
|
+
</span>
|
|
316
|
+
</button>
|
|
317
|
+
|
|
318
|
+
<div className="w-full pl-4">
|
|
319
|
+
<p
|
|
320
|
+
className="cursor-pointer text-sm"
|
|
321
|
+
onClick={handleToggleLegacyAll}
|
|
322
|
+
>
|
|
323
|
+
{t('checkout.payment.store_credit.use_my_store_credits')}
|
|
324
|
+
</p>
|
|
325
|
+
<p className="flex text-sm text-[#606060]">
|
|
326
|
+
{t('checkout.payment.store_credit.total_balance')}:
|
|
327
|
+
<Price
|
|
328
|
+
value={String(totalGroupedBalance)}
|
|
329
|
+
currencyCode={preOrder?.currency_type_label}
|
|
330
|
+
className="pe-1 font-bold"
|
|
331
|
+
/>
|
|
332
|
+
</p>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
<div className="ml-9 flex flex-col gap-2">
|
|
337
|
+
{loyaltyBalances.map((item) => {
|
|
338
|
+
const isSelected = selectedLabels[String(item.label_id)] ?? false;
|
|
339
|
+
return (
|
|
340
|
+
<div
|
|
341
|
+
key={String(item.label_id)}
|
|
342
|
+
className="flex items-center border border-solid border-gray-200 rounded p-2"
|
|
343
|
+
>
|
|
344
|
+
<button onClick={() => handleToggleLegacyLabel(item)}>
|
|
345
|
+
<span
|
|
346
|
+
className={clsx(
|
|
347
|
+
'flex h-4 w-4 items-center justify-center rounded border border-solid border-primary',
|
|
348
|
+
isSelected ? 'bg-primary' : 'bg-white'
|
|
349
|
+
)}
|
|
350
|
+
>
|
|
351
|
+
<Icon
|
|
352
|
+
name={isSelected ? 'check' : ''}
|
|
353
|
+
size={8}
|
|
354
|
+
className={clsx({ 'text-white': isSelected })}
|
|
355
|
+
/>
|
|
356
|
+
</span>
|
|
357
|
+
</button>
|
|
358
|
+
<div className="flex w-full items-center justify-between pl-3">
|
|
359
|
+
<span
|
|
360
|
+
className="cursor-pointer text-sm"
|
|
361
|
+
onClick={() => handleToggleLegacyLabel(item)}
|
|
362
|
+
>
|
|
363
|
+
{item.label ??
|
|
364
|
+
t('checkout.payment.store_credit.use_my_store_credits')}
|
|
365
|
+
</span>
|
|
366
|
+
<Price
|
|
367
|
+
value={item.balance}
|
|
368
|
+
currencyCode={
|
|
369
|
+
item.currency?.toUpperCase() ||
|
|
370
|
+
preOrder?.currency_type_label
|
|
371
|
+
}
|
|
372
|
+
className="text-sm font-bold"
|
|
373
|
+
/>
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
);
|
|
377
|
+
})}
|
|
378
|
+
</div>
|
|
379
|
+
|
|
380
|
+
{isLoyaltyBalanceUsed && parseFloat(preOrder?.unpaid_amount) > 0 && (
|
|
381
|
+
<p className="my-4 text-[15px] font-light italic text-[#707070] max-xs:text-xs">
|
|
382
|
+
<Trans
|
|
383
|
+
i18nKey="checkout.payment.store_credit.insufficient_balance"
|
|
384
|
+
components={{
|
|
385
|
+
Amount: (
|
|
386
|
+
<div className="inline-flex">
|
|
387
|
+
<Price
|
|
388
|
+
value={preOrder?.unpaid_amount}
|
|
389
|
+
currencyCode={preOrder?.currency_type_label}
|
|
390
|
+
className="text-primary"
|
|
391
|
+
/>
|
|
392
|
+
</div>
|
|
393
|
+
)
|
|
394
|
+
}}
|
|
395
|
+
/>
|
|
396
|
+
</p>
|
|
397
|
+
)}
|
|
398
|
+
</div>
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// --- Legacy single balance mode render (from Redux loyaltyBalance) ---
|
|
62
403
|
return (
|
|
63
404
|
<div
|
|
64
405
|
className={twMerge(
|
|
65
|
-
'
|
|
66
|
-
|
|
67
|
-
parseFloat(loyaltyBalance) > 0 && 'block'
|
|
406
|
+
'flex flex-col w-full mb-4 border border-solid border-gray-400 px-0 md:p-4',
|
|
407
|
+
isPayLoading && 'pointer-events-none opacity-30'
|
|
68
408
|
)}
|
|
69
409
|
>
|
|
70
410
|
<div className="flex w-full items-center">
|
|
71
|
-
<button onClick={
|
|
411
|
+
<button onClick={handleToggleLegacyAll}>
|
|
72
412
|
<span
|
|
73
413
|
className={clsx(
|
|
74
414
|
'flex h-5 w-5 items-center justify-center rounded border border-solid border-primary',
|
|
@@ -84,7 +424,10 @@ export const StoreCredits = () => {
|
|
|
84
424
|
</button>
|
|
85
425
|
|
|
86
426
|
<div className="w-full pl-4">
|
|
87
|
-
<p
|
|
427
|
+
<p
|
|
428
|
+
className="cursor-pointer text-sm"
|
|
429
|
+
onClick={handleToggleLegacyAll}
|
|
430
|
+
>
|
|
88
431
|
{t('checkout.payment.store_credit.use_my_store_credits')}
|
|
89
432
|
</p>
|
|
90
433
|
<p className="flex text-sm text-[#606060]">
|
|
@@ -85,7 +85,7 @@ const AddressBox = ({
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
const onSubmit = (data) => {
|
|
88
|
-
editAddress({ ...data, invalidateTag: '
|
|
88
|
+
editAddress({ ...data, invalidateTag: 'Checkout' })
|
|
89
89
|
.unwrap()
|
|
90
90
|
.then((editAddressResponse) => {
|
|
91
91
|
handleAddressClick(addressType, editAddressResponse);
|
|
@@ -96,7 +96,7 @@ const AddressBox = ({
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
const handleRemoveAddress = async (addressPk: number) => {
|
|
99
|
-
await removeAddress({ id: addressPk, invalidateTag: '
|
|
99
|
+
await removeAddress({ id: addressPk, invalidateTag: 'Checkout' });
|
|
100
100
|
setRemoveAddressModalOpen(false);
|
|
101
101
|
dispatch(resetCheckoutState());
|
|
102
102
|
|
|
@@ -168,7 +168,10 @@ const AddressBox = ({
|
|
|
168
168
|
<Button
|
|
169
169
|
appearance="ghost"
|
|
170
170
|
className="italic underline hover:text-secondary-500 hover:!bg-white hover:!border-white p-0 h-auto"
|
|
171
|
-
onClick={() =>
|
|
171
|
+
onClick={(e) => {
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
setIsEditAddressModalOpen(true);
|
|
174
|
+
}}
|
|
172
175
|
data-testid="checkout-address-edit"
|
|
173
176
|
>
|
|
174
177
|
{t('checkout.address.box.edit')}
|
|
@@ -180,21 +183,26 @@ const AddressBox = ({
|
|
|
180
183
|
setOpen={setIsEditAddressModalOpen}
|
|
181
184
|
className="w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto"
|
|
182
185
|
>
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
<div onClick={(e) => e.stopPropagation()}>
|
|
187
|
+
<AddressForm
|
|
188
|
+
data={{
|
|
189
|
+
...address,
|
|
190
|
+
country: address.country?.pk,
|
|
191
|
+
city: address.city?.pk,
|
|
192
|
+
township: address.township?.pk,
|
|
193
|
+
district: address.district?.pk
|
|
194
|
+
}}
|
|
195
|
+
onSubmit={onSubmit}
|
|
196
|
+
/>
|
|
197
|
+
</div>
|
|
193
198
|
</Modal>
|
|
194
199
|
<Button
|
|
195
200
|
appearance="ghost"
|
|
196
201
|
className="italic underline hover:text-secondary-500 hover:!bg-white hover:!border-white p-0 h-auto"
|
|
197
|
-
onClick={() =>
|
|
202
|
+
onClick={(e) => {
|
|
203
|
+
e.stopPropagation();
|
|
204
|
+
setRemoveAddressModalOpen(true);
|
|
205
|
+
}}
|
|
198
206
|
data-testid="checkout-address-remove"
|
|
199
207
|
>
|
|
200
208
|
{t('checkout.address.box.remove')}
|
|
@@ -207,14 +215,18 @@ const AddressBox = ({
|
|
|
207
215
|
setOpen={setRemoveAddressModalOpen}
|
|
208
216
|
showCloseButton={false}
|
|
209
217
|
>
|
|
210
|
-
<div
|
|
218
|
+
<div
|
|
219
|
+
className="text-center px-6 py-10"
|
|
220
|
+
onClick={(e) => e.stopPropagation()}
|
|
221
|
+
>
|
|
211
222
|
<p className="mb-4">
|
|
212
223
|
{t('account.address_book.modal.delete_description')}
|
|
213
224
|
</p>
|
|
214
225
|
<div className="space-x-3 flex justify-center">
|
|
215
226
|
<Button
|
|
216
227
|
appearance="outlined"
|
|
217
|
-
onClick={() => {
|
|
228
|
+
onClick={(e) => {
|
|
229
|
+
e.stopPropagation();
|
|
218
230
|
setRemoveAddressModalOpen(false);
|
|
219
231
|
}}
|
|
220
232
|
data-testid="remove-address-modal-cancel"
|
|
@@ -224,7 +236,8 @@ const AddressBox = ({
|
|
|
224
236
|
<Button
|
|
225
237
|
appearance="filled"
|
|
226
238
|
disabled={removeAddressLoading}
|
|
227
|
-
onClick={() => {
|
|
239
|
+
onClick={(e) => {
|
|
240
|
+
e.stopPropagation();
|
|
228
241
|
handleRemoveAddress(address.pk);
|
|
229
242
|
}}
|
|
230
243
|
className={
|
|
@@ -77,7 +77,7 @@ const Addresses = () => {
|
|
|
77
77
|
}, [billing_and_shipping_same]);
|
|
78
78
|
|
|
79
79
|
const onSubmit = (data) => {
|
|
80
|
-
addAddress({ ...data, invalidateTag: '
|
|
80
|
+
addAddress({ ...data, invalidateTag: 'Checkout' })
|
|
81
81
|
.unwrap()
|
|
82
82
|
.then((addAddressResponse) => {
|
|
83
83
|
if (addressList.length === 0) {
|
package/commands/plugins.ts
CHANGED
|
@@ -29,7 +29,14 @@ async function checkVersion(pkg: PackageJson) {
|
|
|
29
29
|
|
|
30
30
|
if (!semver.satisfies(pkg.dependencies['@akinon/next'], latestVersion)) {
|
|
31
31
|
console.warn(
|
|
32
|
-
`\x1b[
|
|
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}).`,
|
|
33
40
|
'\x1b[0m\n'
|
|
34
41
|
);
|
|
35
42
|
}
|
|
@@ -54,7 +61,27 @@ export default async () => {
|
|
|
54
61
|
}
|
|
55
62
|
}
|
|
56
63
|
|
|
57
|
-
|
|
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();
|
|
58
85
|
await checkVersion(pkg);
|
|
59
86
|
|
|
60
87
|
const pluginsFilePath = findPluginsFilePath();
|