@walkeros/web-destination-piano 4.8.1 → 4.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @walkeros/web-destination-piano
2
2
 
3
+ ## 4.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 2374f54: Events no longer vanish while the Piano script loads: pushes wait for
8
+ it, and fail visibly when it is blocked or missing. A missing `site` or
9
+ `collectDomain` is a `config` error, and rules with `silent: true` send no
10
+ event.
11
+ - 2374f54: A failed vendor call, a missing required setting (`config`) and an
12
+ event that cannot be sent (`missing-input`) are reported as failed pushes,
13
+ with the dead-letter queue and one ERROR line, instead of counting as
14
+ delivered. Rules with `silent: true` send no event. Settings schemas reject
15
+ unknown keys.
16
+ - b1d65e2: Web destinations that load a vendor script inject it through the
17
+ document of their `env`, so simulation and server-side rendering work without
18
+ a browser page. A page still gets the script in its own document by default,
19
+ and a missing document fails the push with `vendor-not-ready`.
20
+ - 2374f54: Vendor scripts load through walkerOS: a blocked or slow script fails
21
+ later events visibly (`vendor-not-loaded`, `vendor-timeout`) instead of losing
22
+ them. Pushes made while the script loads wait for it, and each script is
23
+ injected once per page.
24
+ - Updated dependencies [2374f54]
25
+ - Updated dependencies [7e5fc27]
26
+ - Updated dependencies [2374f54]
27
+ - Updated dependencies [964590a]
28
+ - Updated dependencies [4100ede]
29
+ - Updated dependencies [2374f54]
30
+ - Updated dependencies [2374f54]
31
+ - Updated dependencies [15eb7b2]
32
+ - Updated dependencies [33a2779]
33
+ - Updated dependencies [33a2779]
34
+ - Updated dependencies [b1d65e2]
35
+ - Updated dependencies [964590a]
36
+ - Updated dependencies [2374f54]
37
+ - @walkeros/core@4.8.2
38
+ - @walkeros/web-core@4.8.2
39
+
3
40
  ## 4.8.1
4
41
 
5
42
  ### Patch Changes
package/dist/dev.d.mts CHANGED
@@ -7,7 +7,7 @@ declare const SettingsSchema: z.ZodObject<{
7
7
  site: z.ZodNumber;
8
8
  collectDomain: z.ZodString;
9
9
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
- }, z.core.$strip>;
10
+ }, z.core.$strict>;
11
11
  type Settings = z.infer<typeof SettingsSchema>;
12
12
 
13
13
  /**
@@ -82,13 +82,22 @@ declare const init: Flow.StepExample;
82
82
  declare const pageView: Flow.StepExample;
83
83
  declare const purchase: Flow.StepExample;
84
84
  declare const customEvent: Flow.StepExample;
85
+ /** A silent rule sends no Piano event. */
86
+ declare const silentRule: Flow.StepExample;
87
+ /**
88
+ * Piano sends only on sendEvent, which the collector stops for a revoked
89
+ * consent; the destination has no consent call to make.
90
+ */
91
+ declare const consentRevoke: Flow.StepExample;
85
92
 
93
+ declare const step_consentRevoke: typeof consentRevoke;
86
94
  declare const step_customEvent: typeof customEvent;
87
95
  declare const step_init: typeof init;
88
96
  declare const step_pageView: typeof pageView;
89
97
  declare const step_purchase: typeof purchase;
98
+ declare const step_silentRule: typeof silentRule;
90
99
  declare namespace step {
91
- export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
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 };
92
101
  }
93
102
 
94
103
  declare const index_env: typeof env;
package/dist/dev.d.ts CHANGED
@@ -7,7 +7,7 @@ declare const SettingsSchema: z.ZodObject<{
7
7
  site: z.ZodNumber;
8
8
  collectDomain: z.ZodString;
9
9
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
- }, z.core.$strip>;
10
+ }, z.core.$strict>;
11
11
  type Settings = z.infer<typeof SettingsSchema>;
12
12
 
13
13
  /**
@@ -82,13 +82,22 @@ declare const init: Flow.StepExample;
82
82
  declare const pageView: Flow.StepExample;
83
83
  declare const purchase: Flow.StepExample;
84
84
  declare const customEvent: Flow.StepExample;
85
+ /** A silent rule sends no Piano event. */
86
+ declare const silentRule: Flow.StepExample;
87
+ /**
88
+ * Piano sends only on sendEvent, which the collector stops for a revoked
89
+ * consent; the destination has no consent call to make.
90
+ */
91
+ declare const consentRevoke: Flow.StepExample;
85
92
 
93
+ declare const step_consentRevoke: typeof consentRevoke;
86
94
  declare const step_customEvent: typeof customEvent;
87
95
  declare const step_init: typeof init;
88
96
  declare const step_pageView: typeof pageView;
89
97
  declare const step_purchase: typeof purchase;
98
+ declare const step_silentRule: typeof silentRule;
90
99
  declare namespace step {
91
- export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
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 };
92
101
  }
93
102
 
94
103
  declare const index_env: typeof env;
package/dist/dev.js CHANGED
@@ -1 +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
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
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.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\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;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,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;;;ACfD,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,cAAAC;AAAA,EAAA;AAAA;AAAA;AACA,kBAAyB;AAEzB,IAAMC,YAAW;AAAA,EACf,MAAM;AAAA,EACN,eAAe;AACjB;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AA,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"]}
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,OA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F;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;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"]}
package/dist/dev.mjs CHANGED
@@ -1 +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
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
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.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\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;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,MAAM,EACH,OAAO,EACP;AAAA,IAC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AK;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"]}
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"],"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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":["z","init","settings"]}
@@ -50,13 +50,22 @@ declare const init: Flow.StepExample;
50
50
  declare const pageView: Flow.StepExample;
51
51
  declare const purchase: Flow.StepExample;
52
52
  declare const customEvent: Flow.StepExample;
53
+ /** A silent rule sends no Piano event. */
54
+ declare const silentRule: Flow.StepExample;
55
+ /**
56
+ * Piano sends only on sendEvent, which the collector stops for a revoked
57
+ * consent; the destination has no consent call to make.
58
+ */
59
+ declare const consentRevoke: Flow.StepExample;
53
60
 
61
+ declare const step_consentRevoke: typeof consentRevoke;
54
62
  declare const step_customEvent: typeof customEvent;
55
63
  declare const step_init: typeof init;
56
64
  declare const step_pageView: typeof pageView;
57
65
  declare const step_purchase: typeof purchase;
66
+ declare const step_silentRule: typeof silentRule;
58
67
  declare namespace step {
59
- export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
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 };
60
69
  }
61
70
 
62
71
  export { env, step };
@@ -50,13 +50,22 @@ declare const init: Flow.StepExample;
50
50
  declare const pageView: Flow.StepExample;
51
51
  declare const purchase: Flow.StepExample;
52
52
  declare const customEvent: Flow.StepExample;
53
+ /** A silent rule sends no Piano event. */
54
+ declare const silentRule: Flow.StepExample;
55
+ /**
56
+ * Piano sends only on sendEvent, which the collector stops for a revoked
57
+ * consent; the destination has no consent call to make.
58
+ */
59
+ declare const consentRevoke: Flow.StepExample;
53
60
 
61
+ declare const step_consentRevoke: typeof consentRevoke;
54
62
  declare const step_customEvent: typeof customEvent;
55
63
  declare const step_init: typeof init;
56
64
  declare const step_pageView: typeof pageView;
57
65
  declare const step_purchase: typeof purchase;
66
+ declare const step_silentRule: typeof silentRule;
58
67
  declare namespace step {
59
- export { step_customEvent as customEvent, step_init as init, step_pageView as pageView, step_purchase as purchase };
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 };
60
69
  }
61
70
 
62
71
  export { env, step };
