@walkeros/web-destination-piano 4.8.2 → 4.8.3-next-1793115089237

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 CHANGED
@@ -1,5 +1,36 @@
1
1
  # @walkeros/web-destination-piano
2
2
 
3
+ ## 4.8.3-next-1793115089237
4
+
5
+ ### Patch Changes
6
+
7
+ - 5313635: The sample events from `getEvent` now use the standard event names:
8
+ `checkout start` replaces `checkout view`, an order carries `tax` and `total`,
9
+ a promotion names its placement `slot`, and product events carry `currency`.
10
+ Order `value` is now the merchandise value: the `order complete` sample goes
11
+ from 555 to 462, and the gross amount charged is `total` (467.22). The
12
+ destination examples read `data.tax`, `data.slot` and the search keys
13
+ `data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
14
+ read `data.total` first, then `data.value`. The CLI ships default event
15
+ contracts for common site types in `examples/contracts/`.
16
+ - 5313635: The package publishes a minimal example: the Piano Analytics site ID
17
+ and collection domain, with the SDK loaded by the destination. The docs page
18
+ renders the install line, the integrated code and the flow from it, and the
19
+ package test runs the same setup, so the setup a reader copies is the one that
20
+ was tested.
21
+ - Updated dependencies [29d2218]
22
+ - Updated dependencies [34fd225]
23
+ - Updated dependencies [5313635]
24
+ - Updated dependencies [5313635]
25
+ - Updated dependencies [5313635]
26
+ - Updated dependencies [5313635]
27
+ - Updated dependencies [5313635]
28
+ - Updated dependencies [34fd225]
29
+ - Updated dependencies [5313635]
30
+ - Updated dependencies [5313635]
31
+ - @walkeros/web-core@4.8.3-next-1793115089237
32
+ - @walkeros/core@4.8.3-next-1793115089237
33
+
3
34
  ## 4.8.2
4
35
 
5
36
  ### Patch Changes
package/README.md CHANGED
@@ -50,11 +50,12 @@ npm install @walkeros/web-destination-piano
50
50
  }
51
51
  ```
52
52
 
53
- With `loadScript: true` the destination loads the Piano SDK script and calls
54
- `pa.setConfigurations({ site, collectDomain })` once the script has loaded.
55
- Events that arrive before that are dropped, so the page view at start is lost.
56
- If you load the SDK yourself before walkerOS starts, omit `loadScript`; the
57
- destination then configures `window.pa` on init.
53
+ With `loadScript: true` the destination loads the Piano SDK script. Events
54
+ pushed while it loads wait for it, so the page view at start is sent; if the
55
+ script is blocked, they fail with `vendor-not-loaded`. If you load the SDK
56
+ yourself before walkerOS starts, omit `loadScript`. Either way the destination
57
+ calls `pa.setConfigurations` with `site`, `collectDomain` and `options` before
58
+ its first event.
58
59
 
59
60
  ## Settings
60
61
 
package/dist/dev.d.mts CHANGED
@@ -100,10 +100,14 @@ declare namespace step {
100
100
  export { step_consentRevoke as consentRevoke, step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule };
101
101
  }
102
102
 
103
+ /** The settings Piano Analytics needs to deliver: the site ID and the collection domain, with the SDK loaded by the destination. */
104
+ declare const minimal: Flow.MinimalExample;
105
+
103
106
  declare const index_env: typeof env;
107
+ declare const index_minimal: typeof minimal;
104
108
  declare const index_step: typeof step;
105
109
  declare namespace index {
106
- export { index_env as env, index_step as step };
110
+ export { index_env as env, index_minimal as minimal, index_step as step };
107
111
  }
108
112
 
109
113
  export { index as examples, index$1 as schemas };
package/dist/dev.d.ts CHANGED
@@ -100,10 +100,14 @@ declare namespace step {
100
100
  export { step_consentRevoke as consentRevoke, step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule };
101
101
  }
102
102
 
103
+ /** The settings Piano Analytics needs to deliver: the site ID and the collection domain, with the SDK loaded by the destination. */
104
+ declare const minimal: Flow.MinimalExample;
105
+
103
106
  declare const index_env: typeof env;
107
+ declare const index_minimal: typeof minimal;
104
108
  declare const index_step: typeof step;
105
109
  declare namespace index {
106
- export { index_env as env, index_step as step };
110
+ export { index_env as env, index_minimal as minimal, index_step as step };
107
111
  }
108
112
 
