@akinon/pz-tabby-extension 2.0.0-beta.0 → 2.0.0-beta.10

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,46 @@
1
1
  # @akinon/pz-tabby-extension
2
2
 
3
+ ## 2.0.0-beta.10
4
+
5
+ ### Minor Changes
6
+
7
+ - 2806320: ZERO-3390: Update version tailwindcss, autoprefixer, tailwind-merge, postcss
8
+
9
+ ## 2.0.0-beta.9
10
+
11
+ ### Minor Changes
12
+
13
+ - 0fe7711: ZERO-3387: Upgrade nextjs, eslint-config-next
14
+
15
+ ## 2.0.0-beta.8
16
+
17
+ ## 2.0.0-beta.7
18
+
19
+ ## 2.0.0-beta.6
20
+
21
+ ### Minor Changes
22
+
23
+ - 8f05f9b: ZERO-3250: Beta branch synchronized with Main branch
24
+
25
+ ## 2.0.0-beta.5
26
+
27
+ ## 2.0.0-beta.4
28
+
29
+ ## 2.0.0-beta.3
30
+
31
+ ## 2.0.0-beta.2
32
+
33
+ ### Minor Changes
34
+
35
+ - a006015: ZERO-3116: Add not-found page and update default middleware.
36
+ - 1eeb3d8: ZERO-3116: Add not found page
37
+
38
+ ## 2.0.0-beta.1
39
+
40
+ ### Minor Changes
41
+
42
+ - ZERO-3091: Upgrade Next.js to v15 and React to v19
43
+
3
44
  ## 2.0.0-beta.0
4
45
 
5
46
  ### Major Changes
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@akinon/pz-tabby-extension",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.10",
4
4
  "license": "MIT",
5
5
  "main": "src/index.tsx",
6
6
  "peerDependencies": {
7
- "react": "^18.0.0",
8
- "react-dom": "^18.0.0"
7
+ "react": "^19.0.0",
8
+ "react-dom": "^19.0.0"
9
9
  },
10
10
  "devDependencies": {
11
- "@types/node": "^18.7.8",
12
- "@types/react": "^18.0.17",
13
- "@types/react-dom": "^18.0.6",
14
- "prettier": "^3.0.3",
15
- "react": "^18.2.0",
16
- "react-dom": "^18.2.0",
17
- "typescript": "^5.2.2"
11
+ "@types/node": "^22.10.2",
12
+ "@types/react": "^19.0.2",
13
+ "@types/react-dom": "^19.0.2",
14
+ "prettier": "^3.4.2",
15
+ "react": "^19.0.0",
16
+ "react-dom": "^19.0.0",
17
+ "typescript": "^5.7.2"
18
18
  }
19
19
  }
package/readme.md CHANGED
@@ -2,19 +2,7 @@
2
2
 
3
3
  ## Installation
4
4
 
5
- There are two ways to install the Tabby Payment Gateway extension:
6
-
7
- ### 1. Install the npm package using Yarn
8
-
9
- For the latest version, you can install the package using Yarn:
10
-
11
- ```bash
12
- yarn add @akinon/pz-tabby-extension
13
- ```
14
-
15
- ### 2. Preferred installation method
16
-
17
- You can also use the following command to install the extension with the latest plugins:
5
+ You can use the following command to install the extension with the latest plugins:
18
6
 
19
7
  ```bash
20
8
  npx @akinon/projectzero@latest --plugins
@@ -59,4 +47,4 @@ Add these variables to your `.env` file
59
47
  ```env
60
48
  TABBY_EXTENSION_URL=<your_extension_url>
61
49
  TABBY_HASH_KEY=<your_hash_key>
62
- ```
50
+ ```
@@ -7,12 +7,12 @@ type FormComponentProps = {
7
7
  context: any;
8
8
  };
9
9
 
