@walkeros/web-source-datalayer 0.5.0 → 0.5.1-next.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/dist/index.es5.js +1 -1
- package/package.json +3 -3
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 asyncGeneratorStep(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){asyncGeneratorStep(o,n,a,i,u,"next",e)}function u(e){asyncGeneratorStep(o,n,a,i,u,"throw",e)}i(void 0)})}}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _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,a,o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){u=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw a}}return o}}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 _object_without_properties(e,t){if(null==e)return{};var r,n,a=_object_without_properties_loose(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function _object_without_properties_loose(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}function _ts_generator(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=u(0),i.throw=u(1),i.return=u(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&u[0]?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){o.label=u[1];break}if(6===u[0]&&o.label<a[1]){o.label=a[1],a=u;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(u);break}a[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Destination=function(){var e=function(e){return Array.isArray(e)},t=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!e(t)&&"[object Object]"===Object.prototype.toString.call(t)},r=function(e){return"string"==typeof e},n=function(e,t,r){return function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];try{return e.apply(void 0,_to_consumable_array(a))}catch(e){if(!t)return;return t(e)}finally{null==r||r()}}},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(t.filter&&!0===n(function(){return t.filter(r)},function(){return!1})())return;var a=o(r);if(a){var i=t.prefix||"dataLayer",u="".concat(i," ").concat(a.name),c=(a.name,{name:u,data:_object_without_properties(a,["name"])});n(function(){return e(c)},function(){})()}},o=function(n){if(t(n)&&r(n.event))return _object_spread({name:n.event},_object_without_properties(n,["event"]));if(e(n)&&n.length>=2)return i(n);if(u(n)){var a=Array.from(n);return i(a)}return null},i=function(e){var n,a=_sliced_to_array(e,3),o=a[0],i=a[1],u=a[2];if(!r(o))return null;var c={};switch(o){case"consent":if(!r(i)||e.length<3)return null;if("default"!==i&&"update"!==i)return null;if(!t(u)||null===u)return null;n="".concat(o," ").concat(i),c=_object_spread({},u);break;case"event":if(!r(i))return null;n=i,t(u)&&(c=_object_spread({},u));break;case"config":if(!r(i))return null;n="".concat(o," ").concat(i),t(u)&&(c=_object_spread({},u));break;case"set":if(r(i))n="".concat(o," ").concat(i),t(u)&&(c=_object_spread({},u));else{if(!t(i))return null;n="".concat(o," custom"),c=_object_spread({},i)}break;default:return null}return _object_spread({name:n},c)},u=function(e){return null!=e&&"object"===(void 0===e?"undefined":_type_of(e))&&"length"in e&&"number"==typeof e.length&&e.length>0},c=function(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]},l=function(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]},f=function(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]},_=function(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]},s=function(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]},y=function(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]},d=function(){return["set",{currency:"EUR",country:"DE"}]},p=function(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}},m=Object.defineProperty,v=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,h=function(e,t){for(var r in t)m(e,r,{get:t[r],enumerable:!0})},w={};h(w,{Events:function(){return U},Mapping:function(){return D},SourceDataLayer:function(){return A},consentOnlyMapping:function(){return K},consentUpdateEvent:function(){return c},dataLayerExamples:function(){return T},default:function(){return B},env:function(){return X},sourceDataLayer:function(){return z}});var j=Object.defineProperty;!function(e,t){for(var r in t)j(e,r,{get:t[r],enumerable:!0})}({},{Level:function(){return S}});var O,S=((O=S||{})[O.ERROR=0]="ERROR",O[O.INFO=1]="INFO",O[O.DEBUG=2]="DEBUG",O),E=!1,A={},X={};h(X,{push:function(){return x}});var k=function(){},P=function(){return function(){return Promise.resolve({ok:!0,successful:[],queued:[],failed:[]})}},L={error:k,info:k,debug:k,throw:function(e){throw"string"==typeof e?new Error(e):e},scope:function(){return L}},x={get push(){return P()},get command(){return P()},get elb(){return P()},get window(){return{dataLayer:[],addEventListener:k,removeEventListener:k}},logger:L},U={};h(U,{add_to_cart:function(){return _},config:function(){return y},consentDefault:function(){return l},consentUpdate:function(){return c},directDataLayerEvent:function(){return p},purchase:function(){return f},setCustom:function(){return d},view_item:function(){return s}});var D={};h(D,{add_to_cart:function(){return q},config:function(){return T},configGA4:function(){return C},consentOnlyMapping:function(){return K},consentUpdate:function(){return R},customEvent:function(){return M},purchase:function(){return G},view_item:function(){return N}});var I,R={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:function(e){return"granted"===e}},marketing:{key:"ad_storage",fn:function(e){return"granted"===e}}}}}},G={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},q={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},N={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},C={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},M={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},T={consent:{update:R},purchase:G,add_to_cart:q,view_item:N,"config G-XXXXXXXXXX":C,custom_event:M,"*":{data:{}}},K={consent:{update:R}},z=function(e,t){return _async_to_generator(function(){var r,n,o,i;return _ts_generator(this,function(u){return r=t.elb,n=t.window,o=_object_spread({name:"dataLayer",prefix:"dataLayer"},null==e?void 0:e.settings),i={settings:o},n&&(function(e,t){var r=t.settings,n=(null==r?void 0:r.name)||"dataLayer",o=window[n];if(Array.isArray(o)&&!E){E=!0;try{var i=!0,u=!1,c=void 0;try{for(var l,f=o[Symbol.iterator]();!(i=(l=f.next()).done);i=!0){var _=l.value;a(e,r,_)}}catch(e){u=!0,c=e}finally{try{i||null==f.return||f.return()}finally{if(u)throw c}}}finally{E=!1}}}(r,i),function(e,t){var r=t.settings,n=(null==r?void 0:r.name)||"dataLayer";window[n]||(window[n]=[]);var o=window[n];if(Array.isArray(o)){var i=o.push.bind(o);o.push=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];if(E)return i.apply(void 0,_to_consumable_array(n));E=!0;try{var u=!0,c=!1,l=void 0;try{for(var f,_=n[Symbol.iterator]();!(u=(f=_.next()).done);u=!0){var s=f.value;a(e,r,s)}}catch(e){c=!0,l=e}finally{try{u||null==_.return||_.return()}finally{if(c)throw l}}}finally{E=!1}return i.apply(void 0,_to_consumable_array(n))}}}(r,i)),[2,{type:"dataLayer",config:i,push:r,destroy:function(){return _async_to_generator(function(){var e;return _ts_generator(this,function(t){return e=o.name||"dataLayer",n&&n[e]&&Array.isArray(n[e]),[2]})})()}}]})})()},B=z;return I=w,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var a=!0,o=!1,i=void 0;try{for(var u,c=function(){var a=u.value;g.call(e,a)||a===r||m(e,a,{get:function(){return t[a]},enumerable:!(n=v(t,a))||n.enumerable})},l=b(t)[Symbol.iterator]();!(a=(u=l.next()).done);a=!0)c()}catch(e){o=!0,i=e}finally{try{a||null==l.return||l.return()}finally{if(o)throw i}}}return e}(m({},"__esModule",{value:!0}),I)}();
|
|
1
|
+
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function asyncGeneratorStep(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){asyncGeneratorStep(o,n,a,i,u,"next",e)}function u(e){asyncGeneratorStep(o,n,a,i,u,"throw",e)}i(void 0)})}}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _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,a,o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){u=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw a}}return o}}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 _object_without_properties(e,t){if(null==e)return{};var r,n,a,o={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}if(o=_object_without_properties_loose(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}function _object_without_properties_loose(e,t){if(null==e)return{};var r,n,a={},o=Object.getOwnPropertyNames(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}function _ts_generator(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[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]&&(o=0)),o;)try{if(r=1,n&&(a=2&u[0]?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){o.label=u[1];break}if(6===u[0]&&o.label<a[1]){o.label=a[1],a=u;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(u);break}a[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],n=0}finally{r=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Destination=function(){var e=function(e){return Array.isArray(e)},t=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!e(t)&&"[object Object]"===Object.prototype.toString.call(t)},r=function(e){return"string"==typeof e},n=function(e,t,r){return function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];try{return e.apply(void 0,_to_consumable_array(a))}catch(e){if(!t)return;return t(e)}finally{null==r||r()}}},a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(t.filter&&!0===n(function(){return t.filter(r)},function(){return!1})())return;var a=o(r);if(a){var i=t.prefix||"dataLayer",u="".concat(i," ").concat(a.name),c=(a.name,{name:u,data:_object_without_properties(a,["name"])});n(function(){return e(c)},function(){})()}},o=function(n){if(t(n)&&r(n.event))return _object_spread({name:n.event},_object_without_properties(n,["event"]));if(e(n)&&n.length>=2)return i(n);if(u(n)){var a=Array.from(n);return i(a)}return null},i=function(e){var n,a=_sliced_to_array(e,3),o=a[0],i=a[1],u=a[2];if(!r(o))return null;var c={};switch(o){case"consent":if(!r(i)||e.length<3)return null;if("default"!==i&&"update"!==i)return null;if(!t(u)||null===u)return null;n="".concat(o," ").concat(i),c=_object_spread({},u);break;case"event":if(!r(i))return null;n=i,t(u)&&(c=_object_spread({},u));break;case"config":if(!r(i))return null;n="".concat(o," ").concat(i),t(u)&&(c=_object_spread({},u));break;case"set":if(r(i))n="".concat(o," ").concat(i),t(u)&&(c=_object_spread({},u));else{if(!t(i))return null;n="".concat(o," custom"),c=_object_spread({},i)}break;default:return null}return _object_spread({name:n},c)},u=function(e){return null!=e&&"object"===(void 0===e?"undefined":_type_of(e))&&"length"in e&&"number"==typeof e.length&&e.length>0},c=function(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]},l=function(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]},f=function(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]},_=function(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]},s=function(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]},y=function(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]},d=function(){return["set",{currency:"EUR",country:"DE"}]},p=function(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}},m=Object.defineProperty,v=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,h=function(e,t){for(var r in t)m(e,r,{get:t[r],enumerable:!0})},w={};h(w,{Events:function(){return R},Mapping:function(){return U},SourceDataLayer:function(){return A},consentOnlyMapping:function(){return T},consentUpdateEvent:function(){return c},dataLayerExamples:function(){return M},default:function(){return B},env:function(){return P},sourceDataLayer:function(){return z}});var j=Object.defineProperty;!function(e,t){for(var r in t)j(e,r,{get:t[r],enumerable:!0})}({},{Level:function(){return S}});var O,S=((O=S||{})[O.ERROR=0]="ERROR",O[O.INFO=1]="INFO",O[O.DEBUG=2]="DEBUG",O),E=!1,A={},P={};h(P,{push:function(){return L}});var X=function(){},k=function(){return function(){return Promise.resolve({ok:!0,successful:[],queued:[],failed:[]})}},x={error:X,info:X,debug:X,throw:function(e){throw"string"==typeof e?new Error(e):e},scope:function(){return x}},L={get push(){return k()},get command(){return k()},get elb(){return k()},get window(){return{dataLayer:[],addEventListener:X,removeEventListener:X}},logger:x},R={};h(R,{add_to_cart:function(){return _},config:function(){return y},consentDefault:function(){return l},consentUpdate:function(){return c},directDataLayerEvent:function(){return p},purchase:function(){return f},setCustom:function(){return d},view_item:function(){return s}});var U={};h(U,{add_to_cart:function(){return q},config:function(){return M},configGA4:function(){return C},consentOnlyMapping:function(){return T},consentUpdate:function(){return D},customEvent:function(){return K},purchase:function(){return G},view_item:function(){return N}});var I,D={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:function(e){return"granted"===e}},marketing:{key:"ad_storage",fn:function(e){return"granted"===e}}}}}},G={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},q={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},N={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},C={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},K={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},M={consent:{update:D},purchase:G,add_to_cart:q,view_item:N,"config G-XXXXXXXXXX":C,custom_event:K,"*":{data:{}}},T={consent:{update:D}},z=function(e,t){return _async_to_generator(function(){var r,n,o,i;return _ts_generator(this,function(u){return r=t.elb,n=t.window,o=_object_spread({name:"dataLayer",prefix:"dataLayer"},null==e?void 0:e.settings),i={settings:o},n&&(function(e,t){var r=t.settings,n=(null==r?void 0:r.name)||"dataLayer",o=window[n];if(Array.isArray(o)&&!E){E=!0;try{var i=!0,u=!1,c=void 0;try{for(var l,f=o[Symbol.iterator]();!(i=(l=f.next()).done);i=!0){var _=l.value;a(e,r,_)}}catch(e){u=!0,c=e}finally{try{i||null==f.return||f.return()}finally{if(u)throw c}}}finally{E=!1}}}(r,i),function(e,t){var r=t.settings,n=(null==r?void 0:r.name)||"dataLayer";window[n]||(window[n]=[]);var o=window[n];if(Array.isArray(o)){var i=o.push.bind(o);o.push=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];if(E)return i.apply(void 0,_to_consumable_array(n));E=!0;try{var u=!0,c=!1,l=void 0;try{for(var f,_=n[Symbol.iterator]();!(u=(f=_.next()).done);u=!0){var s=f.value;a(e,r,s)}}catch(e){c=!0,l=e}finally{try{u||null==_.return||_.return()}finally{if(c)throw l}}}finally{E=!1}return i.apply(void 0,_to_consumable_array(n))}}}(r,i)),[2,{type:"dataLayer",config:i,push:r,destroy:function(){return _async_to_generator(function(){var e;return _ts_generator(this,function(t){return e=o.name||"dataLayer",n&&n[e]&&Array.isArray(n[e]),[2]})})()}}]})})()},B=z;return I=w,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var a=!0,o=!1,i=void 0;try{for(var u,c=function(){var a=u.value;g.call(e,a)||a===r||m(e,a,{get:function(){return t[a]},enumerable:!(n=v(t,a))||n.enumerable})},l=b(t)[Symbol.iterator]();!(a=(u=l.next()).done);a=!0)c()}catch(e){o=!0,i=e}finally{try{a||null==l.return||l.return()}finally{if(o)throw i}}}return e}(m({},"__esModule",{value:!0}),I)}();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-source-datalayer",
|
|
3
3
|
"description": "DataLayer source for walkerOS",
|
|
4
|
-
"version": "0.5.0",
|
|
4
|
+
"version": "0.5.1-next.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"update": "npx npm-check-updates -u && npm update"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@walkeros/core": "0.5.0",
|
|
39
|
-
"@walkeros/collector": "0.5.0"
|
|
38
|
+
"@walkeros/core": "0.5.1-next.0",
|
|
39
|
+
"@walkeros/collector": "0.5.1-next.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/gtag.js": "^0.0.20"
|