@customerio/cdp-analytics-browser 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser/index.js +3 -0
- package/dist/cjs/browser/index.js.map +1 -1
- package/dist/cjs/browser/standalone-analytics.js +7 -5
- package/dist/cjs/browser/standalone-analytics.js.map +1 -1
- package/dist/cjs/browser/standalone-interface.js +3 -0
- package/dist/cjs/browser/standalone-interface.js.map +1 -0
- package/dist/cjs/browser/standalone.js +7 -0
- package/dist/cjs/browser/standalone.js.map +1 -1
- package/dist/cjs/core/analytics/index.js +2 -1
- package/dist/cjs/core/analytics/index.js.map +1 -1
- package/dist/cjs/core/buffer/snippet.js +4 -2
- package/dist/cjs/core/buffer/snippet.js.map +1 -1
- package/dist/cjs/generated/version.js +1 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/global-analytics-helper.js +34 -0
- package/dist/cjs/lib/global-analytics-helper.js.map +1 -0
- package/dist/cjs/lib/parse-cdn.js +19 -12
- package/dist/cjs/lib/parse-cdn.js.map +1 -1
- package/dist/cjs/plugins/in-app-plugin/index.js +28 -18
- package/dist/cjs/plugins/in-app-plugin/index.js.map +1 -1
- package/dist/cjs/plugins/routing-middleware/index.js +2 -1
- package/dist/cjs/plugins/routing-middleware/index.js.map +1 -1
- package/dist/cjs/vendor/tsub/tsub.js +645 -0
- package/dist/cjs/vendor/tsub/tsub.js.map +1 -0
- package/dist/cjs/vendor/tsub/types.js +3 -0
- package/dist/cjs/vendor/tsub/types.js.map +1 -0
- package/dist/pkg/browser/index.js +3 -0
- package/dist/pkg/browser/index.js.map +1 -1
- package/dist/pkg/browser/standalone-analytics.js +7 -5
- package/dist/pkg/browser/standalone-analytics.js.map +1 -1
- package/dist/pkg/browser/standalone-interface.js +2 -0
- package/dist/pkg/browser/standalone-interface.js.map +1 -0
- package/dist/pkg/browser/standalone.js +7 -0
- package/dist/pkg/browser/standalone.js.map +1 -1
- package/dist/pkg/core/analytics/index.js +2 -1
- package/dist/pkg/core/analytics/index.js.map +1 -1
- package/dist/pkg/core/buffer/snippet.js +4 -2
- package/dist/pkg/core/buffer/snippet.js.map +1 -1
- package/dist/pkg/generated/version.js +1 -1
- package/dist/pkg/index.js +1 -0
- package/dist/pkg/index.js.map +1 -1
- package/dist/pkg/lib/global-analytics-helper.js +28 -0
- package/dist/pkg/lib/global-analytics-helper.js.map +1 -0
- package/dist/pkg/lib/parse-cdn.js +19 -12
- package/dist/pkg/lib/parse-cdn.js.map +1 -1
- package/dist/pkg/plugins/in-app-plugin/index.js +28 -18
- package/dist/pkg/plugins/in-app-plugin/index.js.map +1 -1
- package/dist/pkg/plugins/routing-middleware/index.js +2 -1
- package/dist/pkg/plugins/routing-middleware/index.js.map +1 -1
- package/dist/pkg/vendor/tsub/tsub.js +645 -0
- package/dist/pkg/vendor/tsub/tsub.js.map +1 -0
- package/dist/pkg/vendor/tsub/types.js +2 -0
- package/dist/pkg/vendor/tsub/types.js.map +1 -0
- package/dist/types/browser/index.d.ts.map +1 -1
- package/dist/types/browser/standalone-analytics.d.ts +0 -14
- package/dist/types/browser/standalone-analytics.d.ts.map +1 -1
- package/dist/types/browser/standalone-interface.d.ts +10 -0
- package/dist/types/browser/standalone-interface.d.ts.map +1 -0
- package/dist/types/browser/standalone.d.ts.map +1 -1
- package/dist/types/core/analytics/index.d.ts +5 -0
- package/dist/types/core/analytics/index.d.ts.map +1 -1
- package/dist/types/core/buffer/index.d.ts +1 -1
- package/dist/types/core/buffer/snippet.d.ts +6 -1
- package/dist/types/core/buffer/snippet.d.ts.map +1 -1
- package/dist/types/generated/version.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/global-analytics-helper.d.ts +18 -0
- package/dist/types/lib/global-analytics-helper.d.ts.map +1 -0
- package/dist/types/lib/parse-cdn.d.ts.map +1 -1
- package/dist/types/plugins/in-app-plugin/index.d.ts.map +1 -1
- package/dist/types/plugins/routing-middleware/index.d.ts +1 -1
- package/dist/types/plugins/routing-middleware/index.d.ts.map +1 -1
- package/dist/types/vendor/tsub/tsub.d.ts +1 -0
- package/dist/types/vendor/tsub/tsub.d.ts.map +1 -0
- package/dist/types/vendor/tsub/types.d.ts +20 -0
- package/dist/types/vendor/tsub/types.d.ts.map +1 -0
- package/dist/umd/646.js +1 -1
- package/dist/umd/646.js.gz +0 -0
- package/dist/umd/inAppPlugin.js +1 -1
- package/dist/umd/inAppPlugin.js.gz +0 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/standalone.js +1 -1
- package/dist/umd/standalone.js.gz +0 -0
- package/dist/umd/tsub-middleware.js +1 -1
- package/dist/umd/tsub-middleware.js.gz +0 -0
- package/package.json +6 -5
- package/src/browser/index.ts +3 -0
- package/src/browser/standalone-analytics.ts +12 -24
- package/src/browser/standalone-interface.ts +11 -0
- package/src/browser/standalone.ts +12 -0
- package/src/core/analytics/index.ts +7 -1
- package/src/core/buffer/snippet.ts +6 -3
- package/src/generated/version.ts +1 -1
- package/src/index.ts +2 -2
- package/src/lib/global-analytics-helper.ts +31 -0
- package/src/lib/parse-cdn.ts +14 -7
- package/src/plugins/in-app-plugin/index.ts +28 -17
- package/src/plugins/routing-middleware/index.ts +5 -4
- package/src/vendor/tsub/tsub.js.LICENSE.txt +53 -0
- package/src/vendor/tsub/tsub.ts +7 -0
- package/src/vendor/tsub/types.ts +19 -0
- package/dist/umd/870.js +0 -1
- package/dist/umd/870.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_customerio_cdp_analytics_browser=self.webpackChunk_customerio_cdp_analytics_browser||[]).push([[604],{669:function(n,r,t){"use strict";t.r(r),t.d(r,{tsubMiddleware:function(){return o}});var e=t(2870),o=function(n){return function(r){var t=r.payload,o=r.integration,a=r.next;new e.Store(n).getRulesByDestinationName(o).forEach((function(n){for(var r=n.matchers,o=n.transformers,s=0;s<r.length;s++)if(e.matches(t.obj,r[s])&&(t.obj=e.transform(t.obj,o[s]),null===t.obj))return a(null)})),a(t)}}}}]);
|
|
1
|
+
(self.webpackChunk_customerio_cdp_analytics_browser=self.webpackChunk_customerio_cdp_analytics_browser||[]).push([[604],{669:function(t,r,n){"use strict";n.r(r),n.d(r,{tsubMiddleware:function(){return o}});var e=n(2248),o=function(t){return function(r){var n=r.payload,o=r.integration,i=r.next;new e.Store(t).getRulesByDestinationName(o).forEach((function(t){for(var r=t.matchers,o=t.transformers,u=0;u<r.length;u++)if(e.matches(n.obj,r[u])&&(n.obj=e.transform(n.obj,o[u]),null===n.obj))return i(null)})),i(n)}}},2248:function(t){"use strict";self,t.exports=function(){var t={2870:function(t,r,n){var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.Store=r.matches=r.transform=void 0;var o=n(4303);Object.defineProperty(r,"transform",{enumerable:!0,get:function(){return e(o).default}});var i=n(2370);Object.defineProperty(r,"matches",{enumerable:!0,get:function(){return e(i).default}});var u=n(1444);Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return e(u).default}})},2370:function(t,r,n){var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var o=e(n(7843));function i(t,r){if(!Array.isArray(t))return!0===u(t,r);var n,e,o,s,p=t[0];switch(p){case"!":return!i(t[1],r);case"or":for(var l=1;l<t.length;l++)if(i(t[l],r))return!0;return!1;case"and":for(l=1;l<t.length;l++)if(!i(t[l],r))return!1;return!0;case"=":case"!=":return function(t,r,n,e){switch(a(t)&&(t=i(t,e)),a(r)&&(r=i(r,e)),"object"==typeof t&&"object"==typeof r&&(t=JSON.stringify(t),r=JSON.stringify(r)),n){case"=":return t===r;case"!=":return t!==r;default:throw new Error("Invalid operator in compareItems: ".concat(n))}}(u(t[1],r),u(t[2],r),p,r);case"<=":case"<":case">":case">=":return function(t,r,n,e){if(a(t)&&(t=i(t,e)),a(r)&&(r=i(r,e)),"number"!=typeof t||"number"!=typeof r)return!1;switch(n){case"<=":return t<=r;case">=":return t>=r;case"<":return t<r;case">":return t>r;default:throw new Error("Invalid operator in compareNumbers: ".concat(n))}}(u(t[1],r),u(t[2],r),p,r);case"in":return function(t,r,n){return void 0!==r.find((function(r){return u(r,n)===t}))}(u(t[1],r),u(t[2],r),r);case"contains":return o=u(t[1],r),s=u(t[2],r),"string"==typeof o&&"string"==typeof s&&-1!==o.indexOf(s);case"match":return n=u(t[1],r),e=u(t[2],r),"string"==typeof n&&"string"==typeof e&&function(t,r){var n,e;t:for(;t.length>0;){var o,i;if(o=(n=c(t)).star,i=n.chunk,t=n.pattern,o&&""===i)return!0;var u=f(i,r),a=u.t,s=u.ok,p=u.err;if(p)return!1;if(!s||!(0===a.length||t.length>0)){if(o)for(var l=0;l<r.length;l++){if(a=(e=f(i,r.slice(l+1))).t,s=e.ok,p=e.err,s){if(0===t.length&&a.length>0)continue;r=a;continue t}if(p)return!1}return!1}r=a}return 0===r.length}(e,n);case"lowercase":var v=u(t[1],r);return"string"!=typeof v?null:v.toLowerCase();case"typeof":return typeof u(t[1],r);case"length":return function(t){return null===t?0:Array.isArray(t)||"string"==typeof t?t.length:NaN}(u(t[1],r));default:throw new Error("FQL IR could not evaluate for token: ".concat(p))}}function u(t,r){return Array.isArray(t)?t:"object"==typeof t?t.value:(0,o.default)(r,t)}function a(t){return!!Array.isArray(t)&&(("lowercase"===t[0]||"length"===t[0]||"typeof"===t[0])&&2===t.length||("contains"===t[0]||"match"===t[0])&&3===t.length)}function c(t){for(var r={star:!1,chunk:"",pattern:""};t.length>0&&"*"===t[0];)t=t.slice(1),r.star=!0;var n,e=!1;t:for(n=0;n<t.length;n++)switch(t[n]){case"\\":n+1<t.length&&n++;break;case"[":e=!0;break;case"]":e=!1;break;case"*":if(!e)break t}return r.chunk=t.slice(0,n),r.pattern=t.slice(n),r}function f(t,r){for(var n,e,o={t:"",ok:!1,err:!1};t.length>0;){if(0===r.length)return o;switch(t[0]){case"[":var i=r[0];r=r.slice(1);var u=!0;(t=t.slice(1)).length>0&&"^"===t[0]&&(u=!1,t=t.slice(1));for(var a=!1,c=0;;){if(t.length>0&&"]"===t[0]&&c>0){t=t.slice(1);break}var f,p="";if(f=(n=s(t)).char,t=n.newChunk,n.err)return o;if(p=f,"-"===t[0]&&(p=(e=s(t.slice(1))).char,t=e.newChunk,e.err))return o;f<=i&&i<=p&&(a=!0),c++}if(a!==u)return o;break;case"?":r=r.slice(1),t=t.slice(1);break;case"\\":if(0===(t=t.slice(1)).length)return o.err=!0,o;default:if(t[0]!==r[0])return o;r=r.slice(1),t=t.slice(1)}}return o.t=r,o.ok=!0,o.err=!1,o}function s(t){var r={char:"",newChunk:"",err:!1};return 0===t.length||"-"===t[0]||"]"===t[0]||"\\"===t[0]&&0===(t=t.slice(1)).length?(r.err=!0,r):(r.char=t[0],r.newChunk=t.slice(1),0===r.newChunk.length&&(r.err=!0),r)}r.default=function(t,r){if(!r)throw new Error("No matcher supplied!");switch(r.type){case"all":return!0;case"fql":return function(t,r){if(!t)return!1;try{t=JSON.parse(t)}catch(r){throw new Error('Failed to JSON.parse FQL intermediate representation "'.concat(t,'": ').concat(r))}var n=i(t,r);return"boolean"==typeof n&&n}(r.ir,t);default:throw new Error("Matcher of type ".concat(r.type," unsupported."))}}},1444:function(t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function t(t){this.rules=[],this.rules=t||[]}return t.prototype.getRulesByDestinationName=function(t){for(var r=[],n=0,e=this.rules;n<e.length;n++){var o=e[n];o.destinationName!==t&&void 0!==o.destinationName||r.push(o)}return r},t}();r.default=n},4303:function(t,r,n){var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var o=e(n(2263)),i=e(n(7843)),u=e(n(5500)),a=n(2341),c=n(4966);function f(t,r){p(t,r.drop,(function(t,r){r.forEach((function(r){return delete t[r]}))}))}function s(t,r){p(t,r.allow,(function(t,r){Object.keys(t).forEach((function(n){r.includes(n)||delete t[n]}))}))}function p(t,r,n){Object.entries(r).forEach((function(r){var e=r[0],o=r[1],u=function(t){"object"==typeof t&&null!==t&&n(t,o)},a=""===e?t:(0,i.default)(t,e);Array.isArray(a)?a.forEach(u):u(a)}))}function l(t,r){var n=JSON.parse(JSON.stringify(t));for(var e in r.map)if(r.map.hasOwnProperty(e)){var o=r.map[e],u=e.split("."),f=void 0;if(u.length>1?(u.pop(),f=(0,i.default)(n,u.join("."))):f=t,"object"==typeof f){if(o.copy){var s=(0,i.default)(n,o.copy);void 0!==s&&(0,a.dset)(t,e,s)}else if(o.move){var p=(0,i.default)(n,o.move);void 0!==p&&(0,a.dset)(t,e,p),(0,c.unset)(t,o.move)}else o.hasOwnProperty("set")&&(0,a.dset)(t,e,o.set);if(o.to_string){var l=(0,i.default)(t,e);if("string"==typeof l||"object"==typeof l&&null!==l)continue;void 0!==l?(0,a.dset)(t,e,JSON.stringify(l)):(0,a.dset)(t,e,"undefined")}}}}function v(t,r){return!(r.sample.percent<=0)&&(r.sample.percent>=1||(r.sample.path?function(t,r){var n=(0,i.default)(t,r.sample.path),e=(0,o.default)(JSON.stringify(n)),a=-64,c=[];y(e.slice(0,8),c);for(var f=0,s=0;s<64&&1!==c[s];s++)f++;if(0!==f){var p=[];y(e.slice(9,16),p),a-=f,c.splice(0,f),p.splice(64-f),c=c.concat(p)}return c[63]=0===c[63]?1:0,(0,u.default)(parseInt(c.join(""),2),a)<r.sample.percent}(t,r):(n=r.sample.percent,Math.random()<=n)));var n}function y(t,r){for(var n=0;n<8;n++)for(var e=t[n],o=128;o>=1;o/=2)e-o>=0?(e-=o,r.push(1)):r.push(0)}r.default=function(t,r){for(var n=t,e=0,o=r;e<o.length;e++){var i=o[e];switch(i.type){case"drop":return null;case"drop_properties":f(n,i.config);break;case"allow_properties":s(n,i.config);break;case"sample_event":if(v(n,i.config))break;return null;case"map_properties":l(n,i.config);break;case"hash_properties":break;default:throw new Error('Transformer of type "'.concat(i.type,'" is unsupported.'))}}return n}},4966:function(t,r,n){var e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.unset=void 0;var o=e(n(7843));r.unset=function(t,r){if((0,o.default)(t,r)){for(var n=r.split("."),e=n.pop();n.length&&"\\"===n[n.length-1].slice(-1);)e=n.pop().slice(0,-1)+"."+e;for(;n.length;)t=t[r=n.shift()];return delete t[e]}return!0}},3304:function(t){var r="function"==typeof Float64Array?Float64Array:void 0;t.exports=r},7382:function(t,r,n){var e,o=n(5569),i=n(3304),u=n(8482);e=o()?i:u,t.exports=e},8482:function(t){t.exports=function(){throw new Error("not implemented")}},6322:function(t,r,n){var e,o=n(2508),i=n(5679),u=n(882);e=o()?i:u,t.exports=e},882:function(t){t.exports=function(){throw new Error("not implemented")}},5679:function(t){var r="function"==typeof Uint16Array?Uint16Array:void 0;t.exports=r},4773:function(t,r,n){var e,o=n(9773),i=n(3004),u=n(3078);e=o()?i:u,t.exports=e},3078:function(t){t.exports=function(){throw new Error("not implemented")}},3004:function(t){var r="function"==typeof Uint32Array?Uint32Array:void 0;t.exports=r},7980:function(t,r,n){var e,o=n(8114),i=n(6737),u=n(3357);e=o()?i:u,t.exports=e},3357:function(t){t.exports=function(){throw new Error("not implemented")}},6737:function(t){var r="function"==typeof Uint8Array?Uint8Array:void 0;t.exports=r},2684:function(t){var r="function"==typeof Float64Array?Float64Array:null;t.exports=r},5569:function(t,r,n){var e=n(3876);t.exports=e},3876:function(t,r,n){var e=n(1448),o=n(2684);t.exports=function(){var t,r;if("function"!=typeof o)return!1;try{r=new o([1,3.14,-3.14,NaN]),t=e(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t}},9048:function(t,r,n){var e=n(3763);t.exports=e},3763:function(t){var r=Object.prototype.hasOwnProperty;t.exports=function(t,n){return null!=t&&r.call(t,n)}},7009:function(t,r,n){var e=n(6784);t.exports=e},6784:function(t){t.exports=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}},3123:function(t,r,n){var e=n(8481);t.exports=e},8481:function(t,r,n){var e=n(7009)();t.exports=function(){return e&&"symbol"==typeof Symbol.toStringTag}},2508:function(t,r,n){var e=n(3403);t.exports=e},3403:function(t,r,n){var e=n(768),o=n(9668),i=n(187);t.exports=function(){var t,r;if("function"!=typeof i)return!1;try{r=new i(r=[1,3.14,-3.14,o+1,o+2]),t=e(r)&&1===r[0]&&3===r[1]&&r[2]===o-2&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}},187:function(t){var r="function"==typeof Uint16Array?Uint16Array:null;t.exports=r},9773:function(t,r,n){var e=n(2822);t.exports=e},2822:function(t,r,n){var e=n(2744),o=n(3899),i=n(746);t.exports=function(){var t,r;if("function"!=typeof i)return!1;try{r=new i(r=[1,3.14,-3.14,o+1,o+2]),t=e(r)&&1===r[0]&&3===r[1]&&r[2]===o-2&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}},746:function(t){var r="function"==typeof Uint32Array?Uint32Array:null;t.exports=r},8114:function(t,r,n){var e=n(8066);t.exports=e},8066:function(t,r,n){var e=n(8279),o=n(3443),i=n(2731);t.exports=function(){var t,r;if("function"!=typeof i)return!1;try{r=new i(r=[1,3.14,-3.14,o+1,o+2]),t=e(r)&&1===r[0]&&3===r[1]&&r[2]===o-2&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}},2731:function(t){var r="function"==typeof Uint8Array?Uint8Array:null;t.exports=r},1448:function(t,r,n){var e=n(1453);t.exports=e},1453:function(t,r,n){var e=n(6208),o="function"==typeof Float64Array;t.exports=function(t){return o&&t instanceof Float64Array||"[object Float64Array]"===e(t)}},9331:function(t,r,n){var e=n(7980),o={uint16:n(6322),uint8:e};t.exports=o},5902:function(t,r,n){var e=n(4106);t.exports=e},4106:function(t,r,n){var e,o,i=n(9331);(o=new i.uint16(1))[0]=4660,e=52===new i.uint8(o.buffer)[0],t.exports=e},768:function(t,r,n){var e=n(3823);t.exports=e},3823:function(t,r,n){var e=n(6208),o="function"==typeof Uint16Array;t.exports=function(t){return o&&t instanceof Uint16Array||"[object Uint16Array]"===e(t)}},2744:function(t,r,n){var e=n(2326);t.exports=e},2326:function(t,r,n){var e=n(6208),o="function"==typeof Uint32Array;t.exports=function(t){return o&&t instanceof Uint32Array||"[object Uint32Array]"===e(t)}},8279:function(t,r,n){var e=n(208);t.exports=e},208:function(t,r,n){var e=n(6208),o="function"==typeof Uint8Array;t.exports=function(t){return o&&t instanceof Uint8Array||"[object Uint8Array]"===e(t)}},6315:function(t){t.exports=1023},1686:function(t){t.exports=2147483647},3105:function(t){t.exports=2146435072},3449:function(t){t.exports=2147483648},6988:function(t){t.exports=-1023},9777:function(t){t.exports=1023},3690:function(t){t.exports=-1074},2918:function(t,r,n){var e=n(4772).NEGATIVE_INFINITY;t.exports=e},4165:function(t){var r=Number.POSITIVE_INFINITY;t.exports=r},6488:function(t){t.exports=22250738585072014e-324},9668:function(t){t.exports=65535},3899:function(t){t.exports=4294967295},3443:function(t){t.exports=255},7011:function(t,r,n){var e=n(812);t.exports=e},812:function(t,r,n){var e=n(4165),o=n(2918);t.exports=function(t){return t===e||t===o}},1883:function(t,r,n){var e=n(1797);t.exports=e},1797:function(t){t.exports=function(t){return t!=t}},513:function(t,r,n){var e=n(5760);t.exports=e},5760:function(t){t.exports=function(t){return Math.abs(t)}},5848:function(t,r,n){var e=n(677);t.exports=e},677:function(t,r,n){var e=n(3449),o=n(1686),i=n(7838),u=n(1921),a=n(2490),c=[0,0];t.exports=function(t,r){var n,f;return i.assign(t,c,1,0),n=c[0],n&=o,f=u(r),a(n|=f&=e,c[1])}},5500:function(t,r,n){var e=n(8397);t.exports=e},8397:function(t,r,n){var e=n(4165),o=n(2918),i=n(6315),u=n(9777),a=n(6988),c=n(3690),f=n(1883),s=n(7011),p=n(5848),l=n(4948),v=n(8478),y=n(7838),d=n(2490),h=[0,0],x=[0,0];t.exports=function(t,r){var n,b;return 0===t||f(t)||s(t)?t:(l(h,t),r+=h[1],(r+=v(t=h[0]))<c?p(0,t):r>u?t<0?o:e:(r<=a?(r+=52,b=2220446049250313e-31):b=1,y(x,t),n=x[0],n&=2148532223,b*d(n|=r+i<<20,x[1])))}},4772:function(t,r,n){var e=n(7548);t.exports=e},7548:function(t){t.exports=Number},8478:function(t,r,n){var e=n(4500);t.exports=e},4500:function(t,r,n){var e=n(1921),o=n(3105),i=n(6315);t.exports=function(t){var r=e(t);return(r=(r&o)>>>20)-i|0}},2490:function(t,r,n){var e=n(9639);t.exports=e},4445:function(t,r,n){var e,o,i;!0===n(5902)?(o=1,i=0):(o=0,i=1),e={HIGH:o,LOW:i},t.exports=e},9639:function(t,r,n){var e=n(4773),o=n(7382),i=n(4445),u=new o(1),a=new e(u.buffer),c=i.HIGH,f=i.LOW;t.exports=function(t,r){return a[c]=t,a[f]=r,u[0]}},5646:function(t,r,n){var e;e=!0===n(5902)?1:0,t.exports=e},1921:function(t,r,n){var e=n(6285);t.exports=e},6285:function(t,r,n){var e=n(4773),o=n(7382),i=n(5646),u=new o(1),a=new e(u.buffer);t.exports=function(t){return u[0]=t,a[i]}},9024:function(t,r,n){var e=n(6488),o=n(7011),i=n(1883),u=n(513);t.exports=function(t,r,n,a){return i(t)||o(t)?(r[a]=t,r[a+n]=0,r):0!==t&&u(t)<e?(r[a]=4503599627370496*t,r[a+n]=-52,r):(r[a]=t,r[a+n]=0,r)}},4948:function(t,r,n){var e=n(7576),o=n(9422);e(o,"assign",n(9024)),t.exports=o},9422:function(t,r,n){var e=n(9024);t.exports=function(t){return e(t,[0,0],1,0)}},7838:function(t,r,n){var e=n(4010);t.exports=e},5782:function(t,r,n){var e,o,i;!0===n(5902)?(o=1,i=0):(o=0,i=1),e={HIGH:o,LOW:i},t.exports=e},4010:function(t,r,n){var e=n(4903);t.exports=function(t,r){return 1===arguments.length?e([0,0],t):e(t,r)}},4903:function(t,r,n){var e=n(4773),o=n(7382),i=n(5782),u=new o(1),a=new e(u.buffer),c=i.HIGH,f=i.LOW;t.exports=function(t,r){return u[0]=r,t[0]=a[c],t[1]=a[f],t}},7576:function(t,r,n){var e=n(7063);t.exports=e},7063:function(t,r,n){var e=n(6691);t.exports=function(t,r,n){e(t,r,{configurable:!1,enumerable:!1,writable:!1,value:n})}},2073:function(t){var r=Object.defineProperty;t.exports=r},1680:function(t){var r="function"==typeof Object.defineProperty?Object.defineProperty:null;t.exports=r},1471:function(t,r,n){var e=n(1680);t.exports=function(){try{return e({},"x",{}),!0}catch(t){return!1}}},6691:function(t,r,n){var e,o=n(1471),i=n(2073),u=n(1309);e=o()?i:u,t.exports=e},1309:function(t){var r=Object.prototype,n=r.toString,e=r.__defineGetter__,o=r.__defineSetter__,i=r.__lookupGetter__,u=r.__lookupSetter__;t.exports=function(t,a,c){var f,s,p,l;if("object"!=typeof t||null===t||"[object Array]"===n.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof c||null===c||"[object Array]"===n.call(c))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+c+"`.");if((s="value"in c)&&(i.call(t,a)||u.call(t,a)?(f=t.__proto__,t.__proto__=r,delete t[a],t[a]=c.value,t.__proto__=f):t[a]=c.value),p="get"in c,l="set"in c,s&&(p||l))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return p&&e&&e.call(t,a,c.get),l&&o&&o.call(t,a,c.set),t}},6208:function(t,r,n){var e,o=n(3123),i=n(7407),u=n(4210);e=o()?u:i,t.exports=e},7407:function(t,r,n){var e=n(173);t.exports=function(t){return e.call(t)}},4210:function(t,r,n){var e=n(9048),o=n(1403),i=n(173);t.exports=function(t){var r,n,u;if(null==t)return i.call(t);n=t[o],r=e(t,o);try{t[o]=void 0}catch(r){return i.call(t)}return u=i.call(t),r?t[o]=n:delete t[o],u}},173:function(t){var r=Object.prototype.toString;t.exports=r},1403:function(t){var r="function"==typeof Symbol?Symbol.toStringTag:"";t.exports=r},7843:function(t){t.exports=function(t,r,n,e,o){for(r=r.split?r.split("."):r,e=0;e<r.length;e++)t=t?t[r[e]]:o;return t===o?n:t}},2341:function(t,r){r.dset=function(t,r,n){r.split&&(r=r.split("."));for(var e,o,i=0,u=r.length,a=t;i<u&&"__proto__"!==(o=r[i++])&&"constructor"!==o&&"prototype"!==o;)a=a[o]=i===u?n:typeof(e=a[o])==typeof r?e:0*r[i]!=0||~(""+r[i]).indexOf(".")?{}:[]}},2263:function(t,r,n){n.r(r),n.d(r,{default:function(){return i}});for(var e=[],o=0;o<64;)e[o]=0|4294967296*Math.sin(++o%Math.PI);function i(t){var r,n,i,u=[r=1732584193,n=4023233417,~r,~n],a=[],c=unescape(encodeURI(t))+"",f=c.length;for(t=--f/4+2|15,a[--t]=8*f;~f;)a[f>>2]|=c.charCodeAt(f)<<8*f--;for(o=c=0;o<t;o+=16){for(f=u;c<64;f=[i=f[3],r+((i=f[0]+[r&n|~r&i,i&r|~i&n,r^n^i,n^(r|~i)][f=c>>4]+e[c]+~~a[o|15&[c,5*c+1,3*c+5,7*c][f]])<<(f=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*f+c++%4])|i>>>-f),r,n])r=0|f[1],n=f[2];for(c=4;c;)u[--c]+=f[c]}for(t="";c<32;)t+=(u[c>>3]>>4*(1^c++)&15).toString(16);return t}}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e].call(i.exports,i,i.exports,n),i.exports}return n.d=function(t,r){for(var e in r)n.o(r,e)&&!n.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(2870)}()}}]);
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@customerio/cdp-analytics-browser",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/customerio/cdp-analytics-js",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"cjs": "yarn tsc -p tsconfig.build.json --outDir ./dist/cjs --module commonjs",
|
|
39
39
|
"clean": "rm -rf dist",
|
|
40
40
|
"lint": "yarn concurrently 'yarn:eslint .' 'yarn:tsc --noEmit'",
|
|
41
|
-
"test": "yarn jest"
|
|
41
|
+
"test": "yarn jest",
|
|
42
|
+
"vendor": "node scripts/vendor/run.js"
|
|
42
43
|
},
|
|
43
44
|
"size-limit": [
|
|
44
45
|
{
|
|
@@ -47,12 +48,11 @@
|
|
|
47
48
|
}
|
|
48
49
|
],
|
|
49
50
|
"dependencies": {
|
|
50
|
-
"@customerio/cdp-analytics-core": "0.3.
|
|
51
|
+
"@customerio/cdp-analytics-core": "0.3.2",
|
|
51
52
|
"@lukeed/uuid": "^2.0.0",
|
|
52
53
|
"@segment/analytics.js-video-plugins": "^0.2.1",
|
|
53
54
|
"@segment/facade": "^3.4.9",
|
|
54
|
-
"
|
|
55
|
-
"customerio-gist-web": "^3.12.0",
|
|
55
|
+
"customerio-gist-web": "^3.14.0",
|
|
56
56
|
"dset": "^3.1.2",
|
|
57
57
|
"js-cookie": "3.0.1",
|
|
58
58
|
"node-fetch": "^2.6.7",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@internal/config": "0.0.0",
|
|
65
65
|
"@segment/analytics.js-integration": "^3.3.3",
|
|
66
66
|
"@segment/analytics.js-integration-amplitude": "^3.3.3",
|
|
67
|
+
"@segment/tsub": "^2.0.0",
|
|
67
68
|
"@size-limit/preset-big-lib": "^7.0.8",
|
|
68
69
|
"@types/flat": "^5.0.1",
|
|
69
70
|
"@types/fs-extra": "^9.0.2",
|
package/src/browser/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { ClassicIntegrationSource } from '../plugins/ajs-destination/types'
|
|
|
27
27
|
import { attachInspector } from '../core/inspector'
|
|
28
28
|
import { Stats } from '../core/stats'
|
|
29
29
|
import { InAppPluginSettings } from '../plugins/in-app-plugin'
|
|
30
|
+
import { setGlobalAnalyticsKey } from '../lib/global-analytics-helper'
|
|
30
31
|
|
|
31
32
|
export interface LegacyIntegrationConfiguration {
|
|
32
33
|
/* @deprecated - This does not indicate browser types anymore */
|
|
@@ -278,6 +279,8 @@ async function loadAnalytics(
|
|
|
278
279
|
options: InitOptions = {},
|
|
279
280
|
preInitBuffer: PreInitMethodCallBuffer
|
|
280
281
|
): Promise<[Analytics, Context]> {
|
|
282
|
+
if (options.globalAnalyticsKey)
|
|
283
|
+
setGlobalAnalyticsKey(options.globalAnalyticsKey)
|
|
281
284
|
// this is an ugly side-effect, but it's for the benefits of the plugins that get their cdn via getCDN()
|
|
282
285
|
if (settings.cdnURL) setGlobalCDNUrl(settings.cdnURL)
|
|
283
286
|
|
|
@@ -1,30 +1,19 @@
|
|
|
1
|
-
import { Analytics, InitOptions } from '../core/analytics'
|
|
2
1
|
import { AnalyticsBrowser } from '.'
|
|
3
2
|
import { embeddedWriteKey } from '../lib/embedded-write-key'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface AnalyticsStandalone extends Analytics {
|
|
10
|
-
_loadOptions?: InitOptions
|
|
11
|
-
_writeKey?: string
|
|
12
|
-
_cdn?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare global {
|
|
16
|
-
interface Window {
|
|
17
|
-
analytics: AnalyticsSnippet
|
|
18
|
-
}
|
|
19
|
-
}
|
|
3
|
+
import { AnalyticsSnippet } from './standalone-interface'
|
|
4
|
+
import {
|
|
5
|
+
getGlobalAnalytics,
|
|
6
|
+
setGlobalAnalytics,
|
|
7
|
+
} from '../lib/global-analytics-helper'
|
|
20
8
|
|
|
21
9
|
function getWriteKey(): string | undefined {
|
|
22
10
|
if (embeddedWriteKey()) {
|
|
23
11
|
return embeddedWriteKey()
|
|
24
12
|
}
|
|
25
13
|
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const analytics = getGlobalAnalytics()
|
|
15
|
+
if (analytics?._writeKey) {
|
|
16
|
+
return analytics._writeKey
|
|
28
17
|
}
|
|
29
18
|
|
|
30
19
|
const regex = /http.*\/analytics\.js\/v1\/([^/]*)(\/platform)?\/analytics.*/
|
|
@@ -59,7 +48,7 @@ function getWriteKey(): string | undefined {
|
|
|
59
48
|
|
|
60
49
|
export async function install(): Promise<void> {
|
|
61
50
|
const writeKey = getWriteKey()
|
|
62
|
-
const options =
|
|
51
|
+
const options = getGlobalAnalytics()?._loadOptions ?? {}
|
|
63
52
|
if (!writeKey) {
|
|
64
53
|
console.error(
|
|
65
54
|
'Failed to load Write Key. Make sure to use the latest version of the snippet, which can be found in your source settings.'
|
|
@@ -67,8 +56,7 @@ export async function install(): Promise<void> {
|
|
|
67
56
|
return
|
|
68
57
|
}
|
|
69
58
|
|
|
70
|
-
|
|
71
|
-
writeKey,
|
|
72
|
-
|
|
73
|
-
)) as AnalyticsSnippet
|
|
59
|
+
setGlobalAnalytics(
|
|
60
|
+
(await AnalyticsBrowser.standalone(writeKey, options)) as AnalyticsSnippet
|
|
61
|
+
)
|
|
74
62
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Analytics, InitOptions } from '../core/analytics'
|
|
2
|
+
|
|
3
|
+
export interface AnalyticsSnippet extends AnalyticsStandalone {
|
|
4
|
+
load: (writeKey: string, options?: InitOptions) => void
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AnalyticsStandalone extends Analytics {
|
|
8
|
+
_loadOptions?: InitOptions
|
|
9
|
+
_writeKey?: string
|
|
10
|
+
_cdn?: string
|
|
11
|
+
}
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
import { getCDN, setGlobalCDNUrl } from '../lib/parse-cdn'
|
|
3
3
|
import { setVersionType } from '../plugins/customerio/normalize'
|
|
4
4
|
|
|
5
|
+
// The global analytics key must be set first so that subsequent calls to getCdn() fetch the CDN from the correct instance.
|
|
6
|
+
const globalAnalyticsKey = (
|
|
7
|
+
document.querySelector(
|
|
8
|
+
'script[data-global-customerio-analytics-key]'
|
|
9
|
+
) as HTMLScriptElement
|
|
10
|
+
)?.dataset.globalCustomerioAnalyticsKey
|
|
11
|
+
|
|
12
|
+
if (globalAnalyticsKey) {
|
|
13
|
+
setGlobalAnalyticsKey(globalAnalyticsKey)
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
if (process.env.ASSET_PATH) {
|
|
6
17
|
if (process.env.ASSET_PATH === '/dist/umd/') {
|
|
7
18
|
// @ts-ignore
|
|
@@ -25,6 +36,7 @@ import { shouldPolyfill } from '../lib/browser-polyfill'
|
|
|
25
36
|
import { RemoteMetrics } from '../core/stats/remote-metrics'
|
|
26
37
|
import { embeddedWriteKey } from '../lib/embedded-write-key'
|
|
27
38
|
import { onCSPError } from '../lib/csp-detection'
|
|
39
|
+
import { setGlobalAnalyticsKey } from '../lib/global-analytics-helper'
|
|
28
40
|
|
|
29
41
|
function onError(err?: unknown) {
|
|
30
42
|
console.error('[analytics.js]', 'Failed to load Analytics.js', err)
|
|
@@ -48,6 +48,7 @@ import { version } from '../../generated/version'
|
|
|
48
48
|
import { PriorityQueue } from '../../lib/priority-queue'
|
|
49
49
|
import { getGlobal } from '../../lib/get-global'
|
|
50
50
|
import { AnalyticsClassic, AnalyticsCore } from './interfaces'
|
|
51
|
+
import { setGlobalAnalytics } from '../../lib/global-analytics-helper'
|
|
51
52
|
|
|
52
53
|
const deprecationWarning =
|
|
53
54
|
'This is being deprecated and will be not be available in future releases of Analytics JS'
|
|
@@ -102,6 +103,11 @@ export interface InitOptions {
|
|
|
102
103
|
aid?: RegExp
|
|
103
104
|
uid?: RegExp
|
|
104
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* When using the snippet, this is the key that points to the global analytics instance (e.g. window.analytics).
|
|
108
|
+
* default: analytics
|
|
109
|
+
*/
|
|
110
|
+
globalAnalyticsKey?: string
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
/* analytics-classic stubs */
|
|
@@ -468,7 +474,7 @@ export class Analytics
|
|
|
468
474
|
|
|
469
475
|
noConflict(): Analytics {
|
|
470
476
|
console.warn(deprecationWarning)
|
|
471
|
-
|
|
477
|
+
setGlobalAnalytics(_analytics ?? this)
|
|
472
478
|
return this
|
|
473
479
|
}
|
|
474
480
|
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
PreInitMethodName,
|
|
4
4
|
PreInitMethodParams,
|
|
5
5
|
} from '.'
|
|
6
|
+
import { getGlobalAnalytics } from '../../lib/global-analytics-helper'
|
|
6
7
|
|
|
7
8
|
export function transformSnippetCall([
|
|
8
9
|
methodName,
|
|
@@ -29,14 +30,16 @@ type SnippetWindowBufferedMethodCall<
|
|
|
29
30
|
* A list of the method calls before initialization for snippet users
|
|
30
31
|
* For example, [["track", "foo", {bar: 123}], ["page"], ["on", "ready", function(){..}]
|
|
31
32
|
*/
|
|
32
|
-
type SnippetBuffer = SnippetWindowBufferedMethodCall[]
|
|
33
|
+
export type SnippetBuffer = SnippetWindowBufferedMethodCall[]
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Fetch the buffered method calls from the window object and normalize them.
|
|
36
37
|
* This removes existing buffered calls from the window object.
|
|
37
38
|
*/
|
|
38
|
-
export const popSnippetWindowBuffer = (
|
|
39
|
-
|
|
39
|
+
export const popSnippetWindowBuffer = (
|
|
40
|
+
buffer: unknown = getGlobalAnalytics()
|
|
41
|
+
): PreInitMethodCall[] => {
|
|
42
|
+
const wa = buffer
|
|
40
43
|
if (!Array.isArray(wa)) return []
|
|
41
44
|
const buffered = wa.splice(0, wa.length)
|
|
42
45
|
return normalizeSnippetBuffer(buffered)
|
package/src/generated/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is generated.
|
|
2
|
-
export const version = '0.3.
|
|
2
|
+
export const version = '0.3.2'
|
package/src/index.ts
CHANGED
|
@@ -8,5 +8,5 @@ export * from './core/plugin'
|
|
|
8
8
|
export * from './core/user'
|
|
9
9
|
|
|
10
10
|
export * from './plugins/in-app-plugin'
|
|
11
|
-
|
|
12
|
-
export
|
|
11
|
+
export type { AnalyticsSnippet } from './browser/standalone-interface'
|
|
12
|
+
export { getGlobalAnalytics } from './lib/global-analytics-helper'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AnalyticsSnippet } from '../browser/standalone-interface'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stores the global window analytics key
|
|
5
|
+
*/
|
|
6
|
+
let _globalAnalyticsKey = 'analytics'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Gets the global analytics/buffer
|
|
10
|
+
* @param key name of the window property where the buffer is stored (default: analytics)
|
|
11
|
+
* @returns AnalyticsSnippet
|
|
12
|
+
*/
|
|
13
|
+
export function getGlobalAnalytics(): AnalyticsSnippet | undefined {
|
|
14
|
+
return (window as any)[_globalAnalyticsKey]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Replaces the global window key for the analytics/buffer object
|
|
19
|
+
* @param key key name
|
|
20
|
+
*/
|
|
21
|
+
export function setGlobalAnalyticsKey(key: string) {
|
|
22
|
+
_globalAnalyticsKey = key
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sets the global analytics object
|
|
27
|
+
* @param analytics analytics snippet
|
|
28
|
+
*/
|
|
29
|
+
export function setGlobalAnalytics(analytics: AnalyticsSnippet): void {
|
|
30
|
+
;(window as any)[_globalAnalyticsKey] = analytics
|
|
31
|
+
}
|
package/src/lib/parse-cdn.ts
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
|
+
import { getGlobalAnalytics } from './global-analytics-helper'
|
|
1
2
|
import { embeddedWriteKey } from './embedded-write-key'
|
|
2
3
|
|
|
3
4
|
const analyticsScriptRegex =
|
|
4
|
-
/(https
|
|
5
|
+
/(https?:\/\/[\w.\-:]+)\/(?:analytics\.js\/v1|v1\/analytics-js\/snippet)\/[\w\-:]+\/(analytics\.(?:min)\.js)/
|
|
5
6
|
|
|
6
7
|
const getCDNUrlFromScriptTag = (): string | undefined => {
|
|
7
8
|
let cdn: string | undefined
|
|
8
9
|
const scripts = Array.prototype.slice.call(
|
|
9
10
|
document.querySelectorAll('script')
|
|
10
11
|
)
|
|
11
|
-
|
|
12
|
+
for (const s of scripts) {
|
|
12
13
|
const src = s.getAttribute('src') ?? ''
|
|
13
14
|
const result = analyticsScriptRegex.exec(src)
|
|
14
15
|
|
|
15
16
|
if (result && result[1]) {
|
|
16
17
|
cdn = result[1]
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
// If the script tag has the globalCustomerioAnalyticsKey attribute, then this is a CDP script (not segment).
|
|
21
|
+
if (s.dataset?.globalCustomerioAnalyticsKey != null) {
|
|
22
|
+
break
|
|
23
|
+
}
|
|
24
|
+
}
|
|
19
25
|
return cdn
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
let _globalCDN: string | undefined // set globalCDN as in-memory singleton
|
|
23
29
|
const getGlobalCDNUrl = (): string | undefined => {
|
|
24
|
-
const result = _globalCDN ??
|
|
30
|
+
const result = _globalCDN ?? getGlobalAnalytics()?._cdn
|
|
25
31
|
return result
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
export const setGlobalCDNUrl = (cdn: string) => {
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
const globalAnalytics = getGlobalAnalytics()
|
|
36
|
+
if (globalAnalytics) {
|
|
37
|
+
globalAnalytics._cdn = cdn
|
|
31
38
|
}
|
|
32
39
|
_globalCDN = cdn
|
|
33
40
|
}
|
|
@@ -61,7 +68,7 @@ export const getNextIntegrationsURL = () => {
|
|
|
61
68
|
* @returns the path to Analytics JS 1.0
|
|
62
69
|
**/
|
|
63
70
|
export function getLegacyAJSPath(): string {
|
|
64
|
-
const writeKey = embeddedWriteKey() ??
|
|
71
|
+
const writeKey = embeddedWriteKey() ?? getGlobalAnalytics()?._writeKey
|
|
65
72
|
|
|
66
73
|
const scripts = Array.prototype.slice.call(
|
|
67
74
|
document.querySelectorAll('script')
|
|
@@ -36,7 +36,7 @@ export function InAppPlugin(
|
|
|
36
36
|
allEvents.forEach((event) => {
|
|
37
37
|
_eventTarget.addEventListener(event, settings?.events as EventListenerOrEventListenerObject);
|
|
38
38
|
});
|
|
39
|
-
['
|
|
39
|
+
['messageDismissed', 'messageError'].forEach((event) => {
|
|
40
40
|
Gist.events.on(event, (message: any) => {
|
|
41
41
|
_eventTarget.dispatchEvent(newEvent(gistToCIO(event), {
|
|
42
42
|
messageId: message.messageId,
|
|
@@ -48,6 +48,17 @@ export function InAppPlugin(
|
|
|
48
48
|
|
|
49
49
|
Gist.events.on('messageShown', (message: any) => {
|
|
50
50
|
const deliveryId:string = message?.properties?.gist?.campaignId;
|
|
51
|
+
if (settings.events) {
|
|
52
|
+
_eventTarget.dispatchEvent(newEvent(InAppEvents.MessageOpened, {
|
|
53
|
+
messageId: message?.messageId,
|
|
54
|
+
deliveryId: deliveryId,
|
|
55
|
+
message: {
|
|
56
|
+
dismiss: function() {
|
|
57
|
+
Gist.dismissMessage(message?.instanceId);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
51
62
|
if (typeof deliveryId != 'undefined' && deliveryId != '') {
|
|
52
63
|
_analytics.track(JourneysEvents.Metric, {
|
|
53
64
|
'deliveryId': deliveryId,
|
|
@@ -68,10 +79,25 @@ export function InAppPlugin(
|
|
|
68
79
|
});
|
|
69
80
|
|
|
70
81
|
Gist.events.on('messageAction', (params: any) => {
|
|
82
|
+
const deliveryId:string = params?.message?.properties?.gist?.campaignId;
|
|
83
|
+
if (settings.events) {
|
|
84
|
+
_eventTarget.dispatchEvent(newEvent(InAppEvents.MessageAction, {
|
|
85
|
+
messageId: params.message.messageId,
|
|
86
|
+
deliveryId: deliveryId,
|
|
87
|
+
action: params.action,
|
|
88
|
+
name: params.name,
|
|
89
|
+
actionName: params.name,
|
|
90
|
+
actionValue: params.action,
|
|
91
|
+
message: {
|
|
92
|
+
dismiss: function() {
|
|
93
|
+
Gist.dismissMessage(params.message.instanceId);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
71
98
|
if (params.action == 'gist://close') {
|
|
72
99
|
return;
|
|
73
100
|
}
|
|
74
|
-
const deliveryId:string = params?.message?.properties?.gist?.campaignId;
|
|
75
101
|
if (typeof deliveryId != 'undefined' && deliveryId != '') {
|
|
76
102
|
_analytics.track(JourneysEvents.Metric, {
|
|
77
103
|
'deliveryId': deliveryId,
|
|
@@ -79,21 +105,6 @@ export function InAppPlugin(
|
|
|
79
105
|
'actionName': params.name,
|
|
80
106
|
'actionValue': params.action,
|
|
81
107
|
});
|
|
82
|
-
if (settings.events) {
|
|
83
|
-
_eventTarget.dispatchEvent(newEvent(InAppEvents.MessageAction, {
|
|
84
|
-
messageId: params.message.messageId,
|
|
85
|
-
deliveryId: deliveryId,
|
|
86
|
-
action: params.action,
|
|
87
|
-
name: params.name,
|
|
88
|
-
actionName: params.name,
|
|
89
|
-
actionValue: params.action,
|
|
90
|
-
message:{
|
|
91
|
-
dismiss: function() {
|
|
92
|
-
Gist.dismissMessage(params?.message?.instanceId);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
108
|
return;
|
|
98
109
|
}
|
|
99
110
|
const broadcastId:Number = params?.message?.properties?.gist?.broadcast?.broadcastIdInt;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as tsub from '../../vendor/tsub/tsub'
|
|
3
|
+
import type { Matcher, Rule, Store } from '../../vendor/tsub/types'
|
|
3
4
|
import { DestinationMiddlewareFunction } from '../middleware'
|
|
4
5
|
|
|
5
6
|
// TODO: update tsub definition
|
|
@@ -16,10 +17,10 @@ export type RoutingRule = Rule & {
|
|
|
16
17
|
export const tsubMiddleware =
|
|
17
18
|
(rules: RoutingRule[]): DestinationMiddlewareFunction =>
|
|
18
19
|
({ payload, integration, next }): void => {
|
|
19
|
-
const store = new tsub.Store(rules)
|
|
20
|
+
const store = new tsub.Store(rules) as Store
|
|
20
21
|
const rulesToApply = store.getRulesByDestinationName(integration)
|
|
21
22
|
|
|
22
|
-
rulesToApply.forEach((rule) => {
|
|
23
|
+
rulesToApply.forEach((rule: Rule) => {
|
|
23
24
|
const { matchers, transformers } = rule
|
|
24
25
|
|
|
25
26
|
for (let i = 0; i < matchers.length; i++) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @license Apache-2.0
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) 2021 The Stdlib Authors.
|
|
23
|
+
*
|
|
24
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
* you may not use this file except in compliance with the License.
|
|
26
|
+
* You may obtain a copy of the License at
|
|
27
|
+
*
|
|
28
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
+
*
|
|
30
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
31
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
32
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
33
|
+
* See the License for the specific language governing permissions and
|
|
34
|
+
* limitations under the License.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @license Apache-2.0
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) 2022 The Stdlib Authors.
|
|
41
|
+
*
|
|
42
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
43
|
+
* you may not use this file except in compliance with the License.
|
|
44
|
+
* You may obtain a copy of the License at
|
|
45
|
+
*
|
|
46
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
47
|
+
*
|
|
48
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
49
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
50
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
51
|
+
* See the License for the specific language governing permissions and
|
|
52
|
+
* limitations under the License.
|
|
53
|
+
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// prettier-ignore
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @segment/tsub 2.0.0 - GENERATED DO NOT MODIFY
|
|
5
|
+
|
|
6
|
+
/*! For license information please see tsub.js.LICENSE.txt */
|
|
7
|
+
!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var e=r();for(var n in e)("object"==typeof exports?exports:t)[n]=e[n]}}(self,(function(){return(()=>{var t={2870:function(t,r,e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.Store=r.matches=r.transform=void 0;var o=e(4303);Object.defineProperty(r,"transform",{enumerable:!0,get:function(){return n(o).default}});var s=e(2370);Object.defineProperty(r,"matches",{enumerable:!0,get:function(){return n(s).default}});var i=e(1444);Object.defineProperty(r,"Store",{enumerable:!0,get:function(){return n(i).default}})},2370:function(t,r,e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var o=n(e(7843));function s(t,r){if(!Array.isArray(t))return!0===i(t,r);var e,n,o,f,p=t[0];switch(p){case"!":return!s(t[1],r);case"or":for(var l=1;l<t.length;l++)if(s(t[l],r))return!0;return!1;case"and":for(l=1;l<t.length;l++)if(!s(t[l],r))return!1;return!0;case"=":case"!=":return function(t,r,e,n){switch(u(t)&&(t=s(t,n)),u(r)&&(r=s(r,n)),"object"==typeof t&&"object"==typeof r&&(t=JSON.stringify(t),r=JSON.stringify(r)),e){case"=":return t===r;case"!=":return t!==r;default:throw new Error("Invalid operator in compareItems: ".concat(e))}}(i(t[1],r),i(t[2],r),p,r);case"<=":case"<":case">":case">=":return function(t,r,e,n){if(u(t)&&(t=s(t,n)),u(r)&&(r=s(r,n)),"number"!=typeof t||"number"!=typeof r)return!1;switch(e){case"<=":return t<=r;case">=":return t>=r;case"<":return t<r;case">":return t>r;default:throw new Error("Invalid operator in compareNumbers: ".concat(e))}}(i(t[1],r),i(t[2],r),p,r);case"in":return function(t,r,e){return void 0!==r.find((function(r){return i(r,e)===t}))}(i(t[1],r),i(t[2],r),r);case"contains":return o=i(t[1],r),f=i(t[2],r),"string"==typeof o&&"string"==typeof f&&-1!==o.indexOf(f);case"match":return e=i(t[1],r),n=i(t[2],r),"string"==typeof e&&"string"==typeof n&&function(t,r){var e,n;t:for(;t.length>0;){var o,s;if(o=(e=a(t)).star,s=e.chunk,t=e.pattern,o&&""===s)return!0;var i=c(s,r),u=i.t,f=i.ok,p=i.err;if(p)return!1;if(!f||!(0===u.length||t.length>0)){if(o)for(var l=0;l<r.length;l++){if(u=(n=c(s,r.slice(l+1))).t,f=n.ok,p=n.err,f){if(0===t.length&&u.length>0)continue;r=u;continue t}if(p)return!1}return!1}r=u}return 0===r.length}(n,e);case"lowercase":var v=i(t[1],r);return"string"!=typeof v?null:v.toLowerCase();case"typeof":return typeof i(t[1],r);case"length":return function(t){return null===t?0:Array.isArray(t)||"string"==typeof t?t.length:NaN}(i(t[1],r));default:throw new Error("FQL IR could not evaluate for token: ".concat(p))}}function i(t,r){return Array.isArray(t)?t:"object"==typeof t?t.value:(0,o.default)(r,t)}function u(t){return!!Array.isArray(t)&&(("lowercase"===t[0]||"length"===t[0]||"typeof"===t[0])&&2===t.length||("contains"===t[0]||"match"===t[0])&&3===t.length)}function a(t){for(var r={star:!1,chunk:"",pattern:""};t.length>0&&"*"===t[0];)t=t.slice(1),r.star=!0;var e,n=!1;t:for(e=0;e<t.length;e++)switch(t[e]){case"\\":e+1<t.length&&e++;break;case"[":n=!0;break;case"]":n=!1;break;case"*":if(!n)break t}return r.chunk=t.slice(0,e),r.pattern=t.slice(e),r}function c(t,r){for(var e,n,o={t:"",ok:!1,err:!1};t.length>0;){if(0===r.length)return o;switch(t[0]){case"[":var s=r[0];r=r.slice(1);var i=!0;(t=t.slice(1)).length>0&&"^"===t[0]&&(i=!1,t=t.slice(1));for(var u=!1,a=0;;){if(t.length>0&&"]"===t[0]&&a>0){t=t.slice(1);break}var c,p="";if(c=(e=f(t)).char,t=e.newChunk,e.err)return o;if(p=c,"-"===t[0]&&(p=(n=f(t.slice(1))).char,t=n.newChunk,n.err))return o;c<=s&&s<=p&&(u=!0),a++}if(u!==i)return o;break;case"?":r=r.slice(1),t=t.slice(1);break;case"\\":if(0===(t=t.slice(1)).length)return o.err=!0,o;default:if(t[0]!==r[0])return o;r=r.slice(1),t=t.slice(1)}}return o.t=r,o.ok=!0,o.err=!1,o}function f(t){var r={char:"",newChunk:"",err:!1};return 0===t.length||"-"===t[0]||"]"===t[0]||"\\"===t[0]&&0===(t=t.slice(1)).length?(r.err=!0,r):(r.char=t[0],r.newChunk=t.slice(1),0===r.newChunk.length&&(r.err=!0),r)}r.default=function(t,r){if(!r)throw new Error("No matcher supplied!");switch(r.type){case"all":return!0;case"fql":return function(t,r){if(!t)return!1;try{t=JSON.parse(t)}catch(r){throw new Error('Failed to JSON.parse FQL intermediate representation "'.concat(t,'": ').concat(r))}var e=s(t,r);return"boolean"==typeof e&&e}(r.ir,t);default:throw new Error("Matcher of type ".concat(r.type," unsupported."))}}},1444:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e=function(){function t(t){this.rules=[],this.rules=t||[]}return t.prototype.getRulesByDestinationName=function(t){for(var r=[],e=0,n=this.rules;e<n.length;e++){var o=n[e];o.destinationName!==t&&void 0!==o.destinationName||r.push(o)}return r},t}();r.default=e},4303:function(t,r,e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0});var o=n(e(2263)),s=n(e(7843)),i=n(e(5500)),u=e(2341),a=e(4966);function c(t,r){p(t,r.drop,(function(t,r){r.forEach((function(r){return delete t[r]}))}))}function f(t,r){p(t,r.allow,(function(t,r){Object.keys(t).forEach((function(e){r.includes(e)||delete t[e]}))}))}function p(t,r,e){Object.entries(r).forEach((function(r){var n=r[0],o=r[1],i=function(t){"object"==typeof t&&null!==t&&e(t,o)},u=""===n?t:(0,s.default)(t,n);Array.isArray(u)?u.forEach(i):i(u)}))}function l(t,r){var e=JSON.parse(JSON.stringify(t));for(var n in r.map)if(r.map.hasOwnProperty(n)){var o=r.map[n],i=n.split("."),c=void 0;if(i.length>1?(i.pop(),c=(0,s.default)(e,i.join("."))):c=t,"object"==typeof c){if(o.copy){var f=(0,s.default)(e,o.copy);void 0!==f&&(0,u.dset)(t,n,f)}else if(o.move){var p=(0,s.default)(e,o.move);void 0!==p&&(0,u.dset)(t,n,p),(0,a.unset)(t,o.move)}else o.hasOwnProperty("set")&&(0,u.dset)(t,n,o.set);if(o.to_string){var l=(0,s.default)(t,n);if("string"==typeof l||"object"==typeof l&&null!==l)continue;void 0!==l?(0,u.dset)(t,n,JSON.stringify(l)):(0,u.dset)(t,n,"undefined")}}}}function v(t,r){return!(r.sample.percent<=0)&&(r.sample.percent>=1||(r.sample.path?function(t,r){var e=(0,s.default)(t,r.sample.path),n=(0,o.default)(JSON.stringify(e)),u=-64,a=[];y(n.slice(0,8),a);for(var c=0,f=0;f<64&&1!==a[f];f++)c++;if(0!==c){var p=[];y(n.slice(9,16),p),u-=c,a.splice(0,c),p.splice(64-c),a=a.concat(p)}return a[63]=0===a[63]?1:0,(0,i.default)(parseInt(a.join(""),2),u)<r.sample.percent}(t,r):(e=r.sample.percent,Math.random()<=e)));var e}function y(t,r){for(var e=0;e<8;e++)for(var n=t[e],o=128;o>=1;o/=2)n-o>=0?(n-=o,r.push(1)):r.push(0)}r.default=function(t,r){for(var e=t,n=0,o=r;n<o.length;n++){var s=o[n];switch(s.type){case"drop":return null;case"drop_properties":c(e,s.config);break;case"allow_properties":f(e,s.config);break;case"sample_event":if(v(e,s.config))break;return null;case"map_properties":l(e,s.config);break;case"hash_properties":break;default:throw new Error('Transformer of type "'.concat(s.type,'" is unsupported.'))}}return e}},4966:function(t,r,e){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:!0}),r.unset=void 0;var o=n(e(7843));r.unset=function(t,r){if((0,o.default)(t,r)){for(var e=r.split("."),n=e.pop();e.length&&"\\"===e[e.length-1].slice(-1);)n=e.pop().slice(0,-1)+"."+n;for(;e.length;)t=t[r=e.shift()];return delete t[n]}return!0}},3304:t=>{"use strict";var r="function"==typeof Float64Array?Float64Array:void 0;t.exports=r},7382:(t,r,e)=>{"use strict";var n,o=e(5569),s=e(3304),i=e(8482);n=o()?s:i,t.exports=n},8482:t=>{"use strict";t.exports=function(){throw new Error("not implemented")}},6322:(t,r,e)=>{"use strict";var n,o=e(2508),s=e(5679),i=e(882);n=o()?s:i,t.exports=n},882:t=>{"use strict";t.exports=function(){throw new Error("not implemented")}},5679:t=>{"use strict";var r="function"==typeof Uint16Array?Uint16Array:void 0;t.exports=r},4773:(t,r,e)=>{"use strict";var n,o=e(9773),s=e(3004),i=e(3078);n=o()?s:i,t.exports=n},3078:t=>{"use strict";t.exports=function(){throw new Error("not implemented")}},3004:t=>{"use strict";var r="function"==typeof Uint32Array?Uint32Array:void 0;t.exports=r},7980:(t,r,e)=>{"use strict";var n,o=e(8114),s=e(6737),i=e(3357);n=o()?s:i,t.exports=n},3357:t=>{"use strict";t.exports=function(){throw new Error("not implemented")}},6737:t=>{"use strict";var r="function"==typeof Uint8Array?Uint8Array:void 0;t.exports=r},2684:t=>{"use strict";var r="function"==typeof Float64Array?Float64Array:null;t.exports=r},5569:(t,r,e)=>{"use strict";var n=e(3876);t.exports=n},3876:(t,r,e)=>{"use strict";var n=e(1448),o=e(2684);t.exports=function(){var t,r;if("function"!=typeof o)return!1;try{r=new o([1,3.14,-3.14,NaN]),t=n(r)&&1===r[0]&&3.14===r[1]&&-3.14===r[2]&&r[3]!=r[3]}catch(r){t=!1}return t}},9048:(t,r,e)=>{"use strict";var n=e(3763);t.exports=n},3763:t=>{"use strict";var r=Object.prototype.hasOwnProperty;t.exports=function(t,e){return null!=t&&r.call(t,e)}},7009:(t,r,e)=>{"use strict";var n=e(6784);t.exports=n},6784:t=>{"use strict";t.exports=function(){return"function"==typeof Symbol&&"symbol"==typeof Symbol("foo")}},3123:(t,r,e)=>{"use strict";var n=e(8481);t.exports=n},8481:(t,r,e)=>{"use strict";var n=e(7009)();t.exports=function(){return n&&"symbol"==typeof Symbol.toStringTag}},2508:(t,r,e)=>{"use strict";var n=e(3403);t.exports=n},3403:(t,r,e)=>{"use strict";var n=e(768),o=e(9668),s=e(187);t.exports=function(){var t,r;if("function"!=typeof s)return!1;try{r=new s(r=[1,3.14,-3.14,o+1,o+2]),t=n(r)&&1===r[0]&&3===r[1]&&r[2]===o-2&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}},187:t=>{"use strict";var r="function"==typeof Uint16Array?Uint16Array:null;t.exports=r},9773:(t,r,e)=>{"use strict";var n=e(2822);t.exports=n},2822:(t,r,e)=>{"use strict";var n=e(2744),o=e(3899),s=e(746);t.exports=function(){var t,r;if("function"!=typeof s)return!1;try{r=new s(r=[1,3.14,-3.14,o+1,o+2]),t=n(r)&&1===r[0]&&3===r[1]&&r[2]===o-2&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}},746:t=>{"use strict";var r="function"==typeof Uint32Array?Uint32Array:null;t.exports=r},8114:(t,r,e)=>{"use strict";var n=e(8066);t.exports=n},8066:(t,r,e)=>{"use strict";var n=e(8279),o=e(3443),s=e(2731);t.exports=function(){var t,r;if("function"!=typeof s)return!1;try{r=new s(r=[1,3.14,-3.14,o+1,o+2]),t=n(r)&&1===r[0]&&3===r[1]&&r[2]===o-2&&0===r[3]&&1===r[4]}catch(r){t=!1}return t}},2731:t=>{"use strict";var r="function"==typeof Uint8Array?Uint8Array:null;t.exports=r},1448:(t,r,e)=>{"use strict";var n=e(1453);t.exports=n},1453:(t,r,e)=>{"use strict";var n=e(6208),o="function"==typeof Float64Array;t.exports=function(t){return o&&t instanceof Float64Array||"[object Float64Array]"===n(t)}},9331:(t,r,e)=>{"use strict";var n=e(7980),o={uint16:e(6322),uint8:n};t.exports=o},5902:(t,r,e)=>{"use strict";var n=e(4106);t.exports=n},4106:(t,r,e)=>{"use strict";var n,o,s=e(9331);(o=new s.uint16(1))[0]=4660,n=52===new s.uint8(o.buffer)[0],t.exports=n},768:(t,r,e)=>{"use strict";var n=e(3823);t.exports=n},3823:(t,r,e)=>{"use strict";var n=e(6208),o="function"==typeof Uint16Array;t.exports=function(t){return o&&t instanceof Uint16Array||"[object Uint16Array]"===n(t)}},2744:(t,r,e)=>{"use strict";var n=e(2326);t.exports=n},2326:(t,r,e)=>{"use strict";var n=e(6208),o="function"==typeof Uint32Array;t.exports=function(t){return o&&t instanceof Uint32Array||"[object Uint32Array]"===n(t)}},8279:(t,r,e)=>{"use strict";var n=e(208);t.exports=n},208:(t,r,e)=>{"use strict";var n=e(6208),o="function"==typeof Uint8Array;t.exports=function(t){return o&&t instanceof Uint8Array||"[object Uint8Array]"===n(t)}},6315:t=>{"use strict";t.exports=1023},1686:t=>{"use strict";t.exports=2147483647},3105:t=>{"use strict";t.exports=2146435072},3449:t=>{"use strict";t.exports=2147483648},6988:t=>{"use strict";t.exports=-1023},9777:t=>{"use strict";t.exports=1023},3690:t=>{"use strict";t.exports=-1074},2918:(t,r,e)=>{"use strict";var n=e(4772).NEGATIVE_INFINITY;t.exports=n},4165:t=>{"use strict";var r=Number.POSITIVE_INFINITY;t.exports=r},6488:t=>{"use strict";t.exports=22250738585072014e-324},9668:t=>{"use strict";t.exports=65535},3899:t=>{"use strict";t.exports=4294967295},3443:t=>{"use strict";t.exports=255},7011:(t,r,e)=>{"use strict";var n=e(812);t.exports=n},812:(t,r,e)=>{"use strict";var n=e(4165),o=e(2918);t.exports=function(t){return t===n||t===o}},1883:(t,r,e)=>{"use strict";var n=e(1797);t.exports=n},1797:t=>{"use strict";t.exports=function(t){return t!=t}},513:(t,r,e)=>{"use strict";var n=e(5760);t.exports=n},5760:t=>{"use strict";t.exports=function(t){return Math.abs(t)}},5848:(t,r,e)=>{"use strict";var n=e(677);t.exports=n},677:(t,r,e)=>{"use strict";var n=e(3449),o=e(1686),s=e(7838),i=e(1921),u=e(2490),a=[0,0];t.exports=function(t,r){var e,c;return s.assign(t,a,1,0),e=a[0],e&=o,c=i(r),u(e|=c&=n,a[1])}},5500:(t,r,e)=>{"use strict";var n=e(8397);t.exports=n},8397:(t,r,e)=>{"use strict";var n=e(4165),o=e(2918),s=e(6315),i=e(9777),u=e(6988),a=e(3690),c=e(1883),f=e(7011),p=e(5848),l=e(4948),v=e(8478),y=e(7838),d=e(2490),h=[0,0],x=[0,0];t.exports=function(t,r){var e,b;return 0===t||c(t)||f(t)?t:(l(h,t),r+=h[1],(r+=v(t=h[0]))<a?p(0,t):r>i?t<0?o:n:(r<=u?(r+=52,b=2220446049250313e-31):b=1,y(x,t),e=x[0],e&=2148532223,b*d(e|=r+s<<20,x[1])))}},4772:(t,r,e)=>{"use strict";var n=e(7548);t.exports=n},7548:t=>{"use strict";t.exports=Number},8478:(t,r,e)=>{"use strict";var n=e(4500);t.exports=n},4500:(t,r,e)=>{"use strict";var n=e(1921),o=e(3105),s=e(6315);t.exports=function(t){var r=n(t);return(r=(r&o)>>>20)-s|0}},2490:(t,r,e)=>{"use strict";var n=e(9639);t.exports=n},4445:(t,r,e)=>{"use strict";var n,o,s;!0===e(5902)?(o=1,s=0):(o=0,s=1),n={HIGH:o,LOW:s},t.exports=n},9639:(t,r,e)=>{"use strict";var n=e(4773),o=e(7382),s=e(4445),i=new o(1),u=new n(i.buffer),a=s.HIGH,c=s.LOW;t.exports=function(t,r){return u[a]=t,u[c]=r,i[0]}},5646:(t,r,e)=>{"use strict";var n;n=!0===e(5902)?1:0,t.exports=n},1921:(t,r,e)=>{"use strict";var n=e(6285);t.exports=n},6285:(t,r,e)=>{"use strict";var n=e(4773),o=e(7382),s=e(5646),i=new o(1),u=new n(i.buffer);t.exports=function(t){return i[0]=t,u[s]}},9024:(t,r,e)=>{"use strict";var n=e(6488),o=e(7011),s=e(1883),i=e(513);t.exports=function(t,r,e,u){return s(t)||o(t)?(r[u]=t,r[u+e]=0,r):0!==t&&i(t)<n?(r[u]=4503599627370496*t,r[u+e]=-52,r):(r[u]=t,r[u+e]=0,r)}},4948:(t,r,e)=>{"use strict";var n=e(7576),o=e(9422);n(o,"assign",e(9024)),t.exports=o},9422:(t,r,e)=>{"use strict";var n=e(9024);t.exports=function(t){return n(t,[0,0],1,0)}},7838:(t,r,e)=>{"use strict";var n=e(4010);t.exports=n},5782:(t,r,e)=>{"use strict";var n,o,s;!0===e(5902)?(o=1,s=0):(o=0,s=1),n={HIGH:o,LOW:s},t.exports=n},4010:(t,r,e)=>{"use strict";var n=e(4903);t.exports=function(t,r){return 1===arguments.length?n([0,0],t):n(t,r)}},4903:(t,r,e)=>{"use strict";var n=e(4773),o=e(7382),s=e(5782),i=new o(1),u=new n(i.buffer),a=s.HIGH,c=s.LOW;t.exports=function(t,r){return i[0]=r,t[0]=u[a],t[1]=u[c],t}},7576:(t,r,e)=>{"use strict";var n=e(7063);t.exports=n},7063:(t,r,e)=>{"use strict";var n=e(6691);t.exports=function(t,r,e){n(t,r,{configurable:!1,enumerable:!1,writable:!1,value:e})}},2073:t=>{"use strict";var r=Object.defineProperty;t.exports=r},1680:t=>{"use strict";var r="function"==typeof Object.defineProperty?Object.defineProperty:null;t.exports=r},1471:(t,r,e)=>{"use strict";var n=e(1680);t.exports=function(){try{return n({},"x",{}),!0}catch(t){return!1}}},6691:(t,r,e)=>{"use strict";var n,o=e(1471),s=e(2073),i=e(1309);n=o()?s:i,t.exports=n},1309:t=>{"use strict";var r=Object.prototype,e=r.toString,n=r.__defineGetter__,o=r.__defineSetter__,s=r.__lookupGetter__,i=r.__lookupSetter__;t.exports=function(t,u,a){var c,f,p,l;if("object"!=typeof t||null===t||"[object Array]"===e.call(t))throw new TypeError("invalid argument. First argument must be an object. Value: `"+t+"`.");if("object"!=typeof a||null===a||"[object Array]"===e.call(a))throw new TypeError("invalid argument. Property descriptor must be an object. Value: `"+a+"`.");if((f="value"in a)&&(s.call(t,u)||i.call(t,u)?(c=t.__proto__,t.__proto__=r,delete t[u],t[u]=a.value,t.__proto__=c):t[u]=a.value),p="get"in a,l="set"in a,f&&(p||l))throw new Error("invalid argument. Cannot specify one or more accessors and a value or writable attribute in the property descriptor.");return p&&n&&n.call(t,u,a.get),l&&o&&o.call(t,u,a.set),t}},6208:(t,r,e)=>{"use strict";var n,o=e(3123),s=e(7407),i=e(4210);n=o()?i:s,t.exports=n},7407:(t,r,e)=>{"use strict";var n=e(173);t.exports=function(t){return n.call(t)}},4210:(t,r,e)=>{"use strict";var n=e(9048),o=e(1403),s=e(173);t.exports=function(t){var r,e,i;if(null==t)return s.call(t);e=t[o],r=n(t,o);try{t[o]=void 0}catch(r){return s.call(t)}return i=s.call(t),r?t[o]=e:delete t[o],i}},173:t=>{"use strict";var r=Object.prototype.toString;t.exports=r},1403:t=>{"use strict";var r="function"==typeof Symbol?Symbol.toStringTag:"";t.exports=r},7843:function(t){t.exports=function(t,r,e,n,o){for(r=r.split?r.split("."):r,n=0;n<r.length;n++)t=t?t[r[n]]:o;return t===o?e:t}},2341:(t,r)=>{r.dset=function(t,r,e){r.split&&(r=r.split("."));for(var n,o,s=0,i=r.length,u=t;s<i&&"__proto__"!==(o=r[s++])&&"constructor"!==o&&"prototype"!==o;)u=u[o]=s===i?e:typeof(n=u[o])==typeof r?n:0*r[s]!=0||~(""+r[s]).indexOf(".")?{}:[]}},2263:(t,r,e)=>{"use strict";e.r(r),e.d(r,{default:()=>s});for(var n=[],o=0;o<64;)n[o]=0|4294967296*Math.sin(++o%Math.PI);function s(t){var r,e,s,i=[r=1732584193,e=4023233417,~r,~e],u=[],a=unescape(encodeURI(t))+"",c=a.length;for(t=--c/4+2|15,u[--t]=8*c;~c;)u[c>>2]|=a.charCodeAt(c)<<8*c--;for(o=a=0;o<t;o+=16){for(c=i;a<64;c=[s=c[3],r+((s=c[0]+[r&e|~r&s,s&r|~s&e,r^e^s,e^(r|~s)][c=a>>4]+n[a]+~~u[o|15&[a,5*a+1,3*a+5,7*a][c]])<<(c=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*c+a++%4])|s>>>-c),r,e])r=0|c[1],e=c[2];for(a=4;a;)i[--a]+=c[a]}for(t="";a<32;)t+=(i[a>>3]>>4*(1^a++)&15).toString(16);return t}}},r={};function e(n){var o=r[n];if(void 0!==o)return o.exports;var s=r[n]={exports:{}};return t[n].call(s.exports,s,s.exports,e),s.exports}return e.d=(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},e.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e(2870)})()}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Rule {
|
|
2
|
+
scope: string
|
|
3
|
+
target_type: string
|
|
4
|
+
matchers: Matcher[]
|
|
5
|
+
transformers: Transformer[][]
|
|
6
|
+
destinationName?: string
|
|
7
|
+
}
|
|
8
|
+
export interface Matcher {
|
|
9
|
+
type: string
|
|
10
|
+
ir: string
|
|
11
|
+
}
|
|
12
|
+
export interface Transformer {
|
|
13
|
+
type: string
|
|
14
|
+
config?: any
|
|
15
|
+
}
|
|
16
|
+
export interface Store {
|
|
17
|
+
new (rules?: Rule[]): this
|
|
18
|
+
getRulesByDestinationName(destinationName: string): Rule[]
|
|
19
|
+
}
|