@onside/install-widget 1.0.0 → 1.0.2

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.
@@ -0,0 +1,85 @@
1
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
+ import { g as k, t as p, B as d, c as w } from "./install-package-CyWo-B7v.js";
3
+ import * as m from "react";
4
+ import { useState as b, useCallback as a, useMemo as y } from "react";
5
+ import { D as C } from "./Dialog-DXOEeh8t.js";
6
+ const v = 5e3, S = (n) => {
7
+ const [o, e] = b(!1);
8
+ return {
9
+ handleCopy: a(() => {
10
+ navigator.clipboard.writeText(n), e(!0), setTimeout(() => e(!1), v);
11
+ }, [n]),
12
+ isCopied: o
13
+ };
14
+ }, N = (n) => /* @__PURE__ */ m.createElement("svg", { width: 10, height: 16, viewBox: "0 0 10 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ m.createElement("path", { d: "M3.9375 12.25L6.35539 9.83211C6.74592 9.44158 6.74592 8.80842 6.35539 8.41789L3.9375 6", stroke: "#1E1C1F", strokeOpacity: 0.6, strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })), D = ({
15
+ open: n,
16
+ onClose: o
17
+ }) => {
18
+ const e = typeof window < "u" ? window.location.href.replace(/\/$/, "") : "", s = y(() => {
19
+ const [i] = e.replace(/^https?:\/\//, "").split(/[?#]/);
20
+ return i?.replace(/\/$/, "") ?? "";
21
+ }, [e]), { handleCopy: l, isCopied: c } = S(e), f = k(), x = f.browser === "opera" && f.platform === "ios", h = a(
22
+ (i) => {
23
+ i || o();
24
+ },
25
+ [o]
26
+ ), g = a(() => {
27
+ p("go_to_safari", "click", "button"), window.location.href = `x-safari-${e}`;
28
+ }, [e]), u = a(() => {
29
+ p("go_to_safari", "click", "link"), l();
30
+ }, [l]);
31
+ return /* @__PURE__ */ t(
32
+ C,
33
+ {
34
+ "aria-labelledby": "go-to-safari-modal",
35
+ isDisplayingMargins: !0,
36
+ open: n,
37
+ onOpenChange: h,
38
+ showCloseButton: !1,
39
+ onBackClick: o,
40
+ children: /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col items-center justify-center", children: [
41
+ /* @__PURE__ */ t("h1", { className: "mt-8 text-center font-sans text-5xl font-medium", children: "Open in Safari" }),
42
+ /* @__PURE__ */ t("p", { className: "text-tertiary mt-5 w-11/12 text-center font-sans text-lg font-normal", children: "Copy the link and open it in Safari to continue." }),
43
+ /* @__PURE__ */ t("p", { className: "text-tertiary w-11/12 text-center font-sans text-lg font-normal", children: "Onside can only be installed from the Safari browser on your device." }),
44
+ /* @__PURE__ */ r("div", { className: "mt-10 flex w-full flex-col items-center gap-5", children: [
45
+ !x && /* @__PURE__ */ r(
46
+ d,
47
+ {
48
+ className: "flex min-w-[206px] items-center justify-center gap-[6px] font-sans text-lg font-normal text-white!",
49
+ onClick: g,
50
+ size: "lg",
51
+ children: [
52
+ "Open in Safari",
53
+ /* @__PURE__ */ t(N, {})
54
+ ]
55
+ }
56
+ ),
57
+ /* @__PURE__ */ t(
58
+ d,
59
+ {
60
+ className: "flex min-w-[206px] items-center justify-center gap-[6px] font-sans text-lg font-normal",
61
+ onClick: u,
62
+ size: "lg",
63
+ variant: "text",
64
+ children: c ? "Link copied" : s
65
+ }
66
+ )
67
+ ] }),
68
+ /* @__PURE__ */ t(
69
+ "p",
70
+ {
71
+ className: w(
72
+ "relative mt-3 rounded-xl bg-black px-4 py-3 font-sans text-xs font-normal text-white transition-[opacity,transform] duration-300",
73
+ "before:absolute before:-top-1 before:left-1/2 before:block before:size-2 before:-translate-x-1/2 before:rotate-45 before:rounded-xs before:bg-black",
74
+ c ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"
75
+ ),
76
+ children: "Paste the link in Safari"
77
+ }
78
+ )
79
+ ] })
80
+ }
81
+ );
82
+ };
83
+ export {
84
+ D as GoToSafariModal
85
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("./install-package-q3ncGygt.cjs"),o=require("react"),g=require("./Dialog-D53Br-Xy.cjs");function h(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const d=h(o),b=5e3,k=t=>{const[a,e]=o.useState(!1);return{handleCopy:o.useCallback(()=>{navigator.clipboard.writeText(t),e(!0),setTimeout(()=>e(!1),b)},[t]),isCopied:a}},y=t=>d.createElement("svg",{width:10,height:16,viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},d.createElement("path",{d:"M3.9375 12.25L6.35539 9.83211C6.74592 9.44158 6.74592 8.80842 6.35539 8.41789L3.9375 6",stroke:"#1E1C1F",strokeOpacity:.6,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),w=({open:t,onClose:a})=>{const e=typeof window<"u"?window.location.href.replace(/\/$/,""):"",s=o.useMemo(()=>{const[i]=e.replace(/^https?:\/\//,"").split(/[?#]/);return i?.replace(/\/$/,"")??""},[e]),{handleCopy:l,isCopied:c}=k(e),f=r.getDeviceInfo(),p=f.browser==="opera"&&f.platform==="ios",u=o.useCallback(i=>{i||a()},[a]),x=o.useCallback(()=>{r.trackModalEvent("go_to_safari","click","button"),window.location.href=`x-safari-${e}`},[e]),m=o.useCallback(()=>{r.trackModalEvent("go_to_safari","click","link"),l()},[l]);return n.jsx(g.Dialog,{"aria-labelledby":"go-to-safari-modal",isDisplayingMargins:!0,open:t,onOpenChange:u,showCloseButton:!1,onBackClick:a,children:n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center",children:[n.jsx("h1",{className:"mt-8 text-center font-sans text-5xl font-medium",children:"Open in Safari"}),n.jsx("p",{className:"text-tertiary mt-5 w-11/12 text-center font-sans text-lg font-normal",children:"Copy the link and open it in Safari to continue."}),n.jsx("p",{className:"text-tertiary w-11/12 text-center font-sans text-lg font-normal",children:"Onside can only be installed from the Safari browser on your device."}),n.jsxs("div",{className:"mt-10 flex w-full flex-col items-center gap-5",children:[!p&&n.jsxs(r.Button,{className:"flex min-w-[206px] items-center justify-center gap-[6px] font-sans text-lg font-normal text-white!",onClick:x,size:"lg",children:["Open in Safari",n.jsx(y,{})]}),n.jsx(r.Button,{className:"flex min-w-[206px] items-center justify-center gap-[6px] font-sans text-lg font-normal",onClick:m,size:"lg",variant:"text",children:c?"Link copied":s})]}),n.jsx("p",{className:r.clsx("relative mt-3 rounded-xl bg-black px-4 py-3 font-sans text-xs font-normal text-white transition-[opacity,transform] duration-300","before:absolute before:-top-1 before:left-1/2 before:block before:size-2 before:-translate-x-1/2 before:rotate-45 before:rounded-xs before:bg-black",c?"translate-y-0 opacity-100":"-translate-y-2 opacity-0"),children:"Paste the link in Safari"})]})})};exports.GoToSafariModal=w;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),a=require("react"),d=require("./install-package-q3ncGygt.cjs"),m=require("./Dialog-D53Br-Xy.cjs"),v="data:image/svg+xml,%3csvg%20width='10'%20height='16'%20viewBox='0%200%2010%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.9375%2012.25L6.35539%209.83211C6.74592%209.44158%206.74592%208.80842%206.35539%208.41789L3.9375%206'%20stroke='%231E1C1F'%20stroke-opacity='0.6'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",f=({breadcrumbs:e,className:t})=>i.jsx("ul",{className:t,children:e.map((n,r)=>i.jsxs("li",{className:"inline-flex",children:[i.jsx("p",{className:"rounded-3xl bg-lightGray px-2 py-0.5 text-sm",children:n}),r<e.length-1&&i.jsx("img",{alt:"Arrow icon","aria-hidden":"true",className:"ml-1",height:16,src:v,width:10})]},n))}),h=e=>{const{ariaLabel:t,children:n,className:r,poster:s}=e,o=a.useRef(null);return a.useEffect(()=>{const l=()=>{o.current&&o.current.paused&&(o.current.muted=!0,o.current.play())},c=()=>{o.current&&(document.visibilityState==="hidden"?o.current.pause():document.visibilityState==="visible"&&l())},u=()=>{o.current&&o.current.pause()};return document.addEventListener("visibilitychange",c),window.addEventListener("focus",l),window.addEventListener("blur",u),()=>{document.removeEventListener("visibilitychange",c),window.removeEventListener("focus",l),window.removeEventListener("blur",u)}},[]),i.jsx("video",{"aria-label":t,autoPlay:!0,className:d.clsx("mt-2 transform-gpu rounded-2xl object-contain object-top",r),controls:!1,disablePictureInPicture:!0,disableRemotePlayback:!0,draggable:!1,loop:!0,muted:!0,playsInline:!0,poster:s,ref:o,"webkit-playsinline":"true","x-webkit-airplay":"deny",children:n},t)},p={"images/.gitkeep":"images/.gitkeep.e3b0c442","images/install-sad-android.png":"images/install-sad-android.8b24a6e1.png","scripts/1.0.0/install-package.cjs":"scripts/1.0.0/install-package.7ac30417.cjs","scripts/1.0.0/install-package.js":"scripts/1.0.0/install-package.65685adc.js","video/.gitkeep":"video/.gitkeep.e3b0c442","video/change-region-poster.png":"video/change-region-poster.bc6bda65.png","video/change-region.h264.mp4":"video/change-region.h264.c47b9282.mp4","video/get-approved-poster.jpg":"video/get-approved-poster.4e7177ac.jpg","video/get-approved.mp4":"video/get-approved.5b7b5f4a.mp4","video/open-onside-poster.jpg":"video/open-onside-poster.6b71cae6.jpg","video/open-onside.av1.mp4":"video/open-onside.av1.32f1aa51.mp4","video/open-onside.h264.mp4":"video/open-onside.h264.6df2feb6.mp4","video/update-ios-poster.png":"video/update-ios-poster.e59e58f8.png","video/update-ios.h264.mp4":"video/update-ios.h264.8054177e.mp4"},b="https://cdn.onside.io/assets/onside-install-widget/";function x(e){return e.replace(/^\//,"")}function y(e){const t=x(e),n=t.split("/").pop()??t,r=[t,`/${t}`,n,`/${n}`];for(const s of r)if(p[s])return p[s];return null}function g(e){if(!e||/^https?:\/\//i.test(e)||e.endsWith(".svg"))return e;const t=y(e);if(!t)return e;try{return new URL(t,b).toString()}catch{return e}}const w=["Settings","General","Software Update"],j=g("/video/update-ios-poster.png"),k=g("/video/update-ios.h264.mp4"),S=({open:e,onClose:t})=>{a.useEffect(()=>{let s;return e&&(s=setTimeout(()=>{document.querySelector("video")?.play()},600)),()=>{clearTimeout(s)}},[e]);const n=a.useCallback(s=>{s||t()},[t]),r=a.useCallback(()=>{d.trackModalEvent("update_ios","click","close"),t()},[t]);return i.jsx(m.Dialog,{"aria-labelledby":"update-ios",open:e,onOpenChange:n,showCloseButton:!1,onBackClick:t,children:i.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[i.jsx("h2",{className:"mt-3 text-center font-sans text-3xl font-medium",id:"update-ios",children:"Update your iOS"}),i.jsxs("section",{className:"mt-2",children:[i.jsx("p",{className:"mt-3 text-center font-sans text-xs font-normal",children:"To install Onside, update your iPhone or iPad to the latest version of iOS."}),i.jsx(f,{breadcrumbs:w,className:"mt-2 flex gap-1"})]}),i.jsx("div",{className:"relative mt-4 flex w-full grow justify-center overflow-hidden rounded-t-2xl bg-lightGray px-7 pt-7",children:i.jsx(h,{ariaLabel:"Instruction demonstrating the update process",className:"shadow-14-50-98 rounded-t-[20px] border-8 border-b-0 border-white",poster:j,children:i.jsx("source",{src:k,type:"video/mp4"})})}),i.jsx(d.Button,{"aria-label":"Close",className:"mt-4 w-full",onClick:r,size:"lg",type:"button",children:"Close"})]})})};exports.UpdateIOSModal=S;
@@ -0,0 +1,169 @@
1
+ import { jsx as i, jsxs as d } from "react/jsx-runtime";
2
+ import { useRef as f, useEffect as m, useCallback as p } from "react";
3
+ import { c as v, t as h, B as b } from "./install-package-CyWo-B7v.js";
4
+ import { D as w } from "./Dialog-DXOEeh8t.js";
5
+ const y = "data:image/svg+xml,%3csvg%20width='10'%20height='16'%20viewBox='0%200%2010%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.9375%2012.25L6.35539%209.83211C6.74592%209.44158%206.74592%208.80842%206.35539%208.41789L3.9375%206'%20stroke='%231E1C1F'%20stroke-opacity='0.6'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e", x = ({ breadcrumbs: e, className: t }) => /* @__PURE__ */ i("ul", { className: t, children: e.map((n, r) => /* @__PURE__ */ d("li", { className: "inline-flex", children: [
6
+ /* @__PURE__ */ i("p", { className: "rounded-3xl bg-lightGray px-2 py-0.5 text-sm", children: n }),
7
+ r < e.length - 1 && /* @__PURE__ */ i(
8
+ "img",
9
+ {
10
+ alt: "Arrow icon",
11
+ "aria-hidden": "true",
12
+ className: "ml-1",
13
+ height: 16,
14
+ src: y,
15
+ width: 10
16
+ }
17
+ )
18
+ ] }, n)) }), k = (e) => {
19
+ const { ariaLabel: t, children: n, className: r, poster: o } = e, s = f(null);
20
+ return m(() => {
21
+ const a = () => {
22
+ s.current && s.current.paused && (s.current.muted = !0, s.current.play());
23
+ }, l = () => {
24
+ s.current && (document.visibilityState === "hidden" ? s.current.pause() : document.visibilityState === "visible" && a());
25
+ }, c = () => {
26
+ s.current && s.current.pause();
27
+ };
28
+ return document.addEventListener("visibilitychange", l), window.addEventListener("focus", a), window.addEventListener("blur", c), () => {
29
+ document.removeEventListener("visibilitychange", l), window.removeEventListener("focus", a), window.removeEventListener("blur", c);
30
+ };
31
+ }, []), /* @__PURE__ */ i(
32
+ "video",
33
+ {
34
+ "aria-label": t,
35
+ autoPlay: !0,
36
+ className: v(
37
+ "mt-2 transform-gpu rounded-2xl object-contain object-top",
38
+ r
39
+ ),
40
+ controls: !1,
41
+ disablePictureInPicture: !0,
42
+ disableRemotePlayback: !0,
43
+ draggable: !1,
44
+ loop: !0,
45
+ muted: !0,
46
+ playsInline: !0,
47
+ poster: o,
48
+ ref: s,
49
+ "webkit-playsinline": "true",
50
+ "x-webkit-airplay": "deny",
51
+ children: n
52
+ },
53
+ t
54
+ );
55
+ }, u = {
56
+ "images/.gitkeep": "images/.gitkeep.e3b0c442",
57
+ "images/install-sad-android.png": "images/install-sad-android.8b24a6e1.png",
58
+ "scripts/1.0.0/install-package.cjs": "scripts/1.0.0/install-package.7ac30417.cjs",
59
+ "scripts/1.0.0/install-package.js": "scripts/1.0.0/install-package.65685adc.js",
60
+ "video/.gitkeep": "video/.gitkeep.e3b0c442",
61
+ "video/change-region-poster.png": "video/change-region-poster.bc6bda65.png",
62
+ "video/change-region.h264.mp4": "video/change-region.h264.c47b9282.mp4",
63
+ "video/get-approved-poster.jpg": "video/get-approved-poster.4e7177ac.jpg",
64
+ "video/get-approved.mp4": "video/get-approved.5b7b5f4a.mp4",
65
+ "video/open-onside-poster.jpg": "video/open-onside-poster.6b71cae6.jpg",
66
+ "video/open-onside.av1.mp4": "video/open-onside.av1.32f1aa51.mp4",
67
+ "video/open-onside.h264.mp4": "video/open-onside.h264.6df2feb6.mp4",
68
+ "video/update-ios-poster.png": "video/update-ios-poster.e59e58f8.png",
69
+ "video/update-ios.h264.mp4": "video/update-ios.h264.8054177e.mp4"
70
+ }, E = "https://cdn.onside.io/assets/onside-install-widget/";
71
+ function N(e) {
72
+ return e.replace(/^\//, "");
73
+ }
74
+ function S(e) {
75
+ const t = N(e), n = t.split("/").pop() ?? t, r = [
76
+ t,
77
+ `/${t}`,
78
+ n,
79
+ `/${n}`
80
+ ];
81
+ for (const o of r)
82
+ if (u[o])
83
+ return u[o];
84
+ return null;
85
+ }
86
+ function g(e) {
87
+ if (!e || /^https?:\/\//i.test(e) || e.endsWith(".svg")) return e;
88
+ const t = S(e);
89
+ if (!t) return e;
90
+ try {
91
+ return new URL(t, E).toString();
92
+ } catch {
93
+ return e;
94
+ }
95
+ }
96
+ const j = ["Settings", "General", "Software Update"], L = g("/video/update-ios-poster.png"), P = g("/video/update-ios.h264.mp4"), R = ({
97
+ open: e,
98
+ onClose: t
99
+ }) => {
100
+ m(() => {
101
+ let o;
102
+ return e && (o = setTimeout(() => {
103
+ document.querySelector("video")?.play();
104
+ }, 600)), () => {
105
+ clearTimeout(o);
106
+ };
107
+ }, [e]);
108
+ const n = p(
109
+ (o) => {
110
+ o || t();
111
+ },
112
+ [t]
113
+ ), r = p(() => {
114
+ h("update_ios", "click", "close"), t();
115
+ }, [t]);
116
+ return /* @__PURE__ */ i(
117
+ w,
118
+ {
119
+ "aria-labelledby": "update-ios",
120
+ open: e,
121
+ onOpenChange: n,
122
+ showCloseButton: !1,
123
+ onBackClick: t,
124
+ children: /* @__PURE__ */ d("div", { className: "flex h-full flex-col items-center justify-center", children: [
125
+ /* @__PURE__ */ i(
126
+ "h2",
127
+ {
128
+ className: "mt-3 text-center font-sans text-3xl font-medium",
129
+ id: "update-ios",
130
+ children: "Update your iOS"
131
+ }
132
+ ),
133
+ /* @__PURE__ */ d("section", { className: "mt-2", children: [
134
+ /* @__PURE__ */ i("p", { className: "mt-3 text-center font-sans text-xs font-normal", children: "To install Onside, update your iPhone or iPad to the latest version of iOS." }),
135
+ /* @__PURE__ */ i(
136
+ x,
137
+ {
138
+ breadcrumbs: j,
139
+ className: "mt-2 flex gap-1"
140
+ }
141
+ )
142
+ ] }),
143
+ /* @__PURE__ */ i("div", { className: "relative mt-4 flex w-full grow justify-center overflow-hidden rounded-t-2xl bg-lightGray px-7 pt-7", children: /* @__PURE__ */ i(
144
+ k,
145
+ {
146
+ ariaLabel: "Instruction demonstrating the update process",
147
+ className: "shadow-14-50-98 rounded-t-[20px] border-8 border-b-0 border-white",
148
+ poster: L,
149
+ children: /* @__PURE__ */ i("source", { src: P, type: "video/mp4" })
150
+ }
151
+ ) }),
152
+ /* @__PURE__ */ i(
153
+ b,
154
+ {
155
+ "aria-label": "Close",
156
+ className: "mt-4 w-full",
157
+ onClick: r,
158
+ size: "lg",
159
+ type: "button",
160
+ children: "Close"
161
+ }
162
+ )
163
+ ] })
164
+ }
165
+ );
166
+ };
167
+ export {
168
+ R as UpdateIOSModal
169
+ };