109
113
  export { index as examples, index$1 as schemas };
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},r={};o(r,{examples:()=>g,schemas:()=>s}),module.exports=(e=r,((e,o,r,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of i(o))a.call(e,c)||c===r||t(e,c,{get:()=>o[c],enumerable:!(s=n(o,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>l,SettingsSchema:()=>d,mapping:()=>u,settings:()=>m});var c=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),d=p.z.object({site:p.z.number().describe("Piano Analytics site id (numeric), from your collection settings"),collectDomain:p.z.string().describe("Collection domain endpoint, like https://xxxxxxx.pa-cd.com"),options:p.z.record(p.z.string(),p.z.unknown()).describe("Additional Piano setConfigurations options merged on init").optional()}).strict(),l=require("@walkeros/core/dev").z.object({}),m=(0,c.zodToSchema)(d),u=(0,c.zodToSchema)(l),g={};o(g,{env:()=>v,step:()=>y});var v={};o(v,{init:()=>h,push:()=>f,simulation:()=>b});var w=()=>{};var h={window:{}},f={window:{pa:{setConfigurations:w,sendEvent:w,sendEvents:w}}},b=["call:window.pa.sendEvent"],y={};o(y,{consentRevoke:()=>A,customEvent:()=>O,init:()=>k,pageView:()=>x,purchase:()=>z,silentRule:()=>j});var P=require("@walkeros/core"),E={site:123456789,collectDomain:"https://example.pa-cd.com"},k={title:"Initialization",description:"Destination bootstrap configures Piano with the site id and collection domain.",in:{settings:E},out:[["pa.setConfigurations",E]]},x={title:"Page view",description:"A page view fires a Piano page.display event with the page name and chapter.",in:(0,P.getEvent)("page view",{timestamp:1700000200}),mapping:{name:"page.display",data:{map:{page:"data.title",page_chapter1:"globals.pagegroup"}}},out:[["pa.sendEvent","page.display",{page:"walkerOS documentation",page_chapter1:"docs"}]]},z={title:"Purchase",description:"A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.",in:(0,P.getEvent)("order complete",{timestamp:1700000201}),mapping:{name:"transaction.confirmation",data:{map:{transaction_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["pa.sendEvent","transaction.confirmation",{transaction_id:"0rd3r1d",revenue:555,currency:"EUR"}]]},O={title:"Custom event",description:"A generic entity action fires a custom Piano event with mapped properties.",in:(0,P.getEvent)("entity action",{timestamp:1700000202}),mapping:{name:"click.action",data:{map:{label:"data.string",value:"data.number"}}},out:[["pa.sendEvent","click.action",{label:"foo",value:1}]]},j={public:!1,description:"A rule with silent: true sends no Piano event.",in:(0,P.getEvent)("page view",{timestamp:1700000203}),mapping:{silent:!0},out:[]},A={public:!1,description:"Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.",command:"consent",in:{analytics:!1},out:[]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,n)=>{for(var i in n)t(e,i,{get:n[i],enumerable:!0})},r={};o(r,{examples:()=>g,schemas:()=>s}),module.exports=(e=r,((e,o,r,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let c of i(o))a.call(e,c)||c===r||t(e,c,{get:()=>o[c],enumerable:!(s=n(o,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};o(s,{MappingSchema:()=>l,SettingsSchema:()=>d,mapping:()=>u,settings:()=>m});var c=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),d=p.z.object({site:p.z.number().describe("Piano Analytics site id (numeric), from your collection settings"),collectDomain:p.z.string().describe("Collection domain endpoint, like https://xxxxxxx.pa-cd.com"),options:p.z.record(p.z.string(),p.z.unknown()).describe("Additional Piano setConfigurations options merged on init").optional()}).strict(),l=require("@walkeros/core/dev").z.object({}),m=(0,c.zodToSchema)(d),u=(0,c.zodToSchema)(l),g={};o(g,{env:()=>v,minimal:()=>A,step:()=>y});var v={};o(v,{init:()=>h,push:()=>f,simulation:()=>b});var w=()=>{};var h={window:{}},f={window:{pa:{setConfigurations:w,sendEvent:w,sendEvents:w}}},b=["call:window.pa.sendEvent"],y={};o(y,{consentRevoke:()=>j,customEvent:()=>O,init:()=>k,pageView:()=>x,purchase:()=>z,silentRule:()=>S});var P=require("@walkeros/core"),E={site:123456789,collectDomain:"https://example.pa-cd.com"},k={title:"Initialization",description:"Destination bootstrap configures Piano with the site id and collection domain.",in:{settings:E},out:[["pa.setConfigurations",E]]},x={title:"Page view",description:"A page view fires a Piano page.display event with the page name and chapter.",in:(0,P.getEvent)("page view",{timestamp:1700000200}),mapping:{name:"page.display",data:{map:{page:"data.title",page_chapter1:"globals.pagegroup"}}},out:[["pa.sendEvent","page.display",{page:"walkerOS documentation",page_chapter1:"docs"}]]},z={title:"Purchase",description:"A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.",in:(0,P.getEvent)("order complete",{timestamp:1700000201}),mapping:{name:"transaction.confirmation",data:{map:{transaction_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["pa.sendEvent","transaction.confirmation",{transaction_id:"0rd3r1d",revenue:462,currency:"EUR"}]]},O={title:"Custom event",description:"A generic entity action fires a custom Piano event with mapped properties.",in:(0,P.getEvent)("entity action",{timestamp:1700000202}),mapping:{name:"click.action",data:{map:{label:"data.string",value:"data.number"}}},out:[["pa.sendEvent","click.action",{label:"foo",value:1}]]},S={public:!1,description:"A rule with silent: true sends no Piano event.",in:(0,P.getEvent)("page view",{timestamp:1700000203}),mapping:{silent:!0},out:[]},j={public:!1,description:"Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.",command:"consent",in:{analytics:!1},out:[]},A={settings:{site:123456789,collectDomain:"https://example.pa-cd.com"},config:{loadScript:!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\nexport const SettingsSchema = z\n .object({\n site: z\n .number()\n .describe(\n 'Piano Analytics site id (numeric), from your collection settings',\n ),\n collectDomain: z\n .string()\n .describe('Collection domain endpoint, like https://xxxxxxx.pa-cd.com'),\n options: z\n .record(z.string(), z.unknown())\n .describe('Additional Piano setConfigurations options merged on init')\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Piano Mapping Schema\n * Piano 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, PianoAnalytics } from '../types';\n\n/**\n * Example environment configurations for the Piano destination.\n *\n * These environments provide standardized mock structures for testing and\n * development without loading the real Piano SDK. They satisfy the `Env`\n * interface directly, so no type casts are needed.\n */\n\nconst noop = () => {};\n\n/** A no-op Piano SDK whose methods are wrapped by `mockEnv` to capture calls. */\nfunction mockPa(): PianoAnalytics {\n return {\n setConfigurations: noop,\n sendEvent: noop,\n sendEvents: noop,\n };\n}\n\n/** SDK not yet present: init must tolerate a missing `pa`. */\nexport const init: Env = {\n window: {},\n};\n\n/** SDK present: used for capturing setConfigurations/sendEvent calls. */\nexport const push: Env = {\n window: {\n pa: mockPa(),\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.pa.sendEvent', // Track Piano sendEvent calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nconst settings = {\n site: 123456789,\n collectDomain: 'https://example.pa-cd.com',\n};\n\n/**\n * Destination bootstrap.\n * init configures the Piano `pa` SDK with the site id and collection domain\n * via setConfigurations.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap configures Piano with the site id and collection domain.',\n in: {\n settings,\n },\n out: [['pa.setConfigurations', settings]],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view fires a Piano page.display event with the page name and chapter.',\n in: getEvent('page view', { timestamp: 1700000200 }),\n mapping: {\n name: 'page.display',\n data: {\n map: {\n page: 'data.title',\n page_chapter1: 'globals.pagegroup',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'page.display',\n {\n page: 'walkerOS documentation',\n page_chapter1: 'docs',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.',\n in: getEvent('order complete', { timestamp: 1700000201 }),\n mapping: {\n name: 'transaction.confirmation',\n data: {\n map: {\n transaction_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'transaction.confirmation',\n {\n transaction_id: '0rd3r1d',\n revenue: 555,\n currency: 'EUR',\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a custom Piano event with mapped properties.',\n in: getEvent('entity action', { timestamp: 1700000202 }),\n mapping: {\n name: 'click.action',\n data: {\n map: {\n label: 'data.string',\n value: 'data.number',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'click.action',\n {\n label: 'foo',\n value: 1,\n },\n ],\n ],\n};\n\n/** A silent rule sends no Piano event. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no Piano event.',\n in: getEvent('page view', { timestamp: 1700000203 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * Piano sends only on sendEvent, which the collector stops for a revoked\n * consent; the destination has no consent call to make.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.',\n command: 'consent',\n in: { analytics: false },\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,MAAM,aACH,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,EACF,eAAe,aACZ,OAAO,EACP,SAAS,4DAA4D;AAAA,EACxE,SAAS,aACN,OAAO,aAAE,OAAO,GAAG,aAAE,QAAQ,CAAC,EAC9B,SAAS,2DAA2D,EACpE,SAAS;AACd,CAAC,EACA,OAAO;;;ACjBV,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;AAGpB,SAAS,SAAyB;AAChC,SAAO;AAAA,IACL,mBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,YAAY;AAAA,EACd;AACF;AAGO,IAAM,OAAY;AAAA,EACvB,QAAQ,CAAC;AACX;AAGO,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,IAAI,OAAO;AAAA,EACb;AACF;AAMO,IAAM,aAAa;AAAA,EACxB;AAAA;AACF;;;ACvCA;AAAA;AAAA;AAAA;AAAA,cAAAC;AAAA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K;AAAA,QACH,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAMO,IAAM,gBAAkC;AAAA,EAC7C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["import_dev","import_dev","init","settings"]}
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","../src/examples/minimal.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\nexport const SettingsSchema = z\n .object({\n site: z\n .number()\n .describe(\n 'Piano Analytics site id (numeric), from your collection settings',\n ),\n collectDomain: z\n .string()\n .describe('Collection domain endpoint, like https://xxxxxxx.pa-cd.com'),\n options: z\n .record(z.string(), z.unknown())\n .describe('Additional Piano setConfigurations options merged on init')\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Piano Mapping Schema\n * Piano 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';\nexport { minimal } from './minimal';\n","import type { Env, PianoAnalytics } from '../types';\n\n/**\n * Example environment configurations for the Piano destination.\n *\n * These environments provide standardized mock structures for testing and\n * development without loading the real Piano SDK. They satisfy the `Env`\n * interface directly, so no type casts are needed.\n */\n\nconst noop = () => {};\n\n/** A no-op Piano SDK whose methods are wrapped by `mockEnv` to capture calls. */\nfunction mockPa(): PianoAnalytics {\n return {\n setConfigurations: noop,\n sendEvent: noop,\n sendEvents: noop,\n };\n}\n\n/** SDK not yet present: init must tolerate a missing `pa`. */\nexport const init: Env = {\n window: {},\n};\n\n/** SDK present: used for capturing setConfigurations/sendEvent calls. */\nexport const push: Env = {\n window: {\n pa: mockPa(),\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.pa.sendEvent', // Track Piano sendEvent calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nconst settings = {\n site: 123456789,\n collectDomain: 'https://example.pa-cd.com',\n};\n\n/**\n * Destination bootstrap.\n * init configures the Piano `pa` SDK with the site id and collection domain\n * via setConfigurations.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap configures Piano with the site id and collection domain.',\n in: {\n settings,\n },\n out: [['pa.setConfigurations', settings]],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view fires a Piano page.display event with the page name and chapter.',\n in: getEvent('page view', { timestamp: 1700000200 }),\n mapping: {\n name: 'page.display',\n data: {\n map: {\n page: 'data.title',\n page_chapter1: 'globals.pagegroup',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'page.display',\n {\n page: 'walkerOS documentation',\n page_chapter1: 'docs',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.',\n in: getEvent('order complete', { timestamp: 1700000201 }),\n mapping: {\n name: 'transaction.confirmation',\n data: {\n map: {\n transaction_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'transaction.confirmation',\n {\n transaction_id: '0rd3r1d',\n revenue: 462,\n currency: 'EUR',\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a custom Piano event with mapped properties.',\n in: getEvent('entity action', { timestamp: 1700000202 }),\n mapping: {\n name: 'click.action',\n data: {\n map: {\n label: 'data.string',\n value: 'data.number',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'click.action',\n {\n label: 'foo',\n value: 1,\n },\n ],\n ],\n};\n\n/** A silent rule sends no Piano event. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no Piano event.',\n in: getEvent('page view', { timestamp: 1700000203 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * Piano sends only on sendEvent, which the collector stops for a revoked\n * consent; the destination has no consent call to make.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.',\n command: 'consent',\n in: { analytics: false },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/** The settings Piano Analytics needs to deliver: the site ID and the collection domain, with the SDK loaded by the destination. */\nexport const minimal: Flow.MinimalExample = {\n settings: { site: 123456789, collectDomain: 'https://example.pa-cd.com' },\n config: { loadScript: true },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB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AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;;;ACxHO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,MAAM,WAAW,eAAe,4BAA4B;AAAA,EACxE,QAAQ,EAAE,YAAY,KAAK;AAC7B;","names":["import_dev","import_dev","init","settings"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,n)=>{for(var i in n)e(t,i,{get:n[i],enumerable:!0})},n={};t(n,{MappingSchema:()=>r,SettingsSchema:()=>o,mapping:()=>p,settings:()=>c});import{zodToSchema as i}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var o=a.object({site:a.number().describe("Piano Analytics site id (numeric), from your collection settings"),collectDomain:a.string().describe("Collection domain endpoint, like https://xxxxxxx.pa-cd.com"),options:a.record(a.string(),a.unknown()).describe("Additional Piano setConfigurations options merged on init").optional()}).strict();import{z as s}from"@walkeros/core/dev";var r=s.object({}),c=i(o),p=i(r),d={};t(d,{env:()=>l,step:()=>w});var l={};t(l,{init:()=>u,push:()=>g,simulation:()=>v});var m=()=>{};var u={window:{}},g={window:{pa:{setConfigurations:m,sendEvent:m,sendEvents:m}}},v=["call:window.pa.sendEvent"],w={};t(w,{consentRevoke:()=>E,customEvent:()=>P,init:()=>b,pageView:()=>y,purchase:()=>k,silentRule:()=>x});import{getEvent as h}from"@walkeros/core";var f={site:123456789,collectDomain:"https://example.pa-cd.com"},b={title:"Initialization",description:"Destination bootstrap configures Piano with the site id and collection domain.",in:{settings:f},out:[["pa.setConfigurations",f]]},y={title:"Page view",description:"A page view fires a Piano page.display event with the page name and chapter.",in:h("page view",{timestamp:1700000200}),mapping:{name:"page.display",data:{map:{page:"data.title",page_chapter1:"globals.pagegroup"}}},out:[["pa.sendEvent","page.display",{page:"walkerOS documentation",page_chapter1:"docs"}]]},k={title:"Purchase",description:"A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.",in:h("order complete",{timestamp:1700000201}),mapping:{name:"transaction.confirmation",data:{map:{transaction_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["pa.sendEvent","transaction.confirmation",{transaction_id:"0rd3r1d",revenue:555,currency:"EUR"}]]},P={title:"Custom event",description:"A generic entity action fires a custom Piano event with mapped properties.",in:h("entity action",{timestamp:1700000202}),mapping:{name:"click.action",data:{map:{label:"data.string",value:"data.number"}}},out:[["pa.sendEvent","click.action",{label:"foo",value:1}]]},x={public:!1,description:"A rule with silent: true sends no Piano event.",in:h("page view",{timestamp:1700000203}),mapping:{silent:!0},out:[]},E={public:!1,description:"Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.",command:"consent",in:{analytics:!1},out:[]};export{d as examples,n as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,i)=>{for(var n in i)e(t,n,{get:i[n],enumerable:!0})},i={};t(i,{MappingSchema:()=>r,SettingsSchema:()=>o,mapping:()=>p,settings:()=>c});import{zodToSchema as n}from"@walkeros/core/dev";import{z as a}from"@walkeros/core/dev";var o=a.object({site:a.number().describe("Piano Analytics site id (numeric), from your collection settings"),collectDomain:a.string().describe("Collection domain endpoint, like https://xxxxxxx.pa-cd.com"),options:a.record(a.string(),a.unknown()).describe("Additional Piano setConfigurations options merged on init").optional()}).strict();import{z as s}from"@walkeros/core/dev";var r=s.object({}),c=n(o),p=n(r),d={};t(d,{env:()=>l,minimal:()=>A,step:()=>w});var l={};t(l,{init:()=>u,push:()=>g,simulation:()=>v});var m=()=>{};var u={window:{}},g={window:{pa:{setConfigurations:m,sendEvent:m,sendEvents:m}}},v=["call:window.pa.sendEvent"],w={};t(w,{consentRevoke:()=>E,customEvent:()=>x,init:()=>b,pageView:()=>y,purchase:()=>k,silentRule:()=>P});import{getEvent as h}from"@walkeros/core";var f={site:123456789,collectDomain:"https://example.pa-cd.com"},b={title:"Initialization",description:"Destination bootstrap configures Piano with the site id and collection domain.",in:{settings:f},out:[["pa.setConfigurations",f]]},y={title:"Page view",description:"A page view fires a Piano page.display event with the page name and chapter.",in:h("page view",{timestamp:1700000200}),mapping:{name:"page.display",data:{map:{page:"data.title",page_chapter1:"globals.pagegroup"}}},out:[["pa.sendEvent","page.display",{page:"walkerOS documentation",page_chapter1:"docs"}]]},k={title:"Purchase",description:"A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.",in:h("order complete",{timestamp:1700000201}),mapping:{name:"transaction.confirmation",data:{map:{transaction_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["pa.sendEvent","transaction.confirmation",{transaction_id:"0rd3r1d",revenue:462,currency:"EUR"}]]},x={title:"Custom event",description:"A generic entity action fires a custom Piano event with mapped properties.",in:h("entity action",{timestamp:1700000202}),mapping:{name:"click.action",data:{map:{label:"data.string",value:"data.number"}}},out:[["pa.sendEvent","click.action",{label:"foo",value:1}]]},P={public:!1,description:"A rule with silent: true sends no Piano event.",in:h("page view",{timestamp:1700000203}),mapping:{silent:!0},out:[]},E={public:!1,description:"Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.",command:"consent",in:{analytics:!1},out:[]},A={settings:{site:123456789,collectDomain:"https://example.pa-cd.com"},config:{loadScript:!0}};export{d as examples,i 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\nexport const SettingsSchema = z\n .object({\n site: z\n .number()\n .describe(\n 'Piano Analytics site id (numeric), from your collection settings',\n ),\n collectDomain: z\n .string()\n .describe('Collection domain endpoint, like https://xxxxxxx.pa-cd.com'),\n options: z\n .record(z.string(), z.unknown())\n .describe('Additional Piano setConfigurations options merged on init')\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Piano Mapping Schema\n * Piano 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, PianoAnalytics } from '../types';\n\n/**\n * Example environment configurations for the Piano destination.\n *\n * These environments provide standardized mock structures for testing and\n * development without loading the real Piano SDK. They satisfy the `Env`\n * interface directly, so no type casts are needed.\n */\n\nconst noop = () => {};\n\n/** A no-op Piano SDK whose methods are wrapped by `mockEnv` to capture calls. */\nfunction mockPa(): PianoAnalytics {\n return {\n setConfigurations: noop,\n sendEvent: noop,\n sendEvents: noop,\n };\n}\n\n/** SDK not yet present: init must tolerate a missing `pa`. */\nexport const init: Env = {\n window: {},\n};\n\n/** SDK present: used for capturing setConfigurations/sendEvent calls. */\nexport const push: Env = {\n window: {\n pa: mockPa(),\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.pa.sendEvent', // Track Piano sendEvent calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nconst settings = {\n site: 123456789,\n collectDomain: 'https://example.pa-cd.com',\n};\n\n/**\n * Destination bootstrap.\n * init configures the Piano `pa` SDK with the site id and collection domain\n * via setConfigurations.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap configures Piano with the site id and collection domain.',\n in: {\n settings,\n },\n out: [['pa.setConfigurations', settings]],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view fires a Piano page.display event with the page name and chapter.',\n in: getEvent('page view', { timestamp: 1700000200 }),\n mapping: {\n name: 'page.display',\n data: {\n map: {\n page: 'data.title',\n page_chapter1: 'globals.pagegroup',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'page.display',\n {\n page: 'walkerOS documentation',\n page_chapter1: 'docs',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.',\n in: getEvent('order complete', { timestamp: 1700000201 }),\n mapping: {\n name: 'transaction.confirmation',\n data: {\n map: {\n transaction_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'transaction.confirmation',\n {\n transaction_id: '0rd3r1d',\n revenue: 555,\n currency: 'EUR',\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a custom Piano event with mapped properties.',\n in: getEvent('entity action', { timestamp: 1700000202 }),\n mapping: {\n name: 'click.action',\n data: {\n map: {\n label: 'data.string',\n value: 'data.number',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'click.action',\n {\n label: 'foo',\n value: 1,\n },\n ],\n ],\n};\n\n/** A silent rule sends no Piano event. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no Piano event.',\n in: getEvent('page view', { timestamp: 1700000203 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * Piano sends only on sendEvent, which the collector stops for a revoked\n * consent; the destination has no consent call to make.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.',\n command: 'consent',\n in: { analytics: false },\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA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,KAAK,CAAC;AACR;AAMO,IAAM,gBAAkC;AAAA,EAC7C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["z","init","settings"]}
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","../src/examples/minimal.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\nexport const SettingsSchema = z\n .object({\n site: z\n .number()\n .describe(\n 'Piano Analytics site id (numeric), from your collection settings',\n ),\n collectDomain: z\n .string()\n .describe('Collection domain endpoint, like https://xxxxxxx.pa-cd.com'),\n options: z\n .record(z.string(), z.unknown())\n .describe('Additional Piano setConfigurations options merged on init')\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Piano Mapping Schema\n * Piano 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';\nexport { minimal } from './minimal';\n","import type { Env, PianoAnalytics } from '../types';\n\n/**\n * Example environment configurations for the Piano destination.\n *\n * These environments provide standardized mock structures for testing and\n * development without loading the real Piano SDK. They satisfy the `Env`\n * interface directly, so no type casts are needed.\n */\n\nconst noop = () => {};\n\n/** A no-op Piano SDK whose methods are wrapped by `mockEnv` to capture calls. */\nfunction mockPa(): PianoAnalytics {\n return {\n setConfigurations: noop,\n sendEvent: noop,\n sendEvents: noop,\n };\n}\n\n/** SDK not yet present: init must tolerate a missing `pa`. */\nexport const init: Env = {\n window: {},\n};\n\n/** SDK present: used for capturing setConfigurations/sendEvent calls. */\nexport const push: Env = {\n window: {\n pa: mockPa(),\n },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n 'call:window.pa.sendEvent', // Track Piano sendEvent calls\n];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nconst settings = {\n site: 123456789,\n collectDomain: 'https://example.pa-cd.com',\n};\n\n/**\n * Destination bootstrap.\n * init configures the Piano `pa` SDK with the site id and collection domain\n * via setConfigurations.\n */\nexport const init: Flow.StepExample = {\n title: 'Initialization',\n description:\n 'Destination bootstrap configures Piano with the site id and collection domain.',\n in: {\n settings,\n },\n out: [['pa.setConfigurations', settings]],\n};\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view fires a Piano page.display event with the page name and chapter.',\n in: getEvent('page view', { timestamp: 1700000200 }),\n mapping: {\n name: 'page.display',\n data: {\n map: {\n page: 'data.title',\n page_chapter1: 'globals.pagegroup',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'page.display',\n {\n page: 'walkerOS documentation',\n page_chapter1: 'docs',\n },\n ],\n ],\n};\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.',\n in: getEvent('order complete', { timestamp: 1700000201 }),\n mapping: {\n name: 'transaction.confirmation',\n data: {\n map: {\n transaction_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'transaction.confirmation',\n {\n transaction_id: '0rd3r1d',\n revenue: 462,\n currency: 'EUR',\n },\n ],\n ],\n};\n\nexport const customEvent: Flow.StepExample = {\n title: 'Custom event',\n description:\n 'A generic entity action fires a custom Piano event with mapped properties.',\n in: getEvent('entity action', { timestamp: 1700000202 }),\n mapping: {\n name: 'click.action',\n data: {\n map: {\n label: 'data.string',\n value: 'data.number',\n },\n },\n },\n out: [\n [\n 'pa.sendEvent',\n 'click.action',\n {\n label: 'foo',\n value: 1,\n },\n ],\n ],\n};\n\n/** A silent rule sends no Piano event. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true sends no Piano event.',\n in: getEvent('page view', { timestamp: 1700000203 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * Piano sends only on sendEvent, which the collector stops for a revoked\n * consent; the destination has no consent call to make.\n */\nexport const consentRevoke: Flow.StepExample = {\n public: false,\n description:\n 'Piano Analytics sends only when the destination calls sendEvent, which walkerOS stops for a consent-gated destination after a revocation, so no consent call is needed.',\n command: 'consent',\n in: { analytics: false },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/** The settings Piano Analytics needs to deliver: the site ID and the collection domain, with the SDK loaded by the destination. */\nexport const minimal: Flow.MinimalExample = {\n settings: { site: 123456789, collectDomain: 'https://example.pa-cd.com' },\n config: { loadScript: true },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,MAAM,EACH,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,EACF,eAAe,EACZ,OAAO,EACP,SAAS,4DAA4D;AAAA,EACxE,SAAS,EACN,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAC9B,SAAS,2DAA2D,EACpE,SAAS;AACd,CAAC,EACA,OAAO;;;ACjBV,SAAS,KAAAA,UAAS;AAMX,IAAM,gBAAgBA,GAAE,OAAO,CAAC,CAAC;;;AFEjC,IAAM,WAAW,YAAY,cAAc;AAC3C,IAAM,UAAU,YAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;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MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,gBAAgB;AAAA,QAChB,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,cAAgC;AAAA,EAC3C,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,iBAAiB,EAAE,WAAW,WAAW,CAAC;AAAA,EACvD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAGO,IAAM,aAA+B;AAAA,EAC1C,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,IAAI,SAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS,EAAE,QAAQ,KAAK;AAAA,EACxB,KAAK,CAAC;AACR;AAMO,IAAM,gBAAkC;AAAA,EAC7C,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;;;ACxHO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,MAAM,WAAW,eAAe,4BAA4B;AAAA,EACxE,QAAQ,EAAE,YAAY,KAAK;AAC7B;","names":["z","init","settings"]}
@@ -68,4 +68,7 @@ declare namespace step {
68
68
  export { step_consentRevoke as consentRevoke, step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule };
69
69
  }
70
70
 
71
- export { env, step };
71
+ /** The settings Piano Analytics needs to deliver: the site ID and the collection domain, with the SDK loaded by the destination. */
72
+ declare const minimal: Flow.MinimalExample;
73
+
74
+ export { env, minimal, step };
@@ -68,4 +68,7 @@ declare namespace step {
68
68
  export { step_consentRevoke as consentRevoke, step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase, step_silentRule as silentRule };
69
69
  }
70
70
 
71
- export { env, step };
71
+ /** The settings Piano Analytics needs to deliver: the site ID and the collection domain, with the SDK loaded by the destination. */
72
+ declare const minimal: Flow.MinimalExample;
73
+
74
+ export { env, minimal, step };
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
23
  env: () => env_exports,
24
+ minimal: () => minimal,
24
25
  step: () => step_exports
25
26
  });
26
27
  module.exports = __toCommonJS(examples_exports);
@@ -121,7 +122,7 @@ var purchase = {
121
122
  "transaction.confirmation",
122
123
  {
123
124
  transaction_id: "0rd3r1d",
124
- revenue: 555,
125
+ revenue: 462,
125
126
  currency: "EUR"
126
127
  }
127
128
  ]
@@ -165,8 +166,15 @@ var consentRevoke = {
165
166
  in: { analytics: false },
166
167
  out: []
167
168
  };
169
+
170
+ // src/examples/minimal.ts
171
+ var minimal = {
172
+ settings: { site: 123456789, collectDomain: "https://example.pa-cd.com" },
173
+ config: { loadScript: true }
174
+ };
168
175
  // Annotate the CommonJS export names for ESM import in node:
169
176
  0 && (module.exports = {
170
177
  env,
178
+ minimal,
171
179
  step
172
180
  });
@@ -100,7 +100,7 @@ var purchase = {
100
100
  "transaction.confirmation",
101
101
  {
102
102
  transaction_id: "0rd3r1d",
103
- revenue: 555,
103
+ revenue: 462,
104
104
  currency: "EUR"
105
105
  }
106
106
  ]
@@ -144,7 +144,14 @@ var consentRevoke = {
144
144
  in: { analytics: false },
145
145
  out: []
146
146
  };
147
+
148
+ // src/examples/minimal.ts
149
+ var minimal = {
150
+ settings: { site: 123456789, collectDomain: "https://example.pa-cd.com" },
151
+ config: { loadScript: true }
152
+ };
147
153
  export {
148
154
  env_exports as env,
155
+ minimal,
149
156
  step_exports as step
150
157
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/web-destination-piano",
4
- "version": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "web"
@@ -69,6 +69,15 @@
69
69
  "call:window.pa.sendEvent"
70
70
  ]
71
71
  },
72
+ "minimal": {
73
+ "settings": {
74
+ "site": 123456789,
75
+ "collectDomain": "https://example.pa-cd.com"
76
+ },
77
+ "config": {
78
+ "loadScript": true
79
+ }
80
+ },
72
81
  "step": {
73
82
  "consentRevoke": {
74
83
  "public": false,
@@ -256,9 +265,10 @@
256
265
  "data": {
257
266
  "id": "0rd3r1d",
258
267
  "currency": "EUR",
268
+ "value": 462,
269
+ "tax": 73.76,
259
270
  "shipping": 5.22,
260
- "taxes": 73.76,
261
- "value": 555
271
+ "total": 467.22
262
272
  },
263
273
  "context": {
264
274
  "shopping": [
@@ -357,7 +367,7 @@
357
367
  "transaction.confirmation",
358
368
  {
359
369
  "transaction_id": "0rd3r1d",
360
- "revenue": 555,
370
+ "revenue": 462,
361
371
  "currency": "EUR"
362
372
  }
363
373
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-destination-piano",
3
3
  "description": "Piano Analytics web destination for walkerOS",
4
- "version": "4.8.2",
4
+ "version": "4.8.3-next-1793115089237",
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.8.2",
42
- "@walkeros/web-core": "4.8.2"
41
+ "@walkeros/core": "4.8.3-next-1793115089237",
42
+ "@walkeros/web-core": "4.8.3-next-1793115089237"
43
43
  },
44
44
  "devDependencies": {
45
- "@walkeros/collector": "4.8.2"
45
+ "@walkeros/collector": "4.8.3-next-1793115089237"
46
46
  },
47
47
  "repository": {
48
48
  "url": "git+https://github.com/elbwalker/walkerOS.git",