@akinon/projectzero 2.0.0-beta.20 → 2.0.0-beta.22

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 (140) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/app-template/CHANGELOG.md +170 -0
  3. package/app-template/next.config.mjs +0 -1
  4. package/app-template/package.json +31 -30
  5. package/app-template/src/app/[pz]/[...prettyurl]/page.tsx +2 -2
  6. package/app-template/src/app/[pz]/account/layout.tsx +2 -1
  7. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/blog/[slug]/page.tsx +4 -2
  8. package/app-template/src/app/[pz]/category/[pk]/page.tsx +11 -1
  9. package/app-template/src/app/[pz]/group-product/[pk]/page.tsx +2 -2
  10. package/app-template/src/app/[pz]/layout.tsx +3 -1
  11. package/app-template/src/app/[pz]/list/page.tsx +11 -1
  12. package/app-template/src/app/[pz]/page.tsx +13 -35
  13. package/app-template/src/app/[pz]/pages/[slug]/page.tsx +19 -0
  14. package/app-template/src/app/[pz]/product/[pk]/page.tsx +2 -2
  15. package/app-template/src/app/api/barcode-search/route.ts +1 -1
  16. package/app-template/src/app/api/cache/route.ts +1 -1
  17. package/app-template/src/app/api/image-proxy/route.ts +1 -1
  18. package/app-template/src/app/api/logout/route.ts +1 -1
  19. package/app-template/src/app/api/product-categories/route.ts +1 -1
  20. package/app-template/src/app/api/similar-product-list/route.ts +1 -1
  21. package/app-template/src/app/api/similar-products/route.ts +1 -1
  22. package/app-template/src/app/api/virtual-try-on/route.ts +1 -1
  23. package/app-template/src/app/api/web-vitals/route.ts +1 -1
  24. package/app-template/src/components/quantity-selector.tsx +16 -4
  25. package/app-template/src/components/widget-content.tsx +3 -3
  26. package/app-template/src/routes/index.ts +6 -6
  27. package/app-template/src/utils/__tests__/theme-page-context.test.ts +145 -0
  28. package/app-template/src/utils/theme-page-context.ts +309 -0
  29. package/app-template/src/views/basket/basket-item.tsx +107 -691
  30. package/app-template/src/views/basket/index.ts +0 -2
  31. package/app-template/src/views/basket/summary.tsx +75 -496
  32. package/app-template/src/views/breadcrumb.tsx +38 -13
  33. package/app-template/src/views/category/category-header.tsx +66 -289
  34. package/app-template/src/views/category/category-info.tsx +24 -173
  35. package/app-template/src/views/category/filters/index.tsx +48 -208
  36. package/app-template/src/views/category/layout.tsx +5 -7
  37. package/app-template/src/views/checkout/index.tsx +0 -5
  38. package/app-template/src/views/checkout/steps/payment/index.tsx +2 -5
  39. package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +1 -72
  40. package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +40 -171
  41. package/app-template/src/views/checkout/steps/shipping/address-box.tsx +12 -74
  42. package/app-template/src/views/checkout/steps/shipping/addresses.tsx +45 -128
  43. package/app-template/src/views/checkout/steps/shipping/shipping-options.tsx +27 -232
  44. package/app-template/src/views/checkout/summary.tsx +29 -303
  45. package/app-template/src/views/footer.tsx +13 -415
  46. package/app-template/src/views/guest-login/index.tsx +1 -1
  47. package/app-template/src/views/header/action-menu.tsx +45 -277
  48. package/app-template/src/views/header/band.tsx +21 -6
  49. package/app-template/src/views/header/index.tsx +47 -109
  50. package/app-template/src/views/header/mini-basket.tsx +45 -820
  51. package/app-template/src/views/header/navbar.tsx +111 -178
  52. package/app-template/src/views/header/search/index.tsx +32 -71
  53. package/app-template/src/views/header/search/results.tsx +65 -127
  54. package/app-template/src/views/product/accordion-wrapper.tsx +43 -135
  55. package/app-template/src/views/product/index.ts +1 -1
  56. package/app-template/src/views/product/layout.tsx +7 -2
  57. package/app-template/src/views/product/misc-buttons.tsx +25 -339
  58. package/app-template/src/views/product/product-actions.tsx +8 -137
  59. package/app-template/src/views/product/product-info.tsx +31 -69
  60. package/app-template/src/views/product/product-share.tsx +8 -11
  61. package/app-template/src/views/product/slider.tsx +79 -117
  62. package/app-template/src/views/product-item/index.tsx +46 -119
  63. package/app-template/src/widgets/footer-social.tsx +16 -47
  64. package/app-template/src/widgets/footer-subscription/index.tsx +17 -183
  65. package/codemods/migrate-auth-v5/index.js +339 -0
  66. package/codemods/migrate-auth-v5/transform.js +86 -0
  67. package/dist/commands/plugins.js +23 -2
  68. package/package.json +1 -1
  69. package/app-template/src/app/[commerce]/[locale]/[currency]/pages/[slug]/page.tsx +0 -15
  70. package/app-template/src/views/basket/basket-summary-context.tsx +0 -560
  71. package/app-template/src/views/basket/designer-context.tsx +0 -617
  72. package/app-template/src/views/breadcrumb/breadcrumb-client.tsx +0 -190
  73. package/app-template/src/views/breadcrumb/breadcrumb-registrar.tsx +0 -286
  74. package/app-template/src/views/breadcrumb/constants.ts +0 -15
  75. package/app-template/src/views/breadcrumb/index.tsx +0 -127
  76. package/app-template/src/views/category/native-widget-context.tsx +0 -257
  77. package/app-template/src/views/category/product-list-registrar.tsx +0 -665
  78. package/app-template/src/views/checkout/checkout-address-registrar.tsx +0 -254
  79. package/app-template/src/views/checkout/checkout-buttons-registrar.tsx +0 -183
  80. package/app-template/src/views/checkout/checkout-delivery-method-registrar.tsx +0 -259
  81. package/app-template/src/views/checkout/checkout-payment-options-registrar.tsx +0 -253
  82. package/app-template/src/views/checkout/checkout-summary-registrar.tsx +0 -183
  83. package/app-template/src/views/checkout/constants.ts +0 -5
  84. package/app-template/src/views/checkout/steps/payment/options/masterpass-rest.tsx +0 -15
  85. package/app-template/src/views/checkout/steps/payment/options/saved-card.tsx +0 -18
  86. package/app-template/src/views/footer/footer-app-banner-context.tsx +0 -326
  87. package/app-template/src/views/footer/footer-bottom-context.tsx +0 -215
  88. package/app-template/src/views/footer/footer-bottom-wrapper.tsx +0 -74
  89. package/app-template/src/views/footer/footer-layout-constants.ts +0 -35
  90. package/app-template/src/views/footer/footer-layout-registrar.tsx +0 -342
  91. package/app-template/src/views/footer/footer-layout-switcher.tsx +0 -110
  92. package/app-template/src/views/footer/footer-menu-context.tsx +0 -211
  93. package/app-template/src/views/footer/footer-native-widgets.tsx +0 -60
  94. package/app-template/src/views/footer/footer-social-context.tsx +0 -254
  95. package/app-template/src/views/footer/footer-subscription-context.tsx +0 -210
  96. package/app-template/src/views/footer/footer-utils.ts +0 -43
  97. package/app-template/src/views/footer/footer-value-props-context.tsx +0 -326
  98. package/app-template/src/views/footer/logo-settings.ts +0 -183
  99. package/app-template/src/views/footer/native-widget-config.ts +0 -262
  100. package/app-template/src/views/footer/subscription-settings.ts +0 -122
  101. package/app-template/src/views/footer/use-footer-logo.ts +0 -162
  102. package/app-template/src/views/header/designer-context.tsx +0 -261
  103. package/app-template/src/views/header/header-announcement-registrar.tsx +0 -267
  104. package/app-template/src/views/header/header-client-wrapper.tsx +0 -496
  105. package/app-template/src/views/header/header-content.tsx +0 -1026
  106. package/app-template/src/views/header/header-currency-registrar.tsx +0 -348
  107. package/app-template/src/views/header/header-icons-context.tsx +0 -262
  108. package/app-template/src/views/header/header-language-registrar.tsx +0 -348
  109. package/app-template/src/views/header/header-layout-context.tsx +0 -143
  110. package/app-template/src/views/header/header-layout-registrar.tsx +0 -658
  111. package/app-template/src/views/header/header-logo-context.tsx +0 -228
  112. package/app-template/src/views/header/header-logo.tsx +0 -118
  113. package/app-template/src/views/header/header-mini-basket-context.tsx +0 -524
  114. package/app-template/src/views/header/header-search-registrar.tsx +0 -511
  115. package/app-template/src/views/header/header-text-slider-registrar.tsx +0 -382
  116. package/app-template/src/views/header/inline-search.tsx +0 -262
  117. package/app-template/src/views/header/navbar-menu-context.tsx +0 -219
  118. package/app-template/src/views/header/search/search-input.tsx +0 -61
  119. package/app-template/src/views/header/server-settings-parser.ts +0 -1105
  120. package/app-template/src/views/header/use-header-icons.ts +0 -241
  121. package/app-template/src/views/header/use-header-logo.ts +0 -213
  122. package/app-template/src/views/header/use-navbar-menu.ts +0 -179
  123. package/app-template/src/views/product/accordion-section.tsx +0 -61
  124. package/app-template/src/views/product/custom-button-group.tsx +0 -69
  125. package/app-template/src/views/product/favorites-button-section.tsx +0 -69
  126. package/app-template/src/views/product/find-in-store-section.tsx +0 -60
  127. package/app-template/src/views/product/product-info-section.tsx +0 -140
  128. package/app-template/src/views/product/quantity-section.tsx +0 -73
  129. package/app-template/src/views/product/sale-tag.tsx +0 -10
  130. package/app-template/src/views/product/share-section.tsx +0 -357
  131. package/app-template/src/views/product/variants-section.tsx +0 -126
  132. package/app-template/src/views/product-detail/constants.ts +0 -272
  133. package/app-template/src/views/product-detail/index.ts +0 -10
  134. package/app-template/src/views/product-detail/product-detail-registrar.tsx +0 -616
  135. package/app-template/src/widgets/footer-app-banner.tsx +0 -444
  136. package/app-template/src/widgets/footer-bottom.tsx +0 -127
  137. package/app-template/src/widgets/footer-menu-compact.tsx +0 -238
  138. package/app-template/src/widgets/footer-menu-two.tsx +0 -298
  139. package/app-template/src/widgets/footer-social-client.tsx +0 -251
  140. package/app-template/src/widgets/footer-value-props.tsx +0 -201