@@ -57,10 +57,12 @@ var simulation = [
57
57
  // src/examples/step.ts
58
58
  var step_exports = {};
59
59
  __export(step_exports, {
60
+ consentRevoke: () => consentRevoke,
60
61
  customEvent: () => customEvent,
61
62
  init: () => init2,
62
63
  pageView: () => pageView,
63
- purchase: () => purchase
64
+ purchase: () => purchase,
65
+ silentRule: () => silentRule
64
66
  });
65
67
  var import_core = require("@walkeros/core");
66
68
  var settings = {
@@ -108,7 +110,7 @@ var purchase = {
108
110
  data: {
109
111
  map: {
110
112
  transaction_id: "data.id",
111
- revenue: "data.total",
113
+ revenue: "data.value",
112
114
  currency: "data.currency"
113
115
  }
114
116
  }
@@ -149,6 +151,20 @@ var customEvent = {
149
151
  ]
150
152
  ]
151
153
  };
154
+ var silentRule = {
155
+ public: false,
156
+ description: "A rule with silent: true sends no Piano event.",
157
+ in: (0, import_core.getEvent)("page view", { timestamp: 1700000203 }),
158
+ mapping: { silent: true },
159
+ out: []
160
+ };
161
+ var consentRevoke = {
162
+ public: false,
163
+ 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.",
164
+ command: "consent",
165
+ in: { analytics: false },
166
+ out: []
167
+ };
152
168
  // Annotate the CommonJS export names for ESM import in node:
153
169
  0 && (module.exports = {
154
170
  env,
@@ -36,10 +36,12 @@ var simulation = [
36
36
  // src/examples/step.ts
37
37
  var step_exports = {};
38
38
  __export(step_exports, {
39
+ consentRevoke: () => consentRevoke,
39
40
  customEvent: () => customEvent,
40
41
  init: () => init2,
41
42
  pageView: () => pageView,
42
- purchase: () => purchase
43
+ purchase: () => purchase,
44
+ silentRule: () => silentRule
43
45
  });
44
46
  import { getEvent } from "@walkeros/core";
45
47
  var settings = {
@@ -87,7 +89,7 @@ var purchase = {
87
89
  data: {
88
90
  map: {
89
91
  transaction_id: "data.id",
90
- revenue: "data.total",
92
+ revenue: "data.value",
91
93
  currency: "data.currency"
92
94
  }
93
95
  }
@@ -128,6 +130,20 @@ var customEvent = {
128
130
  ]
129
131
  ]
130
132
  };
133
+ var silentRule = {
134
+ public: false,
135
+ description: "A rule with silent: true sends no Piano event.",
136
+ in: getEvent("page view", { timestamp: 1700000203 }),
137
+ mapping: { silent: true },
138
+ out: []
139
+ };
140
+ var consentRevoke = {
141
+ public: false,
142
+ 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.",
143
+ command: "consent",
144
+ in: { analytics: false },
145
+ out: []
146
+ };
131
147
  export {
132
148
  env_exports as env,
133
149
  step_exports as step
@@ -1 +1 @@
1
- "use strict";var Destination=(()=>{var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,e=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r={};((n,e)=>{for(var o in e)t(n,o,{get:e[o],enumerable:!0})})(r,{DestinationPiano:()=>v,default:()=>E,destinationPiano:()=>b});var i=Object.defineProperty,a=(t,n)=>{for(var e in n)i(t,e,{get:n[e],enumerable:!0})};function c(t,n){if("collector"===t)return"collector";if(!n)throw new Error(`stepId(${t}) requires an id`);return`${t}.${n}`}a({},{stepId:()=>c});function u(t,n){const e=t.destinations[n];if(!e)throw new Error(`Destination not found: ${n}`);return e}a({},{getDestination:()=>u});a({},{Level:()=>f});var s,f=((s=f||{})[s.ERROR=0]="ERROR",s[s.WARN=1]="WARN",s[s.INFO=2]="INFO",s[s.DEBUG=3]="DEBUG",s);function l(t,n){const e=t.transformers[n];if(!e)throw new Error(`Transformer not found: ${n}`);return e}a({},{getTransformer:()=>l});function d(t,n){const e=t.sources[n];if(!e)throw new Error(`Source not found: ${n}`);return e}a({},{getSource:()=>d});function p(t,n){const e=t.stores[n];if(!e)throw new Error(`Store not found: ${n}`);return e}async function w(t,n){return await t.get(n)}function g(t){return void 0!==t}function y(t){return"object"==typeof t&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)}a({},{getStore:()=>p,getStoreValue:()=>w});var v={},m="https://tag.aticdn.net/piano-analytics.js",b={type:"piano",config:{},init({config:t,env:n,logger:e}){const o=t.settings||{},r=()=>{const t=O(n);t&&g(o.site)&&g(o.collectDomain)&&t.setConfigurations({site:o.site,collectDomain:o.collectDomain,...y(o.options)?o.options:{}})};return t.loadScript?function(t=m,n,e){if("undefined"==typeof document)return;const o=document.createElement("script");o.src=t,n&&(o.onload=()=>n());e&&(o.onerror=()=>e());document.head.appendChild(o)}(m,r,()=>e.warn("Piano Analytics script failed to load, destination not configured")):r(),t},push(t,{data:n,env:e}){const o=O(e);o&&o.sendEvent(t.name,y(n)?n:{})}};function O(t){var n,e;return null!=(e=null==(n=t.window)?void 0:n.pa)?e:"undefined"!=typeof window?window.pa:void 0}var j,E=b;return j=r,((r,i,a,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let u of e(i))o.call(r,u)||u===a||t(r,u,{get:()=>i[u],enumerable:!(c=n(i,u))||c.enumerable});return r})(t({},"__esModule",{value:!0}),j)})();
1
+ "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r),i={};((t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})})(i,{DestinationPiano:()=>T,default:()=>B,destinationPiano:()=>L});var s=Object.defineProperty,c=(e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})};function u(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}c({},{stepId:()=>u});function a(e,t){const n=e.destinations[t];if(!n)throw new Error(`Destination not found: ${t}`);return n}c({},{getDestination:()=>a});c({},{Level:()=>l});var f,l=((f=l||{})[f.ERROR=0]="ERROR",f[f.WARN=1]="WARN",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f);function d(e,t){const n=e.transformers[t];if(!n)throw new Error(`Transformer not found: ${t}`);return n}c({},{getTransformer:()=>d});function p(e,t){const n=e.sources[t];if(!n)throw new Error(`Source not found: ${t}`);return n}c({},{getSource:()=>p});function y(e,t){const n=e.stores[t];if(!n)throw new Error(`Store not found: ${t}`);return n}async function g(e,t){return await e.get(t)}c({},{getStore:()=>y,getStoreValue:()=>g});var w="\\$flow\\.([a-zA-Z_][a-zA-Z0-9_-]*)(?:\\.([a-zA-Z0-9_.]+))?";new RegExp(`^${w}$`),new RegExp(w,"g");function h(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function v(e){return"object"==typeof e&&null!==e&&!function(e){return Array.isArray(e)}(e)&&"[object Object]"===Object.prototype.toString.call(e)}var b=["transport","timeout","breaker-open","blocked","queue-full","vendor-not-ready","vendor-timeout"],m=class extends Error{constructor(e,t){super(e),o(this,"code"),o(this,"status"),o(this,"retryable"),o(this,"body"),void 0!==t.cause&&function(e,t){Object.defineProperty(e,"cause",{value:t,writable:!0,configurable:!0})}(this,t.cause),this.name="StepError",this.code=t.code,void 0!==t.status&&(this.status=t.status),this.retryable=function(e){if(void 0!==e.retryable)return e.retryable;const{status:t}=e;if(void 0!==t){if(429===t||t>=500&&t<600)return!0;if(t>=400&&t<500)return!1}return b.includes(e.code)}(t),void 0!==t.body&&(this.body=t.body),Object.setPrototypeOf(this,new.target.prototype)}};var O="observe";function j(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function P(e){return"function"==typeof e}function R(e){return"object"==typeof e&&null!==e}var E=["name","length","prototype","arguments","caller"];function A(e,t){if(-1!==E.indexOf(t))return!1;let n=e;for(;P(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!P(e)||!P(Object.getPrototypeOf(e)))return!1;n=e}return!1}function S(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function $(e,t){let n=e;for(const e of t){if(P(n)){if(!A(n,e))return!0;if(!S(n,e))return!1}else if(h(n)){if(!(e in n))return!0}else if(!R(n)||!(e in n))return!1;n=Reflect.get(n,e)}return P(n)}function x(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[O];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=typeof e||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;const{paths:t,record:n}=e;return Array.isArray(t)&&t.every(e=>"string"==typeof e)&&"function"==typeof n}(n)){delete t[O];const e=function(e,t,n){const r=[],o=[],i=[];for(const n of t){const t=j(n);if(0===t.length)continue;const r=t.join(".");i.push({rest:t,fn:r}),$(e,t)||o.push(r)}const s=new WeakMap,c=new WeakSet;function u(e,t){for(const o of e)if(n)try{n(o,t)}catch(e){}else r.push({fn:o,args:t,ts:Date.now()})}function a(e,t){return 0===t.length||f(e)?e:h(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>a(e,t)):P(e)?w(e,[],t):R(e)?d(e,t):e}function f(e){return(R(e)||P(e))&&c.has(e)}function l(e,t){const n=[],r=[];for(const o of e)o.rest[0]===t&&(1===o.rest.length?n.includes(o.fn)||n.push(o.fn):r.push({rest:o.rest.slice(1),fn:o.fn}));return{leafs:n,deeper:r}}function d(e,t){var n;const r=t.map(e=>`${e.fn}:${e.rest.join(".")}`).join("|"),o=null!=(n=s.get(e))?n:new Map;s.set(e,o);const i=o.get(r);if(i)return i;const c=p(e,t);return o.set(r,c),c}function p(e,t){return P(e)?y(e,t):t.some(t=>!S(e,t.rest[0]))?function(e,t){const n=Object.create(Object.getPrototypeOf(e)),r=g(e,t,()=>o),o=new Proxy(n,{get:(e,t)=>r.get(t),set:(t,n,r)=>Reflect.set(e,n,r,e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(t,n){const r=Reflect.getOwnPropertyDescriptor(e,n);return r&&{...r,configurable:!0}},defineProperty:(t,n,r)=>Reflect.defineProperty(e,n,r),deleteProperty:(t,n)=>Reflect.deleteProperty(e,n)});return c.add(o),o}(e,t):y(e,t)}function y(e,t){const n=g(e,t,()=>r),r=new Proxy(e,{get:(e,t)=>"string"!=typeof t||S(e,t)?n.get(t):Reflect.get(e,t,e),set:(e,t,n)=>Reflect.set(e,t,n,e)});return c.add(r),r}function g(e,t,n){const r=new Map;return{get(o){const i=Reflect.get(e,o,e);if("string"!=typeof o)return i;if(!P(i)&&!R(i))return i;if(f(i))return i;const s=r.get(o);if(s&&s.value===i)return s.out;const{leafs:c,deeper:u}=l(t,o);if(!(c.length>0||u.length>0)&&(!P(i)||function(e){if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return i;let a=i;return P(i)?a=w(i,c,u,{proxy:n(),target:e}):u.length>0&&(a=d(i,u)),r.set(o,{value:i,out:a}),a}}}function w(e,t,n,r){const o=()=>n.filter(t=>!A(e,t.rest[0])),i=new Map,s=new Proxy(e,{get(e,t){const r=Reflect.get(e,t,e);if("string"!=typeof t||!S(e,t))return r;if(!A(e,t))return r;const{leafs:o,deeper:c}=l(n,t);if(0===o.length&&0===c.length)return r;if(f(r))return r;const u=i.get(t);if(u&&u.value===r)return u.out;let a=r;return P(r)?a=w(r,o,c,{proxy:s,target:e}):R(r)&&c.length>0&&(a=d(r,c)),i.set(t,{value:r,out:a}),a},set:(e,t,n)=>Reflect.set(e,t,n,e),apply(e,n,i){u(t,i);const s=!r||n!==r.proxy&&void 0!==n?n:r.target;return a(Reflect.apply(e,s,i),o())},construct(e,n,r){u(t,n);const i=Reflect.construct(e,n,r===s?e:r),c=a(i,o());return R(c)||P(c)?c:i}});return c.add(s),s}return{env:p(e,i),calls:r,unresolved:o}}(t,n.paths,n.record).env,r=new Set;for(const e of n.paths){const n=j(e)[0];if(void 0===n)continue;const o=t[n];null!==o&&"object"==typeof o&&r.add(n)}const o=Array.from(r,t=>[t,e[t]]);for(const[e,n]of o)t[e]=n}return t}var D="data-walkeros-vendor",_=new WeakMap;var W=()=>new m("Vendor script failed to load",{code:"vendor-not-loaded"});function k(e,t,n={}){var r,o;const i=()=>null!=t();let s;if(e){const t=null!=(r=n.document)?r:"undefined"!=typeof document?document:void 0;if(!t)throw new m(`Vendor script ${e} has no document to go into`,{code:"vendor-not-ready"});s=function(e,t,n,r,o){const i=function(e,t){const n=e.querySelectorAll(`script[${D}]`);return Array.from(n).find(e=>e.getAttribute("src")===t)}(e,t),s=i&&_.get(i);if(s)return s;const c={state:"loading",expired:!1,timeout:n,waiting:[]};if(i&&o())return c.state="loaded",_.set(i,c),c;const u=null!=i?i:e.createElement("script"),a=e=>{const t=c.waiting;c.waiting=[],t.forEach(t=>t(e))},f=setTimeout(()=>{c.expired=!0,a("expired")},n);if(_.set(u,c),u.addEventListener("load",()=>{clearTimeout(f),c.state="loaded",a("loaded")}),u.addEventListener("error",()=>{clearTimeout(f),c.state="failed",a("failed")}),!i){for(const[e,t]of Object.entries(r))u.setAttribute(e,t);u.src=t,u.async=!0,u.setAttribute(D,""),e.head.appendChild(u)}return c}(t,e,function(e){return"number"==typeof e&&e>0?e:1e4}(n.timeout),null!=(o=n.attributes)?o:{},i)}const c=()=>{const e=t();return null==e?Promise.reject(new m("Vendor not ready: its global is missing",{code:"vendor-not-ready"})):Promise.resolve(e)};return{ready:()=>s?"failed"===s.state?Promise.reject(W()):"loaded"===s.state||s.expired?c():new Promise((e,t)=>{s.waiting.push(n=>{var r;"failed"===n?t(W()):"expired"===n?t((r=s.timeout,new m(`Vendor script did not load within ${r}ms`,{code:"vendor-timeout"}))):c().then(e,t)})}):c(),check(){if("failed"===(null==s?void 0:s.state))throw W()}}}var T={};function V(e,t){return k(e.loadScript?"https://tag.aticdn.net/piano-analytics.js":void 0,()=>function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.window)?void 0:t.pa)?n:"undefined"!=typeof window?window.pa:void 0}(t),{timeout:e.timeout,document:x(t).document})}var M=new WeakSet,L={type:"piano",config:{},init({config:e,env:t}){const{site:n,collectDomain:r}=e.settings||{},o=[void 0===n?"site":void 0,r?void 0:"collectDomain"].filter(e=>void 0!==e);if(o.length)throw new m(`Piano Analytics needs settings ${o.join(" and ")}`,{code:"config"});V(e,t)},async push(e,{config:t,data:n,env:r,rule:o}){const i=await V(t,r).ready(),s=t.settings;await async function(e,t,n){try{return await e()}catch(e){if(e instanceof m)throw e;throw new m(n,{code:t,cause:e})}}(async()=>{s&&!M.has(i)&&(await i.setConfigurations({site:s.site,collectDomain:s.collectDomain,...v(s.options)?s.options:{}}),M.add(i)),(null==o?void 0:o.silent)||await i.sendEvent(e.name,v(n)?n:{})},"transport","Piano Analytics call failed")}};var N,B=L;return N=i,((o,i,s,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let u of n(i))r.call(o,u)||u===s||e(o,u,{get:()=>i[u],enumerable:!(c=t(i,u))||c.enumerable});return o})(e({},"__esModule",{value:!0}),N)})();
package/dist/index.es5.js CHANGED
@@ -1 +1 @@
1
- "use strict";function asyncGeneratorStep(n,t,e,r,o,i,u){try{var c=n[i](u),a=c.value}catch(n){return void e(n)}c.done?t(a):Promise.resolve(a).then(r,o)}function _async_to_generator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function u(n){asyncGeneratorStep(i,r,o,u,c,"next",n)}function c(n){asyncGeneratorStep(i,r,o,u,c,"throw",n)}u(void 0)})}}function _define_property(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function _object_spread(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(e).filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.forEach(function(t){_define_property(n,t,e[t])})}return n}function _type_of(n){return n&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n}function _ts_generator(n,t){var e,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:a(0)}),c(u,"throw",{value:a(1)}),c(u,"return",{value:a(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function a(c){return function(a){return function(c){if(e)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(e=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(n,i)}catch(n){c=[6,n],r=0}finally{e=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var Destination=function(){var n=function(n,t){if("collector"===n)return"collector";if(!t)throw new Error("stepId(".concat(n,") requires an id"));return"".concat(n,".").concat(t)},t=function(n,t){var e=n.destinations[t];if(!e)throw new Error("Destination not found: ".concat(t));return e},e=function(n,t){var e=n.transformers[t];if(!e)throw new Error("Transformer not found: ".concat(t));return e},r=function(n,t){var e=n.sources[t];if(!e)throw new Error("Source not found: ".concat(t));return e},o=function(n,t){var e=n.stores[t];if(!e)throw new Error("Store not found: ".concat(t));return e},i=function(n,t){return _async_to_generator(function(){return _ts_generator(this,function(e){switch(e.label){case 0:return[4,n.get(t)];case 1:return[2,e.sent()]}})})()},u=function(n){return void 0!==n},c=function(n){return"object"==(void 0===n?"undefined":_type_of(n))&&null!==n&&!function(n){return Array.isArray(n)}(n)&&"[object Object]"===Object.prototype.toString.call(n)},a=function(n){var t,e;return null!==(t=null===(e=n.window)||void 0===e?void 0:e.pa)&&void 0!==t?t:"undefined"!=typeof window?window.pa:void 0},f=Object.defineProperty,l=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,p=Object.prototype.hasOwnProperty,d={};!function(n,t){for(var e in t)f(n,e,{get:t[e],enumerable:!0})}(d,{DestinationPiano:function(){return h},default:function(){return O},destinationPiano:function(){return _}});var y=Object.defineProperty,v=function(n,t){for(var e in t)y(n,e,{get:t[e],enumerable:!0})};v({},{stepId:function(){return n}});v({},{getDestination:function(){return t}});v({},{Level:function(){return g}});var b,g=((b=g||{})[b.ERROR=0]="ERROR",b[b.WARN=1]="WARN",b[b.INFO=2]="INFO",b[b.DEBUG=3]="DEBUG",b);v({},{getTransformer:function(){return e}});v({},{getSource:function(){return r}});v({},{getStore:function(){return o},getStoreValue:function(){return i}});var w,h={},m="https://tag.aticdn.net/piano-analytics.js",_={type:"piano",config:{},init:function(n){var t=n.config,e=n.env,r=n.logger,o=t.settings||{},i=function(){var n=a(e);n&&u(o.site)&&u(o.collectDomain)&&n.setConfigurations(_object_spread({site:o.site,collectDomain:o.collectDomain},c(o.options)?o.options:{}))};return t.loadScript?function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m,t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0;if("undefined"!=typeof document){var r=document.createElement("script");r.src=n,t&&(r.onload=function(){return t()}),e&&(r.onerror=function(){return e()}),document.head.appendChild(r)}}(m,i,function(){return r.warn("Piano Analytics script failed to load, destination not configured")}):i(),t},push:function(n,t){var e=t.data,r=t.env,o=a(r);o&&o.sendEvent(n.name,c(e)?e:{})}},O=_;return w=d,function(n,t,e,r){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,i=!1,u=void 0;try{for(var c,a=function(){var o=c.value;p.call(n,o)||o===e||f(n,o,{get:function(){return t[o]},enumerable:!(r=l(t,o))||r.enumerable})},d=s(t)[Symbol.iterator]();!(o=(c=d.next()).done);o=!0)a()}catch(n){i=!0,u=n}finally{try{o||null==d.return||d.return()}finally{if(i)throw u}}}return n}(f({},"__esModule",{value:!0}),w)}();
1
+ "use strict";function _array_like_to_array(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _array_with_holes(t){if(Array.isArray(t))return t}function _assert_this_initialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function asyncGeneratorStep(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function _async_to_generator(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){asyncGeneratorStep(i,n,o,u,a,"next",t)}function a(t){asyncGeneratorStep(i,n,o,u,a,"throw",t)}u(void 0)})}}function _call_super(t,e,r){return e=_get_prototype_of(e),_possible_constructor_return(t,_is_native_reflect_construct()?Reflect.construct(e,r||[],_get_prototype_of(t).constructor):e.apply(t,r))}function _class_call_check(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _construct(t,e,r){return _construct=_is_native_reflect_construct()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&_set_prototype_of(o,r.prototype),o},_construct.apply(null,arguments)}function _define_property(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _get_prototype_of(t){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},_get_prototype_of(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_set_prototype_of(t,e)}function _instanceof(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function _is_native_function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _iterable_to_array_limit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){_define_property(t,e,r[e])})}return t}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}function _possible_constructor_return(t,e){return!e||"object"!==_type_of(e)&&"function"!=typeof e?_assert_this_initialized(t):e}function _set_prototype_of(t,e){return _set_prototype_of=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},_set_prototype_of(t,e)}function _sliced_to_array(t,e){return _array_with_holes(t)||_iterable_to_array_limit(t,e)||_unsupported_iterable_to_array(t,e)||_non_iterable_rest()}function _type_of(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function _unsupported_iterable_to_array(t,e){if(t){if("string"==typeof t)return _array_like_to_array(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(t,e):void 0}}function _wrap_native_super(t){var e="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(t){if(null===t||!_is_native_function(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return _construct(t,arguments,_get_prototype_of(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(r,t)},_wrap_native_super(t)}function _is_native_reflect_construct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_is_native_reflect_construct=function(){return!!t})()}function _ts_generator(t,e){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(u,"next",{value:c(0)}),a(u,"throw",{value:c(1)}),a(u,"return",{value:c(2)}),"function"==typeof Symbol&&a(u,Symbol.iterator,{value:function(){return this}}),u;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var Destination=function(){var t=function(t,e){if("collector"===t)return"collector";if(!e)throw new Error("stepId(".concat(t,") requires an id"));return"".concat(t,".").concat(e)},e=function(t,e){var r=t.destinations[e];if(!r)throw new Error("Destination not found: ".concat(e));return r},r=function(t,e){var r=t.transformers[e];if(!r)throw new Error("Transformer not found: ".concat(e));return r},n=function(t,e){var r=t.sources[e];if(!r)throw new Error("Source not found: ".concat(e));return r},o=function(t,e){var r=t.stores[e];if(!r)throw new Error("Store not found: ".concat(e));return r},i=function(t,e){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent()]}})})()},u=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&"then"in t&&"function"==typeof t.then},a=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!function(t){return Array.isArray(t)}(t)&&"[object Object]"===Object.prototype.toString.call(t)},c=function(t,e,r){return _async_to_generator(function(){var n;return _ts_generator(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,t()];case 1:return[2,o.sent()];case 2:if(_instanceof(n=o.sent(),T))throw n;throw new T(r,{code:e,cause:n});case 3:return[2]}})})()},f=function(t){var e=(t.startsWith(M)?t.slice(5):t).split(".");return e.some(function(t){return""===t})?[]:e},l=function(t){return"function"==typeof t},s=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t},p=function(t,e){if(-1!==W.indexOf(e))return!1;for(var r=t;l(r);){if(Object.prototype.hasOwnProperty.call(r,e))return!0;var n=Object.getPrototypeOf(r);if(!l(n)||!l(Object.getPrototypeOf(n)))return!1;r=n}return!1},y=function(t,e){var r=Reflect.getOwnPropertyDescriptor(t,e);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},d=function(t,e){var r=t,n=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(n=(a=c.next()).done);n=!0){var f=a.value;if(l(r)){if(!p(r,f))return!0;if(!y(r,f))return!1}else if(u(r)){if(!(f in r))return!0}else if(!s(r)||!(f in r))return!1;r=Reflect.get(r,f)}}catch(t){o=!0,i=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return l(r)},_=function(t){var e=_object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},t),r=t&&t[I];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(t){if("object"!=(void 0===t?"undefined":_type_of(t))||null===t)return!1;if(!("paths"in t)||!("record"in t))return!1;var e=t.paths,r=t.record;return Array.isArray(e)&&e.every(function(t){return"string"==typeof t})&&"function"==typeof r}(r)){delete e[I];var n=function(t,e,r){var n=[],o=[],i=[],a=!0,c=!1,_=void 0;try{for(var v,b=e[Symbol.iterator]();!(a=(v=b.next()).done);a=!0){var h=v.value,g=f(h);if(0!==g.length){var w=g.join(".");i.push({rest:g,fn:w}),d(t,g)||o.push(w)}}}catch(t){c=!0,_=t}finally{try{a||null==b.return||b.return()}finally{if(c)throw _}}var m=new WeakMap,O=new WeakSet;function j(t,e){var o=!0,i=!1,u=void 0;try{for(var a,c=t[Symbol.iterator]();!(o=(a=c.next()).done);o=!0){var f=a.value;if(r)try{r(f,e)}catch(t){}else n.push({fn:f,args:e,ts:Date.now()})}}catch(t){i=!0,u=t}finally{try{o||null==c.return||c.return()}finally{if(i)throw u}}}function P(t,e){return 0===e.length||S(t)?t:u(t)&&!e.some(function(e){return e.rest[0]in t})?Promise.resolve(t).then(function(t){return P(t,e)}):l(t)?k(t,[],e):s(t)?E(t,e):t}function S(t){return(s(t)||l(t))&&O.has(t)}function R(t,e){var r=[],n=[],o=!0,i=!1,u=void 0;try{for(var a,c=t[Symbol.iterator]();!(o=(a=c.next()).done);o=!0){var f=a.value;f.rest[0]===e&&(1===f.rest.length?r.includes(f.fn)||r.push(f.fn):n.push({rest:f.rest.slice(1),fn:f.fn}))}}catch(t){i=!0,u=t}finally{try{o||null==c.return||c.return()}finally{if(i)throw u}}return{leafs:r,deeper:n}}function E(t,e){var r,n=e.map(function(t){return"".concat(t.fn,":").concat(t.rest.join("."))}).join("|"),o=null!==(r=m.get(t))&&void 0!==r?r:new Map;m.set(t,o);var i=o.get(n);if(i)return i;var u=x(t,e);return o.set(n,u),u}function x(t,e){return l(t)?A(t,e):e.some(function(e){return!y(t,e.rest[0])})?function(t,e){var r=Object.create(Object.getPrototypeOf(t)),n=D(t,e,function(){return o}),o=new Proxy(r,{get:function(t,e){return n.get(e)},set:function(e,r,n){return Reflect.set(t,r,n,t)},has:function(e,r){return Reflect.has(t,r)},ownKeys:function(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor:function(e,r){var n=Reflect.getOwnPropertyDescriptor(t,r);return n&&_object_spread_props(_object_spread({},n),{configurable:!0})},defineProperty:function(e,r,n){return Reflect.defineProperty(t,r,n)},deleteProperty:function(e,r){return Reflect.deleteProperty(t,r)}});return O.add(o),o}(t,e):A(t,e)}function A(t,e){var r=D(t,e,function(){return n}),n=new Proxy(t,{get:function(t,e){return"string"!=typeof e||y(t,e)?r.get(e):Reflect.get(t,e,t)},set:function(t,e,r){return Reflect.set(t,e,r,t)}});return O.add(n),n}function D(t,e,r){var n=new Map;return{get:function(o){var i=Reflect.get(t,o,t);if("string"!=typeof o)return i;if(!l(i)&&!s(i))return i;if(S(i))return i;var u=n.get(o);if(u&&u.value===i)return u.out;var a=R(e,o),c=a.leafs,f=a.deeper;if(!(c.length>0||f.length>0)&&(!l(i)||function(t){if(Array.isArray(t))return!0;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}(t)))return i;var p=i;return l(i)?p=k(i,c,f,{proxy:r(),target:t}):f.length>0&&(p=E(i,f)),n.set(o,{value:i,out:p}),p}}}function k(t,e,r,n){var o=function(){return r.filter(function(e){return!p(t,e.rest[0])})},i=new Map,u=new Proxy(t,{get:function(t,e){var n=Reflect.get(t,e,t);if("string"!=typeof e||!y(t,e))return n;if(!p(t,e))return n;var o=R(r,e),a=o.leafs,c=o.deeper;if(0===a.length&&0===c.length)return n;if(S(n))return n;var f=i.get(e);if(f&&f.value===n)return f.out;var d=n;return l(n)?d=k(n,a,c,{proxy:u,target:t}):s(n)&&c.length>0&&(d=E(n,c)),i.set(e,{value:n,out:d}),d},set:function(t,e,r){return Reflect.set(t,e,r,t)},apply:function(t,r,i){j(e,i);var u=!n||r!==n.proxy&&void 0!==r?r:n.target;return P(Reflect.apply(t,u,i),o())},construct:function(t,r,n){j(e,r);var i=Reflect.construct(t,r,n===u?t:n),a=P(i,o());return s(a)||l(a)?a:i}});return O.add(u),u}return{env:x(t,i),calls:n,unresolved:o}}(e,r.paths,r.record).env,o=new Set,i=!0,a=!1,c=void 0;try{for(var _,v=r.paths[Symbol.iterator]();!(i=(_=v.next()).done);i=!0){var b=_.value,h=f(b)[0];if(void 0!==h){var g=e[h];null!==g&&"object"==(void 0===g?"undefined":_type_of(g))&&o.add(h)}}}catch(t){a=!0,c=t}finally{try{i||null==v.return||v.return()}finally{if(a)throw c}}var w=Array.from(o,function(t){return[t,n[t]]}),m=!0,O=!1,j=void 0;try{for(var P,S=w[Symbol.iterator]();!(m=(P=S.next()).done);m=!0){var R=_sliced_to_array(P.value,2),E=R[0],x=R[1];e[E]=x}}catch(t){O=!0,j=t}finally{try{m||null==S.return||S.return()}finally{if(O)throw j}}}return e},v=function(t,e){var r,n,o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t){var u=null!=(r=i.document)?r:"undefined"!=typeof document?document:void 0;if(!u)throw new T("Vendor script ".concat(t," has no document to go into"),{code:"vendor-not-ready"});o=function(t,e,r,n,o){var i=function(t,e){var r=t.querySelectorAll("script[".concat(V,"]"));return Array.from(r).find(function(t){return t.getAttribute("src")===e})}(t,e),u=i&&B.get(i);if(u)return u;var a={state:"loading",expired:!1,timeout:r,waiting:[]};if(i&&o())return a.state="loaded",B.set(i,a),a;var c=null!=i?i:t.createElement("script"),f=function(t){var e=a.waiting;a.waiting=[],e.forEach(function(e){return e(t)})},l=setTimeout(function(){a.expired=!0,f("expired")},r);if(B.set(c,a),c.addEventListener("load",function(){clearTimeout(l),a.state="loaded",f("loaded")}),c.addEventListener("error",function(){clearTimeout(l),a.state="failed",f("failed")}),!i){var s=!0,p=!1,y=void 0;try{for(var d,_=Object.entries(n)[Symbol.iterator]();!(s=(d=_.next()).done);s=!0){var v=_sliced_to_array(d.value,2),b=v[0],h=v[1];c.setAttribute(b,h)}}catch(t){p=!0,y=t}finally{try{s||null==_.return||_.return()}finally{if(p)throw y}}c.src=e,c.async=!0,c.setAttribute(V,""),t.head.appendChild(c)}return a}(u,t,function(t){return"number"==typeof t&&t>0?t:1e4}(i.timeout),null!=(n=i.attributes)?n:{},function(){return null!=e()})}var a=function(){var t=e();return null==t?Promise.reject(new T("Vendor not ready: its global is missing",{code:"vendor-not-ready"})):Promise.resolve(t)};return{ready:function(){return o?"failed"===o.state?Promise.reject(G()):"loaded"===o.state||o.expired?a():new Promise(function(t,e){o.waiting.push(function(r){var n;"failed"===r?e(G()):"expired"===r?e((n=o.timeout,new T("Vendor script did not load within ".concat(n,"ms"),{code:"vendor-timeout"}))):a().then(t,e)})}):a()},check:function(){if("failed"===(null==o?void 0:o.state))throw G()}}},b=function(t,e){return v(t.loadScript?z:void 0,function(){return h(e)},{timeout:t.timeout,document:_(e).document})},h=function(t){var e,r;return null!==(e=null==t||null===(r=t.window)||void 0===r?void 0:r.pa)&&void 0!==e?e:"undefined"!=typeof window?window.pa:void 0},g=Object.defineProperty,w=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,O=Object.prototype.hasOwnProperty,j=function(t,e,r){return function(t,e,r){return e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r}(t,"symbol"!==(void 0===e?"undefined":_type_of(e))?e+"":e,r)},P={};!function(t,e){for(var r in e)g(t,r,{get:e[r],enumerable:!0})}(P,{DestinationPiano:function(){return K},default:function(){return C},destinationPiano:function(){return N}});var S=Object.defineProperty,R=function(t,e){for(var r in e)S(t,r,{get:e[r],enumerable:!0})};R({},{stepId:function(){return t}});R({},{getDestination:function(){return e}});R({},{Level:function(){return x}});var E,x=((E=x||{})[E.ERROR=0]="ERROR",E[E.WARN=1]="WARN",E[E.INFO=2]="INFO",E[E.DEBUG=3]="DEBUG",E);R({},{getTransformer:function(){return r}});R({},{getSource:function(){return n}});R({},{getStore:function(){return o},getStoreValue:function(){return i}});var A,D="\\$flow\\.(".concat("[a-zA-Z_][a-zA-Z0-9_-]*",")(?:\\.([a-zA-Z0-9_.]+))?"),k=(new RegExp("^".concat(D,"$")),new RegExp(D,"g"),["transport","timeout","breaker-open","blocked","queue-full","vendor-not-ready","vendor-timeout"]),T=function(t){function e(t,r){var n;return _class_call_check(this,e),n=_call_super(this,e,[t]),j(n,"code"),j(n,"status"),j(n,"retryable"),j(n,"body"),void 0!==r.cause&&function(t,e){Object.defineProperty(t,"cause",{value:e,writable:!0,configurable:!0})}(n,r.cause),n.name="StepError",n.code=r.code,void 0!==r.status&&(n.status=r.status),n.retryable=function(t){if(void 0!==t.retryable)return t.retryable;var e=t.status;if(void 0!==e){if(429===e||e>=500&&e<600)return!0;if(e>=400&&e<500)return!1}return k.includes(t.code)}(r),void 0!==r.body&&(n.body=r.body),Object.setPrototypeOf(n,(_instanceof(this,e)?this.constructor:void 0).prototype),n}return _inherits(e,t),e}(_wrap_native_super(Error)),I="observe",M="call:",W=["name","length","prototype","arguments","caller"],V="data-walkeros-vendor",B=new WeakMap,G=function(){return new T("Vendor script failed to load",{code:"vendor-not-loaded"})},K={},z="https://tag.aticdn.net/piano-analytics.js",L=new WeakSet,N={type:"piano",config:{},init:function(t){var e=t.config,r=t.env,n=e.settings||{},o=[void 0===n.site?"site":void 0,n.collectDomain?void 0:"collectDomain"].filter(function(t){return void 0!==t});if(o.length)throw new T("Piano Analytics needs settings ".concat(o.join(" and ")),{code:"config"});b(e,r)},push:function(t,e){return _async_to_generator(function(t,e){var r,n,o,i,u,f;return _ts_generator(this,function(l){switch(l.label){case 0:return r=e.config,n=e.data,o=e.env,i=e.rule,[4,b(r,o).ready()];case 1:return u=l.sent(),f=r.settings,[4,c(function(){return _async_to_generator(function(){return _ts_generator(this,function(e){switch(e.label){case 0:return!f||L.has(u)?[3,2]:[4,u.setConfigurations(_object_spread({site:f.site,collectDomain:f.collectDomain},a(f.options)?f.options:{}))];case 1:e.sent(),L.add(u),e.label=2;case 2:return(null==i?void 0:i.silent)?[3,4]:[4,u.sendEvent(t.name,a(n)?n:{})];case 3:e.sent(),e.label=4;case 4:return[2]}})})()},"transport","Piano Analytics call failed")];case 2:return l.sent(),[2]}})}).apply(this,arguments)}},C=N;return A=P,function(t,e,r,n){if(e&&"object"===(void 0===e?"undefined":_type_of(e))||"function"==typeof e){var o=!0,i=!1,u=void 0;try{for(var a,c=function(){var o=a.value;O.call(t,o)||o===r||g(t,o,{get:function(){return e[o]},enumerable:!(n=w(e,o))||n.enumerable})},f=m(e)[Symbol.iterator]();!(o=(a=f.next()).done);o=!0)c()}catch(t){i=!0,u=t}finally{try{o||null==f.return||f.return()}finally{if(i)throw u}}}return t}(g({},"__esModule",{value:!0}),A)}();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,r={};((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})(r,{DestinationPiano:()=>c,default:()=>p,destinationPiano:()=>d}),module.exports=(e=r,((e,r,a,c)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let s of o(r))i.call(e,s)||s===a||t(e,s,{get:()=>r[s],enumerable:!(c=n(r,s))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=require("@walkeros/core"),c={},s="https://tag.aticdn.net/piano-analytics.js",d={type:"piano",config:{},init({config:e,env:t,logger:n}){const o=e.settings||{},i=()=>{const e=l(t);e&&(0,a.isDefined)(o.site)&&(0,a.isDefined)(o.collectDomain)&&e.setConfigurations({site:o.site,collectDomain:o.collectDomain,...(0,a.isObject)(o.options)?o.options:{}})};return e.loadScript?function(e=s,t,n){if("undefined"==typeof document)return;const o=document.createElement("script");o.src=e,t&&(o.onload=()=>t());n&&(o.onerror=()=>n());document.head.appendChild(o)}(s,i,()=>n.warn("Piano Analytics script failed to load, destination not configured")):i(),e},push(e,{data:t,env:n}){const o=l(n);o&&o.sendEvent(e.name,(0,a.isObject)(t)?t:{})}};function l(e){var t,n;return null!=(n=null==(t=e.window)?void 0:t.pa)?n:"undefined"!=typeof window?window.pa:void 0}var p=d;//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={};((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})(a,{DestinationPiano:()=>l,default:()=>p,destinationPiano:()=>u}),module.exports=(e=a,((e,a,r,s)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let l of o(a))i.call(e,l)||l===r||t(e,l,{get:()=>a[l],enumerable:!(s=n(a,l))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r=require("@walkeros/core"),s=require("@walkeros/web-core"),l={};function c(e,t){return(0,s.loadVendor)(e.loadScript?"https://tag.aticdn.net/piano-analytics.js":void 0,()=>function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.window)?void 0:t.pa)?n:"undefined"!=typeof window?window.pa:void 0}(t),{timeout:e.timeout,document:(0,s.getEnv)(t).document})}var d=new WeakSet,u={type:"piano",config:{},init({config:e,env:t}){const{site:n,collectDomain:o}=e.settings||{},i=[void 0===n?"site":void 0,o?void 0:"collectDomain"].filter(e=>void 0!==e);if(i.length)throw new r.StepError(`Piano Analytics needs settings ${i.join(" and ")}`,{code:"config"});c(e,t)},async push(e,{config:t,data:n,env:o,rule:i}){const a=await c(t,o).ready(),s=t.settings;await(0,r.stepCall)(async()=>{s&&!d.has(a)&&(await a.setConfigurations({site:s.site,collectDomain:s.collectDomain,...(0,r.isObject)(s.options)?s.options:{}}),d.add(a)),(null==i?void 0:i.silent)||await a.sendEvent(e.name,(0,r.isObject)(n)?n:{})},"transport","Piano Analytics call failed")}};var p=u;//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Env, Destination, PianoAnalytics } from './types';\nimport { isDefined, isObject } from '@walkeros/core';\n\n// Types\nexport * as DestinationPiano from './types';\n\nconst SCRIPT_SRC = 'https://tag.aticdn.net/piano-analytics.js';\n\nexport const destinationPiano: Destination = {\n type: 'piano',\n\n config: {},\n\n init({ config, env, logger }) {\n const settings = config.settings || {};\n\n const configure = () => {\n const pa = resolvePa(env);\n if (pa && isDefined(settings.site) && isDefined(settings.collectDomain)) {\n pa.setConfigurations({\n site: settings.site,\n collectDomain: settings.collectDomain,\n ...(isObject(settings.options) ? settings.options : {}),\n });\n }\n };\n\n // When we inject the SDK it loads asynchronously, so `window.pa` is not\n // available in the same tick. Defer configuration until `onload` fires,\n // and warn if the script never loads (e.g. blocked or network failure) so\n // the destination does not silently send unconfigured events.\n if (config.loadScript) {\n addScript(SCRIPT_SRC, configure, () =>\n logger.warn(\n 'Piano Analytics script failed to load, destination not configured',\n ),\n );\n } else {\n configure();\n }\n\n return config;\n },\n\n push(event, { data, env }) {\n const pa = resolvePa(env);\n if (!pa) return;\n\n pa.sendEvent(event.name, isObject(data) ? data : {});\n },\n};\n\n/**\n * Resolve the Piano `pa` SDK without casts: prefer the injected env (tests,\n * simulation), fall back to the browser global declared on `Window`.\n */\nfunction resolvePa(env: Env): PianoAnalytics | undefined {\n return (\n env.window?.pa ?? (typeof window !== 'undefined' ? window.pa : undefined)\n );\n}\n\nfunction addScript(\n src = SCRIPT_SRC,\n onReady?: () => void,\n onError?: () => void,\n) {\n if (typeof document === 'undefined') return;\n const script = document.createElement('script');\n script.src = src;\n if (onReady) script.onload = () => onReady();\n if (onError) script.onerror = () => onError();\n document.head.appendChild(script);\n}\n\nexport default destinationPiano;\n","import type {\n Mapping as WalkerOSMapping,\n WalkerOS,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n pa?: PianoAnalytics;\n }\n}\n\n/**\n * Surface of the official Piano Analytics browser SDK (the `pa` global from\n * https://tag.aticdn.net/piano-analytics.js). Only the methods this\n * destination calls are declared; the SDK exposes more.\n */\nexport interface PianoAnalytics {\n setConfigurations(configurations: WalkerOS.AnyObject): void;\n sendEvent(name: string, data?: WalkerOS.AnyObject): void;\n sendEvents(\n events: ReadonlyArray<{ name: string; data?: WalkerOS.AnyObject }>,\n ): void;\n}\n\nexport interface Settings {\n /** Piano Analytics site id (numeric), from your collection settings. */\n site: number;\n /** Collection domain endpoint, like https://xxxxxxx.pa-cd.com */\n collectDomain: string;\n /** Additional Piano `setConfigurations` options merged on init. */\n options?: WalkerOS.AnyObject;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n window?: {\n pa?: PianoAnalytics;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface PianoDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAoC;;;ACDpC;;;ADMA,IAAM,aAAa;AAEZ,IAAM,mBAAgC;AAAA,EAC3C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG;AAC5B,UAAM,WAAW,OAAO,YAAY,CAAC;AAErC,UAAM,YAAY,MAAM;AACtB,YAAM,KAAK,UAAU,GAAG;AACxB,UAAI,UAAM,uBAAU,SAAS,IAAI,SAAK,uBAAU,SAAS,aAAa,GAAG;AACvE,WAAG,kBAAkB;AAAA,UACnB,MAAM,SAAS;AAAA,UACf,eAAe,SAAS;AAAA,UACxB,OAAI,sBAAS,SAAS,OAAO,IAAI,SAAS,UAAU,CAAC;AAAA,QACvD,CAAC;AAAA,MACH;AAAA,IACF;AAMA,QAAI,OAAO,YAAY;AACrB;AAAA,QAAU;AAAA,QAAY;AAAA,QAAW,MAC/B,OAAO;AAAA,UACL;AAAA,QACF;AAAA,MACF;AAAA,IACF,OAAO;AACL,gBAAU;AAAA,IACZ;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,KAAK,OAAO,EAAE,MAAM,IAAI,GAAG;AACzB,UAAM,KAAK,UAAU,GAAG;AACxB,QAAI,CAAC,GAAI;AAET,OAAG,UAAU,MAAM,UAAM,sBAAS,IAAI,IAAI,OAAO,CAAC,CAAC;AAAA,EACrD;AACF;AAMA,SAAS,UAAU,KAAsC;AAxDzD;AAyDE,UACE,eAAI,WAAJ,mBAAY,OAAZ,YAAmB,OAAO,WAAW,cAAc,OAAO,KAAK;AAEnE;AAEA,SAAS,UACP,MAAM,YACN,SACA,SACA;AACA,MAAI,OAAO,aAAa,YAAa;AACrC,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,MAAM;AACb,MAAI,QAAS,QAAO,SAAS,MAAM,QAAQ;AAC3C,MAAI,QAAS,QAAO,UAAU,MAAM,QAAQ;AAC5C,WAAS,KAAK,YAAY,MAAM;AAClC;AAEA,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Config, Env, Destination, PianoAnalytics } from './types';\nimport { isObject, StepError, stepCall } from '@walkeros/core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPiano from './types';\n\nconst SCRIPT_SRC = 'https://tag.aticdn.net/piano-analytics.js';\n\n/**\n * The Piano SDK. It has no stub that replays calls, so a push waits for the\n * script `loadVendor` injected (`loadScript`), or finds `pa` on the page.\n */\nfunction vendor(config: Config, env?: Env) {\n return loadVendor(\n config.loadScript ? SCRIPT_SRC : undefined,\n () => resolvePa(env),\n { timeout: config.timeout, document: getEnv(env).document },\n );\n}\n\n// SDK instances already configured, so setConfigurations runs once each.\nconst configured = new WeakSet<PianoAnalytics>();\n\nexport const destinationPiano: Destination = {\n type: 'piano',\n\n config: {},\n\n init({ config, env }) {\n const { site, collectDomain } = config.settings || {};\n const missing = [\n site === undefined ? 'site' : undefined,\n !collectDomain ? 'collectDomain' : undefined,\n ].filter((key) => key !== undefined);\n if (missing.length)\n throw new StepError(\n `Piano Analytics needs settings ${missing.join(' and ')}`,\n { code: 'config' },\n );\n\n vendor(config, env);\n },\n\n async push(event, { config, data, env, rule }) {\n const pa = await vendor(config, env).ready();\n const settings = config.settings;\n\n await stepCall(\n async () => {\n if (settings && !configured.has(pa)) {\n await pa.setConfigurations({\n site: settings.site,\n collectDomain: settings.collectDomain,\n ...(isObject(settings.options) ? settings.options : {}),\n });\n configured.add(pa);\n }\n\n if (!rule?.silent)\n await pa.sendEvent(event.name, isObject(data) ? data : {});\n },\n 'transport',\n 'Piano Analytics call failed',\n );\n },\n};\n\n/**\n * Resolve the Piano `pa` SDK without casts: prefer the injected env (tests,\n * simulation), fall back to the browser global declared on `Window`.\n */\nfunction resolvePa(env?: Env): PianoAnalytics | undefined {\n return (\n env?.window?.pa ?? (typeof window !== 'undefined' ? window.pa : undefined)\n );\n}\n\nexport default destinationPiano;\n","import type {\n Mapping as WalkerOSMapping,\n WalkerOS,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n pa?: PianoAnalytics;\n }\n}\n\n/**\n * Surface of the official Piano Analytics browser SDK (the `pa` global from\n * https://tag.aticdn.net/piano-analytics.js). Only the methods this\n * destination calls are declared; the SDK exposes more.\n */\nexport interface PianoAnalytics {\n setConfigurations(configurations: WalkerOS.AnyObject): void;\n sendEvent(name: string, data?: WalkerOS.AnyObject): void;\n sendEvents(\n events: ReadonlyArray<{ name: string; data?: WalkerOS.AnyObject }>,\n ): void;\n}\n\nexport interface Settings {\n /** Piano Analytics site id (numeric), from your collection settings. */\n site: number;\n /** Collection domain endpoint, like https://xxxxxxx.pa-cd.com */\n collectDomain: string;\n /** Additional Piano `setConfigurations` options merged on init. */\n options?: WalkerOS.AnyObject;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n window?: {\n pa?: PianoAnalytics;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface PianoDestination extends Destination {\n env?: Env;\n}\n\nex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,CAAC;AAAA,UACvD,CAAC;AACD,qBAAW,IAAI,EAAE;AAAA,QACnB;AAEA,YAAI,EAAC,6BAAM;AACT,gBAAM,GAAG,UAAU,MAAM,UAAM,sBAAS,IAAI,IAAI,OAAO,CAAC,CAAC;AAAA,MAC7D;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAMA,SAAS,UAAU,KAAuC;AAxE1D;AAyEE,UACE,sCAAK,WAAL,mBAAa,OAAb,YAAoB,OAAO,WAAW,cAAc,OAAO,KAAK;AAEpE;AAEA,IAAO,gBAAQ;","names":[]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{isDefined as n,isObject as o}from"@walkeros/core";var t={},e="https://tag.aticdn.net/piano-analytics.js",i={type:"piano",config:{},init({config:t,env:i,logger:c}){const s=t.settings||{},r=()=>{const t=a(i);t&&n(s.site)&&n(s.collectDomain)&&t.setConfigurations({site:s.site,collectDomain:s.collectDomain,...o(s.options)?s.options:{}})};return t.loadScript?function(n=e,o,t){if("undefined"==typeof document)return;const i=document.createElement("script");i.src=n,o&&(i.onload=()=>o());t&&(i.onerror=()=>t());document.head.appendChild(i)}(e,r,()=>c.warn("Piano Analytics script failed to load, destination not configured")):r(),t},push(n,{data:t,env:e}){const i=a(e);i&&i.sendEvent(n.name,o(t)?t:{})}};function a(n){var o,t;return null!=(t=null==(o=n.window)?void 0:o.pa)?t:"undefined"!=typeof window?window.pa:void 0}var c=i;export{t as DestinationPiano,c as default,i as destinationPiano};//# sourceMappingURL=index.mjs.map
1
+ import{isObject as n,StepError as i,stepCall as t}from"@walkeros/core";import{getEnv as o,loadVendor as a}from"@walkeros/web-core";var e={};function s(n,i){return a(n.loadScript?"https://tag.aticdn.net/piano-analytics.js":void 0,()=>function(n){var i,t;return null!=(t=null==(i=null==n?void 0:n.window)?void 0:i.pa)?t:"undefined"!=typeof window?window.pa:void 0}(i),{timeout:n.timeout,document:o(i).document})}var l=new WeakSet,c={type:"piano",config:{},init({config:n,env:t}){const{site:o,collectDomain:a}=n.settings||{},e=[void 0===o?"site":void 0,a?void 0:"collectDomain"].filter(n=>void 0!==n);if(e.length)throw new i(`Piano Analytics needs settings ${e.join(" and ")}`,{code:"config"});s(n,t)},async push(i,{config:o,data:a,env:e,rule:c}){const d=await s(o,e).ready(),r=o.settings;await t(async()=>{r&&!l.has(d)&&(await d.setConfigurations({site:r.site,collectDomain:r.collectDomain,...n(r.options)?r.options:{}}),l.add(d)),(null==c?void 0:c.silent)||await d.sendEvent(i.name,n(a)?a:{})},"transport","Piano Analytics call failed")}};var d=c;export{e as DestinationPiano,d as default,c as destinationPiano};//# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Env, Destination, PianoAnalytics } from './types';\nimport { isDefined, isObject } from '@walkeros/core';\n\n// Types\nexport * as DestinationPiano from './types';\n\nconst SCRIPT_SRC = 'https://tag.aticdn.net/piano-analytics.js';\n\nexport const destinationPiano: Destination = {\n type: 'piano',\n\n config: {},\n\n init({ config, env, logger }) {\n const settings = config.settings || {};\n\n const configure = () => {\n const pa = resolvePa(env);\n if (pa && isDefined(settings.site) && isDefined(settings.collectDomain)) {\n pa.setConfigurations({\n site: settings.site,\n collectDomain: settings.collectDomain,\n ...(isObject(settings.options) ? settings.options : {}),\n });\n }\n };\n\n // When we inject the SDK it loads asynchronously, so `window.pa` is not\n // available in the same tick. Defer configuration until `onload` fires,\n // and warn if the script never loads (e.g. blocked or network failure) so\n // the destination does not silently send unconfigured events.\n if (config.loadScript) {\n addScript(SCRIPT_SRC, configure, () =>\n logger.warn(\n 'Piano Analytics script failed to load, destination not configured',\n ),\n );\n } else {\n configure();\n }\n\n return config;\n },\n\n push(event, { data, env }) {\n const pa = resolvePa(env);\n if (!pa) return;\n\n pa.sendEvent(event.name, isObject(data) ? data : {});\n },\n};\n\n/**\n * Resolve the Piano `pa` SDK without casts: prefer the injected env (tests,\n * simulation), fall back to the browser global declared on `Window`.\n */\nfunction resolvePa(env: Env): PianoAnalytics | undefined {\n return (\n env.window?.pa ?? (typeof window !== 'undefined' ? window.pa : undefined)\n );\n}\n\nfunction addScript(\n src = SCRIPT_SRC,\n onReady?: () => void,\n onError?: () => void,\n) {\n if (typeof document === 'undefined') return;\n const script = document.createElement('script');\n script.src = src;\n if (onReady) script.onload = () => onReady();\n if (onError) script.onerror = () => onError();\n document.head.appendChild(script);\n}\n\nexport default destinationPiano;\n","import type {\n Mapping as WalkerOSMapping,\n WalkerOS,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n pa?: PianoAnalytics;\n }\n}\n\n/**\n * Surface of the official Piano Analytics browser SDK (the `pa` global from\n * https://tag.aticdn.net/piano-analytics.js). Only the methods this\n * destination calls are declared; the SDK exposes more.\n */\nexport interface PianoAnalytics {\n setConfigurations(configurations: WalkerOS.AnyObject): void;\n sendEvent(name: string, data?: WalkerOS.AnyObject): void;\n sendEvents(\n events: ReadonlyArray<{ name: string; data?: WalkerOS.AnyObject }>,\n ): void;\n}\n\nexport interface Settings {\n /** Piano Analytics site id (numeric), from your collection settings. */\n site: number;\n /** Collection domain endpoint, like https://xxxxxxx.pa-cd.com */\n collectDomain: string;\n /** Additional Piano `setConfigurations` options merged on init. */\n options?: WalkerOS.AnyObject;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n window?: {\n pa?: PianoAnalytics;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface PianoDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";AACA,SAAS,WAAW,gBAAgB;;;ACDpC;;;ADMA,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../src/types/index.ts"],"sourcesContent":["import type { Config, Env, Destination, PianoAnalytics } from './types';\nimport { isObject, StepError, stepCall } from '@walkeros/core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPiano from './types';\n\nconst SCRIPT_SRC = 'https://tag.aticdn.net/piano-analytics.js';\n\n/**\n * The Piano SDK. It has no stub that replays calls, so a push waits for the\n * script `loadVendor` injected (`loadScript`), or finds `pa` on the page.\n */\nfunction vendor(config: Config, env?: Env) {\n return loadVendor(\n config.loadScript ? SCRIPT_SRC : undefined,\n () => resolvePa(env),\n { timeout: config.timeout, document: getEnv(env).document },\n );\n}\n\n// SDK instances already configured, so setConfigurations runs once each.\nconst configured = new WeakSet<PianoAnalytics>();\n\nexport const destinationPiano: Destination = {\n type: 'piano',\n\n config: {},\n\n init({ config, env }) {\n const { site, collectDomain } = config.settings || {};\n const missing = [\n site === undefined ? 'site' : undefined,\n !collectDomain ? 'collectDomain' : undefined,\n ].filter((key) => key !== undefined);\n if (missing.length)\n throw new StepError(\n `Piano Analytics needs settings ${missing.join(' and ')}`,\n { code: 'config' },\n );\n\n vendor(config, env);\n },\n\n async push(event, { config, data, env, rule }) {\n const pa = await vendor(config, env).ready();\n const settings = config.settings;\n\n await stepCall(\n async () => {\n if (settings && !configured.has(pa)) {\n await pa.setConfigurations({\n site: settings.site,\n collectDomain: settings.collectDomain,\n ...(isObject(settings.options) ? settings.options : {}),\n });\n configured.add(pa);\n }\n\n if (!rule?.silent)\n await pa.sendEvent(event.name, isObject(data) ? data : {});\n },\n 'transport',\n 'Piano Analytics call failed',\n );\n },\n};\n\n/**\n * Resolve the Piano `pa` SDK without casts: prefer the injected env (tests,\n * simulation), fall back to the browser global declared on `Window`.\n */\nfunction resolvePa(env?: Env): PianoAnalytics | undefined {\n return (\n env?.window?.pa ?? (typeof window !== 'undefined' ? window.pa : undefined)\n );\n}\n\nexport default destinationPiano;\n","import type {\n Mapping as WalkerOSMapping,\n WalkerOS,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n pa?: PianoAnalytics;\n }\n}\n\n/**\n * Surface of the official Piano Analytics browser SDK (the `pa` global from\n * https://tag.aticdn.net/piano-analytics.js). Only the methods this\n * destination calls are declared; the SDK exposes more.\n */\nexport interface PianoAnalytics {\n setConfigurations(configurations: WalkerOS.AnyObject): void;\n sendEvent(name: string, data?: WalkerOS.AnyObject): void;\n sendEvents(\n events: ReadonlyArray<{ name: string; data?: WalkerOS.AnyObject }>,\n ): void;\n}\n\nexport interface Settings {\n /** Piano Analytics site id (numeric), from your collection settings. */\n site: number;\n /** Collection domain endpoint, like https://xxxxxxx.pa-cd.com */\n collectDomain: string;\n /** Additional Piano `setConfigurations` options merged on init. */\n options?: WalkerOS.AnyObject;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {}\n\nexport interface Env extends DestinationWeb.Env {\n window?: {\n pa?: PianoAnalytics;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface PianoDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";AACA,SAAS,UAAU,WAAW,gBAAgB;AAC9C,SAAS,QAAQ,kBAAkB;;;ACFnC;;;ADOA,IAAM,aAAa;AAMnB,SAAS,OAAO,QAAgB,KAAW;AACzC,SAAO;AAAA,IACL,OAAO,aAAa,aAAa;AAAA,IACjC,MAAM,UAAU,GAAG;AAAA,IACnB,EAAE,SAAS,OAAO,SAAS,UAAU,OAAO,GAAG,EAAE,SAAS;AAAA,EAC5D;AACF;AAGA,IAAM,aAAa,oBAAI,QAAwB;AAExC,IAAM,mBAAgC;AAAA,EAC3C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,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platform": [
7
7
  "web"
@@ -70,6 +70,15 @@
70
70
  ]
71
71
  },
72
72
  "step": {
73
+ "consentRevoke": {
74
+ "public": false,
75
+ "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.",
76
+ "command": "consent",
77
+ "in": {
78
+ "analytics": false
79
+ },
80
+ "out": []
81
+ },
73
82
  "customEvent": {
74
83
  "title": "Custom event",
75
84
  "description": "A generic entity action fires a custom Piano event with mapped properties.",
@@ -113,7 +122,7 @@
113
122
  "consent": {
114
123
  "functional": true
115
124
  },
116
- "id": "1593264d70de9091",
125
+ "id": "a4d76856b028d464",
117
126
  "trigger": "test",
118
127
  "entity": "entity",
119
128
  "action": "action",
@@ -206,7 +215,7 @@
206
215
  "consent": {
207
216
  "functional": true
208
217
  },
209
- "id": "10a75d62f21b18d6",
218
+ "id": "f0cc5f6fec3d8eeb",
210
219
  "trigger": "load",
211
220
  "entity": "page",
212
221
  "action": "view",
@@ -249,7 +258,7 @@
249
258
  "currency": "EUR",
250
259
  "shipping": 5.22,
251
260
  "taxes": 73.76,
252
- "total": 555
261
+ "value": 555
253
262
  },
254
263
  "context": {
255
264
  "shopping": [
@@ -319,7 +328,7 @@
319
328
  "consent": {
320
329
  "functional": true
321
330
  },
322
- "id": "22de86ed009736c0",
331
+ "id": "235d0d7bd7a213f2",
323
332
  "trigger": "load",
324
333
  "entity": "order",
325
334
  "action": "complete",
@@ -337,7 +346,7 @@
337
346
  "data": {
338
347
  "map": {
339
348
  "transaction_id": "data.id",
340
- "revenue": "data.total",
349
+ "revenue": "data.value",
341
350
  "currency": "data.currency"
342
351
  }
343
352
  }
@@ -353,6 +362,65 @@
353
362
  }
354
363
  ]
355
364
  ]
365
+ },
366
+ "silentRule": {
367
+ "public": false,
368
+ "description": "A rule with silent: true sends no Piano event.",
369
+ "in": {
370
+ "name": "page view",
371
+ "data": {
372
+ "domain": "www.example.com",
373
+ "title": "walkerOS documentation",
374
+ "referrer": "https://www.walkeros.io/",
375
+ "search": "?foo=bar",
376
+ "hash": "#hash",
377
+ "id": "/docs/"
378
+ },
379
+ "context": {
380
+ "dev": [
381
+ "test",
382
+ 1
383
+ ]
384
+ },
385
+ "globals": {
386
+ "pagegroup": "docs"
387
+ },
388
+ "custom": {
389
+ "completely": "random"
390
+ },
391
+ "user": {
392
+ "id": "us3r",
393
+ "device": "c00k13",
394
+ "session": "s3ss10n"
395
+ },
396
+ "nested": [
397
+ {
398
+ "entity": "child",
399
+ "data": {
400
+ "is": "subordinated"
401
+ }
402
+ }
403
+ ],
404
+ "consent": {
405
+ "functional": true
406
+ },
407
+ "id": "f0cc5f6fec3d8eeb",
408
+ "trigger": "load",
409
+ "entity": "page",
410
+ "action": "view",
411
+ "timestamp": 1700000203,
412
+ "timing": 3.14,
413
+ "source": {
414
+ "count": 1,
415
+ "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
416
+ "type": "collector",
417
+ "schema": "4"
418
+ }
419
+ },
420
+ "mapping": {
421
+ "silent": true
422
+ },
423
+ "out": []
356
424
  }
357
425
  }
358
426
  }
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.1",
4
+ "version": "4.8.2",
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.1",
42
- "@walkeros/web-core": "4.8.1"
41
+ "@walkeros/core": "4.8.2",
42
+ "@walkeros/web-core": "4.8.2"
43
43
  },
44
44
  "devDependencies": {
45
- "@walkeros/collector": "4.8.1"
45
+ "@walkeros/collector": "4.8.2"
46
46
  },
47
47
  "repository": {
48
48
  "url": "git+https://github.com/elbwalker/walkerOS.git",