@akinon/next 1.117.0-rc.0 → 1.117.0-rc.1

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,11 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.117.0-rc.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 36143125: ZERO-3987: Add barcode scanner functionality with modal and button
8
+
3
9
  ## 1.117.0-rc.0
4
10
 
5
11
  ### Minor Changes
@@ -0,0 +1,59 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import Settings from 'settings';
3
+
4
+ export async function GET(request: NextRequest) {
5
+ try {
6
+ const { searchParams } = new URL(request.url);
7
+ const barcode = searchParams.get('search_text');
8
+
9
+ if (!barcode) {
10
+ return NextResponse.json(
11
+ { error: 'Missing search_text parameter (barcode)' },
12
+ { status: 400 }
13
+ );
14
+ }
15
+
16
+ if (Settings.commerceUrl === 'default') {
17
+ return NextResponse.json(
18
+ { error: 'Commerce URL is not configured' },
19
+ { status: 500 }
20
+ );
21
+ }
22
+
23
+ const queryParams = new URLSearchParams();
24
+ queryParams.append('search_text', barcode);
25
+
26
+ searchParams.forEach((value, key) => {
27
+ if (key !== 'search_text') {
28
+ queryParams.append(key, value);
29
+ }
30
+ });
31
+
32
+ const apiUrl = `${Settings.commerceUrl}/list/?${queryParams.toString()}`;
33
+
34
+ const headers: Record<string, string> = {
35
+ Accept: 'application/json',
36
+ 'Content-Type': 'application/json'
37
+ };
38
+
39
+ const response = await fetch(apiUrl, {
40
+ method: 'GET',
41
+ headers
42
+ });
43
+
44
+ if (!response.ok) {
45
+ return NextResponse.json(
46
+ { error: `API request failed with status: ${response.status}` },
47
+ { status: response.status }
48
+ );
49
+ }
50
+
51
+ const data = await response.json();
52
+ return NextResponse.json(data);
53
+ } catch (error) {
54
+ return NextResponse.json(
55
+ { error: (error as Error).message },
56
+ { status: 500 }
57
+ );
58
+ }
59
+ }
@@ -55,6 +55,7 @@ export enum Component {
55
55
  SavedCard = 'SavedCardOption',
56
56
  VirtualTryOnPlugin = 'VirtualTryOnPlugin',
57
57
  BasketVirtualTryOn = 'BasketVirtualTryOn',
58
+ BarcodeScannerPlugin = 'BarcodeScannerPlugin',
58
59
  IyzicoSavedCard = 'IyzicoSavedCardOption',
59
60
  Hepsipay = 'Hepsipay',
60
61
  FlowPayment = 'FlowPayment',
@@ -116,7 +117,7 @@ const PluginComponents = new Map([
116
117
  [Plugin.FlowPayment, [Component.FlowPayment]],
117
118
  [
118
119
  Plugin.VirtualTryOn,
119
- [Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn]
120
+ [Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn, Component.BarcodeScannerPlugin]
120
121
  ],
121
122
  [Plugin.Hepsipay, [Component.Hepsipay]],
122
123
  [Plugin.MasterpassRest, [Component.MasterpassRest]],
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.117.0-rc.0",
4
+ "version": "1.117.0-rc.1",
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.117.0-rc.0",
38
+ "@akinon/eslint-plugin-projectzero": "1.117.0-rc.1",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",