@@ -13,39 +13,10 @@ import {
13
13
  import { Price, Button, Radio } from '@theme/components';
14
14
  import { CheckoutStep } from '@akinon/next/types';
15
15
  import { useLocalization } from '@akinon/next/hooks';
16
- import { useCheckoutDeliveryMethod } from '@theme/views/checkout/checkout-delivery-method-registrar';
17
- import { useCheckoutButtons } from '@theme/views/checkout/checkout-buttons-registrar';
18
16
 
19
17
  const ShippingOptions: React.FC = () => {
20
18
  const { t } = useLocalization();
21
19
  const dispatch = useAppDispatch();
22
- const { viewType, sectionStyles } = useCheckoutDeliveryMethod();
23
- const { sectionStyles: buttonStyles } = useCheckoutButtons();
24
-
25
- // Helper to get style value (already includes unit if needed)
26
- const getStyleValue = (
27
- key: string,
28
- fallback: string | number = ''
29
- ): string | number => {
30
- const value = sectionStyles[key];
31
- if (value === undefined || value === null || value === '') {
32
- return fallback;
33
- }
34
- return value;
35
- };
36
-
37
- // Helper to get button style value
38
- const getButtonStyle = (
39
- key: string,
40
- fallback: string | number = ''
41
- ): string | number => {
42
- const value = buttonStyles[key];
43
- if (value === undefined || value === null || value === '') {
44
- return fallback;
45
- }
46
- return value;
47
- };
48
-
49
20
  const {
50
21
  steps,
51
22
  shippingOptions,
@@ -201,144 +172,33 @@ const ShippingOptions: React.FC = () => {
201
172
  {t('checkout.address.shipping.chosen_address')}:{' '}
202
173
  {shipping_address?.city.name}
203
174
  </p>
204
-
205
- {/* Dropdown View */}
206
- {viewType === 'dropdown' &&
207
- shippingOptions &&
208
- shippingOptions.length > 0 && (
209
- <div className="mb-4">
210
- <select
211
- className="w-full transition-all duration-200"
212
- style={{
213
- borderColor: getStyleValue(
214
- 'dropdown-border-color',
215
- '#e5e7eb'
216
- ) as string,
217
- borderWidth: getStyleValue('dropdown-border-width', '1px'),
218
- borderStyle: 'solid',
219
- borderRadius: getStyleValue(
220
- 'dropdown-border-radius',
221
- '6px'
222
- ),
223
- backgroundColor: getStyleValue(
224
- 'dropdown-background-color',
225
- '#ffffff'
226
- ) as string,
227
- padding: getStyleValue('dropdown-padding', '12px'),
228
- fontSize: getStyleValue('dropdown-font-size', '14px'),
229
- color: getStyleValue('dropdown-color', '#030712') as string
230
- }}
231
- value={shipping_option?.pk || ''}
232
- onChange={(e) => setShippingOption(Number(e.target.value))}
175
+ {shippingOptions && shippingOptions.length > 0 && (
176
+ <>
177
+ {shippingOptions.map((option) => (
178
+ <div
179
+ key={option.pk}
180
+ className="py-4 border-t border-gray-400 flex justify-between"
233
181
  >
234
- <option value="" disabled>
235
- {t('checkout.address.shipping.select_method') ||
236
- 'Select delivery method'}
237
- </option>
238
- {shippingOptions.map((option) => (
239
- <option key={option.pk} value={option.pk}>
240
- {option.name} - {option.shipping_amount}
241
- </option>
242
- ))}
243
- </select>
244
- </div>
245
- )}
246
-
247
- {/* Radio View */}
248
- {viewType === 'radio' &&
249
- shippingOptions &&
250
- shippingOptions.length > 0 && (
251
- <>
252
- {shippingOptions.map((option) => {
253
- const isSelected = option.pk === shipping_option?.pk;
254
- return (
255
- <div
256
- key={option.pk}
257
- className="flex justify-between cursor-pointer transition-all duration-200"
258
- style={{
259
- paddingTop: getStyleValue('item-padding-y', '16px'),
260
- paddingBottom: getStyleValue('item-padding-y', '16px'),
261
- borderTopWidth: getStyleValue(
262
- 'item-border-width',
263
- '1px'
264
- ),
265
- borderTopStyle: 'solid',
266
- borderTopColor: isSelected
267
- ? (getStyleValue(
268
- 'item-selected-border-color',
269
- '#3b82f6'
270
- ) as string)
271
- : (getStyleValue(
272
- 'item-border-color',
273
- '#e5e7eb'
274
- ) as string),
275
- backgroundColor: isSelected
276
- ? (getStyleValue(
277
- 'item-selected-background-color',
278
- '#f0f9ff'
279
- ) as string)
280
- : (getStyleValue(
281
- 'item-background-color',
282
- 'transparent'
283
- ) as string)
284
- }}
285
- onMouseEnter={(e) => {
286
- if (!isSelected) {
287
- e.currentTarget.style.backgroundColor = getStyleValue(
288
- 'item-hover-background-color',
289
- '#f9fafb'
290
- ) as string;
291
- }
292
- }}
293
- onMouseLeave={(e) => {
294
- if (!isSelected) {
295
- e.currentTarget.style.backgroundColor = getStyleValue(
296
- 'item-background-color',
297
- 'transparent'
298
- ) as string;
299
- }
300
- }}
301
- onClick={() => setShippingOption(option.pk)}
302
- >
303
- <Radio
304
- name="shipping"
305
- checked={isSelected}
306
- onChange={() => setShippingOption(option.pk)}
307
- data-testid={`checkout-shipping-option-${option.pk}`}
308
- >
309
- <span
310
- style={{
311
- fontSize: getStyleValue('label-font-size', '14px'),
312
- fontWeight: getStyleValue(
313
- 'label-font-weight',
314
- '400'
315
- ),
316
- color: getStyleValue(
317
- 'label-color',
318
- '#030712'
319
- ) as string
320
- }}
321
- >
322
- {option.name}
323
- </span>
324
- </Radio>
325
- <span
326
- style={{
327
- fontSize: getStyleValue('price-font-size', '12px'),
328
- fontWeight: getStyleValue('price-font-weight', '400'),
329
- color: getStyleValue(
330
- 'price-color',
331
- '#030712'
332
- ) as string
333
- }}
334
- >
335
- <Price value={option.shipping_amount} />
336
- </span>
337
- </div>
338
- );
339
- })}
340
- </>
341
- )}
182
+ <Radio
183
+ name="shipping"
184
+ checked={option.pk === shipping_option?.pk}
185
+ onChange={() => {
186
+ setShippingOption(option.pk);
187
+ }}
188
+ onClick={() => {
189
+ setShippingOption(option?.pk);
190
+ }}
191
+ data-testid={`checkout-shipping-option-${option.pk}`}
192
+ >
193
+ {option.name}
194
+ </Radio>
195
+ <span className="text-xs">
196
+ <Price value={option.shipping_amount} />
197
+ </span>
198
+ </div>
199
+ ))}
200
+ </>
201
+ )}
342
202
 
343
203
  {attributeBasedShippingOptions &&
344
204
  Object.keys(attributeBasedShippingOptions).length > 0 &&
@@ -403,74 +263,9 @@ const ShippingOptions: React.FC = () => {
403
263
  ))}
404
264
 
405
265
  <Button
406
- className="mt-2"
407
- style={{
408
- width: getButtonStyle('button-width', 'auto') as string,
409
- backgroundColor: getButtonStyle(
410
- 'primary-background-color',
411
- '#000000'
412
- ) as string,
413
- color: getButtonStyle('primary-text-color', '#ffffff') as string,
414
- borderWidth: getButtonStyle('primary-border-width', 0),
415
- borderStyle: 'solid',
416
- borderColor: getButtonStyle(
417
- 'primary-border-color',
418
- '#000000'
419
- ) as string,
420
- borderRadius: getButtonStyle('primary-border-radius', 4),
421
- paddingLeft: getButtonStyle('primary-padding-x', 24),
422
- paddingRight: getButtonStyle('primary-padding-x', 24),
423
- paddingTop: getButtonStyle('primary-padding-y', 12),
424
- paddingBottom: getButtonStyle('primary-padding-y', 12),
425
- fontSize: getButtonStyle('primary-font-size', 14),
426
- fontWeight: getButtonStyle('primary-font-weight', '500'),
427
- textTransform: getButtonStyle(
428
- 'primary-text-transform',
429
- 'uppercase'
430
- ) as string as
431
- | 'none'
432
- | 'capitalize'
433
- | 'uppercase'
434
- | 'lowercase'
435
- | 'initial'
436
- | 'inherit',
437
- cursor: !steps.shipping.completed ? 'not-allowed' : 'pointer',
438
- transition: 'all 0.2s ease'
439
- }}
266
+ className="mt-2 w-full"
440
267
  disabled={!steps.shipping.completed}
441
268
  onClick={() => dispatch(setCurrentStep(CheckoutStep.Payment))}
442
- onMouseEnter={(e) => {
443
- if (steps.shipping.completed) {
444
- e.currentTarget.style.backgroundColor = getButtonStyle(
445
- 'primary-hover-background-color',
446
- '#1a1a1a'
447
- ) as string;
448
- e.currentTarget.style.color = getButtonStyle(
449
- 'primary-hover-text-color',
450
- '#ffffff'
451
- ) as string;
452
- e.currentTarget.style.borderColor = getButtonStyle(
453
- 'primary-hover-border-color',
454
- '#1a1a1a'
455
- ) as string;
456
- }
457
- }}
458
- onMouseLeave={(e) => {
459
- if (steps.shipping.completed) {
460
- e.currentTarget.style.backgroundColor = getButtonStyle(
461
- 'primary-background-color',
462
- '#000000'
463
- ) as string;
464
- e.currentTarget.style.color = getButtonStyle(
465
- 'primary-text-color',
466
- '#ffffff'
467
- ) as string;
468
- e.currentTarget.style.borderColor = getButtonStyle(
469
- 'primary-border-color',
470
- '#000000'
471
- ) as string;
472
- }
473
- }}
474
269
  data-testid="checkout-shipping-save"
475
270
  >
476
271
  {t('checkout.address.shipping.button')}