@axcode/axcloud-sdk 0.3.2 → 0.4.0-dev.35742cb
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/README.md +32 -1
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -9
- package/dist/index.mjs.map +1 -1
- package/dist/public.d.mts +2 -2
- package/dist/public.d.ts +2 -2
- package/dist/{useContent-Cl7dvERE.d.ts → useContent-CGI1l3Gs.d.ts} +25 -1
- package/dist/{useContent-1WbKvPY4.d.mts → useContent-DLoyqAWH.d.mts} +25 -1
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -252,6 +252,7 @@ function createQueryClientOwnerSignature(config, subject) {
|
|
|
252
252
|
config.stage,
|
|
253
253
|
config.apiUrl,
|
|
254
254
|
config.apiKey ?? null,
|
|
255
|
+
config.auth0.identityProviderId ?? null,
|
|
255
256
|
config.auth0.domain,
|
|
256
257
|
config.auth0.clientId,
|
|
257
258
|
config.auth0.audience ?? null,
|
|
@@ -858,17 +859,18 @@ function useSections() {
|
|
|
858
859
|
refetch: query.refetch
|
|
859
860
|
};
|
|
860
861
|
}
|
|
862
|
+
var FORMS_ADMIN_PATH = "/forms/admin";
|
|
861
863
|
function useForms(options = {}) {
|
|
862
|
-
const { client,
|
|
864
|
+
const { client, orgId } = useAxCloudContext();
|
|
863
865
|
const { formType, status, limit = 50, cursor } = options;
|
|
864
866
|
const query = useQuery({
|
|
865
|
-
queryKey: ["axcloud", "forms", "submissions",
|
|
867
|
+
queryKey: ["axcloud", "forms", "submissions", orgId, formType, status, limit, cursor],
|
|
866
868
|
queryFn: async () => {
|
|
867
|
-
const params = { limit };
|
|
869
|
+
const params = { org_id: orgId, limit };
|
|
868
870
|
if (formType) params.form_type = formType;
|
|
869
871
|
if (status) params.status = status;
|
|
870
872
|
if (cursor) params.cursor = cursor;
|
|
871
|
-
return client.get(
|
|
873
|
+
return client.get(`${FORMS_ADMIN_PATH}/submissions`, params);
|
|
872
874
|
},
|
|
873
875
|
staleTime: 1e3 * 30
|
|
874
876
|
// 30 seconds
|
|
@@ -885,12 +887,12 @@ function useForms(options = {}) {
|
|
|
885
887
|
};
|
|
886
888
|
}
|
|
887
889
|
function useFormStats(options = {}) {
|
|
888
|
-
const { client,
|
|
890
|
+
const { client, orgId } = useAxCloudContext();
|
|
889
891
|
const { days = 30 } = options;
|
|
890
892
|
const query = useQuery({
|
|
891
|
-
queryKey: ["axcloud", "forms", "stats",
|
|
893
|
+
queryKey: ["axcloud", "forms", "stats", orgId, days],
|
|
892
894
|
queryFn: async () => {
|
|
893
|
-
return client.get(
|
|
895
|
+
return client.get(`${FORMS_ADMIN_PATH}/stats`, { org_id: orgId, days });
|
|
894
896
|
},
|
|
895
897
|
staleTime: 1e3 * 60 * 5
|
|
896
898
|
// 5 minutes
|
|
@@ -906,7 +908,7 @@ function useFormStats(options = {}) {
|
|
|
906
908
|
};
|
|
907
909
|
}
|
|
908
910
|
function useUpdateFormSubmission() {
|
|
909
|
-
const { client,
|
|
911
|
+
const { client, orgId } = useAxCloudContext();
|
|
910
912
|
const queryClient = useQueryClient();
|
|
911
913
|
return useMutation({
|
|
912
914
|
mutationFn: async ({
|
|
@@ -914,7 +916,10 @@ function useUpdateFormSubmission() {
|
|
|
914
916
|
status,
|
|
915
917
|
notes
|
|
916
918
|
}) => {
|
|
917
|
-
return client.patch(
|
|
919
|
+
return client.patch(
|
|
920
|
+
`${FORMS_ADMIN_PATH}/submissions/${encodeURIComponent(submissionId)}?org_id=${encodeURIComponent(orgId)}`,
|
|
921
|
+
{ status, notes }
|
|
922
|
+
);
|
|
918
923
|
},
|
|
919
924
|
onSuccess: () => {
|
|
920
925
|
queryClient.invalidateQueries({ queryKey: ["axcloud", "forms"] });
|