@shware/analytics 3.6.4 → 3.8.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 +50 -3
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/constants/storage.cjs +12 -37
- package/dist/constants/storage.cjs.map +1 -1
- package/dist/constants/storage.d.cts +10 -8
- package/dist/constants/storage.d.cts.map +1 -0
- package/dist/constants/storage.d.mts +13 -0
- package/dist/constants/storage.d.mts.map +1 -0
- package/dist/constants/storage.mjs +12 -13
- package/dist/constants/storage.mjs.map +1 -1
- package/dist/feedback/index.cjs +14 -40
- package/dist/feedback/index.cjs.map +1 -1
- package/dist/feedback/index.d.cts +4 -4
- package/dist/feedback/index.d.cts.map +1 -0
- package/dist/feedback/index.d.mts +6 -0
- package/dist/feedback/index.d.mts.map +1 -0
- package/dist/feedback/index.mjs +12 -14
- package/dist/feedback/index.mjs.map +1 -1
- package/dist/hooks/use-app-analytics.cjs +46 -65
- package/dist/hooks/use-app-analytics.cjs.map +1 -1
- package/dist/hooks/use-app-analytics.d.cts +3 -1
- package/dist/hooks/use-app-analytics.d.cts.map +1 -0
- package/dist/hooks/use-app-analytics.d.mts +5 -0
- package/dist/hooks/use-app-analytics.d.mts.map +1 -0
- package/dist/hooks/use-app-analytics.mjs +41 -36
- package/dist/hooks/use-app-analytics.mjs.map +1 -1
- package/dist/hooks/use-click-id-persistence.cjs +43 -65
- package/dist/hooks/use-click-id-persistence.cjs.map +1 -1
- package/dist/hooks/use-click-id-persistence.d.cts +3 -1
- package/dist/hooks/use-click-id-persistence.d.cts.map +1 -0
- package/dist/hooks/use-click-id-persistence.d.mts +5 -0
- package/dist/hooks/use-click-id-persistence.d.mts.map +1 -0
- package/dist/hooks/use-click-id-persistence.mjs +40 -38
- package/dist/hooks/use-click-id-persistence.mjs.map +1 -1
- package/dist/hooks/use-outbound-click-analytics.cjs +33 -55
- package/dist/hooks/use-outbound-click-analytics.cjs.map +1 -1
- package/dist/hooks/use-outbound-click-analytics.d.cts +3 -1
- package/dist/hooks/use-outbound-click-analytics.d.cts.map +1 -0
- package/dist/hooks/{use-outbound-click-analytics.d.ts → use-outbound-click-analytics.d.mts} +3 -1
- package/dist/hooks/use-outbound-click-analytics.d.mts.map +1 -0
- package/dist/hooks/use-outbound-click-analytics.mjs +31 -29
- package/dist/hooks/use-outbound-click-analytics.mjs.map +1 -1
- package/dist/hooks/use-previous.cjs +11 -35
- package/dist/hooks/use-previous.cjs.map +1 -1
- package/dist/hooks/use-previous.d.cts +3 -1
- package/dist/hooks/use-previous.d.cts.map +1 -0
- package/dist/hooks/use-previous.d.mts +5 -0
- package/dist/hooks/use-previous.d.mts.map +1 -0
- package/dist/hooks/use-previous.mjs +9 -9
- package/dist/hooks/use-previous.mjs.map +1 -1
- package/dist/hooks/use-track-impression.cjs +24 -51
- package/dist/hooks/use-track-impression.cjs.map +1 -1
- package/dist/hooks/use-track-impression.d.cts +5 -6
- package/dist/hooks/use-track-impression.d.cts.map +1 -0
- package/dist/hooks/use-track-impression.d.mts +6 -0
- package/dist/hooks/use-track-impression.d.mts.map +1 -0
- package/dist/hooks/use-track-impression.mjs +22 -25
- package/dist/hooks/use-track-impression.mjs.map +1 -1
- package/dist/hooks/use-web-analytics.cjs +98 -109
- package/dist/hooks/use-web-analytics.cjs.map +1 -1
- package/dist/hooks/use-web-analytics.d.cts +3 -1
- package/dist/hooks/use-web-analytics.d.cts.map +1 -0
- package/dist/hooks/{use-web-analytics.d.ts → use-web-analytics.d.mts} +3 -1
- package/dist/hooks/use-web-analytics.d.mts.map +1 -0
- package/dist/hooks/use-web-analytics.mjs +93 -80
- package/dist/hooks/use-web-analytics.mjs.map +1 -1
- package/dist/index.cjs +28 -74
- package/dist/index.d.cts +11 -13
- package/dist/index.d.mts +11 -0
- package/dist/index.mjs +3 -34
- package/dist/link/index.cjs +31 -58
- package/dist/link/index.cjs.map +1 -1
- package/dist/link/index.d.cts +7 -7
- package/dist/link/index.d.cts.map +1 -0
- package/dist/link/index.d.mts +11 -0
- package/dist/link/index.d.mts.map +1 -0
- package/dist/link/index.mjs +28 -31
- package/dist/link/index.mjs.map +1 -1
- package/dist/native/fbsdk.cjs +12 -33
- package/dist/native/fbsdk.cjs.map +1 -1
- package/dist/native/fbsdk.d.cts +4 -4
- package/dist/native/fbsdk.d.cts.map +1 -0
- package/dist/native/{fbsdk.d.ts → fbsdk.d.mts} +4 -4
- package/dist/native/fbsdk.d.mts.map +1 -0
- package/dist/native/fbsdk.mjs +10 -7
- package/dist/native/fbsdk.mjs.map +1 -1
- package/dist/native/fingerprint.cjs +41 -64
- package/dist/native/fingerprint.cjs.map +1 -1
- package/dist/native/fingerprint.d.cts +22 -20
- package/dist/native/fingerprint.d.cts.map +1 -0
- package/dist/native/fingerprint.d.mts +28 -0
- package/dist/native/fingerprint.d.mts.map +1 -0
- package/dist/native/fingerprint.mjs +36 -42
- package/dist/native/fingerprint.mjs.map +1 -1
- package/dist/native/firebase.cjs +12 -39
- package/dist/native/firebase.cjs.map +1 -1
- package/dist/native/firebase.d.cts +4 -4
- package/dist/native/firebase.d.cts.map +1 -0
- package/dist/native/firebase.d.mts +6 -0
- package/dist/native/firebase.d.mts.map +1 -0
- package/dist/native/firebase.mjs +10 -13
- package/dist/native/firebase.mjs.map +1 -1
- package/dist/native/index.cjs +11 -45
- package/dist/native/index.d.cts +4 -7
- package/dist/native/index.d.mts +4 -0
- package/dist/native/index.mjs +2 -12
- package/dist/native/posthog.cjs +5 -30
- package/dist/native/posthog.cjs.map +1 -1
- package/dist/native/posthog.d.cts +3 -1
- package/dist/native/posthog.d.cts.map +1 -0
- package/dist/native/posthog.d.mts +5 -0
- package/dist/native/posthog.d.mts.map +1 -0
- package/dist/native/posthog.mjs +5 -6
- package/dist/native/posthog.mjs.map +1 -1
- package/dist/native/setup.cjs +91 -129
- package/dist/native/setup.cjs.map +1 -1
- package/dist/native/setup.d.cts +6 -6
- package/dist/native/setup.d.cts.map +1 -0
- package/dist/native/{setup.d.ts → setup.d.mts} +6 -6
- package/dist/native/setup.d.mts.map +1 -0
- package/dist/native/setup.mjs +83 -105
- package/dist/native/setup.mjs.map +1 -1
- package/dist/next/index.cjs +72 -145
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +18 -19
- package/dist/next/index.d.cts.map +1 -0
- package/dist/next/index.d.mts +21 -0
- package/dist/next/index.d.mts.map +1 -0
- package/dist/next/index.mjs +65 -107
- package/dist/next/index.mjs.map +1 -1
- package/dist/react-router/index.cjs +80 -144
- package/dist/react-router/index.cjs.map +1 -1
- package/dist/react-router/index.d.cts +18 -19
- package/dist/react-router/index.d.cts.map +1 -0
- package/dist/react-router/index.d.mts +21 -0
- package/dist/react-router/index.d.mts.map +1 -0
- package/dist/react-router/index.mjs +75 -115
- package/dist/react-router/index.mjs.map +1 -1
- package/dist/schema/index.cjs +189 -233
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +308 -231
- package/dist/schema/index.d.cts.map +1 -0
- package/dist/schema/index.d.mts +401 -0
- package/dist/schema/index.d.mts.map +1 -0
- package/dist/schema/index.mjs +179 -222
- package/dist/schema/index.mjs.map +1 -1
- package/dist/server/index.cjs +9 -40
- package/dist/server/index.d.cts +5 -9
- package/dist/server/index.d.mts +5 -0
- package/dist/server/index.mjs +5 -12
- package/dist/server/linkedin-conversions-api.cjs +66 -95
- package/dist/server/linkedin-conversions-api.cjs.map +1 -1
- package/dist/server/linkedin-conversions-api.d.cts +45 -45
- package/dist/server/linkedin-conversions-api.d.cts.map +1 -0
- package/dist/server/linkedin-conversions-api.d.mts +56 -0
- package/dist/server/linkedin-conversions-api.d.mts.map +1 -0
- package/dist/server/linkedin-conversions-api.mjs +63 -68
- package/dist/server/linkedin-conversions-api.mjs.map +1 -1
- package/dist/server/meta-conversions-api.cjs +157 -265
- package/dist/server/meta-conversions-api.cjs.map +1 -1
- package/dist/server/meta-conversions-api.d.cts +8 -9
- package/dist/server/meta-conversions-api.d.cts.map +1 -0
- package/dist/server/meta-conversions-api.d.mts +10 -0
- package/dist/server/meta-conversions-api.d.mts.map +1 -0
- package/dist/server/meta-conversions-api.mjs +151 -243
- package/dist/server/meta-conversions-api.mjs.map +1 -1
- package/dist/server/openai-conversions-api.cjs +69 -96
- package/dist/server/openai-conversions-api.cjs.map +1 -1
- package/dist/server/openai-conversions-api.d.cts +34 -34
- package/dist/server/openai-conversions-api.d.cts.map +1 -0
- package/dist/server/openai-conversions-api.d.mts +47 -0
- package/dist/server/openai-conversions-api.d.mts.map +1 -0
- package/dist/server/openai-conversions-api.mjs +65 -68
- package/dist/server/openai-conversions-api.mjs.map +1 -1
- package/dist/server/reddit-conversions-api.cjs +64 -91
- package/dist/server/reddit-conversions-api.cjs.map +1 -1
- package/dist/server/reddit-conversions-api.d.cts +61 -61
- package/dist/server/reddit-conversions-api.d.cts.map +1 -0
- package/dist/server/reddit-conversions-api.d.mts +75 -0
- package/dist/server/reddit-conversions-api.d.mts.map +1 -0
- package/dist/server/reddit-conversions-api.mjs +59 -62
- package/dist/server/reddit-conversions-api.mjs.map +1 -1
- package/dist/setup/index.cjs +34 -63
- package/dist/setup/index.cjs.map +1 -1
- package/dist/setup/index.d.cts +30 -30
- package/dist/setup/index.d.cts.map +1 -0
- package/dist/setup/index.d.mts +41 -0
- package/dist/setup/index.d.mts.map +1 -0
- package/dist/setup/index.mjs +31 -36
- package/dist/setup/index.mjs.map +1 -1
- package/dist/setup/session.cjs +70 -106
- package/dist/setup/session.cjs.map +1 -1
- package/dist/setup/session.d.cts +26 -24
- package/dist/setup/session.d.cts.map +1 -0
- package/dist/setup/session.d.mts +31 -0
- package/dist/setup/session.d.mts.map +1 -0
- package/dist/setup/session.mjs +68 -80
- package/dist/setup/session.mjs.map +1 -1
- package/dist/tanstack/index.cjs +86 -156
- package/dist/tanstack/index.cjs.map +1 -1
- package/dist/tanstack/index.d.cts +19 -20
- package/dist/tanstack/index.d.cts.map +1 -0
- package/dist/tanstack/index.d.mts +22 -0
- package/dist/tanstack/index.d.mts.map +1 -0
- package/dist/tanstack/index.mjs +81 -127
- package/dist/tanstack/index.mjs.map +1 -1
- package/dist/third-parties/google-analytics.cjs +18 -43
- package/dist/third-parties/google-analytics.cjs.map +1 -1
- package/dist/third-parties/google-analytics.d.cts +7 -7
- package/dist/third-parties/google-analytics.d.cts.map +1 -0
- package/dist/third-parties/google-analytics.d.mts +12 -0
- package/dist/third-parties/google-analytics.d.mts.map +1 -0
- package/dist/third-parties/google-analytics.mjs +16 -17
- package/dist/third-parties/google-analytics.mjs.map +1 -1
- package/dist/third-parties/ignored-events.cjs +35 -68
- package/dist/third-parties/ignored-events.cjs.map +1 -1
- package/dist/third-parties/ignored-events.d.cts +3 -1
- package/dist/third-parties/ignored-events.d.cts.map +1 -0
- package/dist/third-parties/ignored-events.d.mts +5 -0
- package/dist/third-parties/ignored-events.d.mts.map +1 -0
- package/dist/third-parties/ignored-events.mjs +34 -43
- package/dist/third-parties/ignored-events.mjs.map +1 -1
- package/dist/third-parties/index.cjs +16 -53
- package/dist/third-parties/index.d.cts +6 -12
- package/dist/third-parties/index.d.mts +6 -0
- package/dist/third-parties/index.mjs +1 -14
- package/dist/third-parties/linkedin-insight-tag.cjs +28 -50
- package/dist/third-parties/linkedin-insight-tag.cjs.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.cts +8 -9
- package/dist/third-parties/linkedin-insight-tag.d.cts.map +1 -0
- package/dist/third-parties/{linkedin-insight-tag.d.ts → linkedin-insight-tag.d.mts} +8 -9
- package/dist/third-parties/linkedin-insight-tag.d.mts.map +1 -0
- package/dist/third-parties/linkedin-insight-tag.mjs +25 -23
- package/dist/third-parties/linkedin-insight-tag.mjs.map +1 -1
- package/dist/third-parties/meta-pixel.cjs +45 -66
- package/dist/third-parties/meta-pixel.cjs.map +1 -1
- package/dist/third-parties/meta-pixel.d.cts +7 -8
- package/dist/third-parties/meta-pixel.d.cts.map +1 -0
- package/dist/third-parties/meta-pixel.d.mts +12 -0
- package/dist/third-parties/meta-pixel.d.mts.map +1 -0
- package/dist/third-parties/meta-pixel.mjs +41 -38
- package/dist/third-parties/meta-pixel.mjs.map +1 -1
- package/dist/third-parties/openai-pixel.cjs +63 -68
- package/dist/third-parties/openai-pixel.cjs.map +1 -1
- package/dist/third-parties/openai-pixel.d.cts +7 -8
- package/dist/third-parties/openai-pixel.d.cts.map +1 -0
- package/dist/third-parties/{openai-pixel.d.ts → openai-pixel.d.mts} +7 -8
- package/dist/third-parties/openai-pixel.d.mts.map +1 -0
- package/dist/third-parties/openai-pixel.mjs +60 -41
- package/dist/third-parties/openai-pixel.mjs.map +1 -1
- package/dist/third-parties/posthog.cjs +23 -43
- package/dist/third-parties/posthog.cjs.map +1 -1
- package/dist/third-parties/posthog.d.cts +5 -5
- package/dist/third-parties/posthog.d.cts.map +1 -0
- package/dist/third-parties/{posthog.d.ts → posthog.d.mts} +5 -5
- package/dist/third-parties/posthog.d.mts.map +1 -0
- package/dist/third-parties/posthog.mjs +20 -16
- package/dist/third-parties/posthog.mjs.map +1 -1
- package/dist/third-parties/reddit-pixel.cjs +37 -58
- package/dist/third-parties/reddit-pixel.cjs.map +1 -1
- package/dist/third-parties/reddit-pixel.d.cts +7 -8
- package/dist/third-parties/reddit-pixel.d.cts.map +1 -0
- package/dist/third-parties/reddit-pixel.d.mts +12 -0
- package/dist/third-parties/reddit-pixel.d.mts.map +1 -0
- package/dist/third-parties/reddit-pixel.mjs +33 -30
- package/dist/third-parties/reddit-pixel.mjs.map +1 -1
- package/dist/track/fbq.cjs +179 -135
- package/dist/track/fbq.cjs.map +1 -1
- package/dist/track/fbq.d.cts +234 -233
- package/dist/track/fbq.d.cts.map +1 -0
- package/dist/track/fbq.d.mts +280 -0
- package/dist/track/fbq.d.mts.map +1 -0
- package/dist/track/fbq.mjs +176 -108
- package/dist/track/fbq.mjs.map +1 -1
- package/dist/track/gtag.cjs +63 -86
- package/dist/track/gtag.cjs.map +1 -1
- package/dist/track/gtag.d.cts +682 -682
- package/dist/track/gtag.d.cts.map +1 -0
- package/dist/track/gtag.d.mts +762 -0
- package/dist/track/gtag.d.mts.map +1 -0
- package/dist/track/gtag.mjs +62 -61
- package/dist/track/gtag.mjs.map +1 -1
- package/dist/track/index.cjs +111 -136
- package/dist/track/index.cjs.map +1 -1
- package/dist/track/index.d.cts +8 -8
- package/dist/track/index.d.cts.map +1 -0
- package/dist/track/{index.d.ts → index.d.mts} +8 -8
- package/dist/track/index.d.mts.map +1 -0
- package/dist/track/index.mjs +105 -106
- package/dist/track/index.mjs.map +1 -1
- package/dist/track/lintrk.cjs +0 -19
- package/dist/track/lintrk.d.cts +12 -10
- package/dist/track/lintrk.d.cts.map +1 -0
- package/dist/track/lintrk.d.mts +14 -0
- package/dist/track/lintrk.d.mts.map +1 -0
- package/dist/track/lintrk.mjs +1 -1
- package/dist/track/oaiq.cjs +153 -146
- package/dist/track/oaiq.cjs.map +1 -1
- package/dist/track/oaiq.d.cts +65 -64
- package/dist/track/oaiq.d.cts.map +1 -0
- package/dist/track/oaiq.d.mts +112 -0
- package/dist/track/oaiq.d.mts.map +1 -0
- package/dist/track/oaiq.mjs +149 -118
- package/dist/track/oaiq.mjs.map +1 -1
- package/dist/track/rdt.cjs +66 -110
- package/dist/track/rdt.cjs.map +1 -1
- package/dist/track/rdt.d.cts +74 -73
- package/dist/track/rdt.d.cts.map +1 -0
- package/dist/track/rdt.d.mts +97 -0
- package/dist/track/rdt.d.mts.map +1 -0
- package/dist/track/rdt.mjs +63 -83
- package/dist/track/rdt.mjs.map +1 -1
- package/dist/track/types.cjs +0 -19
- package/dist/track/types.d.cts +140 -111
- package/dist/track/types.d.cts.map +1 -0
- package/dist/track/types.d.mts +171 -0
- package/dist/track/types.d.mts.map +1 -0
- package/dist/track/types.mjs +1 -1
- package/dist/utils/field.cjs +8 -32
- package/dist/utils/field.cjs.map +1 -1
- package/dist/utils/field.d.cts +3 -1
- package/dist/utils/field.d.cts.map +1 -0
- package/dist/utils/{field.d.ts → field.d.mts} +3 -1
- package/dist/utils/field.d.mts.map +1 -0
- package/dist/utils/field.mjs +7 -7
- package/dist/utils/field.mjs.map +1 -1
- package/dist/utils/stripe.cjs +25 -49
- package/dist/utils/stripe.cjs.map +1 -1
- package/dist/utils/stripe.d.cts +3 -1
- package/dist/utils/stripe.d.cts.map +1 -0
- package/dist/utils/{stripe.d.ts → stripe.d.mts} +3 -1
- package/dist/utils/stripe.d.mts.map +1 -0
- package/dist/utils/stripe.mjs +23 -23
- package/dist/utils/stripe.mjs.map +1 -1
- package/dist/visitor/index.cjs +60 -86
- package/dist/visitor/index.cjs.map +1 -1
- package/dist/visitor/index.d.cts +4 -5
- package/dist/visitor/index.d.cts.map +1 -0
- package/dist/visitor/{index.d.ts → index.d.mts} +4 -5
- package/dist/visitor/index.d.mts.map +1 -0
- package/dist/visitor/index.mjs +57 -59
- package/dist/visitor/index.mjs.map +1 -1
- package/dist/visitor/types.cjs +0 -19
- package/dist/visitor/types.d.cts +14 -14
- package/dist/visitor/types.d.cts.map +1 -0
- package/dist/visitor/types.d.mts +20 -0
- package/dist/visitor/types.d.mts.map +1 -0
- package/dist/visitor/types.mjs +1 -1
- package/dist/web/index.cjs +108 -148
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +5 -6
- package/dist/web/index.d.cts.map +1 -0
- package/dist/web/index.d.mts +9 -0
- package/dist/web/index.d.mts.map +1 -0
- package/dist/web/index.mjs +101 -109
- package/dist/web/index.mjs.map +1 -1
- package/package.json +102 -49
- package/dist/constants/storage.d.ts +0 -11
- package/dist/feedback/index.d.ts +0 -6
- package/dist/hooks/use-app-analytics.d.ts +0 -3
- package/dist/hooks/use-click-id-persistence.d.ts +0 -3
- package/dist/hooks/use-previous.d.ts +0 -3
- package/dist/hooks/use-track-impression.d.ts +0 -7
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.mjs.map +0 -1
- package/dist/link/index.d.ts +0 -11
- package/dist/native/fingerprint.d.ts +0 -26
- package/dist/native/firebase.d.ts +0 -6
- package/dist/native/index.cjs.map +0 -1
- package/dist/native/index.d.ts +0 -7
- package/dist/native/index.mjs.map +0 -1
- package/dist/native/posthog.d.ts +0 -3
- package/dist/next/index.d.ts +0 -22
- package/dist/react-router/index.d.ts +0 -22
- package/dist/schema/index.d.ts +0 -324
- package/dist/server/index.cjs.map +0 -1
- package/dist/server/index.d.ts +0 -9
- package/dist/server/index.mjs.map +0 -1
- package/dist/server/linkedin-conversions-api.d.ts +0 -56
- package/dist/server/meta-conversions-api.d.ts +0 -11
- package/dist/server/openai-conversions-api.d.ts +0 -47
- package/dist/server/reddit-conversions-api.d.ts +0 -75
- package/dist/setup/index.d.ts +0 -41
- package/dist/setup/session.d.ts +0 -29
- package/dist/tanstack/index.d.ts +0 -23
- package/dist/third-parties/google-analytics.d.ts +0 -12
- package/dist/third-parties/ignored-events.d.ts +0 -3
- package/dist/third-parties/index.cjs.map +0 -1
- package/dist/third-parties/index.d.ts +0 -12
- package/dist/third-parties/index.mjs.map +0 -1
- package/dist/third-parties/meta-pixel.d.ts +0 -13
- package/dist/third-parties/reddit-pixel.d.ts +0 -13
- package/dist/track/fbq.d.ts +0 -279
- package/dist/track/gtag.d.ts +0 -762
- package/dist/track/lintrk.cjs.map +0 -1
- package/dist/track/lintrk.d.ts +0 -12
- package/dist/track/lintrk.mjs.map +0 -1
- package/dist/track/oaiq.d.ts +0 -111
- package/dist/track/rdt.d.ts +0 -96
- package/dist/track/types.cjs.map +0 -1
- package/dist/track/types.d.ts +0 -142
- package/dist/track/types.mjs.map +0 -1
- package/dist/visitor/types.cjs.map +0 -1
- package/dist/visitor/types.d.ts +0 -20
- package/dist/visitor/types.mjs.map +0 -1
- package/dist/web/index.d.ts +0 -10
package/dist/web/index.cjs
CHANGED
|
@@ -1,154 +1,114 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/web/index.ts
|
|
31
|
-
var web_exports = {};
|
|
32
|
-
__export(web_exports, {
|
|
33
|
-
getDeviceId: () => getDeviceId,
|
|
34
|
-
getTags: () => getTags,
|
|
35
|
-
storage: () => storage
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(web_exports);
|
|
38
|
-
var import_utils = require("@shware/utils");
|
|
39
|
-
var import_bowser = __toESM(require("bowser"), 1);
|
|
40
|
-
var import_cookie = require("cookie");
|
|
41
|
-
var import_uuid = require("uuid");
|
|
42
|
-
var import_storage = require("../constants/storage.cjs");
|
|
43
|
-
var import_link = require("../link/index.cjs");
|
|
44
|
-
var import_setup = require("../setup/index.cjs");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_setup_index = require("../setup/index.cjs");
|
|
4
|
+
const require_constants_storage = require("../constants/storage.cjs");
|
|
5
|
+
const require_link_index = require("../link/index.cjs");
|
|
6
|
+
let _shware_utils = require("@shware/utils");
|
|
7
|
+
let uuid = require("uuid");
|
|
8
|
+
let cookie = require("cookie");
|
|
9
|
+
let bowser = require("bowser");
|
|
10
|
+
bowser = require_runtime.__toESM(bowser, 1);
|
|
11
|
+
//#region src/web/index.ts
|
|
45
12
|
function getDeviceId() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
13
|
+
const cached = localStorage.getItem(require_constants_storage.keys.device_id);
|
|
14
|
+
if (cached) return cached;
|
|
15
|
+
const id = crypto?.randomUUID ? crypto.randomUUID() : (0, uuid.v4)();
|
|
16
|
+
localStorage.setItem(require_constants_storage.keys.device_id, id);
|
|
17
|
+
return id;
|
|
51
18
|
}
|
|
52
19
|
async function getTags() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
utm_source_platform: (link == null ? void 0 : link.utm_source_platform) ?? params.get("utm_source_platform") ?? void 0,
|
|
123
|
-
utm_creative_format: (link == null ? void 0 : link.utm_creative_format) ?? params.get("utm_creative_format") ?? void 0,
|
|
124
|
-
utm_marketing_tactic: (link == null ? void 0 : link.utm_marketing_tactic) ?? params.get("utm_marketing_tactic") ?? void 0
|
|
125
|
-
};
|
|
126
|
-
import_setup.cache.tags = tags;
|
|
127
|
-
return tags;
|
|
20
|
+
const parser = bowser.default.getParser(window.navigator.userAgent);
|
|
21
|
+
const params = new URLSearchParams(window.location.search);
|
|
22
|
+
const os = parser.getOS();
|
|
23
|
+
const browser = parser.getBrowser();
|
|
24
|
+
const platform = parser.getPlatform();
|
|
25
|
+
const parsed = (0, cookie.parseCookie)(document.cookie);
|
|
26
|
+
const linkId = params.get("s");
|
|
27
|
+
const link = linkId ? await require_link_index.getLink(linkId) : null;
|
|
28
|
+
const tags = {
|
|
29
|
+
os: `${os.name} ${os.version}`,
|
|
30
|
+
os_name: os.name,
|
|
31
|
+
os_version: os.version,
|
|
32
|
+
browser: `${browser.name} ${browser.version}`,
|
|
33
|
+
browser_name: browser.name,
|
|
34
|
+
browser_version: browser.version,
|
|
35
|
+
platform: "web",
|
|
36
|
+
device: platform.model,
|
|
37
|
+
device_id: getDeviceId(),
|
|
38
|
+
device_type: platform.type,
|
|
39
|
+
device_vendor: platform.vendor,
|
|
40
|
+
device_pixel_ratio: window.devicePixelRatio,
|
|
41
|
+
screen_width: window.screen.width,
|
|
42
|
+
screen_height: window.screen.height,
|
|
43
|
+
screen_resolution: `${window.screen.width}x${window.screen.height}`,
|
|
44
|
+
release: require_setup_index.config.release,
|
|
45
|
+
language: navigator.language,
|
|
46
|
+
time_zone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
47
|
+
environment: process.env.NODE_ENV === "development" ? "development" : "production",
|
|
48
|
+
source: "web",
|
|
49
|
+
source_url: window.location.href,
|
|
50
|
+
page_referrer: document.referrer || void 0,
|
|
51
|
+
fbc: parsed._fbc ?? _shware_utils.expiringStorage.getItem(require_constants_storage.keys.fbc) ?? void 0,
|
|
52
|
+
fbp: parsed._fbp,
|
|
53
|
+
fbclid: params.get("fbclid") ?? _shware_utils.expiringStorage.getItem(require_constants_storage.keys.fbclid) ?? void 0,
|
|
54
|
+
ad_id: params.get("ad_id") ?? void 0,
|
|
55
|
+
ad_name: params.get("ad_name") ?? void 0,
|
|
56
|
+
adset_id: params.get("adset_id") ?? void 0,
|
|
57
|
+
adset_name: params.get("adset_name") ?? void 0,
|
|
58
|
+
campaign_id: params.get("campaign_id") ?? void 0,
|
|
59
|
+
campaign_name: params.get("campaign_name") ?? void 0,
|
|
60
|
+
placement: params.get("placement") ?? void 0,
|
|
61
|
+
site_source_name: params.get("site_source_name") ?? void 0,
|
|
62
|
+
gclid: params.get("gclid") ?? void 0,
|
|
63
|
+
gclsrc: params.get("gclsrc") ?? void 0,
|
|
64
|
+
gad_source: params.get("gad_source") ?? void 0,
|
|
65
|
+
gad_campaignid: params.get("gad_campaignid") ?? void 0,
|
|
66
|
+
rdt_cid: params.get("rdt_cid") ?? parsed._rdt_cid ?? _shware_utils.expiringStorage.getItem(require_constants_storage.keys.rdt_cid) ?? void 0,
|
|
67
|
+
rdt_uuid: parsed._rdt_uuid,
|
|
68
|
+
li_fat_id: params.get("li_fat_id") ?? parsed.li_fat_id ?? void 0,
|
|
69
|
+
dclid: params.get("dclid") ?? void 0,
|
|
70
|
+
ko_click_id: params.get("ko_click_id") ?? void 0,
|
|
71
|
+
msclkid: params.get("msclkid") ?? void 0,
|
|
72
|
+
sccid: params.get("sccid") ?? void 0,
|
|
73
|
+
ttclid: params.get("ttclid") ?? void 0,
|
|
74
|
+
twclid: params.get("twclid") ?? void 0,
|
|
75
|
+
wbraid: params.get("wbraid") ?? void 0,
|
|
76
|
+
yclid: params.get("yclid") ?? void 0,
|
|
77
|
+
utm_source: link?.utm_source ?? params.get("utm_source") ?? void 0,
|
|
78
|
+
utm_medium: link?.utm_medium ?? params.get("utm_medium") ?? void 0,
|
|
79
|
+
utm_campaign: link?.utm_campaign ?? params.get("utm_campaign") ?? void 0,
|
|
80
|
+
utm_term: link?.utm_term ?? params.get("utm_term") ?? void 0,
|
|
81
|
+
utm_content: link?.utm_content ?? params.get("utm_content") ?? void 0,
|
|
82
|
+
utm_id: link?.utm_id ?? params.get("utm_id") ?? void 0,
|
|
83
|
+
utm_source_platform: link?.utm_source_platform ?? params.get("utm_source_platform") ?? void 0,
|
|
84
|
+
utm_creative_format: link?.utm_creative_format ?? params.get("utm_creative_format") ?? void 0,
|
|
85
|
+
utm_marketing_tactic: link?.utm_marketing_tactic ?? params.get("utm_marketing_tactic") ?? void 0
|
|
86
|
+
};
|
|
87
|
+
require_setup_index.cache.tags = tags;
|
|
88
|
+
return tags;
|
|
128
89
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
90
|
+
const map = /* @__PURE__ */ new Map();
|
|
91
|
+
const storage = {
|
|
92
|
+
getItem: (key) => {
|
|
93
|
+
try {
|
|
94
|
+
return localStorage.getItem(key);
|
|
95
|
+
} catch {
|
|
96
|
+
console.error("localStorage is not available");
|
|
97
|
+
return map.get(key) ?? null;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
setItem: (key, value) => {
|
|
101
|
+
try {
|
|
102
|
+
localStorage.setItem(key, value);
|
|
103
|
+
} catch {
|
|
104
|
+
console.error("localStorage is not available");
|
|
105
|
+
map.set(key, value);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
147
108
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
109
|
+
//#endregion
|
|
110
|
+
exports.getDeviceId = getDeviceId;
|
|
111
|
+
exports.getTags = getTags;
|
|
112
|
+
exports.storage = storage;
|
|
113
|
+
|
|
154
114
|
//# sourceMappingURL=index.cjs.map
|
package/dist/web/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/web/index.ts"],"sourcesContent":["import { expiringStorage } from '@shware/utils';\nimport Bowser from 'bowser';\nimport { parseCookie } from 'cookie';\nimport { v4 as uuidv4 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { getLink } from '../link/index';\nimport { type Storage, cache, config } from '../setup/index';\nimport type { TrackTags } from '../track/types';\n\nexport function getDeviceId() {\n const cached = localStorage.getItem(keys.device_id);\n if (cached) return cached;\n const id = crypto?.randomUUID ? crypto.randomUUID() : uuidv4();\n localStorage.setItem(keys.device_id, id);\n return id;\n}\n\nexport async function getTags() {\n const parser = Bowser.getParser(window.navigator.userAgent);\n const params = new URLSearchParams(window.location.search);\n const os = parser.getOS();\n const browser = parser.getBrowser();\n const platform = parser.getPlatform();\n const parsed = parseCookie(document.cookie);\n\n const linkId = params.get('s');\n const link = linkId ? await getLink(linkId) : null;\n\n const tags: TrackTags = {\n os: `${os.name} ${os.version}`,\n os_name: os.name,\n os_version: os.version,\n browser: `${browser.name} ${browser.version}`,\n browser_name: browser.name,\n browser_version: browser.version,\n platform: 'web',\n device: platform.model,\n device_id: getDeviceId(),\n device_type: platform.type,\n device_vendor: platform.vendor,\n device_pixel_ratio: window.devicePixelRatio,\n screen_width: window.screen.width,\n screen_height: window.screen.height,\n screen_resolution: `${window.screen.width}x${window.screen.height}`,\n release: config.release,\n language: navigator.language,\n time_zone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n environment: process.env.NODE_ENV === 'development' ? 'development' : 'production',\n source: 'web',\n source_url: window.location.href,\n page_referrer: document.referrer || undefined,\n // Meta Ads\n fbc: parsed._fbc ?? expiringStorage.getItem<string>(keys.fbc) ?? undefined,\n fbp: parsed._fbp,\n fbclid: params.get('fbclid') ?? expiringStorage.getItem<string>(keys.fbclid) ?? undefined,\n ad_id: params.get('ad_id') ?? undefined,\n ad_name: params.get('ad_name') ?? undefined,\n adset_id: params.get('adset_id') ?? undefined,\n adset_name: params.get('adset_name') ?? undefined,\n campaign_id: params.get('campaign_id') ?? undefined,\n campaign_name: params.get('campaign_name') ?? undefined,\n placement: params.get('placement') ?? undefined,\n site_source_name: params.get('site_source_name') ?? undefined,\n // Google Ads\n gclid: params.get('gclid') ?? undefined,\n gclsrc: params.get('gclsrc') ?? undefined,\n gad_source: params.get('gad_source') ?? undefined,\n gad_campaignid: params.get('gad_campaignid') ?? undefined,\n // Reddit Ads\n rdt_cid:\n params.get('rdt_cid') ??\n parsed._rdt_cid ??\n expiringStorage.getItem<string>(keys.rdt_cid) ??\n undefined,\n rdt_uuid: parsed._rdt_uuid,\n // LinkedIn Ads: get click id from url params or first-party cookie\n li_fat_id: params.get('li_fat_id') ?? parsed.li_fat_id ?? undefined,\n // click ids\n dclid: params.get('dclid') ?? undefined,\n ko_click_id: params.get('ko_click_id') ?? undefined,\n msclkid: params.get('msclkid') ?? undefined,\n sccid: params.get('sccid') ?? undefined,\n ttclid: params.get('ttclid') ?? undefined,\n twclid: params.get('twclid') ?? undefined,\n wbraid: params.get('wbraid') ?? undefined,\n yclid: params.get('yclid') ?? undefined,\n // utm params\n utm_source: link?.utm_source ?? params.get('utm_source') ?? undefined,\n utm_medium: link?.utm_medium ?? params.get('utm_medium') ?? undefined,\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign') ?? undefined,\n utm_term: link?.utm_term ?? params.get('utm_term') ?? undefined,\n utm_content: link?.utm_content ?? params.get('utm_content') ?? undefined,\n utm_id: link?.utm_id ?? params.get('utm_id') ?? undefined,\n utm_source_platform:\n link?.utm_source_platform ?? params.get('utm_source_platform') ?? undefined,\n utm_creative_format:\n link?.utm_creative_format ?? params.get('utm_creative_format') ?? undefined,\n utm_marketing_tactic:\n link?.utm_marketing_tactic ?? params.get('utm_marketing_tactic') ?? undefined,\n };\n\n cache.tags = tags;\n return tags;\n}\n\nconst map = new Map<string, string>();\n\nexport const storage: Storage = {\n getItem: (key) => {\n try {\n return localStorage.getItem(key);\n } catch {\n console.error('localStorage is not available');\n return map.get(key) ?? null;\n }\n },\n setItem: (key, value) => {\n try {\n localStorage.setItem(key, value);\n } catch {\n console.error('localStorage is not available');\n map.set(key, value);\n }\n },\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["keys","Bowser","getLink","config","expiringStorage"],"sources":["../../src/web/index.ts"],"sourcesContent":["import { expiringStorage } from '@shware/utils';\nimport Bowser from 'bowser';\nimport { parseCookie } from 'cookie';\nimport { v4 as uuidv4 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { getLink } from '../link/index';\nimport { type Storage, cache, config } from '../setup/index';\nimport type { TrackTags } from '../track/types';\n\nexport function getDeviceId() {\n const cached = localStorage.getItem(keys.device_id);\n if (cached) return cached;\n const id = crypto?.randomUUID ? crypto.randomUUID() : uuidv4();\n localStorage.setItem(keys.device_id, id);\n return id;\n}\n\nexport async function getTags() {\n const parser = Bowser.getParser(window.navigator.userAgent);\n const params = new URLSearchParams(window.location.search);\n const os = parser.getOS();\n const browser = parser.getBrowser();\n const platform = parser.getPlatform();\n const parsed = parseCookie(document.cookie);\n\n const linkId = params.get('s');\n const link = linkId ? await getLink(linkId) : null;\n\n const tags: TrackTags = {\n os: `${os.name} ${os.version}`,\n os_name: os.name,\n os_version: os.version,\n browser: `${browser.name} ${browser.version}`,\n browser_name: browser.name,\n browser_version: browser.version,\n platform: 'web',\n device: platform.model,\n device_id: getDeviceId(),\n device_type: platform.type,\n device_vendor: platform.vendor,\n device_pixel_ratio: window.devicePixelRatio,\n screen_width: window.screen.width,\n screen_height: window.screen.height,\n screen_resolution: `${window.screen.width}x${window.screen.height}`,\n release: config.release,\n language: navigator.language,\n time_zone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n environment: process.env.NODE_ENV === 'development' ? 'development' : 'production',\n source: 'web',\n source_url: window.location.href,\n page_referrer: document.referrer || undefined,\n // Meta Ads\n fbc: parsed._fbc ?? expiringStorage.getItem<string>(keys.fbc) ?? undefined,\n fbp: parsed._fbp,\n fbclid: params.get('fbclid') ?? expiringStorage.getItem<string>(keys.fbclid) ?? undefined,\n ad_id: params.get('ad_id') ?? undefined,\n ad_name: params.get('ad_name') ?? undefined,\n adset_id: params.get('adset_id') ?? undefined,\n adset_name: params.get('adset_name') ?? undefined,\n campaign_id: params.get('campaign_id') ?? undefined,\n campaign_name: params.get('campaign_name') ?? undefined,\n placement: params.get('placement') ?? undefined,\n site_source_name: params.get('site_source_name') ?? undefined,\n // Google Ads\n gclid: params.get('gclid') ?? undefined,\n gclsrc: params.get('gclsrc') ?? undefined,\n gad_source: params.get('gad_source') ?? undefined,\n gad_campaignid: params.get('gad_campaignid') ?? undefined,\n // Reddit Ads\n rdt_cid:\n params.get('rdt_cid') ??\n parsed._rdt_cid ??\n expiringStorage.getItem<string>(keys.rdt_cid) ??\n undefined,\n rdt_uuid: parsed._rdt_uuid,\n // LinkedIn Ads: get click id from url params or first-party cookie\n li_fat_id: params.get('li_fat_id') ?? parsed.li_fat_id ?? undefined,\n // click ids\n dclid: params.get('dclid') ?? undefined,\n ko_click_id: params.get('ko_click_id') ?? undefined,\n msclkid: params.get('msclkid') ?? undefined,\n sccid: params.get('sccid') ?? undefined,\n ttclid: params.get('ttclid') ?? undefined,\n twclid: params.get('twclid') ?? undefined,\n wbraid: params.get('wbraid') ?? undefined,\n yclid: params.get('yclid') ?? undefined,\n // utm params\n utm_source: link?.utm_source ?? params.get('utm_source') ?? undefined,\n utm_medium: link?.utm_medium ?? params.get('utm_medium') ?? undefined,\n utm_campaign: link?.utm_campaign ?? params.get('utm_campaign') ?? undefined,\n utm_term: link?.utm_term ?? params.get('utm_term') ?? undefined,\n utm_content: link?.utm_content ?? params.get('utm_content') ?? undefined,\n utm_id: link?.utm_id ?? params.get('utm_id') ?? undefined,\n utm_source_platform:\n link?.utm_source_platform ?? params.get('utm_source_platform') ?? undefined,\n utm_creative_format:\n link?.utm_creative_format ?? params.get('utm_creative_format') ?? undefined,\n utm_marketing_tactic:\n link?.utm_marketing_tactic ?? params.get('utm_marketing_tactic') ?? undefined,\n };\n\n cache.tags = tags;\n return tags;\n}\n\nconst map = new Map<string, string>();\n\nexport const storage: Storage = {\n getItem: (key) => {\n try {\n return localStorage.getItem(key);\n } catch {\n console.error('localStorage is not available');\n return map.get(key) ?? null;\n }\n },\n setItem: (key, value) => {\n try {\n localStorage.setItem(key, value);\n } catch {\n console.error('localStorage is not available');\n map.set(key, value);\n }\n },\n};\n"],"mappings":"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"}
|
package/dist/web/index.d.cts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import '../track/gtag.cjs';
|
|
5
|
-
|
|
1
|
+
import { TrackTags } from "../track/types.cjs";
|
|
2
|
+
import { Storage } from "../setup/index.cjs";
|
|
3
|
+
//#region src/web/index.d.ts
|
|
6
4
|
declare function getDeviceId(): string;
|
|
7
5
|
declare function getTags(): Promise<TrackTags>;
|
|
8
6
|
declare const storage: Storage;
|
|
9
|
-
|
|
7
|
+
//#endregion
|
|
10
8
|
export { getDeviceId, getTags, storage };
|
|
9
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/web/index.ts"],"mappings":";;;iBASgB;iBAQM,WAAO,QAAA;cA0FhB,SAAS"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TrackTags } from "../track/types.mjs";
|
|
2
|
+
import { Storage } from "../setup/index.mjs";
|
|
3
|
+
//#region src/web/index.d.ts
|
|
4
|
+
declare function getDeviceId(): string;
|
|
5
|
+
declare function getTags(): Promise<TrackTags>;
|
|
6
|
+
declare const storage: Storage;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getDeviceId, getTags, storage };
|
|
9
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/web/index.ts"],"mappings":";;;iBASgB;iBAQM,WAAO,QAAA;cA0FhB,SAAS"}
|
package/dist/web/index.mjs
CHANGED
|
@@ -1,117 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
import { expiringStorage } from "@shware/utils";
|
|
3
|
-
import Bowser from "bowser";
|
|
4
|
-
import { parseCookie } from "cookie";
|
|
5
|
-
import { v4 as uuidv4 } from "uuid";
|
|
1
|
+
import { cache, config } from "../setup/index.mjs";
|
|
6
2
|
import { keys } from "../constants/storage.mjs";
|
|
7
3
|
import { getLink } from "../link/index.mjs";
|
|
8
|
-
import {
|
|
4
|
+
import { expiringStorage } from "@shware/utils";
|
|
5
|
+
import { v4 } from "uuid";
|
|
6
|
+
import { parseCookie } from "cookie";
|
|
7
|
+
import Bowser from "bowser";
|
|
8
|
+
//#region src/web/index.ts
|
|
9
9
|
function getDeviceId() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const cached = localStorage.getItem(keys.device_id);
|
|
11
|
+
if (cached) return cached;
|
|
12
|
+
const id = crypto?.randomUUID ? crypto.randomUUID() : v4();
|
|
13
|
+
localStorage.setItem(keys.device_id, id);
|
|
14
|
+
return id;
|
|
15
15
|
}
|
|
16
16
|
async function getTags() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
utm_source_platform: (link == null ? void 0 : link.utm_source_platform) ?? params.get("utm_source_platform") ?? void 0,
|
|
87
|
-
utm_creative_format: (link == null ? void 0 : link.utm_creative_format) ?? params.get("utm_creative_format") ?? void 0,
|
|
88
|
-
utm_marketing_tactic: (link == null ? void 0 : link.utm_marketing_tactic) ?? params.get("utm_marketing_tactic") ?? void 0
|
|
89
|
-
};
|
|
90
|
-
cache.tags = tags;
|
|
91
|
-
return tags;
|
|
17
|
+
const parser = Bowser.getParser(window.navigator.userAgent);
|
|
18
|
+
const params = new URLSearchParams(window.location.search);
|
|
19
|
+
const os = parser.getOS();
|
|
20
|
+
const browser = parser.getBrowser();
|
|
21
|
+
const platform = parser.getPlatform();
|
|
22
|
+
const parsed = parseCookie(document.cookie);
|
|
23
|
+
const linkId = params.get("s");
|
|
24
|
+
const link = linkId ? await getLink(linkId) : null;
|
|
25
|
+
const tags = {
|
|
26
|
+
os: `${os.name} ${os.version}`,
|
|
27
|
+
os_name: os.name,
|
|
28
|
+
os_version: os.version,
|
|
29
|
+
browser: `${browser.name} ${browser.version}`,
|
|
30
|
+
browser_name: browser.name,
|
|
31
|
+
browser_version: browser.version,
|
|
32
|
+
platform: "web",
|
|
33
|
+
device: platform.model,
|
|
34
|
+
device_id: getDeviceId(),
|
|
35
|
+
device_type: platform.type,
|
|
36
|
+
device_vendor: platform.vendor,
|
|
37
|
+
device_pixel_ratio: window.devicePixelRatio,
|
|
38
|
+
screen_width: window.screen.width,
|
|
39
|
+
screen_height: window.screen.height,
|
|
40
|
+
screen_resolution: `${window.screen.width}x${window.screen.height}`,
|
|
41
|
+
release: config.release,
|
|
42
|
+
language: navigator.language,
|
|
43
|
+
time_zone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
44
|
+
environment: process.env.NODE_ENV === "development" ? "development" : "production",
|
|
45
|
+
source: "web",
|
|
46
|
+
source_url: window.location.href,
|
|
47
|
+
page_referrer: document.referrer || void 0,
|
|
48
|
+
fbc: parsed._fbc ?? expiringStorage.getItem(keys.fbc) ?? void 0,
|
|
49
|
+
fbp: parsed._fbp,
|
|
50
|
+
fbclid: params.get("fbclid") ?? expiringStorage.getItem(keys.fbclid) ?? void 0,
|
|
51
|
+
ad_id: params.get("ad_id") ?? void 0,
|
|
52
|
+
ad_name: params.get("ad_name") ?? void 0,
|
|
53
|
+
adset_id: params.get("adset_id") ?? void 0,
|
|
54
|
+
adset_name: params.get("adset_name") ?? void 0,
|
|
55
|
+
campaign_id: params.get("campaign_id") ?? void 0,
|
|
56
|
+
campaign_name: params.get("campaign_name") ?? void 0,
|
|
57
|
+
placement: params.get("placement") ?? void 0,
|
|
58
|
+
site_source_name: params.get("site_source_name") ?? void 0,
|
|
59
|
+
gclid: params.get("gclid") ?? void 0,
|
|
60
|
+
gclsrc: params.get("gclsrc") ?? void 0,
|
|
61
|
+
gad_source: params.get("gad_source") ?? void 0,
|
|
62
|
+
gad_campaignid: params.get("gad_campaignid") ?? void 0,
|
|
63
|
+
rdt_cid: params.get("rdt_cid") ?? parsed._rdt_cid ?? expiringStorage.getItem(keys.rdt_cid) ?? void 0,
|
|
64
|
+
rdt_uuid: parsed._rdt_uuid,
|
|
65
|
+
li_fat_id: params.get("li_fat_id") ?? parsed.li_fat_id ?? void 0,
|
|
66
|
+
dclid: params.get("dclid") ?? void 0,
|
|
67
|
+
ko_click_id: params.get("ko_click_id") ?? void 0,
|
|
68
|
+
msclkid: params.get("msclkid") ?? void 0,
|
|
69
|
+
sccid: params.get("sccid") ?? void 0,
|
|
70
|
+
ttclid: params.get("ttclid") ?? void 0,
|
|
71
|
+
twclid: params.get("twclid") ?? void 0,
|
|
72
|
+
wbraid: params.get("wbraid") ?? void 0,
|
|
73
|
+
yclid: params.get("yclid") ?? void 0,
|
|
74
|
+
utm_source: link?.utm_source ?? params.get("utm_source") ?? void 0,
|
|
75
|
+
utm_medium: link?.utm_medium ?? params.get("utm_medium") ?? void 0,
|
|
76
|
+
utm_campaign: link?.utm_campaign ?? params.get("utm_campaign") ?? void 0,
|
|
77
|
+
utm_term: link?.utm_term ?? params.get("utm_term") ?? void 0,
|
|
78
|
+
utm_content: link?.utm_content ?? params.get("utm_content") ?? void 0,
|
|
79
|
+
utm_id: link?.utm_id ?? params.get("utm_id") ?? void 0,
|
|
80
|
+
utm_source_platform: link?.utm_source_platform ?? params.get("utm_source_platform") ?? void 0,
|
|
81
|
+
utm_creative_format: link?.utm_creative_format ?? params.get("utm_creative_format") ?? void 0,
|
|
82
|
+
utm_marketing_tactic: link?.utm_marketing_tactic ?? params.get("utm_marketing_tactic") ?? void 0
|
|
83
|
+
};
|
|
84
|
+
cache.tags = tags;
|
|
85
|
+
return tags;
|
|
92
86
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
112
|
-
export {
|
|
113
|
-
getDeviceId,
|
|
114
|
-
getTags,
|
|
115
|
-
storage
|
|
87
|
+
const map = /* @__PURE__ */ new Map();
|
|
88
|
+
const storage = {
|
|
89
|
+
getItem: (key) => {
|
|
90
|
+
try {
|
|
91
|
+
return localStorage.getItem(key);
|
|
92
|
+
} catch {
|
|
93
|
+
console.error("localStorage is not available");
|
|
94
|
+
return map.get(key) ?? null;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
setItem: (key, value) => {
|
|
98
|
+
try {
|
|
99
|
+
localStorage.setItem(key, value);
|
|
100
|
+
} catch {
|
|
101
|
+
console.error("localStorage is not available");
|
|
102
|
+
map.set(key, value);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
116
105
|
};
|
|
106
|
+
//#endregion
|
|
107
|
+
export { getDeviceId, getTags, storage };
|
|
108
|
+
|
|
117
109
|
//# sourceMappingURL=index.mjs.map
|