@walkeros/web-destination-matomo 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 +42 -0
- package/dist/dev.d.mts +19 -15
- package/dist/dev.d.ts +19 -15
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +18 -14
- package/dist/examples/index.d.ts +18 -14
- package/dist/examples/index.js +28 -23
- package/dist/examples/index.mjs +29 -24
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +0 -11
- package/dist/index.d.ts +0 -11
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +140 -32
- package/package.json +4 -4
package/dist/examples/index.d.ts
CHANGED
|
@@ -29,23 +29,12 @@ interface Env extends DestinationWeb.Env {
|
|
|
29
29
|
href?: string;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
document: {
|
|
33
|
-
createElement: (tagName: string) => {
|
|
34
|
-
type: string;
|
|
35
|
-
src: string;
|
|
36
|
-
async?: boolean;
|
|
37
|
-
defer?: boolean;
|
|
38
|
-
};
|
|
39
|
-
head: {
|
|
40
|
-
appendChild: (node: unknown) => void;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
32
|
}
|
|
44
33
|
|
|
45
34
|
/**
|
|
46
35
|
* Example environment configurations for Matomo destination.
|
|
47
|
-
* Mocks the _paq command queue
|
|
48
|
-
*
|
|
36
|
+
* Mocks the _paq command queue for testing without requiring real browser
|
|
37
|
+
* or network.
|
|
49
38
|
*/
|
|
50
39
|
declare const init$1: Env | undefined;
|
|
51
40
|
declare const push: Env;
|
|
@@ -125,8 +114,21 @@ declare const goalTracking: StepExample;
|
|
|
125
114
|
* example stays out of them.
|
|
126
115
|
*/
|
|
127
116
|
declare const customDimensions: StepExample;
|
|
117
|
+
/** A silent rule without a goal sends nothing. */
|
|
118
|
+
declare const silentRule: StepExample;
|
|
119
|
+
/**
|
|
120
|
+
* An event no rule maps: Matomo has no command for it, so the push fails
|
|
121
|
+
* instead of counting as delivered.
|
|
122
|
+
*/
|
|
123
|
+
declare const unmappedEvent: StepExample;
|
|
124
|
+
/**
|
|
125
|
+
* A revocation of the consent the destination requires stops Matomo:
|
|
126
|
+
* config.consent { marketing: true }, granted first, then revoked.
|
|
127
|
+
*/
|
|
128
|
+
declare const consentRevoke: StepExample;
|
|
128
129
|
|
|
129
130
|
type step_StepExample = StepExample;
|
|
131
|
+
declare const step_consentRevoke: typeof consentRevoke;
|
|
130
132
|
declare const step_customDimensions: typeof customDimensions;
|
|
131
133
|
declare const step_customEvent: typeof customEvent;
|
|
132
134
|
declare const step_ecommerceCartUpdate: typeof ecommerceCartUpdate;
|
|
@@ -136,9 +138,11 @@ declare const step_init: typeof init;
|
|
|
136
138
|
declare const step_pageView: typeof pageView;
|
|
137
139
|
declare const step_pageViewWithGoal: typeof pageViewWithGoal;
|
|
138
140
|
declare const step_productDetailView: typeof productDetailView;
|
|
141
|
+
declare const step_silentRule: typeof silentRule;
|
|
139
142
|
declare const step_siteSearch: typeof siteSearch;
|
|
143
|
+
declare const step_unmappedEvent: typeof unmappedEvent;
|
|
140
144
|
declare namespace step {
|
|
141
|
-
export { type step_StepExample as StepExample, step_customDimensions as customDimensions, step_customEvent as customEvent, step_ecommerceCartUpdate as ecommerceCartUpdate, step_ecommerceOrder as ecommerceOrder, step_goalTracking as goalTracking, step_init as init, step_pageView as pageView, step_pageViewWithGoal as pageViewWithGoal, step_productDetailView as productDetailView, step_siteSearch as siteSearch };
|
|
145
|
+
export { type step_StepExample as StepExample, step_consentRevoke as consentRevoke, step_customDimensions as customDimensions, step_customEvent as customEvent, step_ecommerceCartUpdate as ecommerceCartUpdate, step_ecommerceOrder as ecommerceOrder, step_goalTracking as goalTracking, step_init as init, step_pageView as pageView, step_pageViewWithGoal as pageViewWithGoal, step_productDetailView as productDetailView, step_silentRule as silentRule, step_siteSearch as siteSearch, step_unmappedEvent as unmappedEvent };
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
export { env, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -36,32 +36,12 @@ var init = {
|
|
|
36
36
|
window: {
|
|
37
37
|
// _paq absent: init() is expected to install the queue.
|
|
38
38
|
location: { href: "https://www.example.com/page" }
|
|
39
|
-
},
|
|
40
|
-
document: {
|
|
41
|
-
createElement: () => ({
|
|
42
|
-
type: "",
|
|
43
|
-
src: "",
|
|
44
|
-
async: false,
|
|
45
|
-
defer: false
|
|
46
|
-
}),
|
|
47
|
-
head: { appendChild: () => {
|
|
48
|
-
} }
|
|
49
39
|
}
|
|
50
40
|
};
|
|
51
41
|
var push = {
|
|
52
42
|
window: {
|
|
53
43
|
_paq: [],
|
|
54
44
|
location: { href: "https://www.example.com/page" }
|
|
55
|
-
},
|
|
56
|
-
document: {
|
|
57
|
-
createElement: () => ({
|
|
58
|
-
type: "",
|
|
59
|
-
src: "",
|
|
60
|
-
async: false,
|
|
61
|
-
defer: false
|
|
62
|
-
}),
|
|
63
|
-
head: { appendChild: () => {
|
|
64
|
-
} }
|
|
65
45
|
}
|
|
66
46
|
};
|
|
67
47
|
var simulation = [
|
|
@@ -72,6 +52,7 @@ var simulation = [
|
|
|
72
52
|
// src/examples/step.ts
|
|
73
53
|
var step_exports = {};
|
|
74
54
|
__export(step_exports, {
|
|
55
|
+
consentRevoke: () => consentRevoke,
|
|
75
56
|
customDimensions: () => customDimensions,
|
|
76
57
|
customEvent: () => customEvent,
|
|
77
58
|
ecommerceCartUpdate: () => ecommerceCartUpdate,
|
|
@@ -81,7 +62,9 @@ __export(step_exports, {
|
|
|
81
62
|
pageView: () => pageView,
|
|
82
63
|
pageViewWithGoal: () => pageViewWithGoal,
|
|
83
64
|
productDetailView: () => productDetailView,
|
|
84
|
-
|
|
65
|
+
silentRule: () => silentRule,
|
|
66
|
+
siteSearch: () => siteSearch,
|
|
67
|
+
unmappedEvent: () => unmappedEvent
|
|
85
68
|
});
|
|
86
69
|
var import_core = require("@walkeros/core");
|
|
87
70
|
var init2 = {
|
|
@@ -171,7 +154,7 @@ var ecommerceOrder = {
|
|
|
171
154
|
{
|
|
172
155
|
map: {
|
|
173
156
|
orderId: "data.id",
|
|
174
|
-
grandTotal: "data.
|
|
157
|
+
grandTotal: "data.value",
|
|
175
158
|
tax: "data.taxes",
|
|
176
159
|
shipping: "data.shipping"
|
|
177
160
|
}
|
|
@@ -301,7 +284,8 @@ var productDetailView = {
|
|
|
301
284
|
var siteSearch = {
|
|
302
285
|
title: "Site search",
|
|
303
286
|
description: "A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",
|
|
304
|
-
in: (0, import_core.
|
|
287
|
+
in: (0, import_core.createEvent)({
|
|
288
|
+
name: "search submit",
|
|
305
289
|
timestamp: 1700000405,
|
|
306
290
|
data: { query: "shoes", category: "products", resultsCount: 42 }
|
|
307
291
|
}),
|
|
@@ -359,6 +343,27 @@ var customDimensions = {
|
|
|
359
343
|
["_paq.push", ["setCustomDimension", 1, "docs"]]
|
|
360
344
|
]
|
|
361
345
|
};
|
|
346
|
+
var silentRule = {
|
|
347
|
+
public: false,
|
|
348
|
+
description: "A rule with silent: true and no goal sends no command, its dimensions included.",
|
|
349
|
+
in: (0, import_core.getEvent)("page view", { timestamp: 1700000300 }),
|
|
350
|
+
mapping: { silent: true },
|
|
351
|
+
out: []
|
|
352
|
+
};
|
|
353
|
+
var unmappedEvent = {
|
|
354
|
+
public: false,
|
|
355
|
+
description: "An event without a rule name, a tracking flag or a goal, and not a page view, has no Matomo command: the push fails with missing-input.",
|
|
356
|
+
in: (0, import_core.getEvent)("product view", { timestamp: 1700000301 }),
|
|
357
|
+
out: [],
|
|
358
|
+
outcome: { status: "failed", code: "missing-input", retryable: false }
|
|
359
|
+
};
|
|
360
|
+
var consentRevoke = {
|
|
361
|
+
public: false,
|
|
362
|
+
description: "For a destination with config.consent { marketing: true }, revoking marketing pushes forgetConsentGiven, which stops every tracking request of the page, link tracking included.",
|
|
363
|
+
command: "consent",
|
|
364
|
+
in: { marketing: false },
|
|
365
|
+
out: [["window._paq.push", ["forgetConsentGiven"]]]
|
|
366
|
+
};
|
|
362
367
|
// Annotate the CommonJS export names for ESM import in node:
|
|
363
368
|
0 && (module.exports = {
|
|
364
369
|
env,
|
package/dist/examples/index.mjs
CHANGED
|
@@ -15,32 +15,12 @@ var init = {
|
|
|
15
15
|
window: {
|
|
16
16
|
// _paq absent: init() is expected to install the queue.
|
|
17
17
|
location: { href: "https://www.example.com/page" }
|
|
18
|
-
},
|
|
19
|
-
document: {
|
|
20
|
-
createElement: () => ({
|
|
21
|
-
type: "",
|
|
22
|
-
src: "",
|
|
23
|
-
async: false,
|
|
24
|
-
defer: false
|
|
25
|
-
}),
|
|
26
|
-
head: { appendChild: () => {
|
|
27
|
-
} }
|
|
28
18
|
}
|
|
29
19
|
};
|
|
30
20
|
var push = {
|
|
31
21
|
window: {
|
|
32
22
|
_paq: [],
|
|
33
23
|
location: { href: "https://www.example.com/page" }
|
|
34
|
-
},
|
|
35
|
-
document: {
|
|
36
|
-
createElement: () => ({
|
|
37
|
-
type: "",
|
|
38
|
-
src: "",
|
|
39
|
-
async: false,
|
|
40
|
-
defer: false
|
|
41
|
-
}),
|
|
42
|
-
head: { appendChild: () => {
|
|
43
|
-
} }
|
|
44
24
|
}
|
|
45
25
|
};
|
|
46
26
|
var simulation = [
|
|
@@ -51,6 +31,7 @@ var simulation = [
|
|
|
51
31
|
// src/examples/step.ts
|
|
52
32
|
var step_exports = {};
|
|
53
33
|
__export(step_exports, {
|
|
34
|
+
consentRevoke: () => consentRevoke,
|
|
54
35
|
customDimensions: () => customDimensions,
|
|
55
36
|
customEvent: () => customEvent,
|
|
56
37
|
ecommerceCartUpdate: () => ecommerceCartUpdate,
|
|
@@ -60,9 +41,11 @@ __export(step_exports, {
|
|
|
60
41
|
pageView: () => pageView,
|
|
61
42
|
pageViewWithGoal: () => pageViewWithGoal,
|
|
62
43
|
productDetailView: () => productDetailView,
|
|
63
|
-
|
|
44
|
+
silentRule: () => silentRule,
|
|
45
|
+
siteSearch: () => siteSearch,
|
|
46
|
+
unmappedEvent: () => unmappedEvent
|
|
64
47
|
});
|
|
65
|
-
import { getEvent } from "@walkeros/core";
|
|
48
|
+
import { createEvent, getEvent } from "@walkeros/core";
|
|
66
49
|
var init2 = {
|
|
67
50
|
title: "Initialization",
|
|
68
51
|
description: "Destination bootstrap loads the Matomo tracker script and configures the tracker URL and site id.",
|
|
@@ -150,7 +133,7 @@ var ecommerceOrder = {
|
|
|
150
133
|
{
|
|
151
134
|
map: {
|
|
152
135
|
orderId: "data.id",
|
|
153
|
-
grandTotal: "data.
|
|
136
|
+
grandTotal: "data.value",
|
|
154
137
|
tax: "data.taxes",
|
|
155
138
|
shipping: "data.shipping"
|
|
156
139
|
}
|
|
@@ -280,7 +263,8 @@ var productDetailView = {
|
|
|
280
263
|
var siteSearch = {
|
|
281
264
|
title: "Site search",
|
|
282
265
|
description: "A search submit fires Matomo trackSiteSearch with the keyword, category, and number of results.",
|
|
283
|
-
in:
|
|
266
|
+
in: createEvent({
|
|
267
|
+
name: "search submit",
|
|
284
268
|
timestamp: 1700000405,
|
|
285
269
|
data: { query: "shoes", category: "products", resultsCount: 42 }
|
|
286
270
|
}),
|
|
@@ -338,6 +322,27 @@ var customDimensions = {
|
|
|
338
322
|
["_paq.push", ["setCustomDimension", 1, "docs"]]
|
|
339
323
|
]
|
|
340
324
|
};
|
|
325
|
+
var silentRule = {
|
|
326
|
+
public: false,
|
|
327
|
+
description: "A rule with silent: true and no goal sends no command, its dimensions included.",
|
|
328
|
+
in: getEvent("page view", { timestamp: 1700000300 }),
|
|
329
|
+
mapping: { silent: true },
|
|
330
|
+
out: []
|
|
331
|
+
};
|
|
332
|
+
var unmappedEvent = {
|
|
333
|
+
public: false,
|
|
334
|
+
description: "An event without a rule name, a tracking flag or a goal, and not a page view, has no Matomo command: the push fails with missing-input.",
|
|
335
|
+
in: getEvent("product view", { timestamp: 1700000301 }),
|
|
336
|
+
out: [],
|
|
337
|
+
outcome: { status: "failed", code: "missing-input", retryable: false }
|
|
338
|
+
};
|
|
339
|
+
var consentRevoke = {
|
|
340
|
+
public: false,
|
|
341
|
+
description: "For a destination with config.consent { marketing: true }, revoking marketing pushes forgetConsentGiven, which stops every tracking request of the page, link tracking included.",
|
|
342
|
+
command: "consent",
|
|
343
|
+
in: { marketing: false },
|
|
344
|
+
out: [["window._paq.push", ["forgetConsentGiven"]]]
|
|
345
|
+
};
|
|
341
346
|
export {
|
|
342
347
|
env_exports as env,
|
|
343
348
|
step_exports as step
|
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o={};((t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})})(o,{DestinationMatomo:()=>L,default:()=>H,destinationMatomo:()=>G});var i=Object.defineProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})};function s(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}c({},{stepId:()=>s});function a(e,t){const n=e.destinations[t];if(!n)throw new Error(`Destination not found: ${t}`);return n}c({},{getDestination:()=>a});c({},{Level:()=>f});var u,f=((u=f||{})[u.ERROR=0]="ERROR",u[u.WARN=1]="WARN",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u);function l(e,t){const n=e.transformers[t];if(!n)throw new Error(`Transformer not found: ${t}`);return n}c({},{getTransformer:()=>l});function p(e,t){const n=e.sources[t];if(!n)throw new Error(`Source not found: ${t}`);return n}c({},{getSource:()=>p});function d(e,t){const n=e.stores[t];if(!n)throw new Error(`Store not found: ${t}`);return n}async function g(e,t){return await e.get(t)}function v(e){return Array.isArray(e)}function y(e){return void 0!==e}function m(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function w(e){return"object"==typeof e&&null!==e&&!v(e)&&"[object Object]"===Object.prototype.toString.call(e)}function h(e){return"string"==typeof e}function b(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&v(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=b(e,t,n);i.push(r)}return i}if(o=w(o)||v(o)?o[t]:void 0,void 0===o)break}return y(o)?o:n}function O(e){return function(e){return"boolean"==typeof e}(e)||h(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!y(e)||v(e)&&e.every(O)||w(e)&&Object.values(e).every(O)}function j(e){return O(e)?e:void 0}function P(e,t,n){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}c({},{getStore:()=>d,getStoreValue:()=>g});var R=class e extends Error{constructor(t,n){super(t,n),this.name="FatalError",Object.setPrototypeOf(this,e.prototype)}};async function k(e,t={},n){var r;if(!n.collector)throw new Error("getMappingValue: context.collector is required");const o=n.consent||n.collector.consent,i=null!=(r=n.event)?r:{},c={event:i,mapping:t,collector:n.collector,logger:n.collector.logger,consent:o},s=v(t)?t:[t];for(const t of s){const r=await P(E,e=>{if(e instanceof R)throw e;n.collector.status.failed++,c.logger.error("mapping processing failed",{event:i,error:e})})(e,t,{...c,mapping:t});if(y(r))return r}}async function E(e,t,n){return(v(t)?t:[t]).reduce(async(t,r)=>{const o=await t;if(o)return o;const i=h(r)?{key:r}:r;if(!Object.keys(i).length)return;const{condition:c,consent:s,fn:a,key:u,loop:f,map:l,set:p,validate:d,value:g}=i,m={...n,mapping:r};if(c&&!await P(c,e=>{if(e instanceof R)throw e;return m.logger.error("mapping condition failed",{event:m.event,error:e}),!1})(e,m))return;if(s&&!function(e,t={},n={}){const r={...t,...n},o={};let i=!e||0===Object.keys(e).length;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}(s,m.consent))return g;let w=y(g)?g:e;if(f){const[t,n]=f,r="this"===t?[e]:await k(e,t,m);w=v(r)?(await Promise.all(r.map(e=>y(e)?k(e,n,m):void 0))).filter(y):void 0}else l?w=await Object.entries(l).reduce(async(t,[n,r])=>{const o=await t,i=await k(e,r,m);return y(i)&&(o[n]=i),o},Promise.resolve({})):p?w=await Promise.all(p.map(t=>E(e,t,m))):u?w=b(e,u,g):a&&(w=await P(a,e=>{if(e instanceof R)throw e;m.logger.error("mapping fn failed",{event:m.event,error:e})})(e,m));d&&!await P(d,e=>{if(e instanceof R)throw e;return m.logger.error("mapping validate failed",{event:m.event,error:e}),!1})(w,m)&&(w=void 0);const O=j(w);return y(O)?O:j(g)},Promise.resolve(void 0))}async function S(e,t={},n){var r,o;if(!y(e))return;const i=w(e)&&e.consent||(null==n?void 0:n.consent)||(null==(r=null==n?void 0:n.collector)?void 0:r.consent),c=null!=(o=null==n?void 0:n.event)?o:w(e)?e:{};return k(e,t,{...n,consent:i,event:c})}var $="observe";function _(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function I(e){return"function"==typeof e}function D(e){return"object"==typeof e&&null!==e}var N=["name","length","prototype","arguments","caller"];function A(e,t){if(-1!==N.indexOf(t))return!1;let n=e;for(;I(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!I(e)||!I(Object.getPrototypeOf(e)))return!1;n=e}return!1}function x(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function T(e,t){let n=e;for(const e of t){if(I(n)){if(!A(n,e))return!0;if(!x(n,e))return!1}else if(m(n)){if(!(e in n))return!0}else if(!D(n)||!(e in n))return!1;n=Reflect.get(n,e)}return I(n)}function C(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[$];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=typeof e||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;const{paths:t,record:n}=e;return Array.isArray(t)&&t.every(e=>"string"==typeof e)&&"function"==typeof n}(n)){delete t[$];const e=function(e,t,n){const r=[],o=[],i=[];for(const n of t){const t=_(n);if(0===t.length)continue;const r=t.join(".");i.push({rest:t,fn:r}),T(e,t)||o.push(r)}const c=new WeakMap,s=new WeakSet;function a(e,t){for(const o of e)if(n)try{n(o,t)}catch(e){}else r.push({fn:o,args:t,ts:Date.now()})}function u(e,t){return 0===t.length||f(e)?e:m(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>u(e,t)):I(e)?y(e,[],t):D(e)?p(e,t):e}function f(e){return(D(e)||I(e))&&s.has(e)}function l(e,t){const n=[],r=[];for(const o of e)o.rest[0]===t&&(1===o.rest.length?n.includes(o.fn)||n.push(o.fn):r.push({rest:o.rest.slice(1),fn:o.fn}));return{leafs:n,deeper:r}}function p(e,t){var n;const r=t.map(e=>`${e.fn}:${e.rest.join(".")}`).join("|"),o=null!=(n=c.get(e))?n:new Map;c.set(e,o);const i=o.get(r);if(i)return i;const s=d(e,t);return o.set(r,s),s}function d(e,t){return I(e)?g(e,t):t.some(t=>!x(e,t.rest[0]))?function(e,t){const n=Object.create(Object.getPrototypeOf(e)),r=v(e,t,()=>o),o=new Proxy(n,{get:(e,t)=>r.get(t),set:(t,n,r)=>Reflect.set(e,n,r,e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(t,n){const r=Reflect.getOwnPropertyDescriptor(e,n);return r&&{...r,configurable:!0}},defineProperty:(t,n,r)=>Reflect.defineProperty(e,n,r),deleteProperty:(t,n)=>Reflect.deleteProperty(e,n)});return s.add(o),o}(e,t):g(e,t)}function g(e,t){const n=v(e,t,()=>r),r=new Proxy(e,{get:(e,t)=>"string"!=typeof t||x(e,t)?n.get(t):Reflect.get(e,t,e),set:(e,t,n)=>Reflect.set(e,t,n,e)});return s.add(r),r}function v(e,t,n){const r=new Map;return{get(o){const i=Reflect.get(e,o,e);if("string"!=typeof o)return i;if(!I(i)&&!D(i))return i;if(f(i))return i;const c=r.get(o);if(c&&c.value===i)return c.out;const{leafs:s,deeper:a}=l(t,o);if(!(s.length>0||a.length>0)&&(!I(i)||function(e){if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return i;let u=i;return I(i)?u=y(i,s,a,{proxy:n(),target:e}):a.length>0&&(u=p(i,a)),r.set(o,{value:i,out:u}),u}}}function y(e,t,n,r){const o=()=>n.filter(t=>!A(e,t.rest[0])),i=new Map,c=new Proxy(e,{get(e,t){const r=Reflect.get(e,t,e);if("string"!=typeof t||!x(e,t))return r;if(!A(e,t))return r;const{leafs:o,deeper:s}=l(n,t);if(0===o.length&&0===s.length)return r;if(f(r))return r;const a=i.get(t);if(a&&a.value===r)return a.out;let u=r;return I(r)?u=y(r,o,s,{proxy:c,target:e}):D(r)&&s.length>0&&(u=p(r,s)),i.set(t,{value:r,out:u}),u},set:(e,t,n)=>Reflect.set(e,t,n,e),apply(e,n,i){a(t,i);const c=!r||n!==r.proxy&&void 0!==n?n:r.target;return u(Reflect.apply(e,c,i),o())},construct(e,n,r){a(t,n);const i=Reflect.construct(e,n,r===c?e:r),s=u(i,o());return D(s)||I(s)?s:i}});return s.add(c),c}return{env:d(e,i),calls:r,unresolved:o}}(t,n.paths,n.record).env,r=new Set;for(const e of n.paths){const n=_(e)[0];if(void 0===n)continue;const o=t[n];null!==o&&"object"==typeof o&&r.add(n)}const o=Array.from(r,t=>[t,e[t]]);for(const[e,n]of o)t[e]=n}return t}var M=/^\d+$/;async function q(e,t,n){const r={};if(!e)return r;for(const[o,i]of Object.entries(e)){const e=await S(t,i,{collector:n});r[o]=null==e?void 0:String(e)}return r}function V(e){return function(e){return Object.entries(e).filter(([e])=>M.test(e)).sort(([e],[t])=>Number(e)-Number(t))}(e).map(([e,t])=>void 0===t?["deleteCustomDimension",Number(e)]:["setCustomDimension",Number(e),t])}var B=new Set;function W(e,t,n,r){if(!B.has(t)&&B.size<1e3)return B.add(t),void e.warn(n,r);e.debug(n,r)}var L={},G={type:"matomo",config:{},init({config:e,env:t,logger:n}){const{window:r}=C(t),{settings:o={},loadScript:i}=e,{siteId:c,url:s}=o;r._paq=r._paq||[];const a=r._paq,u=e=>{a.push(e)};if(i){if(!c)return n.throw("Config settings siteId missing");if(!s)return n.throw("Config settings url missing");const e=function(e){return`${e.replace(/\/+$/,"")}/`}(s);!function(e,t){const{document:n}=C(t),r=n.createElement("script");r.type="text/javascript",r.src=e+"matomo.js",r.async=!0,r.defer=!0,n.head.appendChild(r)}(e,t),u(["setTrackerUrl",e+"matomo.php"]),u(["setSiteId",c])}o.disableCookies&&u(["disableCookies"]),!1!==o.enableLinkTracking&&u(["enableLinkTracking"]),o.enableHeartBeatTimer&&u(["enableHeartBeatTimer",o.enableHeartBeatTimer])},async push(e,{config:t,rule:n={},data:r,env:o,collector:i,logger:c,id:s}){const{window:a}=C(o),u=a._paq;if(!u)return void c.warn("Matomo _paq queue missing, init() not run");const f=e=>{u.push(e)},l=t.settings||{},p=n.settings||{},{goalId:d}=p,g=v(r)?r:[r],y=("number"==typeof(m=d)?Number.isInteger(m)&&m>0:"string"==typeof m&&K.test(m))?d:void 0;var m;let w;if(void 0!==d&&void 0===y&&W(c,`${s}|${e.name}|invalid goalId`,`Goal of event "${e.name}" skipped: goalId ${JSON.stringify(d)} is not a positive integer`,{event:e.name,reason:"invalid goalId"}),p.siteSearch)w=["trackSiteSearch",...g];else if(p.contentImpression)w=["trackContentImpression",...g];else if(p.contentInteraction)w=["trackContentInteraction",...g];else if(n.name)w=[e.name,...g];else if("page view"===e.name)w=void 0===n.data?["trackPageView",await S(e,"data.title",{collector:i})]:["trackPageView",...g];else if(void 0===y)return void W(c,`${s}|${e.name}|unmapped`,`Event "${e.name}" skipped: no rule name, tracking flag or goal, and not a page view`,{event:e.name,reason:"unmapped"});const h=void 0!==y&&void 0!==p.goalValue?await S(e,p.goalValue,{collector:i}):void 0,{before:b,after:O}=function(e,t){const n=V({...e,...t});if(0===Object.keys(t).length)return{before:n,after:[]};const r={};for(const[n,o]of Object.entries(t))Object.prototype.hasOwnProperty.call(e,n)||void 0===o||(r[n]=void 0);return{before:n,after:[...V(r),...V(e)]}}(await q(l.customDimensions,e,i),await q(p.customDimensions,e,i));b.forEach(f),w&&f(w),void 0!==y&&f(["trackGoal",y,h]),O.forEach(f)}},K=/^[1-9]\d*$/;var F,H=G;return F=o,((o,i,c,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let a of n(i))r.call(o,a)||a===c||e(o,a,{get:()=>i[a],enumerable:!(s=t(i,a))||s.enumerable});return o})(e({},"__esModule",{value:!0}),F)})();
|
|
1
|
+
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o),i={};((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})(i,{DestinationMatomo:()=>ne,default:()=>ue,destinationMatomo:()=>ie});var s=Object.defineProperty,a=(e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})};function c(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}a({},{stepId:()=>c});function u(e,t){const n=e.destinations[t];if(!n)throw new Error(`Destination not found: ${t}`);return n}a({},{getDestination:()=>u});a({},{Level:()=>l});var f,l=((f=l||{})[f.ERROR=0]="ERROR",f[f.WARN=1]="WARN",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f);function d(e,t){const n=e.transformers[t];if(!n)throw new Error(`Transformer not found: ${t}`);return n}a({},{getTransformer:()=>d});function p(e,t){const n=e.sources[t];if(!n)throw new Error(`Source not found: ${t}`);return n}a({},{getSource:()=>p});function g(e,t){const n=e.stores[t];if(!n)throw new Error(`Store not found: ${t}`);return n}async function m(e,t){return await e.get(t)}a({},{getStore:()=>g,getStoreValue:()=>m});var y="\\$flow\\.([a-zA-Z_][a-zA-Z0-9_-]*)(?:\\.([a-zA-Z0-9_.]+))?";new RegExp(`^${y}$`),new RegExp(y,"g");function v(e){return Array.isArray(e)}function w(e){return void 0!==e}function h(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function b(e){return"object"==typeof e&&null!==e&&!v(e)&&"[object Object]"===Object.prototype.toString.call(e)}function O(e){return"string"==typeof e}function j(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&v(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=j(e,t,n);i.push(o)}return i}if(r=b(r)||v(r)?r[t]:void 0,void 0===r)break}return w(r)?r:n}function k(e,t={},n={}){const o={...t,...n},r={};let i=!e||0===Object.keys(e).length;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function P(e){return function(e){return"boolean"==typeof e}(e)||O(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!w(e)||v(e)&&e.every(P)||b(e)&&Object.values(e).every(P)}function R(e){return P(e)?e:void 0}function E(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}function $(e,t){Object.defineProperty(e,"cause",{value:t,writable:!0,configurable:!0})}var S=class e extends Error{constructor(t,n){super(t),this.name="FatalError",n&&"cause"in n&&$(this,n.cause),Object.setPrototypeOf(this,e.prototype)}},_=["transport","timeout","breaker-open","blocked","queue-full","vendor-not-ready","vendor-timeout"],A=class extends Error{constructor(e,t){super(e),r(this,"code"),r(this,"status"),r(this,"retryable"),r(this,"body"),void 0!==t.cause&&$(this,t.cause),this.name="StepError",this.code=t.code,void 0!==t.status&&(this.status=t.status),this.retryable=function(e){if(void 0!==e.retryable)return e.retryable;const{status:t}=e;if(void 0!==t){if(429===t||t>=500&&t<600)return!0;if(t>=400&&t<500)return!1}return _.includes(e.code)}(t),void 0!==t.body&&(this.body=t.body),Object.setPrototypeOf(this,new.target.prototype)}};function x(e){return e.length>300?e.slice(0,300):e}var M=["type","mappingKey"],D=["count","suppressed"];function I(e,t,n,o,r,i="error"){if(null==e?void 0:e.causeLog)return void e.causeLog.report(n,o,r,i);const s=function(e,t){const n={step:e.step,code:e.code};void 0!==e.status&&(n.status=e.status);for(const e of M)"string"==typeof t[e]&&(n[e]=t[e]);for(const e of D)"number"==typeof t[e]&&(n[e]=t[e]);"boolean"==typeof t.retryable&&(n.retryable=t.retryable);const o="string"==typeof(r=t.event)?r:b(r)&&"string"==typeof r.name?r.name:void 0;var r;void 0!==o&&(n.event=o);const i=function(e){if(void 0!==e)return"string"==typeof e?x(e):e instanceof Error||b(e)&&"string"==typeof e.message?x(e.message):x(String(e))}(t.error);return void 0!==i&&(n.error=i),n}(n,r);"warn"===i?t.warn(o,s):t.error(o,s)}var N=["condition","consent","fn","key","loop","map","set","validate","value"];function T(e,t,n,o){const r=e.event.name,i=(null==t?void 0:t.mappingKey)?`mapping.${t.mappingKey}`:"mapping";I(e.collector,e.logger,{step:i,code:"mapping"},n,{..."string"==typeof r?{event:r}:{},...(null==t?void 0:t.mappingKey)?{mappingKey:t.mappingKey}:{},...void 0!==o?{error:o}:{}})}async function q(e,t={},n,o){var r;if(!n.collector)throw new Error("getMappingValue: context.collector is required");const i=n.consent||n.collector.consent,s={event:null!=(r=n.event)?r:{},mapping:t,collector:n.collector,logger:n.collector.logger,consent:i},a=v(t)?t:[t];for(const t of a){const n=await E(V,e=>{if(e instanceof S)throw e;T(s,o,"mapping value failed",e)})(e,t,{...s,mapping:t},o);if(w(n))return n}}async function V(e,t,n,o){return(v(t)?t:[t]).reduce(async(t,r)=>{const i=await t;if(i)return i;const s=O(r)?{key:r}:r;if(!Object.keys(s).length)return;if(!N.some(e=>e in s))return void T({...n,mapping:r},o,`mapping value has no operator (${Object.keys(s).join(", ")}): wrap the fields in map, or use key, value, fn, loop or set`);const{condition:a,consent:c,fn:u,key:f,loop:l,map:d,set:p,validate:g,value:m}=s,y={...n,mapping:r};if(a&&!await E(a,e=>{if(e instanceof S)throw e;return T(y,o,"mapping condition failed",e),!1})(e,y))return;if(c&&!k(c,y.consent))return m;let h=w(m)?m:e;if(l){const[t,n]=l,r="this"===t?[e]:await q(e,t,y,o);h=v(r)?(await Promise.all(r.map(e=>w(e)?q(e,n,y,o):void 0))).filter(w):void 0}else d?h=await Object.entries(d).reduce(async(t,[n,r])=>{const i=await t,s=await q(e,r,y,o);return w(s)&&(i[n]=s),i},Promise.resolve({})):p?h=await Promise.all(p.map(t=>V(e,t,y,o))):f?h=j(e,f,m):u&&(h=await E(u,e=>{if(e instanceof S)throw e;T(y,o,"mapping fn failed",e)})(e,y));g&&!await E(g,e=>{if(e instanceof S)throw e;return T(y,o,"mapping validate failed",e),!1})(h,y)&&(h=void 0);const b=R(h);return w(b)?b:R(m)},Promise.resolve(void 0))}async function C(e,t={},n){return async function(e,t,n,o){var r,i;if(!w(e))return;const s=b(e)&&e.consent||(null==n?void 0:n.consent)||(null==(r=null==n?void 0:n.collector)?void 0:r.consent),a=null!=(i=null==n?void 0:n.event)?i:b(e)?e:{};return q(e,t,{...n,consent:s,event:a},o)}(e,t,n)}var K="observe";function L(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function W(e){return"function"==typeof e}function B(e){return"object"==typeof e&&null!==e}var G=["name","length","prototype","arguments","caller"];function z(e,t){if(-1!==G.indexOf(t))return!1;let n=e;for(;W(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!W(e)||!W(Object.getPrototypeOf(e)))return!1;n=e}return!1}function F(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function H(e,t){let n=e;for(const e of t){if(W(n)){if(!z(n,e))return!0;if(!F(n,e))return!1}else if(h(n)){if(!(e in n))return!0}else if(!B(n)||!(e in n))return!1;n=Reflect.get(n,e)}return W(n)}function U(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[K];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=typeof e||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;const{paths:t,record:n}=e;return Array.isArray(t)&&t.every(e=>"string"==typeof e)&&"function"==typeof n}(n)){delete t[K];const e=function(e,t,n){const o=[],r=[],i=[];for(const n of t){const t=L(n);if(0===t.length)continue;const o=t.join(".");i.push({rest:t,fn:o}),H(e,t)||r.push(o)}const s=new WeakMap,a=new WeakSet;function c(e,t){for(const r of e)if(n)try{n(r,t)}catch(e){}else o.push({fn:r,args:t,ts:Date.now()})}function u(e,t){return 0===t.length||f(e)?e:h(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>u(e,t)):W(e)?y(e,[],t):B(e)?d(e,t):e}function f(e){return(B(e)||W(e))&&a.has(e)}function l(e,t){const n=[],o=[];for(const r of e)r.rest[0]===t&&(1===r.rest.length?n.includes(r.fn)||n.push(r.fn):o.push({rest:r.rest.slice(1),fn:r.fn}));return{leafs:n,deeper:o}}function d(e,t){var n;const o=t.map(e=>`${e.fn}:${e.rest.join(".")}`).join("|"),r=null!=(n=s.get(e))?n:new Map;s.set(e,r);const i=r.get(o);if(i)return i;const a=p(e,t);return r.set(o,a),a}function p(e,t){return W(e)?g(e,t):t.some(t=>!F(e,t.rest[0]))?function(e,t){const n=Object.create(Object.getPrototypeOf(e)),o=m(e,t,()=>r),r=new Proxy(n,{get:(e,t)=>o.get(t),set:(t,n,o)=>Reflect.set(e,n,o,e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(t,n){const o=Reflect.getOwnPropertyDescriptor(e,n);return o&&{...o,configurable:!0}},defineProperty:(t,n,o)=>Reflect.defineProperty(e,n,o),deleteProperty:(t,n)=>Reflect.deleteProperty(e,n)});return a.add(r),r}(e,t):g(e,t)}function g(e,t){const n=m(e,t,()=>o),o=new Proxy(e,{get:(e,t)=>"string"!=typeof t||F(e,t)?n.get(t):Reflect.get(e,t,e),set:(e,t,n)=>Reflect.set(e,t,n,e)});return a.add(o),o}function m(e,t,n){const o=new Map;return{get(r){const i=Reflect.get(e,r,e);if("string"!=typeof r)return i;if(!W(i)&&!B(i))return i;if(f(i))return i;const s=o.get(r);if(s&&s.value===i)return s.out;const{leafs:a,deeper:c}=l(t,r);if(!(a.length>0||c.length>0)&&(!W(i)||function(e){if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return i;let u=i;return W(i)?u=y(i,a,c,{proxy:n(),target:e}):c.length>0&&(u=d(i,c)),o.set(r,{value:i,out:u}),u}}}function y(e,t,n,o){const r=()=>n.filter(t=>!z(e,t.rest[0])),i=new Map,s=new Proxy(e,{get(e,t){const o=Reflect.get(e,t,e);if("string"!=typeof t||!F(e,t))return o;if(!z(e,t))return o;const{leafs:r,deeper:a}=l(n,t);if(0===r.length&&0===a.length)return o;if(f(o))return o;const c=i.get(t);if(c&&c.value===o)return c.out;let u=o;return W(o)?u=y(o,r,a,{proxy:s,target:e}):B(o)&&a.length>0&&(u=d(o,a)),i.set(t,{value:o,out:u}),u},set:(e,t,n)=>Reflect.set(e,t,n,e),apply(e,n,i){c(t,i);const s=!o||n!==o.proxy&&void 0!==n?n:o.target;return u(Reflect.apply(e,s,i),r())},construct(e,n,o){c(t,n);const i=Reflect.construct(e,n,o===s?e:o),a=u(i,r());return B(a)||W(a)?a:i}});return a.add(s),s}return{env:p(e,i),calls:o,unresolved:r}}(t,n.paths,n.record).env,o=new Set;for(const e of n.paths){const n=L(e)[0];if(void 0===n)continue;const r=t[n];null!==r&&"object"==typeof r&&o.add(n)}const r=Array.from(o,t=>[t,e[t]]);for(const[e,n]of r)t[e]=n}return t}var Z="data-walkeros-vendor",J=new WeakMap;var Q=()=>new A("Vendor script failed to load",{code:"vendor-not-loaded"});function X(e,t,n={}){var o,r;const i=()=>null!=t();let s;if(e){const t=null!=(o=n.document)?o:"undefined"!=typeof document?document:void 0;if(!t)throw new A(`Vendor script ${e} has no document to go into`,{code:"vendor-not-ready"});s=function(e,t,n,o,r){const i=function(e,t){const n=e.querySelectorAll(`script[${Z}]`);return Array.from(n).find(e=>e.getAttribute("src")===t)}(e,t),s=i&&J.get(i);if(s)return s;const a={state:"loading",expired:!1,timeout:n,waiting:[]};if(i&&r())return a.state="loaded",J.set(i,a),a;const c=null!=i?i:e.createElement("script"),u=e=>{const t=a.waiting;a.waiting=[],t.forEach(t=>t(e))},f=setTimeout(()=>{a.expired=!0,u("expired")},n);if(J.set(c,a),c.addEventListener("load",()=>{clearTimeout(f),a.state="loaded",u("loaded")}),c.addEventListener("error",()=>{clearTimeout(f),a.state="failed",u("failed")}),!i){for(const[e,t]of Object.entries(o))c.setAttribute(e,t);c.src=t,c.async=!0,c.setAttribute(Z,""),e.head.appendChild(c)}return a}(t,e,function(e){return"number"==typeof e&&e>0?e:1e4}(n.timeout),null!=(r=n.attributes)?r:{},i)}const a=()=>{const e=t();return null==e?Promise.reject(new A("Vendor not ready: its global is missing",{code:"vendor-not-ready"})):Promise.resolve(e)};return{ready:()=>s?"failed"===s.state?Promise.reject(Q()):"loaded"===s.state||s.expired?a():new Promise((e,t)=>{s.waiting.push(n=>{var o;"failed"===n?t(Q()):"expired"===n?t((o=s.timeout,new A(`Vendor script did not load within ${o}ms`,{code:"vendor-timeout"}))):a().then(e,t)})}):a(),check(){if("failed"===(null==s?void 0:s.state))throw Q()}}}var Y=/^\d+$/;async function ee(e,t,n){const o={};if(!e)return o;for(const[r,i]of Object.entries(e)){const e=await C(t,i,{collector:n});o[r]=null==e?void 0:String(e)}return o}function te(e){return function(e){return Object.entries(e).filter(([e])=>Y.test(e)).sort(([e],[t])=>Number(e)-Number(t))}(e).map(([e,t])=>void 0===t?["deleteCustomDimension",Number(e)]:["setCustomDimension",Number(e),t])}var ne={};function oe(e,t,n,o){return async function(e,t,n){try{return await e()}catch(e){if(e instanceof A)throw e;throw new A(n,{code:t,cause:e})}}(()=>Promise.all(t.map(t=>e.push(t))),n,o)}function re(e,t,n){return X(e?`${ae(e)}matomo.js`:void 0,()=>U(t).window._paq,{timeout:n,document:U(t).document})}var ie={type:"matomo",config:{},async init({config:e,env:t}){const{window:n}=U(t),{settings:o={},loadScript:r}=e,{siteId:i,url:s}=o,a=[];if(r){if(!i||!s)throw new A(`Matomo with loadScript needs settings ${[...i?[]:["siteId"],...s?[]:["url"]].join(" and ")}`,{code:"config"});const e=ae(s);a.push(["setTrackerUrl",e+"matomo.php"]),a.push(["setSiteId",i])}o.disableCookies&&a.push(["disableCookies"]),!1!==o.enableLinkTracking&&a.push(["enableLinkTracking"]),o.enableHeartBeatTimer&&a.push(["enableHeartBeatTimer",o.enableHeartBeatTimer]),n._paq=n._paq||[],r&&re(s,t,e.timeout),await oe(n._paq,a,"vendor-not-ready","Matomo did not take its setup commands")},async push(e,{config:t,rule:n={},data:o,env:r,collector:i,logger:s,id:a}){const u=t.settings||{};t.loadScript&&re(u.url,r,t.timeout).check();const f=U(r).window._paq;if(!f)throw new A("Matomo _paq queue missing: init did not run",{code:"vendor-not-ready"});const l=n.settings||{},{goalId:d}=l,p=v(o)?o:[o],g=void 0===d||("number"==typeof(m=d)?Number.isInteger(m)&&m>0:"string"==typeof m&&se.test(m))?d:void 0;var m;let y;if(void 0!==d&&void 0===g&&I(i,s,{step:c("destination",a),code:"config"},"Matomo goal skipped: goalId is not a positive integer",{event:e.name,mappingKey:"goalId"}),n.silent)y=void 0;else if(l.siteSearch)y=["trackSiteSearch",...p];else if(l.contentImpression)y=["trackContentImpression",...p];else if(l.contentInteraction)y=["trackContentInteraction",...p];else if(n.name)y=[e.name,...p];else if("page view"===e.name)y=void 0===n.data?["trackPageView",await C(e,"data.title",{collector:i})]:["trackPageView",...p];else if(void 0===g)throw new A(`Matomo has no command for "${e.name}": map it with a rule name, a tracking flag or a goal, or ignore it`,{code:"missing-input"});const w=void 0!==g&&void 0!==l.goalValue?await C(e,l.goalValue,{collector:i}):void 0,{before:h,after:b}=function(e,t){const n=te({...e,...t});if(0===Object.keys(t).length)return{before:n,after:[]};const o={};for(const[n,r]of Object.entries(t))Object.prototype.hasOwnProperty.call(e,n)||void 0===r||(o[n]=void 0);return{before:n,after:[...te(o),...te(e)]}}(await ee(u.customDimensions,e,i),await ee(l.customDimensions,e,i));(y||void 0!==g)&&await oe(f,[...h,...y?[y]:[],...void 0!==g?[["trackGoal",g,w]]:[],...b],"transport","Matomo did not take the event commands")},async on(e,{config:t,data:n,env:o,collector:r}){const i=t.consent;if("consent"!==e||!i||!b(n))return;if(!Object.keys(i).some(e=>e in n))return;const s=U(o).window._paq;if(!s)return;const a=!1!==k(i,r.consent),c=b(t.settings)&&!0===t.settings.disableCookies,u=a?c?["setConsentGiven",!1]:["setConsentGiven"]:["forgetConsentGiven"];await oe(s,[u],"consent-not-applied","Matomo did not take the consent update")}},se=/^[1-9]\d*$/;function ae(e){return`${e.replace(/\/+$/,"")}/`}var ce,ue=ie;return ce=i,((r,i,s,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of n(i))o.call(r,c)||c===s||e(r,c,{get:()=>i[c],enumerable:!(a=t(i,c))||a.enumerable});return r})(e({},"__esModule",{value:!0}),ce)})();
|
package/dist/index.d.mts
CHANGED
|
@@ -44,17 +44,6 @@ interface Env extends DestinationWeb.Env {
|
|
|
44
44
|
href?: string;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
document: {
|
|
48
|
-
createElement: (tagName: string) => {
|
|
49
|
-
type: string;
|
|
50
|
-
src: string;
|
|
51
|
-
async?: boolean;
|
|
52
|
-
defer?: boolean;
|
|
53
|
-
};
|
|
54
|
-
head: {
|
|
55
|
-
appendChild: (node: unknown) => void;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
47
|
}
|
|
59
48
|
type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
|
|
60
49
|
type Destination = DestinationWeb.Destination<Types>;
|
package/dist/index.d.ts
CHANGED
|
@@ -44,17 +44,6 @@ interface Env extends DestinationWeb.Env {
|
|
|
44
44
|
href?: string;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
document: {
|
|
48
|
-
createElement: (tagName: string) => {
|
|
49
|
-
type: string;
|
|
50
|
-
src: string;
|
|
51
|
-
async?: boolean;
|
|
52
|
-
defer?: boolean;
|
|
53
|
-
};
|
|
54
|
-
head: {
|
|
55
|
-
appendChild: (node: unknown) => void;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
47
|
}
|
|
59
48
|
type Types = Destination$1.Types<Settings, Mapping, Env, InitSettings>;
|
|
60
49
|
type Destination = DestinationWeb.Destination<Types>;
|
package/dist/index.es5.js
CHANGED
|
@@ -1 +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 _assert_this_initialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).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,c,"next",e)}function c(e){asyncGeneratorStep(a,n,o,i,c,"throw",e)}i(void 0)})}}function _call_super(e,t,r){return t=_get_prototype_of(t),_possible_constructor_return(e,_is_native_reflect_construct()?Reflect.construct(t,r||[],_get_prototype_of(e).constructor):t.apply(e,r))}function _class_call_check(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _construct(e,t,r){return _construct=_is_native_reflect_construct()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_set_prototype_of(o,r.prototype),o},_construct.apply(null,arguments)}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 _get_prototype_of(e){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_get_prototype_of(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_set_prototype_of(e,t)}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _is_native_function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}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,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)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 _possible_constructor_return(e,t){return!t||"object"!==_type_of(t)&&"function"!=typeof t?_assert_this_initialized(e):t}function _set_prototype_of(e,t){return _set_prototype_of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_set_prototype_of(e,t)}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 _wrap_native_super(e){var t="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(e){if(null===e||!_is_native_function(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct(e,arguments,_get_prototype_of(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(r,e)},_wrap_native_super(e)}function _is_native_reflect_construct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_is_native_reflect_construct=function(){return!!e})()}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),c=Object.defineProperty;return c(i,"next",{value:u(0)}),c(i,"throw",{value:u(1)}),c(i,"return",{value:u(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function u(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}var Destination=function(){var e=function(e,t){if("collector"===e)return"collector";if(!t)throw new Error("stepId(".concat(e,") requires an id"));return"".concat(e,".").concat(t)},t=function(e,t){var r=e.destinations[t];if(!r)throw new Error("Destination not found: ".concat(t));return r},r=function(e,t){var r=e.transformers[t];if(!r)throw new Error("Transformer not found: ".concat(t));return r},n=function(e,t){var r=e.sources[t];if(!r)throw new Error("Source not found: ".concat(t));return r},o=function(e,t){var r=e.stores[t];if(!r)throw new Error("Store not found: ".concat(t));return r},a=function(e,t){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,e.get(t)];case 1:return[2,r.sent()]}})})()},i=function(e){return Array.isArray(e)},c=function(e){return void 0!==e},u=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&"then"in e&&"function"==typeof e.then},l=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!i(e)&&"[object Object]"===Object.prototype.toString.call(e)},s=function(e){return"string"==typeof e},f=function(e){return B(e)?e:void 0},_=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]}})})()}},p=function(e,t){return _async_to_generator(function(e){var t,r,n,o,a,u,l,s,f,p,y,v,d,b,g,h=arguments;return _ts_generator(this,function(m){switch(m.label){case 0:if(t=h.length>1&&void 0!==h[1]?h[1]:{},!(r=h.length>2?h[2]:void 0).collector)throw new Error("getMappingValue: context.collector is required");o=r.consent||r.collector.consent,a=null!==(n=r.event)&&void 0!==n?n:{},u={event:a,mapping:t,collector:r.collector,logger:r.collector.logger,consent:o},l=i(t)?t:[t],s=!0,f=!1,p=void 0,m.label=1;case 1:m.trys.push([1,6,7,8]),y=l[Symbol.iterator](),m.label=2;case 2:return(s=(v=y.next()).done)?[3,5]:(d=v.value,[4,_(G,function(e){if(_instanceof(e,q))throw e;r.collector.status.failed++,u.logger.error("mapping processing failed",{event:a,error:e})})(e,d,_object_spread_props(_object_spread({},u),{mapping:d}))]);case 3:if(b=m.sent(),c(b))return[2,b];m.label=4;case 4:return s=!0,[3,2];case 5:return[3,8];case 6:return g=m.sent(),f=!0,p=g,[3,8];case 7:try{s||null==y.return||y.return()}finally{if(f)throw p}return[7];case 8:return[2]}})}).apply(this,arguments)},y=function(e,t){return _async_to_generator(function(e){var t,r,n,o,a,i,u=arguments;return _ts_generator(this,function(s){return t=u.length>1&&void 0!==u[1]?u[1]:{},r=u.length>2?u[2]:void 0,c(e)?(a=l(e)&&e.consent||(null==r?void 0:r.consent)||(null==r||null===(o=r.collector)||void 0===o?void 0:o.consent),i=null!==(n=null==r?void 0:r.event)&&void 0!==n?n:l(e)?e:{},[2,p(e,t,_object_spread_props(_object_spread({},r),{consent:a,event:i}))]):[2]})}).apply(this,arguments)},v=function(e){var t=(e.startsWith(K)?e.slice(5):e).split(".");return t.some(function(e){return""===e})?[]:t},d=function(e){return"function"==typeof e},b=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e},g=function(e,t){if(-1!==F.indexOf(t))return!1;for(var r=e;d(r);){if(Object.prototype.hasOwnProperty.call(r,t))return!0;var n=Object.getPrototypeOf(r);if(!d(n)||!d(Object.getPrototypeOf(n)))return!1;r=n}return!1},h=function(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},m=function(e,t){var r=e,n=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(n=(i=c.next()).done);n=!0){var l=i.value;if(d(r)){if(!g(r,l))return!0;if(!h(r,l))return!1}else if(u(r)){if(!(l in r))return!0}else if(!b(r)||!(l in r))return!1;r=Reflect.get(r,l)}}catch(e){o=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return d(r)},w=function(e){var t=_object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e),r=e&&e[W];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=(void 0===e?"undefined":_type_of(e))||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;var t=e.paths,r=e.record;return Array.isArray(t)&&t.every(function(e){return"string"==typeof e})&&"function"==typeof r}(r)){delete t[W];var n=function(e,t,r){var n=[],o=[],a=[],i=!0,c=!1,l=void 0;try{for(var s,f=t[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var _=s.value,p=v(_);if(0!==p.length){var y=p.join(".");a.push({rest:p,fn:y}),m(e,p)||o.push(y)}}}catch(e){c=!0,l=e}finally{try{i||null==f.return||f.return()}finally{if(c)throw l}}var w=new WeakMap,O=new WeakSet;function j(e,t){var o=!0,a=!1,i=void 0;try{for(var c,u=e[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var l=c.value;if(r)try{r(l,t)}catch(e){}else n.push({fn:l,args:t,ts:Date.now()})}}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}}function S(e,t){return 0===t.length||P(e)?e:u(e)&&!t.some(function(t){return t.rest[0]in e})?Promise.resolve(e).then(function(e){return S(e,t)}):d(e)?A(e,[],t):b(e)?E(e,t):e}function P(e){return(b(e)||d(e))&&O.has(e)}function k(e,t){var r=[],n=[],o=!0,a=!1,i=void 0;try{for(var c,u=e[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var l=c.value;l.rest[0]===t&&(1===l.rest.length?r.includes(l.fn)||r.push(l.fn):n.push({rest:l.rest.slice(1),fn:l.fn}))}}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}return{leafs:r,deeper:n}}function E(e,t){var r,n=t.map(function(e){return"".concat(e.fn,":").concat(e.rest.join("."))}).join("|"),o=null!==(r=w.get(e))&&void 0!==r?r:new Map;w.set(e,o);var a=o.get(n);if(a)return a;var i=R(e,t);return o.set(n,i),i}function R(e,t){return d(e)?x(e,t):t.some(function(t){return!h(e,t.rest[0])})?function(e,t){var r=Object.create(Object.getPrototypeOf(e)),n=I(e,t,function(){return o}),o=new Proxy(r,{get:function(e,t){return n.get(t)},set:function(t,r,n){return Reflect.set(e,r,n,e)},has:function(t,r){return Reflect.has(e,r)},ownKeys:function(){return Reflect.ownKeys(e)},getOwnPropertyDescriptor:function(t,r){var n=Reflect.getOwnPropertyDescriptor(e,r);return n&&_object_spread_props(_object_spread({},n),{configurable:!0})},defineProperty:function(t,r,n){return Reflect.defineProperty(e,r,n)},deleteProperty:function(t,r){return Reflect.deleteProperty(e,r)}});return O.add(o),o}(e,t):x(e,t)}function x(e,t){var r=I(e,t,function(){return n}),n=new Proxy(e,{get:function(e,t){return"string"!=typeof t||h(e,t)?r.get(t):Reflect.get(e,t,e)},set:function(e,t,r){return Reflect.set(e,t,r,e)}});return O.add(n),n}function I(e,t,r){var n=new Map;return{get:function(o){var a=Reflect.get(e,o,e);if("string"!=typeof o)return a;if(!d(a)&&!b(a))return a;if(P(a))return a;var i=n.get(o);if(i&&i.value===a)return i.out;var c=k(t,o),u=c.leafs,l=c.deeper;if(!(u.length>0||l.length>0)&&(!d(a)||function(e){if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return a;var s=a;return d(a)?s=A(a,u,l,{proxy:r(),target:e}):l.length>0&&(s=E(a,l)),n.set(o,{value:a,out:s}),s}}}function A(e,t,r,n){var o=function(){return r.filter(function(t){return!g(e,t.rest[0])})},a=new Map,i=new Proxy(e,{get:function(e,t){var n=Reflect.get(e,t,e);if("string"!=typeof t||!h(e,t))return n;if(!g(e,t))return n;var o=k(r,t),c=o.leafs,u=o.deeper;if(0===c.length&&0===u.length)return n;if(P(n))return n;var l=a.get(t);if(l&&l.value===n)return l.out;var s=n;return d(n)?s=A(n,c,u,{proxy:i,target:e}):b(n)&&u.length>0&&(s=E(n,u)),a.set(t,{value:n,out:s}),s},set:function(e,t,r){return Reflect.set(e,t,r,e)},apply:function(e,r,a){j(t,a);var i=!n||r!==n.proxy&&void 0!==r?r:n.target;return S(Reflect.apply(e,i,a),o())},construct:function(e,r,n){j(t,r);var a=Reflect.construct(e,r,n===i?e:n),c=S(a,o());return b(c)||d(c)?c:a}});return O.add(i),i}return{env:R(e,a),calls:n,unresolved:o}}(t,r.paths,r.record).env,o=new Set,a=!0,i=!1,c=void 0;try{for(var l,s=r.paths[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var f=l.value,_=v(f)[0];if(void 0!==_){var p=t[_];null!==p&&"object"==(void 0===p?"undefined":_type_of(p))&&o.add(_)}}}catch(e){i=!0,c=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw c}}var y=Array.from(o,function(e){return[e,n[e]]}),w=!0,O=!1,j=void 0;try{for(var S,P=y[Symbol.iterator]();!(w=(S=P.next()).done);w=!0){var k=_sliced_to_array(S.value,2),E=k[0],R=k[1];t[E]=R}}catch(e){O=!0,j=e}finally{try{w||null==P.return||P.return()}finally{if(O)throw j}}}return t},O=function(e,t,r){return _async_to_generator(function(){var n,o,a,i,c,u,l,s,f,_,p;return _ts_generator(this,function(v){switch(v.label){case 0:if(n={},!e)return[2,n];o=!0,a=!1,i=void 0,v.label=1;case 1:v.trys.push([1,6,7,8]),c=Object.entries(e)[Symbol.iterator](),v.label=2;case 2:return(o=(u=c.next()).done)?[3,5]:(l=_sliced_to_array(u.value,2),s=l[0],f=l[1],[4,y(t,f,{collector:r})]);case 3:_=v.sent(),n[s]=null==_?void 0:String(_),v.label=4;case 4:return o=!0,[3,2];case 5:return[3,8];case 6:return p=v.sent(),a=!0,i=p,[3,8];case 7:try{o||null==c.return||c.return()}finally{if(a)throw i}return[7];case 8:return[2,n]}})})()},j=function(e){return P(e).map(function(e){var t=_sliced_to_array(e,2),r=t[0],n=t[1];return void 0===n?["deleteCustomDimension",Number(r)]:["setCustomDimension",Number(r),n]})},S=function(e,t){var r=j(_object_spread({},e,t));if(0===Object.keys(t).length)return{before:r,after:[]};var n={},o=!0,a=!1,i=void 0;try{for(var c,u=Object.entries(t)[Symbol.iterator]();!(o=(c=u.next()).done);o=!0){var l=_sliced_to_array(c.value,2),s=l[0],f=l[1];Object.prototype.hasOwnProperty.call(e,s)||void 0===f||(n[s]=void 0)}}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}return{before:r,after:_to_consumable_array(j(n)).concat(_to_consumable_array(j(e)))}},P=function(e){return Object.entries(e).filter(function(e){var t=_sliced_to_array(e,1)[0];return L.test(t)}).sort(function(e,t){var r=_sliced_to_array(e,1)[0],n=_sliced_to_array(t,1)[0];return Number(r)-Number(n)})},k=function(e,t,r,n){if(!$.has(t)&&$.size<U)return $.add(t),void e.warn(r,n);e.debug(r,n)},E=Object.defineProperty,R=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,I=Object.prototype.hasOwnProperty,A={};!function(e,t){for(var r in t)E(e,r,{get:t[r],enumerable:!0})}(A,{DestinationMatomo:function(){return z},default:function(){return Q},destinationMatomo:function(){return H}});var D=Object.defineProperty,T=function(e,t){for(var r in t)D(e,r,{get:t[r],enumerable:!0})};T({},{stepId:function(){return e}});T({},{getDestination:function(){return t}});T({},{Level:function(){return M}});var N,M=((N=M||{})[N.ERROR=0]="ERROR",N[N.WARN=1]="WARN",N[N.INFO=2]="INFO",N[N.DEBUG=3]="DEBUG",N);T({},{getTransformer:function(){return r}});T({},{getSource:function(){return n}});function C(e){for(var t=arguments.length>2?arguments[2]:void 0,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),n=e,o=0;o<r.length;o++){var a=r[o];if("*"===a&&i(n)){var u=r.slice(o+1).join("."),s=[],f=!0,_=!1,p=void 0;try{for(var y,v=n[Symbol.iterator]();!(f=(y=v.next()).done);f=!0){var d=C(y.value,u,t);s.push(d)}}catch(e){_=!0,p=e}finally{try{f||null==v.return||v.return()}finally{if(_)throw p}}return s}if(void 0===(n=l(n)||i(n)?n[a]:void 0))break}return c(n)?n:t}function B(e){return function(e){return"boolean"==typeof e}(e)||s(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!c(e)||i(e)&&e.every(B)||l(e)&&Object.values(e).every(B)}T({},{getStore:function(){return o},getStoreValue:function(){return a}});var q=function(){function e(t,r){var n;return _class_call_check(this,e),(n=_call_super(this,e,[t,r])).name="FatalError",Object.setPrototypeOf(n,e.prototype),n}return _inherits(e,_wrap_native_super(Error)),e}();function G(e,t,r){return _async_to_generator(function(){return _ts_generator(this,function(n){return[2,(i(t)?t:[t]).reduce(function(t,n){return _async_to_generator(function(){var o,a,u,l,y,v,d,b,g,h,m,w,O,j,S,P,k,E,R,x,I,A,D,T,N;return _ts_generator(this,function(M){switch(M.label){case 0:return[4,t];case 1:return(o=M.sent())?[2,o]:(a=s(n)?{key:n}:n,Object.keys(a).length?(u=a.condition,l=a.consent,y=a.fn,v=a.key,d=a.loop,b=a.map,g=a.set,h=a.validate,m=a.value,w=_object_spread_props(_object_spread({},r),{mapping:n}),(O=u)?[4,_(u,function(e){if(_instanceof(e,q))throw e;return w.logger.error("mapping condition failed",{event:w.event,error:e}),!1})(e,w)]:[3,3]):[2]);case 2:O=!M.sent(),M.label=3;case 3:return O?[2]:l&&!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=!e||0===Object.keys(e).length;return Object.keys(t).forEach(function(o){t[o]&&(r[o]=!0,e&&e[o]&&(n=!0))}),!!n&&r}(l,w.consent)?[2,m]:(j=c(m)?m:e,d?(S=_sliced_to_array(d,2),P=S[0],k=S[1],"this"!==P?[3,4]:(R=[e],[3,6])):[3,10]);case 4:return[4,p(e,P,w)];case 5:R=M.sent(),M.label=6;case 6:return i(E=R)?[4,Promise.all(E.map(function(e){return c(e)?p(e,k,w):void 0}))]:[3,8];case 7:return x=M.sent().filter(c),[3,9];case 8:x=void 0,M.label=9;case 9:return j=x,[3,21];case 10:return b?[4,Object.entries(b).reduce(function(t,r){var n=_sliced_to_array(r,2),o=n[0],a=n[1];return _async_to_generator(function(){var r,n;return _ts_generator(this,function(i){switch(i.label){case 0:return[4,t];case 1:return r=i.sent(),[4,p(e,a,w)];case 2:return n=i.sent(),[2,(c(n)&&(r[o]=n),r)]}})})()},Promise.resolve({}))]:[3,12];case 11:return j=M.sent(),[3,20];case 12:return g?[4,Promise.all(g.map(function(t){return G(e,t,w)}))]:[3,14];case 13:return I=j=M.sent(),[3,19];case 14:return v?(A=j=C(e,v,m),[3,18]):[3,15];case 15:return(D=y)?[4,_(y,function(e){if(_instanceof(e,q))throw e;w.logger.error("mapping fn failed",{event:w.event,error:e})})(e,w)]:[3,17];case 16:D=j=M.sent(),M.label=17;case 17:A=D,M.label=18;case 18:I=A,M.label=19;case 19:M.label=20;case 20:M.label=21;case 21:return(T=h)?[4,_(h,function(e){if(_instanceof(e,q))throw e;return w.logger.error("mapping validate failed",{event:w.event,error:e}),!1})(j,w)]:[3,23];case 22:T=!M.sent(),M.label=23;case 23:return T&&(j=void 0),N=f(j),[2,c(N)?N:f(m)]}})})()},Promise.resolve(void 0))]})})()}var V,W="observe",K="call:",F=["name","length","prototype","arguments","caller"],L=/^\d+$/,U=1e3,$=new Set,z={},H={type:"matomo",config:{},init:function(e){var t=e.config,r=e.env,n=e.logger,o=w(r).window,a=t.settings,i=void 0===a?{}:a,c=t.loadScript,u=i.siteId,l=i.url;o._paq=o._paq||[];var s=o._paq,f=function(e){s.push(e)};if(c){if(!u)return n.throw("Config settings siteId missing");if(!l)return n.throw("Config settings url missing");var _=function(e){return"".concat(e.replace(/\/+$/,""),"/")}(l);!function(e,t){var r=w(t).document,n=r.createElement("script");n.type="text/javascript",n.src=e+"matomo.js",n.async=!0,n.defer=!0,r.head.appendChild(n)}(_,r),f(["setTrackerUrl",_+"matomo.php"]),f(["setSiteId",u])}i.disableCookies&&f(["disableCookies"]),!1!==i.enableLinkTracking&&f(["enableLinkTracking"]),i.enableHeartBeatTimer&&f(["enableHeartBeatTimer",i.enableHeartBeatTimer])},push:function(e,t){return _async_to_generator(function(e,t){var r,n,o,a,c,u,l,s,f,_,p,v,d,b,g,h,m,j,P,E,R,x,I,A,D,T;return _ts_generator(this,function(N){switch(N.label){case 0:return r=t.config,n=t.rule,o=void 0===n?{}:n,a=t.data,c=t.env,u=t.collector,l=t.logger,s=t.id,f=w(c),_=f.window,(p=_._paq)?(v=function(e){p.push(e)},d=r.settings||{},b=o.settings||{},g=b.goalId,h=i(a)?a:[a],m=("number"==typeof(M=g)?Number.isInteger(M)&&M>0:"string"==typeof M&&J.test(M))?g:void 0,void 0!==g&&void 0===m&&k(l,"".concat(s,"|").concat(e.name,"|invalid goalId"),'Goal of event "'.concat(e.name,'" skipped: goalId ').concat(JSON.stringify(g)," is not a positive integer"),{event:e.name,reason:"invalid goalId"}),b.siteSearch?(j=["trackSiteSearch"].concat(_to_consumable_array(h)),[3,9]):[3,1]):(l.warn("Matomo _paq queue missing, init() not run"),[2]);case 1:return b.contentImpression?(j=["trackContentImpression"].concat(_to_consumable_array(h)),[3,9]):[3,2];case 2:return b.contentInteraction?(j=["trackContentInteraction"].concat(_to_consumable_array(h)),[3,9]):[3,3];case 3:return o.name?(j=[e.name].concat(_to_consumable_array(h)),[3,9]):[3,4];case 4:return"page view"!==e.name?[3,8]:void 0!==o.data?[3,6]:(E=["trackPageView"],[4,y(e,"data.title",{collector:u})]);case 5:return P=E.concat([N.sent()]),[3,7];case 6:P=["trackPageView"].concat(_to_consumable_array(h)),N.label=7;case 7:return j=P,[3,9];case 8:if(void 0===m)return k(l,"".concat(s,"|").concat(e.name,"|unmapped"),'Event "'.concat(e.name,'" skipped: no rule name, tracking flag or goal, and not a page view'),{event:e.name,reason:"unmapped"}),[2];N.label=9;case 9:return void 0===m||void 0===b.goalValue?[3,11]:[4,y(e,b.goalValue,{collector:u})];case 10:return x=N.sent(),[3,12];case 11:x=void 0,N.label=12;case 12:return R=x,[4,O(d.customDimensions,e,u)];case 13:return T=[N.sent()],[4,O(b.customDimensions,e,u)];case 14:return I=S.apply(void 0,T.concat([N.sent()])),A=I.before,D=I.after,A.forEach(v),j&&v(j),void 0!==m&&v(["trackGoal",m,R]),D.forEach(v),[2]}var M})}).apply(this,arguments)}},J=/^[1-9]\d*$/,Q=H;return V=A,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 c,u=function(){var o=c.value;I.call(e,o)||o===r||E(e,o,{get:function(){return t[o]},enumerable:!(n=R(t,o))||n.enumerable})},l=x(t)[Symbol.iterator]();!(o=(c=l.next()).done);o=!0)u()}catch(e){a=!0,i=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw i}}}return e}(E({},"__esModule",{value:!0}),V)}();
|
|
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 _assert_this_initialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return 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 _call_super(e,t,r){return t=_get_prototype_of(t),_possible_constructor_return(e,_is_native_reflect_construct()?Reflect.construct(t,r||[],_get_prototype_of(e).constructor):t.apply(e,r))}function _class_call_check(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _construct(e,t,r){return _construct=_is_native_reflect_construct()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_set_prototype_of(o,r.prototype),o},_construct.apply(null,arguments)}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 _get_prototype_of(e){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_get_prototype_of(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_set_prototype_of(e,t)}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _is_native_function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}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 _possible_constructor_return(e,t){return!t||"object"!==_type_of(t)&&"function"!=typeof t?_assert_this_initialized(e):t}function _set_prototype_of(e,t){return _set_prototype_of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_set_prototype_of(e,t)}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 _wrap_native_super(e){var t="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(e){if(null===e||!_is_native_function(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct(e,arguments,_get_prototype_of(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(r,e)},_wrap_native_super(e)}function _is_native_reflect_construct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_is_native_reflect_construct=function(){return!!e})()}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,t){if("collector"===e)return"collector";if(!t)throw new Error("stepId(".concat(e,") requires an id"));return"".concat(e,".").concat(t)},t=function(e,t){var r=e.destinations[t];if(!r)throw new Error("Destination not found: ".concat(t));return r},r=function(e,t){var r=e.transformers[t];if(!r)throw new Error("Transformer not found: ".concat(t));return r},n=function(e,t){var r=e.sources[t];if(!r)throw new Error("Source not found: ".concat(t));return r},o=function(e,t){var r=e.stores[t];if(!r)throw new Error("Store not found: ".concat(t));return r},a=function(e,t){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,e.get(t)];case 1:return[2,r.sent()]}})})()},i=function(e){return Array.isArray(e)},u=function(e){return void 0!==e},c=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&"then"in e&&"function"==typeof e.then},s=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!i(e)&&"[object Object]"===Object.prototype.toString.call(e)},l=function(e){return"string"==typeof e},f=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=!e||0===Object.keys(e).length;return Object.keys(t).forEach(function(o){t[o]&&(r[o]=!0,e&&e[o]&&(n=!0))}),!!n&&r},_=function(e){return H(e)?e:void 0},p=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]}})})()}},d=function(e,t){Object.defineProperty(e,"cause",{value:t,writable:!0,configurable:!0})},y=function(e){return e.length>300?e.slice(0,300):e},v=function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"error";if(null==e?void 0:e.causeLog)e.causeLog.report(r,n,o,a);else{var i=function(e,t){var r={step:e.step,code:e.code};void 0!==e.status&&(r.status=e.status);var n=!0,o=!1,a=void 0;try{for(var i,u=X[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var c=i.value;"string"==typeof t[c]&&(r[c]=t[c])}}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}var l=!0,f=!1,_=void 0;try{for(var p,d=Y[Symbol.iterator]();!(l=(p=d.next()).done);l=!0){var v=p.value;"number"==typeof t[v]&&(r[v]=t[v])}}catch(e){f=!0,_=e}finally{try{l||null==d.return||d.return()}finally{if(f)throw _}}"boolean"==typeof t.retryable&&(r.retryable=t.retryable);var b,g="string"==typeof(b=t.event)?b:s(b)&&"string"==typeof b.name?b.name:void 0;void 0!==g&&(r.event=g);var h=function(e){if(void 0!==e)return"string"==typeof e?y(e):_instanceof(e,Error)||s(e)&&"string"==typeof e.message?y(e.message):y(String(e))}(t.error);return void 0!==h&&(r.error=h),r}(r,o);"warn"===a?t.warn(n,i):t.error(n,i)}},b=function(e,t,r,n){var o=e.event.name,a=(null==t?void 0:t.mappingKey)?"mapping.".concat(t.mappingKey):"mapping";v(e.collector,e.logger,{step:a,code:"mapping"},r,_object_spread({},"string"==typeof o?{event:o}:{},(null==t?void 0:t.mappingKey)?{mappingKey:t.mappingKey}:{},void 0!==n?{error:n}:{}))},g=function(e,t,r){return _async_to_generator(function(e){var t,r,n,o,a,c,s,l,f,_,d,y,v,g,h,m=arguments;return _ts_generator(this,function(w){switch(w.label){case 0:if(t=m.length>1&&void 0!==m[1]?m[1]:{},n=m.length>3?m[3]:void 0,!(r=m.length>2?m[2]:void 0).collector)throw new Error("getMappingValue: context.collector is required");a=r.consent||r.collector.consent,c={event:null!==(o=r.event)&&void 0!==o?o:{},mapping:t,collector:r.collector,logger:r.collector.logger,consent:a},s=i(t)?t:[t],l=!0,f=!1,_=void 0,w.label=1;case 1:w.trys.push([1,6,7,8]),d=s[Symbol.iterator](),w.label=2;case 2:return(l=(y=d.next()).done)?[3,5]:(v=y.value,[4,p(te,function(e){if(_instanceof(e,Z))throw e;b(c,n,"mapping value failed",e)})(e,v,_object_spread_props(_object_spread({},c),{mapping:v}),n)]);case 3:if(g=w.sent(),u(g))return[2,g];w.label=4;case 4:return l=!0,[3,2];case 5:return[3,8];case 6:return h=w.sent(),f=!0,_=h,[3,8];case 7:try{l||null==d.return||d.return()}finally{if(f)throw _}return[7];case 8:return[2]}})}).apply(this,arguments)},h=function(e,t){return _async_to_generator(function(e){var t=arguments;return _ts_generator(this,function(r){return[2,m(e,t.length>1&&void 0!==t[1]?t[1]:{},t.length>2?t[2]:void 0)]})}).apply(this,arguments)},m=function(e,t,r,n){return _async_to_generator(function(){var o,a,i,c;return _ts_generator(this,function(l){return u(e)?(i=s(e)&&e.consent||(null==r?void 0:r.consent)||(null==r||null===(a=r.collector)||void 0===a?void 0:a.consent),c=null!==(o=null==r?void 0:r.event)&&void 0!==o?o:s(e)?e:{},[2,g(e,t,_object_spread_props(_object_spread({},r),{consent:i,event:c}),n)]):[2]})})()},w=function(e){var t=(e.startsWith(oe)?e.slice(5):e).split(".");return t.some(function(e){return""===e})?[]:t},O=function(e){return"function"==typeof e},j=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e},S=function(e,t){if(-1!==ae.indexOf(t))return!1;for(var r=e;O(r);){if(Object.prototype.hasOwnProperty.call(r,t))return!0;var n=Object.getPrototypeOf(r);if(!O(n)||!O(Object.getPrototypeOf(n)))return!1;r=n}return!1},P=function(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},k=function(e,t){var r=e,n=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var s=i.value;if(O(r)){if(!S(r,s))return!0;if(!P(r,s))return!1}else if(c(r)){if(!(s in r))return!0}else if(!j(r)||!(s in r))return!1;r=Reflect.get(r,s)}}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return O(r)},x=function(e){var t=_object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e),r=e&&e[ne];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=(void 0===e?"undefined":_type_of(e))||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;var t=e.paths,r=e.record;return Array.isArray(t)&&t.every(function(e){return"string"==typeof e})&&"function"==typeof r}(r)){delete t[ne];var n=function(e,t,r){var n=[],o=[],a=[],i=!0,u=!1,s=void 0;try{for(var l,f=t[Symbol.iterator]();!(i=(l=f.next()).done);i=!0){var _=l.value,p=w(_);if(0!==p.length){var d=p.join(".");a.push({rest:p,fn:d}),k(e,p)||o.push(d)}}}catch(e){u=!0,s=e}finally{try{i||null==f.return||f.return()}finally{if(u)throw s}}var y=new WeakMap,v=new WeakSet;function b(e,t){var o=!0,a=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var s=u.value;if(r)try{r(s,t)}catch(e){}else n.push({fn:s,args:t,ts:Date.now()})}}catch(e){a=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}}function g(e,t){return 0===t.length||h(e)?e:c(e)&&!t.some(function(t){return t.rest[0]in e})?Promise.resolve(e).then(function(e){return g(e,t)}):O(e)?I(e,[],t):j(e)?x(e,t):e}function h(e){return(j(e)||O(e))&&v.has(e)}function m(e,t){var r=[],n=[],o=!0,a=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var s=u.value;s.rest[0]===t&&(1===s.rest.length?r.includes(s.fn)||r.push(s.fn):n.push({rest:s.rest.slice(1),fn:s.fn}))}}catch(e){a=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}return{leafs:r,deeper:n}}function x(e,t){var r,n=t.map(function(e){return"".concat(e.fn,":").concat(e.rest.join("."))}).join("|"),o=null!==(r=y.get(e))&&void 0!==r?r:new Map;y.set(e,o);var a=o.get(n);if(a)return a;var i=E(e,t);return o.set(n,i),i}function E(e,t){return O(e)?R(e,t):t.some(function(t){return!P(e,t.rest[0])})?function(e,t){var r=Object.create(Object.getPrototypeOf(e)),n=A(e,t,function(){return o}),o=new Proxy(r,{get:function(e,t){return n.get(t)},set:function(t,r,n){return Reflect.set(e,r,n,e)},has:function(t,r){return Reflect.has(e,r)},ownKeys:function(){return Reflect.ownKeys(e)},getOwnPropertyDescriptor:function(t,r){var n=Reflect.getOwnPropertyDescriptor(e,r);return n&&_object_spread_props(_object_spread({},n),{configurable:!0})},defineProperty:function(t,r,n){return Reflect.defineProperty(e,r,n)},deleteProperty:function(t,r){return Reflect.deleteProperty(e,r)}});return v.add(o),o}(e,t):R(e,t)}function R(e,t){var r=A(e,t,function(){return n}),n=new Proxy(e,{get:function(e,t){return"string"!=typeof t||P(e,t)?r.get(t):Reflect.get(e,t,e)},set:function(e,t,r){return Reflect.set(e,t,r,e)}});return v.add(n),n}function A(e,t,r){var n=new Map;return{get:function(o){var a=Reflect.get(e,o,e);if("string"!=typeof o)return a;if(!O(a)&&!j(a))return a;if(h(a))return a;var i=n.get(o);if(i&&i.value===a)return i.out;var u=m(t,o),c=u.leafs,s=u.deeper;if(!(c.length>0||s.length>0)&&(!O(a)||function(e){if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return a;var l=a;return O(a)?l=I(a,c,s,{proxy:r(),target:e}):s.length>0&&(l=x(a,s)),n.set(o,{value:a,out:l}),l}}}function I(e,t,r,n){var o=function(){return r.filter(function(t){return!S(e,t.rest[0])})},a=new Map,i=new Proxy(e,{get:function(e,t){var n=Reflect.get(e,t,e);if("string"!=typeof t||!P(e,t))return n;if(!S(e,t))return n;var o=m(r,t),u=o.leafs,c=o.deeper;if(0===u.length&&0===c.length)return n;if(h(n))return n;var s=a.get(t);if(s&&s.value===n)return s.out;var l=n;return O(n)?l=I(n,u,c,{proxy:i,target:e}):j(n)&&c.length>0&&(l=x(n,c)),a.set(t,{value:n,out:l}),l},set:function(e,t,r){return Reflect.set(e,t,r,e)},apply:function(e,r,a){b(t,a);var i=!n||r!==n.proxy&&void 0!==r?r:n.target;return g(Reflect.apply(e,i,a),o())},construct:function(e,r,n){b(t,r);var a=Reflect.construct(e,r,n===i?e:n),u=g(a,o());return j(u)||O(u)?u:a}});return v.add(i),i}return{env:E(e,a),calls:n,unresolved:o}}(t,r.paths,r.record).env,o=new Set,a=!0,i=!1,u=void 0;try{for(var s,l=r.paths[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value,_=w(f)[0];if(void 0!==_){var p=t[_];null!==p&&"object"==(void 0===p?"undefined":_type_of(p))&&o.add(_)}}}catch(e){i=!0,u=e}finally{try{a||null==l.return||l.return()}finally{if(i)throw u}}var d=Array.from(o,function(e){return[e,n[e]]}),y=!0,v=!1,b=void 0;try{for(var g,h=d[Symbol.iterator]();!(y=(g=h.next()).done);y=!0){var m=_sliced_to_array(g.value,2),x=m[0],E=m[1];t[x]=E}}catch(e){v=!0,b=e}finally{try{y||null==h.return||h.return()}finally{if(v)throw b}}}return t},E=function(e,t){var r,n,o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e){var i=null!=(r=a.document)?r:"undefined"!=typeof document?document:void 0;if(!i)throw new Q("Vendor script ".concat(e," has no document to go into"),{code:"vendor-not-ready"});o=function(e,t,r,n,o){var a=function(e,t){var r=e.querySelectorAll("script[".concat(ie,"]"));return Array.from(r).find(function(e){return e.getAttribute("src")===t})}(e,t),i=a&&ue.get(a);if(i)return i;var u={state:"loading",expired:!1,timeout:r,waiting:[]};if(a&&o())return u.state="loaded",ue.set(a,u),u;var c=null!=a?a:e.createElement("script"),s=function(e){var t=u.waiting;u.waiting=[],t.forEach(function(t){return t(e)})},l=setTimeout(function(){u.expired=!0,s("expired")},r);if(ue.set(c,u),c.addEventListener("load",function(){clearTimeout(l),u.state="loaded",s("loaded")}),c.addEventListener("error",function(){clearTimeout(l),u.state="failed",s("failed")}),!a){var f=!0,_=!1,p=void 0;try{for(var d,y=Object.entries(n)[Symbol.iterator]();!(f=(d=y.next()).done);f=!0){var v=_sliced_to_array(d.value,2),b=v[0],g=v[1];c.setAttribute(b,g)}}catch(e){_=!0,p=e}finally{try{f||null==y.return||y.return()}finally{if(_)throw p}}c.src=t,c.async=!0,c.setAttribute(ie,""),e.head.appendChild(c)}return u}(i,e,function(e){return"number"==typeof e&&e>0?e:1e4}(a.timeout),null!=(n=a.attributes)?n:{},function(){return null!=t()})}var u=function(){var e=t();return null==e?Promise.reject(new Q("Vendor not ready: its global is missing",{code:"vendor-not-ready"})):Promise.resolve(e)};return{ready:function(){return o?"failed"===o.state?Promise.reject(ce()):"loaded"===o.state||o.expired?u():new Promise(function(e,t){o.waiting.push(function(r){var n;"failed"===r?t(ce()):"expired"===r?t((n=o.timeout,new Q("Vendor script did not load within ".concat(n,"ms"),{code:"vendor-timeout"}))):u().then(e,t)})}):u()},check:function(){if("failed"===(null==o?void 0:o.state))throw ce()}}},R=function(e,t,r){return _async_to_generator(function(){var n,o,a,i,u,c,s,l,f,_,p;return _ts_generator(this,function(d){switch(d.label){case 0:if(n={},!e)return[2,n];o=!0,a=!1,i=void 0,d.label=1;case 1:d.trys.push([1,6,7,8]),u=Object.entries(e)[Symbol.iterator](),d.label=2;case 2:return(o=(c=u.next()).done)?[3,5]:(s=_sliced_to_array(c.value,2),l=s[0],f=s[1],[4,h(t,f,{collector:r})]);case 3:_=d.sent(),n[l]=null==_?void 0:String(_),d.label=4;case 4:return o=!0,[3,2];case 5:return[3,8];case 6:return p=d.sent(),a=!0,i=p,[3,8];case 7:try{o||null==u.return||u.return()}finally{if(a)throw i}return[7];case 8:return[2,n]}})})()},A=function(e){return D(e).map(function(e){var t=_sliced_to_array(e,2),r=t[0],n=t[1];return void 0===n?["deleteCustomDimension",Number(r)]:["setCustomDimension",Number(r),n]})},I=function(e,t){var r=A(_object_spread({},e,t));if(0===Object.keys(t).length)return{before:r,after:[]};var n={},o=!0,a=!1,i=void 0;try{for(var u,c=Object.entries(t)[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var s=_sliced_to_array(u.value,2),l=s[0],f=s[1];Object.prototype.hasOwnProperty.call(e,l)||void 0===f||(n[l]=void 0)}}catch(e){a=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}return{before:r,after:_to_consumable_array(A(n)).concat(_to_consumable_array(A(e)))}},D=function(e){return Object.entries(e).filter(function(e){var t=_sliced_to_array(e,1)[0];return se.test(t)}).sort(function(e,t){var r=_sliced_to_array(e,1)[0],n=_sliced_to_array(t,1)[0];return Number(r)-Number(n)})},M=function(e,t,r,n){return o=function(){return Promise.all(t.map(function(t){return e.push(t)}))},a=r,i=n,_async_to_generator(function(){var e;return _ts_generator(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,o()];case 1:return[2,t.sent()];case 2:if(_instanceof(e=t.sent(),Q))throw e;throw new Q(i,{code:a,cause:e});case 3:return[2]}})})();var o,a,i},T=function(e,t,r){return E(e?"".concat(C(e),"matomo.js"):void 0,function(){return x(t).window._paq},{timeout:r,document:x(t).document})},C=function(e){return"".concat(e.replace(/\/+$/,""),"/")},K=Object.defineProperty,N=Object.getOwnPropertyDescriptor,q=Object.getOwnPropertyNames,V=Object.prototype.hasOwnProperty,G=function(e,t,r){return function(e,t,r){return t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r}(e,"symbol"!==(void 0===t?"undefined":_type_of(t))?t+"":t,r)},B={};!function(e,t){for(var r in t)K(e,r,{get:t[r],enumerable:!0})}(B,{DestinationMatomo:function(){return le},default:function(){return pe},destinationMatomo:function(){return fe}});var L=Object.defineProperty,W=function(e,t){for(var r in t)L(e,r,{get:t[r],enumerable:!0})};W({},{stepId:function(){return e}});W({},{getDestination:function(){return t}});W({},{Level:function(){return z}});var $,z=(($=z||{})[$.ERROR=0]="ERROR",$[$.WARN=1]="WARN",$[$.INFO=2]="INFO",$[$.DEBUG=3]="DEBUG",$);W({},{getTransformer:function(){return r}});W({},{getSource:function(){return n}});W({},{getStore:function(){return o},getStoreValue:function(){return a}});var F="\\$flow\\.(".concat("[a-zA-Z_][a-zA-Z0-9_-]*",")(?:\\.([a-zA-Z0-9_.]+))?");new RegExp("^".concat(F,"$")),new RegExp(F,"g");function U(e){for(var t=arguments.length>2?arguments[2]:void 0,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),n=e,o=0;o<r.length;o++){var a=r[o];if("*"===a&&i(n)){var c=r.slice(o+1).join("."),l=[],f=!0,_=!1,p=void 0;try{for(var d,y=n[Symbol.iterator]();!(f=(d=y.next()).done);f=!0){var v=U(d.value,c,t);l.push(v)}}catch(e){_=!0,p=e}finally{try{f||null==y.return||y.return()}finally{if(_)throw p}}return l}if(void 0===(n=s(n)||i(n)?n[a]:void 0))break}return u(n)?n:t}function H(e){return function(e){return"boolean"==typeof e}(e)||l(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!u(e)||i(e)&&e.every(H)||s(e)&&Object.values(e).every(H)}var Z=function(){function e(t,r){var n;return _class_call_check(this,e),(n=_call_super(this,e,[t])).name="FatalError",r&&"cause"in r&&d(n,r.cause),Object.setPrototypeOf(n,e.prototype),n}return _inherits(e,_wrap_native_super(Error)),e}(),J=["transport","timeout","breaker-open","blocked","queue-full","vendor-not-ready","vendor-timeout"],Q=function(e){function t(e,r){var n;return _class_call_check(this,t),n=_call_super(this,t,[e]),G(n,"code"),G(n,"status"),G(n,"retryable"),G(n,"body"),void 0!==r.cause&&d(n,r.cause),n.name="StepError",n.code=r.code,void 0!==r.status&&(n.status=r.status),n.retryable=function(e){if(void 0!==e.retryable)return e.retryable;var t=e.status;if(void 0!==t){if(429===t||t>=500&&t<600)return!0;if(t>=400&&t<500)return!1}return J.includes(e.code)}(r),void 0!==r.body&&(n.body=r.body),Object.setPrototypeOf(n,(_instanceof(this,t)?this.constructor:void 0).prototype),n}return _inherits(t,e),t}(_wrap_native_super(Error)),X=["type","mappingKey"],Y=["count","suppressed"],ee=["condition","consent","fn","key","loop","map","set","validate","value"];function te(e,t,r,n){return _async_to_generator(function(){return _ts_generator(this,function(o){return[2,(i(t)?t:[t]).reduce(function(t,o){return _async_to_generator(function(){var a,c,s,d,y,v,h,m,w,O,j,S,P,k,x,E,R,A,I,D,M,T,C,K,N;return _ts_generator(this,function(q){switch(q.label){case 0:return[4,t];case 1:return(a=q.sent())?[2,a]:(c=l(o)?{key:o}:o,Object.keys(c).length?ee.some(function(e){return e in c})?(s=c.condition,d=c.consent,y=c.fn,v=c.key,h=c.loop,m=c.map,w=c.set,O=c.validate,j=c.value,S=_object_spread_props(_object_spread({},r),{mapping:o}),(P=s)?[4,p(s,function(e){if(_instanceof(e,Z))throw e;return b(S,n,"mapping condition failed",e),!1})(e,S)]:[3,3]):[2,void b(_object_spread_props(_object_spread({},r),{mapping:o}),n,"mapping value has no operator (".concat(Object.keys(c).join(", "),"): wrap the fields in map, or use key, value, fn, loop or set"))]:[2]);case 2:P=!q.sent(),q.label=3;case 3:return P?[2]:d&&!f(d,S.consent)?[2,j]:(k=u(j)?j:e,h?(x=_sliced_to_array(h,2),E=x[0],R=x[1],"this"!==E?[3,4]:(I=[e],[3,6])):[3,10]);case 4:return[4,g(e,E,S,n)];case 5:I=q.sent(),q.label=6;case 6:return i(A=I)?[4,Promise.all(A.map(function(e){return u(e)?g(e,R,S,n):void 0}))]:[3,8];case 7:return D=q.sent().filter(u),[3,9];case 8:D=void 0,q.label=9;case 9:return k=D,[3,21];case 10:return m?[4,Object.entries(m).reduce(function(t,r){var o=_sliced_to_array(r,2),a=o[0],i=o[1];return _async_to_generator(function(){var r,o;return _ts_generator(this,function(c){switch(c.label){case 0:return[4,t];case 1:return r=c.sent(),[4,g(e,i,S,n)];case 2:return o=c.sent(),[2,(u(o)&&(r[a]=o),r)]}})})()},Promise.resolve({}))]:[3,12];case 11:return k=q.sent(),[3,20];case 12:return w?[4,Promise.all(w.map(function(t){return te(e,t,S,n)}))]:[3,14];case 13:return M=k=q.sent(),[3,19];case 14:return v?(T=k=U(e,v,j),[3,18]):[3,15];case 15:return(C=y)?[4,p(y,function(e){if(_instanceof(e,Z))throw e;b(S,n,"mapping fn failed",e)})(e,S)]:[3,17];case 16:C=k=q.sent(),q.label=17;case 17:T=C,q.label=18;case 18:M=T,q.label=19;case 19:q.label=20;case 20:q.label=21;case 21:return(K=O)?[4,p(O,function(e){if(_instanceof(e,Z))throw e;return b(S,n,"mapping validate failed",e),!1})(k,S)]:[3,23];case 22:K=!q.sent(),q.label=23;case 23:return K&&(k=void 0),N=_(k),[2,u(N)?N:_(j)]}})})()},Promise.resolve(void 0))]})})()}var re,ne="observe",oe="call:",ae=["name","length","prototype","arguments","caller"],ie="data-walkeros-vendor",ue=new WeakMap,ce=function(){return new Q("Vendor script failed to load",{code:"vendor-not-loaded"})},se=/^\d+$/,le={},fe={type:"matomo",config:{},init:function(e){return _async_to_generator(function(e){var t,r,n,o,a,i,u,c,s,l,f;return _ts_generator(this,function(_){switch(_.label){case 0:if(t=e.config,r=e.env,n=x(r),o=n.window,a=t.settings,i=void 0===a?{}:a,u=t.loadScript,c=i.siteId,s=i.url,l=[],u){if(!c||!s)throw new Q("Matomo with loadScript needs settings ".concat(_to_consumable_array(c?[]:["siteId"]).concat(_to_consumable_array(s?[]:["url"])).join(" and ")),{code:"config"});f=C(s),l.push(["setTrackerUrl",f+"matomo.php"]),l.push(["setSiteId",c])}return i.disableCookies&&l.push(["disableCookies"]),!1!==i.enableLinkTracking&&l.push(["enableLinkTracking"]),i.enableHeartBeatTimer&&l.push(["enableHeartBeatTimer",i.enableHeartBeatTimer]),o._paq=o._paq||[],u&&T(s,r,t.timeout),[4,M(o._paq,l,"vendor-not-ready","Matomo did not take its setup commands")];case 1:return _.sent(),[2]}})}).apply(this,arguments)},push:function(t,r){return _async_to_generator(function(t,r){var n,o,a,u,c,s,l,f,_,p,d,y,b,g,m,w,O,j,S,P,k,E,A;return _ts_generator(this,function(D){switch(D.label){case 0:if(n=r.config,o=r.rule,a=void 0===o?{}:o,u=r.data,c=r.env,s=r.collector,l=r.logger,f=r.id,_=n.settings||{},n.loadScript&&T(_.url,c,n.timeout).check(),!(p=x(c).window._paq))throw new Q("Matomo _paq queue missing: init did not run",{code:"vendor-not-ready"});return d=a.settings||{},y=d.goalId,b=i(u)?u:[u],g=void 0===y||("number"==typeof(C=y)?Number.isInteger(C)&&C>0:"string"==typeof C&&_e.test(C))?y:void 0,void 0!==y&&void 0===g&&v(s,l,{step:e("destination",f),code:"config"},"Matomo goal skipped: goalId is not a positive integer",{event:t.name,mappingKey:"goalId"}),a.silent?(m=void 0,[3,10]):[3,1];case 1:return d.siteSearch?(m=["trackSiteSearch"].concat(_to_consumable_array(b)),[3,10]):[3,2];case 2:return d.contentImpression?(m=["trackContentImpression"].concat(_to_consumable_array(b)),[3,10]):[3,3];case 3:return d.contentInteraction?(m=["trackContentInteraction"].concat(_to_consumable_array(b)),[3,10]):[3,4];case 4:return a.name?(m=[t.name].concat(_to_consumable_array(b)),[3,10]):[3,5];case 5:return"page view"!==t.name?[3,9]:void 0!==a.data?[3,7]:(O=["trackPageView"],[4,h(t,"data.title",{collector:s})]);case 6:return w=O.concat([D.sent()]),[3,8];case 7:w=["trackPageView"].concat(_to_consumable_array(b)),D.label=8;case 8:return m=w,[3,10];case 9:if(void 0===g)throw new Q('Matomo has no command for "'.concat(t.name,'": map it with a rule name, a tracking flag or a goal, or ignore it'),{code:"missing-input"});D.label=10;case 10:return void 0===g||void 0===d.goalValue?[3,12]:[4,h(t,d.goalValue,{collector:s})];case 11:return S=D.sent(),[3,13];case 12:S=void 0,D.label=13;case 13:return j=S,[4,R(_.customDimensions,t,s)];case 14:return A=[D.sent()],[4,R(d.customDimensions,t,s)];case 15:return P=I.apply(void 0,A.concat([D.sent()])),k=P.before,E=P.after,m||void 0!==g?[4,M(p,_to_consumable_array(k).concat(_to_consumable_array(m?[m]:[]),_to_consumable_array(void 0!==g?[["trackGoal",g,j]]:[]),_to_consumable_array(E)),"transport","Matomo did not take the event commands")]:[3,17];case 16:D.sent(),D.label=17;case 17:return[2]}var C})}).apply(this,arguments)},on:function(e,t){return _async_to_generator(function(e,t){var r,n,o,a,i,u,c,l;return _ts_generator(this,function(_){switch(_.label){case 0:return r=t.config,n=t.data,o=t.env,a=t.collector,i=r.consent,"consent"===e&&i&&s(n)?Object.keys(i).some(function(e){return e in n})&&(u=x(o).window._paq)?(c=!1!==f(i,a.consent),l=s(r.settings)&&!0===r.settings.disableCookies,[4,M(u,[c?l?["setConsentGiven",!1]:["setConsentGiven"]:["forgetConsentGiven"]],"consent-not-applied","Matomo did not take the consent update")]):[2]:[2];case 1:return _.sent(),[2]}})}).apply(this,arguments)}},_e=/^[1-9]\d*$/,pe=fe;return re=B,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,c=function(){var o=u.value;V.call(e,o)||o===r||K(e,o,{get:function(){return t[o]},enumerable:!(n=N(t,o))||n.enumerable})},s=q(t)[Symbol.iterator]();!(o=(u=s.next()).done);o=!0)c()}catch(e){a=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(a)throw i}}}return e}(K({},"__esModule",{value:!0}),re)}();
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,r={};((e,o)=>{for(var n in o)t(e,n,{get:o[n],enumerable:!0})})(r,{DestinationMatomo:()=>p,default:()=>b,destinationMatomo:()=>f}),module.exports=(e=r,((e,r,a,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let c of n(r))i.call(e,c)||c===a||t(e,c,{get:()=>r[c],enumerable:!(s=o(r,c))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a=require("@walkeros/core"),s=require("@walkeros/web-core"),c=require("@walkeros/core"),l=/^\d+$/;async function d(e,t,o){const n={};if(!e)return n;for(const[i,r]of Object.entries(e)){const e=await(0,c.getMappingValue)(t,r,{collector:o});n[i]=null==e?void 0:String(e)}return n}function u(e){return function(e){return Object.entries(e).filter(([e])=>l.test(e)).sort(([e],[t])=>Number(e)-Number(t))}(e).map(([e,t])=>void 0===t?["deleteCustomDimension",Number(e)]:["setCustomDimension",Number(e),t])}var p={};function m(e,t,o,n){return(0,a.stepCall)(()=>Promise.all(t.map(t=>e.push(t))),o,n)}function g(e,t,o){return(0,s.loadVendor)(e?`${w(e)}matomo.js`:void 0,()=>(0,s.getEnv)(t).window._paq,{timeout:o,document:(0,s.getEnv)(t).document})}var f={type:"matomo",config:{},async init({config:e,env:t}){const{window:o}=(0,s.getEnv)(t),{settings:n={},loadScript:i}=e,{siteId:r,url:c}=n,l=[];if(i){if(!r||!c)throw new a.StepError(`Matomo with loadScript needs settings ${[...r?[]:["siteId"],...c?[]:["url"]].join(" and ")}`,{code:"config"});const e=w(c);l.push(["setTrackerUrl",e+"matomo.php"]),l.push(["setSiteId",r])}n.disableCookies&&l.push(["disableCookies"]),!1!==n.enableLinkTracking&&l.push(["enableLinkTracking"]),n.enableHeartBeatTimer&&l.push(["enableHeartBeatTimer",n.enableHeartBeatTimer]),o._paq=o._paq||[],i&&g(c,t,e.timeout),await m(o._paq,l,"vendor-not-ready","Matomo did not take its setup commands")},async push(e,{config:t,rule:o={},data:n,env:i,collector:r,logger:c,id:l}){const p=t.settings||{};t.loadScript&&g(p.url,i,t.timeout).check();const f=(0,s.getEnv)(i).window._paq;if(!f)throw new a.StepError("Matomo _paq queue missing: init did not run",{code:"vendor-not-ready"});const w=o.settings||{},{goalId:b}=w,k=(0,a.isArray)(n)?n:[n],h=void 0===b||("number"==typeof(y=b)?Number.isInteger(y)&&y>0:"string"==typeof y&&v.test(y))?b:void 0;var y;let O;if(void 0!==b&&void 0===h&&(0,a.reportCause)(r,c,{step:(0,a.stepId)("destination",l),code:"config"},"Matomo goal skipped: goalId is not a positive integer",{event:e.name,mappingKey:"goalId"}),o.silent)O=void 0;else if(w.siteSearch)O=["trackSiteSearch",...k];else if(w.contentImpression)O=["trackContentImpression",...k];else if(w.contentInteraction)O=["trackContentInteraction",...k];else if(o.name)O=[e.name,...k];else if("page view"===e.name)O=void 0===o.data?["trackPageView",await(0,a.getMappingValue)(e,"data.title",{collector:r})]:["trackPageView",...k];else if(void 0===h)throw new a.StepError(`Matomo has no command for "${e.name}": map it with a rule name, a tracking flag or a goal, or ignore it`,{code:"missing-input"});const j=void 0!==h&&void 0!==w.goalValue?await(0,a.getMappingValue)(e,w.goalValue,{collector:r}):void 0,{before:C,after:M}=function(e,t){const o=u({...e,...t});if(0===Object.keys(t).length)return{before:o,after:[]};const n={};for(const[o,i]of Object.entries(t))Object.prototype.hasOwnProperty.call(e,o)||void 0===i||(n[o]=void 0);return{before:o,after:[...u(n),...u(e)]}}(await d(p.customDimensions,e,r),await d(w.customDimensions,e,r));(O||void 0!==h)&&await m(f,[...C,...O?[O]:[],...void 0!==h?[["trackGoal",h,j]]:[],...M],"transport","Matomo did not take the event commands")},async on(e,{config:t,data:o,env:n,collector:i}){const r=t.consent;if("consent"!==e||!r||!(0,a.isObject)(o))return;if(!Object.keys(r).some(e=>e in o))return;const c=(0,s.getEnv)(n).window._paq;if(!c)return;const l=!1!==(0,a.getGrantedConsent)(r,i.consent),d=(0,a.isObject)(t.settings)&&!0===t.settings.disableCookies,u=l?d?["setConsentGiven",!1]:["setConsentGiven"]:["forgetConsentGiven"];await m(c,[u],"consent-not-applied","Matomo did not take the consent update")}},v=/^[1-9]\d*$/;function w(e){return`${e.replace(/\/+$/,"")}/`}var b=f;//# sourceMappingURL=index.js.map
|