@opexa/portal-components 0.0.89 → 0.0.91
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/dist/handlers.d.ts +3 -0
- package/dist/handlers.js +8 -4
- package/dist/next.config.js +4 -0
- package/dist/services/graphqlRequest.js +5 -1
- package/dist/services/httpRequest.js +4 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +192 -192
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +8 -8
- package/dist/ui/Dialog/Dialog.d.ts +88 -88
- package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Field/Field.d.ts +21 -21
- package/dist/ui/Field/field.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- package/package.json +1 -1
package/dist/handlers.d.ts
CHANGED
|
@@ -15,9 +15,11 @@ export declare const GET: (request: NextRequest, { params }: {
|
|
|
15
15
|
} | {
|
|
16
16
|
ok: false;
|
|
17
17
|
message: string;
|
|
18
|
+
__error?: unknown;
|
|
18
19
|
}> | NextResponse<{
|
|
19
20
|
ok: false;
|
|
20
21
|
message: string;
|
|
22
|
+
__error?: unknown;
|
|
21
23
|
} | {
|
|
22
24
|
ok: true;
|
|
23
25
|
data: GetSessionResponse;
|
|
@@ -32,6 +34,7 @@ export declare const DELETE: (request: NextRequest, { params }: {
|
|
|
32
34
|
} | {
|
|
33
35
|
ok: false;
|
|
34
36
|
message: string;
|
|
37
|
+
__error?: unknown;
|
|
35
38
|
}>>;
|
|
36
39
|
export declare const POST: (request: NextRequest, { params }: {
|
|
37
40
|
params: Promise<{
|
package/dist/handlers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addDays, addMinutes, subMinutes } from 'date-fns';
|
|
2
2
|
import { NextResponse } from 'next/server';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { ACCESS_TOKEN_COOKIE_NAME, PLATFORM_CODE, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, } from './constants/index.js';
|
|
4
|
+
import { ACCESS_TOKEN_COOKIE_NAME, BYPASS_RECAPTCHA, PLATFORM_CODE, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, } from './constants/index.js';
|
|
5
5
|
import { authenticate, createSession, destroySession, refreshSession, } from './services/index.js';
|
|
6
6
|
const CreateSessionDefinition = z.union([
|
|
7
7
|
z.object({
|
|
@@ -159,7 +159,6 @@ export const POST = async (request, { params }) => {
|
|
|
159
159
|
const body = await request.json();
|
|
160
160
|
const parsed = CreateSessionDefinition.safeParse(body);
|
|
161
161
|
const recaptcha = request.headers.get(RECAPTCHA_HEADER_KEY);
|
|
162
|
-
console.log(body);
|
|
163
162
|
if (!parsed.success) {
|
|
164
163
|
return NextResponse.json({
|
|
165
164
|
ok: false,
|
|
@@ -173,6 +172,9 @@ export const POST = async (request, { params }) => {
|
|
|
173
172
|
...(recaptcha && {
|
|
174
173
|
[RECAPTCHA_HEADER_KEY]: recaptcha,
|
|
175
174
|
}),
|
|
175
|
+
...(BYPASS_RECAPTCHA && {
|
|
176
|
+
'Test-Pass': '',
|
|
177
|
+
}),
|
|
176
178
|
},
|
|
177
179
|
});
|
|
178
180
|
if (res.authenticator) {
|
|
@@ -194,10 +196,11 @@ export const POST = async (request, { params }) => {
|
|
|
194
196
|
});
|
|
195
197
|
return response;
|
|
196
198
|
}
|
|
197
|
-
catch {
|
|
199
|
+
catch (e) {
|
|
198
200
|
return NextResponse.json({
|
|
199
201
|
ok: false,
|
|
200
202
|
message: 'Unauthorized',
|
|
203
|
+
__error: e,
|
|
201
204
|
}, { status: 401 });
|
|
202
205
|
}
|
|
203
206
|
}
|
|
@@ -236,10 +239,11 @@ export const POST = async (request, { params }) => {
|
|
|
236
239
|
});
|
|
237
240
|
return response;
|
|
238
241
|
}
|
|
239
|
-
catch {
|
|
242
|
+
catch (e) {
|
|
240
243
|
return NextResponse.json({
|
|
241
244
|
ok: false,
|
|
242
245
|
message: 'Unauthorized',
|
|
246
|
+
__error: e,
|
|
243
247
|
}, { status: 401 });
|
|
244
248
|
}
|
|
245
249
|
}
|
package/dist/next.config.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { BYPASS_RECAPTCHA, PLATFORM_CODE, PLATFORM_ID, SITE_ID, TEST_PASS_HEADER_KEY, } from '../constants/index.js';
|
|
2
|
+
import { BYPASS_RECAPTCHA, ENVIRONMENT, PLATFORM_CODE, PLATFORM_ID, RECAPTCHA_HEADER_KEY, SITE_ID, TEST_PASS_HEADER_KEY, } from '../constants/index.js';
|
|
3
3
|
export async function graphqlRequest(url, query, variables, options) {
|
|
4
4
|
const headers = new Headers();
|
|
5
5
|
headers.set('Role', 'MEMBER');
|
|
6
6
|
headers.set('Site-ID', SITE_ID);
|
|
7
7
|
headers.set('Platform-ID', PLATFORM_ID);
|
|
8
8
|
headers.set('Platform-Code', PLATFORM_CODE);
|
|
9
|
+
headers.set('Environment', ENVIRONMENT);
|
|
9
10
|
headers.set('Accept', 'application/json');
|
|
10
11
|
headers.set('Content-Type', 'application/json');
|
|
11
12
|
new Headers(options?.headers).forEach((value, key) => {
|
|
@@ -13,6 +14,7 @@ export async function graphqlRequest(url, query, variables, options) {
|
|
|
13
14
|
});
|
|
14
15
|
if (BYPASS_RECAPTCHA) {
|
|
15
16
|
headers.set(TEST_PASS_HEADER_KEY, '');
|
|
17
|
+
headers.delete(RECAPTCHA_HEADER_KEY);
|
|
16
18
|
}
|
|
17
19
|
const info = getOperationInfo(query);
|
|
18
20
|
const url_ = new URL(url);
|
|
@@ -110,9 +112,11 @@ export async function graphqlUpload(url, query, variables, options) {
|
|
|
110
112
|
headers.set('Site-ID', SITE_ID);
|
|
111
113
|
headers.set('Platform-ID', PLATFORM_ID);
|
|
112
114
|
headers.set('Platform-Code', PLATFORM_CODE);
|
|
115
|
+
headers.set('Environment', ENVIRONMENT);
|
|
113
116
|
headers.delete('Content-Type');
|
|
114
117
|
if (BYPASS_RECAPTCHA) {
|
|
115
118
|
headers.set(TEST_PASS_HEADER_KEY, '');
|
|
119
|
+
headers.delete(RECAPTCHA_HEADER_KEY);
|
|
116
120
|
}
|
|
117
121
|
const body = createUploadBody(query, variables);
|
|
118
122
|
const info = getOperationInfo(query);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { BYPASS_RECAPTCHA, PLATFORM_CODE, PLATFORM_ID, SITE_ID, TEST_PASS_HEADER_KEY, } from '../constants/index.js';
|
|
2
|
+
import { BYPASS_RECAPTCHA, ENVIRONMENT, PLATFORM_CODE, PLATFORM_ID, RECAPTCHA_HEADER_KEY, SITE_ID, TEST_PASS_HEADER_KEY, } from '../constants/index.js';
|
|
3
3
|
export async function httpRequest(url, opts = {}) {
|
|
4
4
|
const headers = new Headers(opts.headers);
|
|
5
5
|
headers.set('Role', 'MEMBER');
|
|
6
6
|
headers.set('Site-ID', SITE_ID);
|
|
7
7
|
headers.set('Platform-ID', PLATFORM_ID);
|
|
8
8
|
headers.set('Platform-Code', PLATFORM_CODE);
|
|
9
|
+
headers.set('Environment', ENVIRONMENT);
|
|
9
10
|
new Headers(opts.headers).forEach((value, key) => {
|
|
10
11
|
headers.set(key, value);
|
|
11
12
|
});
|
|
12
13
|
if (BYPASS_RECAPTCHA) {
|
|
13
14
|
headers.set(TEST_PASS_HEADER_KEY, '');
|
|
15
|
+
headers.delete(RECAPTCHA_HEADER_KEY);
|
|
14
16
|
}
|
|
15
17
|
const res = await fetch(url, {
|
|
16
18
|
...opts,
|
|
@@ -47,6 +49,7 @@ httpRequest.json = async (url, opts = {}) => {
|
|
|
47
49
|
});
|
|
48
50
|
if (BYPASS_RECAPTCHA) {
|
|
49
51
|
headers.set(TEST_PASS_HEADER_KEY, '');
|
|
52
|
+
headers.delete(RECAPTCHA_HEADER_KEY);
|
|
50
53
|
}
|
|
51
54
|
const response = await fetch(url, {
|
|
52
55
|
...opts,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -46,12 +46,14 @@ export type ApiResponse<T = never> = [T] extends [never] ? {
|
|
|
46
46
|
} | {
|
|
47
47
|
ok: false;
|
|
48
48
|
message: string;
|
|
49
|
+
__error?: unknown;
|
|
49
50
|
} : {
|
|
50
51
|
ok: true;
|
|
51
52
|
data: T;
|
|
52
53
|
} | {
|
|
53
54
|
ok: false;
|
|
54
55
|
message: string;
|
|
56
|
+
__error?: unknown;
|
|
55
57
|
};
|
|
56
58
|
export interface DateRange {
|
|
57
59
|
start: Date;
|