@opexa/portal-sdk 0.0.5 → 0.0.7

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/sdk.d.ts CHANGED
@@ -28,7 +28,28 @@ export declare class Sdk {
28
28
  signIn(input: SignInInput): Promise<SignInReturn>;
29
29
  signOut(): Promise<void>;
30
30
  /**
31
+ * @description Watches the session if it is still valid whenever signed in.
31
32
  * @returns Unsubscribe function
33
+ * @example
34
+ * ```tsx
35
+ * import * as React from 'react';
36
+ * import { useAuthenticated } from '@lib/stores';
37
+ *
38
+ * function WatchSession() {
39
+ * const { setAuthenticated } = useAuthenticated();
40
+ *
41
+ * React.useEffect(() => {
42
+ * const unsubscribe = sdk.watchSession({
43
+ * interval: 30000,
44
+ * onInvalid() {
45
+ * setAuthenticated(false);
46
+ * },
47
+ * });
48
+ *
49
+ * return unsubscribe;
50
+ * }, []);
51
+ * }
52
+ * ```
32
53
  */
33
54
  watchSession(input: WatchSessionInput): () => void;
34
55
  session(): Promise<SessionReturn>;
@@ -62,6 +62,7 @@ export interface RegisterMemberAccountMutationVariables {
62
62
  mobileNumber: string;
63
63
  birthDay: string;
64
64
  domain?: string;
65
+ btag?: string;
65
66
  };
66
67
  verificationCode?: string;
67
68
  reCAPTCHAResponse?: string;
@@ -9,7 +9,6 @@ export interface TransactionRecord {
9
9
  currentBalance: Decimal;
10
10
  referenceNumber: string;
11
11
  dateTimeCreated: DateString;
12
- dateTimeLastUpdated: DateString;
13
12
  }
14
13
  export interface TransactionRecordsQuery {
15
14
  member: PaginatedQuery<'transactionRecords', TransactionRecord>;
@@ -7,12 +7,15 @@ interface Data {
7
7
  refreshToken: string;
8
8
  refreshTokenExpiresAt: number;
9
9
  }
10
+ interface SessionManagerConfig extends AuthServiceConfig {
11
+ log?: boolean;
12
+ }
10
13
  export declare class SessionManager {
11
14
  private logger;
12
15
  private storageKey;
13
16
  private authService;
14
17
  private _refreshing;
15
- constructor(config: AuthServiceConfig);
18
+ constructor(config: SessionManagerConfig);
16
19
  get refreshing(): boolean;
17
20
  set refreshing(value: boolean);
18
21
  create(input: CreateSessionInput): Promise<OperationResult<CreateSessionError>>;
package/dist/types.d.ts CHANGED
@@ -180,6 +180,7 @@ export interface CreateAccountInput {
180
180
  * - _max_: `10`
181
181
  * - _pattern_: `/^\d{4,10}$/`
182
182
  */
183
+ btag?: string;
183
184
  verificationCode?: string;
184
185
  reCAPTCHAResponse?: string;
185
186
  }
@@ -511,7 +512,6 @@ export interface TransactionRecord {
511
512
  currentBalance: number;
512
513
  referenceNumber: string;
513
514
  dateTimeCreated: Date;
514
- dateTimeLastUpdated: Date;
515
515
  }
516
516
  export interface TransactionRecordsInput extends Internal.TransactionRecordsQueryVariables {
517
517
  }
@@ -23,7 +23,8 @@ export declare class GraphQLClient {
23
23
  request<Data>(query: string, variables?: GenericObject): Promise<GraphQLClientResponse<Data>>;
24
24
  /** Single file upload */
25
25
  upload<Data>(query: string, variables: GenericObject): Promise<GraphQLClientResponse<Data>>;
26
+ private exec;
26
27
  private runMiddlewares;
27
- private static createUploadBody;
28
- private static extractFiles;
28
+ private createUploadBody;
29
+ private extractFiles;
29
30
  }
@@ -1,4 +1,24 @@
1
- export type HttpErrorCode = 'HttpBadRequest' | 'HttpUnauthorized' | 'HttpForbidden' | 'HttpNotFound' | 'HttpRequestTimeout' | 'HttpTooManyRequests' | 'HttpInternalServerError' | 'HttpServiceUnavailable';
1
+ export type HttpErrorCode =
2
+ /** 400 */
3
+ 'HttpBadRequest'
4
+ /** 401 */
5
+ | 'HttpUnauthorized'
6
+ /** 403 */
7
+ | 'HttpForbidden'
8
+ /** 404 */
9
+ | 'HttpNotFound'
10
+ /** 408 */
11
+ | 'HttpRequestTimeout'
12
+ /** 429 */
13
+ | 'HttpTooManyRequests'
14
+ /** 500 */
15
+ | 'HttpInternalServerError'
16
+ /** 502 */
17
+ | 'HttpBadGateway'
18
+ /** 503 */
19
+ | 'HttpServiceUnavailable'
20
+ /** 504 */
21
+ | 'HttpGatewayTimeout';
2
22
  export interface HttpError {
3
23
  code: HttpErrorCode;
4
24
  message: string;
package/package.json CHANGED
@@ -1,81 +1,78 @@
1
- {
2
- "name": "@opexa/portal-sdk",
3
- "type": "module",
4
- "version": "0.0.5",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "typings": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "require": "./dist/index.js",
11
- "import": "./dist/index.mjs",
12
- "types": "./dist/index.d.ts"
13
- },
14
- "./package.json": "./package.json"
15
- },
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "files": [
20
- "dist"
21
- ],
22
- "scripts": {
23
- "dev": "vite",
24
- "build": "tsc --noEmit && vite build --mode library",
25
- "test": "vitest",
26
- "release": "release-it"
27
- },
28
- "dependencies": {
29
- "@opexa/object-id": "0.1.6"
30
- },
31
- "devDependencies": {
32
- "@ark-ui/react": "3.5.0",
33
- "@faker-js/faker": "8.4.1",
34
- "@fontsource/fira-code": "5.0.18",
35
- "@fontsource/inter": "5.0.18",
36
- "@types/node": "20.14.9",
37
- "@types/react": "18.3.3",
38
- "@types/react-dom": "18.3.0",
39
- "@untitled-theme/icons-react": "0.10.1",
40
- "@vitejs/plugin-react-swc": "3.7.0",
41
- "autoprefixer": "10.4.19",
42
- "clsx": "2.1.1",
43
- "date-fns": "3.6.0",
44
- "msw": "2.3.1",
45
- "postcss": "8.4.39",
46
- "prettier": "3.3.2",
47
- "prettier-plugin-svelte": "3.2.5",
48
- "prettier-plugin-tailwindcss": "0.6.5",
49
- "react": "18.3.1",
50
- "react-dom": "18.3.1",
51
- "react-router-dom": "6.24.0",
52
- "release-it": "17.4.1",
53
- "shiki": "1.10.1",
54
- "tailwind-variants": "0.2.1",
55
- "tailwindcss": "3.4.4",
56
- "typescript": "5.5.3",
57
- "vite": "5.3.3",
58
- "vite-plugin-dts": "3.9.1",
59
- "vite-plugin-node-polyfills": "0.22.0",
60
- "vite-tsconfig-paths": "4.3.2",
61
- "vitest": "1.6.0",
62
- "zod": "3.23.8"
63
- },
64
- "release-it": {
65
- "git": {
66
- "commitMessage": "chore: release ${npm.name} v${version}",
67
- "tagName": "${npm.name}@${version}"
68
- },
69
- "github": {
70
- "release": false
71
- },
72
- "hooks": {
73
- "before:init": [
74
- "pnpm test"
75
- ],
76
- "after:bump": [
77
- "pnpm build"
78
- ]
79
- }
80
- }
81
- }
1
+ {
2
+ "name": "@opexa/portal-sdk",
3
+ "type": "module",
4
+ "version": "0.0.7",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "typings": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.mjs",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "build": "tsc --noEmit && vite build --mode library",
25
+ "test": "vitest",
26
+ "release": "release-it"
27
+ },
28
+ "dependencies": {
29
+ "@opexa/object-id": "0.1.6"
30
+ },
31
+ "devDependencies": {
32
+ "@ark-ui/react": "3.5.0",
33
+ "@faker-js/faker": "8.4.1",
34
+ "@fontsource/fira-code": "5.0.18",
35
+ "@fontsource/inter": "5.0.18",
36
+ "@types/node": "20.14.9",
37
+ "@types/react": "18.3.3",
38
+ "@types/react-dom": "18.3.0",
39
+ "@untitled-theme/icons-react": "0.10.1",
40
+ "@vitejs/plugin-react-swc": "3.7.0",
41
+ "autoprefixer": "10.4.19",
42
+ "clsx": "2.1.1",
43
+ "date-fns": "3.6.0",
44
+ "msw": "2.3.1",
45
+ "postcss": "8.4.39",
46
+ "react": "18.3.1",
47
+ "react-dom": "18.3.1",
48
+ "react-router-dom": "6.24.0",
49
+ "release-it": "17.4.1",
50
+ "shiki": "1.10.1",
51
+ "tailwind-variants": "0.2.1",
52
+ "tailwindcss": "3.4.4",
53
+ "typescript": "5.5.3",
54
+ "vite": "5.3.3",
55
+ "vite-plugin-dts": "3.9.1",
56
+ "vite-plugin-node-polyfills": "0.22.0",
57
+ "vite-tsconfig-paths": "4.3.2",
58
+ "vitest": "1.6.0",
59
+ "zod": "3.23.8"
60
+ },
61
+ "release-it": {
62
+ "git": {
63
+ "commitMessage": "chore: release ${npm.name} v${version}",
64
+ "tagName": "${npm.name}@${version}"
65
+ },
66
+ "github": {
67
+ "release": false
68
+ },
69
+ "hooks": {
70
+ "before:init": [
71
+ "pnpm test"
72
+ ],
73
+ "after:bump": [
74
+ "pnpm build"
75
+ ]
76
+ }
77
+ }
78
+ }