@walkeros/web-destination-snowplow 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,51 @@
1
1
  # @walkeros/web-destination-snowplow
2
2
 
3
+ ## 4.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7e5fc27: On a revocation, activity tracking and the link, form, button and
8
+ YouTube plugins switch off and come back on a grant. Error tracking and
9
+ FocalMeter have no off switch, so a revocation fails visibly
10
+ (`consent-not-applied`). With `settings.tracker`, URL plugins fail at `init`
11
+ with a `config` error.
12
+ - 2374f54: Validation rejects `skipOdp` (Optimizely) and `pageViewTracking`
13
+ (Snowplow): neither was read, so they had no effect. Snowplow's settings
14
+ schema now lists every setting the code reads, with `collectorUrl` required,
15
+ so a typo in a setting name now fails validation.
16
+ - 2374f54: A failed vendor call, a missing required setting (`config`) and an
17
+ event that cannot be sent (`missing-input`) are reported as failed pushes,
18
+ with the dead-letter queue and one ERROR line, instead of counting as
19
+ delivered. Rules with `silent: true` send no event. Settings schemas reject
20
+ unknown keys.
21
+ - b1d65e2: Web destinations that load a vendor script inject it through the
22
+ document of their `env`, so simulation and server-side rendering work without
23
+ a browser page. A page still gets the script in its own document by default,
24
+ and a missing document fails the push with `vendor-not-ready`.
25
+ - 7e5fc27: An event that no rule maps fails with `missing-input` in Snowplow;
26
+ add an `ignore: true` rule for events you do not send. Optimizely fails events
27
+ from visitors without the configured `userId` with `missing-input` instead of
28
+ dropping them.
29
+ - 2374f54: Vendor scripts load through walkerOS: a blocked or slow script fails
30
+ later events visibly (`vendor-not-loaded`, `vendor-timeout`) instead of losing
31
+ them. Pushes made while the script loads wait for it, and each script is
32
+ injected once per page.
33
+ - Updated dependencies [2374f54]
34
+ - Updated dependencies [7e5fc27]
35
+ - Updated dependencies [2374f54]
36
+ - Updated dependencies [964590a]
37
+ - Updated dependencies [4100ede]
38
+ - Updated dependencies [2374f54]
39
+ - Updated dependencies [2374f54]
40
+ - Updated dependencies [15eb7b2]
41
+ - Updated dependencies [33a2779]
42
+ - Updated dependencies [33a2779]
43
+ - Updated dependencies [b1d65e2]
44
+ - Updated dependencies [964590a]
45
+ - Updated dependencies [2374f54]
46
+ - @walkeros/core@4.8.2
47
+ - @walkeros/web-core@4.8.2
48
+
3
49
  ## 4.8.1
4
50
 
5
51
  ### Patch Changes
package/README.md CHANGED
@@ -32,7 +32,9 @@ npm install @walkeros/web-destination-snowplow
32
32
  "destinations": {
33
33
  "snowplow": {
34
34
  "package": "@walkeros/web-destination-snowplow",
35
- "config": {}
35
+ "config": {
36
+ "settings": { "collectorUrl": "https://collector.example.com" }
37
+ }
36
38
  }
37
39
  }
38
40
  }
@@ -40,6 +42,21 @@ npm install @walkeros/web-destination-snowplow
40
42
  }
