@akinon/next 1.21.0-rc.2 → 1.21.0-rc.3

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,13 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.21.0-rc.3
4
+
5
+ ### Minor Changes
6
+
7
+ - af8e38e0: ZERO-2247: Add additionalParams to MasterpassProvider and set them in buildPurchaseForm and buildDirectPurchaseForm
8
+ - 16027410: ZERO-2451: Refactor extraHeaders assignment in client.ts
9
+ - 9edd725b: Datalayer init changed to 3rd party script. Declare is the same as next
10
+
3
11
  ## 1.21.0-rc.2
4
12
 
5
13
  ### Minor Changes
package/api/client.ts CHANGED
@@ -43,13 +43,18 @@ async function proxyRequest(...args) {
43
43
  urlSearchParams.append(key, `${searchParams.get(key)}`);
44
44
  });
45
45
 
46
- const extraHeaders = Object.fromEntries(req.headers.entries());
46
+ const extraHeaders: Record<string, string> = {};
47
+
48
+ for (const [key, value] of Array.from(req.headers.entries())) {
49
+ extraHeaders[key.toLowerCase()] = value;
50
+ }
47
51
 
48
52
  [
49
53
  'x-forwarded-host',
50
54
  'x-forwarded-for',
51
55
  'x-forwarded-proto',
52
56
  'x-forwarded-port',
57
+ 'x-requested-with',
53
58
  'origin',
54
59
  'host',
55
60
  'referer',
File without changes
File without changes
File without changes
package/bin/pz-postdev.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/bin/pz-predev.js CHANGED
File without changes
File without changes
@@ -83,12 +83,18 @@ const completeMasterpassPayment = async (
83
83
  reduxStore: AppStore
84
84
  ) => {
85
85
  const state = reduxStore.getState();
86
- const { token, order_no } = context.page_context;
86
+ const { token, order_no, extras } = context.page_context;
87
87
  const { endpoints: apiEndpoints } = checkoutApi;
88
88
  const { preOrder } = state.checkout ?? {};
89
89
 
90
- const { isDirectPurchase, referenceNo, credentials, msisdn, selectedCard } =
91
- state.masterpass ?? {};
90
+ const {
91
+ isDirectPurchase,
92
+ referenceNo,
93
+ credentials,
94
+ msisdn,
95
+ selectedCard,
96
+ additionalParams
97
+ } = state.masterpass ?? {};
92
98
 
93
99
  const commonFormValues = {
94
100
  token,
@@ -96,12 +102,16 @@ const completeMasterpassPayment = async (
96
102
  referenceNo,
97
103
  merchantId: credentials?.merchant_id ?? null,
98
104
  msisdn,
99
- amount: preOrder?.unpaid_amount?.replace('.', '') ?? ''
105
+ amount: preOrder?.unpaid_amount?.replace('.', '') ?? '',
106
+ additionalParams: additionalParams ?? extras?.additionalParams
100
107
  };
101
108
 
102
109
  const form = isDirectPurchase
103
110
  ? await buildDirectPurchaseForm(commonFormValues, params)
104
- : await buildPurchaseForm({ ...commonFormValues, selectedCard });
111
+ : await buildPurchaseForm({
112
+ ...commonFormValues,
113
+ selectedCard
114
+ });
105
115
 
106
116
  window.MFS?.[
107
117
  state.masterpass.isDirectPurchase ? 'directPurchase' : 'purchase'
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.21.0-rc.2",
4
+ "version": "1.21.0-rc.3",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -32,7 +32,7 @@
32
32
  "@typescript-eslint/eslint-plugin": "6.7.4",
33
33
  "@typescript-eslint/parser": "6.7.4",
34
34
  "eslint": "^8.14.0",
35
- "@akinon/eslint-plugin-projectzero": "1.21.0-rc.2",
35
+ "@akinon/eslint-plugin-projectzero": "1.21.0-rc.3",
36
36
  "eslint-config-prettier": "8.5.0"
37
37
  }
38
38
  }
package/types/index.ts CHANGED
@@ -4,8 +4,11 @@ import { Control, FieldError } from 'react-hook-form';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  declare global {
7
- export interface Window {
8
- dataLayer: Record<string, any>[];
7
+ interface Window {
8
+ // we did it like this because declare types needs to be identical, if not it will fail
9
+ // eslint-disable-next-line @typescript-eslint/ban-types
10
+ dataLayer?: Object[];
11
+ [key: string]: any;
9
12
  }
10
13
  }
11
14