@convertcom/js-sdk-rules 2.0.0 → 2.1.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.
Files changed (78) hide show
  1. package/README.md +2 -2
  2. package/lib/enums/index.d.ts +26 -0
  3. package/lib/enums/src/bucketing-error.d.ts +9 -0
  4. package/lib/enums/src/conversion-setting-key.d.ts +9 -0
  5. package/lib/enums/src/data-enitites.d.ts +16 -0
  6. package/lib/enums/src/dictionary.d.ts +68 -0
  7. package/lib/enums/src/do-not-track.d.ts +12 -0
  8. package/lib/enums/src/entity-type.d.ts +15 -0
  9. package/lib/enums/src/feature-status.d.ts +10 -0
  10. package/lib/enums/src/goal-data-key.d.ts +11 -0
  11. package/lib/enums/src/log-level.d.ts +14 -0
  12. package/lib/enums/src/log-method.d.ts +14 -0
  13. package/lib/enums/src/project-type.d.ts +10 -0
  14. package/lib/enums/src/rule-error.d.ts +10 -0
  15. package/lib/enums/src/segments/browser-type.d.ts +17 -0
  16. package/lib/enums/src/segments/device-type.d.ts +16 -0
  17. package/lib/enums/src/segments/segments-keys.d.ts +15 -0
  18. package/lib/enums/src/segments/source-type.d.ts +12 -0
  19. package/lib/enums/src/segments/visitor-type.d.ts +10 -0
  20. package/lib/enums/src/system-events.d.ts +22 -0
  21. package/lib/enums/src/variable-types.d.ts +7 -0
  22. package/lib/enums/src/variation-change-type.d.ts +14 -0
  23. package/lib/index.d.ts +5 -4
  24. package/lib/index.js +767 -30
  25. package/lib/index.js.map +1 -1
  26. package/lib/index.min.js +1 -1
  27. package/lib/index.min.js.map +1 -1
  28. package/lib/index.min.mjs +1 -1
  29. package/lib/index.min.mjs.map +1 -1
  30. package/lib/index.mjs +743 -6
  31. package/lib/index.mjs.map +1 -1
  32. package/lib/legacy/index.js +798 -140
  33. package/lib/legacy/index.js.map +1 -1
  34. package/lib/legacy/index.min.js +1 -1
  35. package/lib/legacy/index.min.js.map +1 -1
  36. package/lib/logger/index.d.ts +8 -0
  37. package/lib/logger/src/interfaces/log-client.d.ts +13 -0
  38. package/lib/logger/src/interfaces/log-manager.d.ts +18 -0
  39. package/lib/logger/src/interfaces/log-method-map.d.ts +15 -0
  40. package/lib/logger/src/log-manager.d.ts +64 -0
  41. package/lib/package.json +6 -6
  42. package/lib/rules/index.d.ts +8 -0
  43. package/lib/rules/src/interfaces/rule-manager.d.ts +15 -0
  44. package/lib/rules/src/rule-manager.d.ts +82 -0
  45. package/lib/types/index.d.ts +28 -0
  46. package/lib/types/src/BucketedFeature.d.ts +29 -0
  47. package/lib/types/src/BucketedVariation.d.ts +13 -0
  48. package/lib/types/src/BucketingAllocation.d.ts +10 -0
  49. package/lib/types/src/BucketingAttributes.d.ts +17 -0
  50. package/lib/types/src/BucketingHash.d.ts +11 -0
  51. package/lib/types/src/Config.d.ts +60 -0
  52. package/lib/types/src/ConversionAttributes.d.ts +13 -0
  53. package/lib/types/src/Entity.d.ts +8 -0
  54. package/lib/types/src/GoalData.d.ts +11 -0
  55. package/lib/types/src/IndentityField.d.ts +7 -0
  56. package/lib/types/src/Integration.d.ts +8 -0
  57. package/lib/types/src/LocationAttributes.d.ts +12 -0
  58. package/lib/types/src/Path.d.ts +10 -0
  59. package/lib/types/src/RequireAtLeastOne.d.ts +3 -0
  60. package/lib/types/src/Rule.d.ts +13 -0
  61. package/lib/types/src/SegmentsAttributes.d.ts +9 -0
  62. package/lib/types/src/StoreData.d.ts +13 -0
  63. package/lib/types/src/TrackingEvent.d.ts +14 -0
  64. package/lib/types/src/VariableType.d.ts +8 -0
  65. package/lib/types/src/Visitor.d.ts +12 -0
  66. package/lib/types/src/VisitorsQueue.d.ts +14 -0
  67. package/lib/types/src/config/index.d.ts +1 -0
  68. package/lib/types/src/config/types.gen.d.ts +2387 -0
  69. package/lib/utils/index.d.ts +14 -0
  70. package/lib/utils/src/array-utils.d.ts +11 -0
  71. package/lib/utils/src/comparisons.d.ts +22 -0
  72. package/lib/utils/src/data-store.d.ts +39 -0
  73. package/lib/utils/src/file-logger.d.ts +40 -0
  74. package/lib/utils/src/http-client.d.ts +115 -0
  75. package/lib/utils/src/object-utils.d.ts +35 -0
  76. package/lib/utils/src/string-utils.d.ts +32 -0
  77. package/lib/utils/src/types-utils.d.ts +12 -0
  78. package/package.json +35 -31
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../node_modules/murmurhash/murmurhash.js"],"sourcesContent":["(function(){\n const _global = this;\n\n const createBuffer = (val) => new TextEncoder().encode(val)\n\n /**\n * JS Implementation of MurmurHash2\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {Uint8Array | string} str ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n function MurmurHashV2(str, seed) {\n if (typeof str === 'string') str = createBuffer(str);\n let\n l = str.length,\n h = seed ^ l,\n i = 0,\n k;\n\n while (l >= 4) {\n k =\n ((str[i] & 0xff)) |\n ((str[++i] & 0xff) << 8) |\n ((str[++i] & 0xff) << 16) |\n ((str[++i] & 0xff) << 24);\n\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n k ^= k >>> 24;\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;\n\n l -= 4;\n ++i;\n }\n\n switch (l) {\n case 3: h ^= (str[i + 2] & 0xff) << 16;\n case 2: h ^= (str[i + 1] & 0xff) << 8;\n case 1: h ^= (str[i] & 0xff);\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n }\n\n h ^= h >>> 13;\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n h ^= h >>> 15;\n\n return h >>> 0;\n };\n\n /*\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {Uint8Array | string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n function MurmurHashV3(key, seed) {\n if (typeof key === 'string') key = createBuffer(key);\n\n let remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i;\n\n remainder = key.length & 3; // key.length % 4\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 0xcc9e2d51;\n c2 = 0x1b873593;\n i = 0;\n\n while (i < bytes) {\n k1 =\n ((key[i] & 0xff)) |\n ((key[++i] & 0xff) << 8) |\n ((key[++i] & 0xff) << 16) |\n ((key[++i] & 0xff) << 24);\n ++i;\n\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3: k1 ^= (key[i + 2] & 0xff) << 16;\n case 2: k1 ^= (key[i + 1] & 0xff) << 8;\n case 1: k1 ^= (key[i] & 0xff);\n\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= k1;\n }\n\n h1 ^= key.length;\n\n h1 ^= h1 >>> 16;\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= h1 >>> 13;\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n h1 ^= h1 >>> 16;\n\n return h1 >>> 0;\n }\n\n const murmur = MurmurHashV3;\n murmur.v2 = MurmurHashV2;\n murmur.v3 = MurmurHashV3;\n\n if (typeof(module) != 'undefined') {\n module.exports = murmur;\n } else {\n const _previousRoot = _global.murmur;\n murmur.noConflict = function() {\n _global.murmur = _previousRoot;\n return murmur;\n }\n _global.murmur = murmur;\n }\n}());\n"],"names":["createBuffer","val","TextEncoder","encode","MurmurHashV2","str","seed","l","length","h","i","k","MurmurHashV3","key","remainder","bytes","h1","h1b","c1","c1b","c2","k1","murmur","v2","v3","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
@@ -4,5 +4,5 @@
4
4
  * Copyright(c) 2020-2022 Convert Insights, Inc
5
5
  * License Apache-2.0
6
6
  */
7
- "use strict";var e=require("@convertcom/js-sdk-utils"),r=require("@convertcom/js-sdk-enums");function o(e){var r="function"==typeof Symbol&&Symbol.iterator,o=r&&e[r],t=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}"function"==typeof SuppressedError&&SuppressedError;var t=function(){function t(o,t){var l,n,a,i,s,c=(void 0===t?{}:t).loggerManager;this._comparisonProcessor=e.Comparisons,this._negation="!",this._keys_case_sensitive=true,this._loggerManager=c,this._comparisonProcessor=(null===(l=null==o?void 0:o.rules)||void 0===l?void 0:l.comparisonProcessor)||e.Comparisons,this._negation=String((null===(n=null==o?void 0:o.rules)||void 0===n?void 0:n.negation)||"!"),this._keys_case_sensitive=(null===(a=null==o?void 0:o.rules)||void 0===a?void 0:a.keys_case_sensitive)||true,this._mapper=(null==o?void 0:o.mapper)||function(e){return e},null===(s=null===(i=this._loggerManager)||void 0===i?void 0:i.trace)||void 0===s||s.call(i,"RuleManager()",r.MESSAGES.RULE_CONSTRUCTOR,this)}return Object.defineProperty(t.prototype,"comparisonProcessor",{get:function(){return this._comparisonProcessor},set:function(e){this._comparisonProcessor=e},enumerable:!1,configurable:!0}),t.prototype.getComparisonProcessorMethods=function(){var e=this;return Object.getOwnPropertyNames(this._comparisonProcessor).filter((function(r){return"function"==typeof e._comparisonProcessor[r]}))},t.prototype.isRuleMatched=function(o,t,l){var n,a,i,s,c,u,p,_,g,v,d;if(null===(a=null===(n=this._loggerManager)||void 0===n?void 0:n.trace)||void 0===a||a.call(n,"RuleManager.isRuleMatched()",this._mapper({data:o,ruleSet:t})),l&&(null===(s=null===(i=this._loggerManager)||void 0===i?void 0:i.info)||void 0===s||s.call(i,"RuleManager.isRuleMatched()",r.MESSAGES.PROCESSING_ENTITY.replace("#",l))),Object.prototype.hasOwnProperty.call(t,"OR")&&e.arrayNotEmpty(null==t?void 0:t.OR)){for(var R=0,h=t.OR.length;R<h;R++)if(d=this._processAND(o,t.OR[R]),Object.values(r.RuleError).includes(d)?null===(u=null===(c=this._loggerManager)||void 0===c?void 0:c.info)||void 0===u||u.call(c,"RuleManager.isRuleMatched()",l||"",r.ERROR_MESSAGES.RULE_ERROR):null===(_=null===(p=this._loggerManager)||void 0===p?void 0:p.info)||void 0===_||_.call(p,"RuleManager.isRuleMatched()",l||"",!1===d?r.MESSAGES.RULE_NOT_MATCH:r.MESSAGES.RULE_MATCH.replace("#",String(R))),!1!==d)return d}else null===(v=null===(g=this._loggerManager)||void 0===g?void 0:g.warn)||void 0===v||v.call(g,"RuleManager.isRuleMatched()",l||"",r.ERROR_MESSAGES.RULE_NOT_VALID);return!1},t.prototype.isValidRule=function(e){var r,o;return null===(o=null===(r=this._loggerManager)||void 0===r?void 0:r.trace)||void 0===o||o.call(r,"RuleManager.isValidRule()",this._mapper({rule:e})),Object.prototype.hasOwnProperty.call(e,"matching")&&"object"==typeof e.matching&&Object.prototype.hasOwnProperty.call(e.matching,"match_type")&&"string"==typeof e.matching.match_type&&Object.prototype.hasOwnProperty.call(e.matching,"negated")&&"boolean"==typeof e.matching.negated&&Object.prototype.hasOwnProperty.call(e,"value")},t.prototype._processAND=function(o,t){var l,n,a,i,s;if(Object.prototype.hasOwnProperty.call(t,"AND")&&e.arrayNotEmpty(null==t?void 0:t.AND)){for(var c=0,u=t.AND.length;c<u;c++)if(!1===(s=this._processORWHEN(o,t.AND[c])))return!1;return!1!==s&&(null===(n=null===(l=this._loggerManager)||void 0===l?void 0:l.info)||void 0===n||n.call(l,"RuleManager._processAND()",r.MESSAGES.RULE_MATCH_AND)),s}return null===(i=null===(a=this._loggerManager)||void 0===a?void 0:a.warn)||void 0===i||i.call(a,"RuleManager._processAND()",r.ERROR_MESSAGES.RULE_NOT_VALID),!1},t.prototype._processORWHEN=function(o,t){var l,n,a;if(Object.prototype.hasOwnProperty.call(t,"OR_WHEN")&&e.arrayNotEmpty(null==t?void 0:t.OR_WHEN)){for(var i=0,s=t.OR_WHEN.length;i<s;i++)if(!1!==(a=this._processRuleItem(o,t.OR_WHEN[i])))return a}else null===(n=null===(l=this._loggerManager)||void 0===l?void 0:l.warn)||void 0===n||n.call(l,"RuleManager._processORWHEN()",r.ERROR_MESSAGES.RULE_NOT_VALID);return!1},t.prototype._processRuleItem=function(t,l){var n,a,i,s,c,u,p,_,g,v,d,R,h,y,E,f,M;if(this.isValidRule(l))try{var m=l.matching.negated||!1,O=l.matching.match_type;if(-1!==this.getComparisonProcessorMethods().indexOf(O))if(t&&"object"==typeof t)if(this.isUsingCustomInterface(t)){if(null==l?void 0:l.rule_type){null===(u=null===(c=this._loggerManager)||void 0===c?void 0:c.info)||void 0===u||u.call(c,"RuleManager._processRuleItem()",r.MESSAGES.RULE_MATCH_START.replace("#",l.rule_type));try{for(var S=o(Object.getOwnPropertyNames(t.constructor.prototype)),A=S.next();!A.done;A=S.next()){var N=A.value;if("constructor"!==N){var b=e.camelCase("get ".concat(l.rule_type.replace(/_/g," ")));if(N===b||(null===(p=null==t?void 0:t.mapper)||void 0===p?void 0:p.call(t,N))===b){var P=t[N](l);return Object.values(r.RuleError).includes(P)||"js_condition"===l.rule_type?P:this._comparisonProcessor[O](P,l.value,m)}}}}catch(e){n={error:e}}finally{try{A&&!A.done&&(a=S.return)&&a.call(S)}finally{if(n)throw n.error}}}}else if(e.objectNotEmpty(t))try{for(var w=o(Object.keys(t)),T=w.next();!T.done;T=w.next()){var j=T.value;if((this._keys_case_sensitive?j:j.toLowerCase())===(this._keys_case_sensitive?l.key:String(l.key).toLowerCase()))return this._comparisonProcessor[O](t[j],l.value,m)}}catch(e){i={error:e}}finally{try{T&&!T.done&&(s=w.return)&&s.call(w)}finally{if(i)throw i.error}}else null===(g=null===(_=this._loggerManager)||void 0===_?void 0:_.trace)||void 0===g||g.call(_,"RuleManager._processRuleItem()",{warn:r.ERROR_MESSAGES.RULE_DATA_NOT_VALID,data:t});else null===(d=null===(v=this._loggerManager)||void 0===v?void 0:v.trace)||void 0===d||d.call(v,"RuleManager._processRuleItem()",{warn:r.ERROR_MESSAGES.RULE_NOT_VALID,data:t,rule:l});else null===(h=null===(R=this._loggerManager)||void 0===R?void 0:R.warn)||void 0===h||h.call(R,"RuleManager._processRuleItem()",r.ERROR_MESSAGES.RULE_MATCH_TYPE_NOT_SUPPORTED.replace("#",O))}catch(e){null===(E=null===(y=this._loggerManager)||void 0===y?void 0:y.error)||void 0===E||E.call(y,"RuleManager._processRuleItem()",{error:e.message})}else null===(M=null===(f=this._loggerManager)||void 0===f?void 0:f.warn)||void 0===M||M.call(f,"RuleManager._processRuleItem()",r.ERROR_MESSAGES.RULE_NOT_VALID);return!1},t.prototype.isUsingCustomInterface=function(r){return e.objectNotEmpty(r)&&Object.prototype.hasOwnProperty.call(r,"name")&&"RuleData"===r.name},t}();exports.RuleManager=t;
7
+ "use strict";function e(e){return Array.isArray(e)&&e.length>0}function t(e){return"object"==typeof e&&null!==e&&Object.keys(e).length>0}var o,r,n,a;function i(e){if("number"==typeof e)return!0;const t=parseFloat(String(e));return Number.isFinite(t)&&!isNaN(t)}function s(e){if("number"==typeof e)return e;const t=String(e).split(",");return parseFloat("0"==t[0]?String(e).replace(/,/g,"."):String(e).replace(/,/g,""))}o={exports:{}},function(){const e=e=>(new TextEncoder).encode(e);function t(t,o){let r,n,a,i,s,l,c,u;for("string"==typeof t&&(t=e(t)),r=3&t.length,n=t.length-r,a=o,s=3432918353,l=461845907,u=0;u<n;)c=255&t[u]|(255&t[++u])<<8|(255&t[++u])<<16|(255&t[++u])<<24,++u,c=(65535&c)*s+(((c>>>16)*s&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(65535&c)*l+(((c>>>16)*l&65535)<<16)&4294967295,a^=c,a=a<<13|a>>>19,i=5*(65535&a)+((5*(a>>>16)&65535)<<16)&4294967295,a=27492+(65535&i)+((58964+(i>>>16)&65535)<<16);switch(c=0,r){case 3:c^=(255&t[u+2])<<16;case 2:c^=(255&t[u+1])<<8;case 1:c^=255&t[u],c=(65535&c)*s+(((c>>>16)*s&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(65535&c)*l+(((c>>>16)*l&65535)<<16)&4294967295,a^=c}return a^=t.length,a^=a>>>16,a=2246822507*(65535&a)+((2246822507*(a>>>16)&65535)<<16)&4294967295,a^=a>>>13,a=3266489909*(65535&a)+((3266489909*(a>>>16)&65535)<<16)&4294967295,a^=a>>>16,a>>>0}const r=t;r.v2=function(t,o){"string"==typeof t&&(t=e(t));let r,n=t.length,a=o^n,i=0;for(;n>=4;)r=255&t[i]|(255&t[++i])<<8|(255&t[++i])<<16|(255&t[++i])<<24,r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16),r^=r>>>24,r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^r,n-=4,++i;switch(n){case 3:a^=(255&t[i+2])<<16;case 2:a^=(255&t[i+1])<<8;case 1:a^=255&t[i],a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)}return a^=a>>>13,a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),a^=a>>>15,a>>>0},r.v3=t,o.exports=r}();class l{static equals(e,o,r){return Array.isArray(e)?this._returnNegationCheck(-1!==e.indexOf(o),r):t(e)?this._returnNegationCheck(-1!==Object.keys(e).indexOf(String(o)),r):(e=String(e),o=String(o),e=e.valueOf().toLowerCase(),o=o.valueOf().toLowerCase(),this._returnNegationCheck(e===o,r))}static less(e,t,o){return typeof(e=i(e)?s(e):e)==typeof(t=i(t)?s(t):t)&&this._returnNegationCheck(e<t,o)}static lessEqual(e,t,o){return typeof(e=i(e)?s(e):e)==typeof(t=i(t)?s(t):t)&&this._returnNegationCheck(e<=t,o)}static contains(e,t,o){return e=String(e),t=String(t),e=e.valueOf().toLowerCase(),0===(t=t.valueOf().toLowerCase()).replace(/^([\s]*)|([\s]*)$/g,"").length?this._returnNegationCheck(!0,o):this._returnNegationCheck(-1!==e.indexOf(t),o)}static isIn(e,t,o=!1,r="|"){const n=String(e).split(r).map((e=>String(e)));"string"==typeof t&&(t=t.split(r)),Array.isArray(t)||(t=[]),t=t.map((e=>String(e).valueOf().toLowerCase()));for(let e=0;e<n.length;e++)if(-1!==t.indexOf(n[e]))return this._returnNegationCheck(!0,o);return this._returnNegationCheck(!1,o)}static startsWith(e,t,o){return e=String(e).valueOf().toLowerCase(),t=String(t).valueOf().toLowerCase(),this._returnNegationCheck(0===e.indexOf(t),o)}static endsWith(e,t,o){return e=String(e).valueOf().toLowerCase(),t=String(t).valueOf().toLowerCase(),this._returnNegationCheck(-1!==e.indexOf(t,e.length-t.length),o)}static regexMatches(e,t,o){e=String(e).valueOf().toLowerCase(),t=String(t).valueOf();const r=new RegExp(t,"i");return this._returnNegationCheck(r.test(e),o)}static _returnNegationCheck(e,t=!1){return t?!e:e}}r=l,l.equalsNumber=r.equals,l.matches=r.equals,"function"==typeof SuppressedError&&SuppressedError,function(e){e.VARIAION_NOT_DECIDED="convert.com_variation_not_decided"}(n||(n={})),function(e){e.FORCE_MULTIPLE_TRANSACTIONS="forceMultipleTransactions"}(a||(a={}));const c={SDK_KEY_MISSING:"SDK key is missing",DATA_OBJECT_MISSING:"Data object is missing",CONFIG_DATA_NOT_VALID:"Config Data is not valid",SDK_OR_DATA_OBJECT_REQUIRED:"SDK key or Data object should be provided",RULE_NOT_VALID:"Provided rule is not valid",RULE_DATA_NOT_VALID:"Provided rule data is not valid",RULE_MATCH_TYPE_NOT_SUPPORTED:'Provided rule matching type "#" is not supported',RULE_ERROR:"Rule error",DATA_STORE_NOT_VALID:"DataStore object is not valid. It should contain get and set methods",VISITOR_ID_REQUIRED:"Visitor string string is not present",GOAL_DATA_NOT_VALID:"GoalData object is not valid",UNABLE_TO_SELECT_BUCKET_FOR_VISITOR:"Unable to bucket visitor",UNABLE_TO_PERFORM_NETWORK_REQUEST:"Unable to perform network request",UNSUPPORTED_RESPONSE_TYPE:"Unsupported response type"},u={CONFIG_DATA_UPDATED:"Config Data updated",CORE_CONSTRUCTOR:"Core Manager constructor has been called",CORE_INITIALIZED:"Core Manager has been initialized",EXPERIENCE_CONSTRUCTOR:"Experience Manager constructor has been called",EXPERIENCE_NOT_FOUND:"Experience not found",EXPERIENCE_ARCHIVED:"Experience archived",EXPERIENCE_ENVIRONMENT_NOT_MATCH:"Experience environment does not match",EXPERIENCE_RULES_MATCHED:"Experience rules matched",VARIATIONS_NOT_FOUND:"Variations not found",VARIATION_CHANGE_NOT_SUPPORTED:"Variation change not supported",FEATURE_CONSTRUCTOR:"Feature Manager constructor has been called",FEATURE_NOT_FOUND:"Fullstack Feature not found",FEATURE_VARIABLES_NOT_FOUND:"Fullstack Feature Variables not found",FEATURE_VARIABLES_TYPE_NOT_FOUND:"Fullstack Feature Variables Type not found",BUCKETING_CONSTRUCTOR:"Bucketing Manager constructor has been called",DATA_CONSTRUCTOR:"Data Manager constructor has been called",RULE_CONSTRUCTOR:"Rule Manager constructor has been called",PROCESSING_ENTITY:"Processing #",LOCATION_MATCH:"Location # rule matched",LOCATION_NOT_MATCH:"Location does not match",LOCATION_NOT_RESTRICTED:"Location not restricted",AUDIENCE_MATCH:"Audience # rule matched",AUDIENCE_NOT_MATCH:"Audience does not match",NON_PERMANENT_AUDIENCE_NOT_RESTRICTED:"Non-Permanent Audience not restricted",AUDIENCE_NOT_RESTRICTED:"Audience not restricted",SEGMENTATION_MATCH:"Segmentation # rule matched",SEGMENTATION_NOT_RESTRICTED:"Segmentation not restricted",RULE_NOT_MATCH:"Rule does not match",RULE_MATCH:"Found matched rule at OR block #",RULE_MATCH_AND:"AND block rule macthed",RULE_MATCH_START:"About to evaluate rule #",LOCATION_ACTIVATED:"Location # activated",LOCATION_DEACTIVATED:"Location # deactivated",BUCKETED_VISITOR_FOUND:"Visitor is already bucketed for variation #",BUCKETED_VISITOR_FORCED:"Forcing variation #",BUCKETED_VISITOR:"Visitor is bucketed for variation #",GOAL_NOT_FOUND:"Goal not found",GOAL_RULE_NOT_MATCH:"Goal rule do not match",GOAL_FOUND:"Goal # already triggered",SEGMENTS_NOT_FOUND:"Segments not found",SEGMENTS_RULE_NOT_MATCH:"Segments rule do not match",CUSTOM_SEGMENTS_KEY_FOUND:"Custom segments key already set",SEND_BEACON_SUCCESS:"The user agent successfully queued the data for transfer",RELEASING_QUEUE:"Releasing event queue..."};var d,_,E,R,T,O,g,N,A,p,C,h,I,f,S,v;!function(e){e.OFF="OFF",e.EU_ONLY="EU ONLY",e.EEA_ONLY="EEA ONLY",e.WORLDWIDE="Worldwide"}(d||(d={})),function(e){e.AUDIENCE="audience",e.LOCATION="location",e.SEGMENT="segment",e.FEATURE="feature",e.GOAL="goal",e.EXPERIENCE="experience",e.VARIATION="variation"}(_||(_={})),function(e){e.ENABLED="enabled",e.DISABLED="disabled"}(E||(E={})),function(e){e.AMOUNT="amount",e.PRODUCTS_COUNT="productsCount",e.TRANSACTION_ID="transactionId"}(R||(R={})),function(e){e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(T||(T={})),function(e){e.LOG="log",e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.WARN="warn",e.ERROR="error"}(O||(O={})),function(e){e.WEB="web",e.FULLSTACK="fullstack"}(g||(g={})),function(e){e.NO_DATA_FOUND="convert.com_no_data_found",e.NEED_MORE_DATA="convert.com_need_more_data"}(N||(N={})),function(e){e.READY="ready",e.CONFIG_UPDATED="config.updated",e.API_QUEUE_RELEASED="api.queue.released",e.BUCKETING="bucketing",e.CONVERSION="conversion",e.SEGMENTS="segments",e.LOCATION_ACTIVATED="location.activated",e.LOCATION_DEACTIVATED="location.deactivated",e.AUDIENCES="audiences",e.DATA_STORE_QUEUE_RELEASED="datastore.queue.released"}(A||(A={})),function(e){e.RICH_STRUCTURE="richStructure",e.CUSTOM_CODE="customCode",e.DEFAULT_CODE="defaultCode",e.DEFAULT_CODE_MULTIPAGE="defaultCodeMultipage",e.DEFAULT_REDIRECT="defaultRedirect",e.FULLSTACK_FEATURE="fullStackFeature"}(p||(p={})),function(e){e.IE="IE",e.CH="CH",e.FF="FF",e.OP="OP",e.SF="SF",e.EDG="EDG",e.MO="MO",e.NS="NS",e.OTH="OTH"}(C||(C={})),function(e){e.ALLPH="ALLPH",e.IPH="IPH",e.OTHPH="OTHPH",e.ALLTAB="ALLTAB",e.IPAD="IPAD",e.OTHTAB="OTHTAB",e.DESK="DESK",e.OTHDEV="OTHDEV"}(h||(h={})),function(e){e.COUNTRY="country",e.BROWSER="browser",e.DEVICES="devices",e.SOURCE="source",e.CAMPAIGN="campaign",e.VISITOR_TYPE="visitorType",e.CUSTOM_SEGMENTS="customSegments"}(I||(I={})),function(e){e.CAMPAIGN="campaign",e.SEARCH="search",e.REFERRAL="referral",e.DIRECT="direct"}(f||(f={})),function(e){e.NEW="new",e.RETURNING="returning"}(S||(S={})),function(e){e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired"}(v||(v={}));const D=!0;exports.RuleManager=class{constructor(e,{loggerManager:t}={}){var o,r,n,a,i;this._comparisonProcessor=l,this._negation="!",this._keys_case_sensitive=D,this._loggerManager=t,this._comparisonProcessor=(null===(o=null==e?void 0:e.rules)||void 0===o?void 0:o.comparisonProcessor)||l,this._negation=String((null===(r=null==e?void 0:e.rules)||void 0===r?void 0:r.negation)||"!"),this._keys_case_sensitive=(null===(n=null==e?void 0:e.rules)||void 0===n?void 0:n.keys_case_sensitive)||D,this._mapper=(null==e?void 0:e.mapper)||(e=>e),null===(i=null===(a=this._loggerManager)||void 0===a?void 0:a.trace)||void 0===i||i.call(a,"RuleManager()",u.RULE_CONSTRUCTOR,this)}set comparisonProcessor(e){this._comparisonProcessor=e}get comparisonProcessor(){return this._comparisonProcessor}getComparisonProcessorMethods(){return Object.getOwnPropertyNames(this._comparisonProcessor).filter((e=>"function"==typeof this._comparisonProcessor[e]))}isRuleMatched(t,o,r){var n,a,i,s,l,d,_,E,R,T;let O;if(null===(a=null===(n=this._loggerManager)||void 0===n?void 0:n.trace)||void 0===a||a.call(n,"RuleManager.isRuleMatched()",this._mapper({data:t,ruleSet:o})),r&&(null===(s=null===(i=this._loggerManager)||void 0===i?void 0:i.info)||void 0===s||s.call(i,"RuleManager.isRuleMatched()",u.PROCESSING_ENTITY.replace("#",r))),Object.prototype.hasOwnProperty.call(o,"OR")&&e(null==o?void 0:o.OR)){for(let e=0,n=o.OR.length;e<n;e++){if(O=this._processAND(t,o.OR[e]),!0===O)return O;Object.values(N).includes(O)?null===(d=null===(l=this._loggerManager)||void 0===l?void 0:l.info)||void 0===d||d.call(l,"RuleManager.isRuleMatched()",r||"",c.RULE_ERROR):null===(E=null===(_=this._loggerManager)||void 0===_?void 0:_.info)||void 0===E||E.call(_,"RuleManager.isRuleMatched()",r||"",!1===O?u.RULE_NOT_MATCH:u.RULE_MATCH.replace("#",String(e)))}if(!1!==O)return O}else null===(T=null===(R=this._loggerManager)||void 0===R?void 0:R.warn)||void 0===T||T.call(R,"RuleManager.isRuleMatched()",r||"",c.RULE_NOT_VALID);return!1}isValidRule(e){var t,o;return null===(o=null===(t=this._loggerManager)||void 0===t?void 0:t.trace)||void 0===o||o.call(t,"RuleManager.isValidRule()",this._mapper({rule:e})),Object.prototype.hasOwnProperty.call(e,"matching")&&"object"==typeof e.matching&&Object.prototype.hasOwnProperty.call(e.matching,"match_type")&&"string"==typeof e.matching.match_type&&Object.prototype.hasOwnProperty.call(e.matching,"negated")&&"boolean"==typeof e.matching.negated&&Object.prototype.hasOwnProperty.call(e,"value")}_processAND(t,o){var r,n,a,i;let s;if(Object.prototype.hasOwnProperty.call(o,"AND")&&e(null==o?void 0:o.AND)){for(let e=0,r=o.AND.length;e<r;e++)if(s=this._processORWHEN(t,o.AND[e]),!1===s)return!1;return!1!==s&&(null===(n=null===(r=this._loggerManager)||void 0===r?void 0:r.info)||void 0===n||n.call(r,"RuleManager._processAND()",u.RULE_MATCH_AND)),s}return null===(i=null===(a=this._loggerManager)||void 0===a?void 0:a.warn)||void 0===i||i.call(a,"RuleManager._processAND()",c.RULE_NOT_VALID),!1}_processORWHEN(t,o){var r,n;let a;if(Object.prototype.hasOwnProperty.call(o,"OR_WHEN")&&e(null==o?void 0:o.OR_WHEN)){for(let e=0,r=o.OR_WHEN.length;e<r;e++)if(a=this._processRuleItem(t,o.OR_WHEN[e]),!0===a)return a;if(!1!==a)return a}else null===(n=null===(r=this._loggerManager)||void 0===r?void 0:r.warn)||void 0===n||n.call(r,"RuleManager._processORWHEN()",c.RULE_NOT_VALID);return!1}_processRuleItem(e,o){var r,n,a,i,s,l,d,_,E,R,T,O,g;if(this.isValidRule(o))try{const R=o.matching.negated||!1,T=o.matching.match_type;if(-1!==this.getComparisonProcessorMethods().indexOf(T))if(e&&"object"==typeof e)if(this.isUsingCustomInterface(e)){if(null==o?void 0:o.rule_type){null===(n=null===(r=this._loggerManager)||void 0===r?void 0:r.info)||void 0===n||n.call(r,"RuleManager._processRuleItem()",u.RULE_MATCH_START.replace("#",o.rule_type));for(const t of Object.getOwnPropertyNames(e.constructor.prototype)){if("constructor"===t)continue;const r=`get ${o.rule_type.replace(/_/g," ")}`.replace(/(?:^\w|[A-Z]|\b\w)/g,(function(e,t){return 0===t?e.toLowerCase():e.toUpperCase()})).replace(/\s+/g,"");if(t===r||(null===(a=null==e?void 0:e.mapper)||void 0===a?void 0:a.call(e,t))===r){const r=e[t](o);return Object.values(N).includes(r)||"js_condition"===o.rule_type?r:this._comparisonProcessor[T](r,o.value,R)}}}}else if(t(e))for(const t of Object.keys(e)){const r=this._keys_case_sensitive?t:t.toLowerCase();if(r===(this._keys_case_sensitive?o.key:String(o.key).toLowerCase()))return this._comparisonProcessor[T](e[t],o.value,R)}else null===(s=null===(i=this._loggerManager)||void 0===i?void 0:i.trace)||void 0===s||s.call(i,"RuleManager._processRuleItem()",{warn:c.RULE_DATA_NOT_VALID,data:e});else null===(d=null===(l=this._loggerManager)||void 0===l?void 0:l.trace)||void 0===d||d.call(l,"RuleManager._processRuleItem()",{warn:c.RULE_NOT_VALID,data:e,rule:o});else null===(E=null===(_=this._loggerManager)||void 0===_?void 0:_.warn)||void 0===E||E.call(_,"RuleManager._processRuleItem()",c.RULE_MATCH_TYPE_NOT_SUPPORTED.replace("#",T))}catch(e){null===(T=null===(R=this._loggerManager)||void 0===R?void 0:R.error)||void 0===T||T.call(R,"RuleManager._processRuleItem()",{error:e.message})}else null===(g=null===(O=this._loggerManager)||void 0===O?void 0:O.warn)||void 0===g||g.call(O,"RuleManager._processRuleItem()",c.RULE_NOT_VALID);return!1}isUsingCustomInterface(e){return t(e)&&Object.prototype.hasOwnProperty.call(e,"name")&&"RuleData"===e.name}};
8
8
  //# sourceMappingURL=index.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.min.js","sources":["../../../../node_modules/murmurhash/murmurhash.js"],"sourcesContent":["(function(){\n const _global = this;\n\n const createBuffer = (val) => new TextEncoder().encode(val)\n\n /**\n * JS Implementation of MurmurHash2\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {Uint8Array | string} str ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n function MurmurHashV2(str, seed) {\n if (typeof str === 'string') str = createBuffer(str);\n let\n l = str.length,\n h = seed ^ l,\n i = 0,\n k;\n\n while (l >= 4) {\n k =\n ((str[i] & 0xff)) |\n ((str[++i] & 0xff) << 8) |\n ((str[++i] & 0xff) << 16) |\n ((str[++i] & 0xff) << 24);\n\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n k ^= k >>> 24;\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;\n\n l -= 4;\n ++i;\n }\n\n switch (l) {\n case 3: h ^= (str[i + 2] & 0xff) << 16;\n case 2: h ^= (str[i + 1] & 0xff) << 8;\n case 1: h ^= (str[i] & 0xff);\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n }\n\n h ^= h >>> 13;\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n h ^= h >>> 15;\n\n return h >>> 0;\n };\n\n /*\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {Uint8Array | string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n function MurmurHashV3(key, seed) {\n if (typeof key === 'string') key = createBuffer(key);\n\n let remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i;\n\n remainder = key.length & 3; // key.length % 4\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 0xcc9e2d51;\n c2 = 0x1b873593;\n i = 0;\n\n while (i < bytes) {\n k1 =\n ((key[i] & 0xff)) |\n ((key[++i] & 0xff) << 8) |\n ((key[++i] & 0xff) << 16) |\n ((key[++i] & 0xff) << 24);\n ++i;\n\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3: k1 ^= (key[i + 2] & 0xff) << 16;\n case 2: k1 ^= (key[i + 1] & 0xff) << 8;\n case 1: k1 ^= (key[i] & 0xff);\n\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= k1;\n }\n\n h1 ^= key.length;\n\n h1 ^= h1 >>> 16;\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= h1 >>> 13;\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n h1 ^= h1 >>> 16;\n\n return h1 >>> 0;\n }\n\n const murmur = MurmurHashV3;\n murmur.v2 = MurmurHashV2;\n murmur.v3 = MurmurHashV3;\n\n if (typeof(module) != 'undefined') {\n module.exports = murmur;\n } else {\n const _previousRoot = _global.murmur;\n murmur.noConflict = function() {\n _global.murmur = _previousRoot;\n return murmur;\n }\n _global.murmur = murmur;\n }\n}());\n"],"names":["createBuffer","val","TextEncoder","encode","MurmurHashV3","key","seed","remainder","bytes","h1","h1b","c1","c2","k1","i","length","murmur","v2","str","k","l","h","v3","module","exports"],"mappings":";;;;;;kbAAC,WAGC,MAAMA,EAAgBC,IAAQ,IAAIC,aAAcC,OAAOF,GAiEvD,SAASG,EAAaC,EAAKC,GAGzB,IAAIC,EAAWC,EAAOC,EAAIC,EAAKC,EAASC,EAASC,EAAIC,EASrD,IAXmB,iBAART,IAAkBA,EAAML,EAAaK,IAIhDE,EAAyB,EAAbF,EAAIU,OAChBP,EAAQH,EAAIU,OAASR,EACrBE,EAAKH,EACLK,EAAK,WACLC,EAAK,UACLE,EAAI,EAEGA,EAAIN,GACPK,EACa,IAATR,EAAIS,IACO,IAAXT,IAAMS,KAAc,GACT,IAAXT,IAAMS,KAAc,IACT,IAAXT,IAAMS,KAAc,KACxBA,EAEFD,GAAc,MAALA,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C,YAAZA,IAAM,IAAoB,QAAW,IAC5EA,GAAKA,IAAM,GACXA,EAAqB,YAAV,MAAJA,KAA4C,YAAZA,IAAM,IAAoB,QAAW,IAE9EE,EAAqB,YAAV,MAAJA,KAA4C,YAAZA,IAAM,IAAoB,QAAW,IAAOF,EAEjFC,GAAK,IACHN,EAGJ,OAAQM,GACR,KAAK,EAAGC,IAAmB,IAAbH,EAAIJ,EAAI,KAAc,GACpC,KAAK,EAAGO,IAAmB,IAAbH,EAAIJ,EAAI,KAAc,EACpC,KAAK,EAAGO,GAAe,IAATH,EAAIJ,GACVO,EAAqB,YAAV,MAAJA,KAA4C,YAAZA,IAAM,IAAoB,QAAW,IAOpF,OAJAA,GAAKA,IAAM,GACXA,EAAqB,YAAV,MAAJA,KAA4C,YAAZA,IAAM,IAAoB,QAAW,IAC5EA,GAAKA,IAAM,GAEJA,IAAM,CACjB,EAsEEL,EAAOM,GAAKlB,EAGVmB,EAAAC,QAAiBR,CASpB,CAxIA","x_google_ignoreList":[0]}
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Convert JS SDK test
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export { LogManager } from './src/log-manager';
8
+ export { LogManagerInterface } from './src/interfaces/log-manager';
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { LogLevel } from '../../../enums';
8
+ import { LogMethodMapInterface } from './log-method-map';
9
+ export interface LogClientInterface {
10
+ sdk: any;
11
+ level: LogLevel;
12
+ mapper: LogMethodMapInterface;
13
+ }
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { LogLevel } from '../../../enums';
8
+ import { LogMethodMapInterface } from './log-method-map';
9
+ export interface LogManagerInterface {
10
+ log(level: LogLevel, ...args: any[]): void;
11
+ trace(...args: any[]): void;
12
+ debug(...args: any[]): void;
13
+ info(...args: any[]): void;
14
+ warn(...args: any[]): void;
15
+ error(...args: any[]): void;
16
+ addClient(client?: any, level?: LogLevel, methodMap?: LogMethodMapInterface): void;
17
+ setClientLevel(level: LogLevel, client?: any): void;
18
+ }
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { LogMethod } from '../../../enums';
8
+ export interface LogMethodMapInterface {
9
+ [LogMethod.LOG]?: string;
10
+ [LogMethod.DEBUG]?: string;
11
+ [LogMethod.INFO]?: string;
12
+ [LogMethod.WARN]?: string;
13
+ [LogMethod.ERROR]?: string;
14
+ [LogMethod.TRACE]?: string;
15
+ }
@@ -0,0 +1,64 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { LogLevel } from '../../enums';
8
+ import { LogMethodMapInterface } from './interfaces/log-method-map';
9
+ import { LogManagerInterface } from './interfaces/log-manager';
10
+ /**
11
+ * Provides logging logic
12
+ * @category Modules
13
+ * @constructor
14
+ * @implements {LogManagerInterface}
15
+ */
16
+ export declare class LogManager implements LogManagerInterface {
17
+ private _clients;
18
+ private _defaultMapper;
19
+ /**
20
+ * @param {any} client
21
+ * @param {LogLevel=} level
22
+ * @param {LogMethodMapInterface=} mapper
23
+ */
24
+ constructor(client?: any, level?: LogLevel, mapper?: LogMethodMapInterface);
25
+ private _isValidLevel;
26
+ private _isValidMethod;
27
+ private _log;
28
+ /**
29
+ * @param {LogLevel} level
30
+ * @param {Array<any>} args
31
+ */
32
+ log(level: LogLevel, ...args: any[]): void;
33
+ /**
34
+ * @param {Array<any>} args
35
+ */
36
+ trace(...args: any[]): void;
37
+ /**
38
+ * @param {Array<any>} args
39
+ */
40
+ debug(...args: any[]): void;
41
+ /**
42
+ * @param {Array<any>} args
43
+ */
44
+ info(...args: any[]): void;
45
+ /**
46
+ * @param {Array<any>} args
47
+ */
48
+ warn(...args: any[]): void;
49
+ /**
50
+ * @param {Array<any>} args
51
+ */
52
+ error(...args: any[]): void;
53
+ /**
54
+ * @param {any=} client
55
+ * @param {LogLevel=} level
56
+ * @param {LogMethodMapInterface=} methodMap
57
+ */
58
+ addClient(client?: any, level?: LogLevel, methodMap?: LogMethodMapInterface): void;
59
+ /**
60
+ * @param {LogLevel=} level
61
+ * @param {any=} client
62
+ */
63
+ setClientLevel(level: LogLevel, client?: any): void;
64
+ }
package/lib/package.json CHANGED
@@ -14,11 +14,11 @@
14
14
  "directory": "packages/rules"
15
15
  },
16
16
  "license": "Apache-2.0",
17
- "dependencies": {
18
- "@convertcom/js-sdk-enums": ">=1.0.0",
19
- "@convertcom/js-sdk-logger": ">=1.0.0",
20
- "@convertcom/js-sdk-types": ">=1.0.0",
21
- "@convertcom/js-sdk-utils": ">=1.0.0"
17
+ "peerDependencies": {
18
+ "@convertcom/js-sdk-enums": ">=2.2.1",
19
+ "@convertcom/js-sdk-logger": ">=2.1.1",
20
+ "@convertcom/js-sdk-types": ">=3.8.1",
21
+ "@convertcom/js-sdk-utils": ">=2.2.2"
22
22
  },
23
- "version": "2.0.0"
23
+ "version": "2.1.2"
24
24
  }
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Convert JS SDK test
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export { RuleManager } from './src/rule-manager';
8
+ export { RuleManagerInterface } from './src/interfaces/rule-manager';
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { RuleElement, RuleObject } from '../../../types';
8
+ import { RuleError } from '../../../enums';
9
+ export interface RuleManagerInterface {
10
+ comparisonProcessor: Record<string, any>;
11
+ getComparisonProcessorMethods(): Array<string>;
12
+ isRuleMatched(data: Record<string, any>, ruleSet: RuleObject, logEntry?: string): boolean | RuleError;
13
+ isValidRule(rule: RuleElement): boolean;
14
+ isUsingCustomInterface(data: Record<string, any>): boolean;
15
+ }
@@ -0,0 +1,82 @@
1
+ import { RuleManagerInterface } from './interfaces/rule-manager';
2
+ import { Config, RuleElement, RuleObject } from '../../types';
3
+ import { LogManagerInterface } from '../../logger';
4
+ import { RuleError } from '../../enums';
5
+ /**
6
+ * Provides rule processing calculations with corresponding comparisons methods
7
+ * @category Modules
8
+ * @constructor
9
+ * @implements {RuleManagerInterface}
10
+ */
11
+ export declare class RuleManager implements RuleManagerInterface {
12
+ private _comparisonProcessor;
13
+ private readonly _negation;
14
+ private readonly _keys_case_sensitive;
15
+ private _loggerManager;
16
+ private _mapper;
17
+ /**
18
+ * @param {Config=} config
19
+ * @param {Object=} dependencies
20
+ * @param {LogManagerInterface=} dependencies.loggerManager
21
+ */
22
+ constructor(config?: Config, { loggerManager }?: {
23
+ loggerManager?: LogManagerInterface;
24
+ });
25
+ /**
26
+ * Setter for comparison processor
27
+ * @param {Record<string, any>} comparisonProcessor
28
+ */
29
+ set comparisonProcessor(comparisonProcessor: Record<string, any>);
30
+ /**
31
+ * Getter for comparison processor
32
+ */
33
+ get comparisonProcessor(): Record<string, any>;
34
+ /**
35
+ * Retrieve comparison methods from comparison processor
36
+ * @return {Array<string>} List of methods of comparison processor
37
+ */
38
+ getComparisonProcessorMethods(): Array<string>;
39
+ /**
40
+ * Check input data matching to rule set
41
+ * @param {Record<string, any>} data Single value or key-value data set to compare
42
+ * @param {RuleObject} ruleSet
43
+ * @return {boolean | RuleError}
44
+ */
45
+ isRuleMatched(data: Record<string, any>, ruleSet: RuleObject, logEntry?: string): boolean | RuleError;
46
+ /**
47
+ * Check is rule object valid
48
+ * @param {RuleElement} rule
49
+ * @return {boolean}
50
+ */
51
+ isValidRule(rule: RuleElement): boolean;
52
+ /**
53
+ * Process AND block of rule set. Return first false if found
54
+ * @param {Record<string, any>} data Single value or key-value data set to compare
55
+ * @param {RuleAnd} rulesSubset
56
+ * @return {boolean | RuleError}
57
+ * @private
58
+ */
59
+ private _processAND;
60
+ /**
61
+ * Process OR block of rule set. Return first true if found
62
+ * @param {Record<string, any>} data Single value or key-value data set to compare
63
+ * @param {RuleOrWhen} rulesSubset
64
+ * @return {boolean | RuleError}
65
+ * @private
66
+ */
67
+ private _processORWHEN;
68
+ /**
69
+ * Process single rule item
70
+ * @param {Record<string, any>} data Single value or key-value data set to compare
71
+ * @param {RuleElement} rule A single rule to compare
72
+ * @return {boolean | RuleError} Comparison result
73
+ * @private
74
+ */
75
+ private _processRuleItem;
76
+ /**
77
+ * Check is rule data object is a custom interface instead of a literal object
78
+ * @param {Record<string, any>} data Single value or key-value data set to compare
79
+ * @return {boolean}
80
+ */
81
+ isUsingCustomInterface(data: Record<string, any>): boolean;
82
+ }
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Convert JS SDK test
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export * from './src/config/index';
8
+ export * from './src/BucketedFeature';
9
+ export * from './src/BucketedVariation';
10
+ export * from './src/BucketingAttributes';
11
+ export * from './src/BucketingAllocation';
12
+ export * from './src/BucketingHash';
13
+ export * from './src/Config';
14
+ export * from './src/ConversionAttributes';
15
+ export * from './src/Entity';
16
+ export * from './src/GoalData';
17
+ export * from './src/IndentityField';
18
+ export * from './src/Integration';
19
+ export * from './src/LocationAttributes';
20
+ export * from './src/Path';
21
+ export * from './src/RequireAtLeastOne';
22
+ export * from './src/Rule';
23
+ export * from './src/SegmentsAttributes';
24
+ export * from './src/StoreData';
25
+ export * from './src/TrackingEvent';
26
+ export * from './src/VariableType';
27
+ export * from './src/VisitorsQueue';
28
+ export * from './src/Visitor';
@@ -0,0 +1,29 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { FeatureStatus } from '../../enums';
8
+ import { RequireAtLeastOne } from './RequireAtLeastOne';
9
+ type NotEnabledFeature = RequireAtLeastOne<{
10
+ experienceId?: string;
11
+ experienceKey?: string;
12
+ experienceName?: string;
13
+ id?: string;
14
+ key?: string;
15
+ name?: string;
16
+ status: FeatureStatus.DISABLED;
17
+ variables?: Record<string, any>;
18
+ }, 'id' | 'key'>;
19
+ export type BucketedFeature = {
20
+ experienceId?: string;
21
+ experienceKey?: string;
22
+ experienceName?: string;
23
+ id?: string;
24
+ key?: string;
25
+ name?: string;
26
+ status: FeatureStatus;
27
+ variables?: Record<string, any>;
28
+ } | NotEnabledFeature;
29
+ export {};
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { ExperienceVariationConfig } from './config/index';
8
+ export type BucketedVariation = ExperienceVariationConfig & {
9
+ experienceId?: string;
10
+ experienceKey?: string;
11
+ experienceName?: string;
12
+ bucketingAllocation?: number;
13
+ };
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export type BucketingAllocation = {
8
+ variationId?: string;
9
+ bucketingAllocation?: number;
10
+ };
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export type BucketingAttributes = {
8
+ environment?: string;
9
+ locationProperties?: Record<any, any>;
10
+ visitorProperties?: Record<any, any>;
11
+ typeCasting?: boolean;
12
+ experienceKeys?: Array<string>;
13
+ updateVisitorProperties?: boolean;
14
+ forceVariationId?: string;
15
+ enableTracking?: boolean;
16
+ ignoreLocationProperties?: boolean;
17
+ };
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export type BucketingHash = {
8
+ redistribute?: number;
9
+ seed?: number;
10
+ experienceId?: string;
11
+ };
@@ -0,0 +1,60 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { ConfigResponseData } from './config/index';
8
+ import { LogLevel } from '../../enums';
9
+ export * from './config/index';
10
+ type ConfigBase = {
11
+ environment: string;
12
+ api?: {
13
+ endpoint?: {
14
+ config?: string;
15
+ track?: string;
16
+ };
17
+ };
18
+ bucketing?: {
19
+ hash_seed?: number;
20
+ max_traffic?: number;
21
+ excludeExperienceIdHash?: boolean;
22
+ };
23
+ dataStore?: object | null;
24
+ dataRefreshInterval?: number;
25
+ events?: {
26
+ batch_size?: number;
27
+ release_interval?: number;
28
+ };
29
+ rules?: {
30
+ comparisonProcessor?: Record<string, any>;
31
+ negation?: string;
32
+ keys_case_sensitive?: boolean;
33
+ };
34
+ logger?: {
35
+ logLevel?: LogLevel;
36
+ file?: {
37
+ enabled?: boolean;
38
+ path?: string;
39
+ logLevel?: LogLevel;
40
+ };
41
+ customLoggers?: Array<Record<string, any>>;
42
+ };
43
+ network?: {
44
+ tracking?: boolean;
45
+ cacheLevel?: string;
46
+ source?: string;
47
+ };
48
+ mapper?: (...args: any) => any;
49
+ };
50
+ type ConfigWithSdkKey = ConfigBase & {
51
+ sdkKey: string;
52
+ sdkKeySecret?: string;
53
+ data?: never;
54
+ };
55
+ type ConfigWithData = ConfigBase & {
56
+ data: ConfigResponseData;
57
+ sdkKey?: never;
58
+ sdkKeySecret?: never;
59
+ };
60
+ export type Config = ConfigWithSdkKey | ConfigWithData;
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { ConversionSettingKey } from '../../enums';
8
+ import { GoalData } from './GoalData';
9
+ export type ConversionAttributes = {
10
+ ruleData?: Record<string, any>;
11
+ conversionData?: Array<GoalData>;
12
+ conversionSetting?: Record<ConversionSettingKey, number | string | boolean>;
13
+ };
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { ConfigAudience, ConfigExperience, ConfigFeature, ConfigGoal, ConfigLocation, ConfigSegment, ExperienceVariationConfig } from './config/index';
8
+ export type Entity = ConfigExperience | ConfigFeature | ConfigAudience | ConfigLocation | ConfigSegment | ConfigGoal | ExperienceVariationConfig;
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { GoalDataKey } from '../../enums';
8
+ export type GoalData = {
9
+ key?: `${GoalDataKey}`;
10
+ value?: number | string;
11
+ };
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export type IdentityField = 'id' | 'key';
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { ExperienceIntegrationBaidu, ExperienceIntegrationClicktale, ExperienceIntegrationClicky, ExperienceIntegrationCnzz, ExperienceIntegrationCrazyegg, ExperienceIntegrationEconda, ExperienceIntegrationEulerian, ExperienceIntegrationGAServing, ExperienceIntegrationGosquared, ExperienceIntegrationHeapanalytics, ExperienceIntegrationHotjar, ExperienceIntegrationMixpanel, ExperienceIntegrationMouseflow, ExperienceIntegrationPiwik, ExperienceIntegrationSegmentio, ExperienceIntegrationSitecatalyst, ExperienceIntegrationWoopra, ExperienceIntegrationYsance } from './config/index';
8
+ export type Integration = ExperienceIntegrationBaidu | ExperienceIntegrationClicktale | ExperienceIntegrationClicky | ExperienceIntegrationCnzz | ExperienceIntegrationCrazyegg | ExperienceIntegrationEconda | ExperienceIntegrationEulerian | ExperienceIntegrationGAServing | ExperienceIntegrationGosquared | ExperienceIntegrationHeapanalytics | ExperienceIntegrationHotjar | ExperienceIntegrationMixpanel | ExperienceIntegrationMouseflow | ExperienceIntegrationPiwik | ExperienceIntegrationSegmentio | ExperienceIntegrationSitecatalyst | ExperienceIntegrationWoopra | ExperienceIntegrationYsance;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ import { IdentityField } from './IndentityField';
8
+ export type LocationAttributes = {
9
+ locationProperties?: Record<any, any>;
10
+ identityField?: IdentityField;
11
+ forceEvent?: boolean;
12
+ };
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Convert JS SDK
3
+ * Version 1.0.0
4
+ * Copyright(c) 2020 Convert Insights, Inc
5
+ * License Apache-2.0
6
+ */
7
+ export type Path = {
8
+ base: string;
9
+ route: string;
10
+ };
@@ -0,0 +1,3 @@
1
+ export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
2
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
3
+ }[Keys];