@singi-labs/sifa-sdk 0.12.84 → 0.12.86

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.
Files changed (45) hide show
  1. package/dist/{index-D0qELxvf.d.cts → index-jNyd5QP7.d.cts} +6 -0
  2. package/dist/{index-D0qELxvf.d.ts → index-jNyd5QP7.d.ts} +6 -0
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +4 -4
  6. package/dist/index.d.ts +4 -4
  7. package/dist/index.js +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/jsonld/index.d.cts +1 -1
  10. package/dist/jsonld/index.d.ts +1 -1
  11. package/dist/{network-map-C5AnjGcV.d.ts → network-map-GfIVEYpr.d.ts} +4 -4
  12. package/dist/{network-map-CkRrVFJD.d.cts → network-map-y6U7m-hX.d.cts} +4 -4
  13. package/dist/{org-Be8tayoD.d.cts → org-ClDqS3CM.d.cts} +18 -3
  14. package/dist/{org-B2Y54EHg.d.ts → org-GlACA06R.d.ts} +18 -3
  15. package/dist/{profile-summary-Fieyfzzf.d.ts → profile-summary-8fapqzHv.d.ts} +1 -1
  16. package/dist/{profile-summary-CIkWTi6K.d.cts → profile-summary-DY78IoL9.d.cts} +1 -1
  17. package/dist/publishing/index.cjs +40 -0
  18. package/dist/publishing/index.cjs.map +1 -1
  19. package/dist/publishing/index.d.cts +58 -1
  20. package/dist/publishing/index.d.ts +58 -1
  21. package/dist/publishing/index.js +38 -1
  22. package/dist/publishing/index.js.map +1 -1
  23. package/dist/query/fetchers/index.cjs +30 -0
  24. package/dist/query/fetchers/index.cjs.map +1 -1
  25. package/dist/query/fetchers/index.d.cts +6 -6
  26. package/dist/query/fetchers/index.d.ts +6 -6
  27. package/dist/query/fetchers/index.js +29 -1
  28. package/dist/query/fetchers/index.js.map +1 -1
  29. package/dist/query/hooks/index.cjs +62 -0
  30. package/dist/query/hooks/index.cjs.map +1 -1
  31. package/dist/query/hooks/index.d.cts +5 -5
  32. package/dist/query/hooks/index.d.ts +5 -5
  33. package/dist/query/hooks/index.js +61 -1
  34. package/dist/query/hooks/index.js.map +1 -1
  35. package/dist/query/index.cjs +64 -0
  36. package/dist/query/index.cjs.map +1 -1
  37. package/dist/query/index.d.cts +8 -8
  38. package/dist/query/index.d.ts +8 -8
  39. package/dist/query/index.js +61 -1
  40. package/dist/query/index.js.map +1 -1
  41. package/dist/{types-ClxJ0I98.d.ts → types-8JaS6abh.d.ts} +1 -1
  42. package/dist/{types-BEei3kVS.d.cts → types-8wAWvS-T.d.cts} +1 -1
  43. package/dist/{use-org-notification-emails-BdglyA2S.d.cts → use-org-notification-emails-B-oGiDHo.d.cts} +11 -4
  44. package/dist/{use-org-notification-emails-1ZD4ycgg.d.ts → use-org-notification-emails-DGzW9MH6.d.ts} +11 -4
  45. package/package.json +1 -1
