@onside/install-widget 1.0.3 → 1.0.4
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/dist-lib/install-package.d.ts +1 -2
- package/dist-lib/utils.cjs +1 -1
- package/dist-lib/utils.d.ts +1 -2
- package/dist-lib/utils.js +89 -79
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { PropsWithChildren } from 'react';
|
|
|
4
4
|
import { StoreApi } from 'zustand';
|
|
5
5
|
import { UseBoundStore } from 'zustand';
|
|
6
6
|
|
|
7
|
-
export declare type AnalyticsEvent =
|
|
7
|
+
export declare type AnalyticsEvent = TrackedAnalyticsEvent;
|
|
8
8
|
|
|
9
9
|
export declare const AVERAGE_CHECK_TIME: number;
|
|
10
10
|
|
|
@@ -160,7 +160,6 @@ export declare interface TrackedAnalyticsEvent {
|
|
|
160
160
|
event_name: string;
|
|
161
161
|
event_properties: Record<string, unknown>;
|
|
162
162
|
user_properties?: Record<string, unknown>;
|
|
163
|
-
url: string;
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
export declare function trackEvent(event_name: string, event_properties?: Record<string, unknown>, user_properties?: Record<string, unknown>): TrackedAnalyticsEvent | null;
|
package/dist-lib/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./installUrlService-AjG03i8i.cjs"),I={IOS:/iPhone|iPad|iPod/i,IPAD:/iPad/i,ANDROID:/Android/i,INTEL_MAC:/Intel Mac/i},r={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_DUCKDUCKGO_ALT:/DuckDuckGo\//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},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./installUrlService-AjG03i8i.cjs"),I={IOS:/iPhone|iPad|iPod/i,IPAD:/iPad/i,ANDROID:/Android/i,INTEL_MAC:/Intel Mac/i},r={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_DUCKDUCKGO_ALT:/DuckDuckGo\//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},p={WEBKIT:/AppleWebKit|WebKit/i,BLINK:/Chrome|Chromium|Edg|OPR\/|SamsungBrowser|YaBrowser/i,GECKO:/Gecko\/\d|Firefox/i},O={IOS_VERSION:/Version\/(\d+[_.\d]*)/,IOS_OS:/(?:iPhone|iPad|iPod).*?OS (\d+[_.\d]*)/i,IOS_APP:/(?:iOS|iPadOS)\/(\d+[_.\d]*)/i,ANDROID_VERSION:/Android\s+(\d+[.\d]*)/,MACOS_VERSION:/Mac OS X (\d+[_.\d]*)/i},T={MOBILE:/Mobile/i,ANDROID_TABLET_KEYWORDS:/Tablet|SM-T|SM-P|GT-P|SCH-I|SCH-T/i},a={IOS_INSTAGRAM:/\bInstagram\b/i,IOS_FACEBOOK:/\bFBAN\/FBIOS\b|\bFBAV\b/i,IOS_LINKEDIN:/LinkedInApp/i,IOS_LINKEDIN_ALT:/LinkedIn\/\d/i,IOS_DISCORD:/\bDiscord\b/i,IOS_TWITTER:/Twitter for iPhone/i,IOS_TIKTOK:/\bTikTok\b/i,IOS_TIKTOK_ALT:/zhiliaoapp\.musically|musically\/\d/i,IOS_TELEGRAM:/\bTelegram\b/i,IOS_WECHAT:/\bMicroMessenger\b/i,IOS_LINE:/\bLine\/\d/i},b=[{detail:"instagram",pattern:a.IOS_INSTAGRAM},{detail:"facebook",pattern:a.IOS_FACEBOOK},{detail:"linkedin",pattern:a.IOS_LINKEDIN},{detail:"linkedin",pattern:a.IOS_LINKEDIN_ALT},{detail:"discord",pattern:a.IOS_DISCORD},{detail:"twitter",pattern:a.IOS_TWITTER},{detail:"tiktok",pattern:a.IOS_TIKTOK},{detail:"tiktok",pattern:a.IOS_TIKTOK_ALT},{detail:"telegram",pattern:a.IOS_TELEGRAM},{detail:"wechat",pattern:a.IOS_WECHAT},{detail:"line",pattern:a.IOS_LINE}],L=768,C=()=>"ontouchstart"in window||window.navigator?.maxTouchPoints>0||window.navigator?.msMaxTouchPoints>0,M=()=>window.navigator.userAgent,F=e=>{if(I.IOS.test(e)){const i=I.IPAD.test(e);return{platform:"ios",isMobile:!i,isTablet:i,isDesktop:!1}}if(I.ANDROID.test(e)){const i=T.MOBILE.test(e),n=T.ANDROID_TABLET_KEYWORDS.test(e),o=window.innerWidth,t=n||!i&&o>=L;return{platform:"android",isMobile:!t,isTablet:t,isDesktop:!1}}return P(e)?{platform:"ios",isMobile:!1,isTablet:!0,isDesktop:!1}:r.IOS_GOOGLE_APP.test(e)?{platform:"ios",isMobile:!0,isTablet:!1,isDesktop:!1}:{platform:"desktop",isMobile:!1,isTablet:!1,isDesktop:!0}},P=e=>r.SAFARI.test(e)&&I.INTEL_MAC.test(e)&&!r.CHROME.test(e)&&!r.FIREFOX.test(e)&&!r.OPERA.test(e)?C():!1,A=()=>typeof window?.TelegramWebviewProxy<"u",D=e=>{for(const i of b)if(i.pattern.test(e))return i.detail},K=(e,i)=>{const n=(...o)=>o.some(t=>t.test(e));return n(r.IOS_EDGE,r.EDGE)?"edge":n(r.IOS_OPERA,r.IOS_OPERA_NEW,r.OPERA)?"opera":n(r.IOS_BRAVE)?"brave":n(r.IOS_DUCKDUCKGO)||n(r.IOS_DUCKDUCKGO_ALT)?"duckduckgo":n(r.IOS_CHROME,r.CHROME)?"chrome":n(r.IOS_GOOGLE_APP)?"google":n(r.IOS_FIREFOX,r.FIREFOX)?"firefox":i==="ios"&&(D(e)||A())?"in-app":r.SAFARI.test(e)&&!r.CHROME.test(e)&&!r.FIREFOX.test(e)&&!r.OPERA.test(e)&&!r.IOS_BRAVE.test(e)&&!r.IOS_DUCKDUCKGO.test(e)&&!r.IOS_DUCKDUCKGO_ALT.test(e)&&!r.IOS_GOOGLE_APP.test(e)&&!a.IOS_TELEGRAM.test(e)&&!a.IOS_WECHAT.test(e)&&!a.IOS_LINE.test(e)&&!A()?"safari":"unknown"},G=(e,i)=>{switch(i){case"chrome":return r.IOS_CHROME.test(e)?"crios":"chrome";case"firefox":return r.IOS_FIREFOX.test(e)?"fxios":"firefox";case"edge":return r.IOS_EDGE.test(e)?"edgios":"edge";case"opera":return r.IOS_OPERA_NEW.test(e)?"opt":r.IOS_OPERA.test(e)?"opios":"opera";case"duckduckgo":return"duckduckgo";case"google":return"gsa";case"safari":return"safari";case"in-app":return a.IOS_TELEGRAM.test(e)||A()?"telegram":D(e);default:return}},B=(e,i,n)=>i==="ios"?"webkit":n==="firefox"&&!r.IOS_FIREFOX.test(e)?"gecko":n==="chrome"||n==="edge"||n==="opera"||n==="brave"||n==="google"?"blink":n==="safari"?"webkit":p.GECKO.test(e)&&!/like Gecko/i.test(e)?"gecko":p.BLINK.test(e)?"blink":p.WEBKIT.test(e)?"webkit":"unknown",U=(e,i)=>{if(i.platform==="ios")return P(e)||I.IPAD.test(e)||/Apple\/iPad|iPad\d/i.test(e)?"ipad":/iPhone|Apple\/iPhone|iPhone\d/i.test(e)?"iphone":/iPod/i.test(e)?"ipod":"unknown"},V=(e,i,n)=>{const o=t=>t.replace(/_/g,".").split(".").filter(s=>s.length>0).join(".");switch(i){case"ios":{let t=n==="safari"?e.match(O.IOS_VERSION):null;return t||(t=e.match(O.IOS_OS)),t||(t=e.match(O.IOS_APP)),!t&&n==="safari"&&(t=e.match(O.IOS_VERSION)),t?o(t[1]):void 0}case"android":{const t=e.match(O.ANDROID_VERSION);return t?o(t[1]):void 0}case"desktop":{const t=e.match(O.MACOS_VERSION);return t?o(t[1]):void 0}}},W=e=>{if(!e)return{};const[i,n]=e.split("."),o=Number.parseInt(i,10),t=Number.parseInt(n??"0",10);return{version_major:o,version_minor:t}},y={platform:"unknown",browser:"unknown",browserEngine:"unknown",isMobile:!1,isTablet:!1,isDesktop:!1,version:void 0,userAgent:""};let u=null,g=null,m=null;function N(){if(typeof window>"u")return y;const e=M(),i=window.innerWidth;if(u&&g===e&&m===i)return u;const n=F(e),o=K(e,n.platform),t=B(e,n.platform,o),s=G(e,o),c=U(e,n),l=V(e,n.platform,o),f=W(l),_={...n,browser:o,browserEngine:t,browserDetail:s,iosDeviceClass:c,isInAppBrowser:o==="in-app",version:l,...f,userAgent:e};return u=_,g=e,m=i,_}const x=".",R=e=>e.split(x).map(i=>Number.parseInt(i,10)).filter(i=>Number.isFinite(i)&&i>=0),E=(e,i)=>{const n=R(e),o=R(i),t=Math.max(n.length,o.length);for(let s=0;s<t;s+=1){const c=n[s]??0,l=o[s]??0;if(c>l)return 1;if(c<l)return-1}return 0},H="17.6",X="18.6",Y=["safari","chrome","edge","brave","duckduckgo"],j=({platform:e,isIOSDevice:i,shouldUpdateIOS:n,isIOSVersionSupported:o,browserSupportsInstall:t})=>e==="android"?"android":n?"update_ios":o&&t?"install_available":i?"go_to_safari":"unsupported";function Z(e,i={}){const{minIOSVersionForInstall:n=H,minIOSVersionForNewSystemUI:o=X}=i,t=e.version,s=e.platform==="ios"&&(e.isMobile||e.isTablet),c=typeof t=="string",l=!!(s&&c&&E(t,n)>=0),f=!!(s&&c&&E(t,n)<0),_=Y.includes(e.browser),h=!!(s&&_&&!e.isInAppBrowser),v=j({platform:e.platform,isIOSDevice:s,shouldUpdateIOS:f,isIOSVersionSupported:l,browserSupportsInstall:h}),k=!!(s&&c&&E(t,o)>=0);return{installState:v,usesNewInstallFlow:k}}const q="onside_analytics_logging",d=()=>typeof window<"u";function z(){return d()?localStorage.getItem(q)==="true":!1}const $=()=>d()?{locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}:{},J=e=>{const i=$(),n=d()?window.location.href:void 0,o=d()?new URLSearchParams(window.location.search).get("variant")??void 0:void 0;return{...N(),locale:i.locale,timeZone:i.timeZone,full_url:n,variant:o,...e}};function w(e,i={},n){try{if(!d())return null;window.dataLayer||(window.dataLayer=[]);const o=J(i),t={event:"amplitude_event",event_name:e,event_properties:{timestamp:Date.now(),...o},...n?{user_properties:n}:{}};return window.dataLayer.push({event:t.event,event_name:t.event_name,event_properties:t.event_properties,...t.user_properties?{user_properties:t.user_properties}:{}}),z()&&console.log("🎯 Analytics Event:",{event_name:t.event_name,event_properties:t.event_properties,user_properties:t.user_properties}),t}catch(o){return console.error("Analytics error:",o),null}}function Q(e,i,n,o={}){const t=`${e}.${i}`,s={modal_name:e,event_type:i,...o};return n&&(s.action=n),w(t,s)}exports.generateUUID=S.generateUUID;exports.getCookie=S.getCookie;exports.getInstallUrl=S.getInstallUrl;exports.getOnsideToken=S.getOnsideToken;exports.setCookie=S.setCookie;exports.compareVersions=E;exports.getDeviceInfo=N;exports.resolveInstallConditions=Z;exports.trackEvent=w;exports.trackModalEvent=Q;
|
package/dist-lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare type AnalyticsEvent =
|
|
1
|
+
export declare type AnalyticsEvent = TrackedAnalyticsEvent;
|
|
2
2
|
|
|
3
3
|
export declare type Browser = "safari" | "chrome" | "firefox" | "edge" | "opera" | "brave" | "duckduckgo" | "google" | "in-app" | "unknown";
|
|
4
4
|
|
|
@@ -83,7 +83,6 @@ export declare interface TrackedAnalyticsEvent {
|
|
|
83
83
|
event_name: string;
|
|
84
84
|
event_properties: Record<string, unknown>;
|
|
85
85
|
user_properties?: Record<string, unknown>;
|
|
86
|
-
url: string;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
export declare function trackEvent(event_name: string, event_properties?: Record<string, unknown>, user_properties?: Record<string, unknown>): TrackedAnalyticsEvent | null;
|
package/dist-lib/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
const
|
|
1
|
+
import { c as te, b as ne, g as ie, a as re, s as oe } from "./installUrlService-CrJfYPwM.js";
|
|
2
|
+
const I = {
|
|
3
3
|
IOS: /iPhone|iPad|iPod/i,
|
|
4
4
|
IPAD: /iPad/i,
|
|
5
5
|
ANDROID: /Android/i,
|
|
@@ -19,17 +19,17 @@ const l = {
|
|
|
19
19
|
FIREFOX: /Firefox|FxiOS/i,
|
|
20
20
|
EDGE: /Edge|Edg/i,
|
|
21
21
|
OPERA: /Opera|OPiOS|OPT\/|OPR\/|OPX\//i
|
|
22
|
-
},
|
|
22
|
+
}, E = {
|
|
23
23
|
WEBKIT: /AppleWebKit|WebKit/i,
|
|
24
24
|
BLINK: /Chrome|Chromium|Edg|OPR\/|SamsungBrowser|YaBrowser/i,
|
|
25
25
|
GECKO: /Gecko\/\d|Firefox/i
|
|
26
|
-
},
|
|
26
|
+
}, l = {
|
|
27
27
|
IOS_VERSION: /Version\/(\d+[_.\d]*)/,
|
|
28
28
|
IOS_OS: /(?:iPhone|iPad|iPod).*?OS (\d+[_.\d]*)/i,
|
|
29
29
|
IOS_APP: /(?:iOS|iPadOS)\/(\d+[_.\d]*)/i,
|
|
30
30
|
ANDROID_VERSION: /Android\s+(\d+[.\d]*)/,
|
|
31
31
|
MACOS_VERSION: /Mac OS X (\d+[_.\d]*)/i
|
|
32
|
-
},
|
|
32
|
+
}, A = {
|
|
33
33
|
MOBILE: /Mobile/i,
|
|
34
34
|
ANDROID_TABLET_KEYWORDS: /Tablet|SM-T|SM-P|GT-P|SCH-I|SCH-T/i
|
|
35
35
|
}, a = {
|
|
@@ -44,7 +44,7 @@ const l = {
|
|
|
44
44
|
IOS_TELEGRAM: /\bTelegram\b/i,
|
|
45
45
|
IOS_WECHAT: /\bMicroMessenger\b/i,
|
|
46
46
|
IOS_LINE: /\bLine\/\d/i
|
|
47
|
-
},
|
|
47
|
+
}, h = [
|
|
48
48
|
{ detail: "instagram", pattern: a.IOS_INSTAGRAM },
|
|
49
49
|
{ detail: "facebook", pattern: a.IOS_FACEBOOK },
|
|
50
50
|
{ detail: "linkedin", pattern: a.IOS_LINKEDIN },
|
|
@@ -56,10 +56,10 @@ const l = {
|
|
|
56
56
|
{ detail: "telegram", pattern: a.IOS_TELEGRAM },
|
|
57
57
|
{ detail: "wechat", pattern: a.IOS_WECHAT },
|
|
58
58
|
{ detail: "line", pattern: a.IOS_LINE }
|
|
59
|
-
],
|
|
60
|
-
window.navigator?.msMaxTouchPoints > 0,
|
|
61
|
-
if (
|
|
62
|
-
const i =
|
|
59
|
+
], b = 768, k = () => "ontouchstart" in window || window.navigator?.maxTouchPoints > 0 || // @ts-expect-error - msMaxTouchPoints exists in some browsers
|
|
60
|
+
window.navigator?.msMaxTouchPoints > 0, v = () => window.navigator.userAgent, L = (e) => {
|
|
61
|
+
if (I.IOS.test(e)) {
|
|
62
|
+
const i = I.IPAD.test(e);
|
|
63
63
|
return {
|
|
64
64
|
platform: "ios",
|
|
65
65
|
isMobile: !i,
|
|
@@ -67,8 +67,8 @@ window.navigator?.msMaxTouchPoints > 0, k = () => window.navigator.userAgent, L
|
|
|
67
67
|
isDesktop: !1
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
if (
|
|
71
|
-
const i =
|
|
70
|
+
if (I.ANDROID.test(e)) {
|
|
71
|
+
const i = A.MOBILE.test(e), n = A.ANDROID_TABLET_KEYWORDS.test(e), o = window.innerWidth, t = n || !i && o >= b;
|
|
72
72
|
return {
|
|
73
73
|
platform: "android",
|
|
74
74
|
isMobile: !t,
|
|
@@ -76,7 +76,7 @@ window.navigator?.msMaxTouchPoints > 0, k = () => window.navigator.userAgent, L
|
|
|
76
76
|
isDesktop: !1
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return g(e) ? {
|
|
80
80
|
platform: "ios",
|
|
81
81
|
isMobile: !1,
|
|
82
82
|
isTablet: !0,
|
|
@@ -92,11 +92,11 @@ window.navigator?.msMaxTouchPoints > 0, k = () => window.navigator.userAgent, L
|
|
|
92
92
|
isTablet: !1,
|
|
93
93
|
isDesktop: !0
|
|
94
94
|
};
|
|
95
|
-
},
|
|
95
|
+
}, g = (e) => r.SAFARI.test(e) && I.INTEL_MAC.test(e) && !r.CHROME.test(e) && !r.FIREFOX.test(e) && !r.OPERA.test(e) ? k() : !1, u = () => (
|
|
96
96
|
// @ts-expect-error - TelegramWebviewProxy may exist
|
|
97
97
|
typeof window?.TelegramWebviewProxy < "u"
|
|
98
|
-
),
|
|
99
|
-
for (const i of
|
|
98
|
+
), P = (e) => {
|
|
99
|
+
for (const i of h)
|
|
100
100
|
if (i.pattern.test(e))
|
|
101
101
|
return i.detail;
|
|
102
102
|
}, M = (e, i) => {
|
|
@@ -105,8 +105,8 @@ window.navigator?.msMaxTouchPoints > 0, k = () => window.navigator.userAgent, L
|
|
|
105
105
|
r.IOS_OPERA,
|
|
106
106
|
r.IOS_OPERA_NEW,
|
|
107
107
|
r.OPERA
|
|
108
|
-
) ? "opera" : n(r.IOS_BRAVE) ? "brave" : n(r.IOS_DUCKDUCKGO) || n(r.IOS_DUCKDUCKGO_ALT) ? "duckduckgo" : n(r.IOS_CHROME, r.CHROME) ? "chrome" : n(r.IOS_GOOGLE_APP) ? "google" : n(r.IOS_FIREFOX, r.FIREFOX) ? "firefox" : i === "ios" && (
|
|
109
|
-
},
|
|
108
|
+
) ? "opera" : n(r.IOS_BRAVE) ? "brave" : n(r.IOS_DUCKDUCKGO) || n(r.IOS_DUCKDUCKGO_ALT) ? "duckduckgo" : n(r.IOS_CHROME, r.CHROME) ? "chrome" : n(r.IOS_GOOGLE_APP) ? "google" : n(r.IOS_FIREFOX, r.FIREFOX) ? "firefox" : i === "ios" && (P(e) || u()) ? "in-app" : r.SAFARI.test(e) && !r.CHROME.test(e) && !r.FIREFOX.test(e) && !r.OPERA.test(e) && !r.IOS_BRAVE.test(e) && !r.IOS_DUCKDUCKGO.test(e) && !r.IOS_DUCKDUCKGO_ALT.test(e) && !r.IOS_GOOGLE_APP.test(e) && !a.IOS_TELEGRAM.test(e) && !a.IOS_WECHAT.test(e) && !a.IOS_LINE.test(e) && !u() ? "safari" : "unknown";
|
|
109
|
+
}, C = (e, i) => {
|
|
110
110
|
switch (i) {
|
|
111
111
|
case "chrome":
|
|
112
112
|
return r.IOS_CHROME.test(e) ? "crios" : "chrome";
|
|
@@ -123,37 +123,37 @@ window.navigator?.msMaxTouchPoints > 0, k = () => window.navigator.userAgent, L
|
|
|
123
123
|
case "safari":
|
|
124
124
|
return "safari";
|
|
125
125
|
case "in-app":
|
|
126
|
-
return a.IOS_TELEGRAM.test(e) ||
|
|
126
|
+
return a.IOS_TELEGRAM.test(e) || u() ? "telegram" : P(e);
|
|
127
127
|
default:
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
},
|
|
130
|
+
}, F = (e, i, n) => i === "ios" ? "webkit" : n === "firefox" && !r.IOS_FIREFOX.test(e) ? "gecko" : n === "chrome" || n === "edge" || n === "opera" || n === "brave" || n === "google" ? "blink" : n === "safari" ? "webkit" : E.GECKO.test(e) && !/like Gecko/i.test(e) ? "gecko" : E.BLINK.test(e) ? "blink" : E.WEBKIT.test(e) ? "webkit" : "unknown", K = (e, i) => {
|
|
131
131
|
if (i.platform === "ios")
|
|
132
|
-
return
|
|
133
|
-
},
|
|
132
|
+
return g(e) || I.IPAD.test(e) || /Apple\/iPad|iPad\d/i.test(e) ? "ipad" : /iPhone|Apple\/iPhone|iPhone\d/i.test(e) ? "iphone" : /iPod/i.test(e) ? "ipod" : "unknown";
|
|
133
|
+
}, G = (e, i, n) => {
|
|
134
134
|
const o = (t) => t.replace(/_/g, ".").split(".").filter((s) => s.length > 0).join(".");
|
|
135
135
|
switch (i) {
|
|
136
136
|
case "ios": {
|
|
137
|
-
let t = n === "safari" ? e.match(
|
|
138
|
-
return t || (t = e.match(
|
|
137
|
+
let t = n === "safari" ? e.match(l.IOS_VERSION) : null;
|
|
138
|
+
return t || (t = e.match(l.IOS_OS)), t || (t = e.match(l.IOS_APP)), !t && n === "safari" && (t = e.match(l.IOS_VERSION)), t ? o(t[1]) : void 0;
|
|
139
139
|
}
|
|
140
140
|
case "android": {
|
|
141
|
-
const t = e.match(
|
|
141
|
+
const t = e.match(l.ANDROID_VERSION);
|
|
142
142
|
return t ? o(t[1]) : void 0;
|
|
143
143
|
}
|
|
144
144
|
case "desktop": {
|
|
145
|
-
const t = e.match(
|
|
145
|
+
const t = e.match(l.MACOS_VERSION);
|
|
146
146
|
return t ? o(t[1]) : void 0;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, B = (e) => {
|
|
150
150
|
if (!e) return {};
|
|
151
151
|
const [i, n] = e.split("."), o = Number.parseInt(i, 10), t = Number.parseInt(n ?? "0", 10);
|
|
152
152
|
return {
|
|
153
153
|
version_major: o,
|
|
154
154
|
version_minor: t
|
|
155
155
|
};
|
|
156
|
-
},
|
|
156
|
+
}, U = {
|
|
157
157
|
platform: "unknown",
|
|
158
158
|
browser: "unknown",
|
|
159
159
|
browserEngine: "unknown",
|
|
@@ -163,117 +163,127 @@ window.navigator?.msMaxTouchPoints > 0, k = () => window.navigator.userAgent, L
|
|
|
163
163
|
version: void 0,
|
|
164
164
|
userAgent: ""
|
|
165
165
|
};
|
|
166
|
-
let
|
|
166
|
+
let f = null, T = null, m = null;
|
|
167
167
|
function V() {
|
|
168
168
|
if (typeof window > "u")
|
|
169
|
-
return
|
|
170
|
-
const e =
|
|
171
|
-
if (
|
|
172
|
-
return
|
|
173
|
-
const n = L(e), o = M(e, n.platform), t =
|
|
169
|
+
return U;
|
|
170
|
+
const e = v(), i = window.innerWidth;
|
|
171
|
+
if (f && T === e && m === i)
|
|
172
|
+
return f;
|
|
173
|
+
const n = L(e), o = M(e, n.platform), t = F(e, n.platform, o), s = C(e, o), c = K(e, n), O = G(e, n.platform, o), _ = B(O), S = {
|
|
174
174
|
...n,
|
|
175
175
|
browser: o,
|
|
176
176
|
browserEngine: t,
|
|
177
177
|
browserDetail: s,
|
|
178
|
-
iosDeviceClass:
|
|
178
|
+
iosDeviceClass: c,
|
|
179
179
|
isInAppBrowser: o === "in-app",
|
|
180
|
-
version:
|
|
181
|
-
...
|
|
180
|
+
version: O,
|
|
181
|
+
..._,
|
|
182
182
|
userAgent: e
|
|
183
183
|
};
|
|
184
|
-
return
|
|
184
|
+
return f = S, T = e, m = i, S;
|
|
185
185
|
}
|
|
186
|
-
const W = ".", R = (e) => e.split(W).map((i) => Number.parseInt(i, 10)).filter((i) => Number.isFinite(i) && i >= 0),
|
|
186
|
+
const W = ".", R = (e) => e.split(W).map((i) => Number.parseInt(i, 10)).filter((i) => Number.isFinite(i) && i >= 0), p = (e, i) => {
|
|
187
187
|
const n = R(e), o = R(i), t = Math.max(n.length, o.length);
|
|
188
188
|
for (let s = 0; s < t; s += 1) {
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
if (
|
|
189
|
+
const c = n[s] ?? 0, O = o[s] ?? 0;
|
|
190
|
+
if (c > O) return 1;
|
|
191
|
+
if (c < O) return -1;
|
|
192
192
|
}
|
|
193
193
|
return 0;
|
|
194
|
-
},
|
|
194
|
+
}, x = "17.6", y = "18.6", H = [
|
|
195
195
|
"safari",
|
|
196
196
|
"chrome",
|
|
197
197
|
"edge",
|
|
198
198
|
"brave",
|
|
199
199
|
"duckduckgo"
|
|
200
|
-
],
|
|
200
|
+
], X = ({
|
|
201
201
|
platform: e,
|
|
202
202
|
isIOSDevice: i,
|
|
203
203
|
shouldUpdateIOS: n,
|
|
204
204
|
isIOSVersionSupported: o,
|
|
205
205
|
browserSupportsInstall: t
|
|
206
206
|
}) => e === "android" ? "android" : n ? "update_ios" : o && t ? "install_available" : i ? "go_to_safari" : "unsupported";
|
|
207
|
-
function
|
|
207
|
+
function q(e, i = {}) {
|
|
208
208
|
const {
|
|
209
|
-
minIOSVersionForInstall: n =
|
|
210
|
-
minIOSVersionForNewSystemUI: o =
|
|
211
|
-
} = i, t = e.version, s = e.platform === "ios" && (e.isMobile || e.isTablet),
|
|
209
|
+
minIOSVersionForInstall: n = x,
|
|
210
|
+
minIOSVersionForNewSystemUI: o = y
|
|
211
|
+
} = i, t = e.version, s = e.platform === "ios" && (e.isMobile || e.isTablet), c = typeof t == "string", O = !!(s && c && p(t, n) >= 0), _ = !!(s && c && p(t, n) < 0), S = H.includes(
|
|
212
212
|
e.browser
|
|
213
|
-
),
|
|
213
|
+
), D = !!(s && S && !e.isInAppBrowser), N = X({
|
|
214
214
|
platform: e.platform,
|
|
215
215
|
isIOSDevice: s,
|
|
216
|
-
shouldUpdateIOS:
|
|
217
|
-
isIOSVersionSupported:
|
|
218
|
-
browserSupportsInstall:
|
|
219
|
-
}),
|
|
216
|
+
shouldUpdateIOS: _,
|
|
217
|
+
isIOSVersionSupported: O,
|
|
218
|
+
browserSupportsInstall: D
|
|
219
|
+
}), w = !!(s && c && p(t, o) >= 0);
|
|
220
220
|
return {
|
|
221
|
-
installState:
|
|
222
|
-
usesNewInstallFlow:
|
|
221
|
+
installState: N,
|
|
222
|
+
usesNewInstallFlow: w
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
const Y = "onside_analytics_logging", d = () => typeof window < "u";
|
|
226
|
+
function j() {
|
|
227
|
+
return d() ? localStorage.getItem(Y) === "true" : !1;
|
|
227
228
|
}
|
|
228
|
-
|
|
229
|
+
const Z = () => d() ? {
|
|
230
|
+
locale: navigator.language,
|
|
231
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
232
|
+
} : {}, z = (e) => {
|
|
233
|
+
const i = Z(), n = d() ? window.location.href : void 0, o = d() ? new URLSearchParams(window.location.search).get("variant") ?? void 0 : void 0;
|
|
234
|
+
return {
|
|
235
|
+
...V(),
|
|
236
|
+
locale: i.locale,
|
|
237
|
+
timeZone: i.timeZone,
|
|
238
|
+
full_url: n,
|
|
239
|
+
variant: o,
|
|
240
|
+
...e
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
function $(e, i = {}, n) {
|
|
229
244
|
try {
|
|
230
|
-
if (
|
|
245
|
+
if (!d()) return null;
|
|
231
246
|
window.dataLayer || (window.dataLayer = []);
|
|
232
|
-
const o = {
|
|
233
|
-
...i,
|
|
234
|
-
...V()
|
|
235
|
-
}, t = {
|
|
247
|
+
const o = z(i), t = {
|
|
236
248
|
event: "amplitude_event",
|
|
237
249
|
event_name: e,
|
|
238
250
|
event_properties: {
|
|
239
251
|
timestamp: Date.now(),
|
|
240
252
|
...o
|
|
241
253
|
},
|
|
242
|
-
...n ? { user_properties: n } : {}
|
|
243
|
-
url: window.location.href
|
|
254
|
+
...n ? { user_properties: n } : {}
|
|
244
255
|
};
|
|
245
256
|
return window.dataLayer.push({
|
|
246
257
|
event: t.event,
|
|
247
258
|
event_name: t.event_name,
|
|
248
259
|
event_properties: t.event_properties,
|
|
249
260
|
...t.user_properties ? { user_properties: t.user_properties } : {}
|
|
250
|
-
}),
|
|
261
|
+
}), j() && console.log("🎯 Analytics Event:", {
|
|
251
262
|
event_name: t.event_name,
|
|
252
263
|
event_properties: t.event_properties,
|
|
253
|
-
user_properties: t.user_properties
|
|
254
|
-
url: t.url
|
|
264
|
+
user_properties: t.user_properties
|
|
255
265
|
}), t;
|
|
256
266
|
} catch (o) {
|
|
257
267
|
return console.error("Analytics error:", o), null;
|
|
258
268
|
}
|
|
259
269
|
}
|
|
260
|
-
function
|
|
270
|
+
function J(e, i, n, o = {}) {
|
|
261
271
|
const t = `${e}.${i}`, s = {
|
|
262
272
|
modal_name: e,
|
|
263
273
|
event_type: i,
|
|
264
274
|
...o
|
|
265
275
|
};
|
|
266
|
-
return n && (s.action = n),
|
|
276
|
+
return n && (s.action = n), $(t, s);
|
|
267
277
|
}
|
|
268
278
|
export {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
279
|
+
p as compareVersions,
|
|
280
|
+
te as generateUUID,
|
|
281
|
+
ne as getCookie,
|
|
272
282
|
V as getDeviceInfo,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
283
|
+
ie as getInstallUrl,
|
|
284
|
+
re as getOnsideToken,
|
|
285
|
+
q as resolveInstallConditions,
|
|
286
|
+
oe as setCookie,
|
|
287
|
+
$ as trackEvent,
|
|
288
|
+
J as trackModalEvent
|
|
279
289
|
};
|