41
43
  ```
42
44
 
45
+ ## Plugins
46
+
47
+ URL plugins in `settings.plugins` load with sp.js. With `settings.tracker` (your
48
+ own browser tracker), init fails with a `config` error if any are set: load them
49
+ on your own tracker, or drop `settings.tracker` so walkerOS loads them.
50
+
51
+ ## Consent
52
+
53
+ With `config.consent` set, a revocation of that consent stops walkerOS's events
54
+ and the senders that run on their own: activity pings (`activityTracking`) and
55
+ the sp.js plugins for link clicks, forms, buttons and YouTube. The next grant
56
+ starts them again. The error tracking and FocalMeter plugins have no off switch,
57
+ so a revocation fails with `consent-not-applied` while they keep sending: load
58
+ them only after consent. Other plugins are not switched.
59
+
43
60
  ## Documentation
44
61
 
45
62
  Full configuration, mapping, and examples live in the docs:
package/dist/dev.d.mts CHANGED
@@ -47,11 +47,12 @@ declare const ActivityTrackingSchema: z.ZodObject<{
47
47
  * Configuration settings schema for Snowplow destination
48
48
  */
49
49
  declare const SettingsSchema: z.ZodObject<{
50
- collectorUrl: z.ZodOptional<z.ZodString>;
50
+ collectorUrl: z.ZodString;
51
+ scriptUrl: z.ZodOptional<z.ZodString>;
52
+ tracker: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
51
53
  appId: z.ZodOptional<z.ZodString>;
52
54
  trackerName: z.ZodOptional<z.ZodString>;
53
55
  platform: z.ZodOptional<z.ZodString>;
54
- pageViewTracking: z.ZodOptional<z.ZodBoolean>;
55
56
  snowplow: z.ZodOptional<z.ZodObject<{
56
57
  actionSchema: z.ZodOptional<z.ZodString>;
57
58
  productSchema: z.ZodOptional<z.ZodString>;
@@ -92,7 +93,23 @@ declare const SettingsSchema: z.ZodObject<{
92
93
  heartbeatDelay: z.ZodNumber;
93
94
  }, z.core.$strip>>;
94
95
  globalContexts: z.ZodOptional<z.ZodArray<z.ZodAny>>;
95
- }, z.core.$strip>;
96
+ trackPageView: z.ZodOptional<z.ZodBoolean>;
97
+ pageViewEvent: z.ZodOptional<z.ZodString>;
98
+ userId: z.ZodOptional<z.ZodUnknown>;
99
+ page: z.ZodOptional<z.ZodObject<{
100
+ type: z.ZodUnknown;
101
+ language: z.ZodOptional<z.ZodUnknown>;
102
+ locale: z.ZodOptional<z.ZodUnknown>;
103
+ }, z.core.$strip>>;
104
+ consent: z.ZodOptional<z.ZodObject<{
105
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
106
+ basisForProcessing: z.ZodOptional<z.ZodString>;
107
+ consentUrl: z.ZodOptional<z.ZodString>;
108
+ consentVersion: z.ZodOptional<z.ZodString>;
109
+ domainsApplied: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ gdprApplies: z.ZodOptional<z.ZodBoolean>;
111
+ }, z.core.$strip>>;
112
+ }, z.core.$strict>;
96
113
  type Settings = z.infer<typeof SettingsSchema>;
97
114
  type SnowplowSettings = z.infer<typeof SnowplowSettingsSchema>;
98
115
  type TrackerContexts = z.infer<typeof TrackerContextsSchema>;
@@ -188,18 +205,28 @@ declare const pageView: Flow.StepExample;
188
205
  declare const checkoutStep: Flow.StepExample;
189
206
  declare const structuredEvent: Flow.StepExample;
190
207
  declare const contextLoop: Flow.StepExample;
208
+ /** A silent rule sends no Snowplow event. */
209
+ declare const silentRule: Flow.StepExample;
210
+ /**
211
+ * A revocation of the consent the destination requires turns off the
212
+ * tracker's own senders: with activityTracking set, the page pings stop.
213
+ * Without settings.consent there is no Enhanced Consent event.
214
+ */
215
+ declare const consentRevoke: Flow.StepExample;
191
216
 
192
217
  declare const step_addToCart: typeof addToCart;
193
218
  declare const step_checkoutStep: typeof checkoutStep;
219
+ declare const step_consentRevoke: typeof consentRevoke;
194
220
  declare const step_contextLoop: typeof contextLoop;
195
221
  declare const step_init: typeof init;
196
222
  declare const step_pageView: typeof pageView;
197
223
  declare const step_productView: typeof productView;
198
224
  declare const step_promoView: typeof promoView;
225
+ declare const step_silentRule: typeof silentRule;
199
226
  declare const step_structuredEvent: typeof structuredEvent;
200
227
  declare const step_transaction: typeof transaction;
201
228
  declare namespace step {
202
- export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_contextLoop as contextLoop, step_init as init, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_structuredEvent as structuredEvent, step_transaction as transaction };
229
+ export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_consentRevoke as consentRevoke, step_contextLoop as contextLoop, step_init as init, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_silentRule as silentRule, step_structuredEvent as structuredEvent, step_transaction as transaction };
203
230
  }
204
231
 
205
232
  declare const index_env: typeof env;
package/dist/dev.d.ts CHANGED
@@ -47,11 +47,12 @@ declare const ActivityTrackingSchema: z.ZodObject<{
47
47
  * Configuration settings schema for Snowplow destination
48
48
  */
49
49
  declare const SettingsSchema: z.ZodObject<{
50
- collectorUrl: z.ZodOptional<z.ZodString>;
50
+ collectorUrl: z.ZodString;
51
+ scriptUrl: z.ZodOptional<z.ZodString>;
52
+ tracker: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
51
53
  appId: z.ZodOptional<z.ZodString>;
52
54
  trackerName: z.ZodOptional<z.ZodString>;
53
55
  platform: z.ZodOptional<z.ZodString>;
54
- pageViewTracking: z.ZodOptional<z.ZodBoolean>;
55
56
  snowplow: z.ZodOptional<z.ZodObject<{
56
57
  actionSchema: z.ZodOptional<z.ZodString>;
57
58
  productSchema: z.ZodOptional<z.ZodString>;
@@ -92,7 +93,23 @@ declare const SettingsSchema: z.ZodObject<{
92
93
  heartbeatDelay: z.ZodNumber;
93
94
  }, z.core.$strip>>;
94
95
  globalContexts: z.ZodOptional<z.ZodArray<z.ZodAny>>;
95
- }, z.core.$strip>;
96
+ trackPageView: z.ZodOptional<z.ZodBoolean>;
97
+ pageViewEvent: z.ZodOptional<z.ZodString>;
98
+ userId: z.ZodOptional<z.ZodUnknown>;
99
+ page: z.ZodOptional<z.ZodObject<{
100
+ type: z.ZodUnknown;
101
+ language: z.ZodOptional<z.ZodUnknown>;
102
+ locale: z.ZodOptional<z.ZodUnknown>;
103
+ }, z.core.$strip>>;
104
+ consent: z.ZodOptional<z.ZodObject<{
105
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
106
+ basisForProcessing: z.ZodOptional<z.ZodString>;
107
+ consentUrl: z.ZodOptional<z.ZodString>;
108
+ consentVersion: z.ZodOptional<z.ZodString>;
109
+ domainsApplied: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ gdprApplies: z.ZodOptional<z.ZodBoolean>;
111
+ }, z.core.$strip>>;
112
+ }, z.core.$strict>;
96
113
  type Settings = z.infer<typeof SettingsSchema>;
97
114
  type SnowplowSettings = z.infer<typeof SnowplowSettingsSchema>;
98
115
  type TrackerContexts = z.infer<typeof TrackerContextsSchema>;
@@ -188,18 +205,28 @@ declare const pageView: Flow.StepExample;
188
205
  declare const checkoutStep: Flow.StepExample;
189
206
  declare const structuredEvent: Flow.StepExample;
190
207
  declare const contextLoop: Flow.StepExample;
208
+ /** A silent rule sends no Snowplow event. */
209
+ declare const silentRule: Flow.StepExample;
210
+ /**
211
+ * A revocation of the consent the destination requires turns off the
212
+ * tracker's own senders: with activityTracking set, the page pings stop.
213
+ * Without settings.consent there is no Enhanced Consent event.
214
+ */
215
+ declare const consentRevoke: Flow.StepExample;
191
216
 
192
217
  declare const step_addToCart: typeof addToCart;
193
218
  declare const step_checkoutStep: typeof checkoutStep;
219
+ declare const step_consentRevoke: typeof consentRevoke;
194
220
  declare const step_contextLoop: typeof contextLoop;
195
221
  declare const step_init: typeof init;
196
222
  declare const step_pageView: typeof pageView;
197
223
  declare const step_productView: typeof productView;
198
224
  declare const step_promoView: typeof promoView;
225
+ declare const step_silentRule: typeof silentRule;
199
226
  declare const step_structuredEvent: typeof structuredEvent;
200
227
  declare const step_transaction: typeof transaction;
201
228
  declare namespace step {
202
- export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_contextLoop as contextLoop, step_init as init, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_structuredEvent as structuredEvent, step_transaction as transaction };
229
+ export { step_addToCart as addToCart, step_checkoutStep as checkoutStep, step_consentRevoke as consentRevoke, step_contextLoop as contextLoop, step_init as init, step_pageView as pageView, step_productView as productView, step_promoView as promoView, step_silentRule as silentRule, step_structuredEvent as structuredEvent, step_transaction as transaction };
203
230
  }
204
231
 
205
232
  declare const index_env: typeof env;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,c=(e,o)=>{for(var a in o)t(e,a,{get:o[a],enumerable:!0})},i={};c(i,{examples:()=>_,schemas:()=>s}),module.exports=(e=i,((e,c,i,s)=>{if(c&&"object"==typeof c||"function"==typeof c)for(let r of a(c))n.call(e,r)||r===i||t(e,r,{get:()=>c[r],enumerable:!(s=o(c,r))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};c(s,{ActivityTrackingSchema:()=>g,MappingSchema:()=>z,SettingsSchema:()=>h,TrackerContextsSchema:()=>m,UrlBasedPluginSchema:()=>u,mapping:()=>k,settings:()=>S});var r=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),l=p.z.object({actionSchema:p.z.string().optional().describe("Ecommerce action schema URI"),productSchema:p.z.string().optional().describe("Product entity schema URI"),cartSchema:p.z.string().optional().describe("Cart entity schema URI"),transactionSchema:p.z.string().optional().describe("Transaction entity schema URI"),refundSchema:p.z.string().optional().describe("Refund entity schema URI"),checkoutStepSchema:p.z.string().optional().describe("Checkout step entity schema URI"),promotionSchema:p.z.string().optional().describe("Promotion entity schema URI"),userSchema:p.z.string().optional().describe("User entity schema URI"),customSchemas:p.z.record(p.z.string(),p.z.string()).optional().describe("Custom entity schemas"),currency:p.z.string().optional().describe("Default currency code (ISO 4217)")}),m=p.z.object({webPage:p.z.boolean().optional().describe("Web page context"),session:p.z.boolean().optional().describe("Client session context - enables client_session schema"),performanceTiming:p.z.boolean().optional().describe("Performance timing context"),geolocation:p.z.boolean().optional().describe("Geolocation context")}),d=p.z.object({withServerAnonymisation:p.z.boolean().optional().describe("Request server-side anonymisation"),withSessionTracking:p.z.boolean().optional().describe("Continue session tracking in anonymous mode")}),w=p.z.union([p.z.boolean(),d]),u=p.z.object({url:p.z.string().describe("Plugin script URL"),name:p.z.tuple([p.z.string(),p.z.string()]).describe("[globalName, constructorName]"),enableMethod:p.z.string().optional().describe("Override enable method name"),options:p.z.record(p.z.string(),p.z.unknown()).optional().describe("Options for enable method")}),g=p.z.object({minimumVisitLength:p.z.number().describe("Seconds before first ping"),heartbeatDelay:p.z.number().describe("Seconds between pings")}),h=(p.z.object({schema:p.z.string().describe("Iglu schema URI"),data:p.z.record(p.z.string(),p.z.unknown()).describe("Context data")}),p.z.object({schema:p.z.string().describe("Iglu schema URI"),data:p.z.record(p.z.string(),p.z.unknown()).describe("walkerOS mapping"),__mapped:p.z.literal(!0)}),p.z.object({collectorUrl:p.z.string().optional().describe("Snowplow collector endpoint URL"),appId:p.z.string().optional().describe("Application identifier"),trackerName:p.z.string().optional().describe("Tracker instance name"),platform:p.z.string().optional().describe("Platform identifier"),pageViewTracking:p.z.boolean().optional().describe("Enable automatic page view tracking"),snowplow:l.optional().describe("Snowplow-specific ecommerce configuration"),discoverRootDomain:p.z.boolean().optional().describe("Discover root domain for cookies"),cookieSameSite:p.z.enum(["Strict","Lax","None"]).optional().describe("Cookie SameSite attribute"),appVersion:p.z.string().optional().describe("Application version"),contexts:m.optional().describe("Built-in context entities"),anonymousTracking:w.optional().describe("Enable anonymous tracking (no user identifiers)"),plugins:p.z.array(p.z.union([u,p.z.any()])).optional().describe("Snowplow plugins"),activityTracking:g.optional().describe("Page ping configuration"),globalContexts:p.z.array(p.z.any()).optional().describe("Global context entities")})),y=require("@walkeros/core/dev"),b=y.z.object({schema:y.z.string().describe("Iglu schema URI for this context entity"),data:y.z.record(y.z.string(),y.z.unknown()).describe("Data mapping for this context entity")}),v=y.z.object({actionSchema:y.z.string().optional().describe("Override action schema for this specific event")}),z=y.z.object({context:y.z.array(b).optional().describe("Context entities to attach to this event"),snowplow:v.optional().describe("Snowplow-specific settings override")}),S=(0,r.zodToSchema)(h),k=(0,r.zodToSchema)(z),_={};c(_,{env:()=>f,step:()=>U});var f={};c(f,{init:()=>j,push:()=>x,simulation:()=>E});var j={window:{},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},x={window:{snowplow:Object.assign(()=>{},{q:[]})},document:{createElement:()=>({src:"",async:!1,setAttribute:()=>{},removeAttribute:()=>{}}),head:{appendChild:()=>{}}}},E=["call:window.snowplow"],U={};c(U,{addToCart:()=>W,checkoutStep:()=>K,contextLoop:()=>X,init:()=>B,pageView:()=>J,productView:()=>G,promoView:()=>H,structuredEvent:()=>Q,transaction:()=>F});var R=require("@walkeros/core"),D="iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",I="iglu:com.snowplowanalytics.snowplow.ecommerce/cart/jsonschema/1-0-0",A="iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",P="iglu:com.snowplowanalytics.snowplow.ecommerce/checkout_step/jsonschema/1-0-0",C="iglu:com.snowplowanalytics.snowplow.ecommerce/promotion/jsonschema/1-0-0",T="iglu:com.snowplowanalytics.snowplow.ecommerce/page/jsonschema/1-0-0",O="iglu:com.snowplowanalytics.snowplow.ecommerce/user/jsonschema/1-0-0",V="product_view",q="add_to_cart",L="checkout_step",N="transaction",M="promo_view",B={title:"Initialization",description:"Destination bootstrap creates a Snowplow tracker pointed at the configured collector URL.",in:{loadScript:!0,settings:{collectorUrl:"https://collector.example.com",appId:"my-app",pageViewEvent:"page view"}},out:[["snowplow.newTracker","sp","https://collector.example.com",{appId:"my-app",platform:"web",discoverRootDomain:void 0,cookieSameSite:void 0,appVersion:void 0,contexts:void 0,anonymousTracking:void 0}]]},G={title:"Product view",description:"A product view fires a Snowplow ecommerce action with a product context schema and pricing fields.",in:(0,R.getEvent)("product view",{timestamp:1700000400}),mapping:{name:V,settings:{context:[{schema:D,data:{id:"data.id",name:"data.name",category:"data.category",price:"data.price",currency:{key:"data.currency",value:"USD"},brand:"data.brand",variant:"data.variant"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"product_view"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"ers",name:"Everyday Ruck Snack",price:420,currency:"USD"}}]}]]},W={title:"Add to cart",description:"A product add fires a Snowplow ecommerce add_to_cart action with product, cart, page, and user contexts.",in:(0,R.getEvent)("product add",{timestamp:1700000401}),mapping:{name:q,settings:{context:[{schema:D,data:{id:"data.id",name:"data.name",category:"data.category",price:"data.price",currency:{key:"data.currency",value:"USD"},quantity:{key:"data.quantity",value:1}}},{schema:I,data:{total_value:"globals.cart_value",currency:{key:"globals.cart_currency",value:"USD"}}},{schema:T,data:{type:"globals.page_type",language:"globals.language"}},{schema:O,data:{id:"user.id",email:"user.email",is_guest:{fn:e=>{var t;return!!(null==(t=e.user)?void 0:t.id)||void 0}}}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"add_to_cart"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"ers",name:"Everyday Ruck Snack",price:420,currency:"USD",quantity:1}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/cart/jsonschema/1-0-0",data:{currency:"USD"}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/page/jsonschema/1-0-0",data:{}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/user/jsonschema/1-0-0",data:{id:"us3r",is_guest:!0}}]}]]},F={title:"Transaction",description:"A completed order fires a Snowplow ecommerce transaction action with transaction id, revenue, tax, and shipping.",in:(0,R.getEvent)("order complete",{timestamp:1700000402}),mapping:{name:N,settings:{context:[{schema:A,data:{transaction_id:"data.id",revenue:"data.total",currency:{key:"data.currency",value:"USD"},payment_method:{value:"credit_card"},tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"transaction"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",data:{transaction_id:"0rd3r1d",revenue:555,currency:"EUR",payment_method:"credit_card",tax:73.76,shipping:5.22}}]}]]},H={title:"Promo view",description:"A promotion visible event fires a Snowplow promo_view action with a promotion context.",in:(0,R.getEvent)("promotion visible",{timestamp:1700000403}),mapping:{name:M,settings:{context:[{schema:C,data:{id:"data.id",name:"data.name",creative_id:"data.creative_id",type:"data.type",position:"data.position",slot:"data.slot"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"promo_view"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/promotion/jsonschema/1-0-0",data:{name:"Setting up tracking easily",position:"hero"}}]}]]},J={title:"Page view",description:"A page view calls Snowplow trackPageView directly instead of a self-describing event.",in:(0,R.getEvent)("page view",{timestamp:1700000404}),mapping:void 0,out:[["snowplow.trackPageView"]]},K={title:"Checkout step",description:"A checkout view fires a Snowplow checkout_step action with the current step and option.",in:(0,R.getEvent)("checkout view",{timestamp:1700000405}),mapping:{name:L,settings:{context:[{schema:P,data:{step:"data.step",option:"data.option"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"checkout_step"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/checkout_step/jsonschema/1-0-0",data:{step:"payment"}}]}]]},Q={title:"Struct event",description:"A custom event is tracked via Snowplow trackStructEvent with category, action, label, property, and value.",in:(0,R.getEvent)("product visible",{timestamp:1700000406}),mapping:{settings:{struct:{category:{value:"ecommerce"},action:{value:"impression"},label:"data.name",property:"data.color",value:"data.price"}}},out:[["snowplow.trackStructEvent",{category:"ecommerce",action:"impression",label:"Everyday Ruck Snack",property:"black",value:420}]]},X={title:"Transaction with products",description:"A transaction event adds one Snowplow product context per nested product via a loop mapping.",in:(0,R.getEvent)("order complete",{timestamp:1700000407}),mapping:{name:N,settings:{context:[{schema:A,data:{transaction_id:"data.id",revenue:"data.total",currency:"data.currency"}},{schema:D,data:{loop:["nested",{map:{id:"data.id",name:"data.name",price:"data.price"}}]}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"transaction"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",data:{transaction_id:"0rd3r1d",revenue:555,currency:"EUR"}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"ers",name:"Everyday Ruck Snack",price:420}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"cc",name:"Cool Cap",price:42}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{name:"Surprise"}}]}]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(e,o)=>{for(var a in o)t(e,a,{get:o[a],enumerable:!0})},c={};i(c,{examples:()=>f,schemas:()=>s}),module.exports=(e=c,((e,i,c,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let r of a(i))n.call(e,r)||r===c||t(e,r,{get:()=>i[r],enumerable:!(s=o(i,r))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};i(s,{ActivityTrackingSchema:()=>g,MappingSchema:()=>k,SettingsSchema:()=>h,TrackerContextsSchema:()=>m,UrlBasedPluginSchema:()=>u,mapping:()=>S,settings:()=>z});var r=require("@walkeros/core/dev"),p=require("@walkeros/core/dev"),l=p.z.object({actionSchema:p.z.string().optional().describe("Ecommerce action schema URI"),productSchema:p.z.string().optional().describe("Product entity schema URI"),cartSchema:p.z.string().optional().describe("Cart entity schema URI"),transactionSchema:p.z.string().optional().describe("Transaction entity schema URI"),refundSchema:p.z.string().optional().describe("Refund entity schema URI"),checkoutStepSchema:p.z.string().optional().describe("Checkout step entity schema URI"),promotionSchema:p.z.string().optional().describe("Promotion entity schema URI"),userSchema:p.z.string().optional().describe("User entity schema URI"),customSchemas:p.z.record(p.z.string(),p.z.string()).optional().describe("Custom entity schemas"),currency:p.z.string().optional().describe("Default currency code (ISO 4217)")}),m=p.z.object({webPage:p.z.boolean().optional().describe("Web page context"),session:p.z.boolean().optional().describe("Client session context - enables client_session schema"),performanceTiming:p.z.boolean().optional().describe("Performance timing context"),geolocation:p.z.boolean().optional().describe("Geolocation context")}),d=p.z.object({withServerAnonymisation:p.z.boolean().optional().describe("Request server-side anonymisation"),withSessionTracking:p.z.boolean().optional().describe("Continue session tracking in anonymous mode")}),w=p.z.union([p.z.boolean(),d]),u=p.z.object({url:p.z.string().describe("Plugin script URL"),name:p.z.tuple([p.z.string(),p.z.string()]).describe("[globalName, constructorName]"),enableMethod:p.z.string().optional().describe("Override enable method name"),options:p.z.record(p.z.string(),p.z.unknown()).optional().describe("Options for enable method")}),g=p.z.object({minimumVisitLength:p.z.number().describe("Seconds before first ping"),heartbeatDelay:p.z.number().describe("Seconds between pings")}),h=(p.z.object({schema:p.z.string().describe("Iglu schema URI"),data:p.z.record(p.z.string(),p.z.unknown()).describe("Context data")}),p.z.object({schema:p.z.string().describe("Iglu schema URI"),data:p.z.record(p.z.string(),p.z.unknown()).describe("walkerOS mapping"),__mapped:p.z.literal(!0)}),p.z.object({collectorUrl:p.z.string().describe("Snowplow collector endpoint URL"),scriptUrl:p.z.string().optional().describe("URL of the Snowplow JavaScript tracker script, used with loadScript. Defaults to the jsdelivr CDN with the @latest tag; pin a version in production."),tracker:p.z.record(p.z.string(),p.z.any()).optional().describe("Browser-tracker functions for bundled mode (newTracker, trackSelfDescribingEvent and the optional others), set with $code: references"),appId:p.z.string().optional().describe("Application identifier"),trackerName:p.z.string().optional().describe("Tracker instance name"),platform:p.z.string().optional().describe("Platform identifier"),snowplow:l.optional().describe("Snowplow-specific ecommerce configuration"),discoverRootDomain:p.z.boolean().optional().describe("Discover root domain for cookies"),cookieSameSite:p.z.enum(["Strict","Lax","None"]).optional().describe("Cookie SameSite attribute"),appVersion:p.z.string().optional().describe("Application version"),contexts:m.optional().describe("Built-in context entities"),anonymousTracking:w.optional().describe("Enable anonymous tracking (no user identifiers)"),plugins:p.z.array(p.z.union([u,p.z.any()])).optional().describe("Snowplow plugins"),activityTracking:g.optional().describe("Page ping configuration"),globalContexts:p.z.array(p.z.any()).optional().describe("Global context entities"),trackPageView:p.z.boolean().optional().describe("Call trackPageView once right after the tracker starts"),pageViewEvent:p.z.string().optional().describe("Event name that calls trackPageView instead of a self-describing event (like page view)"),userId:p.z.unknown().optional().describe("walkerOS mapping value resolving to the user id, set once on the first event where it resolves"),page:p.z.object({type:p.z.unknown().describe("Mapping value resolving to the page type"),language:p.z.unknown().optional().describe("Mapping value resolving to the page language"),locale:p.z.unknown().optional().describe("Mapping value resolving to the page locale")}).optional().describe("Page context for setPageType (ecommerce plugin)"),consent:p.z.object({required:p.z.array(p.z.string()).optional().describe("walkerOS consent groups to check"),basisForProcessing:p.z.string().optional().describe("Legal basis for processing under GDPR (default consent)"),consentUrl:p.z.string().optional().describe("URL of the privacy policy or consent document"),consentVersion:p.z.string().optional().describe("Version of the consent document"),domainsApplied:p.z.array(p.z.string()).optional().describe("Domains where this consent applies"),gdprApplies:p.z.boolean().optional().describe("Whether GDPR applies to this user")}).optional().describe("Consent event tracking through the Enhanced Consent plugin, used by the consent handler")}).strict()),b=require("@walkeros/core/dev"),v=b.z.object({schema:b.z.string().describe("Iglu schema URI for this context entity"),data:b.z.record(b.z.string(),b.z.unknown()).describe("Data mapping for this context entity")}),y=b.z.object({actionSchema:b.z.string().optional().describe("Override action schema for this specific event")}),k=b.z.object({context:b.z.array(v).optional().describe("Context entities to attach to this event"),snowplow:y.optional().describe("Snowplow-specific settings override")}),z=(0,r.zodToSchema)(h),S=(0,r.zodToSchema)(k),f={};i(f,{env:()=>_,step:()=>R});var _={};i(_,{init:()=>x,push:()=>E,simulation:()=>U});var j=require("@walkeros/web-core/dev"),x={window:{},document:(0,j.mockScriptDocument)()},E={window:{snowplow:Object.assign(()=>{},{q:[]})},document:(0,j.mockScriptDocument)()},U=["call:window.snowplow"],R={};i(R,{addToCart:()=>W,checkoutStep:()=>K,consentRevoke:()=>Z,contextLoop:()=>X,init:()=>B,pageView:()=>H,productView:()=>F,promoView:()=>$,silentRule:()=>Y,structuredEvent:()=>Q,transaction:()=>J});var D=require("@walkeros/core"),P="iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",I="iglu:com.snowplowanalytics.snowplow.ecommerce/cart/jsonschema/1-0-0",T="iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",A="iglu:com.snowplowanalytics.snowplow.ecommerce/checkout_step/jsonschema/1-0-0",C="iglu:com.snowplowanalytics.snowplow.ecommerce/promotion/jsonschema/1-0-0",O="iglu:com.snowplowanalytics.snowplow.ecommerce/page/jsonschema/1-0-0",V="iglu:com.snowplowanalytics.snowplow.ecommerce/user/jsonschema/1-0-0",q="product_view",L="add_to_cart",M="checkout_step",N="transaction",G="promo_view",B={title:"Initialization",description:"Destination bootstrap creates a Snowplow tracker pointed at the configured collector URL.",in:{loadScript:!0,settings:{collectorUrl:"https://collector.example.com",appId:"my-app",pageViewEvent:"page view"}},out:[["snowplow.newTracker","sp","https://collector.example.com",{appId:"my-app",platform:"web",discoverRootDomain:void 0,cookieSameSite:void 0,appVersion:void 0,contexts:void 0,anonymousTracking:void 0}]]},F={title:"Product view",description:"A product view fires a Snowplow ecommerce action with a product context schema and pricing fields.",in:(0,D.getEvent)("product view",{timestamp:1700000400}),mapping:{name:q,settings:{context:[{schema:P,data:{id:"data.id",name:"data.name",category:"data.category",price:"data.price",currency:{key:"data.currency",value:"USD"},brand:"data.brand",variant:"data.variant"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"product_view"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"ers",name:"Everyday Ruck Snack",price:420,currency:"USD"}}]}]]},W={title:"Add to cart",description:"A product add fires a Snowplow ecommerce add_to_cart action with product, cart, page, and user contexts.",in:(0,D.getEvent)("product add",{timestamp:1700000401}),mapping:{name:L,settings:{context:[{schema:P,data:{id:"data.id",name:"data.name",category:"data.category",price:"data.price",currency:{key:"data.currency",value:"USD"},quantity:{key:"data.quantity",value:1}}},{schema:I,data:{total_value:"globals.cart_value",currency:{key:"globals.cart_currency",value:"USD"}}},{schema:O,data:{type:"globals.page_type",language:"globals.language"}},{schema:V,data:{id:"user.id",email:"user.email",is_guest:{fn:e=>{var t;return!!(null==(t=e.user)?void 0:t.id)||void 0}}}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"add_to_cart"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"ers",name:"Everyday Ruck Snack",price:420,currency:"USD",quantity:1}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/cart/jsonschema/1-0-0",data:{currency:"USD"}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/page/jsonschema/1-0-0",data:{}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/user/jsonschema/1-0-0",data:{id:"us3r",is_guest:!0}}]}]]},J={title:"Transaction",description:"A completed order fires a Snowplow ecommerce transaction action with transaction id, revenue, tax, and shipping.",in:(0,D.getEvent)("order complete",{timestamp:1700000402}),mapping:{name:N,settings:{context:[{schema:T,data:{transaction_id:"data.id",revenue:"data.value",currency:{key:"data.currency",value:"USD"},payment_method:{value:"credit_card"},tax:"data.taxes",shipping:"data.shipping"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"transaction"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",data:{transaction_id:"0rd3r1d",revenue:555,currency:"EUR",payment_method:"credit_card",tax:73.76,shipping:5.22}}]}]]},$={title:"Promo view",description:"A promotion visible event fires a Snowplow promo_view action with a promotion context.",in:(0,D.getEvent)("promotion visible",{timestamp:1700000403}),mapping:{name:G,settings:{context:[{schema:C,data:{id:"data.id",name:"data.name",creative_id:"data.creative_id",type:"data.type",position:"data.position",slot:"data.slot"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"promo_view"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/promotion/jsonschema/1-0-0",data:{name:"Setting up tracking easily",position:"hero"}}]}]]},H={title:"Page view",description:"A page view calls Snowplow trackPageView directly instead of a self-describing event.",in:(0,D.getEvent)("page view",{timestamp:1700000404}),mapping:void 0,out:[["snowplow.trackPageView"]]},K={title:"Checkout step",description:"A checkout view fires a Snowplow checkout_step action with the current step and option.",in:(0,D.getEvent)("checkout view",{timestamp:1700000405}),mapping:{name:M,settings:{context:[{schema:A,data:{step:"data.step",option:"data.option"}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"checkout_step"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/checkout_step/jsonschema/1-0-0",data:{step:"payment"}}]}]]},Q={title:"Struct event",description:"A custom event is tracked via Snowplow trackStructEvent with category, action, label, property, and value.",in:(0,D.getEvent)("product visible",{timestamp:1700000406}),mapping:{settings:{struct:{category:{value:"ecommerce"},action:{value:"impression"},label:"data.name",property:"data.color",value:"data.price"}}},out:[["snowplow.trackStructEvent",{category:"ecommerce",action:"impression",label:"Everyday Ruck Snack",property:"black",value:420}]]},X={title:"Transaction with products",description:"A transaction event adds one Snowplow product context per nested product via a loop mapping.",in:(0,D.getEvent)("order complete",{timestamp:1700000407}),mapping:{name:N,settings:{context:[{schema:T,data:{transaction_id:"data.id",revenue:"data.value",currency:"data.currency"}},{schema:P,data:{loop:["nested",{map:{id:"data.id",name:"data.name",price:"data.price"}}]}}]}},out:[["snowplow.trackSelfDescribingEvent",{event:{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/snowplow_ecommerce_action/jsonschema/1-0-2",data:{type:"transaction"}},context:[{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/transaction/jsonschema/1-0-0",data:{transaction_id:"0rd3r1d",revenue:555,currency:"EUR"}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"ers",name:"Everyday Ruck Snack",price:420}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{id:"cc",name:"Cool Cap",price:42}},{schema:"iglu:com.snowplowanalytics.snowplow.ecommerce/product/jsonschema/1-0-0",data:{name:"Surprise"}}]}]]},Y={public:!1,description:"A rule with silent: true sends no Snowplow event.",in:(0,D.getEvent)("product view",{timestamp:1700000405}),mapping:{name:q,silent:!0},out:[]},Z={public:!1,description:"For a destination with config.consent { marketing: true } and activityTracking, revoking marketing calls disableActivityTracking, so sp.js stops its page pings; a grant enables them again.",command:"consent",in:{marketing:!1},out:[["window.snowplow","disableActivityTracking"]]};//# sourceMappingURL=dev.js.map