@walkeros/web-destination-heap 4.8.0-next-1791441510508 → 4.8.0
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 +5 -3
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/walkerOS.json +8 -8
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @walkeros/web-destination-heap
|
|
2
2
|
|
|
3
|
-
## 4.8.0
|
|
3
|
+
## 4.8.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
`loadScript` ignores them. The settings schema lists `heapConfig` for further
|
|
10
10
|
`heap.load()` options, and the step examples name the destination config they
|
|
11
11
|
rely on and the consent methods the classic SDK lacks.
|
|
12
|
+
- Updated dependencies [7132619]
|
|
12
13
|
- Updated dependencies [5593d7b]
|
|
13
|
-
|
|
14
|
-
- @walkeros/
|
|
14
|
+
- Updated dependencies [421233d]
|
|
15
|
+
- @walkeros/core@4.8.0
|
|
16
|
+
- @walkeros/web-core@4.8.0
|
|
15
17
|
|
|
16
18
|
## 4.7.2
|
|
17
19
|
|
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,{DestinationHeap:()=>W,default:()=>K,destinationHeap:()=>M});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 y(e){return Array.isArray(e)}function v(e){return void 0!==e}function w(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function h(e){return"object"==typeof e&&null!==e&&!y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function b(e){return"string"==typeof e}function m(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&y(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=m(e,t,n);i.push(r)}return i}if(o=h(o)||y(o)?o[t]:void 0,void 0===o)break}return v(o)?o:n}function P(e){return function(e){return"boolean"==typeof e}(e)||b(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!v(e)||y(e)&&e.every(P)||h(e)&&Object.values(e).every(P)}function O(e){return P(e)?e:void 0}function j(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 E=class e extends Error{constructor(t,n){super(t,n),this.name="FatalError",Object.setPrototypeOf(this,e.prototype)}};async function R(e,t={},n={}){var r,o;const i=n.consent||(null==(r=n.collector)?void 0:r.consent),c=null!=(o=n.event)?o:{};if(!n.collector)throw new Error("getMappingValue: context.collector is required");const s={event:c,mapping:t,collector:n.collector,logger:n.collector.logger,consent:i},a=y(t)?t:[t];for(const t of a){const r=await j(k,e=>{if(e instanceof E)throw e;n.collector&&n.collector.status.failed++,s.logger.error("mapping processing failed",{event:c,error:e})})(e,t,{...s,mapping:t});if(v(r))return r}}async function k(e,t,n){return(y(t)?t:[t]).reduce(async(t,r)=>{const o=await t;if(o)return o;const i=b(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,w={...n,mapping:r};if(c&&!await j(c,e=>{if(e instanceof E)throw e;return w.logger.error("mapping condition failed",{event:w.event,error:e}),!1})(e,w))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,w.consent))return g;let h=v(g)?g:e;if(f){const[t,n]=f,r="this"===t?[e]:await R(e,t,w);h=y(r)?(await Promise.all(r.map(e=>v(e)?R(e,n,w):void 0))).filter(v):void 0}else l?h=await Object.entries(l).reduce(async(t,[n,r])=>{const o=await t,i=await R(e,r,w);return v(i)&&(o[n]=i),o},Promise.resolve({})):p?h=await Promise.all(p.map(t=>k(e,t,w))):u?h=m(e,u,g):a&&(h=await j(a,e=>{if(e instanceof E)throw e;w.logger.error("mapping fn failed",{event:w.event,error:e})})(e,w));d&&!await j(d,e=>{if(e instanceof E)throw e;return w.logger.error("mapping validate failed",{event:w.event,error:e}),!1})(h,w)&&(h=void 0);const P=O(h);return v(P)?P:O(g)},Promise.resolve(void 0))}async function S(e,t={},n={}){var r,o;if(!v(e))return;const i=h(e)&&e.consent||n.consent||(null==(r=n.collector)?void 0:r.consent),c=null!=(o=n.event)?o:h(e)?e:{};return R(e,t,{...n,consent:i,event:c})}var A="observe";function T(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function x(e){return"function"==typeof e}function _(e){return"object"==typeof e&&null!==e}var D=["name","length","prototype","arguments","caller"];function N(e,t){if(-1!==D.indexOf(t))return!1;let n=e;for(;x(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!x(e)||!x(Object.getPrototypeOf(e)))return!1;n=e}return!1}function I(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function $(e,t){let n=e;for(const e of t){if(x(n)){if(!N(n,e))return!0;if(!I(n,e))return!1}else if(w(n)){if(!(e in n))return!0}else if(!_(n)||!(e in n))return!1;n=Reflect.get(n,e)}return x(n)}function C(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[A];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[A];const e=function(e,t,n){const r=[],o=[],i=[];for(const n of t){const t=T(n);if(0===t.length)continue;const r=t.join(".");i.push({rest:t,fn:r}),$(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:w(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>u(e,t)):x(e)?v(e,[],t):_(e)?p(e,t):e}function f(e){return(_(e)||x(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 x(e)?g(e,t):t.some(t=>!I(e,t.rest[0]))?function(e,t){const n=Object.create(Object.getPrototypeOf(e)),r=y(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=y(e,t,()=>r),r=new Proxy(e,{get:(e,t)=>"string"!=typeof t||I(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 y(e,t,n){const r=new Map;return{get(o){const i=Reflect.get(e,o,e);if("string"!=typeof o)return i;if(!x(i)&&!_(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)&&(!x(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 x(i)?u=v(i,s,a,{proxy:n(),target:e}):a.length>0&&(u=p(i,a)),r.set(o,{value:i,out:u}),u}}}function v(e,t,n,r){const o=()=>n.filter(t=>!N(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||!I(e,t))return r;if(!N(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 x(r)?u=v(r,o,s,{proxy:c,target:e}):_(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 _(s)||x(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=T(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 W={};function q(e){var t;if(null==(t=null==e?void 0:e.window)?void 0:t.heap)return e.window.heap;const{window:n}=C(e);return n.heap}function B(e){const t={};if(!h(e))return t;for(const[n,r]of Object.entries(e))"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||(t[n]=r);return t}var M={type:"heap",config:{},init({config:e,env:t}){var n,r,o;const i=e.settings;if(!(null==i?void 0:i.appId))return!1;if(null==(n=null==t?void 0:t.window)?void 0:n.heap)return e;const{window:c,document:s}=C(t),a=c,u=s,f={disableTextCapture:null==(r=i.disableTextCapture)||r,disablePageviewAutocapture:null==(o=i.disablePageviewAutocapture)||o,...void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},...void 0!==i.secureCookie&&{secureCookie:i.secureCookie},...void 0!==i.ingestServer&&{ingestServer:i.ingestServer},...i.heapConfig};if(!a.heap){const e={load:(t,n)=>{e.appid=t,e.config=null!=n?n:{}},track:()=>{},identify:()=>{},resetIdentity:()=>{},addUserProperties:()=>{},addEventProperties:()=>{},clearEventProperties:()=>{},startTracking:()=>{},stopTracking:()=>{},q:[]},t=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"];for(const n of t){const t=(...t)=>{e.q=e.q||[],e.q.push([n,...t])};e[n]=t}a.heap=e}e.loadScript&&function(e,t){const n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src=`https://cdn.heapanalytics.com/js/heap-${e}.js`;const r=t.getElementsByTagName("script")[0];r&&r.parentNode?r.parentNode.insertBefore(n,r):t.head.appendChild(n)}(i.appId,u);const l=a.heap;return l.appid||l.load(i.appId,f),e},async push(e,{config:t,data:n,env:r,rule:o,collector:i}){var c,s;const a=q(r);if(!a)return;const u=t.settings||{},f=(null==o?void 0:o.settings)||{};if(void 0!==f.reset){("boolean"==typeof f.reset?f.reset:await S(e,f.reset,{collector:i}))&&a.resetIdentity()}const l=null!=(c=f.identify)?c:u.identify;if(void 0!==l){const t=await S(e,l,{collector:i});b(t)&&t.length>0&&a.identify(t)}const p=null!=(s=f.userProperties)?s:u.userProperties;if(void 0!==p){const t=await S(e,p,{collector:i});h(t)&&a.addUserProperties(B(t))}if(void 0!==f.eventProperties){const t=await S(e,f.eventProperties,{collector:i});h(t)&&a.addEventProperties(B(t))}if(void 0!==f.clearEventProperties){("boolean"==typeof f.clearEventProperties?f.clearEventProperties:await S(e,f.clearEventProperties,{collector:i}))&&a.clearEventProperties()}if(!0!==(null==o?void 0:o.silent)){const t=b(null==o?void 0:o.name)?o.name:e.name,r=B(n);a.track(t,r)}},on(e,t){var n;if("consent"!==e||!t.data)return;const r=q(t.env);if(!r)return;const o=null==(n=t.config)?void 0:n.consent;if(!o||0===Object.keys(o).length)return;const i=t.data;Object.keys(o).every(e=>!0===i[e])?r.startTracking():r.stopTracking()}};var U,K=M;return U=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}),U)})();
|
|
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,{DestinationHeap:()=>W,default:()=>K,destinationHeap:()=>M});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 w(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function h(e){return"object"==typeof e&&null!==e&&!v(e)&&"[object Object]"===Object.prototype.toString.call(e)}function b(e){return"string"==typeof e}function m(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=m(e,t,n);i.push(r)}return i}if(o=h(o)||v(o)?o[t]:void 0,void 0===o)break}return y(o)?o:n}function P(e){return function(e){return"boolean"==typeof e}(e)||b(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!y(e)||v(e)&&e.every(P)||h(e)&&Object.values(e).every(P)}function O(e){return P(e)?e:void 0}function j(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 E=class e extends Error{constructor(t,n){super(t,n),this.name="FatalError",Object.setPrototypeOf(this,e.prototype)}};async function R(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 j(k,e=>{if(e instanceof E)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 k(e,t,n){return(v(t)?t:[t]).reduce(async(t,r)=>{const o=await t;if(o)return o;const i=b(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,w={...n,mapping:r};if(c&&!await j(c,e=>{if(e instanceof E)throw e;return w.logger.error("mapping condition failed",{event:w.event,error:e}),!1})(e,w))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,w.consent))return g;let h=y(g)?g:e;if(f){const[t,n]=f,r="this"===t?[e]:await R(e,t,w);h=v(r)?(await Promise.all(r.map(e=>y(e)?R(e,n,w):void 0))).filter(y):void 0}else l?h=await Object.entries(l).reduce(async(t,[n,r])=>{const o=await t,i=await R(e,r,w);return y(i)&&(o[n]=i),o},Promise.resolve({})):p?h=await Promise.all(p.map(t=>k(e,t,w))):u?h=m(e,u,g):a&&(h=await j(a,e=>{if(e instanceof E)throw e;w.logger.error("mapping fn failed",{event:w.event,error:e})})(e,w));d&&!await j(d,e=>{if(e instanceof E)throw e;return w.logger.error("mapping validate failed",{event:w.event,error:e}),!1})(h,w)&&(h=void 0);const P=O(h);return y(P)?P:O(g)},Promise.resolve(void 0))}async function S(e,t={},n){var r,o;if(!y(e))return;const i=h(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:h(e)?e:{};return R(e,t,{...n,consent:i,event:c})}var A="observe";function T(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function x(e){return"function"==typeof e}function _(e){return"object"==typeof e&&null!==e}var D=["name","length","prototype","arguments","caller"];function N(e,t){if(-1!==D.indexOf(t))return!1;let n=e;for(;x(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!x(e)||!x(Object.getPrototypeOf(e)))return!1;n=e}return!1}function I(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function $(e,t){let n=e;for(const e of t){if(x(n)){if(!N(n,e))return!0;if(!I(n,e))return!1}else if(w(n)){if(!(e in n))return!0}else if(!_(n)||!(e in n))return!1;n=Reflect.get(n,e)}return x(n)}function C(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[A];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[A];const e=function(e,t,n){const r=[],o=[],i=[];for(const n of t){const t=T(n);if(0===t.length)continue;const r=t.join(".");i.push({rest:t,fn:r}),$(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:w(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>u(e,t)):x(e)?y(e,[],t):_(e)?p(e,t):e}function f(e){return(_(e)||x(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 x(e)?g(e,t):t.some(t=>!I(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||I(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(!x(i)&&!_(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)&&(!x(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 x(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=>!N(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||!I(e,t))return r;if(!N(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 x(r)?u=y(r,o,s,{proxy:c,target:e}):_(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 _(s)||x(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=T(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 W={};function q(e){var t;if(null==(t=null==e?void 0:e.window)?void 0:t.heap)return e.window.heap;const{window:n}=C(e);return n.heap}function B(e){const t={};if(!h(e))return t;for(const[n,r]of Object.entries(e))"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||(t[n]=r);return t}var M={type:"heap",config:{},init({config:e,env:t}){var n,r,o;const i=e.settings;if(!(null==i?void 0:i.appId))return!1;if(null==(n=null==t?void 0:t.window)?void 0:n.heap)return e;const{window:c,document:s}=C(t),a=c,u=s,f={disableTextCapture:null==(r=i.disableTextCapture)||r,disablePageviewAutocapture:null==(o=i.disablePageviewAutocapture)||o,...void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},...void 0!==i.secureCookie&&{secureCookie:i.secureCookie},...void 0!==i.ingestServer&&{ingestServer:i.ingestServer},...i.heapConfig};if(!a.heap){const e={load:(t,n)=>{e.appid=t,e.config=null!=n?n:{}},track:()=>{},identify:()=>{},resetIdentity:()=>{},addUserProperties:()=>{},addEventProperties:()=>{},clearEventProperties:()=>{},startTracking:()=>{},stopTracking:()=>{},q:[]},t=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"];for(const n of t){const t=(...t)=>{e.q=e.q||[],e.q.push([n,...t])};e[n]=t}a.heap=e}e.loadScript&&function(e,t){const n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src=`https://cdn.heapanalytics.com/js/heap-${e}.js`;const r=t.getElementsByTagName("script")[0];r&&r.parentNode?r.parentNode.insertBefore(n,r):t.head.appendChild(n)}(i.appId,u);const l=a.heap;return l.appid||l.load(i.appId,f),e},async push(e,{config:t,data:n,env:r,rule:o,collector:i}){var c,s;const a=q(r);if(!a)return;const u=t.settings||{},f=(null==o?void 0:o.settings)||{};if(void 0!==f.reset){("boolean"==typeof f.reset?f.reset:await S(e,f.reset,{collector:i}))&&a.resetIdentity()}const l=null!=(c=f.identify)?c:u.identify;if(void 0!==l){const t=await S(e,l,{collector:i});b(t)&&t.length>0&&a.identify(t)}const p=null!=(s=f.userProperties)?s:u.userProperties;if(void 0!==p){const t=await S(e,p,{collector:i});h(t)&&a.addUserProperties(B(t))}if(void 0!==f.eventProperties){const t=await S(e,f.eventProperties,{collector:i});h(t)&&a.addEventProperties(B(t))}if(void 0!==f.clearEventProperties){("boolean"==typeof f.clearEventProperties?f.clearEventProperties:await S(e,f.clearEventProperties,{collector:i}))&&a.clearEventProperties()}if(!0!==(null==o?void 0:o.silent)){const t=b(null==o?void 0:o.name)?o.name:e.name,r=B(n);a.track(t,r)}},on(e,t){var n;if("consent"!==e||!t.data)return;const r=q(t.env);if(!r)return;const o=null==(n=t.config)?void 0:n.consent;if(!o||0===Object.keys(o).length)return;const i=t.data;Object.keys(o).every(e=>!0===i[e])?r.startTracking():r.stopTracking()}};var U,K=M;return U=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}),U)})();
|
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 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},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 N(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]}})})()}},_=function(e){return _async_to_generator(function(e){var t,r,n,o,a,c,l,s,f,_,y,v,d,b,h,g,w=arguments;return _ts_generator(this,function(m){switch(m.label){case 0:if(t=w.length>1&&void 0!==w[1]?w[1]:{},a=(r=w.length>2&&void 0!==w[2]?w[2]:{}).consent||(null===(o=r.collector)||void 0===o?void 0:o.consent),c=null!==(n=r.event)&&void 0!==n?n:{},!r.collector)throw new Error("getMappingValue: context.collector is required");l={event:c,mapping:t,collector:r.collector,logger:r.collector.logger,consent:a},s=i(t)?t:[t],f=!0,_=!1,y=void 0,m.label=1;case 1:m.trys.push([1,6,7,8]),v=s[Symbol.iterator](),m.label=2;case 2:return(f=(d=v.next()).done)?[3,5]:(b=d.value,[4,p(M,function(e){if(_instanceof(e,C))throw e;r.collector&&r.collector.status.failed++,l.logger.error("mapping processing failed",{event:c,error:e})})(e,b,_object_spread_props(_object_spread({},l),{mapping:b}))]);case 3:if(h=m.sent(),u(h))return[2,h];m.label=4;case 4:return f=!0,[3,2];case 5:return[3,8];case 6:return g=m.sent(),_=!0,y=g,[3,8];case 7:try{f||null==v.return||v.return()}finally{if(_)throw y}return[7];case 8:return[2]}})}).apply(this,arguments)},y=function(e){return _async_to_generator(function(e){var t,r,n,o,a,i,c=arguments;return _ts_generator(this,function(s){return t=c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2&&void 0!==c[2]?c[2]:{},u(e)?(a=l(e)&&e.consent||r.consent||(null===(o=r.collector)||void 0===o?void 0:o.consent),i=null!==(n=r.event)&&void 0!==n?n:l(e)?e:{},[2,_(e,t,_object_spread_props(_object_spread({},r),{consent:a,event:i}))]):[2]})}).apply(this,arguments)},v=function(e){var t=(e.startsWith(q)?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},h=function(e,t){if(-1!==G.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},g=function(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},w=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 l=i.value;if(d(r)){if(!h(r,l))return!0;if(!g(r,l))return!1}else if(c(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==u.return||u.return()}finally{if(o)throw a}}return d(r)},m=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,u=!1,l=void 0;try{for(var s,f=t[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var p=s.value,_=v(p);if(0!==_.length){var y=_.join(".");a.push({rest:_,fn:y}),w(e,_)||o.push(y)}}}catch(e){u=!0,l=e}finally{try{i||null==f.return||f.return()}finally{if(u)throw l}}var m=new WeakMap,O=new WeakSet;function j(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 l=u.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==c.return||c.return()}finally{if(a)throw i}}}function P(e,t){return 0===t.length||S(e)?e:c(e)&&!t.some(function(t){return t.rest[0]in e})?Promise.resolve(e).then(function(e){return P(e,t)}):d(e)?I(e,[],t):b(e)?k(e,t):e}function S(e){return(b(e)||d(e))&&O.has(e)}function E(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 l=u.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==c.return||c.return()}finally{if(a)throw i}}return{leafs:r,deeper:n}}function k(e,t){var r,n=t.map(function(e){return"".concat(e.fn,":").concat(e.rest.join("."))}).join("|"),o=null!==(r=m.get(e))&&void 0!==r?r:new Map;m.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!g(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 O.add(o),o}(e,t):x(e,t)}function x(e,t){var r=A(e,t,function(){return n}),n=new Proxy(e,{get:function(e,t){return"string"!=typeof t||g(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 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(!d(a)&&!b(a))return a;if(S(a))return a;var i=n.get(o);if(i&&i.value===a)return i.out;var u=E(t,o),c=u.leafs,l=u.deeper;if(!(c.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=I(a,c,l,{proxy:r(),target:e}):l.length>0&&(s=k(a,l)),n.set(o,{value:a,out:s}),s}}}function I(e,t,r,n){var o=function(){return r.filter(function(t){return!h(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||!g(e,t))return n;if(!h(e,t))return n;var o=E(r,t),u=o.leafs,c=o.deeper;if(0===u.length&&0===c.length)return n;if(S(n))return n;var l=a.get(t);if(l&&l.value===n)return l.out;var s=n;return d(n)?s=I(n,u,c,{proxy:i,target:e}):b(n)&&c.length>0&&(s=k(n,c)),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 P(Reflect.apply(e,i,a),o())},construct:function(e,r,n){j(t,r);var a=Reflect.construct(e,r,n===i?e:n),u=P(a,o());return b(u)||d(u)?u: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,u=void 0;try{for(var l,s=r.paths[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var f=l.value,p=v(f)[0];if(void 0!==p){var _=t[p];null!==_&&"object"==(void 0===_?"undefined":_type_of(_))&&o.add(p)}}}catch(e){i=!0,u=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw u}}var y=Array.from(o,function(e){return[e,n[e]]}),m=!0,O=!1,j=void 0;try{for(var P,S=y[Symbol.iterator]();!(m=(P=S.next()).done);m=!0){var E=_sliced_to_array(P.value,2),k=E[0],R=E[1];t[k]=R}}catch(e){O=!0,j=e}finally{try{m||null==S.return||S.return()}finally{if(O)throw j}}}return t},O=function(e){var t;return(null==e||null===(t=e.window)||void 0===t?void 0:t.heap)?e.window.heap:m(e).window.heap},j=function(e){var t={};if(!l(e))return t;var r=!0,n=!1,o=void 0;try{for(var a,i=Object.entries(e)[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var u=_sliced_to_array(a.value,2),c=u[0],s=u[1];"string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s||(t[c]=s)}}catch(e){n=!0,o=e}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}return t},P=Object.defineProperty,S=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,k=Object.prototype.hasOwnProperty,R={};!function(e,t){for(var r in t)P(e,r,{get:t[r],enumerable:!0})}(R,{DestinationHeap:function(){return K},default:function(){return F},destinationHeap:function(){return U}});var x=Object.defineProperty,A=function(e,t){for(var r in t)x(e,r,{get:t[r],enumerable:!0})};A({},{stepId:function(){return e}});A({},{getDestination:function(){return t}});A({},{Level:function(){return T}});var I,T=((I=T||{})[I.ERROR=0]="ERROR",I[I.WARN=1]="WARN",I[I.INFO=2]="INFO",I[I.DEBUG=3]="DEBUG",I);A({},{getTransformer:function(){return r}});A({},{getSource:function(){return n}});function D(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("."),s=[],f=!0,p=!1,_=void 0;try{for(var y,v=n[Symbol.iterator]();!(f=(y=v.next()).done);f=!0){var d=D(y.value,c,t);s.push(d)}}catch(e){p=!0,_=e}finally{try{f||null==v.return||v.return()}finally{if(p)throw _}}return s}if(void 0===(n=l(n)||i(n)?n[a]:void 0))break}return u(n)?n:t}function N(e){return function(e){return"boolean"==typeof e}(e)||s(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!u(e)||i(e)&&e.every(N)||l(e)&&Object.values(e).every(N)}A({},{getStore:function(){return o},getStoreValue:function(){return a}});var C=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 M(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,c,l,y,v,d,b,h,g,w,m,O,j,P,S,E,k,R,x,A,I,T,N,B;return _ts_generator(this,function(W){switch(W.label){case 0:return[4,t];case 1:return(o=W.sent())?[2,o]:(a=s(n)?{key:n}:n,Object.keys(a).length?(c=a.condition,l=a.consent,y=a.fn,v=a.key,d=a.loop,b=a.map,h=a.set,g=a.validate,w=a.value,m=_object_spread_props(_object_spread({},r),{mapping:n}),(O=c)?[4,p(c,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping condition failed",{event:m.event,error:e}),!1})(e,m)]:[3,3]):[2]);case 2:O=!W.sent(),W.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,m.consent)?[2,w]:(j=u(w)?w:e,d?(P=_sliced_to_array(d,2),S=P[0],E=P[1],"this"!==S?[3,4]:(R=[e],[3,6])):[3,10]);case 4:return[4,_(e,S,m)];case 5:R=W.sent(),W.label=6;case 6:return i(k=R)?[4,Promise.all(k.map(function(e){return u(e)?_(e,E,m):void 0}))]:[3,8];case 7:return x=W.sent().filter(u),[3,9];case 8:x=void 0,W.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,_(e,a,m)];case 2:return n=i.sent(),[2,(u(n)&&(r[o]=n),r)]}})})()},Promise.resolve({}))]:[3,12];case 11:return j=W.sent(),[3,20];case 12:return h?[4,Promise.all(h.map(function(t){return M(e,t,m)}))]:[3,14];case 13:return A=j=W.sent(),[3,19];case 14:return v?(I=j=D(e,v,w),[3,18]):[3,15];case 15:return(T=y)?[4,p(y,function(e){if(_instanceof(e,C))throw e;m.logger.error("mapping fn failed",{event:m.event,error:e})})(e,m)]:[3,17];case 16:T=j=W.sent(),W.label=17;case 17:I=T,W.label=18;case 18:A=I,W.label=19;case 19:W.label=20;case 20:W.label=21;case 21:return(N=g)?[4,p(g,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping validate failed",{event:m.event,error:e}),!1})(j,m)]:[3,23];case 22:N=!W.sent(),W.label=23;case 23:return N&&(j=void 0),B=f(j),[2,u(B)?B:f(w)]}})})()},Promise.resolve(void 0))]})})()}var B,W="observe",q="call:",G=["name","length","prototype","arguments","caller"],K={},U={type:"heap",config:{},init:function(e){var t,r,n,o=e.config,a=e.env,i=o.settings;if(!(null==i?void 0:i.appId))return!1;if(null==a||null===(n=a.window)||void 0===n?void 0:n.heap)return o;var u=m(a),c=u.window,l=u.document,s=_object_spread({disableTextCapture:null===(t=i.disableTextCapture)||void 0===t||t,disablePageviewAutocapture:null===(r=i.disablePageviewAutocapture)||void 0===r||r},void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},void 0!==i.secureCookie&&{secureCookie:i.secureCookie},void 0!==i.ingestServer&&{ingestServer:i.ingestServer},i.heapConfig);if(!c.heap){var f={load:function(e,t){f.appid=e,f.config=null!=t?t:{}},track:function(){},identify:function(){},resetIdentity:function(){},addUserProperties:function(){},addEventProperties:function(){},clearEventProperties:function(){},startTracking:function(){},stopTracking:function(){},q:[]},p=!0,_=!1,y=void 0;try{for(var v,d=function(){var e=v.value;f[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];f.q=f.q||[],f.q.push([e].concat(_to_consumable_array(r)))}},b=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"][Symbol.iterator]();!(p=(v=b.next()).done);p=!0)d()}catch(e){_=!0,y=e}finally{try{p||null==b.return||b.return()}finally{if(_)throw y}}c.heap=f}o.loadScript&&function(e,t){var r=t.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-".concat(e,".js");var n=t.getElementsByTagName("script")[0];n&&n.parentNode?n.parentNode.insertBefore(r,n):t.head.appendChild(r)}(i.appId,l);var h=c.heap;return h.appid||h.load(i.appId,s),o},push:function(e,t){return _async_to_generator(function(e,t){var r,n,o,a,i,u,c,f,p,_,v,d,b,h,g,w,m,P,S;return _ts_generator(this,function(E){switch(E.label){case 0:return r=t.config,n=t.data,o=t.env,a=t.rule,i=t.collector,(f=O(o))?(p=r.settings||{},void 0===(_=(null==a?void 0:a.settings)||{}).reset?[3,4]:"boolean"!=typeof _.reset?[3,1]:(v=_.reset,[3,3])):[2];case 1:return[4,y(e,_.reset,{collector:i})];case 2:v=E.sent(),E.label=3;case 3:v&&f.resetIdentity(),E.label=4;case 4:return void 0===(d=null!==(u=_.identify)&&void 0!==u?u:p.identify)?[3,6]:[4,y(e,d,{collector:i})];case 5:b=E.sent(),s(b)&&b.length>0&&f.identify(b),E.label=6;case 6:return void 0===(h=null!==(c=_.userProperties)&&void 0!==c?c:p.userProperties)?[3,8]:[4,y(e,h,{collector:i})];case 7:g=E.sent(),l(g)&&f.addUserProperties(j(g)),E.label=8;case 8:return void 0===_.eventProperties?[3,10]:[4,y(e,_.eventProperties,{collector:i})];case 9:w=E.sent(),l(w)&&f.addEventProperties(j(w)),E.label=10;case 10:return void 0===_.clearEventProperties?[3,14]:"boolean"!=typeof _.clearEventProperties?[3,11]:(m=_.clearEventProperties,[3,13]);case 11:return[4,y(e,_.clearEventProperties,{collector:i})];case 12:m=E.sent(),E.label=13;case 13:m&&f.clearEventProperties(),E.label=14;case 14:return!0!==(null==a?void 0:a.silent)&&(P=s(null==a?void 0:a.name)?a.name:e.name,S=j(n),f.track(P,S)),[2]}})}).apply(this,arguments)},on:function(e,t){var r;if("consent"===e&&t.data){var n=O(t.env);if(n){var o=null===(r=t.config)||void 0===r?void 0:r.consent;if(o&&0!==Object.keys(o).length){var a=t.data;Object.keys(o).every(function(e){return!0===a[e]})?n.startTracking():n.stopTracking()}}}}},F=U;return B=R,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;k.call(e,o)||o===r||P(e,o,{get:function(){return t[o]},enumerable:!(n=S(t,o))||n.enumerable})},l=E(t)[Symbol.iterator]();!(o=(u=l.next()).done);o=!0)c()}catch(e){a=!0,i=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw i}}}return e}(P({},"__esModule",{value:!0}),B)}();
|
|
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},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 N(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]}})})()}},_=function(e,t){return _async_to_generator(function(e){var t,r,n,o,a,c,l,s,f,_,y,v,d,b,h,g=arguments;return _ts_generator(this,function(w){switch(w.label){case 0:if(t=g.length>1&&void 0!==g[1]?g[1]:{},!(r=g.length>2?g[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:{},c={event:a,mapping:t,collector:r.collector,logger:r.collector.logger,consent:o},l=i(t)?t:[t],s=!0,f=!1,_=void 0,w.label=1;case 1:w.trys.push([1,6,7,8]),y=l[Symbol.iterator](),w.label=2;case 2:return(s=(v=y.next()).done)?[3,5]:(d=v.value,[4,p(M,function(e){if(_instanceof(e,C))throw e;r.collector.status.failed++,c.logger.error("mapping processing failed",{event:a,error:e})})(e,d,_object_spread_props(_object_spread({},c),{mapping:d}))]);case 3:if(b=w.sent(),u(b))return[2,b];w.label=4;case 4:return s=!0,[3,2];case 5:return[3,8];case 6:return h=w.sent(),f=!0,_=h,[3,8];case 7:try{s||null==y.return||y.return()}finally{if(f)throw _}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,c=arguments;return _ts_generator(this,function(s){return t=c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2?c[2]:void 0,u(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,_(e,t,_object_spread_props(_object_spread({},r),{consent:a,event:i}))]):[2]})}).apply(this,arguments)},v=function(e){var t=(e.startsWith(q)?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},h=function(e,t){if(-1!==G.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},g=function(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},w=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 l=i.value;if(d(r)){if(!h(r,l))return!0;if(!g(r,l))return!1}else if(c(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==u.return||u.return()}finally{if(o)throw a}}return d(r)},m=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,u=!1,l=void 0;try{for(var s,f=t[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var p=s.value,_=v(p);if(0!==_.length){var y=_.join(".");a.push({rest:_,fn:y}),w(e,_)||o.push(y)}}}catch(e){u=!0,l=e}finally{try{i||null==f.return||f.return()}finally{if(u)throw l}}var m=new WeakMap,O=new WeakSet;function j(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 l=u.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==c.return||c.return()}finally{if(a)throw i}}}function P(e,t){return 0===t.length||S(e)?e:c(e)&&!t.some(function(t){return t.rest[0]in e})?Promise.resolve(e).then(function(e){return P(e,t)}):d(e)?I(e,[],t):b(e)?k(e,t):e}function S(e){return(b(e)||d(e))&&O.has(e)}function E(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 l=u.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==c.return||c.return()}finally{if(a)throw i}}return{leafs:r,deeper:n}}function k(e,t){var r,n=t.map(function(e){return"".concat(e.fn,":").concat(e.rest.join("."))}).join("|"),o=null!==(r=m.get(e))&&void 0!==r?r:new Map;m.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!g(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 O.add(o),o}(e,t):x(e,t)}function x(e,t){var r=A(e,t,function(){return n}),n=new Proxy(e,{get:function(e,t){return"string"!=typeof t||g(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 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(!d(a)&&!b(a))return a;if(S(a))return a;var i=n.get(o);if(i&&i.value===a)return i.out;var u=E(t,o),c=u.leafs,l=u.deeper;if(!(c.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=I(a,c,l,{proxy:r(),target:e}):l.length>0&&(s=k(a,l)),n.set(o,{value:a,out:s}),s}}}function I(e,t,r,n){var o=function(){return r.filter(function(t){return!h(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||!g(e,t))return n;if(!h(e,t))return n;var o=E(r,t),u=o.leafs,c=o.deeper;if(0===u.length&&0===c.length)return n;if(S(n))return n;var l=a.get(t);if(l&&l.value===n)return l.out;var s=n;return d(n)?s=I(n,u,c,{proxy:i,target:e}):b(n)&&c.length>0&&(s=k(n,c)),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 P(Reflect.apply(e,i,a),o())},construct:function(e,r,n){j(t,r);var a=Reflect.construct(e,r,n===i?e:n),u=P(a,o());return b(u)||d(u)?u: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,u=void 0;try{for(var l,s=r.paths[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var f=l.value,p=v(f)[0];if(void 0!==p){var _=t[p];null!==_&&"object"==(void 0===_?"undefined":_type_of(_))&&o.add(p)}}}catch(e){i=!0,u=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw u}}var y=Array.from(o,function(e){return[e,n[e]]}),m=!0,O=!1,j=void 0;try{for(var P,S=y[Symbol.iterator]();!(m=(P=S.next()).done);m=!0){var E=_sliced_to_array(P.value,2),k=E[0],R=E[1];t[k]=R}}catch(e){O=!0,j=e}finally{try{m||null==S.return||S.return()}finally{if(O)throw j}}}return t},O=function(e){var t;return(null==e||null===(t=e.window)||void 0===t?void 0:t.heap)?e.window.heap:m(e).window.heap},j=function(e){var t={};if(!l(e))return t;var r=!0,n=!1,o=void 0;try{for(var a,i=Object.entries(e)[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var u=_sliced_to_array(a.value,2),c=u[0],s=u[1];"string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s||(t[c]=s)}}catch(e){n=!0,o=e}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}return t},P=Object.defineProperty,S=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,k=Object.prototype.hasOwnProperty,R={};!function(e,t){for(var r in t)P(e,r,{get:t[r],enumerable:!0})}(R,{DestinationHeap:function(){return K},default:function(){return F},destinationHeap:function(){return U}});var x=Object.defineProperty,A=function(e,t){for(var r in t)x(e,r,{get:t[r],enumerable:!0})};A({},{stepId:function(){return e}});A({},{getDestination:function(){return t}});A({},{Level:function(){return T}});var I,T=((I=T||{})[I.ERROR=0]="ERROR",I[I.WARN=1]="WARN",I[I.INFO=2]="INFO",I[I.DEBUG=3]="DEBUG",I);A({},{getTransformer:function(){return r}});A({},{getSource:function(){return n}});function D(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("."),s=[],f=!0,p=!1,_=void 0;try{for(var y,v=n[Symbol.iterator]();!(f=(y=v.next()).done);f=!0){var d=D(y.value,c,t);s.push(d)}}catch(e){p=!0,_=e}finally{try{f||null==v.return||v.return()}finally{if(p)throw _}}return s}if(void 0===(n=l(n)||i(n)?n[a]:void 0))break}return u(n)?n:t}function N(e){return function(e){return"boolean"==typeof e}(e)||s(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!u(e)||i(e)&&e.every(N)||l(e)&&Object.values(e).every(N)}A({},{getStore:function(){return o},getStoreValue:function(){return a}});var C=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 M(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,c,l,y,v,d,b,h,g,w,m,O,j,P,S,E,k,R,x,A,I,T,N,B;return _ts_generator(this,function(W){switch(W.label){case 0:return[4,t];case 1:return(o=W.sent())?[2,o]:(a=s(n)?{key:n}:n,Object.keys(a).length?(c=a.condition,l=a.consent,y=a.fn,v=a.key,d=a.loop,b=a.map,h=a.set,g=a.validate,w=a.value,m=_object_spread_props(_object_spread({},r),{mapping:n}),(O=c)?[4,p(c,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping condition failed",{event:m.event,error:e}),!1})(e,m)]:[3,3]):[2]);case 2:O=!W.sent(),W.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,m.consent)?[2,w]:(j=u(w)?w:e,d?(P=_sliced_to_array(d,2),S=P[0],E=P[1],"this"!==S?[3,4]:(R=[e],[3,6])):[3,10]);case 4:return[4,_(e,S,m)];case 5:R=W.sent(),W.label=6;case 6:return i(k=R)?[4,Promise.all(k.map(function(e){return u(e)?_(e,E,m):void 0}))]:[3,8];case 7:return x=W.sent().filter(u),[3,9];case 8:x=void 0,W.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,_(e,a,m)];case 2:return n=i.sent(),[2,(u(n)&&(r[o]=n),r)]}})})()},Promise.resolve({}))]:[3,12];case 11:return j=W.sent(),[3,20];case 12:return h?[4,Promise.all(h.map(function(t){return M(e,t,m)}))]:[3,14];case 13:return A=j=W.sent(),[3,19];case 14:return v?(I=j=D(e,v,w),[3,18]):[3,15];case 15:return(T=y)?[4,p(y,function(e){if(_instanceof(e,C))throw e;m.logger.error("mapping fn failed",{event:m.event,error:e})})(e,m)]:[3,17];case 16:T=j=W.sent(),W.label=17;case 17:I=T,W.label=18;case 18:A=I,W.label=19;case 19:W.label=20;case 20:W.label=21;case 21:return(N=g)?[4,p(g,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping validate failed",{event:m.event,error:e}),!1})(j,m)]:[3,23];case 22:N=!W.sent(),W.label=23;case 23:return N&&(j=void 0),B=f(j),[2,u(B)?B:f(w)]}})})()},Promise.resolve(void 0))]})})()}var B,W="observe",q="call:",G=["name","length","prototype","arguments","caller"],K={},U={type:"heap",config:{},init:function(e){var t,r,n,o=e.config,a=e.env,i=o.settings;if(!(null==i?void 0:i.appId))return!1;if(null==a||null===(n=a.window)||void 0===n?void 0:n.heap)return o;var u=m(a),c=u.window,l=u.document,s=_object_spread({disableTextCapture:null===(t=i.disableTextCapture)||void 0===t||t,disablePageviewAutocapture:null===(r=i.disablePageviewAutocapture)||void 0===r||r},void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},void 0!==i.secureCookie&&{secureCookie:i.secureCookie},void 0!==i.ingestServer&&{ingestServer:i.ingestServer},i.heapConfig);if(!c.heap){var f={load:function(e,t){f.appid=e,f.config=null!=t?t:{}},track:function(){},identify:function(){},resetIdentity:function(){},addUserProperties:function(){},addEventProperties:function(){},clearEventProperties:function(){},startTracking:function(){},stopTracking:function(){},q:[]},p=!0,_=!1,y=void 0;try{for(var v,d=function(){var e=v.value;f[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];f.q=f.q||[],f.q.push([e].concat(_to_consumable_array(r)))}},b=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"][Symbol.iterator]();!(p=(v=b.next()).done);p=!0)d()}catch(e){_=!0,y=e}finally{try{p||null==b.return||b.return()}finally{if(_)throw y}}c.heap=f}o.loadScript&&function(e,t){var r=t.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-".concat(e,".js");var n=t.getElementsByTagName("script")[0];n&&n.parentNode?n.parentNode.insertBefore(r,n):t.head.appendChild(r)}(i.appId,l);var h=c.heap;return h.appid||h.load(i.appId,s),o},push:function(e,t){return _async_to_generator(function(e,t){var r,n,o,a,i,u,c,f,p,_,v,d,b,h,g,w,m,P,S;return _ts_generator(this,function(E){switch(E.label){case 0:return r=t.config,n=t.data,o=t.env,a=t.rule,i=t.collector,(f=O(o))?(p=r.settings||{},void 0===(_=(null==a?void 0:a.settings)||{}).reset?[3,4]:"boolean"!=typeof _.reset?[3,1]:(v=_.reset,[3,3])):[2];case 1:return[4,y(e,_.reset,{collector:i})];case 2:v=E.sent(),E.label=3;case 3:v&&f.resetIdentity(),E.label=4;case 4:return void 0===(d=null!==(u=_.identify)&&void 0!==u?u:p.identify)?[3,6]:[4,y(e,d,{collector:i})];case 5:b=E.sent(),s(b)&&b.length>0&&f.identify(b),E.label=6;case 6:return void 0===(h=null!==(c=_.userProperties)&&void 0!==c?c:p.userProperties)?[3,8]:[4,y(e,h,{collector:i})];case 7:g=E.sent(),l(g)&&f.addUserProperties(j(g)),E.label=8;case 8:return void 0===_.eventProperties?[3,10]:[4,y(e,_.eventProperties,{collector:i})];case 9:w=E.sent(),l(w)&&f.addEventProperties(j(w)),E.label=10;case 10:return void 0===_.clearEventProperties?[3,14]:"boolean"!=typeof _.clearEventProperties?[3,11]:(m=_.clearEventProperties,[3,13]);case 11:return[4,y(e,_.clearEventProperties,{collector:i})];case 12:m=E.sent(),E.label=13;case 13:m&&f.clearEventProperties(),E.label=14;case 14:return!0!==(null==a?void 0:a.silent)&&(P=s(null==a?void 0:a.name)?a.name:e.name,S=j(n),f.track(P,S)),[2]}})}).apply(this,arguments)},on:function(e,t){var r;if("consent"===e&&t.data){var n=O(t.env);if(n){var o=null===(r=t.config)||void 0===r?void 0:r.consent;if(o&&0!==Object.keys(o).length){var a=t.data;Object.keys(o).every(function(e){return!0===a[e]})?n.startTracking():n.stopTracking()}}}}},F=U;return B=R,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;k.call(e,o)||o===r||P(e,o,{get:function(){return t[o]},enumerable:!(n=S(t,o))||n.enumerable})},l=E(t)[Symbol.iterator]();!(o=(u=l.next()).done);o=!0)c()}catch(e){a=!0,i=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw i}}}return e}(P({},"__esModule",{value:!0}),B)}();
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-heap",
|
|
4
|
-
"version": "4.8.0
|
|
4
|
+
"version": "4.8.0",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
"consent": {
|
|
230
230
|
"functional": true
|
|
231
231
|
},
|
|
232
|
-
"id": "
|
|
232
|
+
"id": "d0b8c5a8dbb5d560",
|
|
233
233
|
"trigger": "load",
|
|
234
234
|
"entity": "product",
|
|
235
235
|
"action": "view",
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
"consent": {
|
|
292
292
|
"functional": true
|
|
293
293
|
},
|
|
294
|
-
"id": "
|
|
294
|
+
"id": "6eb210859e1c5cc1",
|
|
295
295
|
"trigger": "load",
|
|
296
296
|
"entity": "page",
|
|
297
297
|
"action": "view",
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
"consent": {
|
|
400
400
|
"functional": true
|
|
401
401
|
},
|
|
402
|
-
"id": "
|
|
402
|
+
"id": "9cc46ff40841828d",
|
|
403
403
|
"trigger": "load",
|
|
404
404
|
"entity": "order",
|
|
405
405
|
"action": "complete",
|
|
@@ -515,7 +515,7 @@
|
|
|
515
515
|
"consent": {
|
|
516
516
|
"functional": true
|
|
517
517
|
},
|
|
518
|
-
"id": "
|
|
518
|
+
"id": "be020fb0b77bb75f",
|
|
519
519
|
"trigger": "load",
|
|
520
520
|
"entity": "order",
|
|
521
521
|
"action": "complete",
|
|
@@ -589,7 +589,7 @@
|
|
|
589
589
|
"consent": {
|
|
590
590
|
"functional": true
|
|
591
591
|
},
|
|
592
|
-
"id": "
|
|
592
|
+
"id": "e1f643fffe57fc63",
|
|
593
593
|
"trigger": "load",
|
|
594
594
|
"entity": "page",
|
|
595
595
|
"action": "view",
|
|
@@ -659,7 +659,7 @@
|
|
|
659
659
|
"consent": {
|
|
660
660
|
"functional": true
|
|
661
661
|
},
|
|
662
|
-
"id": "
|
|
662
|
+
"id": "21b41baf9f155702",
|
|
663
663
|
"trigger": "test",
|
|
664
664
|
"entity": "user",
|
|
665
665
|
"action": "login",
|
|
@@ -741,7 +741,7 @@
|
|
|
741
741
|
"consent": {
|
|
742
742
|
"functional": true
|
|
743
743
|
},
|
|
744
|
-
"id": "
|
|
744
|
+
"id": "472d926b0fb172ad",
|
|
745
745
|
"trigger": "test",
|
|
746
746
|
"entity": "user",
|
|
747
747
|
"action": "logout",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-heap",
|
|
3
3
|
"description": "Heap web destination for walkerOS (product analytics, auto-capture)",
|
|
4
|
-
"version": "4.8.0
|
|
4
|
+
"version": "4.8.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"update": "npx npm-check-updates -u && npm update"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@walkeros/core": "4.8.0
|
|
42
|
-
"@walkeros/web-core": "4.8.0
|
|
41
|
+
"@walkeros/core": "4.8.0",
|
|
42
|
+
"@walkeros/web-core": "4.8.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@walkeros/collector": "4.8.0
|
|
45
|
+
"@walkeros/collector": "4.8.0"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|