@walkeros/web-destination-piano 4.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 elbWalker GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ <p align="left">
2
+ <a href="https://www.walkeros.io">
3
+ <img alt="walkerOS" title="walkerOS" src="https://www.walkeros.io/img/walkerOS_logo.svg" width="256px"/>
4
+ </a>
5
+ </p>
6
+
7
+ # @walkeros/web-destination-piano
8
+
9
+ Send walkerOS events to Piano Analytics.
10
+
11
+ [Documentation](https://www.walkeros.io/docs/destinations/web/piano) &bull;
12
+ [NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-piano)
13
+ &bull;
14
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/destinations/piano)
15
+
16
+ This destination forwards collector-processed events to the official
17
+ [Piano Analytics JavaScript SDK](https://github.com/at-internet/piano-analytics-js)
18
+ (`pa`) via `pa.sendEvent`.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @walkeros/web-destination-piano
24
+ ```
25
+
26
+ ## Quick start
27
+
28
+ ```json
29
+ {
30
+ "version": 4,
31
+ "flows": {
32
+ "default": {
33
+ "config": {
34
+ "platform": "web"
35
+ },
36
+ "destinations": {
37
+ "piano": {
38
+ "package": "@walkeros/web-destination-piano",
39
+ "config": {
40
+ "loadScript": true,
41
+ "settings": {
42
+ "site": 123456789,
43
+ "collectDomain": "https://example.pa-cd.com"
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ With `loadScript: true` the destination loads the Piano SDK script and calls
54
+ `pa.setConfigurations({ site, collectDomain })` on init. If you load the SDK
55
+ yourself, omit `loadScript` and make sure `pa` is available on `window`.
56
+
57
+ ## Settings
58
+
59
+ | Setting | Type | Required | Description |
60
+ | --------------- | -------- | -------- | ------------------------------------------------------------ |
61
+ | `site` | `number` | yes | Piano Analytics site id, from your collection settings. |
62
+ | `collectDomain` | `string` | yes | Collection domain endpoint, like `https://xxxxxxx.pa-cd.com` |
63
+ | `options` | `object` | no | Additional Piano `setConfigurations` options merged on init. |
64
+
65
+ ## Mapping
66
+
67
+ Each event is mapped to a Piano event name and a property object, then sent with
68
+ `pa.sendEvent(name, data)`. Piano uses dot-notation event names like
69
+ `page.display`.
70
+
71
+ | walkerOS event | Piano event | Notes |
72
+ | ---------------- | -------------------------- | --------------------------- |
73
+ | `page view` | `page.display` | Page name and chapter. |
74
+ | `order complete` | `transaction.confirmation` | Transaction id and revenue. |
75
+
76
+ ```json
77
+ {
78
+ "mapping": {
79
+ "page": {
80
+ "view": {
81
+ "name": "page.display",
82
+ "data": { "map": { "page": "data.title" } }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## Documentation
90
+
91
+ Full configuration, mapping, and examples live in the docs:
92
+ **https://www.walkeros.io/docs/destinations/web/piano**
93
+
94
+ ## Contribute
95
+
96
+ Feel free to contribute by submitting an
97
+ [issue](https://github.com/elbwalker/walkerOS/issues), starting a
98
+ [discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
99
+ [contact](https://calendly.com/elb-alexander/30min).
100
+
101
+ ## License
102
+
103
+ MIT
package/dist/dev.d.mts ADDED
@@ -0,0 +1,100 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { WalkerOS, Flow } from '@walkeros/core';
4
+ import { DestinationWeb } from '@walkeros/web-core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ site: z.ZodNumber;
8
+ collectDomain: z.ZodString;
9
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
+ }, z.core.$strip>;
11
+ type Settings = z.infer<typeof SettingsSchema>;
12
+
13
+ /**
14
+ * Piano Mapping Schema
15
+ * Piano has no event-level mapping configuration
16
+ */
17
+ declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
18
+ /**
19
+ * Type inference from MappingSchema
20
+ */
21
+ type Mapping = z.infer<typeof MappingSchema>;
22
+
23
+ declare const settings: _walkeros_core_dev.JSONSchema;
24
+ declare const mapping: _walkeros_core_dev.JSONSchema;
25
+
26
+ type index$1_Mapping = Mapping;
27
+ declare const index$1_MappingSchema: typeof MappingSchema;
28
+ type index$1_Settings = Settings;
29
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
30
+ declare const index$1_mapping: typeof mapping;
31
+ declare const index$1_settings: typeof settings;
32
+ declare namespace index$1 {
33
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
34
+ }
35
+
36
+ declare global {
37
+ interface Window {
38
+ pa?: PianoAnalytics;
39
+ }
40
+ }
41
+ /**
42
+ * Surface of the official Piano Analytics browser SDK (the `pa` global from
43
+ * https://tag.aticdn.net/piano-analytics.js). Only the methods this
44
+ * destination calls are declared; the SDK exposes more.
45
+ */
46
+ interface PianoAnalytics {
47
+ setConfigurations(configurations: WalkerOS.AnyObject): void;
48
+ sendEvent(name: string, data?: WalkerOS.AnyObject): void;
49
+ sendEvents(events: ReadonlyArray<{
50
+ name: string;
51
+ data?: WalkerOS.AnyObject;
52
+ }>): void;
53
+ }
54
+ interface Env extends DestinationWeb.Env {
55
+ window?: {
56
+ pa?: PianoAnalytics;
57
+ };
58
+ }
59
+
60
+ /** SDK not yet present: init must tolerate a missing `pa`. */
61
+ declare const init$1: Env;
62
+ /** SDK present: used for capturing setConfigurations/sendEvent calls. */
63
+ declare const push: Env;
64
+ /**
65
+ * Simulation tracking paths
66
+ * Specifies which function calls to track during simulation
67
+ */
68
+ declare const simulation: string[];
69
+
70
+ declare const env_push: typeof push;
71
+ declare const env_simulation: typeof simulation;
72
+ declare namespace env {
73
+ export { init$1 as init, env_push as push, env_simulation as simulation };
74
+ }
75
+
76
+ /**
77
+ * Destination bootstrap.
78
+ * init configures the Piano `pa` SDK with the site id and collection domain
79
+ * via setConfigurations.
80
+ */
81
+ declare const init: Flow.StepExample;
82
+ declare const pageView: Flow.StepExample;
83
+ declare const purchase: Flow.StepExample;
84
+ declare const customEvent: Flow.StepExample;
85
+
86
+ declare const step_customEvent: typeof customEvent;
87
+ declare const step_init: typeof init;
88
+ declare const step_pageView: typeof pageView;
89
+ declare const step_purchase: typeof purchase;
90
+ declare namespace step {
91
+ export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
92
+ }
93
+
94
+ declare const index_env: typeof env;
95
+ declare const index_step: typeof step;
96
+ declare namespace index {
97
+ export { index_env as env, index_step as step };
98
+ }
99
+
100
+ export { index as examples, index$1 as schemas };
package/dist/dev.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { WalkerOS, Flow } from '@walkeros/core';
4
+ import { DestinationWeb } from '@walkeros/web-core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ site: z.ZodNumber;
8
+ collectDomain: z.ZodString;
9
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
+ }, z.core.$strip>;
11
+ type Settings = z.infer<typeof SettingsSchema>;
12
+
13
+ /**
14
+ * Piano Mapping Schema
15
+ * Piano has no event-level mapping configuration
16
+ */
17
+ declare const MappingSchema: z.ZodObject<{}, z.core.$strip>;
18
+ /**
19
+ * Type inference from MappingSchema
20
+ */
21
+ type Mapping = z.infer<typeof MappingSchema>;
22
+
23
+ declare const settings: _walkeros_core_dev.JSONSchema;
24
+ declare const mapping: _walkeros_core_dev.JSONSchema;
25
+
26
+ type index$1_Mapping = Mapping;
27
+ declare const index$1_MappingSchema: typeof MappingSchema;
28
+ type index$1_Settings = Settings;
29
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
30
+ declare const index$1_mapping: typeof mapping;
31
+ declare const index$1_settings: typeof settings;
32
+ declare namespace index$1 {
33
+ export { type index$1_Mapping as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, index$1_mapping as mapping, index$1_settings as settings };
34
+ }
35
+
36
+ declare global {
37
+ interface Window {
38
+ pa?: PianoAnalytics;
39
+ }
40
+ }
41
+ /**
42
+ * Surface of the official Piano Analytics browser SDK (the `pa` global from
43
+ * https://tag.aticdn.net/piano-analytics.js). Only the methods this
44
+ * destination calls are declared; the SDK exposes more.
45
+ */
46
+ interface PianoAnalytics {
47
+ setConfigurations(configurations: WalkerOS.AnyObject): void;
48
+ sendEvent(name: string, data?: WalkerOS.AnyObject): void;
49
+ sendEvents(events: ReadonlyArray<{
50
+ name: string;
51
+ data?: WalkerOS.AnyObject;
52
+ }>): void;
53
+ }
54
+ interface Env extends DestinationWeb.Env {
55
+ window?: {
56
+ pa?: PianoAnalytics;
57
+ };
58
+ }
59
+
60
+ /** SDK not yet present: init must tolerate a missing `pa`. */
61
+ declare const init$1: Env;
62
+ /** SDK present: used for capturing setConfigurations/sendEvent calls. */
63
+ declare const push: Env;
64
+ /**
65
+ * Simulation tracking paths
66
+ * Specifies which function calls to track during simulation
67
+ */
68
+ declare const simulation: string[];
69
+
70
+ declare const env_push: typeof push;
71
+ declare const env_simulation: typeof simulation;
72
+ declare namespace env {
73
+ export { init$1 as init, env_push as push, env_simulation as simulation };
74
+ }
75
+
76
+ /**
77
+ * Destination bootstrap.
78
+ * init configures the Piano `pa` SDK with the site id and collection domain
79
+ * via setConfigurations.
80
+ */
81
+ declare const init: Flow.StepExample;
82
+ declare const pageView: Flow.StepExample;
83
+ declare const purchase: Flow.StepExample;
84
+ declare const customEvent: Flow.StepExample;
85
+
86
+ declare const step_customEvent: typeof customEvent;
87
+ declare const step_init: typeof init;
88
+ declare const step_pageView: typeof pageView;
89
+ declare const step_purchase: typeof purchase;
90
+ declare namespace step {
91
+ export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
92
+ }
93
+
94
+ declare const index_env: typeof env;
95
+ declare const index_step: typeof step;
96
+ declare namespace index {
97
+ export { index_env as env, index_step as step };
98
+ }
99
+
100
+ export { index as examples, index$1 as schemas };
package/dist/dev.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,o=(e,a)=>{for(var i in a)t(e,i,{get:a[i],enumerable:!0})},r={};o(r,{examples:()=>g,schemas:()=>c}),module.exports=(e=r,((e,o,r,c)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let s of i(o))n.call(e,s)||s===r||t(e,s,{get:()=>o[s],enumerable:!(c=a(o,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c={};o(c,{MappingSchema:()=>l,SettingsSchema:()=>d,mapping:()=>u,settings:()=>m});var s=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()}),l=require("@walkeros/core/dev").z.object({}),m=(0,s.zodToSchema)(d),u=(0,s.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,{customEvent:()=>O,init:()=>x,pageView:()=>z,purchase:()=>k});var P=require("@walkeros/core"),E={site:123456789,collectDomain:"https://example.pa-cd.com"},x={title:"Initialization",description:"Destination bootstrap configures Piano with the site id and collection domain.",in:{settings:E},out:[["pa.setConfigurations",E]]},z={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"}]]},k={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.total",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}]]};//# sourceMappingURL=dev.js.map
@@ -0,0 +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.object({\n site: z\n .number()\n .describe('Piano Analytics site id (numeric), from your collection settings'),\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\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.total',\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"],"mappings":";;;;;;;;;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QAAI,sBAAS,aAAa,EAAE,WAAW,WAAW,CAAC;AAAA,EACnD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,MAAM;AAAA,QACN,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,WAA6B;AAAA,EACxC,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,kBAAkB,EAAE,WAAW,WAAW,CAAC;AAAA,EACxD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,gBAAgB;AAAA,QAChB,SAAS;AAAA,QACT,UAAU;AAAA,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,QAAI,sBAAS,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;","names":["import_dev","import_dev","init","settings"]}
package/dist/dev.mjs ADDED
@@ -0,0 +1 @@
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:()=>c});import{zodToSchema as i}from"@walkeros/core/dev";import{z as n}from"@walkeros/core/dev";var o=n.object({site:n.number().describe("Piano Analytics site id (numeric), from your collection settings"),collectDomain:n.string().describe("Collection domain endpoint, like https://xxxxxxx.pa-cd.com"),options:n.record(n.string(),n.unknown()).describe("Additional Piano setConfigurations options merged on init").optional()});import{z as r}from"@walkeros/core/dev";var s=r.object({}),c=i(o),p=i(s),d={};t(d,{env:()=>m,step:()=>w});var m={};t(m,{init:()=>g,push:()=>u,simulation:()=>v});var l=()=>{};var g={window:{}},u={window:{pa:{setConfigurations:l,sendEvent:l,sendEvents:l}}},v=["call:window.pa.sendEvent"],w={};t(w,{customEvent:()=>k,init:()=>b,pageView:()=>y,purchase:()=>x});import{getEvent as f}from"@walkeros/core";var h={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:h},out:[["pa.setConfigurations",h]]},y={title:"Page view",description:"A page view fires a Piano page.display event with the page name and chapter.",in:f("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"}]]},x={title:"Purchase",description:"A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.",in:f("order complete",{timestamp:1700000201}),mapping:{name:"transaction.confirmation",data:{map:{transaction_id:"data.id",revenue:"data.total",currency:"data.currency"}}},out:[["pa.sendEvent","transaction.confirmation",{transaction_id:"0rd3r1d",revenue:555,currency:"EUR"}]]},k={title:"Custom event",description:"A generic entity action fires a custom Piano event with mapped properties.",in:f("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}]]};export{d as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
@@ -0,0 +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.object({\n site: z\n .number()\n .describe('Piano Analytics site id (numeric), from your collection settings'),\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\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.total',\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"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,MAAM;AAAA,QACN,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,WAA6B;AAAA,EACxC,OAAO;AAAA,EACP,aACE;AAAA,EACF,IAAI,SAAS,kBAAkB,EAAE,WAAW,WAAW,CAAC;AAAA,EACxD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,KAAK;AAAA,QACH,gBAAgB;AAAA,QAChB,SAAS;AAAA,QACT,UAAU;AAAA,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;","names":["z","init","settings"]}
@@ -0,0 +1,62 @@
1
+ import { WalkerOS, Flow } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ pa?: PianoAnalytics;
7
+ }
8
+ }
9
+ /**
10
+ * Surface of the official Piano Analytics browser SDK (the `pa` global from
11
+ * https://tag.aticdn.net/piano-analytics.js). Only the methods this
12
+ * destination calls are declared; the SDK exposes more.
13
+ */
14
+ interface PianoAnalytics {
15
+ setConfigurations(configurations: WalkerOS.AnyObject): void;
16
+ sendEvent(name: string, data?: WalkerOS.AnyObject): void;
17
+ sendEvents(events: ReadonlyArray<{
18
+ name: string;
19
+ data?: WalkerOS.AnyObject;
20
+ }>): void;
21
+ }
22
+ interface Env extends DestinationWeb.Env {
23
+ window?: {
24
+ pa?: PianoAnalytics;
25
+ };
26
+ }
27
+
28
+ /** SDK not yet present: init must tolerate a missing `pa`. */
29
+ declare const init$1: Env;
30
+ /** SDK present: used for capturing setConfigurations/sendEvent calls. */
31
+ declare const push: Env;
32
+ /**
33
+ * Simulation tracking paths
34
+ * Specifies which function calls to track during simulation
35
+ */
36
+ declare const simulation: string[];
37
+
38
+ declare const env_push: typeof push;
39
+ declare const env_simulation: typeof simulation;
40
+ declare namespace env {
41
+ export { init$1 as init, env_push as push, env_simulation as simulation };
42
+ }
43
+
44
+ /**
45
+ * Destination bootstrap.
46
+ * init configures the Piano `pa` SDK with the site id and collection domain
47
+ * via setConfigurations.
48
+ */
49
+ declare const init: Flow.StepExample;
50
+ declare const pageView: Flow.StepExample;
51
+ declare const purchase: Flow.StepExample;
52
+ declare const customEvent: Flow.StepExample;
53
+
54
+ declare const step_customEvent: typeof customEvent;
55
+ declare const step_init: typeof init;
56
+ declare const step_pageView: typeof pageView;
57
+ declare const step_purchase: typeof purchase;
58
+ declare namespace step {
59
+ export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
60
+ }
61
+
62
+ export { env, step };
@@ -0,0 +1,62 @@
1
+ import { WalkerOS, Flow } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ pa?: PianoAnalytics;
7
+ }
8
+ }
9
+ /**
10
+ * Surface of the official Piano Analytics browser SDK (the `pa` global from
11
+ * https://tag.aticdn.net/piano-analytics.js). Only the methods this
12
+ * destination calls are declared; the SDK exposes more.
13
+ */
14
+ interface PianoAnalytics {
15
+ setConfigurations(configurations: WalkerOS.AnyObject): void;
16
+ sendEvent(name: string, data?: WalkerOS.AnyObject): void;
17
+ sendEvents(events: ReadonlyArray<{
18
+ name: string;
19
+ data?: WalkerOS.AnyObject;
20
+ }>): void;
21
+ }
22
+ interface Env extends DestinationWeb.Env {
23
+ window?: {
24
+ pa?: PianoAnalytics;
25
+ };
26
+ }
27
+
28
+ /** SDK not yet present: init must tolerate a missing `pa`. */
29
+ declare const init$1: Env;
30
+ /** SDK present: used for capturing setConfigurations/sendEvent calls. */
31
+ declare const push: Env;
32
+ /**
33
+ * Simulation tracking paths
34
+ * Specifies which function calls to track during simulation
35
+ */
36
+ declare const simulation: string[];
37
+
38
+ declare const env_push: typeof push;
39
+ declare const env_simulation: typeof simulation;
40
+ declare namespace env {
41
+ export { init$1 as init, env_push as push, env_simulation as simulation };
42
+ }
43
+
44
+ /**
45
+ * Destination bootstrap.
46
+ * init configures the Piano `pa` SDK with the site id and collection domain
47
+ * via setConfigurations.
48
+ */
49
+ declare const init: Flow.StepExample;
50
+ declare const pageView: Flow.StepExample;
51
+ declare const purchase: Flow.StepExample;
52
+ declare const customEvent: Flow.StepExample;
53
+
54
+ declare const step_customEvent: typeof customEvent;
55
+ declare const step_init: typeof init;
56
+ declare const step_pageView: typeof pageView;
57
+ declare const step_purchase: typeof purchase;
58
+ declare namespace step {
59
+ export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
60
+ }
61
+
62
+ export { env, step };
@@ -0,0 +1,156 @@
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
+ step: () => step_exports
25
+ });
26
+ module.exports = __toCommonJS(examples_exports);
27
+
28
+ // src/examples/env.ts
29
+ var env_exports = {};
30
+ __export(env_exports, {
31
+ init: () => init,
32
+ push: () => push,
33
+ simulation: () => simulation
34
+ });
35
+ var noop = () => {
36
+ };
37
+ function mockPa() {
38
+ return {
39
+ setConfigurations: noop,
40
+ sendEvent: noop,
41
+ sendEvents: noop
42
+ };
43
+ }
44
+ var init = {
45
+ window: {}
46
+ };
47
+ var push = {
48
+ window: {
49
+ pa: mockPa()
50
+ }
51
+ };
52
+ var simulation = [
53
+ "call:window.pa.sendEvent"
54
+ // Track Piano sendEvent calls
55
+ ];
56
+
57
+ // src/examples/step.ts
58
+ var step_exports = {};
59
+ __export(step_exports, {
60
+ customEvent: () => customEvent,
61
+ init: () => init2,
62
+ pageView: () => pageView,
63
+ purchase: () => purchase
64
+ });
65
+ var import_core = require("@walkeros/core");
66
+ var settings = {
67
+ site: 123456789,
68
+ collectDomain: "https://example.pa-cd.com"
69
+ };
70
+ var init2 = {
71
+ title: "Initialization",
72
+ description: "Destination bootstrap configures Piano with the site id and collection domain.",
73
+ in: {
74
+ settings
75
+ },
76
+ out: [["pa.setConfigurations", settings]]
77
+ };
78
+ var pageView = {
79
+ title: "Page view",
80
+ description: "A page view fires a Piano page.display event with the page name and chapter.",
81
+ in: (0, import_core.getEvent)("page view", { timestamp: 1700000200 }),
82
+ mapping: {
83
+ name: "page.display",
84
+ data: {
85
+ map: {
86
+ page: "data.title",
87
+ page_chapter1: "globals.pagegroup"
88
+ }
89
+ }
90
+ },
91
+ out: [
92
+ [
93
+ "pa.sendEvent",
94
+ "page.display",
95
+ {
96
+ page: "walkerOS documentation",
97
+ page_chapter1: "docs"
98
+ }
99
+ ]
100
+ ]
101
+ };
102
+ var purchase = {
103
+ title: "Purchase",
104
+ description: "A completed order fires a Piano transaction.confirmation event with the transaction id, revenue and currency.",
105
+ in: (0, import_core.getEvent)("order complete", { timestamp: 1700000201 }),
106
+ mapping: {
107
+ name: "transaction.confirmation",
108
+ data: {
109
+ map: {
110
+ transaction_id: "data.id",
111
+ revenue: "data.total",
112
+ currency: "data.currency"
113
+ }
114
+ }
115
+ },
116
+ out: [
117
+ [
118
+ "pa.sendEvent",
119
+ "transaction.confirmation",
120
+ {
121
+ transaction_id: "0rd3r1d",
122
+ revenue: 555,
123
+ currency: "EUR"
124
+ }
125
+ ]
126
+ ]
127
+ };
128
+ var customEvent = {
129
+ title: "Custom event",
130
+ description: "A generic entity action fires a custom Piano event with mapped properties.",
131
+ in: (0, import_core.getEvent)("entity action", { timestamp: 1700000202 }),
132
+ mapping: {
133
+ name: "click.action",
134
+ data: {
135
+ map: {
136
+ label: "data.string",
137
+ value: "data.number"
138
+ }
139
+ }
140
+ },
141
+ out: [
142
+ [
143
+ "pa.sendEvent",
144
+ "click.action",
145
+ {
146
+ label: "foo",
147
+ value: 1
148
+ }
149
+ ]
150
+ ]
151
+ };
152
+ // Annotate the CommonJS export names for ESM import in node:
153
+ 0 && (module.exports = {
154
+ env,
155
+ step
156
+ });