@walkeros/web-destination-plausible 0.0.0-next-20251219153324

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,59 @@
1
+ import { WalkerOS, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ plausible?: Plausible & {
7
+ q?: IArguments[];
8
+ };
9
+ }
10
+ }
11
+ type Plausible = (event: string, options?: {
12
+ props?: WalkerOS.AnyObject;
13
+ }) => void;
14
+ interface Mapping {
15
+ }
16
+ interface Env extends DestinationWeb.Env {
17
+ window: {
18
+ plausible: Plausible & {
19
+ q?: IArguments[];
20
+ };
21
+ };
22
+ }
23
+ type Rule = Mapping$1.Rule<Mapping>;
24
+
25
+ declare const init: Env | undefined;
26
+ declare const push: Env;
27
+
28
+ declare const env_init: typeof init;
29
+ declare const env_push: typeof push;
30
+ declare namespace env {
31
+ export { env_init as init, env_push as push };
32
+ }
33
+
34
+ declare function purchase$1(): unknown[];
35
+ declare function customEvent$1(): unknown[];
36
+
37
+ declare namespace events {
38
+ export { customEvent$1 as customEvent, purchase$1 as purchase };
39
+ }
40
+
41
+ declare const customEvent: Rule;
42
+ declare const purchase: Rule;
43
+ declare const config: {
44
+ entity: {
45
+ action: Rule;
46
+ };
47
+ order: {
48
+ complete: Rule;
49
+ };
50
+ };
51
+
52
+ declare const mapping_config: typeof config;
53
+ declare const mapping_customEvent: typeof customEvent;
54
+ declare const mapping_purchase: typeof purchase;
55
+ declare namespace mapping {
56
+ export { mapping_config as config, mapping_customEvent as customEvent, mapping_purchase as purchase };
57
+ }
58
+
59
+ export { env, events, mapping };
@@ -0,0 +1,59 @@
1
+ import { WalkerOS, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ plausible?: Plausible & {
7
+ q?: IArguments[];
8
+ };
9
+ }
10
+ }
11
+ type Plausible = (event: string, options?: {
12
+ props?: WalkerOS.AnyObject;
13
+ }) => void;
14
+ interface Mapping {
15
+ }
16
+ interface Env extends DestinationWeb.Env {
17
+ window: {
18
+ plausible: Plausible & {
19
+ q?: IArguments[];
20
+ };
21
+ };
22
+ }
23
+ type Rule = Mapping$1.Rule<Mapping>;
24
+
25
+ declare const init: Env | undefined;
26
+ declare const push: Env;
27
+
28
+ declare const env_init: typeof init;
29
+ declare const env_push: typeof push;
30
+ declare namespace env {
31
+ export { env_init as init, env_push as push };
32
+ }
33
+
34
+ declare function purchase$1(): unknown[];
35
+ declare function customEvent$1(): unknown[];
36
+
37
+ declare namespace events {
38
+ export { customEvent$1 as customEvent, purchase$1 as purchase };
39
+ }
40
+
41
+ declare const customEvent: Rule;
42
+ declare const purchase: Rule;
43
+ declare const config: {
44
+ entity: {
45
+ action: Rule;
46
+ };
47
+ order: {
48
+ complete: Rule;
49
+ };
50
+ };
51
+
52
+ declare const mapping_config: typeof config;
53
+ declare const mapping_customEvent: typeof customEvent;
54
+ declare const mapping_purchase: typeof purchase;
55
+ declare namespace mapping {
56
+ export { mapping_config as config, mapping_customEvent as customEvent, mapping_purchase as purchase };
57
+ }
58
+
59
+ export { env, events, mapping };
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/examples/index.ts
21
+ var examples_exports = {};
22
+ __export(examples_exports, {
23
+ env: () => env_exports,
24
+ events: () => events_exports,
25
+ mapping: () => mapping_exports
26
+ });
27
+ module.exports = __toCommonJS(examples_exports);
28
+
29
+ // src/examples/env.ts
30
+ var env_exports = {};
31
+ __export(env_exports, {
32
+ init: () => init,
33
+ push: () => push
34
+ });
35
+ var noop = () => {
36
+ };
37
+ var init = {
38
+ window: {
39
+ plausible: void 0
40
+ },
41
+ document: {
42
+ createElement: () => ({
43
+ src: "",
44
+ dataset: {},
45
+ setAttribute: () => {
46
+ },
47
+ removeAttribute: () => {
48
+ }
49
+ }),
50
+ head: { appendChild: () => {
51
+ } },
52
+ querySelector: () => null
53
+ }
54
+ };
55
+ var push = {
56
+ window: {
57
+ plausible: Object.assign(noop, {
58
+ // Add queue property for analytics loading pattern
59
+ q: []
60
+ })
61
+ },
62
+ document: {
63
+ createElement: () => ({
64
+ src: "",
65
+ dataset: {},
66
+ setAttribute: () => {
67
+ },
68
+ removeAttribute: () => {
69
+ }
70
+ }),
71
+ head: { appendChild: () => {
72
+ } },
73
+ querySelector: () => null
74
+ }
75
+ };
76
+
77
+ // src/examples/events.ts
78
+ var events_exports = {};
79
+ __export(events_exports, {
80
+ customEvent: () => customEvent,
81
+ purchase: () => purchase
82
+ });
83
+
84
+ // ../../../core/dist/index.mjs
85
+ var e = Object.defineProperty;
86
+ var c = {};
87
+ ((t, n) => {
88
+ for (var r in n) e(t, r, { get: n[r], enumerable: true });
89
+ })(c, { Level: () => a });
90
+ var a = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(a || {});
91
+ var E = { merge: true, shallow: true, extend: true };
92
+ function S(e2, t = {}, n = {}) {
93
+ n = { ...E, ...n };
94
+ const r = Object.entries(t).reduce((t2, [r2, o]) => {
95
+ const i = e2[r2];
96
+ return n.merge && Array.isArray(i) && Array.isArray(o) ? t2[r2] = o.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || r2 in e2) && (t2[r2] = o), t2;
97
+ }, {});
98
+ return n.shallow ? { ...e2, ...r } : (Object.assign(e2, r), e2);
99
+ }
100
+ function W(e2 = {}) {
101
+ var _a;
102
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", r = e2.count || 1, o = S({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${r}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: r, version: { source: "0.5.1-next.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
103
+ if (e2.name) {
104
+ const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
105
+ t2 && n2 && (o.entity = t2, o.action = n2);
106
+ }
107
+ return o;
108
+ }
109
+ function B(e2 = "entity action", t = {}) {
110
+ const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
111
+ return W({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
112
+ }
113
+
114
+ // src/examples/events.ts
115
+ function purchase() {
116
+ const event = B("order complete");
117
+ return [
118
+ "purchase",
119
+ {
120
+ revenue: {
121
+ currency: "EUR",
122
+ amount: event.data.total
123
+ }
124
+ }
125
+ ];
126
+ }
127
+ function customEvent() {
128
+ const event = B();
129
+ return [
130
+ "Custom Event",
131
+ {
132
+ props: event.data,
133
+ revenue: event.data.number
134
+ }
135
+ ];
136
+ }
137
+
138
+ // src/examples/mapping.ts
139
+ var mapping_exports = {};
140
+ __export(mapping_exports, {
141
+ config: () => config,
142
+ customEvent: () => customEvent2,
143
+ purchase: () => purchase2
144
+ });
145
+ var customEvent2 = {
146
+ name: "Custom Event",
147
+ data: {
148
+ map: {
149
+ props: "data",
150
+ revenue: "data.number"
151
+ }
152
+ }
153
+ };
154
+ var purchase2 = {
155
+ name: "purchase",
156
+ data: {
157
+ map: {
158
+ revenue: {
159
+ map: {
160
+ currency: { value: "EUR" },
161
+ amount: "data.total"
162
+ }
163
+ }
164
+ }
165
+ }
166
+ };
167
+ var config = {
168
+ entity: { action: customEvent2 },
169
+ order: { complete: purchase2 }
170
+ };
171
+ // Annotate the CommonJS export names for ESM import in node:
172
+ 0 && (module.exports = {
173
+ env,
174
+ events,
175
+ mapping
176
+ });
@@ -0,0 +1,153 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/examples/env.ts
8
+ var env_exports = {};
9
+ __export(env_exports, {
10
+ init: () => init,
11
+ push: () => push
12
+ });
13
+ var noop = () => {
14
+ };
15
+ var init = {
16
+ window: {
17
+ plausible: void 0
18
+ },
19
+ document: {
20
+ createElement: () => ({
21
+ src: "",
22
+ dataset: {},
23
+ setAttribute: () => {
24
+ },
25
+ removeAttribute: () => {
26
+ }
27
+ }),
28
+ head: { appendChild: () => {
29
+ } },
30
+ querySelector: () => null
31
+ }
32
+ };
33
+ var push = {
34
+ window: {
35
+ plausible: Object.assign(noop, {
36
+ // Add queue property for analytics loading pattern
37
+ q: []
38
+ })
39
+ },
40
+ document: {
41
+ createElement: () => ({
42
+ src: "",
43
+ dataset: {},
44
+ setAttribute: () => {
45
+ },
46
+ removeAttribute: () => {
47
+ }
48
+ }),
49
+ head: { appendChild: () => {
50
+ } },
51
+ querySelector: () => null
52
+ }
53
+ };
54
+
55
+ // src/examples/events.ts
56
+ var events_exports = {};
57
+ __export(events_exports, {
58
+ customEvent: () => customEvent,
59
+ purchase: () => purchase
60
+ });
61
+
62
+ // ../../../core/dist/index.mjs
63
+ var e = Object.defineProperty;
64
+ var c = {};
65
+ ((t, n) => {
66
+ for (var r in n) e(t, r, { get: n[r], enumerable: true });
67
+ })(c, { Level: () => a });
68
+ var a = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(a || {});
69
+ var E = { merge: true, shallow: true, extend: true };
70
+ function S(e2, t = {}, n = {}) {
71
+ n = { ...E, ...n };
72
+ const r = Object.entries(t).reduce((t2, [r2, o]) => {
73
+ const i = e2[r2];
74
+ return n.merge && Array.isArray(i) && Array.isArray(o) ? t2[r2] = o.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || r2 in e2) && (t2[r2] = o), t2;
75
+ }, {});
76
+ return n.shallow ? { ...e2, ...r } : (Object.assign(e2, r), e2);
77
+ }
78
+ function W(e2 = {}) {
79
+ var _a;
80
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", r = e2.count || 1, o = S({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${r}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: r, version: { source: "0.5.1-next.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
81
+ if (e2.name) {
82
+ const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
83
+ t2 && n2 && (o.entity = t2, o.action = n2);
84
+ }
85
+ return o;
86
+ }
87
+ function B(e2 = "entity action", t = {}) {
88
+ const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
89
+ return W({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...r, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
90
+ }
91
+
92
+ // src/examples/events.ts
93
+ function purchase() {
94
+ const event = B("order complete");
95
+ return [
96
+ "purchase",
97
+ {
98
+ revenue: {
99
+ currency: "EUR",
100
+ amount: event.data.total
101
+ }
102
+ }
103
+ ];
104
+ }
105
+ function customEvent() {
106
+ const event = B();
107
+ return [
108
+ "Custom Event",
109
+ {
110
+ props: event.data,
111
+ revenue: event.data.number
112
+ }
113
+ ];
114
+ }
115
+
116
+ // src/examples/mapping.ts
117
+ var mapping_exports = {};
118
+ __export(mapping_exports, {
119
+ config: () => config,
120
+ customEvent: () => customEvent2,
121
+ purchase: () => purchase2
122
+ });
123
+ var customEvent2 = {
124
+ name: "Custom Event",
125
+ data: {
126
+ map: {
127
+ props: "data",
128
+ revenue: "data.number"
129
+ }
130
+ }
131
+ };
132
+ var purchase2 = {
133
+ name: "purchase",
134
+ data: {
135
+ map: {
136
+ revenue: {
137
+ map: {
138
+ currency: { value: "EUR" },
139
+ amount: "data.total"
140
+ }
141
+ }
142
+ }
143
+ }
144
+ };
145
+ var config = {
146
+ entity: { action: customEvent2 },
147
+ order: { complete: purchase2 }
148
+ };
149
+ export {
150
+ env_exports as env,
151
+ events_exports as events,
152
+ mapping_exports as mapping
153
+ };
@@ -0,0 +1 @@
1
+ "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,i={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(i,{DestinationPlausible:()=>s,default:()=>b,destinationPlausible:()=>p});var r=Object.defineProperty;((e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>l});var a,l=((a=l||{})[a.ERROR=0]="ERROR",a[a.INFO=1]="INFO",a[a.DEBUG=2]="DEBUG",a);function u(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}function c(e){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e}}var s={},p={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=c(t),o=n,i=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:o}=c(t),i=o,r=i.createElement("script");r.src=n,e&&(r.dataset.domain=e);i.head.appendChild(r)}(i.domain,t),o.plausible=o.plausible||function(){(o.plausible.q=o.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:o}){const i=u(n)?n:{},{window:r}=c(o);(0,r.plausible)(`${e.name}`,i)}};var d,b=p;return d=i,((i,r,a,l)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let u of n(r))o.call(i,u)||u===a||e(i,u,{get:()=>r[u],enumerable:!(l=t(r,u))||l.enumerable});return i})(e({},"__esModule",{value:!0}),d)})();
@@ -0,0 +1,53 @@
1
+ import { WalkerOS, Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ plausible?: Plausible & {
7
+ q?: IArguments[];
8
+ };
9
+ }
10
+ }
11
+ type Plausible = (event: string, options?: {
12
+ props?: WalkerOS.AnyObject;
13
+ }) => void;
14
+ interface Settings {
15
+ domain?: string;
16
+ }
17
+ type InitSettings = Partial<Settings>;
18
+ interface Mapping {
19
+ }
20
+ interface Env extends DestinationWeb.Env {
21
+ window: {
22
+ plausible: Plausible & {
23
+ q?: IArguments[];
24
+ };
25
+ };
26
+ }
27
+ type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
28
+ type Destination = DestinationWeb.Destination<Types>;
29
+ type Config = DestinationWeb.Config<Types>;
30
+ interface PlausibleDestination extends Destination {
31
+ env?: Env;
32
+ }
33
+ type Rule = Mapping$1.Rule<Mapping>;
34
+ type Rules = Mapping$1.Rules<Rule>;
35
+
36
+ type index_Config = Config;
37
+ type index_Destination = Destination;
38
+ type index_Env = Env;
39
+ type index_InitSettings = InitSettings;
40
+ type index_Mapping = Mapping;
41
+ type index_Plausible = Plausible;
42
+ type index_PlausibleDestination = PlausibleDestination;
43
+ type index_Rule = Rule;
44
+ type index_Rules = Rules;
45
+ type index_Settings = Settings;
46
+ type index_Types = Types;
47
+ declare namespace index {
48
+ export type { index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_Plausible as Plausible, index_PlausibleDestination as PlausibleDestination, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings, index_Types as Types };
49
+ }
50
+
51
+ declare const destinationPlausible: Destination;
52
+
53
+ export { index as DestinationPlausible, destinationPlausible as default, destinationPlausible };
@@ -0,0 +1,53 @@
1
+ import { WalkerOS, Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ plausible?: Plausible & {
7
+ q?: IArguments[];
8
+ };
9
+ }
10
+ }
11
+ type Plausible = (event: string, options?: {
12
+ props?: WalkerOS.AnyObject;
13
+ }) => void;
14
+ interface Settings {
15
+ domain?: string;
16
+ }
17
+ type InitSettings = Partial<Settings>;
18
+ interface Mapping {
19
+ }
20
+ interface Env extends DestinationWeb.Env {
21
+ window: {
22
+ plausible: Plausible & {
23
+ q?: IArguments[];
24
+ };
25
+ };
26
+ }
27
+ type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
28
+ type Destination = DestinationWeb.Destination<Types>;
29
+ type Config = DestinationWeb.Config<Types>;
30
+ interface PlausibleDestination extends Destination {
31
+ env?: Env;
32
+ }
33
+ type Rule = Mapping$1.Rule<Mapping>;
34
+ type Rules = Mapping$1.Rules<Rule>;
35
+
36
+ type index_Config = Config;
37
+ type index_Destination = Destination;
38
+ type index_Env = Env;
39
+ type index_InitSettings = InitSettings;
40
+ type index_Mapping = Mapping;
41
+ type index_Plausible = Plausible;
42
+ type index_PlausibleDestination = PlausibleDestination;
43
+ type index_Rule = Rule;
44
+ type index_Rules = Rules;
45
+ type index_Settings = Settings;
46
+ type index_Types = Types;
47
+ declare namespace index {
48
+ export type { index_Config as Config, index_Destination as Destination, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_Plausible as Plausible, index_PlausibleDestination as PlausibleDestination, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings, index_Types as Types };
49
+ }
50
+
51
+ declare const destinationPlausible: Destination;
52
+
53
+ export { index as DestinationPlausible, destinationPlausible as default, destinationPlausible };
@@ -0,0 +1 @@
1
+ "use strict";function _define_property(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _object_spread(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(n){_define_property(e,n,t[n])})}return e}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var Destination=function(){var e=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)},n=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,u={};!function(e,n){for(var r in n)t(e,r,{get:n[r],enumerable:!0})}(u,{DestinationPlausible:function(){return p},default:function(){return b},destinationPlausible:function(){return d}});var c=Object.defineProperty;!function(e,n){for(var t in n)c(e,t,{get:n[t],enumerable:!0})}({},{Level:function(){return f}});var a,l,f=((a=f||{})[a.ERROR=0]="ERROR",a[a.INFO=1]="INFO",a[a.DEBUG=2]="DEBUG",a),p={},d={type:"plausible",config:{},init:function(e){var t=e.config,r=e.env,o=n(r).window,i=t.settings||{};return t.loadScript&&function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"https://plausible.io/js/script.manual.js",o=n(t).document,i=o.createElement("script");i.src=r,e&&(i.dataset.domain=e),o.head.appendChild(i)}(i.domain,r),o.plausible=o.plausible||function(){(o.plausible.q=o.plausible.q||[]).push(arguments)},t},push:function(t,r){r.config;var o=r.data,i=r.env,u=e(o)?o:{};(0,n(i).window.plausible)("".concat(t.name),u)}},b=d;return l=u,function(e,n,u,c){if(n&&"object"===(void 0===n?"undefined":_type_of(n))||"function"==typeof n){var a=!0,l=!1,f=void 0;try{for(var p,d=function(){var o=p.value;i.call(e,o)||o===u||t(e,o,{get:function(){return n[o]},enumerable:!(c=r(n,o))||c.enumerable})},b=o(n)[Symbol.iterator]();!(a=(p=b.next()).done);a=!0)d()}catch(e){l=!0,f=e}finally{try{a||null==b.return||b.return()}finally{if(l)throw f}}}return e}(t({},"__esModule",{value:!0}),l)}();
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,a={};((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(a,{DestinationPlausible:()=>p,default:()=>f,destinationPlausible:()=>b}),module.exports=(e=a,((e,a,i,l)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of r(a))o.call(e,s)||s===i||t(e,s,{get:()=>a[s],enumerable:!(l=n(a,s))||l.enumerable});return e})(t({},"__esModule",{value:!0}),e));var i=Object.defineProperty;((e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>s});var l,s=((l=s||{})[l.ERROR=0]="ERROR",l[l.INFO=1]="INFO",l[l.DEBUG=2]="DEBUG",l);function u(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var c=require("@walkeros/web-core"),p={},b={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=(0,c.getEnv)(t),r=n,o=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:r}=(0,c.getEnv)(t),o=r,a=o.createElement("script");a.src=n,e&&(a.dataset.domain=e);o.head.appendChild(a)}(o.domain,t),r.plausible=r.plausible||function(){(r.plausible.q=r.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:r}){const o=u(n)?n:{},{window:a}=(0,c.getEnv)(r);(0,a.plausible)(`${e.name}`,o)}};var f=b;//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Config, Destination } from './types';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { isObject } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPlausible from './types';\n\nexport const destinationPlausible: Destination = {\n type: 'plausible',\n\n config: {},\n\n init({ config, env }) {\n const { window } = getEnv(env);\n const w = window as Window;\n const settings = config.settings || {};\n\n if (config.loadScript) addScript(settings.domain, env);\n\n w.plausible =\n w.plausible ||\n function () {\n (w.plausible!.q = w.plausible!.q || []).push(arguments);\n };\n\n return config;\n },\n\n push(event, { config, data, env }) {\n const params = isObject(data) ? data : {};\n\n const { window } = getEnv(env);\n const plausible = (window as Window).plausible!;\n plausible(`${event.name}`, params);\n },\n};\n\nfunction addScript(\n domain?: string,\n env?: DestinationWeb.Env,\n src = 'https://plausible.io/js/script.manual.js',\n) {\n const { document } = getEnv(env);\n const doc = document as Document;\n const script = doc.createElement('script');\n script.src = src;\n if (domain) script.dataset.domain = domain;\n doc.head.appendChild(script);\n}\n\nexport default destinationPlausible;\n","import type {\n Mapping as WalkerOSMapping,\n WalkerOS,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n plausible?: Plausible & { q?: IArguments[] };\n }\n}\n\nexport type Plausible = (\n event: string,\n options?: { props?: WalkerOS.AnyObject },\n) => void;\n\nexport interface Settings {\n domain?: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n plausible: Plausible & { q?: IArguments[] };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface PlausibleDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A;;;;;;;;;;;;;;;;AAGA,sBAAuB;;;ACHvB;;;ADQO,IAAM,uBAAoC;AAAA,EAC/C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,IAAI,GAAG;AACpB,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,IAAI;AACV,UAAM,WAAW,OAAO,YAAY,CAAC;AAErC,QAAI,OAAO,WAAY,WAAU,SAAS,QAAQ,GAAG;AAErD,MAAE,YACA,EAAE,aACF,WAAY;AACV,OAAC,EAAE,UAAW,IAAI,EAAE,UAAW,KAAK,CAAC,GAAG,KAAK,SAAS;AAAA,IACxD;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,MAAM,IAAI,GAAG;AACjC,UAAM,SAAS,EAAS,IAAI,IAAI,OAAO,CAAC;AAExC,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,YAAa,OAAkB;AACrC,cAAU,GAAG,MAAM,IAAI,IAAI,MAAM;AAAA,EACnC;AACF;AAEA,SAAS,UACP,QACA,KACA,MAAM,4CACN;AACA,QAAM,EAAE,UAAAA,UAAS,QAAI,wBAAO,GAAG;AAC/B,QAAM,MAAMA;AACZ,QAAM,SAAS,IAAI,cAAc,QAAQ;AACzC,SAAO,MAAM;AACb,MAAI,OAAQ,QAAO,QAAQ,SAAS;AACpC,MAAI,KAAK,YAAY,MAAM;AAC7B;AAEA,IAAO,gBAAQ;","names":["document"]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty;((t,n)=>{for(var a in n)e(t,a,{get:n[a],enumerable:!0})})({},{Level:()=>n});var t,n=((t=n||{})[t.ERROR=0]="ERROR",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t);function a(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}import{getEnv as i}from"@walkeros/web-core";var o={},r={type:"plausible",config:{},init({config:e,env:t}){const{window:n}=i(t),a=n,o=e.settings||{};return e.loadScript&&function(e,t,n="https://plausible.io/js/script.manual.js"){const{document:a}=i(t),o=a,r=o.createElement("script");r.src=n,e&&(r.dataset.domain=e);o.head.appendChild(r)}(o.domain,t),a.plausible=a.plausible||function(){(a.plausible.q=a.plausible.q||[]).push(arguments)},e},push(e,{config:t,data:n,env:o}){const r=a(n)?n:{},{window:l}=i(o);(0,l.plausible)(`${e.name}`,r)}};var l=r;export{o as DestinationPlausible,l as default,r as destinationPlausible};//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Config, Destination } from './types';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { isObject } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPlausible from './types';\n\nexport const destinationPlausible: Destination = {\n type: 'plausible',\n\n config: {},\n\n init({ config, env }) {\n const { window } = getEnv(env);\n const w = window as Window;\n const settings = config.settings || {};\n\n if (config.loadScript) addScript(settings.domain, env);\n\n w.plausible =\n w.plausible ||\n function () {\n (w.plausible!.q = w.plausible!.q || []).push(arguments);\n };\n\n return config;\n },\n\n push(event, { config, data, env }) {\n const params = isObject(data) ? data : {};\n\n const { window } = getEnv(env);\n const plausible = (window as Window).plausible!;\n plausible(`${event.name}`, params);\n },\n};\n\nfunction addScript(\n domain?: string,\n env?: DestinationWeb.Env,\n src = 'https://plausible.io/js/script.manual.js',\n) {\n const { document } = getEnv(env);\n const doc = document as Document;\n const script = doc.createElement('script');\n script.src = src;\n if (domain) script.dataset.domain = domain;\n doc.head.appendChild(script);\n}\n\nexport default destinationPlausible;\n","import type {\n Mapping as WalkerOSMapping,\n WalkerOS,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n plausible?: Plausible & { q?: IArguments[] };\n }\n}\n\nexport type Plausible = (\n event: string,\n options?: { props?: WalkerOS.AnyObject },\n) => void;\n\nexport interface Settings {\n domain?: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n plausible: Plausible & { q?: IArguments[] };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface PlausibleDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";;;;;;;;;;;;;;;AAGA,SAAS,cAAc;;;ACHvB;;;ADQO,IAAM,uBAAoC;AAAA,EAC/C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,IAAI,GAAG;AACpB,UAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,UAAM,IAAI;AACV,UAAM,WAAW,OAAO,YAAY,CAAC;AAErC,QAAI,OAAO,WAAY,WAAU,SAAS,QAAQ,GAAG;AAErD,MAAE,YACA,EAAE,aACF,WAAY;AACV,OAAC,EAAE,UAAW,IAAI,EAAE,UAAW,KAAK,CAAC,GAAG,KAAK,SAAS;AAAA,IACxD;AAEF,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,OAAO,EAAE,QAAQ,MAAM,IAAI,GAAG;AACjC,UAAM,SAAS,EAAS,IAAI,IAAI,OAAO,CAAC;AAExC,UAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,UAAM,YAAa,OAAkB;AACrC,cAAU,GAAG,MAAM,IAAI,IAAI,MAAM;AAAA,EACnC;AACF;AAEA,SAAS,UACP,QACA,KACA,MAAM,4CACN;AACA,QAAM,EAAE,UAAAA,UAAS,IAAI,OAAO,GAAG;AAC/B,QAAM,MAAMA;AACZ,QAAM,SAAS,IAAI,cAAc,QAAQ;AACzC,SAAO,MAAM;AACb,MAAI,OAAQ,QAAO,QAAQ,SAAS;AACpC,MAAI,KAAK,YAAY,MAAM;AAC7B;AAEA,IAAO,gBAAQ;","names":["document"]}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@walkeros/web-destination-plausible",
3
+ "description": "Plausible web destination for walkerOS",
4
+ "version": "0.0.0-next-20251219153324",
5
+ "license": "MIT",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./examples": {
16
+ "types": "./dist/examples/index.d.ts",
17
+ "import": "./dist/examples/index.mjs",
18
+ "require": "./dist/examples/index.js"
19
+ },
20
+ "./dev": {
21
+ "types": "./dist/dev.d.ts",
22
+ "import": "./dist/dev.mjs",
23
+ "require": "./dist/dev.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist/**"
28
+ ],
29
+ "scripts": {
30
+ "build": "tsup --silent",
31
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
32
+ "dev": "jest --watchAll --colors",
33
+ "lint": "tsc && eslint \"**/*.ts*\"",
34
+ "test": "jest",
35
+ "update": "npx npm-check-updates -u && npm update"
36
+ },
37
+ "dependencies": {
38
+ "@walkeros/web-core": "0.0.0-next-20251219153324"
39
+ },
40
+ "devDependencies": {},
41
+ "repository": {
42
+ "url": "git+https://github.com/elbwalker/walkerOS.git",
43
+ "directory": "packages/web/destinations/plausible"
44
+ },
45
+ "author": "elbwalker <hello@elbwalker.com>",
46
+ "homepage": "https://github.com/elbwalker/walkerOS#readme",
47
+ "bugs": {
48
+ "url": "https://github.com/elbwalker/walkerOS/issues"
49
+ },
50
+ "keywords": [
51
+ "walker",
52
+ "walkerOS",
53
+ "destination",
54
+ "web",
55
+ "plausible"
56
+ ],
57
+ "funding": [
58
+ {
59
+ "type": "GitHub Sponsors",
60
+ "url": "https://github.com/sponsors/elbwalker"
61
+ }
62
+ ]
63
+ }