@akinon/projectzero 1.96.0-rc.57 → 1.96.0-rc.59

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.96.0-rc.59
4
+
5
+ ## 1.96.0-rc.58
6
+
3
7
  ## 1.96.0-rc.57
4
8
 
5
9
  ## 1.96.0-rc.56
@@ -0,0 +1,338 @@
1
+ # Settings.js Configuration Instructions
2
+
3
+ This file is the main configuration file for the ProjectZero Next.js application. All customizable settings are defined here.
4
+
5
+ ## 📋 Table of Contents
6
+
7
+ - [Basic Structure](#basic-structure)
8
+ - [Available Settings](#available-settings)
9
+ - [Detailed Explanations](#detailed-explanations)
10
+ - [Example Configuration](#example-configuration)
11
+ - [Plugin Configuration](#plugin-configuration)
12
+ - [Important Notes](#important-notes)
13
+
14
+ ## Basic Structure
15
+
16
+ ```javascript
17
+ /** @type {import('@akinon/next/types').Settings} */
18
+ module.exports = {
19
+ // Settings are defined here
20
+ };
21
+ ```
22
+
23
+ ## Available Settings
24
+
25
+ ### 1. 🌐 Web Vitals
26
+ ```javascript
27
+ webVitals: {
28
+ enabled: true // Enables/disables web performance metrics
29
+ }
30
+ ```
31
+
32
+ ### 2. 🔗 Commerce URL
33
+ ```javascript
34
+ commerceUrl: string // Backend API URL (taken from SERVICE_BACKEND_URL environment variable)
35
+ ```
36
+
37
+ ### 3. 🏷️ Product Attributes
38
+ ```javascript
39
+ commonProductAttributes: [
40
+ {
41
+ translationKey: 'color', // Translation key
42
+ key: 'color' // Attribute key from API
43
+ },
44
+ {
45
+ translationKey: 'size',
46
+ key: 'size'
47
+ }
48
+ ]
49
+ ```
50
+
51
+ ### 4. 🌍 Localization Settings
52
+ ```javascript
53
+ localization: {
54
+ // Supported languages
55
+ locales: [
56
+ {
57
+ label: 'EN', // Display label
58
+ value: 'en', // Language code in ISO 639-1 format
59
+ localePath: 'en', // URL path
60
+ apiValue: 'en-us', // Value used for API
61
+ rtl: false // Right-to-left writing (true for Arabic, Hebrew)
62
+ }
63
+ ],
64
+
65
+ // Supported currencies
66
+ currencies: [
67
+ {
68
+ label: 'USD', // Display label
69
+ code: 'usd', // Currency code in ISO 4217 format
70
+ decimalScale: 2 // Number of decimal places (optional)
71
+ }
72
+ ],
73
+
74
+ defaultLocaleValue: 'en', // Default language
75
+ localeUrlStrategy: LocaleUrlStrategy.HideDefaultLocale, // URL strategy
76
+ redirectToDefaultLocale: true, // Redirect to default locale
77
+ defaultCurrencyCode: 'usd', // Default currency
78
+
79
+ // Dynamic currency determination (optional)
80
+ getActiveCurrencyCode: ({ req, locale, defaultCurrencyCode }) => {
81
+ // Custom currency determination logic
82
+ return defaultCurrencyCode;
83
+ },
84
+
85
+ // Locale included pretty URL pattern (optional)
86
+ localeIncludedPrettyUrlPattern: new RegExp('.+/pages/.+$')
87
+ }
88
+ ```
89
+
90
+ #### Locale URL Strategies:
91
+ - `LocaleUrlStrategy.HideDefaultLocale`: Default language is hidden in URL
92
+ - `LocaleUrlStrategy.ShowAllLocales`: All languages are shown in URL
93
+ - `LocaleUrlStrategy.HideAllLocales`: No language is shown in URL
94
+
95
+ ### 5. 🔄 URL Rewrites
96
+ ```javascript
97
+ rewrites: [
98
+ {
99
+ source: '/auth', // Source URL
100
+ destination: '/auth' // Destination URL
101
+ }
102
+ ]
103
+ ```
104
+
105
+ ### 6. ⚡ Redis Cache Settings
106
+ ```javascript
107
+ redis: {
108
+ defaultExpirationTime: 900 // Default cache duration (seconds)
109
+ }
110
+ ```
111
+
112
+ ### 7. 💳 Checkout Settings
113
+ ```javascript
114
+ checkout: {
115
+ // Payment options to exclude from iframe (deprecated)
116
+ iframeExcludedPaymentOptions: ['payment-option-slug'],
117
+
118
+ // Payment options to include in iframe
119
+ iframeIncludedPaymentOptions: ['payment-option-slug'],
120
+
121
+ // Additional payment types
122
+ extraPaymentTypes: ['custom-payment-type'],
123
+
124
+ // Masterpass JS URL
125
+ masterpassJsUrl: 'https://example.com/masterpass.js'
126
+ }
127
+ ```
128
+
129
+ ### 8. ⚙️ Other Settings
130
+ ```javascript
131
+ // Enable custom 404 page
132
+ customNotFoundEnabled: false,
133
+
134
+ // Use optimized translations
135
+ useOptimizedTranslations: true,
136
+
137
+ // Use pretty URL route
138
+ usePrettyUrlRoute: true,
139
+
140
+ // Plugin settings
141
+ plugins: {
142
+ 'plugin-name': {
143
+ setting1: 'value1',
144
+ setting2: 'value2'
145
+ }
146
+ },
147
+
148
+ // Proxy headers - determines which headers should be passed to Commerce API
149
+ includedProxyHeaders: ['x-custom-header', 'x-forwarded-for', 'user-agent'],
150
+
151
+ // Commerce redirection ignore list
152
+ commerceRedirectionIgnoreList: ['/api/', '/_next/'],
153
+
154
+ // Reset basket when currency changes
155
+ resetBasketOnCurrencyChange: true,
156
+
157
+ // Frontend IDs used to pass x-frontend-id header to commerce
158
+ frontendIds: {
159
+ 'frontend-name': 123
160
+ }
161
+ ```
162
+
163
+ ## Detailed Explanations
164
+
165
+ ### 🔒 includedProxyHeaders
166
+
167
+ This setting determines which HTTP headers should be passed in proxy requests from the Next.js application to the Commerce API.
168
+
169
+ #### How It Works?
170
+
171
+ 1. **Default Behavior**: The system does not pass certain headers to the Commerce API by default
172
+ 2. **Override Mechanism**: Headers specified in the `includedProxyHeaders` array are passed to the Commerce API even if they are in the excluded list
173
+
174
+ #### Why Is It Used?
175
+
176
+ - **🔐 Security**: Prevents headers containing sensitive information from being passed to the Commerce API
177
+ - **⚡ Performance**: Prevents unnecessary headers from being passed
178
+ - **🔧 Flexibility**: Allows specific headers to be passed for special cases
179
+
180
+ #### Usage Example
181
+
182
+ ```javascript
183
+ includedProxyHeaders: [
184
+ 'x-forwarded-for',
185
+ 'user-agent',
186
+ 'x-custom-header',
187
+ 'x-device-type'
188
+ ]
189
+ ```
190
+
191
+ ### 🚫 commerceRedirectionIgnoreList
192
+
193
+ This setting determines which URL patterns should disable redirections (redirects) coming from the Commerce API.
194
+
195
+ #### How It Works?
196
+
197
+ 1. **Middleware Process**: The `url-redirection.ts` middleware runs on every URL request
198
+ 2. **Commerce Check**: The middleware sends the current URL to the Commerce API
199
+ 3. **Redirect Check**: If a redirect response comes from the Commerce API, `commerceRedirectionIgnoreList` is checked
200
+ 4. **Pattern Matching**: If the redirect URL matches one of the patterns in the ignore list, the redirect is not performed
201
+
202
+ #### Why Is It Used?
203
+
204
+ - Ensures that certain pages are not affected by Commerce redirects
205
+
206
+ #### Usage Example
207
+
208
+ ```javascript
209
+ commerceRedirectionIgnoreList: ['/users/reset']
210
+ ```
211
+
212
+ ## Example Configuration
213
+
214
+ ```javascript
215
+ const { LocaleUrlStrategy } = require('@akinon/next/localization');
216
+ const { ROUTES } = require('@theme/routes');
217
+
218
+ const commerceUrl = encodeURI(process.env.SERVICE_BACKEND_URL ?? 'default');
219
+
220
+ /** @type {import('@akinon/next/types').Settings} */
221
+ module.exports = {
222
+ webVitals: {
223
+ enabled: true
224
+ },
225
+ commerceUrl,
226
+ commonProductAttributes: [
227
+ { translationKey: 'color', key: 'color' },
228
+ { translationKey: 'size', key: 'size' }
229
+ ],
230
+ localization: {
231
+ locales: [
232
+ {
233
+ label: 'EN',
234
+ value: 'en',
235
+ localePath: 'en',
236
+ apiValue: 'en-us',
237
+ rtl: false
238
+ },
239
+ {
240
+ label: 'TR',
241
+ value: 'tr',
242
+ localePath: 'tr',
243
+ apiValue: 'tr-tr',
244
+ rtl: false
245
+ }
246
+ ],
247
+ currencies: [
248
+ {
249
+ label: 'USD',
250
+ code: 'usd',
251
+ decimalScale: 2
252
+ },
253
+ {
254
+ label: 'TRY',
255
+ code: 'try',
256
+ decimalScale: 2
257
+ }
258
+ ],
259
+ defaultLocaleValue: 'en',
260
+ localeUrlStrategy: LocaleUrlStrategy.HideDefaultLocale,
261
+ redirectToDefaultLocale: true,
262
+ defaultCurrencyCode: 'usd'
263
+ },
264
+ rewrites: [
265
+ {
266
+ source: ROUTES.AUTH,
267
+ destination: '/auth'
268
+ }
269
+ ],
270
+ redis: {
271
+ defaultExpirationTime: 900
272
+ },
273
+ customNotFoundEnabled: false
274
+ };
275
+ ```
276
+
277
+ ## Plugin Configuration
278
+
279
+ The `plugins` setting allows you to customize the behavior of plugins in the ProjectZero ecosystem.
280
+
281
+ ### 🎛️ How It Works?
282
+
283
+ 1. **Plugin System**: Plugins are loaded through the `PluginModule` component
284
+ 2. **Settings Integration**: Each plugin gets its own settings through `settings.plugins[pluginName]`
285
+ 3. **Dynamic Loading**: Plugins are loaded only when needed (lazy loading)
286
+ 4. **Customization**: Each plugin has its own specific settings
287
+
288
+ ### 🚀 Example: pz-akifast Plugin Configuration
289
+
290
+ ```javascript
291
+ plugins: {
292
+ 'pz-akifast': {
293
+ quickLogin: false, // Hide quick login button
294
+ pdp: false, // Hide checkout button on product detail page
295
+ basket: true // Show checkout button on basket page
296
+ }
297
+ }
298
+ ```
299
+
300
+
301
+ ### 💡 Plugin Usage Examples
302
+
303
+ #### Akifast Quick Login Button
304
+ ```javascript
305
+ // settings.js
306
+ plugins: {
307
+ 'pz-akifast': {
308
+ quickLogin: true // Show button
309
+ }
310
+ }
311
+ ```
312
+
313
+ #### Akifast Checkout Button
314
+ ```javascript
315
+ // settings.js
316
+ plugins: {
317
+ 'pz-akifast': {
318
+ pdp: true, // Show on product detail page
319
+ basket: false // Hide on basket page
320
+ }
321
+ }
322
+ ```
323
+
324
+ ### ⚠️ Things to Consider
325
+
326
+ 1. **Plugin Names**: Plugin names must match exactly (e.g., `pz-akifast`)
327
+ 5. **Performance**: Plugins are loaded only when needed
328
+
329
+ ## Important Notes
330
+
331
+ 1. **📝 TypeScript Support**: The file provides TypeScript support with `@type` comment
332
+ 2. **🌐 Environment Variables**: Commerce URL is taken from `SERVICE_BACKEND_URL` environment variable
333
+ 3. **📦 Imports**: Required modules must be imported at the beginning of the file
334
+ 4. **✅ Validation**: All settings must comply with the Settings interface
335
+ 5. **⚡ Performance**: Redis cache settings affect performance
336
+ 6. **🌍 Localization**: Language and currency settings directly affect the e-commerce experience
337
+ 7. **🔒 Proxy Headers**: The `includedProxyHeaders` setting is critical for security and performance
338
+ 8. **🚫 Redirect Control**: The `commerceRedirectionIgnoreList` setting is important for protecting APIs and static files
@@ -1,5 +1,57 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.96.0-rc.59
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [4c23847]
8
+ - @akinon/pz-gpay@1.96.0-rc.59
9
+ - @akinon/next@1.96.0-rc.59
10
+ - @akinon/pz-akifast@1.96.0-rc.59
11
+ - @akinon/pz-b2b@1.96.0-rc.59
12
+ - @akinon/pz-basket-gift-pack@1.96.0-rc.59
13
+ - @akinon/pz-bkm@1.96.0-rc.59
14
+ - @akinon/pz-checkout-gift-pack@1.96.0-rc.59
15
+ - @akinon/pz-click-collect@1.96.0-rc.59
16
+ - @akinon/pz-credit-payment@1.96.0-rc.59
17
+ - @akinon/pz-hepsipay@1.96.0-rc.59
18
+ - @akinon/pz-masterpass@1.96.0-rc.59
19
+ - @akinon/pz-one-click-checkout@1.96.0-rc.59
20
+ - @akinon/pz-otp@1.96.0-rc.59
21
+ - @akinon/pz-pay-on-delivery@1.96.0-rc.59
22
+ - @akinon/pz-saved-card@1.96.0-rc.59
23
+ - @akinon/pz-similar-products@1.96.0-rc.59
24
+ - @akinon/pz-tabby-extension@1.96.0-rc.59
25
+ - @akinon/pz-tamara-extension@1.96.0-rc.59
26
+
27
+ ## 1.96.0-rc.58
28
+
29
+ ### Minor Changes
30
+
31
+ - 994dafe: ZERO-3616: Add settings instruction file
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [af5c93a]
36
+ - @akinon/next@1.96.0-rc.58
37
+ - @akinon/pz-akifast@1.96.0-rc.58
38
+ - @akinon/pz-b2b@1.96.0-rc.58
39
+ - @akinon/pz-basket-gift-pack@1.96.0-rc.58
40
+ - @akinon/pz-bkm@1.96.0-rc.58
41
+ - @akinon/pz-checkout-gift-pack@1.96.0-rc.58
42
+ - @akinon/pz-click-collect@1.96.0-rc.58
43
+ - @akinon/pz-credit-payment@1.96.0-rc.58
44
+ - @akinon/pz-gpay@1.96.0-rc.58
45
+ - @akinon/pz-hepsipay@1.96.0-rc.58
46
+ - @akinon/pz-masterpass@1.96.0-rc.58
47
+ - @akinon/pz-one-click-checkout@1.96.0-rc.58
48
+ - @akinon/pz-otp@1.96.0-rc.58
49
+ - @akinon/pz-pay-on-delivery@1.96.0-rc.58
50
+ - @akinon/pz-saved-card@1.96.0-rc.58
51
+ - @akinon/pz-similar-products@1.96.0-rc.58
52
+ - @akinon/pz-tabby-extension@1.96.0-rc.58
53
+ - @akinon/pz-tamara-extension@1.96.0-rc.58
54
+
3
55
  ## 1.96.0-rc.57
4
56
 
5
57
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.96.0-rc.57",
3
+ "version": "1.96.0-rc.59",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -24,24 +24,24 @@
24
24
  "test:middleware": "jest middleware-matcher.test.ts --bail"
25
25
  },
26
26
  "dependencies": {
27
- "@akinon/next": "1.96.0-rc.57",
28
- "@akinon/pz-akifast": "1.96.0-rc.57",
29
- "@akinon/pz-b2b": "1.96.0-rc.57",
30
- "@akinon/pz-basket-gift-pack": "1.96.0-rc.57",
31
- "@akinon/pz-bkm": "1.96.0-rc.57",
32
- "@akinon/pz-checkout-gift-pack": "1.96.0-rc.57",
33
- "@akinon/pz-click-collect": "1.96.0-rc.57",
34
- "@akinon/pz-credit-payment": "1.96.0-rc.57",
35
- "@akinon/pz-gpay": "1.96.0-rc.57",
36
- "@akinon/pz-hepsipay": "1.96.0-rc.57",
37
- "@akinon/pz-masterpass": "1.96.0-rc.57",
38
- "@akinon/pz-one-click-checkout": "1.96.0-rc.57",
39
- "@akinon/pz-otp": "1.96.0-rc.57",
40
- "@akinon/pz-pay-on-delivery": "1.96.0-rc.57",
41
- "@akinon/pz-saved-card": "1.96.0-rc.57",
42
- "@akinon/pz-similar-products": "1.96.0-rc.57",
43
- "@akinon/pz-tabby-extension": "1.96.0-rc.57",
44
- "@akinon/pz-tamara-extension": "1.96.0-rc.57",
27
+ "@akinon/next": "1.96.0-rc.59",
28
+ "@akinon/pz-akifast": "1.96.0-rc.59",
29
+ "@akinon/pz-b2b": "1.96.0-rc.59",
30
+ "@akinon/pz-basket-gift-pack": "1.96.0-rc.59",
31
+ "@akinon/pz-bkm": "1.96.0-rc.59",
32
+ "@akinon/pz-checkout-gift-pack": "1.96.0-rc.59",
33
+ "@akinon/pz-click-collect": "1.96.0-rc.59",
34
+ "@akinon/pz-credit-payment": "1.96.0-rc.59",
35
+ "@akinon/pz-gpay": "1.96.0-rc.59",
36
+ "@akinon/pz-hepsipay": "1.96.0-rc.59",
37
+ "@akinon/pz-masterpass": "1.96.0-rc.59",
38
+ "@akinon/pz-one-click-checkout": "1.96.0-rc.59",
39
+ "@akinon/pz-otp": "1.96.0-rc.59",
40
+ "@akinon/pz-pay-on-delivery": "1.96.0-rc.59",
41
+ "@akinon/pz-saved-card": "1.96.0-rc.59",
42
+ "@akinon/pz-similar-products": "1.96.0-rc.59",
43
+ "@akinon/pz-tabby-extension": "1.96.0-rc.59",
44
+ "@akinon/pz-tamara-extension": "1.96.0-rc.59",
45
45
  "@hookform/resolvers": "2.9.0",
46
46
  "@next/third-parties": "14.1.0",
47
47
  "@react-google-maps/api": "2.17.1",
@@ -64,7 +64,7 @@
64
64
  "yup": "0.32.11"
65
65
  },
66
66
  "devDependencies": {
67
- "@akinon/eslint-plugin-projectzero": "1.96.0-rc.57",
67
+ "@akinon/eslint-plugin-projectzero": "1.96.0-rc.59",
68
68
  "@semantic-release/changelog": "6.0.2",
69
69
  "@semantic-release/exec": "6.0.3",
70
70
  "@semantic-release/git": "10.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.96.0-rc.57",
3
+ "version": "1.96.0-rc.59",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {