@walkeros/web-destination-plausible 4.7.2 → 4.8.0-next-1791496487198
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/CHANGELOG.md +13 -0
- package/README.md +9 -1
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.js +10 -7
- package/dist/examples/index.mjs +10 -7
- package/dist/walkerOS.json +13 -14
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @walkeros/web-destination-plausible
|
|
2
2
|
|
|
3
|
+
## 4.8.0-next-1791496487198
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5593d7b: The custom event step example now sends scalar `props` only.
|
|
8
|
+
Plausible accepts no arrays or objects as prop values and expects `revenue` as
|
|
9
|
+
`{ currency, amount }`, as the purchase example shows.
|
|
10
|
+
- Updated dependencies [7132619]
|
|
11
|
+
- Updated dependencies [5593d7b]
|
|
12
|
+
- Updated dependencies [421233d]
|
|
13
|
+
- @walkeros/core@4.8.0-next-1791496487198
|
|
14
|
+
- @walkeros/web-core@4.8.0-next-1791496487198
|
|
15
|
+
|
|
3
16
|
## 4.7.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -32,7 +32,15 @@ npm install @walkeros/web-destination-plausible
|
|
|
32
32
|
"destinations": {
|
|
33
33
|
"plausible": {
|
|
34
34
|
"package": "@walkeros/web-destination-plausible",
|
|
35
|
-
"config": {
|
|
35
|
+
"config": {
|
|
36
|
+
"loadScript": true,
|
|
37
|
+
"settings": {
|
|
38
|
+
"domain": "walkeros.io"
|
|
39
|
+
},
|
|
40
|
+
"mapping": {
|
|
41
|
+
"page": { "view": { "name": "pageview" } }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
}
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},n={};o(n,{examples:()=>b,schemas:()=>s}),module.exports=(e=n,((e,o,n,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},n={};o(n,{examples:()=>b,schemas:()=>s}),module.exports=(e=n,((e,o,n,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let l of r(o))i.call(e,l)||l===n||t(e,l,{get:()=>o[l],enumerable:!(s=a(o,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>c,SettingsSchema:()=>p,mapping:()=>d,settings:()=>m});var l=require("@walkeros/core/dev"),u=require("@walkeros/core/dev"),p=u.z.object({domain:u.z.string().regex(/^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*$/,"Must be a valid hostname").describe("The domain of your site as registered in Plausible (like walkeros.io)").optional()}),c=require("@walkeros/core/dev").z.object({}),m=(0,l.zodToSchema)(p),d=(0,l.zodToSchema)(c),b={};o(b,{env:()=>v,step:()=>y});var v={};o(v,{init:()=>h,push:()=>g,simulation:()=>w});var h={window:{},document:{createElement:()=>({src:"",dataset:{},setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}},querySelector:()=>null}},g={window:{plausible:Object.assign(()=>{},{q:[]})},document:{createElement:()=>({src:"",dataset:{},setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}},querySelector:()=>null}},w=["call:window.plausible"],y={};o(y,{customEvent:()=>P,init:()=>j,purchase:()=>E});var f=require("@walkeros/core"),j={title:"Initialization",description:"Destination bootstrap loads the Plausible script for the configured domain and installs the queue.",in:{loadScript:!0,settings:{domain:"example.com"}},out:[["script.appendChild",{src:"https://plausible.io/js/script.manual.js",domain:"example.com"}]]},E={title:"Purchase",description:"A completed order fires a Plausible purchase event with revenue currency and amount.",in:(0,f.getEvent)("order complete",{timestamp:1700000200}),mapping:{name:"purchase",data:{map:{revenue:{map:{currency:{value:"EUR"},amount:"data.total"}}}}},out:[["plausible","purchase",{revenue:{currency:"EUR",amount:555}}]]},P={title:"Custom event",description:"A generic entity action fires a Plausible custom event with mapped scalar props.",in:(0,f.getEvent)("entity action",{timestamp:1700000201}),mapping:{name:"Custom Event",data:{map:{props:{map:{string:"data.string",number:"data.number",boolean:"data.boolean"}}}}},out:[["plausible","Custom Event",{props:{string:"foo",number:1,boolean:!0}}]]};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nconst hostnameRegex =\n /^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.[A-Za-z0-9-]{1,63}(?<!-))*$/;\n\nexport const SettingsSchema = z.object({\n domain: z\n .string()\n .regex(hostnameRegex, 'Must be a valid hostname')\n .describe(\n 'The domain of your site as registered in Plausible (like walkeros.io)',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Plausible Mapping Schema\n * Plausible has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Plausible destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n window: {\n // plausible absent: init() is expected to install the stub.\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\nexport const push: Env = {\n window: {\n plausible: Object.assign(noop, {\n // Add queue property for analytics loading pattern\n q: [] as IArguments[],\n }),\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.plausible', // Track plausible function calls\n];\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Plausible script tag\n * with the configured domain and installs the global `plausible` queue.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Plausible script for the configured domain and installs the queue.',\n in: {\n loadScript: true,\n settings: {\n domain: 'example.com',\n },\n },\n out: [\n [\n 'script.appendChild',\n {\n src: 'https://plausible.io/js/script.manual.js',\n domain: 'example.com',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Plausible purchase event with revenue currency and amount.',\n in: getEvent('order complete', { timestamp: 1700000200 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n revenue: {\n map: {\n currency: { value: 'EUR' },\n amount: 'data.total',\n },\n },\n },\n },\n },\n out: [\n [\n 'plausible',\n 'purchase',\n {\n revenue: {\n currency: 'EUR',\n amount: 555,\n },\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a Plausible custom event with mapped props
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nconst hostnameRegex =\n /^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.[A-Za-z0-9-]{1,63}(?<!-))*$/;\n\nexport const SettingsSchema = z.object({\n domain: z\n .string()\n .regex(hostnameRegex, 'Must be a valid hostname')\n .describe(\n 'The domain of your site as registered in Plausible (like walkeros.io)',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Plausible Mapping Schema\n * Plausible has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Plausible destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n window: {\n // plausible absent: init() is expected to install the stub.\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\nexport const push: Env = {\n window: {\n plausible: Object.assign(noop, {\n // Add queue property for analytics loading pattern\n q: [] as IArguments[],\n }),\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.plausible', // Track plausible function calls\n];\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Plausible script tag\n * with the configured domain and installs the global `plausible` queue.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Plausible script for the configured domain and installs the queue.',\n in: {\n loadScript: true,\n settings: {\n domain: 'example.com',\n },\n },\n out: [\n [\n 'script.appendChild',\n {\n src: 'https://plausible.io/js/script.manual.js',\n domain: 'example.com',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Plausible purchase event with revenue currency and amount.',\n in: getEvent('order complete', { timestamp: 1700000200 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n revenue: {\n map: {\n currency: { value: 'EUR' },\n amount: 'data.total',\n },\n },\n },\n },\n },\n out: [\n [\n 'plausible',\n 'purchase',\n {\n revenue: {\n currency: 'EUR',\n amount: 555,\n },\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a Plausible custom event with mapped scalar props.',\n in: getEvent('entity action', { timestamp: 1700000201 }),\n mapping: {\n name: 'Custom Event',\n data: {\n map: {\n props: {\n map: {\n string: 'data.string',\n number: 'data.number',\n boolean: 'data.boolean',\n },\n },\n },\n },\n },\n out: [\n [\n 'plausible',\n 'Custom Event',\n {\n props: {\n string: 'foo',\n number: 1,\n boolean: true,\n },\n },\n ],\n ],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAElB,IAAM,gBACJ;AAEK,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,MAAM,eAAe,0BAA0B,EAC/C;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACbD,IAAAC,cAAkB;AAMX,IAAM,gBAAgB,cAAE,OAAO,CAAC,CAAC;;;AFEjC,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAEb,IAAM,OAAwB;AAAA,EACnC,QAAQ;AAAA;AAAA,EAER;AAAA,EACA,UAAU;AAAA,IACR,eAAe,OAAO;AAAA,MACpB,KAAK;AAAA,MACL,SAAS,CAAC;AAAA,MACV,cAAc,MAAM;AAAA,MAAC;AAAA,MACrB,iBAAiB,MAAM;AAAA,MAAC;AAAA,IAC1B;AAAA,IACA,MAAM,EAAE,aAAa,MAAM;AAAA,IAAC,EAAE;AAAA,IAC9B,eAAe,MAAM;AAAA,EACvB;AACF;AAEO,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,WAAW,OAAO,OAAO,MAAM;AAAA;AAAA,MAE7B,GAAG,CAAC;AAAA,IACN,CAAC;AAAA,E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;AAAA,EACvD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,OAAO;AAAA,UACL,KAAK;AAAA,YACH,QAAQ;AAAA,YACR,QAAQ;AAAA,YACR,SAAS;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,OAAO;AAAA,UACL,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["import_dev","import_dev","init"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,a)=>{for(var
|
|
1
|
+
var e=Object.defineProperty,t=(t,a)=>{for(var i in a)e(t,i,{get:a[i],enumerable:!0})},a={};t(a,{MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>p,settings:()=>l});import{zodToSchema as i}from"@walkeros/core/dev";import{z as r}from"@walkeros/core/dev";var o=r.object({domain:r.string().regex(/^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63}(?<!-))*$/,"Must be a valid hostname").describe("The domain of your site as registered in Plausible (like walkeros.io)").optional()});import{z as n}from"@walkeros/core/dev";var s=n.object({}),l=i(o),p=i(s),m={};t(m,{env:()=>u,step:()=>v});var u={};t(u,{init:()=>c,push:()=>d,simulation:()=>b});var c={window:{},document:{createElement:()=>({src:"",dataset:{},setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}},querySelector:()=>null}},d={window:{plausible:Object.assign(()=>{},{q:[]})},document:{createElement:()=>({src:"",dataset:{},setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}},querySelector:()=>null}},b=["call:window.plausible"],v={};t(v,{customEvent:()=>f,init:()=>g,purchase:()=>w});import{getEvent as h}from"@walkeros/core";var g={title:"Initialization",description:"Destination bootstrap loads the Plausible script for the configured domain and installs the queue.",in:{loadScript:!0,settings:{domain:"example.com"}},out:[["script.appendChild",{src:"https://plausible.io/js/script.manual.js",domain:"example.com"}]]},w={title:"Purchase",description:"A completed order fires a Plausible purchase event with revenue currency and amount.",in:h("order complete",{timestamp:1700000200}),mapping:{name:"purchase",data:{map:{revenue:{map:{currency:{value:"EUR"},amount:"data.total"}}}}},out:[["plausible","purchase",{revenue:{currency:"EUR",amount:555}}]]},f={title:"Custom event",description:"A generic entity action fires a Plausible custom event with mapped scalar props.",in:h("entity action",{timestamp:1700000201}),mapping:{name:"Custom Event",data:{map:{props:{map:{string:"data.string",number:"data.number",boolean:"data.boolean"}}}}},out:[["plausible","Custom Event",{props:{string:"foo",number:1,boolean:!0}}]]};export{m as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nconst hostnameRegex =\n /^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.[A-Za-z0-9-]{1,63}(?<!-))*$/;\n\nexport const SettingsSchema = z.object({\n domain: z\n .string()\n .regex(hostnameRegex, 'Must be a valid hostname')\n .describe(\n 'The domain of your site as registered in Plausible (like walkeros.io)',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Plausible Mapping Schema\n * Plausible has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Plausible destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n window: {\n // plausible absent: init() is expected to install the stub.\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\nexport const push: Env = {\n window: {\n plausible: Object.assign(noop, {\n // Add queue property for analytics loading pattern\n q: [] as IArguments[],\n }),\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.plausible', // Track plausible function calls\n];\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Plausible script tag\n * with the configured domain and installs the global `plausible` queue.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Plausible script for the configured domain and installs the queue.',\n in: {\n loadScript: true,\n settings: {\n domain: 'example.com',\n },\n },\n out: [\n [\n 'script.appendChild',\n {\n src: 'https://plausible.io/js/script.manual.js',\n domain: 'example.com',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Plausible purchase event with revenue currency and amount.',\n in: getEvent('order complete', { timestamp: 1700000200 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n revenue: {\n map: {\n currency: { value: 'EUR' },\n amount: 'data.total',\n },\n },\n },\n },\n },\n out: [\n [\n 'plausible',\n 'purchase',\n {\n revenue: {\n currency: 'EUR',\n amount: 555,\n },\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a Plausible custom event with mapped props
|
|
1
|
+
{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nconst hostnameRegex =\n /^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.[A-Za-z0-9-]{1,63}(?<!-))*$/;\n\nexport const SettingsSchema = z.object({\n domain: z\n .string()\n .regex(hostnameRegex, 'Must be a valid hostname')\n .describe(\n 'The domain of your site as registered in Plausible (like walkeros.io)',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Plausible Mapping Schema\n * Plausible has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Plausible destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n window: {\n // plausible absent: init() is expected to install the stub.\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\nexport const push: Env = {\n window: {\n plausible: Object.assign(noop, {\n // Add queue property for analytics loading pattern\n q: [] as IArguments[],\n }),\n },\n document: {\n createElement: () => ({\n src: '',\n dataset: {},\n setAttribute: () => {},\n removeAttribute: () => {},\n }),\n head: { appendChild: () => {} },\n querySelector: () => null,\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.plausible', // Track plausible function calls\n];\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Plausible script tag\n * with the configured domain and installs the global `plausible` queue.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap loads the Plausible script for the configured domain and installs the queue.',\n in: {\n loadScript: true,\n settings: {\n domain: 'example.com',\n },\n },\n out: [\n [\n 'script.appendChild',\n {\n src: 'https://plausible.io/js/script.manual.js',\n domain: 'example.com',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Plausible purchase event with revenue currency and amount.',\n in: getEvent('order complete', { timestamp: 1700000200 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n revenue: {\n map: {\n currency: { value: 'EUR' },\n amount: 'data.total',\n },\n },\n },\n },\n },\n out: [\n [\n 'plausible',\n 'purchase',\n {\n revenue: {\n currency: 'EUR',\n amount: 555,\n },\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a Plausible custom event with mapped scalar props.',\n in: getEvent('entity action', { timestamp: 1700000201 }),\n mapping: {\n name: 'Custom Event',\n data: {\n map: {\n props: {\n map: {\n string: 'data.string',\n number: 'data.number',\n boolean: 'data.boolean',\n },\n },\n },\n },\n },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AA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,OAAO;AAAA,UACL,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["z","init"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -137,14 +137,19 @@ var purchase = {
|
|
|
137
137
|
};
|
|
138
138
|
var customEvent = {
|
|
139
139
|
title: "Custom event",
|
|
140
|
-
description: "A generic entity action fires a Plausible custom event with mapped props
|
|
140
|
+
description: "A generic entity action fires a Plausible custom event with mapped scalar props.",
|
|
141
141
|
in: (0, import_core.getEvent)("entity action", { timestamp: 1700000201 }),
|
|
142
142
|
mapping: {
|
|
143
143
|
name: "Custom Event",
|
|
144
144
|
data: {
|
|
145
145
|
map: {
|
|
146
|
-
props:
|
|
147
|
-
|
|
146
|
+
props: {
|
|
147
|
+
map: {
|
|
148
|
+
string: "data.string",
|
|
149
|
+
number: "data.number",
|
|
150
|
+
boolean: "data.boolean"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
},
|
|
@@ -156,10 +161,8 @@ var customEvent = {
|
|
|
156
161
|
props: {
|
|
157
162
|
string: "foo",
|
|
158
163
|
number: 1,
|
|
159
|
-
boolean: true
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
revenue: 1
|
|
164
|
+
boolean: true
|
|
165
|
+
}
|
|
163
166
|
}
|
|
164
167
|
]
|
|
165
168
|
]
|
package/dist/examples/index.mjs
CHANGED
|
@@ -116,14 +116,19 @@ var purchase = {
|
|
|
116
116
|
};
|
|
117
117
|
var customEvent = {
|
|
118
118
|
title: "Custom event",
|
|
119
|
-
description: "A generic entity action fires a Plausible custom event with mapped props
|
|
119
|
+
description: "A generic entity action fires a Plausible custom event with mapped scalar props.",
|
|
120
120
|
in: getEvent("entity action", { timestamp: 1700000201 }),
|
|
121
121
|
mapping: {
|
|
122
122
|
name: "Custom Event",
|
|
123
123
|
data: {
|
|
124
124
|
map: {
|
|
125
|
-
props:
|
|
126
|
-
|
|
125
|
+
props: {
|
|
126
|
+
map: {
|
|
127
|
+
string: "data.string",
|
|
128
|
+
number: "data.number",
|
|
129
|
+
boolean: "data.boolean"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
},
|
|
@@ -135,10 +140,8 @@ var customEvent = {
|
|
|
135
140
|
props: {
|
|
136
141
|
string: "foo",
|
|
137
142
|
number: 1,
|
|
138
|
-
boolean: true
|
|
139
|
-
|
|
140
|
-
},
|
|
141
|
-
revenue: 1
|
|
143
|
+
boolean: true
|
|
144
|
+
}
|
|
142
145
|
}
|
|
143
146
|
]
|
|
144
147
|
]
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-plausible",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.0-next-1791496487198",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"step": {
|
|
76
76
|
"customEvent": {
|
|
77
77
|
"title": "Custom event",
|
|
78
|
-
"description": "A generic entity action fires a Plausible custom event with mapped props
|
|
78
|
+
"description": "A generic entity action fires a Plausible custom event with mapped scalar props.",
|
|
79
79
|
"in": {
|
|
80
80
|
"name": "entity action",
|
|
81
81
|
"data": {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"consent": {
|
|
117
117
|
"functional": true
|
|
118
118
|
},
|
|
119
|
-
"id": "
|
|
119
|
+
"id": "420045430a956366",
|
|
120
120
|
"trigger": "test",
|
|
121
121
|
"entity": "entity",
|
|
122
122
|
"action": "action",
|
|
@@ -133,8 +133,13 @@
|
|
|
133
133
|
"name": "Custom Event",
|
|
134
134
|
"data": {
|
|
135
135
|
"map": {
|
|
136
|
-
"props":
|
|
137
|
-
|
|
136
|
+
"props": {
|
|
137
|
+
"map": {
|
|
138
|
+
"string": "data.string",
|
|
139
|
+
"number": "data.number",
|
|
140
|
+
"boolean": "data.boolean"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
},
|
|
@@ -146,14 +151,8 @@
|
|
|
146
151
|
"props": {
|
|
147
152
|
"string": "foo",
|
|
148
153
|
"number": 1,
|
|
149
|
-
"boolean": true
|
|
150
|
-
|
|
151
|
-
0,
|
|
152
|
-
"text",
|
|
153
|
-
false
|
|
154
|
-
]
|
|
155
|
-
},
|
|
156
|
-
"revenue": 1
|
|
154
|
+
"boolean": true
|
|
155
|
+
}
|
|
157
156
|
}
|
|
158
157
|
]
|
|
159
158
|
]
|
|
@@ -257,7 +256,7 @@
|
|
|
257
256
|
"consent": {
|
|
258
257
|
"functional": true
|
|
259
258
|
},
|
|
260
|
-
"id": "
|
|
259
|
+
"id": "6c49c9dcf3c33c21",
|
|
261
260
|
"trigger": "load",
|
|
262
261
|
"entity": "order",
|
|
263
262
|
"action": "complete",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-plausible",
|
|
3
3
|
"description": "Plausible web destination for walkerOS",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.0-next-1791496487198",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"update": "npx npm-check-updates -u && npm update"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@walkeros/core": "4.
|
|
42
|
-
"@walkeros/web-core": "4.
|
|
41
|
+
"@walkeros/core": "4.8.0-next-1791496487198",
|
|
42
|
+
"@walkeros/web-core": "4.8.0-next-1791496487198"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@walkeros/collector": "4.
|
|
45
|
+
"@walkeros/collector": "4.8.0-next-1791496487198"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|