@learnorama/mozaik-sdk 0.8.2-staging.31.1 → 0.9.0-staging.35.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/dist/api/account.d.ts +27 -28
- package/dist/api/account.js +41 -28
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +1 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-desk.d.ts +23 -1
- package/dist/api/admin-desk.js +59 -1
- package/dist/api/admin-desk.js.map +1 -1
- package/dist/api/admin-licenses.d.ts +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +1 -1
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +1 -1
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.d.ts +1 -1
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/auth.d.ts +11 -1
- package/dist/api/auth.js +31 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-library.d.ts +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +17 -1
- package/dist/api/biblio-press.js +49 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.d.ts +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.d.ts +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/consumption.d.ts +1 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +1 -1
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +1 -1
- package/dist/api/cvs-ils.js.map +1 -1
- package/dist/api/cvs-loans.d.ts +1 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +1 -1
- package/dist/api/cvs-payments.js.map +1 -1
- package/dist/api/cvs-streaming.d.ts +1 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +8 -8
- package/dist/api/index.js +8 -8
- package/dist/api/partner-catalogue.d.ts +20 -1
- package/dist/api/partner-catalogue.js +44 -1
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader.d.ts +34 -6
- package/dist/api/partner-reader.js +48 -6
- package/dist/api/partner-reader.js.map +1 -1
- package/dist/api/profiles.d.ts +86 -33
- package/dist/api/profiles.js +302 -33
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +1 -1
- package/dist/api/search.js.map +1 -1
- package/dist/api/tutoring-catalogue.d.ts +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +1 -1
- package/dist/api/tutoring-chat.js.map +1 -1
- package/dist/api/tutoring-dispatch.d.ts +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.d.ts +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/chunks/client2.d.ts +1 -1
- package/dist/chunks/connection.d.ts +1 -1
- package/dist/chunks/index.d.ts +1183 -347
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js +95 -2
- package/dist/models.js.map +1 -1
- package/dist/react/account.d.ts +81 -28
- package/dist/react/account.js +90 -29
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +1 -1
- package/dist/react/admin-catalogue.js +1 -1
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +1 -1
- package/dist/react/admin-consumption.js +1 -1
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-desk.d.ts +104 -1
- package/dist/react/admin-desk.js +132 -2
- package/dist/react/admin-desk.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +1 -1
- package/dist/react/admin-licenses.js +1 -1
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +1 -1
- package/dist/react/admin-patrons.js +1 -1
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +1 -1
- package/dist/react/admin-reviews.js +1 -1
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +1 -1
- package/dist/react/admin-roles.js +1 -1
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +1 -1
- package/dist/react/admin-support.js +1 -1
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +1 -1
- package/dist/react/admin-tenants.js +1 -1
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +1 -1
- package/dist/react/admin-tutoring.js +1 -1
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/auth.d.ts +29 -1
- package/dist/react/auth.js +60 -2
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +1 -1
- package/dist/react/biblio-catalogue.js +1 -1
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +1 -1
- package/dist/react/biblio-home.js +1 -1
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-library.d.ts +1 -1
- package/dist/react/biblio-library.js +1 -1
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +1 -1
- package/dist/react/biblio-nextory.js +1 -1
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +65 -3
- package/dist/react/biblio-press.js +104 -3
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +1 -1
- package/dist/react/biblio-search.js +1 -1
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +1 -1
- package/dist/react/biblio-telemetry.js +1 -1
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/chat.d.ts +1 -1
- package/dist/react/consumption.d.ts +1 -1
- package/dist/react/consumption.js +1 -1
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +1 -1
- package/dist/react/cvs-app.js +1 -1
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +1 -1
- package/dist/react/cvs-documents.js +1 -1
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +1 -1
- package/dist/react/cvs-favorites.js +1 -1
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +1 -1
- package/dist/react/cvs-ils.js +1 -1
- package/dist/react/cvs-ils.js.map +1 -1
- package/dist/react/cvs-loans.d.ts +1 -1
- package/dist/react/cvs-loans.js +1 -1
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +1 -1
- package/dist/react/cvs-payments.js +1 -1
- package/dist/react/cvs-payments.js.map +1 -1
- package/dist/react/cvs-streaming.d.ts +1 -1
- package/dist/react/cvs-streaming.js +1 -1
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +8 -8
- package/dist/react/index.js +8 -8
- package/dist/react/partner-catalogue.d.ts +74 -1
- package/dist/react/partner-catalogue.js +95 -2
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader.d.ts +79 -6
- package/dist/react/partner-reader.js +102 -7
- package/dist/react/partner-reader.js.map +1 -1
- package/dist/react/profiles.d.ts +406 -33
- package/dist/react/profiles.js +760 -59
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +1 -1
- package/dist/react/search.js +1 -1
- package/dist/react/search.js.map +1 -1
- package/dist/react/tutoring-catalogue.d.ts +1 -1
- package/dist/react/tutoring-catalogue.js +1 -1
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +1 -1
- package/dist/react/tutoring-chat.js +1 -1
- package/dist/react/tutoring-chat.js.map +1 -1
- package/dist/react/tutoring-dispatch.d.ts +1 -1
- package/dist/react/tutoring-dispatch.js +1 -1
- package/dist/react/tutoring-dispatch.js.map +1 -1
- package/dist/react/tutoring-practitioner.d.ts +1 -1
- package/dist/react/tutoring-practitioner.js +1 -1
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +1 -1
- package/dist/react/tutoring-requests.js +1 -1
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +7 -7
package/dist/react/profiles.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
|
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Mozaik backend
|
|
9
9
|
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.
|
|
10
|
+
* OpenAPI spec version: 0.9.0
|
|
11
11
|
*/
|
|
12
12
|
const withQueryKey = (query, queryKey) => {
|
|
13
13
|
const result = { queryKey };
|
|
@@ -21,30 +21,441 @@ const withQueryKey = (query, queryKey) => {
|
|
|
21
21
|
}
|
|
22
22
|
return result;
|
|
23
23
|
};
|
|
24
|
+
const getSetPinUrl = () => {
|
|
25
|
+
return `/me/guardian-pin`;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* @summary Set Pin
|
|
29
|
+
*/
|
|
30
|
+
const setPin = async (guardianPinWrite, options) => {
|
|
31
|
+
const getHeaders = (h) => {
|
|
32
|
+
if (!h) return {};
|
|
33
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
34
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
35
|
+
const headers = {};
|
|
36
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
37
|
+
return headers;
|
|
38
|
+
};
|
|
39
|
+
return request(getSetPinUrl(), {
|
|
40
|
+
...options,
|
|
41
|
+
method: "PUT",
|
|
42
|
+
headers: {
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
...getHeaders(options?.headers)
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify(guardianPinWrite)
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const getSetPinMutationKey = () => ["setPin"];
|
|
50
|
+
const getSetPinMutationOptions = (options) => {
|
|
51
|
+
const mutationKey = getSetPinMutationKey();
|
|
52
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
53
|
+
...options,
|
|
54
|
+
mutation: {
|
|
55
|
+
...options.mutation,
|
|
56
|
+
mutationKey
|
|
57
|
+
}
|
|
58
|
+
} : {
|
|
59
|
+
mutation: { mutationKey },
|
|
60
|
+
request: void 0
|
|
61
|
+
};
|
|
62
|
+
const mutationFn = (props) => {
|
|
63
|
+
const { data } = props ?? {};
|
|
64
|
+
return setPin(data, requestOptions);
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
mutationFn,
|
|
68
|
+
...mutationOptions
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @summary Set Pin
|
|
73
|
+
*/
|
|
74
|
+
const useSetPin = (options, queryClient) => {
|
|
75
|
+
return useMutation(getSetPinMutationOptions(options), queryClient);
|
|
76
|
+
};
|
|
77
|
+
const getRequestResetUrl = () => {
|
|
78
|
+
return `/me/guardian-pin/reset`;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* @summary Request Reset
|
|
82
|
+
*/
|
|
83
|
+
const requestReset = async (options) => {
|
|
84
|
+
return request(getRequestResetUrl(), {
|
|
85
|
+
...options,
|
|
86
|
+
method: "POST"
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const getRequestResetMutationKey = () => ["requestReset"];
|
|
90
|
+
const getRequestResetMutationOptions = (options) => {
|
|
91
|
+
const mutationKey = getRequestResetMutationKey();
|
|
92
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
93
|
+
...options,
|
|
94
|
+
mutation: {
|
|
95
|
+
...options.mutation,
|
|
96
|
+
mutationKey
|
|
97
|
+
}
|
|
98
|
+
} : {
|
|
99
|
+
mutation: { mutationKey },
|
|
100
|
+
request: void 0
|
|
101
|
+
};
|
|
102
|
+
const mutationFn = () => {
|
|
103
|
+
return requestReset(requestOptions);
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
mutationFn,
|
|
107
|
+
...mutationOptions
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* @summary Request Reset
|
|
112
|
+
*/
|
|
113
|
+
const useRequestReset = (options, queryClient) => {
|
|
114
|
+
return useMutation(getRequestResetMutationOptions(options), queryClient);
|
|
115
|
+
};
|
|
116
|
+
const getConfirmResetUrl = () => {
|
|
117
|
+
return `/me/guardian-pin/reset/confirm`;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @summary Confirm Reset
|
|
121
|
+
*/
|
|
122
|
+
const confirmReset = async (guardianPinResetWrite, options) => {
|
|
123
|
+
const getHeaders = (h) => {
|
|
124
|
+
if (!h) return {};
|
|
125
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
126
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
127
|
+
const headers = {};
|
|
128
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
129
|
+
return headers;
|
|
130
|
+
};
|
|
131
|
+
return request(getConfirmResetUrl(), {
|
|
132
|
+
...options,
|
|
133
|
+
method: "POST",
|
|
134
|
+
headers: {
|
|
135
|
+
"Content-Type": "application/json",
|
|
136
|
+
...getHeaders(options?.headers)
|
|
137
|
+
},
|
|
138
|
+
body: JSON.stringify(guardianPinResetWrite)
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const getConfirmResetMutationKey = () => ["confirmReset"];
|
|
142
|
+
const getConfirmResetMutationOptions = (options) => {
|
|
143
|
+
const mutationKey = getConfirmResetMutationKey();
|
|
144
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
145
|
+
...options,
|
|
146
|
+
mutation: {
|
|
147
|
+
...options.mutation,
|
|
148
|
+
mutationKey
|
|
149
|
+
}
|
|
150
|
+
} : {
|
|
151
|
+
mutation: { mutationKey },
|
|
152
|
+
request: void 0
|
|
153
|
+
};
|
|
154
|
+
const mutationFn = (props) => {
|
|
155
|
+
const { data } = props ?? {};
|
|
156
|
+
return confirmReset(data, requestOptions);
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
mutationFn,
|
|
160
|
+
...mutationOptions
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @summary Confirm Reset
|
|
165
|
+
*/
|
|
166
|
+
const useConfirmReset = (options, queryClient) => {
|
|
167
|
+
return useMutation(getConfirmResetMutationOptions(options), queryClient);
|
|
168
|
+
};
|
|
169
|
+
const getProfileSessionUrl = () => {
|
|
170
|
+
return `/me/profile-session`;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* @summary Profile Session
|
|
174
|
+
*/
|
|
175
|
+
const profileSession = async (options) => {
|
|
176
|
+
return request(getProfileSessionUrl(), {
|
|
177
|
+
...options,
|
|
178
|
+
method: "GET"
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
const getProfileSessionQueryKey = () => {
|
|
182
|
+
return [`/me/profile-session`];
|
|
183
|
+
};
|
|
184
|
+
const getProfileSessionQueryOptions = (options) => {
|
|
185
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
186
|
+
const queryKey = queryOptions?.queryKey ?? getProfileSessionQueryKey();
|
|
187
|
+
const queryFn = ({ signal }) => profileSession({
|
|
188
|
+
signal,
|
|
189
|
+
...requestOptions
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
queryKey,
|
|
193
|
+
queryFn,
|
|
194
|
+
...queryOptions
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* @summary Profile Session
|
|
199
|
+
*/
|
|
200
|
+
function useProfileSession(options, queryClient) {
|
|
201
|
+
const queryOptions = getProfileSessionQueryOptions(options);
|
|
202
|
+
const query = useQuery(queryOptions, queryClient);
|
|
203
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
204
|
+
}
|
|
205
|
+
const getOpenChildUrl = () => {
|
|
206
|
+
return `/me/profile-session/child`;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* @summary Open Child
|
|
210
|
+
*/
|
|
211
|
+
const openChild = async (openChildProfileWrite, options) => {
|
|
212
|
+
const getHeaders = (h) => {
|
|
213
|
+
if (!h) return {};
|
|
214
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
215
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
216
|
+
const headers = {};
|
|
217
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
218
|
+
return headers;
|
|
219
|
+
};
|
|
220
|
+
return request(getOpenChildUrl(), {
|
|
221
|
+
...options,
|
|
222
|
+
method: "POST",
|
|
223
|
+
headers: {
|
|
224
|
+
"Content-Type": "application/json",
|
|
225
|
+
...getHeaders(options?.headers)
|
|
226
|
+
},
|
|
227
|
+
body: JSON.stringify(openChildProfileWrite)
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
const getOpenChildMutationKey = () => ["openChild"];
|
|
231
|
+
const getOpenChildMutationOptions = (options) => {
|
|
232
|
+
const mutationKey = getOpenChildMutationKey();
|
|
233
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
234
|
+
...options,
|
|
235
|
+
mutation: {
|
|
236
|
+
...options.mutation,
|
|
237
|
+
mutationKey
|
|
238
|
+
}
|
|
239
|
+
} : {
|
|
240
|
+
mutation: { mutationKey },
|
|
241
|
+
request: void 0
|
|
242
|
+
};
|
|
243
|
+
const mutationFn = (props) => {
|
|
244
|
+
const { data } = props ?? {};
|
|
245
|
+
return openChild(data, requestOptions);
|
|
246
|
+
};
|
|
247
|
+
return {
|
|
248
|
+
mutationFn,
|
|
249
|
+
...mutationOptions
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* @summary Open Child
|
|
254
|
+
*/
|
|
255
|
+
const useOpenChild = (options, queryClient) => {
|
|
256
|
+
return useMutation(getOpenChildMutationOptions(options), queryClient);
|
|
257
|
+
};
|
|
258
|
+
const getExitChildUrl = () => {
|
|
259
|
+
return `/me/profile-session/exit`;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* @summary Exit Child
|
|
263
|
+
*/
|
|
264
|
+
const exitChild = async (exitChildProfileWrite, options) => {
|
|
265
|
+
const getHeaders = (h) => {
|
|
266
|
+
if (!h) return {};
|
|
267
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
268
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
269
|
+
const headers = {};
|
|
270
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
271
|
+
return headers;
|
|
272
|
+
};
|
|
273
|
+
return request(getExitChildUrl(), {
|
|
274
|
+
...options,
|
|
275
|
+
method: "POST",
|
|
276
|
+
headers: {
|
|
277
|
+
"Content-Type": "application/json",
|
|
278
|
+
...getHeaders(options?.headers)
|
|
279
|
+
},
|
|
280
|
+
body: JSON.stringify(exitChildProfileWrite)
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
const getExitChildMutationKey = () => ["exitChild"];
|
|
284
|
+
const getExitChildMutationOptions = (options) => {
|
|
285
|
+
const mutationKey = getExitChildMutationKey();
|
|
286
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
287
|
+
...options,
|
|
288
|
+
mutation: {
|
|
289
|
+
...options.mutation,
|
|
290
|
+
mutationKey
|
|
291
|
+
}
|
|
292
|
+
} : {
|
|
293
|
+
mutation: { mutationKey },
|
|
294
|
+
request: void 0
|
|
295
|
+
};
|
|
296
|
+
const mutationFn = (props) => {
|
|
297
|
+
const { data } = props ?? {};
|
|
298
|
+
return exitChild(data, requestOptions);
|
|
299
|
+
};
|
|
300
|
+
return {
|
|
301
|
+
mutationFn,
|
|
302
|
+
...mutationOptions
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* @summary Exit Child
|
|
307
|
+
*/
|
|
308
|
+
const useExitChild = (options, queryClient) => {
|
|
309
|
+
return useMutation(getExitChildMutationOptions(options), queryClient);
|
|
310
|
+
};
|
|
24
311
|
const getListProfilesUrl = () => {
|
|
25
312
|
return `/me/profiles`;
|
|
26
313
|
};
|
|
27
314
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
315
|
+
* Holder sees household cards; another adult sees self and supervised children.
|
|
316
|
+
*
|
|
317
|
+
* Cards never grant the right to open another adult's profile. Expired pending
|
|
318
|
+
* invitations remain manageable but no longer reserve capacity.
|
|
319
|
+
* @summary List Profiles
|
|
320
|
+
*/
|
|
321
|
+
const listProfiles = async (options) => {
|
|
322
|
+
return request(getListProfilesUrl(), {
|
|
323
|
+
...options,
|
|
324
|
+
method: "GET"
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
const getListProfilesQueryKey = () => {
|
|
328
|
+
return [`/me/profiles`];
|
|
329
|
+
};
|
|
330
|
+
const getListProfilesQueryOptions = (options) => {
|
|
331
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
332
|
+
const queryKey = queryOptions?.queryKey ?? getListProfilesQueryKey();
|
|
333
|
+
const queryFn = ({ signal }) => listProfiles({
|
|
334
|
+
signal,
|
|
335
|
+
...requestOptions
|
|
336
|
+
});
|
|
337
|
+
return {
|
|
338
|
+
queryKey,
|
|
339
|
+
queryFn,
|
|
340
|
+
...queryOptions
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* @summary List Profiles
|
|
345
|
+
*/
|
|
346
|
+
function useListProfiles(options, queryClient) {
|
|
347
|
+
const queryOptions = getListProfilesQueryOptions(options);
|
|
348
|
+
const query = useQuery(queryOptions, queryClient);
|
|
349
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
350
|
+
}
|
|
351
|
+
const getCreateProfileUrl = () => {
|
|
352
|
+
return `/me/profiles`;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* @summary Create Profile
|
|
356
|
+
*/
|
|
357
|
+
const createProfile = async (profileCreateWrite, options) => {
|
|
358
|
+
const getHeaders = (h) => {
|
|
359
|
+
if (!h) return {};
|
|
360
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
361
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
362
|
+
const headers = {};
|
|
363
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
364
|
+
return headers;
|
|
365
|
+
};
|
|
366
|
+
return request(getCreateProfileUrl(), {
|
|
367
|
+
...options,
|
|
368
|
+
method: "POST",
|
|
369
|
+
headers: {
|
|
370
|
+
"Content-Type": "application/json",
|
|
371
|
+
...getHeaders(options?.headers)
|
|
372
|
+
},
|
|
373
|
+
body: JSON.stringify(profileCreateWrite)
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
const getCreateProfileMutationKey = () => ["createProfile"];
|
|
377
|
+
const getCreateProfileMutationOptions = (options) => {
|
|
378
|
+
const mutationKey = getCreateProfileMutationKey();
|
|
379
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
380
|
+
...options,
|
|
381
|
+
mutation: {
|
|
382
|
+
...options.mutation,
|
|
383
|
+
mutationKey
|
|
384
|
+
}
|
|
385
|
+
} : {
|
|
386
|
+
mutation: { mutationKey },
|
|
387
|
+
request: void 0
|
|
388
|
+
};
|
|
389
|
+
const mutationFn = (props) => {
|
|
390
|
+
const { data } = props ?? {};
|
|
391
|
+
return createProfile(data, requestOptions);
|
|
392
|
+
};
|
|
393
|
+
return {
|
|
394
|
+
mutationFn,
|
|
395
|
+
...mutationOptions
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* @summary Create Profile
|
|
400
|
+
*/
|
|
401
|
+
const useCreateProfile = (options, queryClient) => {
|
|
402
|
+
return useMutation(getCreateProfileMutationOptions(options), queryClient);
|
|
403
|
+
};
|
|
404
|
+
const getGuardianCandidatesUrl = () => {
|
|
405
|
+
return `/me/profiles/guardian-candidates`;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* @summary Guardian Candidates
|
|
409
|
+
*/
|
|
410
|
+
const guardianCandidates = async (options) => {
|
|
411
|
+
return request(getGuardianCandidatesUrl(), {
|
|
412
|
+
...options,
|
|
413
|
+
method: "GET"
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
const getGuardianCandidatesQueryKey = () => {
|
|
417
|
+
return [`/me/profiles/guardian-candidates`];
|
|
418
|
+
};
|
|
419
|
+
const getGuardianCandidatesQueryOptions = (options) => {
|
|
420
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
421
|
+
const queryKey = queryOptions?.queryKey ?? getGuardianCandidatesQueryKey();
|
|
422
|
+
const queryFn = ({ signal }) => guardianCandidates({
|
|
423
|
+
signal,
|
|
424
|
+
...requestOptions
|
|
425
|
+
});
|
|
426
|
+
return {
|
|
427
|
+
queryKey,
|
|
428
|
+
queryFn,
|
|
429
|
+
...queryOptions
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* @summary Guardian Candidates
|
|
434
|
+
*/
|
|
435
|
+
function useGuardianCandidates(options, queryClient) {
|
|
436
|
+
const queryOptions = getGuardianCandidatesQueryOptions(options);
|
|
437
|
+
const query = useQuery(queryOptions, queryClient);
|
|
438
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
439
|
+
}
|
|
440
|
+
const getListInvitationsUrl = () => {
|
|
441
|
+
return `/me/profiles/invitations`;
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* @summary List Invitations
|
|
34
445
|
*/
|
|
35
|
-
const
|
|
36
|
-
return request(
|
|
446
|
+
const listInvitations = async (options) => {
|
|
447
|
+
return request(getListInvitationsUrl(), {
|
|
37
448
|
...options,
|
|
38
449
|
method: "GET"
|
|
39
450
|
});
|
|
40
451
|
};
|
|
41
|
-
const
|
|
42
|
-
return [`/me/profiles`];
|
|
452
|
+
const getListInvitationsQueryKey = () => {
|
|
453
|
+
return [`/me/profiles/invitations`];
|
|
43
454
|
};
|
|
44
|
-
const
|
|
455
|
+
const getListInvitationsQueryOptions = (options) => {
|
|
45
456
|
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
46
|
-
const queryKey = queryOptions?.queryKey ??
|
|
47
|
-
const queryFn = ({ signal }) =>
|
|
457
|
+
const queryKey = queryOptions?.queryKey ?? getListInvitationsQueryKey();
|
|
458
|
+
const queryFn = ({ signal }) => listInvitations({
|
|
48
459
|
signal,
|
|
49
460
|
...requestOptions
|
|
50
461
|
});
|
|
@@ -55,29 +466,20 @@ const getListProfilesQueryOptions = (options) => {
|
|
|
55
466
|
};
|
|
56
467
|
};
|
|
57
468
|
/**
|
|
58
|
-
* @summary List
|
|
469
|
+
* @summary List Invitations
|
|
59
470
|
*/
|
|
60
|
-
function
|
|
61
|
-
const queryOptions =
|
|
471
|
+
function useListInvitations(options, queryClient) {
|
|
472
|
+
const queryOptions = getListInvitationsQueryOptions(options);
|
|
62
473
|
const query = useQuery(queryOptions, queryClient);
|
|
63
474
|
return withQueryKey(query, queryOptions.queryKey);
|
|
64
475
|
}
|
|
65
|
-
const
|
|
66
|
-
return `/me/profiles`;
|
|
476
|
+
const getInviteAdultUrl = () => {
|
|
477
|
+
return `/me/profiles/invitations`;
|
|
67
478
|
};
|
|
68
479
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* The new row inherits ``tenant_id`` from the holder rather than accepting one:
|
|
72
|
-
* a profile belongs to the same company as the account it hangs off, and
|
|
73
|
-
* letting that be supplied would be a way into another tenant.
|
|
74
|
-
*
|
|
75
|
-
* A profile has no credential of its own. It has no ``login``, no ``email`` and
|
|
76
|
-
* no password — it is reached by switching within an authenticated session, so
|
|
77
|
-
* there is nothing for it to authenticate *with*.
|
|
78
|
-
* @summary Create Profile
|
|
480
|
+
* @summary Invite Adult
|
|
79
481
|
*/
|
|
80
|
-
const
|
|
482
|
+
const inviteAdult = async (householdInvitationWrite, options) => {
|
|
81
483
|
const getHeaders = (h) => {
|
|
82
484
|
if (!h) return {};
|
|
83
485
|
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
@@ -86,19 +488,19 @@ const createProfile = async (profileCreateWrite, options) => {
|
|
|
86
488
|
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
87
489
|
return headers;
|
|
88
490
|
};
|
|
89
|
-
return request(
|
|
491
|
+
return request(getInviteAdultUrl(), {
|
|
90
492
|
...options,
|
|
91
493
|
method: "POST",
|
|
92
494
|
headers: {
|
|
93
495
|
"Content-Type": "application/json",
|
|
94
496
|
...getHeaders(options?.headers)
|
|
95
497
|
},
|
|
96
|
-
body: JSON.stringify(
|
|
498
|
+
body: JSON.stringify(householdInvitationWrite)
|
|
97
499
|
});
|
|
98
500
|
};
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const mutationKey =
|
|
501
|
+
const getInviteAdultMutationKey = () => ["inviteAdult"];
|
|
502
|
+
const getInviteAdultMutationOptions = (options) => {
|
|
503
|
+
const mutationKey = getInviteAdultMutationKey();
|
|
102
504
|
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
103
505
|
...options,
|
|
104
506
|
mutation: {
|
|
@@ -111,7 +513,7 @@ const getCreateProfileMutationOptions = (options) => {
|
|
|
111
513
|
};
|
|
112
514
|
const mutationFn = (props) => {
|
|
113
515
|
const { data } = props ?? {};
|
|
114
|
-
return
|
|
516
|
+
return inviteAdult(data, requestOptions);
|
|
115
517
|
};
|
|
116
518
|
return {
|
|
117
519
|
mutationFn,
|
|
@@ -119,23 +521,150 @@ const getCreateProfileMutationOptions = (options) => {
|
|
|
119
521
|
};
|
|
120
522
|
};
|
|
121
523
|
/**
|
|
122
|
-
* @summary
|
|
524
|
+
* @summary Invite Adult
|
|
123
525
|
*/
|
|
124
|
-
const
|
|
125
|
-
return useMutation(
|
|
526
|
+
const useInviteAdult = (options, queryClient) => {
|
|
527
|
+
return useMutation(getInviteAdultMutationOptions(options), queryClient);
|
|
528
|
+
};
|
|
529
|
+
const getAcceptInvitationUrl = () => {
|
|
530
|
+
return `/me/profiles/invitations/accept`;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* Requires a verified login email; never creates an unrelated root account.
|
|
534
|
+
* @summary Accept Invitation
|
|
535
|
+
*/
|
|
536
|
+
const acceptInvitation = async (householdInvitationAcceptWrite, options) => {
|
|
537
|
+
const getHeaders = (h) => {
|
|
538
|
+
if (!h) return {};
|
|
539
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
540
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
541
|
+
const headers = {};
|
|
542
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
543
|
+
return headers;
|
|
544
|
+
};
|
|
545
|
+
return request(getAcceptInvitationUrl(), {
|
|
546
|
+
...options,
|
|
547
|
+
method: "POST",
|
|
548
|
+
headers: {
|
|
549
|
+
"Content-Type": "application/json",
|
|
550
|
+
...getHeaders(options?.headers)
|
|
551
|
+
},
|
|
552
|
+
body: JSON.stringify(householdInvitationAcceptWrite)
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
const getAcceptInvitationMutationKey = () => ["acceptInvitation"];
|
|
556
|
+
const getAcceptInvitationMutationOptions = (options) => {
|
|
557
|
+
const mutationKey = getAcceptInvitationMutationKey();
|
|
558
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
559
|
+
...options,
|
|
560
|
+
mutation: {
|
|
561
|
+
...options.mutation,
|
|
562
|
+
mutationKey
|
|
563
|
+
}
|
|
564
|
+
} : {
|
|
565
|
+
mutation: { mutationKey },
|
|
566
|
+
request: void 0
|
|
567
|
+
};
|
|
568
|
+
const mutationFn = (props) => {
|
|
569
|
+
const { data } = props ?? {};
|
|
570
|
+
return acceptInvitation(data, requestOptions);
|
|
571
|
+
};
|
|
572
|
+
return {
|
|
573
|
+
mutationFn,
|
|
574
|
+
...mutationOptions
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* @summary Accept Invitation
|
|
579
|
+
*/
|
|
580
|
+
const useAcceptInvitation = (options, queryClient) => {
|
|
581
|
+
return useMutation(getAcceptInvitationMutationOptions(options), queryClient);
|
|
582
|
+
};
|
|
583
|
+
const getRevokeInvitationUrl = (invitationId) => {
|
|
584
|
+
return `/me/profiles/invitations/${invitationId}`;
|
|
585
|
+
};
|
|
586
|
+
/**
|
|
587
|
+
* @summary Revoke Invitation
|
|
588
|
+
*/
|
|
589
|
+
const revokeInvitation = async (invitationId, options) => {
|
|
590
|
+
return request(getRevokeInvitationUrl(invitationId), {
|
|
591
|
+
...options,
|
|
592
|
+
method: "DELETE"
|
|
593
|
+
});
|
|
594
|
+
};
|
|
595
|
+
const getRevokeInvitationMutationKey = () => ["revokeInvitation"];
|
|
596
|
+
const getRevokeInvitationMutationOptions = (options) => {
|
|
597
|
+
const mutationKey = getRevokeInvitationMutationKey();
|
|
598
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
599
|
+
...options,
|
|
600
|
+
mutation: {
|
|
601
|
+
...options.mutation,
|
|
602
|
+
mutationKey
|
|
603
|
+
}
|
|
604
|
+
} : {
|
|
605
|
+
mutation: { mutationKey },
|
|
606
|
+
request: void 0
|
|
607
|
+
};
|
|
608
|
+
const mutationFn = (props) => {
|
|
609
|
+
const { invitationId } = props ?? {};
|
|
610
|
+
return revokeInvitation(invitationId, requestOptions);
|
|
611
|
+
};
|
|
612
|
+
return {
|
|
613
|
+
mutationFn,
|
|
614
|
+
...mutationOptions
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
/**
|
|
618
|
+
* @summary Revoke Invitation
|
|
619
|
+
*/
|
|
620
|
+
const useRevokeInvitation = (options, queryClient) => {
|
|
621
|
+
return useMutation(getRevokeInvitationMutationOptions(options), queryClient);
|
|
622
|
+
};
|
|
623
|
+
const getResendInvitationUrl = (invitationId) => {
|
|
624
|
+
return `/me/profiles/invitations/${invitationId}/resend`;
|
|
625
|
+
};
|
|
626
|
+
/**
|
|
627
|
+
* @summary Resend Invitation
|
|
628
|
+
*/
|
|
629
|
+
const resendInvitation = async (invitationId, options) => {
|
|
630
|
+
return request(getResendInvitationUrl(invitationId), {
|
|
631
|
+
...options,
|
|
632
|
+
method: "POST"
|
|
633
|
+
});
|
|
634
|
+
};
|
|
635
|
+
const getResendInvitationMutationKey = () => ["resendInvitation"];
|
|
636
|
+
const getResendInvitationMutationOptions = (options) => {
|
|
637
|
+
const mutationKey = getResendInvitationMutationKey();
|
|
638
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
639
|
+
...options,
|
|
640
|
+
mutation: {
|
|
641
|
+
...options.mutation,
|
|
642
|
+
mutationKey
|
|
643
|
+
}
|
|
644
|
+
} : {
|
|
645
|
+
mutation: { mutationKey },
|
|
646
|
+
request: void 0
|
|
647
|
+
};
|
|
648
|
+
const mutationFn = (props) => {
|
|
649
|
+
const { invitationId } = props ?? {};
|
|
650
|
+
return resendInvitation(invitationId, requestOptions);
|
|
651
|
+
};
|
|
652
|
+
return {
|
|
653
|
+
mutationFn,
|
|
654
|
+
...mutationOptions
|
|
655
|
+
};
|
|
656
|
+
};
|
|
657
|
+
/**
|
|
658
|
+
* @summary Resend Invitation
|
|
659
|
+
*/
|
|
660
|
+
const useResendInvitation = (options, queryClient) => {
|
|
661
|
+
return useMutation(getResendInvitationMutationOptions(options), queryClient);
|
|
126
662
|
};
|
|
127
663
|
const getDeleteProfileUrl = (profileId) => {
|
|
128
664
|
return `/me/profiles/${profileId}`;
|
|
129
665
|
};
|
|
130
666
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* Deleting a profile that is already gone is ``204``, not ``404``: the caller
|
|
134
|
-
* asked for it to be absent and it is absent. A retried delete after a timeout
|
|
135
|
-
* must not read as a failure.
|
|
136
|
-
*
|
|
137
|
-
* The account holder cannot be deleted this way — that is E17, which anonymises
|
|
138
|
-
* the whole account and is a different decision with different consequences.
|
|
667
|
+
* Deactivate membership without discarding profile history or its ancestry.
|
|
139
668
|
* @summary Delete Profile
|
|
140
669
|
*/
|
|
141
670
|
const deleteProfile = async (profileId, options) => {
|
|
@@ -176,7 +705,6 @@ const getReadProfileUrl = (profileId) => {
|
|
|
176
705
|
return `/me/profiles/${profileId}`;
|
|
177
706
|
};
|
|
178
707
|
/**
|
|
179
|
-
* One profile (E22). Returns the resource; the legacy rendered an edit form.
|
|
180
708
|
* @summary Read Profile
|
|
181
709
|
*/
|
|
182
710
|
const readProfile = async (profileId, options) => {
|
|
@@ -214,16 +742,6 @@ const getUpdateProfileUrl = (profileId) => {
|
|
|
214
742
|
return `/me/profiles/${profileId}`;
|
|
215
743
|
};
|
|
216
744
|
/**
|
|
217
|
-
* Partially update a profile (E23).
|
|
218
|
-
*
|
|
219
|
-
* The target comes from the path and the row is re-read from the database
|
|
220
|
-
* before anything is written, so nothing in the body can retarget the write.
|
|
221
|
-
* That is the one habit worth keeping from the legacy handler, which overwrote
|
|
222
|
-
* the identity fields from the trusted record for exactly this reason.
|
|
223
|
-
*
|
|
224
|
-
* ``exclude_unset`` is what makes this a PATCH rather than a PUT wearing the
|
|
225
|
-
* wrong verb: a field the client did not send is untouched, which is not the
|
|
226
|
-
* same as a field it sent as null.
|
|
227
745
|
* @summary Update Profile
|
|
228
746
|
*/
|
|
229
747
|
const updateProfile = async (profileId, profileUpdateWrite, options) => {
|
|
@@ -273,7 +791,190 @@ const getUpdateProfileMutationOptions = (options) => {
|
|
|
273
791
|
const useUpdateProfile = (options, queryClient) => {
|
|
274
792
|
return useMutation(getUpdateProfileMutationOptions(options), queryClient);
|
|
275
793
|
};
|
|
794
|
+
const getListGuardiansUrl = (profileId) => {
|
|
795
|
+
return `/me/profiles/${profileId}/guardians`;
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* @summary List Guardians
|
|
799
|
+
*/
|
|
800
|
+
const listGuardians = async (profileId, options) => {
|
|
801
|
+
return request(getListGuardiansUrl(profileId), {
|
|
802
|
+
...options,
|
|
803
|
+
method: "GET"
|
|
804
|
+
});
|
|
805
|
+
};
|
|
806
|
+
const getListGuardiansQueryKey = (profileId) => {
|
|
807
|
+
return [`/me/profiles/${profileId}/guardians`];
|
|
808
|
+
};
|
|
809
|
+
const getListGuardiansQueryOptions = (profileId, options) => {
|
|
810
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
811
|
+
const queryKey = queryOptions?.queryKey ?? getListGuardiansQueryKey(profileId);
|
|
812
|
+
const queryFn = ({ signal }) => listGuardians(profileId, {
|
|
813
|
+
signal,
|
|
814
|
+
...requestOptions
|
|
815
|
+
});
|
|
816
|
+
return {
|
|
817
|
+
queryKey,
|
|
818
|
+
queryFn,
|
|
819
|
+
enabled: profileId !== null && profileId !== void 0,
|
|
820
|
+
...queryOptions
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
/**
|
|
824
|
+
* @summary List Guardians
|
|
825
|
+
*/
|
|
826
|
+
function useListGuardians(profileId, options, queryClient) {
|
|
827
|
+
const queryOptions = getListGuardiansQueryOptions(profileId, options);
|
|
828
|
+
const query = useQuery(queryOptions, queryClient);
|
|
829
|
+
return withQueryKey(query, queryOptions.queryKey);
|
|
830
|
+
}
|
|
831
|
+
const getAddGuardianUrl = (profileId) => {
|
|
832
|
+
return `/me/profiles/${profileId}/guardians`;
|
|
833
|
+
};
|
|
834
|
+
/**
|
|
835
|
+
* @summary Add Guardian
|
|
836
|
+
*/
|
|
837
|
+
const addGuardian = async (profileId, householdGuardianWrite, options) => {
|
|
838
|
+
const getHeaders = (h) => {
|
|
839
|
+
if (!h) return {};
|
|
840
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
841
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
842
|
+
const headers = {};
|
|
843
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
844
|
+
return headers;
|
|
845
|
+
};
|
|
846
|
+
return request(getAddGuardianUrl(profileId), {
|
|
847
|
+
...options,
|
|
848
|
+
method: "POST",
|
|
849
|
+
headers: {
|
|
850
|
+
"Content-Type": "application/json",
|
|
851
|
+
...getHeaders(options?.headers)
|
|
852
|
+
},
|
|
853
|
+
body: JSON.stringify(householdGuardianWrite)
|
|
854
|
+
});
|
|
855
|
+
};
|
|
856
|
+
const getAddGuardianMutationKey = () => ["addGuardian"];
|
|
857
|
+
const getAddGuardianMutationOptions = (options) => {
|
|
858
|
+
const mutationKey = getAddGuardianMutationKey();
|
|
859
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
860
|
+
...options,
|
|
861
|
+
mutation: {
|
|
862
|
+
...options.mutation,
|
|
863
|
+
mutationKey
|
|
864
|
+
}
|
|
865
|
+
} : {
|
|
866
|
+
mutation: { mutationKey },
|
|
867
|
+
request: void 0
|
|
868
|
+
};
|
|
869
|
+
const mutationFn = (props) => {
|
|
870
|
+
const { profileId, data } = props ?? {};
|
|
871
|
+
return addGuardian(profileId, data, requestOptions);
|
|
872
|
+
};
|
|
873
|
+
return {
|
|
874
|
+
mutationFn,
|
|
875
|
+
...mutationOptions
|
|
876
|
+
};
|
|
877
|
+
};
|
|
878
|
+
/**
|
|
879
|
+
* @summary Add Guardian
|
|
880
|
+
*/
|
|
881
|
+
const useAddGuardian = (options, queryClient) => {
|
|
882
|
+
return useMutation(getAddGuardianMutationOptions(options), queryClient);
|
|
883
|
+
};
|
|
884
|
+
const getRemoveGuardianUrl = (profileId, adultId) => {
|
|
885
|
+
return `/me/profiles/${profileId}/guardians/${adultId}`;
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* @summary Remove Guardian
|
|
889
|
+
*/
|
|
890
|
+
const removeGuardian = async (profileId, adultId, options) => {
|
|
891
|
+
return request(getRemoveGuardianUrl(profileId, adultId), {
|
|
892
|
+
...options,
|
|
893
|
+
method: "DELETE"
|
|
894
|
+
});
|
|
895
|
+
};
|
|
896
|
+
const getRemoveGuardianMutationKey = () => ["removeGuardian"];
|
|
897
|
+
const getRemoveGuardianMutationOptions = (options) => {
|
|
898
|
+
const mutationKey = getRemoveGuardianMutationKey();
|
|
899
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
900
|
+
...options,
|
|
901
|
+
mutation: {
|
|
902
|
+
...options.mutation,
|
|
903
|
+
mutationKey
|
|
904
|
+
}
|
|
905
|
+
} : {
|
|
906
|
+
mutation: { mutationKey },
|
|
907
|
+
request: void 0
|
|
908
|
+
};
|
|
909
|
+
const mutationFn = (props) => {
|
|
910
|
+
const { profileId, adultId } = props ?? {};
|
|
911
|
+
return removeGuardian(profileId, adultId, requestOptions);
|
|
912
|
+
};
|
|
913
|
+
return {
|
|
914
|
+
mutationFn,
|
|
915
|
+
...mutationOptions
|
|
916
|
+
};
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* @summary Remove Guardian
|
|
920
|
+
*/
|
|
921
|
+
const useRemoveGuardian = (options, queryClient) => {
|
|
922
|
+
return useMutation(getRemoveGuardianMutationOptions(options), queryClient);
|
|
923
|
+
};
|
|
924
|
+
const getInviteIndependentMinorUrl = (profileId) => {
|
|
925
|
+
return `/me/profiles/${profileId}/independent-invitation`;
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* @summary Invite Independent Minor
|
|
929
|
+
*/
|
|
930
|
+
const inviteIndependentMinor = async (profileId, independentInvitationWrite, options) => {
|
|
931
|
+
const getHeaders = (h) => {
|
|
932
|
+
if (!h) return {};
|
|
933
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
934
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
935
|
+
const headers = {};
|
|
936
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
937
|
+
return headers;
|
|
938
|
+
};
|
|
939
|
+
return request(getInviteIndependentMinorUrl(profileId), {
|
|
940
|
+
...options,
|
|
941
|
+
method: "POST",
|
|
942
|
+
headers: {
|
|
943
|
+
"Content-Type": "application/json",
|
|
944
|
+
...getHeaders(options?.headers)
|
|
945
|
+
},
|
|
946
|
+
body: JSON.stringify(independentInvitationWrite)
|
|
947
|
+
});
|
|
948
|
+
};
|
|
949
|
+
const getInviteIndependentMinorMutationKey = () => ["inviteIndependentMinor"];
|
|
950
|
+
const getInviteIndependentMinorMutationOptions = (options) => {
|
|
951
|
+
const mutationKey = getInviteIndependentMinorMutationKey();
|
|
952
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
953
|
+
...options,
|
|
954
|
+
mutation: {
|
|
955
|
+
...options.mutation,
|
|
956
|
+
mutationKey
|
|
957
|
+
}
|
|
958
|
+
} : {
|
|
959
|
+
mutation: { mutationKey },
|
|
960
|
+
request: void 0
|
|
961
|
+
};
|
|
962
|
+
const mutationFn = (props) => {
|
|
963
|
+
const { profileId, data } = props ?? {};
|
|
964
|
+
return inviteIndependentMinor(profileId, data, requestOptions);
|
|
965
|
+
};
|
|
966
|
+
return {
|
|
967
|
+
mutationFn,
|
|
968
|
+
...mutationOptions
|
|
969
|
+
};
|
|
970
|
+
};
|
|
971
|
+
/**
|
|
972
|
+
* @summary Invite Independent Minor
|
|
973
|
+
*/
|
|
974
|
+
const useInviteIndependentMinor = (options, queryClient) => {
|
|
975
|
+
return useMutation(getInviteIndependentMinorMutationOptions(options), queryClient);
|
|
976
|
+
};
|
|
276
977
|
//#endregion
|
|
277
|
-
export { createProfile, deleteProfile, getCreateProfileMutationKey, getCreateProfileMutationOptions, getCreateProfileUrl, getDeleteProfileMutationKey, getDeleteProfileMutationOptions, getDeleteProfileUrl, getListProfilesQueryKey, getListProfilesQueryOptions, getListProfilesUrl, getReadProfileQueryKey, getReadProfileQueryOptions, getReadProfileUrl, getUpdateProfileMutationKey, getUpdateProfileMutationOptions, getUpdateProfileUrl, listProfiles, readProfile, updateProfile, useCreateProfile, useDeleteProfile, useListProfiles, useReadProfile, useUpdateProfile };
|
|
978
|
+
export { acceptInvitation, addGuardian, confirmReset, createProfile, deleteProfile, exitChild, getAcceptInvitationMutationKey, getAcceptInvitationMutationOptions, getAcceptInvitationUrl, getAddGuardianMutationKey, getAddGuardianMutationOptions, getAddGuardianUrl, getConfirmResetMutationKey, getConfirmResetMutationOptions, getConfirmResetUrl, getCreateProfileMutationKey, getCreateProfileMutationOptions, getCreateProfileUrl, getDeleteProfileMutationKey, getDeleteProfileMutationOptions, getDeleteProfileUrl, getExitChildMutationKey, getExitChildMutationOptions, getExitChildUrl, getGuardianCandidatesQueryKey, getGuardianCandidatesQueryOptions, getGuardianCandidatesUrl, getInviteAdultMutationKey, getInviteAdultMutationOptions, getInviteAdultUrl, getInviteIndependentMinorMutationKey, getInviteIndependentMinorMutationOptions, getInviteIndependentMinorUrl, getListGuardiansQueryKey, getListGuardiansQueryOptions, getListGuardiansUrl, getListInvitationsQueryKey, getListInvitationsQueryOptions, getListInvitationsUrl, getListProfilesQueryKey, getListProfilesQueryOptions, getListProfilesUrl, getOpenChildMutationKey, getOpenChildMutationOptions, getOpenChildUrl, getProfileSessionQueryKey, getProfileSessionQueryOptions, getProfileSessionUrl, getReadProfileQueryKey, getReadProfileQueryOptions, getReadProfileUrl, getRemoveGuardianMutationKey, getRemoveGuardianMutationOptions, getRemoveGuardianUrl, getRequestResetMutationKey, getRequestResetMutationOptions, getRequestResetUrl, getResendInvitationMutationKey, getResendInvitationMutationOptions, getResendInvitationUrl, getRevokeInvitationMutationKey, getRevokeInvitationMutationOptions, getRevokeInvitationUrl, getSetPinMutationKey, getSetPinMutationOptions, getSetPinUrl, getUpdateProfileMutationKey, getUpdateProfileMutationOptions, getUpdateProfileUrl, guardianCandidates, inviteAdult, inviteIndependentMinor, listGuardians, listInvitations, listProfiles, openChild, profileSession, readProfile, removeGuardian, requestReset, resendInvitation, revokeInvitation, setPin, updateProfile, useAcceptInvitation, useAddGuardian, useConfirmReset, useCreateProfile, useDeleteProfile, useExitChild, useGuardianCandidates, useInviteAdult, useInviteIndependentMinor, useListGuardians, useListInvitations, useListProfiles, useOpenChild, useProfileSession, useReadProfile, useRemoveGuardian, useRequestReset, useResendInvitation, useRevokeInvitation, useSetPin, useUpdateProfile };
|
|
278
979
|
|
|
279
980
|
//# sourceMappingURL=profiles.js.map
|