10
- const FormComponent = ({
10
+ const FormComponent = async ({
11
11
  extensionUrl,
12
12
  sessionId,
13
13
  context
14
14
  }: FormComponentProps) => {
15
- const nextCookies = cookies();
15
+ const nextCookies = await cookies();
16
16
 
17
17
  const extensionUrlWithoutSlash = `${extensionUrl}`.endsWith('/')
18
18
  ? extensionUrl.slice(0, -1)
@@ -6,6 +6,7 @@ import FormComponent from '../components/FormComponent';
6
6
  import {
7
7
  fetchData,
8
8
  generateHash,
9
+ getISODateWithMicroseconds,
9
10
  getOrderStatus,
10
11
  getRandomString,
11
12
  groupByProductId
@@ -30,7 +31,7 @@ export const TabbyPaymentGateway = async ({
30
31
  return <></>;
31
32
  }
32
33
 
33
- const nextCookies = cookies();
34
+ const nextCookies = await cookies();
34
35
 
35
36
  const language = settings.localization.locales.find(
36
37
  (item) => item.value === locale
@@ -77,30 +78,32 @@ export const TabbyPaymentGateway = async ({
77
78
  category: item.product.category.name
78
79
  })),
79
80
  buyer_history: {
80
- registered_since: userProfile.date_joined,
81
- loyalty_level: successOrders.count,
82
- wishlist_count: wishlist.count,
83
- is_email_verified: userProfile.is_email_verified,
84
- is_social_networks_connected: userProfile.is_social_networks_connected,
81
+ registered_since: userProfile.date_joined ?? getISODateWithMicroseconds(),
82
+ loyalty_level: successOrders.count ?? 0,
83
+ wishlist_count: wishlist.count ?? 0,
84
+ is_email_verified: userProfile.is_email_verified ?? false,
85
+ is_social_networks_connected:
86
+ userProfile.is_social_networks_connected ?? false,
85
87
  is_phone_number_verified: userProfile.attributes?.verified_phone ?? false
86
88
  },
87
- order_history: orderHistory.results.map((order_history: any) => ({
88
- purchased_at: order_history.created_date,
89
- amount: order_history.amount,
90
- payment_method: order_history.card === null ? 'cod' : 'card',
91
- status: getOrderStatus(order_history.status.value),
92
- buyer: {
93
- phone: order_history.billing_address.phone_number,
94
- email: order_history.billing_address.email,
95
- name: `${order_history.billing_address.first_name} ${order_history.billing_address.last_name}`
96
- },
97
- shipping_address: {
98
- city: order_history.shipping_address.city.name,
99
- address: order_history.shipping_address.line,
100
- zip: order_history.shipping_address.postcode ?? '0'
101
- },
102
- order_items: groupByProductId(order_history.orderitem_set)
103
- }))
89
+ order_history:
90
+ orderHistory?.results?.map((order_history: any) => ({
91
+ purchased_at: order_history.created_date,
92
+ amount: order_history.amount,
93
+ payment_method: order_history.card === null ? 'cod' : 'card',
94
+ status: getOrderStatus(order_history.status.value),
95
+ buyer: {
96
+ phone: order_history.billing_address.phone_number,
97
+ email: order_history.billing_address.email,
98
+ name: `${order_history.billing_address.first_name} ${order_history.billing_address.last_name}`
99
+ },
100
+ shipping_address: {
101
+ city: order_history.shipping_address.city.name,
102
+ address: order_history.shipping_address.line,
103
+ zip: order_history.shipping_address.postcode ?? '0'
104
+ },
105
+ order_items: groupByProductId(order_history.orderitem_set)
106
+ })) ?? []
104
107
  };
105
108
 
106
109
  return (
@@ -64,3 +64,13 @@ export const getOrderStatus = (
64
64
  return OrderServiceStatus.Unknown;
65
65
  }
66
66
  };
67
+
68
+ export const getISODateWithMicroseconds = () => {
69
+ const now = new Date();
70
+ const isoString = now.toISOString();
71
+
72
+ const milliseconds = now.getMilliseconds().toString().padStart(3, '0');
73
+ const microseconds = milliseconds + '650';
74
+
75
+ return isoString.replace(/\.\d{3}Z$/, `.${microseconds}Z`);
76
+ };