@akinon/projectzero 1.126.14-v1-rc.10 → 1.126.14

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,6 +1,10 @@
1
1
  # @akinon/projectzero
2
2
 
3
- ## 1.126.14-v1-rc.10
3
+ ## 1.126.14
4
+
5
+ ### Patch Changes
6
+
7
+ - fb75f8e: ZERO-5168: Post the attribute-based shipping selection to the page name Commerce reports
4
8
 
5
9
  ## 1.126.13
6
10
 
@@ -1,39 +1,36 @@
1
1
  # projectzeronext
2
2
 
3
- ## 1.126.14-v1-rc.10
4
-
5
- ### Patch Changes
6
-
7
- - Updated dependencies [560e209]
8
- - Updated dependencies [d480941]
9
- - Updated dependencies [560e209]
10
- - Updated dependencies [182a639b]
11
- - @akinon/pz-tamara-extension@1.126.14-v1-rc.10
12
- - @akinon/pz-masterpass-rest@1.126.14-v1-rc.10
13
- - @akinon/next@1.126.14-v1-rc.10
14
- - @akinon/pz-virtual-try-on@1.126.14-v1-rc.10
15
- - @akinon/pz-akifast@1.126.14-v1-rc.10
16
- - @akinon/pz-apple-pay@1.126.14-v1-rc.10
17
- - @akinon/pz-b2b@1.126.14-v1-rc.10
18
- - @akinon/pz-basket-gift-pack@1.126.14-v1-rc.10
19
- - @akinon/pz-bkm@1.126.14-v1-rc.10
20
- - @akinon/pz-checkout-gift-pack@1.126.14-v1-rc.10
21
- - @akinon/pz-click-collect@1.126.14-v1-rc.10
22
- - @akinon/pz-credit-payment@1.126.14-v1-rc.10
23
- - @akinon/pz-cybersource-uc@1.126.14-v1-rc.10
24
- - @akinon/pz-flow-payment@1.126.14-v1-rc.10
25
- - @akinon/pz-google-pay@1.126.14-v1-rc.10
26
- - @akinon/pz-gpay@1.126.14-v1-rc.10
27
- - @akinon/pz-haso@1.126.14-v1-rc.10
28
- - @akinon/pz-hepsipay@1.126.14-v1-rc.10
29
- - @akinon/pz-masterpass@1.126.14-v1-rc.10
30
- - @akinon/pz-multi-basket@1.126.14-v1-rc.10
31
- - @akinon/pz-one-click-checkout@1.126.14-v1-rc.10
32
- - @akinon/pz-otp@1.126.14-v1-rc.10
33
- - @akinon/pz-pay-on-delivery@1.126.14-v1-rc.10
34
- - @akinon/pz-saved-card@1.126.14-v1-rc.10
35
- - @akinon/pz-similar-products@1.126.14-v1-rc.10
36
- - @akinon/pz-tabby-extension@1.126.14-v1-rc.10
3
+ ## 1.126.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [fb75f8e]
8
+ - @akinon/next@1.126.14
9
+ - @akinon/pz-virtual-try-on@1.126.14
10
+ - @akinon/pz-akifast@1.126.14
11
+ - @akinon/pz-apple-pay@1.126.14
12
+ - @akinon/pz-b2b@1.126.14
13
+ - @akinon/pz-basket-gift-pack@1.126.14
14
+ - @akinon/pz-bkm@1.126.14
15
+ - @akinon/pz-checkout-gift-pack@1.126.14
16
+ - @akinon/pz-click-collect@1.126.14
17
+ - @akinon/pz-credit-payment@1.126.14
18
+ - @akinon/pz-cybersource-uc@1.126.14
19
+ - @akinon/pz-flow-payment@1.126.14
20
+ - @akinon/pz-google-pay@1.126.14
21
+ - @akinon/pz-gpay@1.126.14
22
+ - @akinon/pz-haso@1.126.14
23
+ - @akinon/pz-hepsipay@1.126.14
24
+ - @akinon/pz-masterpass@1.126.14
25
+ - @akinon/pz-masterpass-rest@1.126.14
26
+ - @akinon/pz-multi-basket@1.126.14
27
+ - @akinon/pz-one-click-checkout@1.126.14
28
+ - @akinon/pz-otp@1.126.14
29
+ - @akinon/pz-pay-on-delivery@1.126.14
30
+ - @akinon/pz-saved-card@1.126.14
31
+ - @akinon/pz-similar-products@1.126.14
32
+ - @akinon/pz-tabby-extension@1.126.14
33
+ - @akinon/pz-tamara-extension@1.126.14
37
34
 
38
35
  ## 1.126.13