@@ -354,6 +354,34 @@ async function uploadAvatar(config, file, options = {}) {
354
354
  function deleteAvatarOverride(config, options = {}) {
355
355
  return apiWrite(config, "/api/profile/avatar", "DELETE", options);
356
356
  }
357
+ async function uploadNamePronunciationAudio(config, file, options = {}) {
358
+ const fetchFn = config.fetch ?? globalThis.fetch;
359
+ const url = `${config.baseUrl}/api/profile/pronunciation-audio`;
360
+ const formData = new FormData();
361
+ formData.append("file", file);
362
+ try {
363
+ const res = await fetchFn(url, {
364
+ method: "POST",
365
+ credentials: options.credentials ?? "include",
366
+ body: formData,
367
+ signal: options.signal ?? AbortSignal.timeout(options.timeoutMs ?? 3e4),
368
+ headers: options.headers
369
+ });
370
+ if (!res.ok) {
371
+ const errBody = await res.json().catch(() => ({}));
372
+ const msg = errBody.message ?? `Request failed (${res.status})`;
373
+ const pdsHost = errBody.pdsHost;
374
+ return { success: false, error: msg, ...pdsHost ? { pdsHost } : {} };
375
+ }
376
+ const data = await res.json();
377
+ return { success: true, url: data.url };
378
+ } catch {
379
+ return { success: false, error: "Network error" };
380
+ }
381
+ }
382
+ function deleteNamePronunciationAudio(config, options = {}) {
383
+ return apiWrite(config, "/api/profile/pronunciation-audio", "DELETE", options);
384
+ }
357
385
 
358
386
  // src/query/hooks/use-profile-mutations.ts
359
387
  async function invalidateProfile(queryClient, ownerHandleOrDid) {
@@ -441,6 +469,38 @@ function useDeleteAvatarOverride(ownerHandleOrDid, options) {
441
469
  }
442
470
  });
443
471
  }
472
+ function useUploadNamePronunciationAudio(ownerHandleOrDid, options) {
473
+ const config = useSifaConfig();
474
+ const queryClient = reactQuery.useQueryClient();
475
+ return reactQuery.useMutation({
476
+ // Spread first: a consumer-supplied onSuccess would otherwise replace the
477
+ // handler below and silently drop cache invalidation (#453).
478
+ ...options,
479
+ mutationFn: (file) => uploadNamePronunciationAudio(config, file),
480
+ onSuccess: async (result, variables, onMutateResult, context) => {
481
+ if (result.success) {
482
+ await invalidateProfile(queryClient, ownerHandleOrDid);
483
+ }
484
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
485
+ }
486
+ });
487
+ }
488
+ function useDeleteNamePronunciationAudio(ownerHandleOrDid, options) {
489
+ const config = useSifaConfig();
490
+ const queryClient = reactQuery.useQueryClient();
491
+ return reactQuery.useMutation({
492
+ // Spread first: a consumer-supplied onSuccess would otherwise replace the
493
+ // handler below and silently drop cache invalidation (#453).
494
+ ...options,
495
+ mutationFn: () => deleteNamePronunciationAudio(config),
496
+ onSuccess: async (result, variables, onMutateResult, context) => {
497
+ if (result.success) {
498
+ await invalidateProfile(queryClient, ownerHandleOrDid);
499
+ }
500
+ await options?.onSuccess?.(result, variables, onMutateResult, context);
501
+ }
502
+ });
503
+ }
444
504
 
445
505
  // src/query/fetchers/positions.ts
446
506
  function createPosition(config, data, options = {}) {
@@ -3203,6 +3263,7 @@ exports.useDeleteAvatarOverride = useDeleteAvatarOverride;
3203
3263
  exports.useDeleteEducation = useDeleteEducation;
3204
3264
  exports.useDeleteExternalAccount = useDeleteExternalAccount;
3205
3265
  exports.useDeleteInvestment = useDeleteInvestment;
3266
+ exports.useDeleteNamePronunciationAudio = useDeleteNamePronunciationAudio;
3206
3267
  exports.useDeletePosition = useDeletePosition;
3207
3268
  exports.useDeleteProfileLocation = useDeleteProfileLocation;
3208
3269
  exports.useDeleteReaction = useDeleteReaction;
@@ -3286,6 +3347,7 @@ exports.useUpdateRecord = useUpdateRecord;
3286
3347
  exports.useUpdateSkill = useUpdateSkill;
3287
3348
  exports.useUpdateSkillSubCategories = useUpdateSkillSubCategories;
3288
3349
  exports.useUploadAvatar = useUploadAvatar;
3350
+ exports.useUploadNamePronunciationAudio = useUploadNamePronunciationAudio;
3289
3351
  exports.useVerifyExternalAccount = useVerifyExternalAccount;
3290
3352
  exports.useWipePreview = useWipePreview;
3291
3353
  //# sourceMappingURL=index.cjs.map