@ottocode/web-sdk 0.1.271 → 0.1.272

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.
@@ -2955,6 +2955,7 @@ function openNotificationTarget(notification) {
2955
2955
  function requestNotificationPermission() {
2956
2956
  return new Promise((resolve) => {
2957
2957
  let settled = false;
2958
+ let hasNativeRequest = false;
2958
2959
  const finish = (permission) => {
2959
2960
  if (settled)
2960
2961
  return;
@@ -2964,12 +2965,15 @@ function requestNotificationPermission() {
2964
2965
  try {
2965
2966
  const result = Notification.requestPermission(finish);
2966
2967
  if (result && typeof result.then === "function") {
2968
+ hasNativeRequest = true;
2967
2969
  result.then(finish).catch(() => finish());
2968
2970
  }
2969
2971
  } catch {
2970
2972
  finish();
2971
2973
  }
2972
- setTimeout(() => finish(), 1500);
2974
+ if (!hasNativeRequest) {
2975
+ setTimeout(() => finish(), 60000);
2976
+ }
2973
2977
  });
2974
2978
  }
2975
2979
  function showInAppNotification(notification) {
@@ -3127,6 +3131,8 @@ function useClientEvents(activeSessionId) {
3127
3131
  const currentPermission = Notification.permission;
3128
3132
  if (permission === "granted" || currentPermission === "granted") {
3129
3133
  toast.success("Browser notifications enabled.");
3134
+ } else if (permission === "default" && currentPermission === "default") {
3135
+ return;
3130
3136
  } else {
3131
3137
  toast.info("Browser notifications were not enabled.");
3132
3138
  }
@@ -5791,4 +5797,4 @@ export {
5791
5797
  sessionsQueryKey
5792
5798
  };
5793
5799
 
5794
- //# debugId=26C8EA5B27C5271C64756E2164756E21
5800
+ //# debugId=AFCFC55375F9489664756E2164756E21