@onside/install-widget 1.0.4 → 1.1.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.
Files changed (38) hide show
  1. package/dist-lib/AndroidPlatformModal-Bo8KL9YE.cjs +1 -0
  2. package/dist-lib/AndroidPlatformModal-DGNUxRkK.js +48 -0
  3. package/dist-lib/CheckInstallModal-BAx1q0Eh.js +76 -0
  4. package/dist-lib/CheckInstallModal-CamMs4Ky.cjs +1 -0
  5. package/dist-lib/Dialog-BpvFTl3s.js +95 -0
  6. package/dist-lib/Dialog-H1GsCMbd.cjs +1 -0
  7. package/dist-lib/FaqModal-B6YPov5t.js +103 -0
  8. package/dist-lib/FaqModal-BYENishJ.cjs +1 -0
  9. package/dist-lib/GoToSafariModal-B1EWxzWE.cjs +1 -0
  10. package/dist-lib/{GoToSafariModal-C_KBizh8.js → GoToSafariModal-pXhEb2yy.js} +36 -36
  11. package/dist-lib/UpdateIOSModal-B-jqDkQO.cjs +1 -0
  12. package/dist-lib/UpdateIOSModal-D-cikTQ4.js +81 -0
  13. package/dist-lib/cdn-DQucWvIe.js +99 -0
  14. package/dist-lib/cdn-ToXHpWOt.cjs +1 -0
  15. package/dist-lib/hooks.cjs +1 -1
  16. package/dist-lib/hooks.js +4 -3
  17. package/dist-lib/index-BqoWsHcB.js +195 -0
  18. package/dist-lib/index-DFXiHkdo.cjs +1 -0
  19. package/dist-lib/install-package-5TE9fTFQ.cjs +1 -0
  20. package/dist-lib/install-package-S3saul1C.js +451 -0
  21. package/dist-lib/install-package.cjs +1 -1
  22. package/dist-lib/install-package.d.ts +82 -17
  23. package/dist-lib/install-package.js +14 -12
  24. package/dist-lib/install-widget.css +1 -1
  25. package/dist-lib/useInstallUrl-McaAuMPK.js +65 -0
  26. package/dist-lib/useInstallUrl-iPCPqYWB.cjs +1 -0
  27. package/package.json +12 -4
  28. package/dist-lib/AndroidPlatformModal-2Ykjo2V7.js +0 -48
  29. package/dist-lib/AndroidPlatformModal-DTglyxUG.cjs +0 -1
  30. package/dist-lib/Dialog-yEP-7Deb.js +0 -1399
  31. package/dist-lib/Dialog-yZ9bWtK1.cjs +0 -45
  32. package/dist-lib/GoToSafariModal-Cgx0X0rg.cjs +0 -1
  33. package/dist-lib/UpdateIOSModal-BGWvssyd.js +0 -170
  34. package/dist-lib/UpdateIOSModal-CE-d3YCr.cjs +0 -1
  35. package/dist-lib/install-package-B17QfMPy.cjs +0 -1
  36. package/dist-lib/install-package-DowlG4hO.js +0 -3036
  37. package/dist-lib/useInstallUrl-CjUspi0p.cjs +0 -1
  38. package/dist-lib/useInstallUrl-JIdkWpgj.js +0 -87
