@shipfox/client-invitations 0.2.0
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/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +111 -0
- package/LICENSE +21 -0
- package/dist/complete-acceptance.d.ts +17 -0
- package/dist/complete-acceptance.d.ts.map +1 -0
- package/dist/complete-acceptance.js +29 -0
- package/dist/complete-acceptance.js.map +1 -0
- package/dist/feature.d.ts +9 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/feature.js +13 -0
- package/dist/feature.js.map +1 -0
- package/dist/hooks/api/accept-invitation.d.ts +11 -0
- package/dist/hooks/api/accept-invitation.d.ts.map +1 -0
- package/dist/hooks/api/accept-invitation.js +15 -0
- package/dist/hooks/api/accept-invitation.js.map +1 -0
- package/dist/hooks/api/preview-invitation.d.ts +19 -0
- package/dist/hooks/api/preview-invitation.d.ts.map +1 -0
- package/dist/hooks/api/preview-invitation.js +24 -0
- package/dist/hooks/api/preview-invitation.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/invitation-accept-page.d.ts +2 -0
- package/dist/pages/invitation-accept-page.d.ts.map +1 -0
- package/dist/pages/invitation-accept-page.js +384 -0
- package/dist/pages/invitation-accept-page.js.map +1 -0
- package/dist/routes/accept.d.ts +6 -0
- package/dist/routes/accept.d.ts.map +1 -0
- package/dist/routes/accept.js +7 -0
- package/dist/routes/accept.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +98 -0
- package/src/complete-acceptance.test.ts +55 -0
- package/src/complete-acceptance.ts +33 -0
- package/src/feature.ts +12 -0
- package/src/hooks/api/accept-invitation.ts +17 -0
- package/src/hooks/api/preview-invitation.ts +23 -0
- package/src/index.ts +7 -0
- package/src/pages/invitation-accept-page.tsx +298 -0
- package/src/routes/accept.tsx +4 -0
- package/test/setup.ts +3 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vitest.config.ts +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-emit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ shipfox-tsc-check
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# @shipfox/client-invitations
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3d064b8: Publishes the client runtime closure with shell, feature, route, Vite, and testing contracts.
|
|
8
|
+
- 6bc2e45: Adds the composable upstream client shell, feature catalog, and route manifests for every client feature.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [3d064b8]
|
|
13
|
+
- Updated dependencies [6bc2e45]
|
|
14
|
+
- @shipfox/client-api@0.2.0
|
|
15
|
+
- @shipfox/client-auth@0.2.0
|
|
16
|
+
- @shipfox/client-shell@0.2.0
|
|
17
|
+
|
|
18
|
+
## 0.0.5
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [c18d624]
|
|
23
|
+
- @shipfox/react-ui@0.3.1
|
|
24
|
+
- @shipfox/client-auth@0.0.5
|
|
25
|
+
|
|
26
|
+
## 0.0.4
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [1b0d344]
|
|
31
|
+
- @shipfox/api-auth-dto@2.0.0
|
|
32
|
+
- @shipfox/api-workspaces-dto@2.0.0
|
|
33
|
+
- @shipfox/client-auth@0.0.4
|
|
34
|
+
- @shipfox/client-api@0.0.1
|
|
35
|
+
- @shipfox/react-ui@0.3.0
|
|
36
|
+
|
|
37
|
+
## 0.0.3
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [43d7996]
|
|
42
|
+
- Updated dependencies [14e0bea]
|
|
43
|
+
- Updated dependencies [d02c5fd]
|
|
44
|
+
- Updated dependencies [9018f0b]
|
|
45
|
+
- Updated dependencies [7fdfd72]
|
|
46
|
+
- Updated dependencies [c0a883c]
|
|
47
|
+
- Updated dependencies [72ce351]
|
|
48
|
+
- Updated dependencies [2a3193f]
|
|
49
|
+
- Updated dependencies [f104ff2]
|
|
50
|
+
- Updated dependencies [7341569]
|
|
51
|
+
- Updated dependencies [e250c4c]
|
|
52
|
+
- Updated dependencies [e4c6abf]
|
|
53
|
+
- Updated dependencies [5d0676a]
|
|
54
|
+
- Updated dependencies [3afb7e3]
|
|
55
|
+
- Updated dependencies [a35c2dc]
|
|
56
|
+
- Updated dependencies [58f7aef]
|
|
57
|
+
- Updated dependencies [5264a22]
|
|
58
|
+
- Updated dependencies [9674879]
|
|
59
|
+
- Updated dependencies [225c9a5]
|
|
60
|
+
- Updated dependencies [24f131b]
|
|
61
|
+
- Updated dependencies [7790355]
|
|
62
|
+
- Updated dependencies [bb2a7bc]
|
|
63
|
+
- Updated dependencies [63bcac8]
|
|
64
|
+
- Updated dependencies [5eb06d0]
|
|
65
|
+
- Updated dependencies [4e13e5f]
|
|
66
|
+
- Updated dependencies [e92150d]
|
|
67
|
+
- Updated dependencies [8037501]
|
|
68
|
+
- Updated dependencies [0fb6018]
|
|
69
|
+
- Updated dependencies [c27a1ed]
|
|
70
|
+
- Updated dependencies [362b3eb]
|
|
71
|
+
- Updated dependencies [b8e49ff]
|
|
72
|
+
- Updated dependencies [8037501]
|
|
73
|
+
- Updated dependencies [6c0da64]
|
|
74
|
+
- Updated dependencies [07f8ff8]
|
|
75
|
+
- Updated dependencies [e457582]
|
|
76
|
+
- Updated dependencies [8b5c905]
|
|
77
|
+
- Updated dependencies [f849131]
|
|
78
|
+
- Updated dependencies [94bdcc5]
|
|
79
|
+
- Updated dependencies [a34c8ea]
|
|
80
|
+
- Updated dependencies [27770eb]
|
|
81
|
+
- Updated dependencies [8ac4bf4]
|
|
82
|
+
- Updated dependencies [6181819]
|
|
83
|
+
- Updated dependencies [3a0be6b]
|
|
84
|
+
- Updated dependencies [d42baf4]
|
|
85
|
+
- Updated dependencies [8037501]
|
|
86
|
+
- Updated dependencies [54bb8a3]
|
|
87
|
+
- Updated dependencies [f711e18]
|
|
88
|
+
- @shipfox/react-ui@0.3.0
|
|
89
|
+
- @shipfox/api-auth-dto@0.1.0
|
|
90
|
+
- @shipfox/api-workspaces-dto@0.1.0
|
|
91
|
+
- @shipfox/client-api@0.0.1
|
|
92
|
+
- @shipfox/client-auth@0.0.3
|
|
93
|
+
|
|
94
|
+
## 0.0.2
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [5c1e777]
|
|
99
|
+
- @shipfox/react-ui@0.2.0
|
|
100
|
+
- @shipfox/client-auth@0.0.2
|
|
101
|
+
|
|
102
|
+
## 0.0.1
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [2311e15]
|
|
107
|
+
- @shipfox/react-ui@0.1.1
|
|
108
|
+
- @shipfox/client-auth@0.0.1
|
|
109
|
+
- @shipfox/api-auth-dto@0.0.0
|
|
110
|
+
- @shipfox/api-workspaces-dto@0.0.0
|
|
111
|
+
- @shipfox/client-api@0.0.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shipfox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NavigateOptions } from '@tanstack/react-router';
|
|
2
|
+
/**
|
|
3
|
+
* Final step of every successful invitation accept path (existing-user match,
|
|
4
|
+
* signup-with-invitation success, login-then-accept). Refreshes the auth
|
|
5
|
+
* session so the JWT carries the new membership before navigating, then
|
|
6
|
+
* routes the user into the workspace home.
|
|
7
|
+
*
|
|
8
|
+
* `refreshAuth` is passed in so this helper stays a plain function (no hook).
|
|
9
|
+
* Call sites construct it via `useRefreshAuth()` from `@shipfox/client-auth`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function completeInvitationAcceptance(params: {
|
|
12
|
+
workspaceId: string;
|
|
13
|
+
workspaceName: string;
|
|
14
|
+
refreshAuth: () => Promise<unknown>;
|
|
15
|
+
navigate: (opts: NavigateOptions) => Promise<void> | void;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=complete-acceptance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete-acceptance.d.ts","sourceRoot":"","sources":["../src/complete-acceptance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAE5D;;;;;;;;GAQG;AACH,wBAAsB,4BAA4B,CAAC,MAAM,EAAE;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3D,GAAG,OAAO,CAAC,IAAI,CAAC,CAehB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { toast } from '@shipfox/react-ui/toast';
|
|
2
|
+
/**
|
|
3
|
+
* Final step of every successful invitation accept path (existing-user match,
|
|
4
|
+
* signup-with-invitation success, login-then-accept). Refreshes the auth
|
|
5
|
+
* session so the JWT carries the new membership before navigating, then
|
|
6
|
+
* routes the user into the workspace home.
|
|
7
|
+
*
|
|
8
|
+
* `refreshAuth` is passed in so this helper stays a plain function (no hook).
|
|
9
|
+
* Call sites construct it via `useRefreshAuth()` from `@shipfox/client-auth`.
|
|
10
|
+
*/ export async function completeInvitationAcceptance(params) {
|
|
11
|
+
// Access tokens embed memberships at issue time, so refresh before AuthGuard
|
|
12
|
+
// reads the accepted workspace.
|
|
13
|
+
try {
|
|
14
|
+
await params.refreshAuth();
|
|
15
|
+
} catch {
|
|
16
|
+
// Even if refresh fails the membership is real in the DB; surface the
|
|
17
|
+
// success toast and let the user re-auth if their session has fully
|
|
18
|
+
// expired. The next API call will redirect to login as usual.
|
|
19
|
+
}
|
|
20
|
+
toast.success(`You joined ${params.workspaceName}.`);
|
|
21
|
+
await params.navigate({
|
|
22
|
+
to: '/workspaces/$wid',
|
|
23
|
+
params: {
|
|
24
|
+
wid: params.workspaceId
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=complete-acceptance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/complete-acceptance.ts"],"sourcesContent":["import {toast} from '@shipfox/react-ui/toast';\nimport type {NavigateOptions} from '@tanstack/react-router';\n\n/**\n * Final step of every successful invitation accept path (existing-user match,\n * signup-with-invitation success, login-then-accept). Refreshes the auth\n * session so the JWT carries the new membership before navigating, then\n * routes the user into the workspace home.\n *\n * `refreshAuth` is passed in so this helper stays a plain function (no hook).\n * Call sites construct it via `useRefreshAuth()` from `@shipfox/client-auth`.\n */\nexport async function completeInvitationAcceptance(params: {\n workspaceId: string;\n workspaceName: string;\n refreshAuth: () => Promise<unknown>;\n navigate: (opts: NavigateOptions) => Promise<void> | void;\n}): Promise<void> {\n // Access tokens embed memberships at issue time, so refresh before AuthGuard\n // reads the accepted workspace.\n try {\n await params.refreshAuth();\n } catch {\n // Even if refresh fails the membership is real in the DB; surface the\n // success toast and let the user re-auth if their session has fully\n // expired. The next API call will redirect to login as usual.\n }\n toast.success(`You joined ${params.workspaceName}.`);\n await params.navigate({\n to: '/workspaces/$wid',\n params: {wid: params.workspaceId},\n });\n}\n"],"names":["toast","completeInvitationAcceptance","params","refreshAuth","success","workspaceName","navigate","to","wid","workspaceId"],"mappings":"AAAA,SAAQA,KAAK,QAAO,0BAA0B;AAG9C;;;;;;;;CAQC,GACD,OAAO,eAAeC,6BAA6BC,MAKlD;IACC,6EAA6E;IAC7E,gCAAgC;IAChC,IAAI;QACF,MAAMA,OAAOC,WAAW;IAC1B,EAAE,OAAM;IACN,sEAAsE;IACtE,oEAAoE;IACpE,8DAA8D;IAChE;IACAH,MAAMI,OAAO,CAAC,CAAC,WAAW,EAAEF,OAAOG,aAAa,CAAC,CAAC,CAAC;IACnD,MAAMH,OAAOI,QAAQ,CAAC;QACpBC,IAAI;QACJL,QAAQ;YAACM,KAAKN,OAAOO,WAAW;QAAA;IAClC;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const invitationsFeature: {
|
|
2
|
+
readonly id: "shipfox.invitations";
|
|
3
|
+
readonly routes: readonly [{
|
|
4
|
+
readonly path: "/invitations/accept";
|
|
5
|
+
readonly parent: "root";
|
|
6
|
+
readonly impl: "@shipfox/client-invitations/routes/accept";
|
|
7
|
+
}];
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;;;CAS7B,CAAC"}
|
package/dist/feature.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineClientFeature } from '@shipfox/client-shell';
|
|
2
|
+
export const invitationsFeature = defineClientFeature({
|
|
3
|
+
id: 'shipfox.invitations',
|
|
4
|
+
routes: [
|
|
5
|
+
{
|
|
6
|
+
path: '/invitations/accept',
|
|
7
|
+
parent: 'root',
|
|
8
|
+
impl: '@shipfox/client-invitations/routes/accept'
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/feature.ts"],"sourcesContent":["import {defineClientFeature} from '@shipfox/client-shell';\n\nexport const invitationsFeature = defineClientFeature({\n id: 'shipfox.invitations',\n routes: [\n {\n path: '/invitations/accept',\n parent: 'root',\n impl: '@shipfox/client-invitations/routes/accept',\n },\n ],\n});\n"],"names":["defineClientFeature","invitationsFeature","id","routes","path","parent","impl"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,wBAAwB;AAE1D,OAAO,MAAMC,qBAAqBD,oBAAoB;IACpDE,IAAI;IACJC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;KACD;AACH,GAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function useAcceptInvitation(): import("@tanstack/react-query").UseMutationResult<{
|
|
2
|
+
membership: {
|
|
3
|
+
id: string;
|
|
4
|
+
user_id: string;
|
|
5
|
+
workspace_id: string;
|
|
6
|
+
};
|
|
7
|
+
already_member: boolean;
|
|
8
|
+
}, Error, {
|
|
9
|
+
token: string;
|
|
10
|
+
}, unknown>;
|
|
11
|
+
//# sourceMappingURL=accept-invitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accept-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/accept-invitation.ts"],"names":[],"mappings":"AAcA,wBAAgB,mBAAmB;;;;;;;;;YAElC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { apiRequest } from '@shipfox/client-api';
|
|
2
|
+
import { useMutation } from '@tanstack/react-query';
|
|
3
|
+
async function acceptInvitation(body) {
|
|
4
|
+
return await apiRequest('/invitations/accept', {
|
|
5
|
+
method: 'POST',
|
|
6
|
+
body
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export function useAcceptInvitation() {
|
|
10
|
+
return useMutation({
|
|
11
|
+
mutationFn: acceptInvitation
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=accept-invitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/accept-invitation.ts"],"sourcesContent":["import type {\n AcceptInvitationBodyDto,\n AcceptInvitationResponseDto,\n} from '@shipfox/api-workspaces-dto';\nimport {apiRequest} from '@shipfox/client-api';\nimport {useMutation} from '@tanstack/react-query';\n\nasync function acceptInvitation(body: AcceptInvitationBodyDto) {\n return await apiRequest<AcceptInvitationResponseDto>('/invitations/accept', {\n method: 'POST',\n body,\n });\n}\n\nexport function useAcceptInvitation() {\n return useMutation({mutationFn: acceptInvitation});\n}\n"],"names":["apiRequest","useMutation","acceptInvitation","body","method","useAcceptInvitation","mutationFn"],"mappings":"AAIA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,WAAW,QAAO,wBAAwB;AAElD,eAAeC,iBAAiBC,IAA6B;IAC3D,OAAO,MAAMH,WAAwC,uBAAuB;QAC1EI,QAAQ;QACRD;IACF;AACF;AAEA,OAAO,SAASE;IACd,OAAOJ,YAAY;QAACK,YAAYJ;IAAgB;AAClD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const previewInvitationQueryKey: (token: string) => readonly ["invitations", "preview", string];
|
|
2
|
+
export declare function usePreviewInvitation(token: string | undefined): import("@tanstack/react-query").UseQueryResult<NoInfer<{
|
|
3
|
+
status: "pending";
|
|
4
|
+
workspace_id: string;
|
|
5
|
+
workspace_name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
invited_by_display: string | null;
|
|
8
|
+
expires_at: string;
|
|
9
|
+
} | {
|
|
10
|
+
status: "expired";
|
|
11
|
+
workspace_name: string;
|
|
12
|
+
expires_at: string;
|
|
13
|
+
} | {
|
|
14
|
+
status: "already_used";
|
|
15
|
+
workspace_name: string;
|
|
16
|
+
} | {
|
|
17
|
+
status: "invalid";
|
|
18
|
+
}>, Error>;
|
|
19
|
+
//# sourceMappingURL=preview-invitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/preview-invitation.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,gDACX,CAAC;AAS7C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;WAQ7D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { apiRequest } from '@shipfox/client-api';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
export const previewInvitationQueryKey = (token)=>[
|
|
4
|
+
'invitations',
|
|
5
|
+
'preview',
|
|
6
|
+
token
|
|
7
|
+
];
|
|
8
|
+
async function previewInvitation(token) {
|
|
9
|
+
const params = new URLSearchParams({
|
|
10
|
+
token
|
|
11
|
+
});
|
|
12
|
+
return await apiRequest(`/invitations/preview?${params.toString()}`);
|
|
13
|
+
}
|
|
14
|
+
export function usePreviewInvitation(token) {
|
|
15
|
+
return useQuery({
|
|
16
|
+
queryKey: previewInvitationQueryKey(token ?? ''),
|
|
17
|
+
queryFn: ()=>previewInvitation(token),
|
|
18
|
+
enabled: Boolean(token),
|
|
19
|
+
retry: false,
|
|
20
|
+
staleTime: 30_000
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=preview-invitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/preview-invitation.ts"],"sourcesContent":["import type {PreviewInvitationResponseDto} from '@shipfox/api-workspaces-dto';\nimport {apiRequest} from '@shipfox/client-api';\nimport {useQuery} from '@tanstack/react-query';\n\nexport const previewInvitationQueryKey = (token: string) =>\n ['invitations', 'preview', token] as const;\n\nasync function previewInvitation(token: string): Promise<PreviewInvitationResponseDto> {\n const params = new URLSearchParams({token});\n return await apiRequest<PreviewInvitationResponseDto>(\n `/invitations/preview?${params.toString()}`,\n );\n}\n\nexport function usePreviewInvitation(token: string | undefined) {\n return useQuery({\n queryKey: previewInvitationQueryKey(token ?? ''),\n queryFn: () => previewInvitation(token as string),\n enabled: Boolean(token),\n retry: false,\n staleTime: 30_000,\n });\n}\n"],"names":["apiRequest","useQuery","previewInvitationQueryKey","token","previewInvitation","params","URLSearchParams","toString","usePreviewInvitation","queryKey","queryFn","enabled","Boolean","retry","staleTime"],"mappings":"AACA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,QAAQ,QAAO,wBAAwB;AAE/C,OAAO,MAAMC,4BAA4B,CAACC,QACxC;QAAC;QAAe;QAAWA;KAAM,CAAU;AAE7C,eAAeC,kBAAkBD,KAAa;IAC5C,MAAME,SAAS,IAAIC,gBAAgB;QAACH;IAAK;IACzC,OAAO,MAAMH,WACX,CAAC,qBAAqB,EAAEK,OAAOE,QAAQ,IAAI;AAE/C;AAEA,OAAO,SAASC,qBAAqBL,KAAyB;IAC5D,OAAOF,SAAS;QACdQ,UAAUP,0BAA0BC,SAAS;QAC7CO,SAAS,IAAMN,kBAAkBD;QACjCQ,SAASC,QAAQT;QACjBU,OAAO;QACPC,WAAW;IACb;AACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { completeInvitationAcceptance } from './complete-acceptance.js';
|
|
2
|
+
export { useAcceptInvitation } from './hooks/api/accept-invitation.js';
|
|
3
|
+
export { previewInvitationQueryKey, usePreviewInvitation, } from './hooks/api/preview-invitation.js';
|
|
4
|
+
export { InvitationAcceptPage } from './pages/invitation-accept-page.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,4BAA4B,EAAC,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AACrE,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,oBAAoB,EAAC,MAAM,mCAAmC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { completeInvitationAcceptance } from './complete-acceptance.js';
|
|
2
|
+
export { useAcceptInvitation } from './hooks/api/accept-invitation.js';
|
|
3
|
+
export { previewInvitationQueryKey, usePreviewInvitation } from './hooks/api/preview-invitation.js';
|
|
4
|
+
export { InvitationAcceptPage } from './pages/invitation-accept-page.js';
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {completeInvitationAcceptance} from './complete-acceptance.js';\nexport {useAcceptInvitation} from './hooks/api/accept-invitation.js';\nexport {\n previewInvitationQueryKey,\n usePreviewInvitation,\n} from './hooks/api/preview-invitation.js';\nexport {InvitationAcceptPage} from './pages/invitation-accept-page.js';\n"],"names":["completeInvitationAcceptance","useAcceptInvitation","previewInvitationQueryKey","usePreviewInvitation","InvitationAcceptPage"],"mappings":"AAAA,SAAQA,4BAA4B,QAAO,2BAA2B;AACtE,SAAQC,mBAAmB,QAAO,mCAAmC;AACrE,SACEC,yBAAyB,EACzBC,oBAAoB,QACf,oCAAoC;AAC3C,SAAQC,oBAAoB,QAAO,oCAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitation-accept-page.d.ts","sourceRoot":"","sources":["../../src/pages/invitation-accept-page.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,oBAAoB,uCAkPnC"}
|