@contember/react-client-tenant 2.0.0-alpha.25 → 2.0.0-alpha.26
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/development/index.cjs +6 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +6 -0
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.cjs +29 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.js +12 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.js.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.cjs +29 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.js +12 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.js.map +1 -0
- package/dist/development/src/hooks/useFetchIdentity.cjs +1 -0
- package/dist/development/src/hooks/useFetchIdentity.cjs.map +1 -1
- package/dist/development/src/hooks/useFetchIdentity.js +1 -0
- package/dist/development/src/hooks/useFetchIdentity.js.map +1 -1
- package/dist/production/index.cjs +6 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +6 -0
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.cjs +29 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.js +12 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.js.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.cjs +29 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.js +12 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.js.map +1 -0
- package/dist/production/src/hooks/useFetchIdentity.cjs +1 -0
- package/dist/production/src/hooks/useFetchIdentity.cjs.map +1 -1
- package/dist/production/src/hooks/useFetchIdentity.js +1 -0
- package/dist/production/src/hooks/useFetchIdentity.js.map +1 -1
- package/dist/types/hooks/mutations/index.d.ts +1 -0
- package/dist/types/hooks/mutations/index.d.ts.map +1 -1
- package/dist/types/hooks/mutations/profile/index.d.ts +3 -0
- package/dist/types/hooks/mutations/profile/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/useChangeMyProfile.d.ts +21 -0
- package/dist/types/hooks/mutations/profile/useChangeMyProfile.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/useChangeProfile.d.ts +23 -0
- package/dist/types/hooks/mutations/profile/useChangeProfile.d.ts.map +1 -0
- package/dist/types/hooks/useFetchIdentity.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/Identity.d.ts +1 -0
- package/dist/types/types/Identity.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/hooks/mutations/index.ts +1 -0
- package/src/hooks/mutations/profile/index.ts +2 -0
- package/src/hooks/mutations/profile/useChangeMyProfile.ts +13 -0
- package/src/hooks/mutations/profile/useChangeProfile.ts +13 -0
- package/src/hooks/useFetchIdentity.ts +1 -0
- package/src/types/Identity.ts +1 -0
|
@@ -44,6 +44,8 @@ const useDisableOtpMutation = require("./src/hooks/mutations/otp/useDisableOtpMu
|
|
|
44
44
|
const usePrepareOtpMutation = require("./src/hooks/mutations/otp/usePrepareOtpMutation.cjs");
|
|
45
45
|
const useCreateResetPasswordRequestMutation = require("./src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs");
|
|
46
46
|
const useResetPasswordMutation = require("./src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs");
|
|
47
|
+
const useChangeProfile = require("./src/hooks/mutations/profile/useChangeProfile.cjs");
|
|
48
|
+
const useChangeMyProfile = require("./src/hooks/mutations/profile/useChangeMyProfile.cjs");
|
|
47
49
|
const useMeQuery = require("./src/hooks/queries/useMeQuery.cjs");
|
|
48
50
|
const useProjectMembersQuery = require("./src/hooks/queries/useProjectMembersQuery.cjs");
|
|
49
51
|
const useProjectMembershipsQuery = require("./src/hooks/queries/useProjectMembershipsQuery.cjs");
|
|
@@ -138,6 +140,10 @@ exports.createResetPasswordRequestMutation = useCreateResetPasswordRequestMutati
|
|
|
138
140
|
exports.useCreateResetPasswordRequestMutation = useCreateResetPasswordRequestMutation.useCreateResetPasswordRequestMutation;
|
|
139
141
|
exports.resetPasswordMutation = useResetPasswordMutation.resetPasswordMutation;
|
|
140
142
|
exports.useResetPasswordMutation = useResetPasswordMutation.useResetPasswordMutation;
|
|
143
|
+
exports.changeProfile = useChangeProfile.changeProfile;
|
|
144
|
+
exports.useChangeProfileMutation = useChangeProfile.useChangeProfileMutation;
|
|
145
|
+
exports.changeMyProfile = useChangeMyProfile.changeMyProfile;
|
|
146
|
+
exports.useChangeMyProfileMutation = useChangeMyProfile.useChangeMyProfileMutation;
|
|
141
147
|
exports.useMeQuery = useMeQuery.useMeQuery;
|
|
142
148
|
exports.useProjectMembersQuery = useProjectMembersQuery.useProjectMembersQuery;
|
|
143
149
|
exports.useProjectMembershipsQuery = useProjectMembershipsQuery.useProjectMembershipsQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -42,6 +42,8 @@ import { disableOtpMutation, useDisableOtpMutation } from "./src/hooks/mutations
|
|
|
42
42
|
import { prepareOtpMutation, usePrepareOtpMutation } from "./src/hooks/mutations/otp/usePrepareOtpMutation.js";
|
|
43
43
|
import { createResetPasswordRequestMutation, useCreateResetPasswordRequestMutation } from "./src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js";
|
|
44
44
|
import { resetPasswordMutation, useResetPasswordMutation } from "./src/hooks/mutations/passwordReset/useResetPasswordMutation.js";
|
|
45
|
+
import { changeProfile, useChangeProfileMutation } from "./src/hooks/mutations/profile/useChangeProfile.js";
|
|
46
|
+
import { changeMyProfile, useChangeMyProfileMutation } from "./src/hooks/mutations/profile/useChangeMyProfile.js";
|
|
45
47
|
import { useMeQuery } from "./src/hooks/queries/useMeQuery.js";
|
|
46
48
|
import { useProjectMembersQuery } from "./src/hooks/queries/useProjectMembersQuery.js";
|
|
47
49
|
import { useProjectMembershipsQuery } from "./src/hooks/queries/useProjectMembershipsQuery.js";
|
|
@@ -82,6 +84,8 @@ export {
|
|
|
82
84
|
UpdateProjectMemberForm,
|
|
83
85
|
addProjectMemberMutation,
|
|
84
86
|
changeMyPasswordMutation,
|
|
87
|
+
changeMyProfile,
|
|
88
|
+
changeProfile,
|
|
85
89
|
confirmOtpMutation,
|
|
86
90
|
createApiKeyMutation,
|
|
87
91
|
createGlobalApiKeyMutation,
|
|
@@ -102,6 +106,8 @@ export {
|
|
|
102
106
|
useAddProjectMemberMutation,
|
|
103
107
|
useChangeMyPasswordForm,
|
|
104
108
|
useChangeMyPasswordMutation,
|
|
109
|
+
useChangeMyProfileMutation,
|
|
110
|
+
useChangeProfileMutation,
|
|
105
111
|
useConfirmOtpMutation,
|
|
106
112
|
useCreateApiKeyForm,
|
|
107
113
|
useCreateApiKeyMutation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
22
|
+
const changeMyProfile = TenantApi__namespace.mutation$.changeMyProfile(
|
|
23
|
+
TenantApi__namespace.changeMyProfileResponse$$.error(TenantApi__namespace.changeMyProfileError$$),
|
|
24
|
+
(options) => options.alias("mutation")
|
|
25
|
+
);
|
|
26
|
+
const useChangeMyProfileMutation = useTenantMutation.createTenantMutation(changeMyProfile);
|
|
27
|
+
exports.changeMyProfile = changeMyProfile;
|
|
28
|
+
exports.useChangeMyProfileMutation = useChangeMyProfileMutation;
|
|
29
|
+
//# sourceMappingURL=useChangeMyProfile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeMyProfile.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeMyProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeMyProfile = TenantApi.mutation$\n\t.changeMyProfile(\n\t\tTenantApi\n\t\t .changeMyProfileResponse$$\n\t\t .error(TenantApi.changeMyProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeMyProfileMutation = createTenantMutation(changeMyProfile)\nexport type ChangeMyProfileMutationVariables = Parameters<ReturnType<typeof useChangeMyProfileMutation>>[0]\n"],"names":["TenantApi","createTenantMutation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,kBAAkBA,qBAAU,UACvC;AAAA,EACAA,qBACG,0BACA,MAAMA,qBAAU,sBAAsB;AAAA,EACzC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,6BAA6BC,uCAAqB,eAAe;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
3
|
+
const changeMyProfile = TenantApi.mutation$.changeMyProfile(
|
|
4
|
+
TenantApi.changeMyProfileResponse$$.error(TenantApi.changeMyProfileError$$),
|
|
5
|
+
(options) => options.alias("mutation")
|
|
6
|
+
);
|
|
7
|
+
const useChangeMyProfileMutation = createTenantMutation(changeMyProfile);
|
|
8
|
+
export {
|
|
9
|
+
changeMyProfile,
|
|
10
|
+
useChangeMyProfileMutation
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useChangeMyProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeMyProfile.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeMyProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeMyProfile = TenantApi.mutation$\n\t.changeMyProfile(\n\t\tTenantApi\n\t\t .changeMyProfileResponse$$\n\t\t .error(TenantApi.changeMyProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeMyProfileMutation = createTenantMutation(changeMyProfile)\nexport type ChangeMyProfileMutationVariables = Parameters<ReturnType<typeof useChangeMyProfileMutation>>[0]\n"],"names":[],"mappings":";;AAGa,MAAA,kBAAkB,UAAU,UACvC;AAAA,EACA,UACG,0BACA,MAAM,UAAU,sBAAsB;AAAA,EACzC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,6BAA6B,qBAAqB,eAAe;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
22
|
+
const changeProfile = TenantApi__namespace.mutation$.changeProfile(
|
|
23
|
+
TenantApi__namespace.changeProfileResponse$$.error(TenantApi__namespace.changeProfileError$$),
|
|
24
|
+
(options) => options.alias("mutation")
|
|
25
|
+
);
|
|
26
|
+
const useChangeProfileMutation = useTenantMutation.createTenantMutation(changeProfile);
|
|
27
|
+
exports.changeProfile = changeProfile;
|
|
28
|
+
exports.useChangeProfileMutation = useChangeProfileMutation;
|
|
29
|
+
//# sourceMappingURL=useChangeProfile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeProfile.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeProfile = TenantApi.mutation$\n\t.changeProfile(\n\t\tTenantApi\n\t\t .changeProfileResponse$$\n\t\t .error(TenantApi.changeProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeProfileMutation = createTenantMutation(changeProfile)\nexport type ChangeProfileMutationVariables = Parameters<ReturnType<typeof useChangeProfileMutation>>[0]\n"],"names":["TenantApi","createTenantMutation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,gBAAgBA,qBAAU,UACrC;AAAA,EACAA,qBACG,wBACA,MAAMA,qBAAU,oBAAoB;AAAA,EACvC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,2BAA2BC,uCAAqB,aAAa;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
3
|
+
const changeProfile = TenantApi.mutation$.changeProfile(
|
|
4
|
+
TenantApi.changeProfileResponse$$.error(TenantApi.changeProfileError$$),
|
|
5
|
+
(options) => options.alias("mutation")
|
|
6
|
+
);
|
|
7
|
+
const useChangeProfileMutation = createTenantMutation(changeProfile);
|
|
8
|
+
export {
|
|
9
|
+
changeProfile,
|
|
10
|
+
useChangeProfileMutation
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useChangeProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeProfile.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeProfile = TenantApi.mutation$\n\t.changeProfile(\n\t\tTenantApi\n\t\t .changeProfileResponse$$\n\t\t .error(TenantApi.changeProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeProfileMutation = createTenantMutation(changeProfile)\nexport type ChangeProfileMutationVariables = Parameters<ReturnType<typeof useChangeProfileMutation>>[0]\n"],"names":[],"mappings":";;AAGa,MAAA,gBAAgB,UAAU,UACrC;AAAA,EACA,UACG,wBACA,MAAM,UAAU,oBAAoB;AAAA,EACvC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,2BAA2B,qBAAqB,aAAa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchIdentity.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["useSessionToken","useMeQuery","useState","useCallback","useLogoutInternal","it","GraphQlClientError","useMemo"],"mappings":";;;;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAeA,YAAAA;AACrB,QAAM,UAAUC,WAAAA;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAIC,MAAAA,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgBC,MAAAA,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAASC,oCAAkB,aAAa;AAExC,QAAA,QAAQD,MAAAA,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAE,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAaC,YAAAA,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACAC,MAAAA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;;"}
|
|
1
|
+
{"version":3,"file":"useFetchIdentity.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\troles: response.roles ?? [],\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["useSessionToken","useMeQuery","useState","useCallback","useLogoutInternal","it","GraphQlClientError","useMemo"],"mappings":";;;;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAeA,YAAAA;AACrB,QAAM,UAAUC,WAAAA;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAIC,MAAAA,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgBC,MAAAA,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAASC,oCAAkB,aAAa;AAExC,QAAA,QAAQD,MAAAA,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,OAAO,SAAS,SAAS,CAAC;AAAA,UAC1B,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAE,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAaC,YAAAA,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACAC,MAAAA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchIdentity.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["it"],"mappings":";;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgB,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAAS,kBAAkB,aAAa;AAExC,QAAA,QAAQ,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAA,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAa,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;"}
|
|
1
|
+
{"version":3,"file":"useFetchIdentity.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\troles: response.roles ?? [],\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["it"],"mappings":";;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgB,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAAS,kBAAkB,aAAa;AAExC,QAAA,QAAQ,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,OAAO,SAAS,SAAS,CAAC;AAAA,UAC1B,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAA,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAa,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;"}
|
|
@@ -44,6 +44,8 @@ const useDisableOtpMutation = require("./src/hooks/mutations/otp/useDisableOtpMu
|
|
|
44
44
|
const usePrepareOtpMutation = require("./src/hooks/mutations/otp/usePrepareOtpMutation.cjs");
|
|
45
45
|
const useCreateResetPasswordRequestMutation = require("./src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs");
|
|
46
46
|
const useResetPasswordMutation = require("./src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs");
|
|
47
|
+
const useChangeProfile = require("./src/hooks/mutations/profile/useChangeProfile.cjs");
|
|
48
|
+
const useChangeMyProfile = require("./src/hooks/mutations/profile/useChangeMyProfile.cjs");
|
|
47
49
|
const useMeQuery = require("./src/hooks/queries/useMeQuery.cjs");
|
|
48
50
|
const useProjectMembersQuery = require("./src/hooks/queries/useProjectMembersQuery.cjs");
|
|
49
51
|
const useProjectMembershipsQuery = require("./src/hooks/queries/useProjectMembershipsQuery.cjs");
|
|
@@ -138,6 +140,10 @@ exports.createResetPasswordRequestMutation = useCreateResetPasswordRequestMutati
|
|
|
138
140
|
exports.useCreateResetPasswordRequestMutation = useCreateResetPasswordRequestMutation.useCreateResetPasswordRequestMutation;
|
|
139
141
|
exports.resetPasswordMutation = useResetPasswordMutation.resetPasswordMutation;
|
|
140
142
|
exports.useResetPasswordMutation = useResetPasswordMutation.useResetPasswordMutation;
|
|
143
|
+
exports.changeProfile = useChangeProfile.changeProfile;
|
|
144
|
+
exports.useChangeProfileMutation = useChangeProfile.useChangeProfileMutation;
|
|
145
|
+
exports.changeMyProfile = useChangeMyProfile.changeMyProfile;
|
|
146
|
+
exports.useChangeMyProfileMutation = useChangeMyProfile.useChangeMyProfileMutation;
|
|
141
147
|
exports.useMeQuery = useMeQuery.useMeQuery;
|
|
142
148
|
exports.useProjectMembersQuery = useProjectMembersQuery.useProjectMembersQuery;
|
|
143
149
|
exports.useProjectMembershipsQuery = useProjectMembershipsQuery.useProjectMembershipsQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -42,6 +42,8 @@ import { disableOtpMutation, useDisableOtpMutation } from "./src/hooks/mutations
|
|
|
42
42
|
import { prepareOtpMutation, usePrepareOtpMutation } from "./src/hooks/mutations/otp/usePrepareOtpMutation.js";
|
|
43
43
|
import { createResetPasswordRequestMutation, useCreateResetPasswordRequestMutation } from "./src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js";
|
|
44
44
|
import { resetPasswordMutation, useResetPasswordMutation } from "./src/hooks/mutations/passwordReset/useResetPasswordMutation.js";
|
|
45
|
+
import { changeProfile, useChangeProfileMutation } from "./src/hooks/mutations/profile/useChangeProfile.js";
|
|
46
|
+
import { changeMyProfile, useChangeMyProfileMutation } from "./src/hooks/mutations/profile/useChangeMyProfile.js";
|
|
45
47
|
import { useMeQuery } from "./src/hooks/queries/useMeQuery.js";
|
|
46
48
|
import { useProjectMembersQuery } from "./src/hooks/queries/useProjectMembersQuery.js";
|
|
47
49
|
import { useProjectMembershipsQuery } from "./src/hooks/queries/useProjectMembershipsQuery.js";
|
|
@@ -82,6 +84,8 @@ export {
|
|
|
82
84
|
UpdateProjectMemberForm,
|
|
83
85
|
addProjectMemberMutation,
|
|
84
86
|
changeMyPasswordMutation,
|
|
87
|
+
changeMyProfile,
|
|
88
|
+
changeProfile,
|
|
85
89
|
confirmOtpMutation,
|
|
86
90
|
createApiKeyMutation,
|
|
87
91
|
createGlobalApiKeyMutation,
|
|
@@ -102,6 +106,8 @@ export {
|
|
|
102
106
|
useAddProjectMemberMutation,
|
|
103
107
|
useChangeMyPasswordForm,
|
|
104
108
|
useChangeMyPasswordMutation,
|
|
109
|
+
useChangeMyProfileMutation,
|
|
110
|
+
useChangeProfileMutation,
|
|
105
111
|
useConfirmOtpMutation,
|
|
106
112
|
useCreateApiKeyForm,
|
|
107
113
|
useCreateApiKeyMutation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
22
|
+
const changeMyProfile = TenantApi__namespace.mutation$.changeMyProfile(
|
|
23
|
+
TenantApi__namespace.changeMyProfileResponse$$.error(TenantApi__namespace.changeMyProfileError$$),
|
|
24
|
+
(options) => options.alias("mutation")
|
|
25
|
+
);
|
|
26
|
+
const useChangeMyProfileMutation = useTenantMutation.createTenantMutation(changeMyProfile);
|
|
27
|
+
exports.changeMyProfile = changeMyProfile;
|
|
28
|
+
exports.useChangeMyProfileMutation = useChangeMyProfileMutation;
|
|
29
|
+
//# sourceMappingURL=useChangeMyProfile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeMyProfile.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeMyProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeMyProfile = TenantApi.mutation$\n\t.changeMyProfile(\n\t\tTenantApi\n\t\t .changeMyProfileResponse$$\n\t\t .error(TenantApi.changeMyProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeMyProfileMutation = createTenantMutation(changeMyProfile)\nexport type ChangeMyProfileMutationVariables = Parameters<ReturnType<typeof useChangeMyProfileMutation>>[0]\n"],"names":["TenantApi","createTenantMutation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,kBAAkBA,qBAAU,UACvC;AAAA,EACAA,qBACG,0BACA,MAAMA,qBAAU,sBAAsB;AAAA,EACzC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,6BAA6BC,uCAAqB,eAAe;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
3
|
+
const changeMyProfile = TenantApi.mutation$.changeMyProfile(
|
|
4
|
+
TenantApi.changeMyProfileResponse$$.error(TenantApi.changeMyProfileError$$),
|
|
5
|
+
(options) => options.alias("mutation")
|
|
6
|
+
);
|
|
7
|
+
const useChangeMyProfileMutation = createTenantMutation(changeMyProfile);
|
|
8
|
+
export {
|
|
9
|
+
changeMyProfile,
|
|
10
|
+
useChangeMyProfileMutation
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useChangeMyProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeMyProfile.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeMyProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeMyProfile = TenantApi.mutation$\n\t.changeMyProfile(\n\t\tTenantApi\n\t\t .changeMyProfileResponse$$\n\t\t .error(TenantApi.changeMyProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeMyProfileMutation = createTenantMutation(changeMyProfile)\nexport type ChangeMyProfileMutationVariables = Parameters<ReturnType<typeof useChangeMyProfileMutation>>[0]\n"],"names":[],"mappings":";;AAGa,MAAA,kBAAkB,UAAU,UACvC;AAAA,EACA,UACG,0BACA,MAAM,UAAU,sBAAsB;AAAA,EACzC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,6BAA6B,qBAAqB,eAAe;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
22
|
+
const changeProfile = TenantApi__namespace.mutation$.changeProfile(
|
|
23
|
+
TenantApi__namespace.changeProfileResponse$$.error(TenantApi__namespace.changeProfileError$$),
|
|
24
|
+
(options) => options.alias("mutation")
|
|
25
|
+
);
|
|
26
|
+
const useChangeProfileMutation = useTenantMutation.createTenantMutation(changeProfile);
|
|
27
|
+
exports.changeProfile = changeProfile;
|
|
28
|
+
exports.useChangeProfileMutation = useChangeProfileMutation;
|
|
29
|
+
//# sourceMappingURL=useChangeProfile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeProfile.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeProfile = TenantApi.mutation$\n\t.changeProfile(\n\t\tTenantApi\n\t\t .changeProfileResponse$$\n\t\t .error(TenantApi.changeProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeProfileMutation = createTenantMutation(changeProfile)\nexport type ChangeProfileMutationVariables = Parameters<ReturnType<typeof useChangeProfileMutation>>[0]\n"],"names":["TenantApi","createTenantMutation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,gBAAgBA,qBAAU,UACrC;AAAA,EACAA,qBACG,wBACA,MAAMA,qBAAU,oBAAoB;AAAA,EACvC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,2BAA2BC,uCAAqB,aAAa;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
3
|
+
const changeProfile = TenantApi.mutation$.changeProfile(
|
|
4
|
+
TenantApi.changeProfileResponse$$.error(TenantApi.changeProfileError$$),
|
|
5
|
+
(options) => options.alias("mutation")
|
|
6
|
+
);
|
|
7
|
+
const useChangeProfileMutation = createTenantMutation(changeProfile);
|
|
8
|
+
export {
|
|
9
|
+
changeProfile,
|
|
10
|
+
useChangeProfileMutation
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useChangeProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeProfile.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeProfile = TenantApi.mutation$\n\t.changeProfile(\n\t\tTenantApi\n\t\t .changeProfileResponse$$\n\t\t .error(TenantApi.changeProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeProfileMutation = createTenantMutation(changeProfile)\nexport type ChangeProfileMutationVariables = Parameters<ReturnType<typeof useChangeProfileMutation>>[0]\n"],"names":[],"mappings":";;AAGa,MAAA,gBAAgB,UAAU,UACrC;AAAA,EACA,UACG,wBACA,MAAM,UAAU,oBAAoB;AAAA,EACvC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,2BAA2B,qBAAqB,aAAa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchIdentity.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["useSessionToken","useMeQuery","useState","useCallback","useLogoutInternal","it","GraphQlClientError","useMemo"],"mappings":";;;;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAeA,YAAAA;AACrB,QAAM,UAAUC,WAAAA;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAIC,MAAAA,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgBC,MAAAA,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAASC,oCAAkB,aAAa;AAExC,QAAA,QAAQD,MAAAA,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAE,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAaC,YAAAA,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACAC,MAAAA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;;"}
|
|
1
|
+
{"version":3,"file":"useFetchIdentity.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\troles: response.roles ?? [],\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["useSessionToken","useMeQuery","useState","useCallback","useLogoutInternal","it","GraphQlClientError","useMemo"],"mappings":";;;;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAeA,YAAAA;AACrB,QAAM,UAAUC,WAAAA;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAIC,MAAAA,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgBC,MAAAA,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAASC,oCAAkB,aAAa;AAExC,QAAA,QAAQD,MAAAA,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,OAAO,SAAS,SAAS,CAAC;AAAA,UAC1B,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAE,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAaC,YAAAA,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACAC,MAAAA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchIdentity.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["it"],"mappings":";;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgB,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAAS,kBAAkB,aAAa;AAExC,QAAA,QAAQ,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAA,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAa,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;"}
|
|
1
|
+
{"version":3,"file":"useFetchIdentity.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\troles: response.roles ?? [],\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["it"],"mappings":";;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAW,CAAA;AAE5J,QAAM,gBAAgB,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW,GAAG,CAAE,CAAA;AACjG,QAAA,SAAS,kBAAkB,aAAa;AAExC,QAAA,QAAQ,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,CAAA,CAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,OAAO,SAAS,SAAS,CAAC;AAAA,UAC1B,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAA,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QACD;AAAA,MAAA,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAa,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,KAAA,CAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAC1D;AAAA,IACD;AAAA,EAAA,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAAA;AAE5B;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/mutations/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,OAAO,CAAA;AACrB,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/mutations/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,OAAO,CAAA;AACrB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/mutations/profile/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as TenantApi from '@contember/graphql-client-tenant';
|
|
2
|
+
export declare const changeMyProfile: TenantApi.MutationFetcher<{
|
|
3
|
+
readonly mutation?: ({
|
|
4
|
+
readonly ok: boolean;
|
|
5
|
+
} & {
|
|
6
|
+
readonly error?: ({
|
|
7
|
+
readonly code: TenantApi.ChangeMyProfileErrorCode;
|
|
8
|
+
} & {
|
|
9
|
+
readonly developerMessage: string;
|
|
10
|
+
}) | undefined;
|
|
11
|
+
}) | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
readonly email?: string;
|
|
14
|
+
readonly name?: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const useChangeMyProfileMutation: ({ headers, apiToken }?: import("../..").TenantApiOptions) => (variables: {
|
|
17
|
+
readonly email?: string;
|
|
18
|
+
readonly name?: string;
|
|
19
|
+
}) => Promise<import("../../useTenantMutation").TenantMutationResponse<unknown, TenantApi.ChangeMyProfileErrorCode>>;
|
|
20
|
+
export type ChangeMyProfileMutationVariables = Parameters<ReturnType<typeof useChangeMyProfileMutation>>[0];
|
|
21
|
+
//# sourceMappingURL=useChangeMyProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeMyProfile.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/mutations/profile/useChangeMyProfile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAA;AAG7D,eAAO,MAAM,eAAe;;;;;;;;;;;;;EAM1B,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;oHAAwC,CAAA;AAC/E,MAAM,MAAM,gCAAgC,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as TenantApi from '@contember/graphql-client-tenant';
|
|
2
|
+
export declare const changeProfile: TenantApi.MutationFetcher<{
|
|
3
|
+
readonly mutation?: ({
|
|
4
|
+
readonly ok: boolean;
|
|
5
|
+
} & {
|
|
6
|
+
readonly error?: ({
|
|
7
|
+
readonly code: TenantApi.ChangeProfileErrorCode;
|
|
8
|
+
} & {
|
|
9
|
+
readonly developerMessage: string;
|
|
10
|
+
}) | undefined;
|
|
11
|
+
}) | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
readonly personId: string;
|
|
14
|
+
readonly email?: string;
|
|
15
|
+
readonly name?: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const useChangeProfileMutation: ({ headers, apiToken }?: import("../..").TenantApiOptions) => (variables: {
|
|
18
|
+
readonly personId: string;
|
|
19
|
+
readonly email?: string;
|
|
20
|
+
readonly name?: string;
|
|
21
|
+
}) => Promise<import("../../useTenantMutation").TenantMutationResponse<unknown, TenantApi.ChangeProfileErrorCode>>;
|
|
22
|
+
export type ChangeProfileMutationVariables = Parameters<ReturnType<typeof useChangeProfileMutation>>[0];
|
|
23
|
+
//# sourceMappingURL=useChangeProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeProfile.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/mutations/profile/useChangeProfile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAA;AAG7D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;EAMxB,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;kHAAsC,CAAA;AAC3E,MAAM,MAAM,8BAA8B,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchIdentity.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFetchIdentity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAKxE,eAAO,MAAM,gBAAgB,QAAO,CAAC;IAAE,KAAK,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"useFetchIdentity.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFetchIdentity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAKxE,eAAO,MAAM,gBAAgB,QAAO,CAAC;IAAE,KAAK,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,EAAE,eAAe,CAgDlH,CAAA"}
|