@akinon/next 1.126.14-v1-rc.11 → 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,17 +1,10 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.126.14-v1-rc.11
3
+ ## 1.126.14
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - a34bb1b: ZERO-5168: Post the attribute-based shipping selection to the page name Commerce reports
8
-
9
- ## 1.126.14-v1-rc.10
10
-
11
- ### Patch Changes
12
-
13
- - d480941: ZERO-4399: add card rewards to pz-masterpass-rest
14
- - 182a639b: ZERO-4483: Verify v1-rc maintenance pipeline (no-op patch to confirm v1-rc dist-tag flow)
7
+ - fb75f8e: ZERO-5168: Post the attribute-based shipping selection to the page name Commerce reports
15
8
 
16
9
  ## 1.126.13
17
10
 
@@ -49,17 +49,21 @@ describe('attributeBasedShippingOptionMiddleware', () => {
49
49
  expect(result).toBeNull();
50
50
  });
51
51
 
52
- it('skips a group that came back without any option', () => {
53
- const { dispatch } = run({
52
+ it('posts nothing when only some of the reported groups are selectable', () => {
53
+ // The backend rejects a selection that does not cover every group it
54
+ // reported, and that rejection leaves pre_order empty, which re-arms this
55
+ // middleware. Posting a partial map would loop.
56
+ const { dispatch, result, action } = run({
54
57
  express: group(11),
55
58
  None: group()
56
59
  });
57
60
 
58
- expect(mockInitiate).toHaveBeenCalledWith({ express: 11 });
59
- expect(dispatch).toHaveBeenCalledTimes(1);
61
+ expect(mockInitiate).not.toHaveBeenCalled();
62
+ expect(dispatch).not.toHaveBeenCalled();
63
+ expect(result).toBe(action);
60
64
  });
61
65
 
62
- it('does not dispatch when no group has a selectable option', () => {
66
+ it('does not dispatch when no group has a selectable option at all', () => {
63
67
  const { dispatch, result, action } = run({ None: group() });
64
68
 
65
69
  expect(mockInitiate).not.toHaveBeenCalled();
@@ -71,4 +75,11 @@ describe('attributeBasedShippingOptionMiddleware', () => {
71
75
  expect(() => run({ None: {} })).not.toThrow();
72
76
  expect(mockInitiate).not.toHaveBeenCalled();
73
77
  });
78
+
79
+ it('still posts when every reported group is selectable', () => {
80
+ const { dispatch } = run({ express: group(11), standart: group(21, 22) });
81
+
82
+ expect(mockInitiate).toHaveBeenCalledWith({ express: 11, standart: 21 });
83
+ expect(dispatch).toHaveBeenCalledTimes(1);
84
+ });
74
85
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.126.14-v1-rc.11",
4
+ "version": "1.126.14",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "1.126.14-v1-rc.11",
38
+ "@akinon/eslint-plugin-projectzero": "1.126.14",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
@@ -21,10 +21,9 @@ export const attributeBasedShippingOptionMiddleware: Middleware = ({
21
21
  Object.keys(attributeBasedShippingOptions).length > 0 &&
22
22
  !preOrder.attribute_based_shipping_options
23
23
  ) {
24
- // A group can come back without any option -- the remote grouping falls
25
- // back to a single group when its provider is unreachable, and no rule
26
- // ships for it. Skip those instead of indexing into an empty list, which
27
- // would throw inside the middleware chain and drop the whole response.
24
+ // A group can come back without any option: the service logs it and still
25
+ // reports the group with an empty list, so indexing into it would throw
26
+ // inside the middleware chain and drop the whole checkout response.
28
27
  const initialSelectedOptions: Record<string, number> = {};
29
28
 
30
29
  Object.entries(attributeBasedShippingOptions).forEach(([key, group]) => {
@@ -35,7 +34,13 @@ export const attributeBasedShippingOptionMiddleware: Middleware = ({
35
34
  }
36
35
  });
37
36
 
38
- if (Object.keys(initialSelectedOptions).length === 0) {
37
+ // The backend rejects a selection that does not cover every group it
38
+ // reported, and the rejection leaves pre_order empty, which brings us
39
+ // straight back here. Post nothing rather than start that loop.
40
+ if (
41
+ Object.keys(initialSelectedOptions).length !==
42
+ Object.keys(attributeBasedShippingOptions).length
43
+ ) {
39
44
  return result;
40
45
  }
41
46