@onside/install-widget 1.0.0
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 +71 -0
- package/dist-lib/install-package.cjs +1 -0
- package/dist-lib/install-package.d.ts +67 -0
- package/dist-lib/install-package.js +3292 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Onside Install Widget
|
|
2
|
+
|
|
3
|
+
## Install package (for partner landing pages)
|
|
4
|
+
|
|
5
|
+
### From npm
|
|
6
|
+
|
|
7
|
+
Install the package and its peer dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add onside-install-widget react react-dom zustand
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Note:** You do **not** need `QueryClientProvider` or `@tanstack/react-query`. The package uses Zustand for install URL state.
|
|
14
|
+
|
|
15
|
+
### From your CDN
|
|
16
|
+
|
|
17
|
+
Upload the contents of `dist-lib/` to your CDN with the version in the path, for example:
|
|
18
|
+
|
|
19
|
+
- Base URL: `https://<your-cdn>/onside-install-widget/1.0.0/`
|
|
20
|
+
- ESM bundle: `https://<your-cdn>/onside-install-widget/1.0.0/install-package.js`
|
|
21
|
+
- CJS bundle: `https://<your-cdn>/onside-install-widget/1.0.0/install-package.cjs`
|
|
22
|
+
|
|
23
|
+
When loading from CDN, partners must also provide React, React DOM and Zustand (e.g. via import map or their own bundle).
|
|
24
|
+
|
|
25
|
+
Example — ESM in the browser with import map:
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script type="importmap">
|
|
29
|
+
{
|
|
30
|
+
"imports": {
|
|
31
|
+
"onside-install-widget": "https://<your-cdn>/onside-install-widget/1.0.0/install-package.js",
|
|
32
|
+
"react": "https://esm.sh/react@19",
|
|
33
|
+
"react-dom": "https://esm.sh/react-dom@19",
|
|
34
|
+
"react-dom/client": "https://esm.sh/react-dom@19/client",
|
|
35
|
+
"zustand": "https://esm.sh/zustand@5"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
<script type="module">
|
|
40
|
+
import { InstallAppButton } from "onside-install-widget";
|
|
41
|
+
// mount InstallAppButton in your app
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Usage (npm or CDN)
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { InstallAppButton } from "onside-install-widget";
|
|
49
|
+
|
|
50
|
+
function App() {
|
|
51
|
+
return <InstallAppButton />;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Demo / widget (IIFE)
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<!DOCTYPE html>
|
|
61
|
+
<html lang="en">
|
|
62
|
+
<head>
|
|
63
|
+
<meta charset="UTF-8">
|
|
64
|
+
<title>Title</title>
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<script src="http://localhost:4173/provider-widget.iife.js" data-selector=".install-button" data-css-href="http://localhost:4173/onside-install-widget.css"></script>
|
|
68
|
+
</body>
|
|
69
|
+
</html>
|
|
70
|
+
```
|
|
71
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),V=require("react"),et=require("zustand");function tt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const H=tt(V);function ze(e){var t,o,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(o=ze(e[t]))&&(r&&(r+=" "),r+=o)}else for(o in e)e[o]&&(r&&(r+=" "),r+=o);return r}function ot(){for(var e,t,o=0,r="",n=arguments.length;o<n;o++)(e=arguments[o])&&(t=ze(e))&&(r&&(r+=" "),r+=t);return r}const we="-",rt=e=>{const t=st(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{const p=l.split(we);return p[0]===""&&p.length!==1&&p.shift(),De(p,t)||nt(l)},getConflictingClassGroupIds:(l,p)=>{const u=o[l]||[];return p&&r[l]?[...u,...r[l]]:u}}},De=(e,t)=>{if(e.length===0)return t.classGroupId;const o=e[0],r=t.nextPart.get(o),n=r?De(e.slice(1),r):void 0;if(n)return n;if(t.validators.length===0)return;const a=e.join(we);return t.validators.find(({validator:l})=>l(a))?.classGroupId},_e=/^\[(.+)\]$/,nt=e=>{if(_e.test(e)){const t=_e.exec(e)[1],o=t?.substring(0,t.indexOf(":"));if(o)return"arbitrary.."+o}},st=e=>{const{theme:t,classGroups:o}=e,r={nextPart:new Map,validators:[]};for(const n in o)fe(o[n],r,n,t);return r},fe=(e,t,o,r)=>{e.forEach(n=>{if(typeof n=="string"){const a=n===""?t:Ee(t,n);a.classGroupId=o;return}if(typeof n=="function"){if(it(n)){fe(n(r),t,o,r);return}t.validators.push({validator:n,classGroupId:o});return}Object.entries(n).forEach(([a,l])=>{fe(l,Ee(t,a),o,r)})})},Ee=(e,t)=>{let o=e;return t.split(we).forEach(r=>{o.nextPart.has(r)||o.nextPart.set(r,{nextPart:new Map,validators:[]}),o=o.nextPart.get(r)}),o},it=e=>e.isThemeGetter,at=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=new Map,r=new Map;const n=(a,l)=>{o.set(a,l),t++,t>e&&(t=0,r=o,o=new Map)};return{get(a){let l=o.get(a);if(l!==void 0)return l;if((l=r.get(a))!==void 0)return n(a,l),l},set(a,l){o.has(a)?o.set(a,l):n(a,l)}}},be="!",ge=":",lt=ge.length,ct=e=>{const{prefix:t,experimentalParseClassName:o}=e;let r=n=>{const a=[];let l=0,p=0,u=0,g;for(let v=0;v<n.length;v++){let I=n[v];if(l===0&&p===0){if(I===ge){a.push(n.slice(u,v)),u=v+lt;continue}if(I==="/"){g=v;continue}}I==="["?l++:I==="]"?l--:I==="("?p++:I===")"&&p--}const b=a.length===0?n:n.substring(u),C=dt(b),k=C!==b,_=g&&g>u?g-u:void 0;return{modifiers:a,hasImportantModifier:k,baseClassName:C,maybePostfixModifierPosition:_}};if(t){const n=t+ge,a=r;r=l=>l.startsWith(n)?a(l.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:l,maybePostfixModifierPosition:void 0}}if(o){const n=r;r=a=>o({className:a,parseClassName:n})}return r},dt=e=>e.endsWith(be)?e.substring(0,e.length-1):e.startsWith(be)?e.substring(1):e,ut=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const n=[];let a=[];return r.forEach(l=>{l[0]==="["||t[l]?(n.push(...a.sort(),l),a=[]):a.push(l)}),n.push(...a.sort()),n}},mt=e=>({cache:at(e.cacheSize),parseClassName:ct(e),sortModifiers:ut(e),...rt(e)}),pt=/\s+/,ft=(e,t)=>{const{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:n,sortModifiers:a}=t,l=[],p=e.trim().split(pt);let u="";for(let g=p.length-1;g>=0;g-=1){const b=p[g],{isExternal:C,modifiers:k,hasImportantModifier:_,baseClassName:v,maybePostfixModifierPosition:I}=o(b);if(C){u=b+(u.length>0?" "+u:u);continue}let z=!!I,T=r(z?v.substring(0,I):v);if(!T){if(!z){u=b+(u.length>0?" "+u:u);continue}if(T=r(v),!T){u=b+(u.length>0?" "+u:u);continue}z=!1}const B=a(k).join(":"),D=_?B+be:B,N=D+T;if(l.includes(N))continue;l.push(N);const E=n(T,z);for(let S=0;S<E.length;++S){const R=E[S];l.push(D+R)}u=b+(u.length>0?" "+u:u)}return u};function bt(){let e=0,t,o,r="";for(;e<arguments.length;)(t=arguments[e++])&&(o=Ge(t))&&(r&&(r+=" "),r+=o);return r}const Ge=e=>{if(typeof e=="string")return e;let t,o="";for(let r=0;r<e.length;r++)e[r]&&(t=Ge(e[r]))&&(o&&(o+=" "),o+=t);return o};function gt(e,...t){let o,r,n,a=l;function l(u){const g=t.reduce((b,C)=>C(b),e());return o=mt(g),r=o.cache.get,n=o.cache.set,a=p,p(u)}function p(u){const g=r(u);if(g)return g;const b=ft(u,o);return n(u,b),b}return function(){return a(bt.apply(null,arguments))}}const h=e=>{const t=o=>o[e]||[];return t.isThemeGetter=!0,t},Ve=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ue=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ht=/^\d+\/\d+$/,wt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,kt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,vt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,W=e=>ht.test(e),m=e=>!!e&&!Number.isNaN(Number(e)),G=e=>!!e&&Number.isInteger(Number(e)),ue=e=>e.endsWith("%")&&m(e.slice(0,-1)),L=e=>wt.test(e),It=()=>!0,St=e=>xt.test(e)&&!kt.test(e),Fe=()=>!1,Ot=e=>yt.test(e),_t=e=>vt.test(e),Et=e=>!s(e)&&!i(e),At=e=>X(e,Ke,Fe),s=e=>Ve.test(e),F=e=>X(e,We,St),me=e=>X(e,Nt,m),Ae=e=>X(e,je,Fe),Ct=e=>X(e,Be,_t),re=e=>X(e,$e,Ot),i=e=>Ue.test(e),J=e=>Y(e,We),Tt=e=>Y(e,Pt),Ce=e=>Y(e,je),Rt=e=>Y(e,Ke),Mt=e=>Y(e,Be),ne=e=>Y(e,$e,!0),X=(e,t,o)=>{const r=Ve.exec(e);return r?r[1]?t(r[1]):o(r[2]):!1},Y=(e,t,o=!1)=>{const r=Ue.exec(e);return r?r[1]?t(r[1]):o:!1},je=e=>e==="position"||e==="percentage",Be=e=>e==="image"||e==="url",Ke=e=>e==="length"||e==="size"||e==="bg-size",We=e=>e==="length",Nt=e=>e==="number",Pt=e=>e==="family-name",$e=e=>e==="shadow",Lt=()=>{const e=h("color"),t=h("font"),o=h("text"),r=h("font-weight"),n=h("tracking"),a=h("leading"),l=h("breakpoint"),p=h("container"),u=h("spacing"),g=h("radius"),b=h("shadow"),C=h("inset-shadow"),k=h("text-shadow"),_=h("drop-shadow"),v=h("blur"),I=h("perspective"),z=h("aspect"),T=h("ease"),B=h("animate"),D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...N(),i,s],S=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],d=()=>[i,s,u],A=()=>[W,"full","auto",...d()],Z=()=>[G,"none","subgrid",i,s],q=()=>["auto",{span:["full",G,i,s]},G,i,s],M=()=>[G,"auto",i,s],ke=()=>["auto","min","max","fr",i,s],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...d()],U=()=>[W,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...d()],c=()=>[e,i,s],ye=()=>[...N(),Ce,Ae,{position:[i,s]}],ve=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ie=()=>["auto","cover","contain",Rt,At,{size:[i,s]}],ce=()=>[ue,J,F],y=()=>["","none","full",g,i,s],O=()=>["",m,J,F],Q=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],x=()=>[m,ue,Ce,Ae],Oe=()=>["","none",v,i,s],ee=()=>["none",m,i,s],te=()=>["none",m,i,s],de=()=>[m,i,s],oe=()=>[W,"full",...d()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[L],breakpoint:[L],color:[It],container:[L],"drop-shadow":[L],ease:["in","out","in-out"],font:[Et],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[L],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[L],shadow:[L],spacing:["px",m],text:[L],"text-shadow":[L],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",W,s,i,z]}],container:["container"],columns:[{columns:[m,s,i,p]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[G,"auto",i,s]}],basis:[{basis:[W,"full","auto",p,...d()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[m,W,"auto","initial","none",s]}],grow:[{grow:["",m,i,s]}],shrink:[{shrink:["",m,i,s]}],order:[{order:[G,"first","last","none",i,s]}],"grid-cols":[{"grid-cols":Z()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":Z()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ke()}],"auto-rows":[{"auto-rows":ke()}],gap:[{gap:d()}],"gap-x":[{"gap-x":d()}],"gap-y":[{"gap-y":d()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:d()}],px:[{px:d()}],py:[{py:d()}],ps:[{ps:d()}],pe:[{pe:d()}],pt:[{pt:d()}],pr:[{pr:d()}],pb:[{pb:d()}],pl:[{pl:d()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":d()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":d()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[p,"screen",...U()]}],"min-w":[{"min-w":[p,"screen","none",...U()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[l]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",o,J,F]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,i,me]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ue,s]}],"font-family":[{font:[Tt,s,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,i,s]}],"line-clamp":[{"line-clamp":[m,"none",i,me]}],leading:[{leading:[a,...d()]}],"list-image":[{"list-image":["none",i,s]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",i,s]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:c()}],"text-color":[{text:c()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:[m,"from-font","auto",i,F]}],"text-decoration-color":[{decoration:c()}],"underline-offset":[{"underline-offset":[m,"auto",i,s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:d()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",i,s]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",i,s]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ye()}],"bg-repeat":[{bg:ve()}],"bg-size":[{bg:Ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},G,i,s],radial:["",i,s],conic:[G,i,s]},Mt,Ct]}],"bg-color":[{bg:c()}],"gradient-from-pos":[{from:ce()}],"gradient-via-pos":[{via:ce()}],"gradient-to-pos":[{to:ce()}],"gradient-from":[{from:c()}],"gradient-via":[{via:c()}],"gradient-to":[{to:c()}],rounded:[{rounded:y()}],"rounded-s":[{"rounded-s":y()}],"rounded-e":[{"rounded-e":y()}],"rounded-t":[{"rounded-t":y()}],"rounded-r":[{"rounded-r":y()}],"rounded-b":[{"rounded-b":y()}],"rounded-l":[{"rounded-l":y()}],"rounded-ss":[{"rounded-ss":y()}],"rounded-se":[{"rounded-se":y()}],"rounded-ee":[{"rounded-ee":y()}],"rounded-es":[{"rounded-es":y()}],"rounded-tl":[{"rounded-tl":y()}],"rounded-tr":[{"rounded-tr":y()}],"rounded-br":[{"rounded-br":y()}],"rounded-bl":[{"rounded-bl":y()}],"border-w":[{border:O()}],"border-w-x":[{"border-x":O()}],"border-w-y":[{"border-y":O()}],"border-w-s":[{"border-s":O()}],"border-w-e":[{"border-e":O()}],"border-w-t":[{"border-t":O()}],"border-w-r":[{"border-r":O()}],"border-w-b":[{"border-b":O()}],"border-w-l":[{"border-l":O()}],"divide-x":[{"divide-x":O()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":O()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Q(),"hidden","none"]}],"divide-style":[{divide:[...Q(),"hidden","none"]}],"border-color":[{border:c()}],"border-color-x":[{"border-x":c()}],"border-color-y":[{"border-y":c()}],"border-color-s":[{"border-s":c()}],"border-color-e":[{"border-e":c()}],"border-color-t":[{"border-t":c()}],"border-color-r":[{"border-r":c()}],"border-color-b":[{"border-b":c()}],"border-color-l":[{"border-l":c()}],"divide-color":[{divide:c()}],"outline-style":[{outline:[...Q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[m,i,s]}],"outline-w":[{outline:["",m,J,F]}],"outline-color":[{outline:c()}],shadow:[{shadow:["","none",b,ne,re]}],"shadow-color":[{shadow:c()}],"inset-shadow":[{"inset-shadow":["none",C,ne,re]}],"inset-shadow-color":[{"inset-shadow":c()}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:c()}],"ring-offset-w":[{"ring-offset":[m,F]}],"ring-offset-color":[{"ring-offset":c()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":c()}],"text-shadow":[{"text-shadow":["none",k,ne,re]}],"text-shadow-color":[{"text-shadow":c()}],opacity:[{opacity:[m,i,s]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[m]}],"mask-image-linear-from-pos":[{"mask-linear-from":x()}],"mask-image-linear-to-pos":[{"mask-linear-to":x()}],"mask-image-linear-from-color":[{"mask-linear-from":c()}],"mask-image-linear-to-color":[{"mask-linear-to":c()}],"mask-image-t-from-pos":[{"mask-t-from":x()}],"mask-image-t-to-pos":[{"mask-t-to":x()}],"mask-image-t-from-color":[{"mask-t-from":c()}],"mask-image-t-to-color":[{"mask-t-to":c()}],"mask-image-r-from-pos":[{"mask-r-from":x()}],"mask-image-r-to-pos":[{"mask-r-to":x()}],"mask-image-r-from-color":[{"mask-r-from":c()}],"mask-image-r-to-color":[{"mask-r-to":c()}],"mask-image-b-from-pos":[{"mask-b-from":x()}],"mask-image-b-to-pos":[{"mask-b-to":x()}],"mask-image-b-from-color":[{"mask-b-from":c()}],"mask-image-b-to-color":[{"mask-b-to":c()}],"mask-image-l-from-pos":[{"mask-l-from":x()}],"mask-image-l-to-pos":[{"mask-l-to":x()}],"mask-image-l-from-color":[{"mask-l-from":c()}],"mask-image-l-to-color":[{"mask-l-to":c()}],"mask-image-x-from-pos":[{"mask-x-from":x()}],"mask-image-x-to-pos":[{"mask-x-to":x()}],"mask-image-x-from-color":[{"mask-x-from":c()}],"mask-image-x-to-color":[{"mask-x-to":c()}],"mask-image-y-from-pos":[{"mask-y-from":x()}],"mask-image-y-to-pos":[{"mask-y-to":x()}],"mask-image-y-from-color":[{"mask-y-from":c()}],"mask-image-y-to-color":[{"mask-y-to":c()}],"mask-image-radial":[{"mask-radial":[i,s]}],"mask-image-radial-from-pos":[{"mask-radial-from":x()}],"mask-image-radial-to-pos":[{"mask-radial-to":x()}],"mask-image-radial-from-color":[{"mask-radial-from":c()}],"mask-image-radial-to-color":[{"mask-radial-to":c()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[m]}],"mask-image-conic-from-pos":[{"mask-conic-from":x()}],"mask-image-conic-to-pos":[{"mask-conic-to":x()}],"mask-image-conic-from-color":[{"mask-conic-from":c()}],"mask-image-conic-to-color":[{"mask-conic-to":c()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ye()}],"mask-repeat":[{mask:ve()}],"mask-size":[{mask:Ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",i,s]}],filter:[{filter:["","none",i,s]}],blur:[{blur:Oe()}],brightness:[{brightness:[m,i,s]}],contrast:[{contrast:[m,i,s]}],"drop-shadow":[{"drop-shadow":["","none",_,ne,re]}],"drop-shadow-color":[{"drop-shadow":c()}],grayscale:[{grayscale:["",m,i,s]}],"hue-rotate":[{"hue-rotate":[m,i,s]}],invert:[{invert:["",m,i,s]}],saturate:[{saturate:[m,i,s]}],sepia:[{sepia:["",m,i,s]}],"backdrop-filter":[{"backdrop-filter":["","none",i,s]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[m,i,s]}],"backdrop-contrast":[{"backdrop-contrast":[m,i,s]}],"backdrop-grayscale":[{"backdrop-grayscale":["",m,i,s]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m,i,s]}],"backdrop-invert":[{"backdrop-invert":["",m,i,s]}],"backdrop-opacity":[{"backdrop-opacity":[m,i,s]}],"backdrop-saturate":[{"backdrop-saturate":[m,i,s]}],"backdrop-sepia":[{"backdrop-sepia":["",m,i,s]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":d()}],"border-spacing-x":[{"border-spacing-x":d()}],"border-spacing-y":[{"border-spacing-y":d()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",i,s]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[m,"initial",i,s]}],ease:[{ease:["linear","initial",T,i,s]}],delay:[{delay:[m,i,s]}],animate:[{animate:["none",B,i,s]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[I,i,s]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[i,s,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],accent:[{accent:c()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:c()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",i,s]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":d()}],"scroll-mx":[{"scroll-mx":d()}],"scroll-my":[{"scroll-my":d()}],"scroll-ms":[{"scroll-ms":d()}],"scroll-me":[{"scroll-me":d()}],"scroll-mt":[{"scroll-mt":d()}],"scroll-mr":[{"scroll-mr":d()}],"scroll-mb":[{"scroll-mb":d()}],"scroll-ml":[{"scroll-ml":d()}],"scroll-p":[{"scroll-p":d()}],"scroll-px":[{"scroll-px":d()}],"scroll-py":[{"scroll-py":d()}],"scroll-ps":[{"scroll-ps":d()}],"scroll-pe":[{"scroll-pe":d()}],"scroll-pt":[{"scroll-pt":d()}],"scroll-pr":[{"scroll-pr":d()}],"scroll-pb":[{"scroll-pb":d()}],"scroll-pl":[{"scroll-pl":d()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",i,s]}],fill:[{fill:["none",...c()]}],"stroke-w":[{stroke:[m,J,F,me]}],stroke:[{stroke:["none",...c()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},zt=gt(Lt);function j(...e){return zt(ot(e))}const Dt={primary:"rounded-full whitespace-nowrap leading-none !font-medium transition-bg duration-300 flex items-center justify-center text-center",secondary:"rounded-full whitespace-nowrap leading-none !font-medium bg-transparent border transition-bg transition-color duration-300 flex items-center justify-center text-center",text:"whitespace-nowrap leading-none !font-medium transition-colors duration-300 flex items-center justify-center text-center",transparent:"rounded-full whitespace-nowrap leading-none !font-medium transition-opacity duration-300 flex items-center justify-center text-center"},Gt={primary:{blue:"bg-blue text-white hover:bg-buttonHover focus:bg-blue disabled:bg-buttonDisabled",lightBlue:"bg-[#e2eaf8] text-blue hover:opacity-60 focus:opacity-100",white:"bg-white text-blue hover:opacity-90 focus:opacity-100 disabled:opacity-50"},secondary:{blue:"border-blue text-blue hover:bg-blue hover:text-white focus:bg-blue focus:text-white",lightBlue:"border-[#e2eaf8] text-[#e2eaf8] hover:bg-[#e2eaf8] hover:text-white focus:bg-[#e2eaf8] focus:text-white",white:"border-white text-white hover:bg-white hover:text-blue focus:bg-white focus:text-blue"},text:{blue:"bg-transparent text-blue hover:underline focus:underline",lightBlue:"bg-transparent text-[#e2eaf8] hover:underline focus:underline",white:"bg-transparent text-white hover:underline focus:underline"},transparent:{blue:"bg-transparent text-blue hover:opacity-75",lightBlue:"bg-transparent text-[#e2eaf8] hover:opacity-75",white:"bg-transparent text-white hover:opacity-75"}},Vt={lg:"py-4 px-8 text-button-l",md:"py-3 px-5 text-button-m"};function ae({className:e,...t}){const o=t.variant??"primary",r=t.color??"blue",n=t.size??"md",a=j(Dt[o],Vt[o!=="text"?n:"md"],Gt[o][r],e);if(typeof t.href>"u"){const g=t;return w.jsx("button",{className:a,...g})}const{purelink:l,...p}=t,u=("rel"in p?p.rel:void 0)??(p.target==="_blank"?"noopener noreferrer":void 0);return w.jsx("a",{className:a,rel:u,...p})}const Ut="https://onside.io/web-api/v1/marketplace/install",xe=1e3,Ft=e=>{if(typeof document>"u")return null;const t=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`));if(!t)return null;const o=t.indexOf("=");return o!==-1?t.slice(o+1):null},Te=(e,t,o)=>{if(typeof document>"u")return;const r=new Date(Date.now()+o*1e3),n=typeof window<"u"&&window.location?.protocol==="https:"?"; Secure":"";document.cookie=`${e}=${t}; expires=${r.toUTCString()}; path=/; SameSite=Lax${n}`},jt=7*xe,Bt=7*xe,He=2*xe,he="onside_token_data",Re=15552e3,Kt=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("Secure random UUID generation is not available");const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,o=>o.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`},Xe=()=>{const e=Ft(he);if(!e)return null;try{return JSON.parse(decodeURIComponent(e)).token}catch{return null}},Wt=()=>{const e=Xe();if(e){const r={token:e,createdAt:Date.now()};return Te(he,encodeURIComponent(JSON.stringify(r)),Re),e}const t=Kt(),o={token:t,createdAt:Date.now()};return Te(he,encodeURIComponent(JSON.stringify(o)),Re),t},$t=async e=>{const t=await fetch(Ut,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({referer_url:window.location.href,onside_token:e})});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const o=await t.json();if(!o.url||!o.attribution_token||!o.exp)throw new Error("Invalid response format");return o},Ht=async()=>{const t=Xe()||Wt(),o=await $t(t);return{installUrl:o.url,attribution_token:o.attribution_token,is_eligible:o.is_eligible,onside_token:t}},Me=3,Xt=e=>Math.min(1e3*2**e,3e4),pe={installUrl:null,attribution_token:null,isEligible:null,onside_token:null,isLoading:!1,error:null},Yt=et.create((e,t)=>({...pe,fetchInstallData:async()=>{if(t().isLoading)return;e({isLoading:!0,error:null});let o=null;for(let r=0;r<Me;r++)try{const n=await Ht();e({...pe,installUrl:n.installUrl,attribution_token:n.attribution_token,isEligible:n.is_eligible,onside_token:n.onside_token,isLoading:!1,error:null});return}catch(n){o=n instanceof Error?n:new Error(String(n)),r<Me-1&&await new Promise(a=>setTimeout(a,Xt(r)))}e({isLoading:!1,error:o})},reset:()=>e(pe)})),Ye=(e=!0)=>{const{installUrl:t,attribution_token:o,isEligible:r,onside_token:n,isLoading:a,error:l,fetchInstallData:p}=Yt(),u=V.useRef(!1);return V.useEffect(()=>{e&&!u.current&&(u.current=!0,p())},[e,p]),{installUrl:t,attribution_token:o,isEligible:r,onside_token:n,isLoading:a,error:l,fetchInstallData:p}},ie={IOS:/iPhone|iPad|iPod/i,IPAD:/iPad/i,ANDROID:/Android/i,INTEL_MAC:/Intel Mac/i},f={IOS_CHROME:/CriOS/i,IOS_FIREFOX:/FxiOS/i,IOS_EDGE:/EdgiOS/i,IOS_OPERA:/OPiOS/i,IOS_OPERA_NEW:/OPT\//i,IOS_BRAVE:/Brave\//i,IOS_DUCKDUCKGO:/Ddg\//i,IOS_GOOGLE_APP:/GSA/i,SAFARI:/Safari/i,CHROME:/Chrome|CriOS/i,FIREFOX:/Firefox|FxiOS/i,EDGE:/Edge|Edg/i,OPERA:/Opera|OPiOS|OPT\/|OPR\/|OPX\//i},se={IOS_VERSION:/Version\/(\d+[_\.\d]*)/,IOS_OS:/(?:iPhone|iPad|iPod).*?OS (\d+[_\.\d]*)/i,ANDROID_VERSION:/Android\s+(\d+[\.\d]*)/,MACOS_VERSION:/Mac OS X (\d+[_\.\d]*)/i},Ne={MOBILE:/Mobile/i,ANDROID_TABLET_KEYWORDS:/Tablet|SM-T|SM-P|GT-P|SCH-I|SCH-T/i},$={IOS_INSTAGRAM:/\bInstagram\b/i,IOS_FACEBOOK:/\bFBAN\/FBIOS\b|\bFBAV\b/i,IOS_LINKEDIN:/LinkedInApp/i,IOS_DISCORD:/\bDiscord\b/i,IOS_TWITTER:/Twitter for iPhone/i,IOS_TIKTOK:/\bTikTok\b/i},qt=768,Jt=()=>typeof window<"u"&&("ontouchstart"in window||window.navigator?.maxTouchPoints>0||window.navigator?.msMaxTouchPoints>0),Zt=()=>typeof window>"u"?"":window.navigator.userAgent,Qt=e=>{if(ie.IOS.test(e)){const t=ie.IPAD.test(e);return{platform:"ios",isMobile:!t,isTablet:t,isDesktop:!1}}if(ie.ANDROID.test(e)){const t=Ne.MOBILE.test(e)&&(window.innerWidth>=qt||Ne.ANDROID_TABLET_KEYWORDS.test(e));return{platform:"android",isMobile:!t,isTablet:t,isDesktop:!1}}return eo(e)?{platform:"ios",isMobile:!1,isTablet:!0,isDesktop:!1}:f.IOS_GOOGLE_APP.test(e)?{platform:"ios",isMobile:!0,isTablet:!1,isDesktop:!1}:{platform:"desktop",isMobile:!1,isTablet:!1,isDesktop:!0}},eo=e=>f.SAFARI.test(e)&&ie.INTEL_MAC.test(e)&&!f.CHROME.test(e)&&!f.FIREFOX.test(e)&&!f.OPERA.test(e)?Jt():!1,Pe=()=>typeof window?.TelegramWebviewProxy<"u",to=e=>{const t=(...o)=>o.some(r=>r.test(e));return t(f.IOS_EDGE,f.EDGE)?"edge":t(f.IOS_OPERA,f.IOS_OPERA_NEW,f.OPERA)?"opera":t(f.IOS_BRAVE)?"brave":t(f.IOS_DUCKDUCKGO)?"duckduckgo":t(f.IOS_CHROME,f.CHROME)?"chrome":t(f.IOS_GOOGLE_APP)?"google":t(f.IOS_FIREFOX,f.FIREFOX)?"firefox":f.SAFARI.test(e)&&!f.CHROME.test(e)&&!f.FIREFOX.test(e)&&!f.OPERA.test(e)&&!f.IOS_BRAVE.test(e)&&!f.IOS_DUCKDUCKGO.test(e)&&!f.IOS_GOOGLE_APP.test(e)&&!Pe()?"safari":t($.IOS_INSTAGRAM,$.IOS_FACEBOOK,$.IOS_LINKEDIN,$.IOS_DISCORD,$.IOS_TWITTER,$.IOS_TIKTOK)||Pe()?"in-app":"unknown"},oo=(e,t)=>{switch(t){case"ios":{let o=e.match(se.IOS_OS);if(o||(o=e.match(se.IOS_VERSION)),o){const r=o[1].replace(/_/g,".");return parseFloat(r)}return}case"android":{const o=e.match(se.ANDROID_VERSION);return o?parseFloat(o[1]):void 0}case"desktop":{const o=e.match(se.MACOS_VERSION);if(o){const r=o[1].replace(/_/g,".");return parseFloat(r)}return}default:return}},ro={platform:"unknown",browser:"unknown",isMobile:!1,isTablet:!1,isDesktop:!1,version:void 0,userAgent:""};function qe(){if(typeof window>"u")return ro;const e=Zt(),t=Qt(e),o=to(e),r=oo(e,t.platform);return{...t,browser:o,version:r,userAgent:e}}const Le=17.6,no=18.6,so=["safari","chrome","edge","brave","duckduckgo"];function io(e){return e.platform==="ios"&&(e.isMobile||e.isTablet)?so.includes(e.browser):!1}function ao(e){return!!(e.platform==="ios"&&e.version&&e.version>=no)}const Je=()=>{const e=qe(),t=io(e),o=!!(e.platform==="ios"&&e.version&&e.version>=Le),r=!!(e.platform==="ios"&&e.version&&e.version<Le),n=e.platform==="ios"&&(e.isMobile||e.isTablet)&&!r&&!t,a=ao(e),l=o&&t,p=e.platform==="android";return{canInstall:l,shouldGoToSafari:n,shouldUpdateIOS:r,isIOS186PlusVersion:a,isAndroid:p}};function Ze(e,t={},o){try{if(typeof window>"u")return;window.dataLayer||(window.dataLayer=[]);const r={...t,...qe()};window.dataLayer.push({event:"amplitude_event",event_name:e,event_properties:{timestamp:Date.now(),...r},...o?{user_properties:o}:{}}),console.log("🎯 Analytics Event:",{event_name:e,event_properties:{timestamp:new Date().toISOString(),...r},user_properties:o,url:window.location.href})}catch(r){console.error("Analytics error:",r)}}function lo(e,t,o,r={}){const n=`${e}.${t}`,a={modal_name:e,event_type:t,...r};a.action=o,Ze(n,a)}const co={INSTALL_BUTTON_CLICK:"install_button_click"},Qe=(e={})=>({trackInstallEvent:r=>{Ze(co.INSTALL_BUTTON_CLICK,{...e,event_type:r})},trackOpenModalEvent:r=>{lo(r,"opened","install_button",{...e})}}),uo=e=>H.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},H.createElement("path",{d:"M12.1268 5.74646C11.3368 5.74646 10.1139 4.84824 8.82613 4.88071C7.12708 4.90235 5.56872 5.8655 4.69214 7.39139C2.92817 10.454 4.23762 14.9776 5.95831 17.4667C6.80243 18.6787 7.79805 20.0423 9.11832 19.999C10.3845 19.9449 10.8607 19.1765 12.3974 19.1765C13.9233 19.1765 14.3562 19.999 15.6981 19.9665C17.0617 19.9449 17.9274 18.7328 18.7607 17.5099C19.7239 16.1031 20.1243 14.7395 20.1459 14.6638C20.1134 14.653 17.4945 13.6465 17.4621 10.6164C17.4404 8.084 19.5291 6.87195 19.6265 6.81784C18.436 5.0755 16.6071 4.88071 15.9686 4.83742C14.3021 4.70755 12.906 5.74646 12.1268 5.74646ZM14.9406 3.19248C15.644 2.34837 16.1093 1.16877 15.9795 0C14.973 0.0432878 13.761 0.670965 13.0359 1.51508C12.3866 2.26179 11.8238 3.46303 11.9753 4.61016C13.09 4.69673 14.2371 4.03659 14.9406 3.19248Z",fill:"currentColor"})),mo=({className:e,onClick:t,children:o,id:r,androidClassName:n,androidTextClassName:a})=>w.jsx(ae,{id:r,className:j("bg-white px-7",e,n),variant:"secondary",size:"lg",onClick:t,children:w.jsxs("span",{className:"flex flex-row items-center gap-1",children:[w.jsx(uo,{className:a?"text-[#FF465D]":void 0}),w.jsx("span",{className:j("flex-1",a),children:o})]})}),po=({href:e,onClick:t,children:o,className:r,id:n})=>w.jsx(ae,{id:n,href:e,purelink:!0,size:"lg",onClick:t,className:r,children:o}),fo=e=>H.createElement("svg",{stroke:"customColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...e},H.createElement("style",null,".spinner_V8m1{transform-origin:center;animation:spinner_zKoa 2s linear infinite}.spinner_V8m1 circle{stroke-linecap:round;animation:spinner_YpZS 1.5s ease-in-out infinite}@keyframes spinner_zKoa{100%{transform:rotate(360deg)}}@keyframes spinner_YpZS{0%{stroke-dasharray:0 150;stroke-dashoffset:0}47.5%{stroke-dasharray:42 150;stroke-dashoffset:-16}95%,100%{stroke-dasharray:42 150;stroke-dashoffset:-59}}"),H.createElement("g",{className:"spinner_V8m1"},H.createElement("circle",{cx:12,cy:12,r:9.5,fill:"none",strokeWidth:3}))),bo=e=>{const{id:t,className:o,children:r="Loading...",showLoaderOnly:n}=e;return w.jsx(ae,{id:t,className:j("px-8 py-4",o),disabled:!0,children:w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(fo,{className:"size-5 animate-spin stroke-blue"}),!n&&r]})})},go=()=>w.jsx("p",{className:"mt-2 text-center text-sm text-red-600",children:"Unable to load install link. Please try again."}),ho=e=>{const{className:t,children:o="Install Onside",handleCustomStep:r,location:n="hero",caption:a,showCaption:l=!0,showLoaderOnly:p=!1,androidClassName:u,androidTextClassName:g,id:b}=e,C=typeof window<"u"?window.location.pathname:"",k=Je();console.log("conditions",k);const{installUrl:_,error:v,onside_token:I,attribution_token:z,isEligible:T}=Ye(k.canInstall);console.log("installUrl",_);const[B,D]=V.useState(!1),N=V.useCallback(()=>{D(!0);const M=setTimeout(()=>{D(!1),clearTimeout(M)},He)},[]),E=M=>{console.log("openModal",M)},{trackOpenModalEvent:S,trackInstallEvent:R}=Qe({page:C,location:n,onside_token:I??void 0,attribution_token:z??void 0}),d=V.useCallback(M=>{if(!_){M.preventDefault();return}if(r){r();return}R(k.isIOS186PlusVersion?"ios_18_6_plus":"install_click"),window.location.href=_},[_,r,k.isIOS186PlusVersion,R]),A=V.useCallback(()=>{if(N(),k.shouldGoToSafari){S("go_to_safari"),E("goToSafari");return}if(k.shouldUpdateIOS){S("update_ios"),E("updateIOS");return}R("no_condition_matched")},[N,k.shouldGoToSafari,k.shouldUpdateIOS,S,E,R]),Z=V.useCallback(()=>{S("is_android"),E("isAndroid")},[E,S]),q=l&&(!T||a)&&w.jsx("div",{className:"text-2xs font-mono opacity-60",children:T?a:"Only available in the EU. Install from an eligible region."});return k.isAndroid?w.jsx(mo,{id:b,className:t,androidClassName:u,androidTextClassName:g,onClick:Z,children:"Onside is for iPhone and iPad"}):B?w.jsx(bo,{showLoaderOnly:p,id:b,className:j("bg-buttonHover!",t)}):_&&k.canInstall?w.jsxs(w.Fragment,{children:[w.jsxs(po,{id:b,className:j(t,"flex-col gap-1"),href:_,onClick:d,children:[o,q]}),v&&w.jsx(go,{})]}):w.jsxs(ae,{id:b,className:j(t,"flex-col gap-1"),size:"lg",onClick:A,children:[o,q]})};exports.AVERAGE_CHECK_TIME=Bt;exports.AVERAGE_INSTALL_TIME=jt;exports.AVERAGE_LOADING_TIME=He;exports.InstallAppButton=ho;exports.createInstallAnalyticsHandler=Qe;exports.useInstallConditions=Je;exports.useInstallUrl=Ye;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
export declare const AVERAGE_CHECK_TIME: number;
|
|
6
|
+
|
|
7
|
+
export declare const AVERAGE_INSTALL_TIME: number;
|
|
8
|
+
|
|
9
|
+
export declare const AVERAGE_LOADING_TIME: number;
|
|
10
|
+
|
|
11
|
+
declare type ButtonLocation = "hero" | "header" | "fixed_bottom" | "install_guide" | "get_approved" | "go_to_safari" | "update_ios" | "unavailable_outside_eu" | "debug";
|
|
12
|
+
|
|
13
|
+
export declare const createInstallAnalyticsHandler: (analyticsProps?: Record<string, unknown>) => {
|
|
14
|
+
trackInstallEvent: (eventType: string) => void;
|
|
15
|
+
trackOpenModalEvent: (modalName: string) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export declare const InstallAppButton: (props: PropsWithChildren<InstallAppButtonProps>) => JSX.Element;
|
|
19
|
+
|
|
20
|
+
export declare interface InstallAppButtonProps {
|
|
21
|
+
className?: string;
|
|
22
|
+
androidClassName?: string;
|
|
23
|
+
androidTextClassName?: string;
|
|
24
|
+
handleCustomStep?: () => void;
|
|
25
|
+
onClick?: (e: MouseEvent_2) => void;
|
|
26
|
+
location?: ButtonLocation;
|
|
27
|
+
caption?: string;
|
|
28
|
+
showCaption?: boolean;
|
|
29
|
+
id?: string;
|
|
30
|
+
showLoaderOnly?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Optional CDN URLs for install modals media.
|
|
35
|
+
* When not provided, modals render without video (text + buttons only).
|
|
36
|
+
*/
|
|
37
|
+
export declare interface InstallMediaUrls {
|
|
38
|
+
/** URL for Update IOS modal video (e.g. CDN). Omit to hide video. */
|
|
39
|
+
updateIosVideoUrl?: string;
|
|
40
|
+
/** URL for Update IOS modal poster image. Omit to hide video. */
|
|
41
|
+
updateIosPosterUrl?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare interface InstallModalBaseProps {
|
|
45
|
+
open: boolean;
|
|
46
|
+
onClose: () => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export declare const useInstallConditions: () => {
|
|
50
|
+
canInstall: boolean;
|
|
51
|
+
shouldGoToSafari: boolean;
|
|
52
|
+
shouldUpdateIOS: boolean;
|
|
53
|
+
isIOS186PlusVersion: boolean;
|
|
54
|
+
isAndroid: boolean;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export declare const useInstallUrl: (isAvailable?: boolean) => {
|
|
58
|
+
installUrl: string | null;
|
|
59
|
+
attribution_token: string | null;
|
|
60
|
+
isEligible: boolean | null;
|
|
61
|
+
onside_token: string | null;
|
|
62
|
+
isLoading: boolean;
|
|
63
|
+
error: Error | null;
|
|
64
|
+
fetchInstallData: () => Promise<void>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { }
|