@@ -1 +0,0 @@
1
- "use strict";const l=require("react"),w=require("./installUrlService-AjG03i8i.cjs"),y=!0,h=1e3,d=t=>{let e;const s=new Set,r=(a,S)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const g=e;e=S??(typeof c!="object"||c===null)?c:Object.assign({},e,c),s.forEach(U=>U(e,g))}},n=()=>e,i={setState:r,getState:n,getInitialState:()=>b,subscribe:a=>(s.add(a),()=>s.delete(a))},b=e=t(r,n,i);return i},m=(t=>t?d(t):d),M=t=>t;function p(t,e=M){const s=l.useSyncExternalStore(t.subscribe,l.useCallback(()=>e(t.getState()),[t,e]),l.useCallback(()=>e(t.getInitialState()),[t,e]));return l.useDebugValue(s),s}const f=t=>{const e=m(t),s=r=>p(e,r);return Object.assign(s,e),s},E=(t=>t?f(t):f),R=t=>new Promise(e=>setTimeout(e,t)),C=async(t,e)=>{let s=null;for(let r=0;r<e.attempts;r++)try{return await t()}catch(n){s=n,r<e.attempts-1&&await R(e.delayMs(r))}throw s??new Error("Unknown retry error")},_=t=>!!(t?.exp&&Date.now()<t.exp),j=3,k=t=>Math.min(1e3*2**t,3e4),I={status:"idle",data:null,error:null},x=t=>t instanceof Error?t:new Error(String(t)),u=E((t,e)=>({...I,fetchInstallUrl:async()=>{const s=e();if(!_(s.data)&&s.status!=="loading"){t({status:"loading",error:null});try{const r=await C(()=>w.getInstallUrl({useMockResponse:!y}),{attempts:j,delayMs:k});t({status:"success",data:r,error:null})}catch(r){t({status:"error",error:x(r)})}}},reset:()=>t(I)})),D=(t=!0)=>{const e=u(o=>o.status),s=u(o=>o.data),r=u(o=>o.error),n=u(o=>o.fetchInstallUrl);return l.useEffect(()=>{t&&n()},[t,n]),{status:e,data:s,error:r,fetchInstallUrl:n}};exports.SEC_MS=h;exports.create=E;exports.isProduction=y;exports.useInstallUrl=D;exports.useInstallUrlStore=u;
@@ -1,87 +0,0 @@
1
- import l, { useEffect as E } from "react";
2
- import { g as I } from "./installUrlService-CrJfYPwM.js";
3
- const w = !0, Y = 1e3, f = (t) => {
4
- let e;
5
- const s = /* @__PURE__ */ new Set(), n = (a, S) => {
6
- const c = typeof a == "function" ? a(e) : a;
7
- if (!Object.is(c, e)) {
8
- const y = e;
9
- e = S ?? (typeof c != "object" || c === null) ? c : Object.assign({}, e, c), s.forEach((b) => b(e, y));
10
- }
11
- }, r = () => e, i = { setState: n, getState: r, getInitialState: () => m, subscribe: (a) => (s.add(a), () => s.delete(a)) }, m = e = t(n, r, i);
12
- return i;
13
- }, h = ((t) => t ? f(t) : f), p = (t) => t;
14
- function U(t, e = p) {
15
- const s = l.useSyncExternalStore(
16
- t.subscribe,
17
- l.useCallback(() => e(t.getState()), [t, e]),
18
- l.useCallback(() => e(t.getInitialState()), [t, e])
19
- );
20
- return l.useDebugValue(s), s;
21
- }
22
- const d = (t) => {
23
- const e = h(t), s = (n) => U(e, n);
24
- return Object.assign(s, e), s;
25
- }, M = ((t) => t ? d(t) : d), R = (t) => new Promise((e) => setTimeout(e, t)), _ = async (t, e) => {
26
- let s = null;
27
- for (let n = 0; n < e.attempts; n++)
28
- try {
29
- return await t();
30
- } catch (r) {
31
- s = r, n < e.attempts - 1 && await R(e.delayMs(n));
32
- }
33
- throw s ?? new Error("Unknown retry error");
34
- }, x = (t) => !!(t?.exp && Date.now() < t.exp), j = 3, k = (t) => Math.min(1e3 * 2 ** t, 3e4), g = {
35
- status: "idle",
36
- data: null,
37
- error: null
38
- }, C = (t) => t instanceof Error ? t : new Error(String(t)), u = M((t, e) => ({
39
- ...g,
40
- fetchInstallUrl: async () => {
41
- const s = e();
42
- if (!x(s.data) && s.status !== "loading") {
43
- t({ status: "loading", error: null });
44
- try {
45
- const n = await _(
46
- () => I({
47
- useMockResponse: !w
48
- }),
49
- {
50
- attempts: j,
51
- delayMs: k
52
- }
53
- );
54
- t({
55
- status: "success",
56
- data: n,
57
- error: null
58
- });
59
- } catch (n) {
60
- t({
61
- status: "error",
62
- error: C(n)
63
- });
64
- }
65
- }
66
- },
67
- reset: () => t(g)
68
- })), B = (t = !0) => {
69
- const e = u((o) => o.status), s = u((o) => o.data), n = u((o) => o.error), r = u(
70
- (o) => o.fetchInstallUrl
71
- );
72
- return E(() => {
73
- t && r();
74
- }, [t, r]), {
75
- status: e,
76
- data: s,
77
- error: n,
78
- fetchInstallUrl: r
79
- };
80
- };
81
- export {
82
- Y as S,
83
- u as a,
84
- M as c,
85
- w as i,
86
- B as u
87
- };