39
36
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.126.14-v1-rc.10",
3
+ "version": "1.126.14",
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": "1.126.14-v1-rc.10",
28
- "@akinon/pz-akifast": "1.126.14-v1-rc.10",
29
- "@akinon/pz-apple-pay": "1.126.14-v1-rc.10",
30
- "@akinon/pz-b2b": "1.126.14-v1-rc.10",
31
- "@akinon/pz-basket-gift-pack": "1.126.14-v1-rc.10",
32
- "@akinon/pz-bkm": "1.126.14-v1-rc.10",
33
- "@akinon/pz-checkout-gift-pack": "1.126.14-v1-rc.10",
34
- "@akinon/pz-click-collect": "1.126.14-v1-rc.10",
35
- "@akinon/pz-credit-payment": "1.126.14-v1-rc.10",
36
- "@akinon/pz-cybersource-uc": "1.126.14-v1-rc.10",
37
- "@akinon/pz-flow-payment": "1.126.14-v1-rc.10",
38
- "@akinon/pz-google-pay": "1.126.14-v1-rc.10",
39
- "@akinon/pz-gpay": "1.126.14-v1-rc.10",
40
- "@akinon/pz-haso": "1.126.14-v1-rc.10",
41
- "@akinon/pz-hepsipay": "1.126.14-v1-rc.10",
42
- "@akinon/pz-masterpass": "1.126.14-v1-rc.10",
43
- "@akinon/pz-masterpass-rest": "1.126.14-v1-rc.10",
44
- "@akinon/pz-multi-basket": "1.126.14-v1-rc.10",
45
- "@akinon/pz-one-click-checkout": "1.126.14-v1-rc.10",
46
- "@akinon/pz-otp": "1.126.14-v1-rc.10",
47
- "@akinon/pz-pay-on-delivery": "1.126.14-v1-rc.10",
48
- "@akinon/pz-saved-card": "1.126.14-v1-rc.10",
49
- "@akinon/pz-similar-products": "1.126.14-v1-rc.10",
50
- "@akinon/pz-tabby-extension": "1.126.14-v1-rc.10",
51
- "@akinon/pz-tamara-extension": "1.126.14-v1-rc.10",
52
- "@akinon/pz-virtual-try-on": "1.126.14-v1-rc.10",
27
+ "@akinon/next": "1.126.14",
28
+ "@akinon/pz-akifast": "1.126.14",
29
+ "@akinon/pz-apple-pay": "1.126.14",
30
+ "@akinon/pz-b2b": "1.126.14",
31
+ "@akinon/pz-basket-gift-pack": "1.126.14",
32
+ "@akinon/pz-bkm": "1.126.14",
33
+ "@akinon/pz-checkout-gift-pack": "1.126.14",
34
+ "@akinon/pz-click-collect": "1.126.14",
35
+ "@akinon/pz-credit-payment": "1.126.14",
36
+ "@akinon/pz-cybersource-uc": "1.126.14",
37
+ "@akinon/pz-flow-payment": "1.126.14",
38
+ "@akinon/pz-google-pay": "1.126.14",
39
+ "@akinon/pz-gpay": "1.126.14",
40
+ "@akinon/pz-haso": "1.126.14",
41
+ "@akinon/pz-hepsipay": "1.126.14",
42
+ "@akinon/pz-masterpass": "1.126.14",
43
+ "@akinon/pz-masterpass-rest": "1.126.14",
44
+ "@akinon/pz-multi-basket": "1.126.14",
45
+ "@akinon/pz-one-click-checkout": "1.126.14",
46
+ "@akinon/pz-otp": "1.126.14",
47
+ "@akinon/pz-pay-on-delivery": "1.126.14",
48
+ "@akinon/pz-saved-card": "1.126.14",
49
+ "@akinon/pz-similar-products": "1.126.14",
50
+ "@akinon/pz-tabby-extension": "1.126.14",
51
+ "@akinon/pz-tamara-extension": "1.126.14",
52
+ "@akinon/pz-virtual-try-on": "1.126.14",
53
53
  "@hookform/resolvers": "2.9.0",
54
54
  "@next/third-parties": "14.1.0",
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": "1.126.14-v1-rc.10",
75
+ "@akinon/eslint-plugin-projectzero": "1.126.14",
76
76
  "@semantic-release/changelog": "6.0.2",
77
77
  "@semantic-release/exec": "6.0.3",
78
78
  "@semantic-release/git": "10.0.1",
@@ -11,7 +11,7 @@ import {
11
11
  useSetDataSourceShippingOptionsMutation
12
12
  } from '@akinon/next/data/client/checkout';
13
13
  import { Price, Button, Radio } from '@theme/components';
