@walkeros/web-destination-piwikpro 0.0.0-next-20251219153324

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 elbWalker GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ <p align="left">
2
+ <a href="https://www.walkeros.io">
3
+ <img title="elbwalker" src="https://www.walkeros.io/img/elbwalker_logo.png" width="256px"/>
4
+ </a>
5
+ </p>
6
+
7
+ # Piwik PRO Destination for walkerOS
8
+
9
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/destinations/piwikpro)
10
+ &bull;
11
+ [NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-piwikpro)
12
+
13
+ This package provides a [Piwik PRO](https://piwik.pro/) destination for
14
+ walkerOS. Piwik PRO is a European, privacy-focused web analytics and marketing
15
+ platform that helps businesses track website traffic and user behavior.
16
+
17
+ walkerOS follows a **source → collector → destination** architecture. This Piwik
18
+ PRO destination receives processed events from the walkerOS collector and
19
+ transforms them into Piwik PRO's analytics format, providing privacy-compliant
20
+ analytics with GDPR compliance and data ownership control.
21
+
22
+ ## Installation
23
+
24
+ ```sh
25
+ npm install @walkeros/web-destination-piwikpro
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ Here's a basic example of how to use the Piwik PRO destination:
31
+
32
+ ```typescript
33
+ import { startFlow } from '@walkeros/collector';
34
+ import { destinationPiwikPro } from '@walkeros/web-destination-piwikpro';
35
+
36
+ await startFlow({
37
+ destinations: {
38
+ piwikpro: {
39
+ code: destinationPiwikPro,
40
+ config: {
41
+ settings: {
42
+ appId: 'XXX-XXX-XXX-XXX-XXX', // Required
43
+ url: 'https://your_account_name.piwik.pro/', // Required
44
+ },
45
+ },
46
+ },
47
+ },
48
+ });
49
+ ```
50
+
51
+ ## Configuration
52
+
53
+ | Name | Type | Description | Required | Example |
54
+ | -------------- | --------- | ---------------------------------------------- | -------- | ---------------------------------------- |
55
+ | `appId` | `string` | ID of the Piwik PRO site | Yes | `'XXX-XXX-XXX-XXX-XXX'` |
56
+ | `url` | `string` | URL of your Piwik PRO account | Yes | `'https://your_account_name.piwik.pro/'` |
57
+ | `linkTracking` | `boolean` | Enables/Disables download and outlink tracking | No | `false` |
58
+
59
+ ### Event Mapping
60
+
61
+ For custom event mapping (`mapping.entity.action.settings`):
62
+
63
+ | Name | Type | Description | Required | Example |
64
+ | ----------- | -------- | ------------------------------------- | -------- | -------------- |
65
+ | `goalId` | `string` | ID to count the event as a goal | No | `'1'` |
66
+ | `goalValue` | `string` | Property to be used as the goal value | No | `'data.value'` |
67
+
68
+ ## Contribute
69
+
70
+ Feel free to contribute by submitting an
71
+ [issue](https://github.com/elbwalker/walkerOS/issues), starting a
72
+ [discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
73
+ [contact](https://calendly.com/elb-alexander/30min).
74
+
75
+ ## License
76
+
77
+ This project is licensed under the MIT License.
package/dist/dev.d.mts ADDED
@@ -0,0 +1,114 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { Mapping as Mapping$2 } from '@walkeros/core';
4
+ import { DestinationWeb } from '@walkeros/web-core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ appId: z.ZodString;
8
+ url: z.ZodString;
9
+ linkTracking: z.ZodDefault<z.ZodBoolean>;
10
+ }, z.core.$strip>;
11
+ type Settings = z.infer<typeof SettingsSchema>;
12
+
13
+ declare const MappingSchema: z.ZodObject<{
14
+ goalId: z.ZodString;
15
+ goalValue: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ type Mapping$1 = z.infer<typeof MappingSchema>;
18
+
19
+ declare const settings: _walkeros_core_dev.JSONSchema;
20
+ declare const mapping$1: _walkeros_core_dev.JSONSchema;
21
+
22
+ declare const index$1_MappingSchema: typeof MappingSchema;
23
+ type index$1_Settings = Settings;
24
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
25
+ declare const index$1_settings: typeof settings;
26
+ declare namespace index$1 {
27
+ export { type Mapping$1 as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, mapping$1 as mapping, index$1_settings as settings };
28
+ }
29
+
30
+ declare global {
31
+ interface Window {
32
+ _paq?: Array<unknown>;
33
+ }
34
+ }
35
+ interface Mapping {
36
+ goalId?: string;
37
+ goalValue?: string;
38
+ }
39
+ interface Env extends DestinationWeb.Env {
40
+ window: {
41
+ _paq: Array<unknown>;
42
+ };
43
+ document: {
44
+ createElement: (tagName: string) => {
45
+ type: string;
46
+ src: string;
47
+ async?: boolean;
48
+ defer?: boolean;
49
+ };
50
+ head: {
51
+ appendChild: (node: unknown) => void;
52
+ };
53
+ };
54
+ }
55
+ type Rule = Mapping$2.Rule<Mapping>;
56
+
57
+ /**
58
+ * Example environment configurations for PiwikPro destination
59
+ *
60
+ * These environments provide standardized mock structures for testing
61
+ * and development without requiring external dependencies.
62
+ */
63
+ declare const init: Env | undefined;
64
+ declare const push: Env;
65
+
66
+ declare const env_init: typeof init;
67
+ declare const env_push: typeof push;
68
+ declare namespace env {
69
+ export { env_init as init, env_push as push };
70
+ }
71
+
72
+ declare function ecommerceOrder$1(): unknown[];
73
+ declare function ecommerceAddToCart$1(): unknown[];
74
+ declare function ecommerceProductDetailView$1(): unknown[];
75
+ declare function ecommerceCartUpdate$1(): unknown[];
76
+
77
+ declare namespace events {
78
+ export { ecommerceAddToCart$1 as ecommerceAddToCart, ecommerceCartUpdate$1 as ecommerceCartUpdate, ecommerceOrder$1 as ecommerceOrder, ecommerceProductDetailView$1 as ecommerceProductDetailView };
79
+ }
80
+
81
+ declare const ecommerceOrder: Rule;
82
+ declare const ecommerceAddToCart: Rule;
83
+ declare const ecommerceProductDetailView: Rule;
84
+ declare const ecommerceCartUpdate: Rule;
85
+ declare const config: {
86
+ order: {
87
+ complete: Rule;
88
+ };
89
+ product: {
90
+ add: Rule;
91
+ view: Rule;
92
+ };
93
+ cart: {
94
+ view: Rule;
95
+ };
96
+ };
97
+
98
+ declare const mapping_config: typeof config;
99
+ declare const mapping_ecommerceAddToCart: typeof ecommerceAddToCart;
100
+ declare const mapping_ecommerceCartUpdate: typeof ecommerceCartUpdate;
101
+ declare const mapping_ecommerceOrder: typeof ecommerceOrder;
102
+ declare const mapping_ecommerceProductDetailView: typeof ecommerceProductDetailView;
103
+ declare namespace mapping {
104
+ export { mapping_config as config, mapping_ecommerceAddToCart as ecommerceAddToCart, mapping_ecommerceCartUpdate as ecommerceCartUpdate, mapping_ecommerceOrder as ecommerceOrder, mapping_ecommerceProductDetailView as ecommerceProductDetailView };
105
+ }
106
+
107
+ declare const index_env: typeof env;
108
+ declare const index_events: typeof events;
109
+ declare const index_mapping: typeof mapping;
110
+ declare namespace index {
111
+ export { index_env as env, index_events as events, index_mapping as mapping };
112
+ }
113
+
114
+ export { index as examples, index$1 as schemas };
package/dist/dev.d.ts ADDED
@@ -0,0 +1,114 @@
1
+ import * as _walkeros_core_dev from '@walkeros/core/dev';
2
+ import { z } from '@walkeros/core/dev';
3
+ import { Mapping as Mapping$2 } from '@walkeros/core';
4
+ import { DestinationWeb } from '@walkeros/web-core';
5
+
6
+ declare const SettingsSchema: z.ZodObject<{
7
+ appId: z.ZodString;
8
+ url: z.ZodString;
9
+ linkTracking: z.ZodDefault<z.ZodBoolean>;
10
+ }, z.core.$strip>;
11
+ type Settings = z.infer<typeof SettingsSchema>;
12
+
13
+ declare const MappingSchema: z.ZodObject<{
14
+ goalId: z.ZodString;
15
+ goalValue: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ type Mapping$1 = z.infer<typeof MappingSchema>;
18
+
19
+ declare const settings: _walkeros_core_dev.JSONSchema;
20
+ declare const mapping$1: _walkeros_core_dev.JSONSchema;
21
+
22
+ declare const index$1_MappingSchema: typeof MappingSchema;
23
+ type index$1_Settings = Settings;
24
+ declare const index$1_SettingsSchema: typeof SettingsSchema;
25
+ declare const index$1_settings: typeof settings;
26
+ declare namespace index$1 {
27
+ export { type Mapping$1 as Mapping, index$1_MappingSchema as MappingSchema, type index$1_Settings as Settings, index$1_SettingsSchema as SettingsSchema, mapping$1 as mapping, index$1_settings as settings };
28
+ }
29
+
30
+ declare global {
31
+ interface Window {
32
+ _paq?: Array<unknown>;
33
+ }
34
+ }
35
+ interface Mapping {
36
+ goalId?: string;
37
+ goalValue?: string;
38
+ }
39
+ interface Env extends DestinationWeb.Env {
40
+ window: {
41
+ _paq: Array<unknown>;
42
+ };
43
+ document: {
44
+ createElement: (tagName: string) => {
45
+ type: string;
46
+ src: string;
47
+ async?: boolean;
48
+ defer?: boolean;
49
+ };
50
+ head: {
51
+ appendChild: (node: unknown) => void;
52
+ };
53
+ };
54
+ }
55
+ type Rule = Mapping$2.Rule<Mapping>;
56
+
57
+ /**
58
+ * Example environment configurations for PiwikPro destination
59
+ *
60
+ * These environments provide standardized mock structures for testing
61
+ * and development without requiring external dependencies.
62
+ */
63
+ declare const init: Env | undefined;
64
+ declare const push: Env;
65
+
66
+ declare const env_init: typeof init;
67
+ declare const env_push: typeof push;
68
+ declare namespace env {
69
+ export { env_init as init, env_push as push };
70
+ }
71
+
72
+ declare function ecommerceOrder$1(): unknown[];
73
+ declare function ecommerceAddToCart$1(): unknown[];
74
+ declare function ecommerceProductDetailView$1(): unknown[];
75
+ declare function ecommerceCartUpdate$1(): unknown[];
76
+
77
+ declare namespace events {
78
+ export { ecommerceAddToCart$1 as ecommerceAddToCart, ecommerceCartUpdate$1 as ecommerceCartUpdate, ecommerceOrder$1 as ecommerceOrder, ecommerceProductDetailView$1 as ecommerceProductDetailView };
79
+ }
80
+
81
+ declare const ecommerceOrder: Rule;
82
+ declare const ecommerceAddToCart: Rule;
83
+ declare const ecommerceProductDetailView: Rule;
84
+ declare const ecommerceCartUpdate: Rule;
85
+ declare const config: {
86
+ order: {
87
+ complete: Rule;
88
+ };
89
+ product: {
90
+ add: Rule;
91
+ view: Rule;
92
+ };
93
+ cart: {
94
+ view: Rule;
95
+ };
96
+ };
97
+
98
+ declare const mapping_config: typeof config;
99
+ declare const mapping_ecommerceAddToCart: typeof ecommerceAddToCart;
100
+ declare const mapping_ecommerceCartUpdate: typeof ecommerceCartUpdate;
101
+ declare const mapping_ecommerceOrder: typeof ecommerceOrder;
102
+ declare const mapping_ecommerceProductDetailView: typeof ecommerceProductDetailView;
103
+ declare namespace mapping {
104
+ export { mapping_config as config, mapping_ecommerceAddToCart as ecommerceAddToCart, mapping_ecommerceCartUpdate as ecommerceCartUpdate, mapping_ecommerceOrder as ecommerceOrder, mapping_ecommerceProductDetailView as ecommerceProductDetailView };
105
+ }
106
+
107
+ declare const index_env: typeof env;
108
+ declare const index_events: typeof events;
109
+ declare const index_mapping: typeof mapping;
110
+ declare namespace index {
111
+ export { index_env as env, index_events as events, index_mapping as mapping };
112
+ }
113
+
114
+ export { index as examples, index$1 as schemas };
package/dist/dev.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,c=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},d={};c(d,{examples:()=>g,schemas:()=>n}),module.exports=(e=d,((e,c,d,n)=>{if(c&&"object"==typeof c||"function"==typeof c)for(let i of r(c))o.call(e,i)||i===d||t(e,i,{get:()=>c[i],enumerable:!(n=a(c,i))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};c(n,{MappingSchema:()=>s,SettingsSchema:()=>p,mapping:()=>v,settings:()=>l});var i=require("@walkeros/core/dev"),m=require("@walkeros/core/dev"),p=m.z.object({appId:m.z.string().min(1).describe("ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)"),url:m.z.string().url().describe("URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)"),linkTracking:m.z.boolean().default(!1).describe("Enables/Disables download and outlink tracking")}),u=require("@walkeros/core/dev"),s=u.z.object({goalId:u.z.string().describe("ID to count the event as a goal (like 1)"),goalValue:u.z.string().describe("Property to be used as the goal value (like data.value)").optional()}),l=(0,i.zodToSchema)(p),v=(0,i.zodToSchema)(s),g={};c(g,{env:()=>y,events:()=>f,mapping:()=>P});var y={};c(y,{init:()=>w,push:()=>b});var w={window:{_paq:void 0},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},b={window:{_paq:[]},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},f={};c(f,{ecommerceAddToCart:()=>E,ecommerceCartUpdate:()=>X,ecommerceOrder:()=>C,ecommerceProductDetailView:()=>O});var h=require("@walkeros/core");function k(e){return{sku:e.data.id,name:e.data.name,price:e.data.price,quantity:1,variant:e.data.color,customDimensions:{1:e.data.size}}}function C(){const e=(0,h.getEvent)("order complete");return[["ecommerceOrder",e.nested.filter(e=>"product"===e.entity).map(k),{orderId:e.data.id,grandTotal:e.data.total,tax:e.data.taxes,shipping:e.data.shipping},{currencyCode:"EUR"}]]}function E(){return[["ecommerceAddToCart",[k((0,h.getEvent)("product add")),,],{currencyCode:"EUR"}]]}function O(){return[["ecommerceProductDetailView",[k((0,h.getEvent)("product view")),,],{currencyCode:"EUR"}]]}function X(){const e=(0,h.getEvent)("cart view");return[["ecommerceCartUpdate",e.nested.filter(e=>"product"===e.entity).map(k),e.data.value,{currencyCode:"EUR"}]]}var P={};c(P,{config:()=>T,ecommerceAddToCart:()=>D,ecommerceCartUpdate:()=>q,ecommerceOrder:()=>R,ecommerceProductDetailView:()=>j});var U=require("@walkeros/core"),z={sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1},variant:{key:"data.color"},customDimensions:{map:{1:"data.size"}}},R={name:"ecommerceOrder",data:{set:[{loop:["nested",{condition:e=>(0,U.isObject)(e)&&"product"===e.entity,map:z}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}},{map:{currencyCode:{value:"EUR"}}}]}},D={name:"ecommerceAddToCart",data:{set:[{set:[{map:z}]},{map:{currencyCode:{value:"EUR"}}}]}},j={name:"ecommerceProductDetailView",data:{set:[{set:[{map:z}]},{map:{currencyCode:{value:"EUR"}}}]}},q={name:"ecommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>(0,U.isObject)(e)&&"product"===e.entity,map:z}]},"data.value",{map:{currencyCode:{value:"EUR"}}}]}},T={order:{complete:R},product:{add:D,view:j},cart:{view:q}};//# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/events.ts","../src/examples/mapping.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 appId: z\n .string()\n .min(1)\n .describe('ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)'),\n url: z\n .string()\n .url()\n .describe(\n 'URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)',\n ),\n linkTracking: z\n .boolean()\n .default(false)\n .describe('Enables/Disables download and outlink tracking'),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z.string().describe('ID to count the event as a goal (like 1)'),\n goalValue: z\n .string()\n .describe('Property to be used as the goal value (like data.value)')\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as events from './events';\nexport * as mapping from './mapping';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for PiwikPro destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n","import type { WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nfunction getProduct(entity: WalkerOS.Entity | WalkerOS.Event) {\n return {\n sku: entity.data.id,\n name: entity.data.name,\n price: entity.data.price,\n quantity: 1,\n variant: entity.data.color,\n customDimensions: {\n 1: entity.data.size,\n },\n };\n}\n\nexport function ecommerceOrder(): unknown[] {\n const event = getEvent('order complete');\n\n return [\n [\n 'ecommerceOrder',\n event.nested.filter((item) => item.entity === 'product').map(getProduct),\n {\n orderId: event.data.id,\n grandTotal: event.data.total,\n tax: event.data.taxes,\n shipping: event.data.shipping,\n },\n { currencyCode: 'EUR' },\n ],\n ];\n}\n\nexport function ecommerceAddToCart(): unknown[] {\n const event = getEvent('product add');\n\n return [\n ['ecommerceAddToCart', [getProduct(event), ,], { currencyCode: 'EUR' }],\n ];\n}\n\nexport function ecommerceProductDetailView(): unknown[] {\n const event = getEvent('product view');\n\n return [\n [\n 'ecommerceProductDetailView',\n [getProduct(event), ,],\n { currencyCode: 'EUR' },\n ],\n ];\n}\n\nexport function ecommerceCartUpdate(): unknown[] {\n const event = getEvent('cart view');\n\n return [\n [\n 'ecommerceCartUpdate',\n event.nested.filter((item) => item.entity === 'product').map(getProduct),\n event.data.value,\n { currencyCode: 'EUR' },\n ],\n ];\n}\n","import type { DestinationPiwikPro } from '..';\nimport { isObject } from '@walkeros/core';\n\nconst productMap = {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n variant: { key: 'data.color' },\n customDimensions: {\n map: {\n 1: 'data.size',\n },\n },\n};\n\nexport const ecommerceOrder: DestinationPiwikPro.Rule = {\n name: 'ecommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: productMap,\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceAddToCart: DestinationPiwikPro.Rule = {\n name: 'ecommerceAddToCart',\n data: {\n set: [\n {\n set: [\n {\n map: productMap,\n },\n ],\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceProductDetailView: DestinationPiwikPro.Rule = {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: productMap,\n },\n ],\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceCartUpdate: DestinationPiwikPro.Rule = {\n name: 'ecommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: productMap,\n },\n ],\n },\n 'data.value',\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const config = {\n order: { complete: ecommerceOrder },\n product: { add: ecommerceAddToCart, view: ecommerceProductDetailView },\n cart: { view: ecommerceCartUpdate },\n} satisfies DestinationPiwikPro.Rules;\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,OAAO,aACJ,OAAO,EACP,IAAI,CAAC,EACL,SAAS,qDAAqD;AAAA,EACjE,KAAK,aACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,cAAc,aACX,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,gDAAgD;AAC9D,CAAC;;;ACjBD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,QAAQ,cAAE,OAAO,EAAE,SAAS,0CAA0C;AAAA,EACtE,WAAW,cACR,OAAO,EACP,SAAS,yDAAyD,EAClE,SAAS;AACd,CAAC;;;AFAM,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,OAAwB;A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CartUpdate","ecommerceOrder","ecommerceProductDetailView","import_core"]}
package/dist/dev.mjs ADDED
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,a=(a,t)=>{for(var r in t)e(a,r,{get:t[r],enumerable:!0})},t={};a(t,{MappingSchema:()=>i,SettingsSchema:()=>c,mapping:()=>m,settings:()=>n});import{zodToSchema as r}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var c=o.object({appId:o.string().min(1).describe("ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)"),url:o.string().url().describe("URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)"),linkTracking:o.boolean().default(!1).describe("Enables/Disables download and outlink tracking")});import{z as d}from"@walkeros/core/dev";var i=d.object({goalId:d.string().describe("ID to count the event as a goal (like 1)"),goalValue:d.string().describe("Property to be used as the goal value (like data.value)").optional()}),n=r(c),m=r(i),p={};a(p,{env:()=>s,events:()=>v,mapping:()=>h});var s={};a(s,{init:()=>u,push:()=>l});var u={window:{_paq:void 0},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},l={window:{_paq:[]},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},v={};a(v,{ecommerceAddToCart:()=>f,ecommerceCartUpdate:()=>C,ecommerceOrder:()=>w,ecommerceProductDetailView:()=>k});import{getEvent as g}from"@walkeros/core";function y(e){return{sku:e.data.id,name:e.data.name,price:e.data.price,quantity:1,variant:e.data.color,customDimensions:{1:e.data.size}}}function w(){const e=g("order complete");return[["ecommerceOrder",e.nested.filter(e=>"product"===e.entity).map(y),{orderId:e.data.id,grandTotal:e.data.total,tax:e.data.taxes,shipping:e.data.shipping},{currencyCode:"EUR"}]]}function f(){return[["ecommerceAddToCart",[y(g("product add")),,],{currencyCode:"EUR"}]]}function k(){return[["ecommerceProductDetailView",[y(g("product view")),,],{currencyCode:"EUR"}]]}function C(){const e=g("cart view");return[["ecommerceCartUpdate",e.nested.filter(e=>"product"===e.entity).map(y),e.data.value,{currencyCode:"EUR"}]]}var h={};a(h,{config:()=>D,ecommerceAddToCart:()=>E,ecommerceCartUpdate:()=>P,ecommerceOrder:()=>U,ecommerceProductDetailView:()=>R});import{isObject as X}from"@walkeros/core";var b={sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1},variant:{key:"data.color"},customDimensions:{map:{1:"data.size"}}},U={name:"ecommerceOrder",data:{set:[{loop:["nested",{condition:e=>X(e)&&"product"===e.entity,map:b}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}},{map:{currencyCode:{value:"EUR"}}}]}},E={name:"ecommerceAddToCart",data:{set:[{set:[{map:b}]},{map:{currencyCode:{value:"EUR"}}}]}},R={name:"ecommerceProductDetailView",data:{set:[{set:[{map:b}]},{map:{currencyCode:{value:"EUR"}}}]}},P={name:"ecommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>X(e)&&"product"===e.entity,map:b}]},"data.value",{map:{currencyCode:{value:"EUR"}}}]}},D={order:{complete:U},product:{add:E,view:R},cart:{view:P}};export{p as examples,t as schemas};//# sourceMappingURL=dev.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/events.ts","../src/examples/mapping.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 appId: z\n .string()\n .min(1)\n .describe('ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)'),\n url: z\n .string()\n .url()\n .describe(\n 'URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)',\n ),\n linkTracking: z\n .boolean()\n .default(false)\n .describe('Enables/Disables download and outlink tracking'),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n goalId: z.string().describe('ID to count the event as a goal (like 1)'),\n goalValue: z\n .string()\n .describe('Property to be used as the goal value (like data.value)')\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as events from './events';\nexport * as mapping from './mapping';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for PiwikPro destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n","import type { WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nfunction getProduct(entity: WalkerOS.Entity | WalkerOS.Event) {\n return {\n sku: entity.data.id,\n name: entity.data.name,\n price: entity.data.price,\n quantity: 1,\n variant: entity.data.color,\n customDimensions: {\n 1: entity.data.size,\n },\n };\n}\n\nexport function ecommerceOrder(): unknown[] {\n const event = getEvent('order complete');\n\n return [\n [\n 'ecommerceOrder',\n event.nested.filter((item) => item.entity === 'product').map(getProduct),\n {\n orderId: event.data.id,\n grandTotal: event.data.total,\n tax: event.data.taxes,\n shipping: event.data.shipping,\n },\n { currencyCode: 'EUR' },\n ],\n ];\n}\n\nexport function ecommerceAddToCart(): unknown[] {\n const event = getEvent('product add');\n\n return [\n ['ecommerceAddToCart', [getProduct(event), ,], { currencyCode: 'EUR' }],\n ];\n}\n\nexport function ecommerceProductDetailView(): unknown[] {\n const event = getEvent('product view');\n\n return [\n [\n 'ecommerceProductDetailView',\n [getProduct(event), ,],\n { currencyCode: 'EUR' },\n ],\n ];\n}\n\nexport function ecommerceCartUpdate(): unknown[] {\n const event = getEvent('cart view');\n\n return [\n [\n 'ecommerceCartUpdate',\n event.nested.filter((item) => item.entity === 'product').map(getProduct),\n event.data.value,\n { currencyCode: 'EUR' },\n ],\n ];\n}\n","import type { DestinationPiwikPro } from '..';\nimport { isObject } from '@walkeros/core';\n\nconst productMap = {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n variant: { key: 'data.color' },\n customDimensions: {\n map: {\n 1: 'data.size',\n },\n },\n};\n\nexport const ecommerceOrder: DestinationPiwikPro.Rule = {\n name: 'ecommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: productMap,\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceAddToCart: DestinationPiwikPro.Rule = {\n name: 'ecommerceAddToCart',\n data: {\n set: [\n {\n set: [\n {\n map: productMap,\n },\n ],\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceProductDetailView: DestinationPiwikPro.Rule = {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: productMap,\n },\n ],\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceCartUpdate: DestinationPiwikPro.Rule = {\n name: 'ecommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: productMap,\n },\n ],\n },\n 'data.value',\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const config = {\n order: { complete: ecommerceOrder },\n product: { add: ecommerceAddToCart, view: ecommerceProductDetailView },\n cart: { view: ecommerceCartUpdate },\n} satisfies DestinationPiwikPro.Rules;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,OAAO,EACJ,OAAO,EACP,IAAI,CAAC,EACL,SAAS,qDAAqD;AAAA,EACjE,KAAK,EACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,cAAc,EACX,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,gDAAgD;AAC9D,CAAC;;;ACjBD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,QAAQA,GAAE,OAAO,EAAE,SAAS,0CAA0C;AAAA,EACtE,WAAWA,GACR,OAAO,EACP,SAAS,yDAAyD,EAClE,SAAS;AACd,CAAC;;;AFAM,IAAM,WAAW,YAAY,cAAc;AAC3C,IAAM,UAAU,YAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,OAAwB;AAAA,EACnC,QAAQ;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,eAAe,OAAO;AAAA,MACpB,MAAM;AAAA,MACN,KAAK;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA,MAAM,EAAE,aAAa,MAAM;AAAA,IAAC,EAAE;AAAA,EAChC;AACF;AAEO,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,MAAM,CAAC;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,eAAe,OAAO;AAAA,MACpB,MAAM;AAAA,MACN,KAAK;AAAA,MACL,OAAO;AAAA,MACP,OAAO;A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,8BAAuD;AAAA,EAClE,MAAM;AAAA,EACN,MAAM;AAAA,IACJ,KAAK;AAAA,MACH;AAAA,QACE,KAAK;AAAA,UACH;AAAA,YACE,KAAK;AAAA,UACP;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,cAAc,EAAE,OAAO,MAAM;AAAA,QAC/B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAMF,uBAAgD;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM;AAAA,IACJ,KAAK;AAAA,MACH;AAAA,QACE,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,YACE,WAAW,CAAC,WACV,SAAS,MAAM,KAAK,OAAO,WAAW;AAAA,YACxC,KAAK;AAAA,UACP;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,cAAc,EAAE,OAAO,MAAM;AAAA,QAC/B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,SAAS;AAAA,EACpB,OAAO,EAAE,UAAUC,gBAAe;AAAA,EAClC,SAAS,EAAE,KAAKF,qBAAoB,MAAMG,4BAA2B;AAAA,EACrE,MAAM,EAAE,MAAMF,qBAAoB;AACpC;","names":["z","ecommerceAddToCart","ecommerceCartUpdate","ecommerceOrder","ecommerceProductDetailView"]}
@@ -0,0 +1,81 @@
1
+ import { Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ _paq?: Array<unknown>;
7
+ }
8
+ }
9
+ interface Mapping {
10
+ goalId?: string;
11
+ goalValue?: string;
12
+ }
13
+ interface Env extends DestinationWeb.Env {
14
+ window: {
15
+ _paq: Array<unknown>;
16
+ };
17
+ document: {
18
+ createElement: (tagName: string) => {
19
+ type: string;
20
+ src: string;
21
+ async?: boolean;
22
+ defer?: boolean;
23
+ };
24
+ head: {
25
+ appendChild: (node: unknown) => void;
26
+ };
27
+ };
28
+ }
29
+ type Rule = Mapping$1.Rule<Mapping>;
30
+
31
+ /**
32
+ * Example environment configurations for PiwikPro destination
33
+ *
34
+ * These environments provide standardized mock structures for testing
35
+ * and development without requiring external dependencies.
36
+ */
37
+ declare const init: Env | undefined;
38
+ declare const push: Env;
39
+
40
+ declare const env_init: typeof init;
41
+ declare const env_push: typeof push;
42
+ declare namespace env {
43
+ export { env_init as init, env_push as push };
44
+ }
45
+
46
+ declare function ecommerceOrder$1(): unknown[];
47
+ declare function ecommerceAddToCart$1(): unknown[];
48
+ declare function ecommerceProductDetailView$1(): unknown[];
49
+ declare function ecommerceCartUpdate$1(): unknown[];
50
+
51
+ declare namespace events {
52
+ export { ecommerceAddToCart$1 as ecommerceAddToCart, ecommerceCartUpdate$1 as ecommerceCartUpdate, ecommerceOrder$1 as ecommerceOrder, ecommerceProductDetailView$1 as ecommerceProductDetailView };
53
+ }
54
+
55
+ declare const ecommerceOrder: Rule;
56
+ declare const ecommerceAddToCart: Rule;
57
+ declare const ecommerceProductDetailView: Rule;
58
+ declare const ecommerceCartUpdate: Rule;
59
+ declare const config: {
60
+ order: {
61
+ complete: Rule;
62
+ };
63
+ product: {
64
+ add: Rule;
65
+ view: Rule;
66
+ };
67
+ cart: {
68
+ view: Rule;
69
+ };
70
+ };
71
+
72
+ declare const mapping_config: typeof config;
73
+ declare const mapping_ecommerceAddToCart: typeof ecommerceAddToCart;
74
+ declare const mapping_ecommerceCartUpdate: typeof ecommerceCartUpdate;
75
+ declare const mapping_ecommerceOrder: typeof ecommerceOrder;
76
+ declare const mapping_ecommerceProductDetailView: typeof ecommerceProductDetailView;
77
+ declare namespace mapping {
78
+ export { mapping_config as config, mapping_ecommerceAddToCart as ecommerceAddToCart, mapping_ecommerceCartUpdate as ecommerceCartUpdate, mapping_ecommerceOrder as ecommerceOrder, mapping_ecommerceProductDetailView as ecommerceProductDetailView };
79
+ }
80
+
81
+ export { env, events, mapping };
@@ -0,0 +1,81 @@
1
+ import { Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ _paq?: Array<unknown>;
7
+ }
8
+ }
9
+ interface Mapping {
10
+ goalId?: string;
11
+ goalValue?: string;
12
+ }
13
+ interface Env extends DestinationWeb.Env {
14
+ window: {
15
+ _paq: Array<unknown>;
16
+ };
17
+ document: {
18
+ createElement: (tagName: string) => {
19
+ type: string;
20
+ src: string;
21
+ async?: boolean;
22
+ defer?: boolean;
23
+ };
24
+ head: {
25
+ appendChild: (node: unknown) => void;
26
+ };
27
+ };
28
+ }
29
+ type Rule = Mapping$1.Rule<Mapping>;
30
+
31
+ /**
32
+ * Example environment configurations for PiwikPro destination
33
+ *
34
+ * These environments provide standardized mock structures for testing
35
+ * and development without requiring external dependencies.
36
+ */
37
+ declare const init: Env | undefined;
38
+ declare const push: Env;
39
+
40
+ declare const env_init: typeof init;
41
+ declare const env_push: typeof push;
42
+ declare namespace env {
43
+ export { env_init as init, env_push as push };
44
+ }
45
+
46
+ declare function ecommerceOrder$1(): unknown[];
47
+ declare function ecommerceAddToCart$1(): unknown[];
48
+ declare function ecommerceProductDetailView$1(): unknown[];
49
+ declare function ecommerceCartUpdate$1(): unknown[];
50
+
51
+ declare namespace events {
52
+ export { ecommerceAddToCart$1 as ecommerceAddToCart, ecommerceCartUpdate$1 as ecommerceCartUpdate, ecommerceOrder$1 as ecommerceOrder, ecommerceProductDetailView$1 as ecommerceProductDetailView };
53
+ }
54
+
55
+ declare const ecommerceOrder: Rule;
56
+ declare const ecommerceAddToCart: Rule;
57
+ declare const ecommerceProductDetailView: Rule;
58
+ declare const ecommerceCartUpdate: Rule;
59
+ declare const config: {
60
+ order: {
61
+ complete: Rule;
62
+ };
63
+ product: {
64
+ add: Rule;
65
+ view: Rule;
66
+ };
67
+ cart: {
68
+ view: Rule;
69
+ };
70
+ };
71
+
72
+ declare const mapping_config: typeof config;
73
+ declare const mapping_ecommerceAddToCart: typeof ecommerceAddToCart;
74
+ declare const mapping_ecommerceCartUpdate: typeof ecommerceCartUpdate;
75
+ declare const mapping_ecommerceOrder: typeof ecommerceOrder;
76
+ declare const mapping_ecommerceProductDetailView: typeof ecommerceProductDetailView;
77
+ declare namespace mapping {
78
+ export { mapping_config as config, mapping_ecommerceAddToCart as ecommerceAddToCart, mapping_ecommerceCartUpdate as ecommerceCartUpdate, mapping_ecommerceOrder as ecommerceOrder, mapping_ecommerceProductDetailView as ecommerceProductDetailView };
79
+ }
80
+
81
+ export { env, events, mapping };
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/examples/index.ts
21
+ var examples_exports = {};
22
+ __export(examples_exports, {
23
+ env: () => env_exports,
24
+ events: () => events_exports,
25
+ mapping: () => mapping_exports
26
+ });
27
+ module.exports = __toCommonJS(examples_exports);
28
+
29
+ // src/examples/env.ts
30
+ var env_exports = {};
31
+ __export(env_exports, {
32
+ init: () => init,
33
+ push: () => push
34
+ });
35
+ var init = {
36
+ window: {
37
+ _paq: void 0
38
+ },
39
+ document: {
40
+ createElement: () => ({
41
+ type: "",
42
+ src: "",
43
+ async: false,
44
+ defer: false
45
+ }),
46
+ head: { appendChild: () => {
47
+ } }
48
+ }
49
+ };
50
+ var push = {
51
+ window: {
52
+ _paq: []
53
+ },
54
+ document: {
55
+ createElement: () => ({
56
+ type: "",
57
+ src: "",
58
+ async: false,
59
+ defer: false
60
+ }),
61
+ head: { appendChild: () => {
62
+ } }
63
+ }
64
+ };
65
+
66
+ // src/examples/events.ts
67
+ var events_exports = {};
68
+ __export(events_exports, {
69
+ ecommerceAddToCart: () => ecommerceAddToCart,
70
+ ecommerceCartUpdate: () => ecommerceCartUpdate,
71
+ ecommerceOrder: () => ecommerceOrder,
72
+ ecommerceProductDetailView: () => ecommerceProductDetailView
73
+ });
74
+ var import_core = require("@walkeros/core");
75
+ function getProduct(entity) {
76
+ return {
77
+ sku: entity.data.id,
78
+ name: entity.data.name,
79
+ price: entity.data.price,
80
+ quantity: 1,
81
+ variant: entity.data.color,
82
+ customDimensions: {
83
+ 1: entity.data.size
84
+ }
85
+ };
86
+ }
87
+ function ecommerceOrder() {
88
+ const event = (0, import_core.getEvent)("order complete");
89
+ return [
90
+ [
91
+ "ecommerceOrder",
92
+ event.nested.filter((item) => item.entity === "product").map(getProduct),
93
+ {
94
+ orderId: event.data.id,
95
+ grandTotal: event.data.total,
96
+ tax: event.data.taxes,
97
+ shipping: event.data.shipping
98
+ },
99
+ { currencyCode: "EUR" }
100
+ ]
101
+ ];
102
+ }
103
+ function ecommerceAddToCart() {
104
+ const event = (0, import_core.getEvent)("product add");
105
+ return [
106
+ ["ecommerceAddToCart", [getProduct(event), ,], { currencyCode: "EUR" }]
107
+ ];
108
+ }
109
+ function ecommerceProductDetailView() {
110
+ const event = (0, import_core.getEvent)("product view");
111
+ return [
112
+ [
113
+ "ecommerceProductDetailView",
114
+ [getProduct(event), ,],
115
+ { currencyCode: "EUR" }
116
+ ]
117
+ ];
118
+ }
119
+ function ecommerceCartUpdate() {
120
+ const event = (0, import_core.getEvent)("cart view");
121
+ return [
122
+ [
123
+ "ecommerceCartUpdate",
124
+ event.nested.filter((item) => item.entity === "product").map(getProduct),
125
+ event.data.value,
126
+ { currencyCode: "EUR" }
127
+ ]
128
+ ];
129
+ }
130
+
131
+ // src/examples/mapping.ts
132
+ var mapping_exports = {};
133
+ __export(mapping_exports, {
134
+ config: () => config,
135
+ ecommerceAddToCart: () => ecommerceAddToCart2,
136
+ ecommerceCartUpdate: () => ecommerceCartUpdate2,
137
+ ecommerceOrder: () => ecommerceOrder2,
138
+ ecommerceProductDetailView: () => ecommerceProductDetailView2
139
+ });
140
+ var import_core2 = require("@walkeros/core");
141
+ var productMap = {
142
+ sku: "data.id",
143
+ name: "data.name",
144
+ price: "data.price",
145
+ quantity: { value: 1 },
146
+ variant: { key: "data.color" },
147
+ customDimensions: {
148
+ map: {
149
+ 1: "data.size"
150
+ }
151
+ }
152
+ };
153
+ var ecommerceOrder2 = {
154
+ name: "ecommerceOrder",
155
+ data: {
156
+ set: [
157
+ {
158
+ loop: [
159
+ "nested",
160
+ {
161
+ condition: (entity) => (0, import_core2.isObject)(entity) && entity.entity === "product",
162
+ map: productMap
163
+ }
164
+ ]
165
+ },
166
+ {
167
+ map: {
168
+ orderId: "data.id",
169
+ grandTotal: "data.total",
170
+ tax: "data.taxes",
171
+ shipping: "data.shipping"
172
+ }
173
+ },
174
+ {
175
+ map: {
176
+ currencyCode: { value: "EUR" }
177
+ }
178
+ }
179
+ ]
180
+ }
181
+ };
182
+ var ecommerceAddToCart2 = {
183
+ name: "ecommerceAddToCart",
184
+ data: {
185
+ set: [
186
+ {
187
+ set: [
188
+ {
189
+ map: productMap
190
+ }
191
+ ]
192
+ },
193
+ {
194
+ map: {
195
+ currencyCode: { value: "EUR" }
196
+ }
197
+ }
198
+ ]
199
+ }
200
+ };
201
+ var ecommerceProductDetailView2 = {
202
+ name: "ecommerceProductDetailView",
203
+ data: {
204
+ set: [
205
+ {
206
+ set: [
207
+ {
208
+ map: productMap
209
+ }
210
+ ]
211
+ },
212
+ {
213
+ map: {
214
+ currencyCode: { value: "EUR" }
215
+ }
216
+ }
217
+ ]
218
+ }
219
+ };
220
+ var ecommerceCartUpdate2 = {
221
+ name: "ecommerceCartUpdate",
222
+ data: {
223
+ set: [
224
+ {
225
+ loop: [
226
+ "nested",
227
+ {
228
+ condition: (entity) => (0, import_core2.isObject)(entity) && entity.entity === "product",
229
+ map: productMap
230
+ }
231
+ ]
232
+ },
233
+ "data.value",
234
+ {
235
+ map: {
236
+ currencyCode: { value: "EUR" }
237
+ }
238
+ }
239
+ ]
240
+ }
241
+ };
242
+ var config = {
243
+ order: { complete: ecommerceOrder2 },
244
+ product: { add: ecommerceAddToCart2, view: ecommerceProductDetailView2 },
245
+ cart: { view: ecommerceCartUpdate2 }
246
+ };
247
+ // Annotate the CommonJS export names for ESM import in node:
248
+ 0 && (module.exports = {
249
+ env,
250
+ events,
251
+ mapping
252
+ });
@@ -0,0 +1,229 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/examples/env.ts
8
+ var env_exports = {};
9
+ __export(env_exports, {
10
+ init: () => init,
11
+ push: () => push
12
+ });
13
+ var init = {
14
+ window: {
15
+ _paq: void 0
16
+ },
17
+ document: {
18
+ createElement: () => ({
19
+ type: "",
20
+ src: "",
21
+ async: false,
22
+ defer: false
23
+ }),
24
+ head: { appendChild: () => {
25
+ } }
26
+ }
27
+ };
28
+ var push = {
29
+ window: {
30
+ _paq: []
31
+ },
32
+ document: {
33
+ createElement: () => ({
34
+ type: "",
35
+ src: "",
36
+ async: false,
37
+ defer: false
38
+ }),
39
+ head: { appendChild: () => {
40
+ } }
41
+ }
42
+ };
43
+
44
+ // src/examples/events.ts
45
+ var events_exports = {};
46
+ __export(events_exports, {
47
+ ecommerceAddToCart: () => ecommerceAddToCart,
48
+ ecommerceCartUpdate: () => ecommerceCartUpdate,
49
+ ecommerceOrder: () => ecommerceOrder,
50
+ ecommerceProductDetailView: () => ecommerceProductDetailView
51
+ });
52
+ import { getEvent } from "@walkeros/core";
53
+ function getProduct(entity) {
54
+ return {
55
+ sku: entity.data.id,
56
+ name: entity.data.name,
57
+ price: entity.data.price,
58
+ quantity: 1,
59
+ variant: entity.data.color,
60
+ customDimensions: {
61
+ 1: entity.data.size
62
+ }
63
+ };
64
+ }
65
+ function ecommerceOrder() {
66
+ const event = getEvent("order complete");
67
+ return [
68
+ [
69
+ "ecommerceOrder",
70
+ event.nested.filter((item) => item.entity === "product").map(getProduct),
71
+ {
72
+ orderId: event.data.id,
73
+ grandTotal: event.data.total,
74
+ tax: event.data.taxes,
75
+ shipping: event.data.shipping
76
+ },
77
+ { currencyCode: "EUR" }
78
+ ]
79
+ ];
80
+ }
81
+ function ecommerceAddToCart() {
82
+ const event = getEvent("product add");
83
+ return [
84
+ ["ecommerceAddToCart", [getProduct(event), ,], { currencyCode: "EUR" }]
85
+ ];
86
+ }
87
+ function ecommerceProductDetailView() {
88
+ const event = getEvent("product view");
89
+ return [
90
+ [
91
+ "ecommerceProductDetailView",
92
+ [getProduct(event), ,],
93
+ { currencyCode: "EUR" }
94
+ ]
95
+ ];
96
+ }
97
+ function ecommerceCartUpdate() {
98
+ const event = getEvent("cart view");
99
+ return [
100
+ [
101
+ "ecommerceCartUpdate",
102
+ event.nested.filter((item) => item.entity === "product").map(getProduct),
103
+ event.data.value,
104
+ { currencyCode: "EUR" }
105
+ ]
106
+ ];
107
+ }
108
+
109
+ // src/examples/mapping.ts
110
+ var mapping_exports = {};
111
+ __export(mapping_exports, {
112
+ config: () => config,
113
+ ecommerceAddToCart: () => ecommerceAddToCart2,
114
+ ecommerceCartUpdate: () => ecommerceCartUpdate2,
115
+ ecommerceOrder: () => ecommerceOrder2,
116
+ ecommerceProductDetailView: () => ecommerceProductDetailView2
117
+ });
118
+ import { isObject } from "@walkeros/core";
119
+ var productMap = {
120
+ sku: "data.id",
121
+ name: "data.name",
122
+ price: "data.price",
123
+ quantity: { value: 1 },
124
+ variant: { key: "data.color" },
125
+ customDimensions: {
126
+ map: {
127
+ 1: "data.size"
128
+ }
129
+ }
130
+ };
131
+ var ecommerceOrder2 = {
132
+ name: "ecommerceOrder",
133
+ data: {
134
+ set: [
135
+ {
136
+ loop: [
137
+ "nested",
138
+ {
139
+ condition: (entity) => isObject(entity) && entity.entity === "product",
140
+ map: productMap
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ map: {
146
+ orderId: "data.id",
147
+ grandTotal: "data.total",
148
+ tax: "data.taxes",
149
+ shipping: "data.shipping"
150
+ }
151
+ },
152
+ {
153
+ map: {
154
+ currencyCode: { value: "EUR" }
155
+ }
156
+ }
157
+ ]
158
+ }
159
+ };
160
+ var ecommerceAddToCart2 = {
161
+ name: "ecommerceAddToCart",
162
+ data: {
163
+ set: [
164
+ {
165
+ set: [
166
+ {
167
+ map: productMap
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ map: {
173
+ currencyCode: { value: "EUR" }
174
+ }
175
+ }
176
+ ]
177
+ }
178
+ };
179
+ var ecommerceProductDetailView2 = {
180
+ name: "ecommerceProductDetailView",
181
+ data: {
182
+ set: [
183
+ {
184
+ set: [
185
+ {
186
+ map: productMap
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ map: {
192
+ currencyCode: { value: "EUR" }
193
+ }
194
+ }
195
+ ]
196
+ }
197
+ };
198
+ var ecommerceCartUpdate2 = {
199
+ name: "ecommerceCartUpdate",
200
+ data: {
201
+ set: [
202
+ {
203
+ loop: [
204
+ "nested",
205
+ {
206
+ condition: (entity) => isObject(entity) && entity.entity === "product",
207
+ map: productMap
208
+ }
209
+ ]
210
+ },
211
+ "data.value",
212
+ {
213
+ map: {
214
+ currencyCode: { value: "EUR" }
215
+ }
216
+ }
217
+ ]
218
+ }
219
+ };
220
+ var config = {
221
+ order: { complete: ecommerceOrder2 },
222
+ product: { add: ecommerceAddToCart2, view: ecommerceProductDetailView2 },
223
+ cart: { view: ecommerceCartUpdate2 }
224
+ };
225
+ export {
226
+ env_exports as env,
227
+ events_exports as events,
228
+ mapping_exports as mapping
229
+ };
@@ -0,0 +1 @@
1
+ "use strict";var Destination=(()=>{var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r={};((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})(r,{DestinationPiwikPro:()=>b,default:()=>h,destinationPiwikPro:()=>O});var i=Object.defineProperty;((t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})})({},{Level:()=>c});var a,c=((a=c||{})[a.ERROR=0]="ERROR",a[a.INFO=1]="INFO",a[a.DEBUG=2]="DEBUG",a);function s(t){return Array.isArray(t)}function u(t){return void 0!==t}function l(t){return"object"==typeof t&&null!==t&&!s(t)&&"[object Object]"===Object.prototype.toString.call(t)}function f(t){return"string"==typeof t}function p(t,e="",n){const o=e.split(".");let r=t;for(let t=0;t<o.length;t++){const e=o[t];if("*"===e&&s(r)){const e=o.slice(t+1).join("."),i=[];for(const t of r){const o=p(t,e,n);i.push(o)}return i}if(r=r instanceof Object?r[e]:void 0,!r)break}return u(r)?r:n}function d(t){return function(t){return"boolean"==typeof t}(t)||f(t)||function(t){return"number"==typeof t&&!Number.isNaN(t)}(t)||!u(t)||s(t)&&t.every(d)||l(t)&&Object.values(t).every(d)}function w(t){return d(t)?t:void 0}function y(t,e,n){return async function(...o){try{return await t(...o)}catch(t){if(!e)return;return await e(t)}finally{await(null==n?void 0:n())}}}async function g(t,e={},n={}){var o;if(!u(t))return;const r=l(t)&&t.consent||n.consent||(null==(o=n.collector)?void 0:o.consent),i=s(e)?e:[e];for(const e of i){const o=await y(v)(t,e,{...n,consent:r});if(u(o))return o}}async function v(t,e,n={}){const{collector:o,consent:r}=n;return(s(e)?e:[e]).reduce(async(e,i)=>{const a=await e;if(a)return a;const c=f(i)?{key:i}:i;if(!Object.keys(c).length)return;const{condition:l,consent:d,fn:m,key:b,loop:O,map:j,set:h,validate:k,value:P}=c;if(l&&!await y(l)(t,i,o))return;if(d&&!function(t,e={},n={}){const o={...e,...n},r={};let i=void 0===t;return Object.keys(o).forEach(e=>{o[e]&&(r[e]=!0,t&&t[e]&&(i=!0))}),!!i&&r}(d,r))return P;let I=u(P)?P:t;if(m&&(I=await y(m)(t,i,n)),b&&(I=p(t,b,P)),O){const[e,o]=O,r="this"===e?[t]:await g(t,e,n);s(r)&&(I=(await Promise.all(r.map(t=>g(t,o,n)))).filter(u))}else j?I=await Object.entries(j).reduce(async(e,[o,r])=>{const i=await e,a=await g(t,r,n);return u(a)&&(i[o]=a),i},Promise.resolve({})):h&&(I=await Promise.all(h.map(e=>v(t,e,n))));k&&!await y(k)(I)&&(I=void 0);const E=w(I);return u(E)?E:w(P)},Promise.resolve(void 0))}function m(t){return{window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...t}}var b={},O={type:"piwikpro",config:{},init({config:t,env:e,logger:n}){const{window:o}=m(e),r=o,{settings:i,loadScript:a}=t,{appId:c,url:s}=i||{};c||n.throw("Config settings appId missing"),s||n.throw("Config settings url missing"),r._paq=r._paq||[];const u=r._paq.push;a&&(!function(t,e){const{document:n}=m(e),o=n,r=o.createElement("script");r.type="text/javascript",r.src=t+"ppms.js",r.async=!0,r.defer=!0,o.head.appendChild(r)}(s,e),u(["setTrackerUrl",s+"ppms.php"]),u(["setSiteId",c])),!1!==(null==i?void 0:i.linkTracking)&&u(["enableLinkTracking"])},async push(t,{mapping:e={},data:n,env:o}){const{window:r}=m(o),i=r._paq.push;if("page view"===t.name&&!e.settings)return void i(["trackPageView",await g(t,"data.title")]);const a=e.settings||{},c=s(n)?n:[n];if(i([t.name,...c]),a.goalId){const e=a.goalValue?g(t,a.goalValue):void 0;i(["trackGoal",a.goalId,e])}}};var j,h=O;return j=r,((r,i,a,c)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of n(i))o.call(r,s)||s===a||t(r,s,{get:()=>i[s],enumerable:!(c=e(i,s))||c.enumerable});return r})(t({},"__esModule",{value:!0}),j)})();
@@ -0,0 +1,60 @@
1
+ import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ _paq?: Array<unknown>;
7
+ }
8
+ }
9
+ interface Settings {
10
+ appId: string;
11
+ linkTracking?: boolean;
12
+ url: string;
13
+ }
14
+ type InitSettings = Partial<Settings>;
15
+ interface Mapping {
16
+ goalId?: string;
17
+ goalValue?: string;
18
+ }
19
+ interface Env extends DestinationWeb.Env {
20
+ window: {
21
+ _paq: Array<unknown>;
22
+ };
23
+ document: {
24
+ createElement: (tagName: string) => {
25
+ type: string;
26
+ src: string;
27
+ async?: boolean;
28
+ defer?: boolean;
29
+ };
30
+ head: {
31
+ appendChild: (node: unknown) => void;
32
+ };
33
+ };
34
+ }
35
+ type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
36
+ type Destination = DestinationWeb.Destination<Types>;
37
+ type Config = DestinationWeb.Config<Types>;
38
+ type Rule = Mapping$1.Rule<Mapping>;
39
+ type Rules = Mapping$1.Rules<Rule>;
40
+ interface Dimensions {
41
+ [i: number]: string;
42
+ }
43
+
44
+ type index_Config = Config;
45
+ type index_Destination = Destination;
46
+ type index_Dimensions = Dimensions;
47
+ type index_Env = Env;
48
+ type index_InitSettings = InitSettings;
49
+ type index_Mapping = Mapping;
50
+ type index_Rule = Rule;
51
+ type index_Rules = Rules;
52
+ type index_Settings = Settings;
53
+ type index_Types = Types;
54
+ declare namespace index {
55
+ export type { index_Config as Config, index_Destination as Destination, index_Dimensions as Dimensions, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings, index_Types as Types };
56
+ }
57
+
58
+ declare const destinationPiwikPro: Destination;
59
+
60
+ export { index as DestinationPiwikPro, destinationPiwikPro as default, destinationPiwikPro };
@@ -0,0 +1,60 @@
1
+ import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ declare global {
5
+ interface Window {
6
+ _paq?: Array<unknown>;
7
+ }
8
+ }
9
+ interface Settings {
10
+ appId: string;
11
+ linkTracking?: boolean;
12
+ url: string;
13
+ }
14
+ type InitSettings = Partial<Settings>;
15
+ interface Mapping {
16
+ goalId?: string;
17
+ goalValue?: string;
18
+ }
19
+ interface Env extends DestinationWeb.Env {
20
+ window: {
21
+ _paq: Array<unknown>;
22
+ };
23
+ document: {
24
+ createElement: (tagName: string) => {
25
+ type: string;
26
+ src: string;
27
+ async?: boolean;
28
+ defer?: boolean;
29
+ };
30
+ head: {
31
+ appendChild: (node: unknown) => void;
32
+ };
33
+ };
34
+ }
35
+ type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
36
+ type Destination = DestinationWeb.Destination<Types>;
37
+ type Config = DestinationWeb.Config<Types>;
38
+ type Rule = Mapping$1.Rule<Mapping>;
39
+ type Rules = Mapping$1.Rules<Rule>;
40
+ interface Dimensions {
41
+ [i: number]: string;
42
+ }
43
+
44
+ type index_Config = Config;
45
+ type index_Destination = Destination;
46
+ type index_Dimensions = Dimensions;
47
+ type index_Env = Env;
48
+ type index_InitSettings = InitSettings;
49
+ type index_Mapping = Mapping;
50
+ type index_Rule = Rule;
51
+ type index_Rules = Rules;
52
+ type index_Settings = Settings;
53
+ type index_Types = Types;
54
+ declare namespace index {
55
+ export type { index_Config as Config, index_Destination as Destination, index_Dimensions as Dimensions, index_Env as Env, index_InitSettings as InitSettings, index_Mapping as Mapping, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings, index_Types as Types };
56
+ }
57
+
58
+ declare const destinationPiwikPro: Destination;
59
+
60
+ export { index as DestinationPiwikPro, destinationPiwikPro as default, destinationPiwikPro };
@@ -0,0 +1 @@
1
+ "use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)})}}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}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 _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.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(e,t):void 0}}function _ts_generator(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Destination=function(){var e=function(e){return Array.isArray(e)},t=function(e){return void 0!==e},r=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!e(t)&&"[object Object]"===Object.prototype.toString.call(t)},n=function(e){return"string"==typeof e},o=function(e){return v(e)?e:void 0},a=function(e,t,r){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return _async_to_generator(function(){var n;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return n=a.sent(),t?[4,t(n)]:[2];case 4:return[4,null==r?void 0:r()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},i=function(n){return _async_to_generator(function(n){var o,i,u,c,l,s,f,y,_,p,b,d,v,g=arguments;return _ts_generator(this,function(m){switch(m.label){case 0:if(o=g.length>1&&void 0!==g[1]?g[1]:{},i=g.length>2&&void 0!==g[2]?g[2]:{},!t(n))return[2];c=r(n)&&n.consent||i.consent||(null===(u=i.collector)||void 0===u?void 0:u.consent),l=e(o)?o:[o],s=!0,f=!1,y=void 0,m.label=1;case 1:m.trys.push([1,6,7,8]),_=l[Symbol.iterator](),m.label=2;case 2:return(s=(p=_.next()).done)?[3,5]:(b=p.value,[4,a(h)(n,b,_object_spread_props(_object_spread({},i),{consent:c}))]);case 3:if(d=m.sent(),t(d))return[2,d];m.label=4;case 4:return s=!0,[3,2];case 5:return[3,8];case 6:return v=m.sent(),f=!0,y=v,[3,8];case 7:try{s||null==_.return||_.return()}finally{if(f)throw y}return[7];case 8:return[2]}})}).apply(this,arguments)},u=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,f=Object.prototype.hasOwnProperty,y={};!function(e,t){for(var r in t)c(e,r,{get:t[r],enumerable:!0})}(y,{DestinationPiwikPro:function(){return m},default:function(){return O},destinationPiwikPro:function(){return w}});var _=Object.defineProperty;!function(e,t){for(var r in t)_(e,r,{get:t[r],enumerable:!0})}({},{Level:function(){return b}});var p,b=((p=b||{})[p.ERROR=0]="ERROR",p[p.INFO=1]="INFO",p[p.DEBUG=2]="DEBUG",p);function d(r){for(var n=arguments.length>2?arguments[2]:void 0,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),a=r,i=0;i<o.length;i++){var u=o[i];if("*"===u&&e(a)){var c=o.slice(i+1).join("."),l=[],s=!0,f=!1,y=void 0;try{for(var _,p=a[Symbol.iterator]();!(s=(_=p.next()).done);s=!0){var b=d(_.value,c,n);l.push(b)}}catch(e){f=!0,y=e}finally{try{s||null==p.return||p.return()}finally{if(f)throw y}}return l}if(!(a=_instanceof(a,Object)?a[u]:void 0))break}return t(a)?a:n}function v(o){return function(e){return"boolean"==typeof e}(o)||n(o)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(o)||!t(o)||e(o)&&o.every(v)||r(o)&&Object.values(o).every(v)}function h(r,u){return _async_to_generator(function(r,u){var c,l,s,f=arguments;return _ts_generator(this,function(y){return l=(c=f.length>2&&void 0!==f[2]?f[2]:{}).collector,s=c.consent,[2,(e(u)?u:[u]).reduce(function(u,f){return _async_to_generator(function(){var y,_,p,b,v,g,m,w,O,j,P,S,k,I,A,E,D,x,T,G,N;return _ts_generator(this,function(R){switch(R.label){case 0:return[4,u];case 1:return(y=R.sent())?[2,y]:(_=n(f)?{key:f}:f,Object.keys(_).length?(p=_.condition,b=_.consent,v=_.fn,g=_.key,m=_.loop,w=_.map,O=_.set,j=_.validate,P=_.value,(S=p)?[4,a(p)(r,f,l)]:[3,3]):[2]);case 2:S=!R.sent(),R.label=3;case 3:return S?[2]:b&&!function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r={},n=void 0===e;return Object.keys(t).forEach(function(o){t[o]&&(r[o]=!0,e&&e[o]&&(n=!0))}),!!n&&r}(b,s)?[2,P]:(k=t(P)?P:r,v?[4,a(v)(r,f,c)]:[3,5]);case 4:k=R.sent(),R.label=5;case 5:return g&&(k=d(r,g,P)),m?(I=_sliced_to_array(m,2),A=I[0],E=I[1],"this"!==A?[3,6]:(x=[r],[3,8])):[3,11];case 6:return[4,i(r,A,c)];case 7:x=R.sent(),R.label=8;case 8:return e(D=x)?[4,Promise.all(D.map(function(e){return i(e,E,c)}))]:[3,10];case 9:k=R.sent().filter(t),R.label=10;case 10:return[3,17];case 11:return w?[4,Object.entries(w).reduce(function(e,n){var o=_sliced_to_array(n,2),a=o[0],u=o[1];return _async_to_generator(function(){var n,o;return _ts_generator(this,function(l){switch(l.label){case 0:return[4,e];case 1:return n=l.sent(),[4,i(r,u,c)];case 2:return o=l.sent(),[2,(t(o)&&(n[a]=o),n)]}})})()},Promise.resolve({}))]:[3,13];case 12:return k=R.sent(),[3,16];case 13:return(T=O)?[4,Promise.all(O.map(function(e){return h(r,e,c)}))]:[3,15];case 14:T=k=R.sent(),R.label=15;case 15:R.label=16;case 16:R.label=17;case 17:return(G=j)?[4,a(j)(k)]:[3,19];case 18:G=!R.sent(),R.label=19;case 19:return G&&(k=void 0),N=o(k),[2,t(N)?N:o(P)]}})})()},Promise.resolve(void 0))]})}).apply(this,arguments)}var g,m={},w={type:"piwikpro",config:{},init:function(e){var t=e.config,r=e.env,n=e.logger,o=u(r).window,a=t.settings,i=t.loadScript,c=a||{},l=c.appId,s=c.url;l||n.throw("Config settings appId missing"),s||n.throw("Config settings url missing"),o._paq=o._paq||[];var f=o._paq.push;i&&(!function(e,t){var r=u(t).document,n=r.createElement("script");n.type="text/javascript",n.src=e+"ppms.js",n.async=!0,n.defer=!0,r.head.appendChild(n)}(s,r),f(["setTrackerUrl",s+"ppms.php"]),f(["setSiteId",l])),!1!==(null==a?void 0:a.linkTracking)&&f(["enableLinkTracking"])},push:function(t,r){return _async_to_generator(function(t,r){var n,o,a,c,l,s,f,y,_,p,b;return _ts_generator(this,function(d){switch(d.label){case 0:return n=r.mapping,o=void 0===n?{}:n,a=r.data,c=r.env,l=u(c),s=l.window,f=s._paq.push,"page view"!==t.name||o.settings?[3,2]:(y=["trackPageView"],[4,i(t,"data.title")]);case 1:return f.apply(void 0,[y.concat([d.sent()])]),[2];case 2:return _=o.settings||{},p=e(a)?a:[a],f([t.name].concat(_to_consumable_array(p))),_.goalId&&(b=_.goalValue?i(t,_.goalValue):void 0,f(["trackGoal",_.goalId,b])),[2]}})}).apply(this,arguments)}},O=w;return g=y,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var u,y=function(){var o=u.value;f.call(e,o)||o===r||c(e,o,{get:function(){return t[o]},enumerable:!(n=l(t,o))||n.enumerable})},_=s(t)[Symbol.iterator]();!(o=(u=_.next()).done);o=!0)y()}catch(e){a=!0,i=e}finally{try{o||null==_.return||_.return()}finally{if(a)throw i}}}return e}(c({},"__esModule",{value:!0}),g)}();
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,r={};((e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})})(r,{DestinationPiwikPro:()=>p,default:()=>g,destinationPiwikPro:()=>c}),module.exports=(e=r,((e,r,o,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let p of n(r))i.call(e,p)||p===o||t(e,p,{get:()=>r[p],enumerable:!(s=a(r,p))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o=require("@walkeros/core"),s=require("@walkeros/web-core"),p={},c={type:"piwikpro",config:{},init({config:e,env:t,logger:a}){const{window:n}=(0,s.getEnv)(t),i=n,{settings:r,loadScript:o}=e,{appId:p,url:c}=r||{};p||a.throw("Config settings appId missing"),c||a.throw("Config settings url missing"),i._paq=i._paq||[];const g=i._paq.push;o&&(!function(e,t){const{document:a}=(0,s.getEnv)(t),n=a,i=n.createElement("script");i.type="text/javascript",i.src=e+"ppms.js",i.async=!0,i.defer=!0,n.head.appendChild(i)}(c,t),g(["setTrackerUrl",c+"ppms.php"]),g(["setSiteId",p])),!1!==(null==r?void 0:r.linkTracking)&&g(["enableLinkTracking"])},async push(e,{mapping:t={},data:a,env:n}){const{window:i}=(0,s.getEnv)(n),r=i._paq.push;if("page view"===e.name&&!t.settings)return void r(["trackPageView",await(0,o.getMappingValue)(e,"data.title")]);const p=t.settings||{},c=(0,o.isArray)(a)?a:[a];if(r([e.name,...c]),p.goalId){const t=p.goalValue?(0,o.getMappingValue)(e,p.goalValue):void 0;r(["trackGoal",p.goalId,t])}}};var g=c;//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Mapping, Destination } from './types';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getMappingValue, isArray } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPiwikPro from './types';\n\nexport const destinationPiwikPro: Destination = {\n type: 'piwikpro',\n\n config: {},\n\n init({ config, env, logger }) {\n const { window } = getEnv(env);\n const w = window as Window;\n const { settings, loadScript } = config;\n const { appId, url } = settings || {};\n\n // Required parameters\n if (!appId) logger.throw('Config settings appId missing');\n if (!url) logger.throw('Config settings url missing');\n\n // Set up the Piwik Pro interface _paq\n w._paq = w._paq || [];\n\n const paq = w._paq.push;\n if (loadScript) {\n // Load the JavaScript Tracking Client\n addScript(url!, env);\n\n // Register the tracker url only with script loading\n paq(['setTrackerUrl', url + 'ppms.php']);\n\n // Register app id\n paq(['setSiteId', appId]);\n }\n\n // Enable download and outlink tracking if not disabled\n if (settings?.linkTracking !== false) paq(['enableLinkTracking']);\n },\n\n async push(event, { mapping = {}, data, env }) {\n const { window } = getEnv(env);\n const paq = (window as Window)._paq!.push;\n\n // Send pageviews if not disabled\n if (event.name === 'page view' && !mapping.settings) {\n paq(['trackPageView', await getMappingValue(event, 'data.title')]);\n return;\n }\n\n const eventMapping: Mapping = mapping.settings || {};\n\n const parameters = isArray(data) ? data : [data];\n\n paq([event.name, ...parameters]);\n\n if (eventMapping.goalId) {\n const goalValue = eventMapping.goalValue\n ? getMappingValue(event, eventMapping.goalValue)\n : undefined;\n\n paq([\n 'trackGoal',\n eventMapping.goalId,\n goalValue,\n // @TODO dimensions\n ]);\n }\n },\n};\n\nfunction addScript(url: string, env?: DestinationWeb.Env) {\n const { document } = getEnv(env);\n const doc = document as Document;\n const script = doc.createElement('script');\n script.type = 'text/javascript';\n script.src = url + 'ppms.js';\n script.async = true;\n script.defer = true;\n doc.head.appendChild(script);\n}\n\nexport default destinationPiwikPro;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _paq?: Array<unknown>;\n }\n}\n\nexport interface Settings {\n appId: string;\n linkTracking?: boolean;\n url: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n goalId?: string;\n goalValue?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n _paq: Array<unknown>;\n };\n document: {\n createElement: (tagName: string) => {\n type: string;\n src: string;\n async?: boolean;\n defer?: boolean;\n };\n head: {\n appendChild: (node: unknown) => void;\n };\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 type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport interface Dimensions {\n [i: number]: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAyC;AACzC,sBAAuB;;;ACHvB;;;ADQO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG;AAC5B,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,IAAI;AACV,UAAM,EAAE,UAAU,WAAW,IAAI;AACjC,UAAM,EAAE,OAAO,IAAI,IAAI,YAAY,CAAC;AAGpC,QAAI,CAAC,MAAO,QAAO,MAAM,+BAA+B;AACxD,QAAI,CAAC,IAAK,QAAO,MAAM,6BAA6B;AAGpD,MAAE,OAAO,EAAE,QAAQ,CAAC;AAEpB,UAAM,MAAM,EAAE,KAAK;AACnB,QAAI,YAAY;AAEd,gBAAU,KAAM,GAAG;AAGnB,UAAI,CAAC,iBAAiB,MAAM,UAAU,CAAC;AAGvC,UAAI,CAAC,aAAa,KAAK,CAAC;AAAA,IAC1B;AAGA,SAAI,qCAAU,kBAAiB,MAAO,KAAI,CAAC,oBAAoB,CAAC;AAAA,EAClE;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,UAAU,CAAC,GAAG,MAAM,IAAI,GAAG;AAC7C,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,MAAO,OAAkB,KAAM;AAGrC,QAAI,MAAM,SAAS,eAAe,CAAC,QAAQ,UAAU;AACnD,UAAI,CAAC,iBAAiB,UAAM,6BAAgB,OAAO,YAAY,CAAC,CAAC;AACjE;AAAA,IACF;AAEA,UAAM,eAAwB,QAAQ,YAAY,CAAC;AAEnD,UAAM,iBAAa,qBAAQ,IAAI,IAAI,OAAO,CAAC,IAAI;AAE/C,QAAI,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AAE/B,QAAI,aAAa,QAAQ;AACvB,YAAM,YAAY,aAAa,gBAC3B,6BAAgB,OAAO,aAAa,SAAS,IAC7C;AAEJ,UAAI;AAAA,QACF;AAAA,QACA,aAAa;AAAA,QACb;AAAA;AAAA,MAEF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,SAAS,UAAU,KAAa,KAA0B;AACxD,QAAM,EAAE,SAAS,QAAI,wBAAO,GAAG;AAC/B,QAAM,MAAM;AACZ,QAAM,SAAS,IAAI,cAAc,QAAQ;AACzC,SAAO,OAAO;AACd,SAAO,MAAM,MAAM;AACnB,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,MAAI,KAAK,YAAY,MAAM;AAC7B;AAEA,IAAO,gBAAQ;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{getMappingValue as t,isArray as a}from"@walkeros/core";import{getEnv as i}from"@walkeros/web-core";var e={},n={type:"piwikpro",config:{},init({config:t,env:a,logger:e}){const{window:n}=i(a),o=n,{settings:s,loadScript:r}=t,{appId:p,url:c}=s||{};p||e.throw("Config settings appId missing"),c||e.throw("Config settings url missing"),o._paq=o._paq||[];const g=o._paq.push;r&&(!function(t,a){const{document:e}=i(a),n=e,o=n.createElement("script");o.type="text/javascript",o.src=t+"ppms.js",o.async=!0,o.defer=!0,n.head.appendChild(o)}(c,a),g(["setTrackerUrl",c+"ppms.php"]),g(["setSiteId",p])),!1!==(null==s?void 0:s.linkTracking)&&g(["enableLinkTracking"])},async push(e,{mapping:n={},data:o,env:s}){const{window:r}=i(s),p=r._paq.push;if("page view"===e.name&&!n.settings)return void p(["trackPageView",await t(e,"data.title")]);const c=n.settings||{},g=a(o)?o:[o];if(p([e.name,...g]),c.goalId){const a=c.goalValue?t(e,c.goalValue):void 0;p(["trackGoal",c.goalId,a])}}};var o=n;export{e as DestinationPiwikPro,o as default,n as destinationPiwikPro};//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Mapping, Destination } from './types';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getMappingValue, isArray } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPiwikPro from './types';\n\nexport const destinationPiwikPro: Destination = {\n type: 'piwikpro',\n\n config: {},\n\n init({ config, env, logger }) {\n const { window } = getEnv(env);\n const w = window as Window;\n const { settings, loadScript } = config;\n const { appId, url } = settings || {};\n\n // Required parameters\n if (!appId) logger.throw('Config settings appId missing');\n if (!url) logger.throw('Config settings url missing');\n\n // Set up the Piwik Pro interface _paq\n w._paq = w._paq || [];\n\n const paq = w._paq.push;\n if (loadScript) {\n // Load the JavaScript Tracking Client\n addScript(url!, env);\n\n // Register the tracker url only with script loading\n paq(['setTrackerUrl', url + 'ppms.php']);\n\n // Register app id\n paq(['setSiteId', appId]);\n }\n\n // Enable download and outlink tracking if not disabled\n if (settings?.linkTracking !== false) paq(['enableLinkTracking']);\n },\n\n async push(event, { mapping = {}, data, env }) {\n const { window } = getEnv(env);\n const paq = (window as Window)._paq!.push;\n\n // Send pageviews if not disabled\n if (event.name === 'page view' && !mapping.settings) {\n paq(['trackPageView', await getMappingValue(event, 'data.title')]);\n return;\n }\n\n const eventMapping: Mapping = mapping.settings || {};\n\n const parameters = isArray(data) ? data : [data];\n\n paq([event.name, ...parameters]);\n\n if (eventMapping.goalId) {\n const goalValue = eventMapping.goalValue\n ? getMappingValue(event, eventMapping.goalValue)\n : undefined;\n\n paq([\n 'trackGoal',\n eventMapping.goalId,\n goalValue,\n // @TODO dimensions\n ]);\n }\n },\n};\n\nfunction addScript(url: string, env?: DestinationWeb.Env) {\n const { document } = getEnv(env);\n const doc = document as Document;\n const script = doc.createElement('script');\n script.type = 'text/javascript';\n script.src = url + 'ppms.js';\n script.async = true;\n script.defer = true;\n doc.head.appendChild(script);\n}\n\nexport default destinationPiwikPro;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _paq?: Array<unknown>;\n }\n}\n\nexport interface Settings {\n appId: string;\n linkTracking?: boolean;\n url: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\nexport interface Mapping {\n goalId?: string;\n goalValue?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n _paq: Array<unknown>;\n };\n document: {\n createElement: (tagName: string) => {\n type: string;\n src: string;\n async?: boolean;\n defer?: boolean;\n };\n head: {\n appendChild: (node: unknown) => void;\n };\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 type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport interface Dimensions {\n [i: number]: string;\n}\n"],"mappings":";AAEA,SAAS,iBAAiB,eAAe;AACzC,SAAS,cAAc;;;ACHvB;;;ADQO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,KAAK,OAAO,GAAG;AAC5B,UAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,UAAM,IAAI;AACV,UAAM,EAAE,UAAU,WAAW,IAAI;AACjC,UAAM,EAAE,OAAO,IAAI,IAAI,YAAY,CAAC;AAGpC,QAAI,CAAC,MAAO,QAAO,MAAM,+BAA+B;AACxD,QAAI,CAAC,IAAK,QAAO,MAAM,6BAA6B;AAGpD,MAAE,OAAO,EAAE,QAAQ,CAAC;AAEpB,UAAM,MAAM,EAAE,KAAK;AACnB,QAAI,YAAY;AAEd,gBAAU,KAAM,GAAG;AAGnB,UAAI,CAAC,iBAAiB,MAAM,UAAU,CAAC;AAGvC,UAAI,CAAC,aAAa,KAAK,CAAC;AAAA,IAC1B;AAGA,SAAI,qCAAU,kBAAiB,MAAO,KAAI,CAAC,oBAAoB,CAAC;AAAA,EAClE;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,UAAU,CAAC,GAAG,MAAM,IAAI,GAAG;AAC7C,UAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,UAAM,MAAO,OAAkB,KAAM;AAGrC,QAAI,MAAM,SAAS,eAAe,CAAC,QAAQ,UAAU;AACnD,UAAI,CAAC,iBAAiB,MAAM,gBAAgB,OAAO,YAAY,CAAC,CAAC;AACjE;AAAA,IACF;AAEA,UAAM,eAAwB,QAAQ,YAAY,CAAC;AAEnD,UAAM,aAAa,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI;AAE/C,QAAI,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AAE/B,QAAI,aAAa,QAAQ;AACvB,YAAM,YAAY,aAAa,YAC3B,gBAAgB,OAAO,aAAa,SAAS,IAC7C;AAEJ,UAAI;AAAA,QACF;AAAA,QACA,aAAa;AAAA,QACb;AAAA;AAAA,MAEF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,SAAS,UAAU,KAAa,KAA0B;AACxD,QAAM,EAAE,SAAS,IAAI,OAAO,GAAG;AAC/B,QAAM,MAAM;AACZ,QAAM,SAAS,IAAI,cAAc,QAAQ;AACzC,SAAO,OAAO;AACd,SAAO,MAAM,MAAM;AACnB,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,MAAI,KAAK,YAAY,MAAM;AAC7B;AAEA,IAAO,gBAAQ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@walkeros/web-destination-piwikpro",
3
+ "description": "Piwik PRO destination for walkerOS",
4
+ "version": "0.0.0-next-20251219153324",
5
+ "license": "MIT",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./examples": {
16
+ "types": "./dist/examples/index.d.ts",
17
+ "import": "./dist/examples/index.mjs",
18
+ "require": "./dist/examples/index.js"
19
+ },
20
+ "./dev": {
21
+ "types": "./dist/dev.d.ts",
22
+ "import": "./dist/dev.mjs",
23
+ "require": "./dist/dev.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist/**"
28
+ ],
29
+ "scripts": {
30
+ "build": "tsup --silent",
31
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
32
+ "dev": "jest --watchAll --colors",
33
+ "lint": "tsc && eslint \"**/*.ts*\"",
34
+ "test": "jest",
35
+ "update": "npx npm-check-updates -u && npm update"
36
+ },
37
+ "dependencies": {
38
+ "@walkeros/core": "0.0.0-next-20251219153324",
39
+ "@walkeros/web-core": "0.0.0-next-20251219153324"
40
+ },
41
+ "devDependencies": {},
42
+ "repository": {
43
+ "url": "git+https://github.com/elbwalker/walkerOS.git",
44
+ "directory": "packages/web/destinations/piwikpro"
45
+ },
46
+ "author": "elbwalker <hello@elbwalker.com>",
47
+ "homepage": "https://github.com/elbwalker/walkerOS#readme",
48
+ "bugs": {
49
+ "url": "https://github.com/elbwalker/walkerOS/issues"
50
+ },
51
+ "keywords": [
52
+ "walker",
53
+ "walkerOS",
54
+ "destination",
55
+ "web",
56
+ "piwik pro"
57
+ ],
58
+ "funding": [
59
+ {
60
+ "type": "GitHub Sponsors",
61
+ "url": "https://github.com/sponsors/elbwalker"
62
+ }
63
+ ]
64
+ }