14
- import { CheckoutStep } from '@akinon/next/types';
14
+ import { AttributeBasedShippingOption, CheckoutStep } from '@akinon/next/types';
15
15
  import { useLocalization } from '@akinon/next/hooks';
16
16
 
17
17
  const ShippingOptions: React.FC = () => {
@@ -47,22 +47,41 @@ const ShippingOptions: React.FC = () => {
47
47
 
48
48
  const initializeSelectedOptions = useCallback(() => {
49
49
  if (attribute_based_shipping_options) {
50
- const newSelected = { ...selectedShippingOptions };
50
+ const newSelected: Record<string, number> = {};
51
51
  let hasChanges = false;
52
52
 
53
53
  Object.entries(attributeBasedShippingOptions).forEach(
54
- ([color, options]) => {
55
- if (
56
- !newSelected[color] ||
57
- !options.some((opt) => opt.pk === newSelected[color])
58
- ) {
59
- newSelected[color] = options[0].pk;
54
+ ([color, group]) => {
55
+ // The step arrives as a dictionary of groups, each carrying its own
56
+ // option list. Both the local and the remote page use this shape.
57
+ const options: AttributeBasedShippingOption[] =
58
+ group?.attribute_based_shipping_options ?? [];
59
+
60
+ if (options.length === 0) {
61
+ return;
62
+ }
63
+
64
+ const previous = selectedShippingOptions[color];
65
+ const keepsPrevious = options.some((opt) => opt.pk === previous);
66
+
67
+ newSelected[color] = keepsPrevious ? previous : options[0].pk;
68
+
69
+ if (!keepsPrevious) {
60
70
  hasChanges = true;
61
71
  }
62
72
  }
63
73
  );
64
74
 
65
- if (hasChanges) {
75
+ // A group the backend no longer reports must not stay in the selection:
76
+ // it rejects the whole payload when the group count does not match.
77
+ if (
78
+ Object.keys(newSelected).length !==
79
+ Object.keys(selectedShippingOptions).length
80
+ ) {
81
+ hasChanges = true;
82
+ }
83
+
84
+ if (hasChanges && Object.keys(newSelected).length > 0) {
66
85
  dispatch(setSelectedShippingOptions(newSelected));
67
86
  setAttributeBasedShippingOptions(newSelected);
68
87
  }
@@ -203,31 +222,40 @@ const ShippingOptions: React.FC = () => {
203
222
  {attributeBasedShippingOptions &&
204
223
  Object.keys(attributeBasedShippingOptions).length > 0 &&
205
224
  Object.entries(attributeBasedShippingOptions).map(
206
- ([color, options]) => (
207
- <div key={color}>
208
- <h3 className="text-lg font-bold">{color}</h3>
209
- {options.map((option) => (
210
- <div
211
- key={option.pk}
212
- className="py-4 border-t border-gray-400 flex justify-between"
213
- >
214
- <Radio
215
- name={`attribute-based-shipping-${color}`}
216
- checked={selectedShippingOptions[color] === option.pk}
217
- onChange={() =>
218
- handleAttributeBasedOptionChange(color, option.pk)
219
- }
220
- data-testid={`checkout-attribute-based-shipping-${option.pk}`}
225
+ ([color, group]) => {
226
+ const options: AttributeBasedShippingOption[] =
227
+ group?.attribute_based_shipping_options ?? [];
228
+
229
+ if (options.length === 0) {
230
+ return null;
231
+ }
232
+
233
+ return (
234
+ <div key={color}>
235
+ <h3 className="text-lg font-bold">{color}</h3>
236
+ {options.map((option) => (
237
+ <div
238
+ key={option.pk}
239
+ className="py-4 border-t border-gray-400 flex justify-between"
221
240
  >
222
- {`${option.shipping_option_name}`}
223
- </Radio>
224
- <span className="text-xs">
225
- <Price value={option.shipping_amount} />
226
- </span>
227
- </div>
228
- ))}
229
- </div>
230
- )
241
+ <Radio
242
+ name={`attribute-based-shipping-${color}`}
243
+ checked={selectedShippingOptions[color] === option.pk}
244
+ onChange={() =>
245
+ handleAttributeBasedOptionChange(color, option.pk)
246
+ }
247
+ data-testid={`checkout-attribute-based-shipping-${option.pk}`}
248
+ >
249
+ {`${option.shipping_option_name}`}
250
+ </Radio>
251
+ <span className="text-xs">
252
+ <Price value={option.shipping_amount} />
253
+ </span>
254
+ </div>
255
+ ))}
256
+ </div>
257
+ );
258
+ }
231
259
  )}
232
260
 
233
261
  {dataSourceShippingOptions &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.126.14-v1-rc.10",
3
+ "version": "1.126.14",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {