@convertcom/js-sdk-rules 1.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/enums/index.d.ts +26 -0
- package/lib/enums/src/bucketing-error.d.ts +9 -0
- package/lib/enums/src/conversion-setting-key.d.ts +9 -0
- package/lib/enums/src/data-enitites.d.ts +16 -0
- package/lib/enums/src/dictionary.d.ts +65 -0
- package/lib/enums/src/do-not-track.d.ts +12 -0
- package/lib/enums/src/entity-type.d.ts +15 -0
- package/lib/enums/src/feature-status.d.ts +10 -0
- package/lib/enums/src/goal-data-key.d.ts +11 -0
- package/lib/enums/src/log-level.d.ts +14 -0
- package/lib/enums/src/log-method.d.ts +14 -0
- package/lib/enums/src/project-type.d.ts +10 -0
- package/lib/enums/src/rule-error.d.ts +10 -0
- package/lib/enums/src/segments/browser-type.d.ts +17 -0
- package/lib/enums/src/segments/device-type.d.ts +16 -0
- package/lib/enums/src/segments/segments-keys.d.ts +15 -0
- package/lib/enums/src/segments/source-type.d.ts +12 -0
- package/lib/enums/src/segments/visitor-type.d.ts +10 -0
- package/lib/enums/src/system-events.d.ts +22 -0
- package/lib/enums/src/variable-types.d.ts +7 -0
- package/lib/enums/src/variation-change-type.d.ts +14 -0
- package/lib/index.d.ts +10 -10
- package/lib/index.js +731 -33
- package/lib/index.js.map +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.map +1 -1
- package/lib/index.min.mjs +1 -1
- package/lib/index.min.mjs.map +1 -1
- package/lib/index.mjs +707 -9
- package/lib/index.mjs.map +1 -1
- package/lib/legacy/index.js +759 -140
- package/lib/legacy/index.js.map +1 -1
- package/lib/legacy/index.min.js +1 -1
- package/lib/legacy/index.min.js.map +1 -1
- package/lib/logger/index.d.ts +8 -0
- package/lib/logger/src/interfaces/log-client.d.ts +13 -0
- package/lib/logger/src/interfaces/log-manager.d.ts +18 -0
- package/lib/logger/src/interfaces/log-method-map.d.ts +15 -0
- package/lib/logger/src/log-manager.d.ts +64 -0
- package/lib/package.json +6 -6
- package/lib/rules/index.d.ts +8 -0
- package/lib/rules/src/interfaces/rule-manager.d.ts +14 -0
- package/lib/rules/src/rule-manager.d.ts +82 -0
- package/lib/types/index.d.ts +27 -0
- package/lib/types/src/BucketedFeature.d.ts +29 -0
- package/lib/types/src/BucketedVariation.d.ts +13 -0
- package/lib/types/src/BucketingAllocation.d.ts +10 -0
- package/lib/types/src/BucketingAttributes.d.ts +17 -0
- package/lib/types/src/BucketingHash.d.ts +11 -0
- package/lib/types/src/Config.d.ts +60 -0
- package/lib/types/src/ConversionAttributes.d.ts +13 -0
- package/lib/types/src/Entity.d.ts +8 -0
- package/lib/types/src/GoalData.d.ts +11 -0
- package/lib/types/src/IndentityField.d.ts +7 -0
- package/lib/types/src/Integration.d.ts +8 -0
- package/lib/types/src/LocationAttributes.d.ts +12 -0
- package/lib/types/src/Path.d.ts +10 -0
- package/lib/types/src/RequireAtLeastOne.d.ts +3 -0
- package/lib/types/src/Rule.d.ts +13 -0
- package/lib/types/src/SegmentsAttributes.d.ts +9 -0
- package/lib/types/src/StoreData.d.ts +13 -0
- package/lib/types/src/TrackingEvent.d.ts +14 -0
- package/lib/types/src/VariableType.d.ts +8 -0
- package/lib/types/src/Visitor.d.ts +12 -0
- package/lib/types/src/VisitorsQueue.d.ts +14 -0
- package/lib/types/src/config/index.d.ts +192 -0
- package/lib/types/src/config/models/Base64Image.d.ts +6 -0
- package/lib/types/src/config/models/BaseMatch.d.ts +8 -0
- package/lib/types/src/config/models/BaseRule.d.ts +6 -0
- package/lib/types/src/config/models/BaseRuleWithBooleanValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithBrowserNameValue.d.ts +21 -0
- package/lib/types/src/config/models/BaseRuleWithCountryCodeValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithDayOfWeekValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithExperienceBucketedValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithGoalTriggeredValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithHourOfDayValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithJsCodeValue.d.ts +9 -0
- package/lib/types/src/config/models/BaseRuleWithLanguageCodeValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithMinuteOfHourValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithNumericValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithOsValue.d.ts +21 -0
- package/lib/types/src/config/models/BaseRuleWithSegmentBucketedValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithStringValue.d.ts +7 -0
- package/lib/types/src/config/models/BaseRuleWithVisitorTypeValue.d.ts +16 -0
- package/lib/types/src/config/models/BaseRuleWithWeatherConditionValue.d.ts +34 -0
- package/lib/types/src/config/models/BoolMatchRulesTypes.d.ts +6 -0
- package/lib/types/src/config/models/BrowserNameMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/BrowserNameMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/BucketingEvent.d.ts +15 -0
- package/lib/types/src/config/models/ChoiceContainsOptions.d.ts +3 -0
- package/lib/types/src/config/models/ChoiceMatchingOptions.d.ts +3 -0
- package/lib/types/src/config/models/ClicksElementGoal.d.ts +11 -0
- package/lib/types/src/config/models/ClicksElementGoalSettings.d.ts +6 -0
- package/lib/types/src/config/models/ClicksLinkGoal.d.ts +11 -0
- package/lib/types/src/config/models/ClicksLinkGoalSettings.d.ts +6 -0
- package/lib/types/src/config/models/ConfigAudience.d.ts +21 -0
- package/lib/types/src/config/models/ConfigAudienceTypes.d.ts +10 -0
- package/lib/types/src/config/models/ConfigExperience.d.ts +98 -0
- package/lib/types/src/config/models/ConfigFeature.d.ts +22 -0
- package/lib/types/src/config/models/ConfigGoal.d.ts +9 -0
- package/lib/types/src/config/models/ConfigGoalBase.d.ts +24 -0
- package/lib/types/src/config/models/ConfigLocation.d.ts +21 -0
- package/lib/types/src/config/models/ConfigProject.d.ts +151 -0
- package/lib/types/src/config/models/ConfigResponseData.d.ts +45 -0
- package/lib/types/src/config/models/ConfigSegment.d.ts +19 -0
- package/lib/types/src/config/models/ConversionEvent.d.ts +30 -0
- package/lib/types/src/config/models/CookieMatchRule.d.ts +14 -0
- package/lib/types/src/config/models/CookieMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/CountryMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/CountryMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/DayOfWeekMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/DayOfWeekMatchRulesTypes.d.ts +4 -0
- package/lib/types/src/config/models/DomInteractionGoal.d.ts +11 -0
- package/lib/types/src/config/models/DomInteractionGoalSettings.d.ts +15 -0
- package/lib/types/src/config/models/ErrorData.d.ts +5 -0
- package/lib/types/src/config/models/ExperienceBucketedMatchRule.d.ts +9 -0
- package/lib/types/src/config/models/ExperienceChange.d.ts +10 -0
- package/lib/types/src/config/models/ExperienceChangeAdd.d.ts +10 -0
- package/lib/types/src/config/models/ExperienceChangeBase.d.ts +27 -0
- package/lib/types/src/config/models/ExperienceChangeCustomCodeData.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeCustomCodeDataAdd.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeCustomCodeDataBase.d.ts +29 -0
- package/lib/types/src/config/models/ExperienceChangeCustomCodeDataUpdate.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeCustomCodeDataUpdateNoId.d.ts +5 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeData.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeDataAdd.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeDataBase.d.ts +29 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeDataUpdate.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeDataUpdateNoId.d.ts +5 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeMultipageData.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeMultipageDataAdd.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeMultipageDataBase.d.ts +33 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeMultipageDataUpdate.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultCodeMultipageDataUpdateNoId.d.ts +5 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultRedirectData.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultRedirectDataAdd.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultRedirectDataBase.d.ts +29 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultRedirectDataUpdate.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeDefaultRedirectDataUpdateNoId.d.ts +5 -0
- package/lib/types/src/config/models/ExperienceChangeFullStackFeature.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeFullStackFeatureAdd.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeFullStackFeatureBase.d.ts +25 -0
- package/lib/types/src/config/models/ExperienceChangeFullStackFeatureUpdate.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeFullStackFeatureUpdateNoId.d.ts +5 -0
- package/lib/types/src/config/models/ExperienceChangeId.d.ts +9 -0
- package/lib/types/src/config/models/ExperienceChangeIdReadOnly.d.ts +9 -0
- package/lib/types/src/config/models/ExperienceChangeRichStructureData.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeRichStructureDataAdd.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeRichStructureDataBase.d.ts +16 -0
- package/lib/types/src/config/models/ExperienceChangeRichStructureDataUpdate.d.ts +6 -0
- package/lib/types/src/config/models/ExperienceChangeRichStructureDataUpdateNoId.d.ts +5 -0
- package/lib/types/src/config/models/ExperienceChangeUpdate.d.ts +10 -0
- package/lib/types/src/config/models/ExperienceChangeUpdateNoId.d.ts +10 -0
- package/lib/types/src/config/models/ExperienceIntegrationBaidu.d.ts +7 -0
- package/lib/types/src/config/models/ExperienceIntegrationBase.d.ts +10 -0
- package/lib/types/src/config/models/ExperienceIntegrationClicktale.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationClicky.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationCnzz.d.ts +7 -0
- package/lib/types/src/config/models/ExperienceIntegrationCrazyegg.d.ts +9 -0
- package/lib/types/src/config/models/ExperienceIntegrationEconda.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationEulerian.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationGA3.d.ts +9 -0
- package/lib/types/src/config/models/ExperienceIntegrationGA4.d.ts +8 -0
- package/lib/types/src/config/models/ExperienceIntegrationGA4Base.d.ts +4 -0
- package/lib/types/src/config/models/ExperienceIntegrationGAServing.d.ts +3 -0
- package/lib/types/src/config/models/ExperienceIntegrationGoogleAnalytics.d.ts +3 -0
- package/lib/types/src/config/models/ExperienceIntegrationGosquared.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationHeapanalytics.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationHotjar.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationMixpanel.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationMouseflow.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationPiwik.d.ts +7 -0
- package/lib/types/src/config/models/ExperienceIntegrationSegmentio.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationSitecatalyst.d.ts +7 -0
- package/lib/types/src/config/models/ExperienceIntegrationWoopra.d.ts +2 -0
- package/lib/types/src/config/models/ExperienceIntegrationYsance.d.ts +7 -0
- package/lib/types/src/config/models/ExperienceTypes.d.ts +8 -0
- package/lib/types/src/config/models/ExperienceVariationConfig.d.ts +30 -0
- package/lib/types/src/config/models/Extra.d.ts +4 -0
- package/lib/types/src/config/models/FeatureVariableItemData.d.ts +25 -0
- package/lib/types/src/config/models/GA_Settings.d.ts +3 -0
- package/lib/types/src/config/models/GA_SettingsBase.d.ts +6 -0
- package/lib/types/src/config/models/GaGoal.d.ts +11 -0
- package/lib/types/src/config/models/GaGoalSettings.d.ts +6 -0
- package/lib/types/src/config/models/GenericBoolKeyValueMatchRule.d.ts +11 -0
- package/lib/types/src/config/models/GenericBoolKeyValueMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/GenericBoolMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/GenericKey.d.ts +6 -0
- package/lib/types/src/config/models/GenericNumericKeyValueMatchRule.d.ts +11 -0
- package/lib/types/src/config/models/GenericNumericKeyValueMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/GenericNumericMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/GenericSetMatchRule.d.ts +9 -0
- package/lib/types/src/config/models/GenericTextKeyValueMatchRule.d.ts +11 -0
- package/lib/types/src/config/models/GenericTextKeyValueMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/GenericTextMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/GoalTriggeredMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/GoalTriggeredMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/GoalTypes.d.ts +10 -0
- package/lib/types/src/config/models/HourOfDayMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/HourOfDayMatchRulesTypes.d.ts +4 -0
- package/lib/types/src/config/models/IntegrationGA3.d.ts +12 -0
- package/lib/types/src/config/models/IntegrationGA4.d.ts +7 -0
- package/lib/types/src/config/models/IntegrationGA4Base.d.ts +12 -0
- package/lib/types/src/config/models/IntegrationProvider.d.ts +23 -0
- package/lib/types/src/config/models/JsConditionMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/JsConditionMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/KeyValueMatchRulesTypes.d.ts +4 -0
- package/lib/types/src/config/models/LanguageMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/LanguageMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/LocationTrigger.d.ts +5 -0
- package/lib/types/src/config/models/LocationTriggerBase.d.ts +14 -0
- package/lib/types/src/config/models/LocationTriggerCallback.d.ts +13 -0
- package/lib/types/src/config/models/LocationTriggerDomChange.d.ts +17 -0
- package/lib/types/src/config/models/LocationTriggerManual.d.ts +9 -0
- package/lib/types/src/config/models/LocationTriggerUrlChange.d.ts +9 -0
- package/lib/types/src/config/models/MinuteOfHourMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/MinuteOfHourMatchRulesTypes.d.ts +4 -0
- package/lib/types/src/config/models/NoSettingsGoal.d.ts +11 -0
- package/lib/types/src/config/models/NumericMatchRulesTypes.d.ts +8 -0
- package/lib/types/src/config/models/NumericMatchingOptions.d.ts +5 -0
- package/lib/types/src/config/models/OnlyCount.d.ts +7 -0
- package/lib/types/src/config/models/OsMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/OsMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/PageNumber.d.ts +9 -0
- package/lib/types/src/config/models/Pagination.d.ts +18 -0
- package/lib/types/src/config/models/ProjectGASettingsBase.d.ts +7 -0
- package/lib/types/src/config/models/ProjectIntegrationGA3.d.ts +3 -0
- package/lib/types/src/config/models/ProjectIntegrationGA4.d.ts +8 -0
- package/lib/types/src/config/models/ResultsPerPage.d.ts +10 -0
- package/lib/types/src/config/models/RevenueGoal.d.ts +11 -0
- package/lib/types/src/config/models/RevenueGoalSettings.d.ts +25 -0
- package/lib/types/src/config/models/RuleElement.d.ts +20 -0
- package/lib/types/src/config/models/RuleElementNoUrl.d.ts +20 -0
- package/lib/types/src/config/models/RuleObject.d.ts +20 -0
- package/lib/types/src/config/models/RuleObjectNoUrl.d.ts +20 -0
- package/lib/types/src/config/models/RulesTypes.d.ts +17 -0
- package/lib/types/src/config/models/ScrollPercentageGoal.d.ts +11 -0
- package/lib/types/src/config/models/ScrollPercentageGoalSettings.d.ts +6 -0
- package/lib/types/src/config/models/SegmentBucketedMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/SegmentBucketedMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/SendTrackingEventsRequestData.d.ts +39 -0
- package/lib/types/src/config/models/SetMatchingOptions.d.ts +3 -0
- package/lib/types/src/config/models/SortDirection.d.ts +21 -0
- package/lib/types/src/config/models/SubmitsFormGoal.d.ts +11 -0
- package/lib/types/src/config/models/SubmitsFormGoalSettings.d.ts +6 -0
- package/lib/types/src/config/models/SuccessData.d.ts +4 -0
- package/lib/types/src/config/models/TextMatchRulesTypes.d.ts +23 -0
- package/lib/types/src/config/models/TextMatchingOptions.d.ts +7 -0
- package/lib/types/src/config/models/UTC_Offset.d.ts +4 -0
- package/lib/types/src/config/models/UpdateExperienceChangeRequestData.d.ts +2 -0
- package/lib/types/src/config/models/VariationStatuses.d.ts +7 -0
- package/lib/types/src/config/models/VisitorSegments.d.ts +78 -0
- package/lib/types/src/config/models/VisitorTrackingEvents.d.ts +21 -0
- package/lib/types/src/config/models/VisitorTypeMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/VisitorTypeMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/WeatherConditionMatchRule.d.ts +10 -0
- package/lib/types/src/config/models/WeatherConditionMatchRulesTypes.d.ts +3 -0
- package/lib/types/src/config/models/WeatherConditions.d.ts +30 -0
- package/lib/utils/index.d.ts +14 -0
- package/lib/utils/src/array-utils.d.ts +11 -0
- package/lib/utils/src/comparisons.d.ts +22 -0
- package/lib/utils/src/data-store.d.ts +39 -0
- package/lib/utils/src/file-logger.d.ts +40 -0
- package/lib/utils/src/http-client.d.ts +115 -0
- package/lib/utils/src/object-utils.d.ts +35 -0
- package/lib/utils/src/string-utils.d.ts +20 -0
- package/lib/utils/src/types-utils.d.ts +12 -0
- package/package.json +35 -31
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,703 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Convert JS SDK
|
|
3
|
+
* Version 1.0.0
|
|
4
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
+
* License Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Validates variable is array and not empty
|
|
9
|
+
* @param array
|
|
10
|
+
*/
|
|
11
|
+
function arrayNotEmpty(array) {
|
|
12
|
+
return Array.isArray(array) && array.length > 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*!
|
|
16
|
+
* Convert JS SDK
|
|
17
|
+
* Version 1.0.0
|
|
18
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
19
|
+
* License Apache-2.0
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Returns the value at path of object
|
|
23
|
+
* TODO: get this utility to work with the optional mapper() helper from config
|
|
24
|
+
* @param {Record<string, any>} object
|
|
25
|
+
* @param {string} path
|
|
26
|
+
* @param {any=} defaultValue
|
|
27
|
+
* @param {boolean=} truthy Should Number 0 number and Boolean false be considered as normal value
|
|
28
|
+
* @return {any}
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Validates variable is object and not empty
|
|
32
|
+
* @param object
|
|
33
|
+
*/
|
|
34
|
+
function objectNotEmpty(object) {
|
|
35
|
+
return (typeof object === 'object' &&
|
|
36
|
+
object !== null &&
|
|
37
|
+
Object.keys(object).length > 0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/*!
|
|
41
|
+
* Convert JS SDK
|
|
42
|
+
* Version 1.0.0
|
|
43
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
44
|
+
* License Apache-2.0
|
|
45
|
+
*/
|
|
46
|
+
var _a;
|
|
47
|
+
/**
|
|
48
|
+
* Comparison Processor. Provides comparison methods for rules validation
|
|
49
|
+
*/
|
|
50
|
+
class Comparisons {
|
|
51
|
+
static equals(value, testAgainst, negation) {
|
|
52
|
+
if (Array.isArray(value))
|
|
53
|
+
return this._returnNegationCheck(value.indexOf(testAgainst) !== -1, negation);
|
|
54
|
+
if (objectNotEmpty(value))
|
|
55
|
+
return this._returnNegationCheck(Object.keys(value).indexOf(String(testAgainst)) !== -1, negation);
|
|
56
|
+
value = String(value);
|
|
57
|
+
testAgainst = String(testAgainst);
|
|
58
|
+
value = value.valueOf().toLowerCase();
|
|
59
|
+
testAgainst = testAgainst.valueOf().toLowerCase();
|
|
60
|
+
return this._returnNegationCheck(value === testAgainst, negation);
|
|
61
|
+
}
|
|
62
|
+
static less(value, testAgainst, negation) {
|
|
63
|
+
if (typeof value !== typeof testAgainst) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return this._returnNegationCheck(value < testAgainst, negation);
|
|
67
|
+
}
|
|
68
|
+
static lessEqual(value, testAgainst, negation) {
|
|
69
|
+
if (typeof value !== typeof testAgainst) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return this._returnNegationCheck(value <= testAgainst, negation);
|
|
73
|
+
}
|
|
74
|
+
static contains(value, testAgainst, negation) {
|
|
75
|
+
value = String(value);
|
|
76
|
+
testAgainst = String(testAgainst);
|
|
77
|
+
value = value.valueOf().toLowerCase();
|
|
78
|
+
testAgainst = testAgainst.valueOf().toLowerCase();
|
|
79
|
+
if (testAgainst.replace(/^([\s]*)|([\s]*)$/g, '').length === 0) {
|
|
80
|
+
return this._returnNegationCheck(true, negation);
|
|
81
|
+
}
|
|
82
|
+
return this._returnNegationCheck(value.indexOf(testAgainst) !== -1, negation);
|
|
83
|
+
}
|
|
84
|
+
static isIn(values, testAgainst, negation = false, splitter = '|') {
|
|
85
|
+
const matchedValuesArray = String(values)
|
|
86
|
+
.split(splitter)
|
|
87
|
+
.map((item) => {
|
|
88
|
+
return String(item);
|
|
89
|
+
});
|
|
90
|
+
if (typeof testAgainst === 'string') {
|
|
91
|
+
testAgainst = testAgainst.split(splitter);
|
|
92
|
+
}
|
|
93
|
+
if (!Array.isArray(testAgainst)) {
|
|
94
|
+
testAgainst = [];
|
|
95
|
+
}
|
|
96
|
+
testAgainst = testAgainst.map((item) => {
|
|
97
|
+
return String(item).valueOf().toLowerCase();
|
|
98
|
+
});
|
|
99
|
+
for (let i = 0; i < matchedValuesArray.length; i++) {
|
|
100
|
+
if (testAgainst.indexOf(matchedValuesArray[i]) !== -1) {
|
|
101
|
+
return this._returnNegationCheck(true, negation);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return this._returnNegationCheck(false, negation);
|
|
105
|
+
}
|
|
106
|
+
static startsWith(value, testAgainst, negation) {
|
|
107
|
+
value = String(value).valueOf().toLowerCase();
|
|
108
|
+
testAgainst = String(testAgainst).valueOf().toLowerCase();
|
|
109
|
+
return this._returnNegationCheck(value.indexOf(testAgainst) === 0, negation);
|
|
110
|
+
}
|
|
111
|
+
static endsWith(value, testAgainst, negation) {
|
|
112
|
+
value = String(value).valueOf().toLowerCase();
|
|
113
|
+
testAgainst = String(testAgainst).valueOf().toLowerCase();
|
|
114
|
+
return this._returnNegationCheck(value.indexOf(testAgainst, value.length - testAgainst.length) !== -1, negation);
|
|
115
|
+
}
|
|
116
|
+
static regexMatches(value, testAgainst, negation) {
|
|
117
|
+
value = String(value).valueOf().toLowerCase();
|
|
118
|
+
testAgainst = String(testAgainst).valueOf();
|
|
119
|
+
const regExp = new RegExp(testAgainst, 'i');
|
|
120
|
+
return this._returnNegationCheck(regExp.test(value), negation);
|
|
121
|
+
}
|
|
122
|
+
static _returnNegationCheck(value, negation = false) {
|
|
123
|
+
if (negation) {
|
|
124
|
+
return !value;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
_a = Comparisons;
|
|
132
|
+
Comparisons.equalsNumber = _a.equals;
|
|
133
|
+
Comparisons.matches = _a.equals;
|
|
134
|
+
|
|
135
|
+
/******************************************************************************
|
|
136
|
+
Copyright (c) Microsoft Corporation.
|
|
137
|
+
|
|
138
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
139
|
+
purpose with or without fee is hereby granted.
|
|
140
|
+
|
|
141
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
142
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
143
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
144
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
145
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
146
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
147
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
148
|
+
***************************************************************************** */
|
|
149
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
153
|
+
var e = new Error(message);
|
|
154
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/*!
|
|
158
|
+
* Convert JS SDK
|
|
159
|
+
* Version 1.0.0
|
|
160
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
161
|
+
* License Apache-2.0
|
|
162
|
+
*/
|
|
163
|
+
var BucketingError;
|
|
164
|
+
(function (BucketingError) {
|
|
165
|
+
BucketingError["VARIAION_NOT_DECIDED"] = "convert.com_variation_not_decided";
|
|
166
|
+
})(BucketingError || (BucketingError = {}));
|
|
167
|
+
|
|
168
|
+
/*!
|
|
169
|
+
* Convert JS SDK
|
|
170
|
+
* Version 1.0.0
|
|
171
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
172
|
+
* License Apache-2.0
|
|
173
|
+
*/
|
|
174
|
+
var ConversionSettingKey;
|
|
175
|
+
(function (ConversionSettingKey) {
|
|
176
|
+
ConversionSettingKey["FORCE_MULTIPLE_TRANSACTIONS"] = "forceMultipleTransactions";
|
|
177
|
+
})(ConversionSettingKey || (ConversionSettingKey = {}));
|
|
178
|
+
|
|
179
|
+
/*!
|
|
180
|
+
* Convert JS SDK
|
|
181
|
+
* Version 1.0.0
|
|
182
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
183
|
+
* License Apache-2.0
|
|
184
|
+
*/
|
|
185
|
+
const ERROR_MESSAGES = {
|
|
186
|
+
SDK_KEY_MISSING: 'SDK key is missing',
|
|
187
|
+
DATA_OBJECT_MISSING: 'Data object is missing',
|
|
188
|
+
CONFIG_DATA_NOT_VALID: 'Config Data is not valid',
|
|
189
|
+
SDK_OR_DATA_OBJECT_REQUIRED: 'SDK key or Data object should be provided',
|
|
190
|
+
RULE_NOT_VALID: 'Provided rule is not valid',
|
|
191
|
+
RULE_DATA_NOT_VALID: 'Provided rule data is not valid',
|
|
192
|
+
RULE_MATCH_TYPE_NOT_SUPPORTED: 'Provided rule matching type "#" is not supported',
|
|
193
|
+
RULE_ERROR: 'Rule error',
|
|
194
|
+
DATA_STORE_NOT_VALID: 'DataStore object is not valid. It should contain get and set methods',
|
|
195
|
+
VISITOR_ID_REQUIRED: 'Visitor string string is not present',
|
|
196
|
+
GOAL_DATA_NOT_VALID: 'GoalData object is not valid',
|
|
197
|
+
UNABLE_TO_SELECT_BUCKET_FOR_VISITOR: 'Unable to bucket visitor',
|
|
198
|
+
UNABLE_TO_PERFORM_NETWORK_REQUEST: 'Unable to perform network request',
|
|
199
|
+
UNSUPPORTED_RESPONSE_TYPE: 'Unsupported response type'
|
|
200
|
+
};
|
|
201
|
+
const MESSAGES = {
|
|
202
|
+
CONFIG_DATA_UPDATED: 'Config Data updated',
|
|
203
|
+
CORE_CONSTRUCTOR: 'Core Manager constructor has been called',
|
|
204
|
+
CORE_INITIALIZED: 'Core Manager has been initialized',
|
|
205
|
+
EXPERIENCE_CONSTRUCTOR: 'Experience Manager constructor has been called',
|
|
206
|
+
EXPERIENCE_NOT_FOUND: 'Experience not found',
|
|
207
|
+
EXPERIENCE_RULES_MATCHED: 'Experience rules matched',
|
|
208
|
+
VARIATIONS_NOT_FOUND: 'Variations not found',
|
|
209
|
+
VARIATION_CHANGE_NOT_SUPPORTED: 'Variation change not supported',
|
|
210
|
+
FEATURE_CONSTRUCTOR: 'Feature Manager constructor has been called',
|
|
211
|
+
FEATURE_NOT_FOUND: 'Fullstack Feature not found',
|
|
212
|
+
FEATURE_VARIABLES_NOT_FOUND: 'Fullstack Feature Variables not found',
|
|
213
|
+
FEATURE_VARIABLES_TYPE_NOT_FOUND: 'Fullstack Feature Variables Type not found',
|
|
214
|
+
BUCKETING_CONSTRUCTOR: 'Bucketing Manager constructor has been called',
|
|
215
|
+
DATA_CONSTRUCTOR: 'Data Manager constructor has been called',
|
|
216
|
+
RULE_CONSTRUCTOR: 'Rule Manager constructor has been called',
|
|
217
|
+
PROCESSING_ENTITY: 'Processing #',
|
|
218
|
+
LOCATION_MATCH: 'Location # rule matched',
|
|
219
|
+
LOCATION_NOT_MATCH: 'Location does not match',
|
|
220
|
+
LOCATION_NOT_RESTRICTED: 'Location not restricted',
|
|
221
|
+
AUDIENCE_MATCH: 'Audience # rule matched',
|
|
222
|
+
AUDIENCE_NOT_MATCH: 'Audience does not match',
|
|
223
|
+
NON_PERMANENT_AUDIENCE_NOT_RESTRICTED: 'Non-Permanent Audience not restricted',
|
|
224
|
+
AUDIENCE_NOT_RESTRICTED: 'Audience not restricted',
|
|
225
|
+
SEGMENTATION_MATCH: 'Segmentation # rule matched',
|
|
226
|
+
SEGMENTATION_NOT_RESTRICTED: 'Segmentation not restricted',
|
|
227
|
+
RULE_NOT_MATCH: 'Rule does not match',
|
|
228
|
+
RULE_MATCH: 'Found matched rule at OR block #',
|
|
229
|
+
RULE_MATCH_AND: 'AND block rule macthed',
|
|
230
|
+
RULE_MATCH_START: 'About to evaluate rule #',
|
|
231
|
+
LOCATION_ACTIVATED: 'Location # activated',
|
|
232
|
+
LOCATION_DEACTIVATED: 'Location # deactivated',
|
|
233
|
+
BUCKETED_VISITOR_FOUND: 'Visitor is already bucketed for variation #',
|
|
234
|
+
BUCKETED_VISITOR_FORCED: 'Forcing variation #',
|
|
235
|
+
BUCKETED_VISITOR: 'Visitor is bucketed for variation #',
|
|
236
|
+
GOAL_NOT_FOUND: 'Goal not found',
|
|
237
|
+
GOAL_RULE_NOT_MATCH: 'Goal rule do not match',
|
|
238
|
+
GOAL_FOUND: 'Goal # already triggered',
|
|
239
|
+
SEGMENTS_NOT_FOUND: 'Segments not found',
|
|
240
|
+
SEGMENTS_RULE_NOT_MATCH: 'Segments rule do not match',
|
|
241
|
+
CUSTOM_SEGMENTS_KEY_FOUND: 'Custom segments key already set',
|
|
242
|
+
SEND_BEACON_SUCCESS: 'The user agent successfully queued the data for transfer'
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/*!
|
|
246
|
+
* Convert JS SDK
|
|
247
|
+
* Version 1.0.0
|
|
248
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
249
|
+
* License Apache-2.0
|
|
250
|
+
*/
|
|
251
|
+
var DoNotTrack;
|
|
252
|
+
(function (DoNotTrack) {
|
|
253
|
+
DoNotTrack["OFF"] = "OFF";
|
|
254
|
+
DoNotTrack["EU_ONLY"] = "EU ONLY";
|
|
255
|
+
DoNotTrack["EEA_ONLY"] = "EEA ONLY";
|
|
256
|
+
DoNotTrack["WORLDWIDE"] = "Worldwide";
|
|
257
|
+
})(DoNotTrack || (DoNotTrack = {}));
|
|
258
|
+
|
|
259
|
+
/*!
|
|
260
|
+
* Convert JS SDK
|
|
261
|
+
* Version 1.0.0
|
|
262
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
263
|
+
* License Apache-2.0
|
|
264
|
+
*/
|
|
265
|
+
var EntityType;
|
|
266
|
+
(function (EntityType) {
|
|
267
|
+
EntityType["AUDIENCE"] = "audience";
|
|
268
|
+
EntityType["LOCATION"] = "location";
|
|
269
|
+
EntityType["SEGMENT"] = "segment";
|
|
270
|
+
EntityType["FEATURE"] = "feature";
|
|
271
|
+
EntityType["GOAL"] = "goal";
|
|
272
|
+
EntityType["EXPERIENCE"] = "experience";
|
|
273
|
+
EntityType["VARIATION"] = "variation";
|
|
274
|
+
})(EntityType || (EntityType = {}));
|
|
275
|
+
|
|
276
|
+
/*!
|
|
277
|
+
* Convert JS SDK
|
|
278
|
+
* Version 1.0.0
|
|
279
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
280
|
+
* License Apache-2.0
|
|
281
|
+
*/
|
|
282
|
+
var FeatureStatus;
|
|
283
|
+
(function (FeatureStatus) {
|
|
284
|
+
FeatureStatus["ENABLED"] = "enabled";
|
|
285
|
+
FeatureStatus["DISABLED"] = "disabled";
|
|
286
|
+
})(FeatureStatus || (FeatureStatus = {}));
|
|
287
|
+
|
|
288
|
+
/*!
|
|
289
|
+
* Convert JS SDK
|
|
290
|
+
* Version 1.0.0
|
|
291
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
292
|
+
* License Apache-2.0
|
|
293
|
+
*/
|
|
294
|
+
var GoalDataKey;
|
|
295
|
+
(function (GoalDataKey) {
|
|
296
|
+
GoalDataKey["AMOUNT"] = "amount";
|
|
297
|
+
GoalDataKey["PRODUCTS_COUNT"] = "productsCount";
|
|
298
|
+
GoalDataKey["TRANSACTION_ID"] = "transactionId";
|
|
299
|
+
})(GoalDataKey || (GoalDataKey = {}));
|
|
300
|
+
|
|
301
|
+
/*!
|
|
302
|
+
* Convert JS SDK
|
|
303
|
+
* Version 1.0.0
|
|
304
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
305
|
+
* License Apache-2.0
|
|
306
|
+
*/
|
|
307
|
+
var LogLevel;
|
|
308
|
+
(function (LogLevel) {
|
|
309
|
+
LogLevel[LogLevel["TRACE"] = 0] = "TRACE";
|
|
310
|
+
LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
|
|
311
|
+
LogLevel[LogLevel["INFO"] = 2] = "INFO";
|
|
312
|
+
LogLevel[LogLevel["WARN"] = 3] = "WARN";
|
|
313
|
+
LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
|
|
314
|
+
LogLevel[LogLevel["SILENT"] = 5] = "SILENT";
|
|
315
|
+
})(LogLevel || (LogLevel = {}));
|
|
316
|
+
|
|
317
|
+
/*!
|
|
318
|
+
* Convert JS SDK
|
|
319
|
+
* Version 1.0.0
|
|
320
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
321
|
+
* License Apache-2.0
|
|
322
|
+
*/
|
|
323
|
+
var LogMethod;
|
|
324
|
+
(function (LogMethod) {
|
|
325
|
+
LogMethod["LOG"] = "log";
|
|
326
|
+
LogMethod["TRACE"] = "trace";
|
|
327
|
+
LogMethod["DEBUG"] = "debug";
|
|
328
|
+
LogMethod["INFO"] = "info";
|
|
329
|
+
LogMethod["WARN"] = "warn";
|
|
330
|
+
LogMethod["ERROR"] = "error";
|
|
331
|
+
})(LogMethod || (LogMethod = {}));
|
|
332
|
+
|
|
333
|
+
/*!
|
|
334
|
+
* Convert JS SDK
|
|
335
|
+
* Version 1.0.0
|
|
336
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
337
|
+
* License Apache-2.0
|
|
338
|
+
*/
|
|
339
|
+
var ProjectType;
|
|
340
|
+
(function (ProjectType) {
|
|
341
|
+
ProjectType["WEB"] = "web";
|
|
342
|
+
ProjectType["FULLSTACK"] = "fullstack";
|
|
343
|
+
})(ProjectType || (ProjectType = {}));
|
|
344
|
+
|
|
345
|
+
/*!
|
|
346
|
+
* Convert JS SDK
|
|
347
|
+
* Version 1.0.0
|
|
348
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
349
|
+
* License Apache-2.0
|
|
350
|
+
*/
|
|
351
|
+
var RuleError;
|
|
352
|
+
(function (RuleError) {
|
|
353
|
+
RuleError["NO_DATA_FOUND"] = "convert.com_no_data_found";
|
|
354
|
+
RuleError["NEED_MORE_DATA"] = "convert.com_need_more_data";
|
|
355
|
+
})(RuleError || (RuleError = {}));
|
|
356
|
+
|
|
357
|
+
/*!
|
|
358
|
+
* Convert JS SDK
|
|
359
|
+
* Version 1.0.0
|
|
360
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
361
|
+
* License Apache-2.0
|
|
362
|
+
*/
|
|
363
|
+
/**
|
|
364
|
+
* SDK system events. Possible values: 'ready' | 'queue-released'
|
|
365
|
+
* or custom visitor's event
|
|
366
|
+
*/
|
|
367
|
+
var SystemEvents;
|
|
368
|
+
(function (SystemEvents) {
|
|
369
|
+
SystemEvents["READY"] = "ready";
|
|
370
|
+
SystemEvents["CONFIG_UPDATED"] = "config.updated";
|
|
371
|
+
SystemEvents["API_QUEUE_RELEASED"] = "api.queue.released";
|
|
372
|
+
SystemEvents["BUCKETING"] = "bucketing";
|
|
373
|
+
SystemEvents["CONVERSION"] = "conversion";
|
|
374
|
+
SystemEvents["SEGMENTS"] = "segments";
|
|
375
|
+
SystemEvents["LOCATION_ACTIVATED"] = "location.activated";
|
|
376
|
+
SystemEvents["LOCATION_DEACTIVATED"] = "location.deactivated";
|
|
377
|
+
SystemEvents["AUDIENCES"] = "audiences";
|
|
378
|
+
SystemEvents["DATA_STORE_QUEUE_RELEASED"] = "datastore.queue.released";
|
|
379
|
+
})(SystemEvents || (SystemEvents = {}));
|
|
380
|
+
|
|
381
|
+
/*!
|
|
382
|
+
* Convert JS SDK
|
|
383
|
+
* Version 1.0.0
|
|
384
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
385
|
+
* License Apache-2.0
|
|
386
|
+
*/
|
|
387
|
+
var VariationChangeType;
|
|
388
|
+
(function (VariationChangeType) {
|
|
389
|
+
VariationChangeType["RICH_STRUCTURE"] = "richStructure";
|
|
390
|
+
VariationChangeType["CUSTOM_CODE"] = "customCode";
|
|
391
|
+
VariationChangeType["DEFAULT_CODE"] = "defaultCode";
|
|
392
|
+
VariationChangeType["DEFAULT_CODE_MULTIPAGE"] = "defaultCodeMultipage";
|
|
393
|
+
VariationChangeType["DEFAULT_REDIRECT"] = "defaultRedirect";
|
|
394
|
+
VariationChangeType["FULLSTACK_FEATURE"] = "fullStackFeature";
|
|
395
|
+
})(VariationChangeType || (VariationChangeType = {}));
|
|
396
|
+
|
|
397
|
+
/*!
|
|
398
|
+
* Convert JS SDK
|
|
399
|
+
* Version 1.0.0
|
|
400
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
401
|
+
* License Apache-2.0
|
|
402
|
+
*/
|
|
403
|
+
var BrowserType;
|
|
404
|
+
(function (BrowserType) {
|
|
405
|
+
BrowserType["IE"] = "IE";
|
|
406
|
+
BrowserType["CH"] = "CH";
|
|
407
|
+
BrowserType["FF"] = "FF";
|
|
408
|
+
BrowserType["OP"] = "OP";
|
|
409
|
+
BrowserType["SF"] = "SF";
|
|
410
|
+
BrowserType["EDG"] = "EDG";
|
|
411
|
+
BrowserType["MO"] = "MO";
|
|
412
|
+
BrowserType["NS"] = "NS";
|
|
413
|
+
BrowserType["OTH"] = "OTH";
|
|
414
|
+
})(BrowserType || (BrowserType = {}));
|
|
415
|
+
|
|
416
|
+
/*!
|
|
417
|
+
* Convert JS SDK
|
|
418
|
+
* Version 1.0.0
|
|
419
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
420
|
+
* License Apache-2.0
|
|
421
|
+
*/
|
|
422
|
+
var DeviceType;
|
|
423
|
+
(function (DeviceType) {
|
|
424
|
+
DeviceType["ALLPH"] = "ALLPH";
|
|
425
|
+
DeviceType["IPH"] = "IPH";
|
|
426
|
+
DeviceType["OTHPH"] = "OTHPH";
|
|
427
|
+
DeviceType["ALLTAB"] = "ALLTAB";
|
|
428
|
+
DeviceType["IPAD"] = "IPAD";
|
|
429
|
+
DeviceType["OTHTAB"] = "OTHTAB";
|
|
430
|
+
DeviceType["DESK"] = "DESK";
|
|
431
|
+
DeviceType["OTHDEV"] = "OTHDEV";
|
|
432
|
+
})(DeviceType || (DeviceType = {}));
|
|
433
|
+
|
|
434
|
+
/*!
|
|
435
|
+
* Convert JS SDK
|
|
436
|
+
* Version 1.0.0
|
|
437
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
438
|
+
* License Apache-2.0
|
|
439
|
+
*/
|
|
440
|
+
var SegmentsKeys;
|
|
441
|
+
(function (SegmentsKeys) {
|
|
442
|
+
SegmentsKeys["COUNTRY"] = "country";
|
|
443
|
+
SegmentsKeys["BROWSER"] = "browser";
|
|
444
|
+
SegmentsKeys["DEVICES"] = "devices";
|
|
445
|
+
SegmentsKeys["SOURCE"] = "source";
|
|
446
|
+
SegmentsKeys["CAMPAIGN"] = "campaign";
|
|
447
|
+
SegmentsKeys["VISITOR_TYPE"] = "visitorType";
|
|
448
|
+
SegmentsKeys["CUSTOM_SEGMENTS"] = "customSegments";
|
|
449
|
+
})(SegmentsKeys || (SegmentsKeys = {}));
|
|
450
|
+
|
|
451
|
+
/*!
|
|
452
|
+
* Convert JS SDK
|
|
453
|
+
* Version 1.0.0
|
|
454
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
455
|
+
* License Apache-2.0
|
|
456
|
+
*/
|
|
457
|
+
var SourceType;
|
|
458
|
+
(function (SourceType) {
|
|
459
|
+
SourceType["CAMPAIGN"] = "campaign";
|
|
460
|
+
SourceType["SEARCH"] = "search";
|
|
461
|
+
SourceType["REFERRAL"] = "referral";
|
|
462
|
+
SourceType["DIRECT"] = "direct";
|
|
463
|
+
})(SourceType || (SourceType = {}));
|
|
464
|
+
|
|
465
|
+
/*!
|
|
466
|
+
* Convert JS SDK
|
|
467
|
+
* Version 1.0.0
|
|
468
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
469
|
+
* License Apache-2.0
|
|
470
|
+
*/
|
|
471
|
+
var VisitorType;
|
|
472
|
+
(function (VisitorType) {
|
|
473
|
+
VisitorType["NEW"] = "new";
|
|
474
|
+
VisitorType["RETURNING"] = "returning";
|
|
475
|
+
})(VisitorType || (VisitorType = {}));
|
|
476
|
+
|
|
477
|
+
/*!
|
|
478
|
+
* Convert JS SDK
|
|
479
|
+
* Version 1.0.0
|
|
480
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
481
|
+
* License Apache-2.0
|
|
482
|
+
*/
|
|
483
|
+
var HttpStatusCode;
|
|
484
|
+
(function (HttpStatusCode) {
|
|
485
|
+
HttpStatusCode[HttpStatusCode["Continue"] = 100] = "Continue";
|
|
486
|
+
HttpStatusCode[HttpStatusCode["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
487
|
+
HttpStatusCode[HttpStatusCode["Processing"] = 102] = "Processing";
|
|
488
|
+
HttpStatusCode[HttpStatusCode["EarlyHints"] = 103] = "EarlyHints";
|
|
489
|
+
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
|
490
|
+
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
491
|
+
HttpStatusCode[HttpStatusCode["Accepted"] = 202] = "Accepted";
|
|
492
|
+
HttpStatusCode[HttpStatusCode["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
493
|
+
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
|
|
494
|
+
HttpStatusCode[HttpStatusCode["ResetContent"] = 205] = "ResetContent";
|
|
495
|
+
HttpStatusCode[HttpStatusCode["PartialContent"] = 206] = "PartialContent";
|
|
496
|
+
HttpStatusCode[HttpStatusCode["MultiStatus"] = 207] = "MultiStatus";
|
|
497
|
+
HttpStatusCode[HttpStatusCode["AlreadyReported"] = 208] = "AlreadyReported";
|
|
498
|
+
HttpStatusCode[HttpStatusCode["ImUsed"] = 226] = "ImUsed";
|
|
499
|
+
HttpStatusCode[HttpStatusCode["MultipleChoices"] = 300] = "MultipleChoices";
|
|
500
|
+
HttpStatusCode[HttpStatusCode["MovedPermanently"] = 301] = "MovedPermanently";
|
|
501
|
+
HttpStatusCode[HttpStatusCode["Found"] = 302] = "Found";
|
|
502
|
+
HttpStatusCode[HttpStatusCode["SeeOther"] = 303] = "SeeOther";
|
|
503
|
+
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
|
|
504
|
+
HttpStatusCode[HttpStatusCode["UseProxy"] = 305] = "UseProxy";
|
|
505
|
+
HttpStatusCode[HttpStatusCode["Unused"] = 306] = "Unused";
|
|
506
|
+
HttpStatusCode[HttpStatusCode["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
507
|
+
HttpStatusCode[HttpStatusCode["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
508
|
+
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
|
|
509
|
+
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
|
510
|
+
HttpStatusCode[HttpStatusCode["PaymentRequired"] = 402] = "PaymentRequired";
|
|
511
|
+
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
|
512
|
+
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
513
|
+
HttpStatusCode[HttpStatusCode["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
514
|
+
HttpStatusCode[HttpStatusCode["NotAcceptable"] = 406] = "NotAcceptable";
|
|
515
|
+
HttpStatusCode[HttpStatusCode["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
516
|
+
HttpStatusCode[HttpStatusCode["RequestTimeout"] = 408] = "RequestTimeout";
|
|
517
|
+
HttpStatusCode[HttpStatusCode["Conflict"] = 409] = "Conflict";
|
|
518
|
+
HttpStatusCode[HttpStatusCode["Gone"] = 410] = "Gone";
|
|
519
|
+
HttpStatusCode[HttpStatusCode["LengthRequired"] = 411] = "LengthRequired";
|
|
520
|
+
HttpStatusCode[HttpStatusCode["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
521
|
+
HttpStatusCode[HttpStatusCode["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
522
|
+
HttpStatusCode[HttpStatusCode["UriTooLong"] = 414] = "UriTooLong";
|
|
523
|
+
HttpStatusCode[HttpStatusCode["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
524
|
+
HttpStatusCode[HttpStatusCode["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
525
|
+
HttpStatusCode[HttpStatusCode["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
526
|
+
HttpStatusCode[HttpStatusCode["ImATeapot"] = 418] = "ImATeapot";
|
|
527
|
+
HttpStatusCode[HttpStatusCode["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
528
|
+
HttpStatusCode[HttpStatusCode["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
529
|
+
HttpStatusCode[HttpStatusCode["Locked"] = 423] = "Locked";
|
|
530
|
+
HttpStatusCode[HttpStatusCode["FailedDependency"] = 424] = "FailedDependency";
|
|
531
|
+
HttpStatusCode[HttpStatusCode["TooEarly"] = 425] = "TooEarly";
|
|
532
|
+
HttpStatusCode[HttpStatusCode["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
533
|
+
HttpStatusCode[HttpStatusCode["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
534
|
+
HttpStatusCode[HttpStatusCode["TooManyRequests"] = 429] = "TooManyRequests";
|
|
535
|
+
HttpStatusCode[HttpStatusCode["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
536
|
+
HttpStatusCode[HttpStatusCode["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
537
|
+
HttpStatusCode[HttpStatusCode["InternalServerError"] = 500] = "InternalServerError";
|
|
538
|
+
HttpStatusCode[HttpStatusCode["NotImplemented"] = 501] = "NotImplemented";
|
|
539
|
+
HttpStatusCode[HttpStatusCode["BadGateway"] = 502] = "BadGateway";
|
|
540
|
+
HttpStatusCode[HttpStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
541
|
+
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
542
|
+
HttpStatusCode[HttpStatusCode["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
|
|
543
|
+
HttpStatusCode[HttpStatusCode["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
544
|
+
HttpStatusCode[HttpStatusCode["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
545
|
+
HttpStatusCode[HttpStatusCode["LoopDetected"] = 508] = "LoopDetected";
|
|
546
|
+
HttpStatusCode[HttpStatusCode["NotExtended"] = 510] = "NotExtended";
|
|
547
|
+
HttpStatusCode[HttpStatusCode["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
548
|
+
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
549
|
+
|
|
550
|
+
var murmurhash = {exports: {}};
|
|
551
|
+
|
|
552
|
+
(function (module) {
|
|
553
|
+
(function(){
|
|
554
|
+
|
|
555
|
+
const createBuffer = (val) => new TextEncoder().encode(val);
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* JS Implementation of MurmurHash2
|
|
559
|
+
*
|
|
560
|
+
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
561
|
+
* @see http://github.com/garycourt/murmurhash-js
|
|
562
|
+
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
|
|
563
|
+
* @see http://sites.google.com/site/murmurhash/
|
|
564
|
+
*
|
|
565
|
+
* @param {Uint8Array | string} str ASCII only
|
|
566
|
+
* @param {number} seed Positive integer only
|
|
567
|
+
* @return {number} 32-bit positive integer hash
|
|
568
|
+
*/
|
|
569
|
+
function MurmurHashV2(str, seed) {
|
|
570
|
+
if (typeof str === 'string') str = createBuffer(str);
|
|
571
|
+
let
|
|
572
|
+
l = str.length,
|
|
573
|
+
h = seed ^ l,
|
|
574
|
+
i = 0,
|
|
575
|
+
k;
|
|
576
|
+
|
|
577
|
+
while (l >= 4) {
|
|
578
|
+
k =
|
|
579
|
+
((str[i] & 0xff)) |
|
|
580
|
+
((str[++i] & 0xff) << 8) |
|
|
581
|
+
((str[++i] & 0xff) << 16) |
|
|
582
|
+
((str[++i] & 0xff) << 24);
|
|
583
|
+
|
|
584
|
+
k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));
|
|
585
|
+
k ^= k >>> 24;
|
|
586
|
+
k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));
|
|
587
|
+
|
|
588
|
+
h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;
|
|
589
|
+
|
|
590
|
+
l -= 4;
|
|
591
|
+
++i;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
switch (l) {
|
|
595
|
+
case 3: h ^= (str[i + 2] & 0xff) << 16;
|
|
596
|
+
case 2: h ^= (str[i + 1] & 0xff) << 8;
|
|
597
|
+
case 1: h ^= (str[i] & 0xff);
|
|
598
|
+
h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
h ^= h >>> 13;
|
|
602
|
+
h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));
|
|
603
|
+
h ^= h >>> 15;
|
|
604
|
+
|
|
605
|
+
return h >>> 0;
|
|
606
|
+
}
|
|
607
|
+
/*
|
|
608
|
+
* JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)
|
|
609
|
+
*
|
|
610
|
+
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
611
|
+
* @see http://github.com/garycourt/murmurhash-js
|
|
612
|
+
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
|
|
613
|
+
* @see http://sites.google.com/site/murmurhash/
|
|
614
|
+
*
|
|
615
|
+
* @param {Uint8Array | string} key ASCII only
|
|
616
|
+
* @param {number} seed Positive integer only
|
|
617
|
+
* @return {number} 32-bit positive integer hash
|
|
618
|
+
*/
|
|
619
|
+
function MurmurHashV3(key, seed) {
|
|
620
|
+
if (typeof key === 'string') key = createBuffer(key);
|
|
621
|
+
|
|
622
|
+
let remainder, bytes, h1, h1b, c1, c2, k1, i;
|
|
623
|
+
|
|
624
|
+
remainder = key.length & 3; // key.length % 4
|
|
625
|
+
bytes = key.length - remainder;
|
|
626
|
+
h1 = seed;
|
|
627
|
+
c1 = 0xcc9e2d51;
|
|
628
|
+
c2 = 0x1b873593;
|
|
629
|
+
i = 0;
|
|
630
|
+
|
|
631
|
+
while (i < bytes) {
|
|
632
|
+
k1 =
|
|
633
|
+
((key[i] & 0xff)) |
|
|
634
|
+
((key[++i] & 0xff) << 8) |
|
|
635
|
+
((key[++i] & 0xff) << 16) |
|
|
636
|
+
((key[++i] & 0xff) << 24);
|
|
637
|
+
++i;
|
|
638
|
+
|
|
639
|
+
k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
|
|
640
|
+
k1 = (k1 << 15) | (k1 >>> 17);
|
|
641
|
+
k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
|
|
642
|
+
|
|
643
|
+
h1 ^= k1;
|
|
644
|
+
h1 = (h1 << 13) | (h1 >>> 19);
|
|
645
|
+
h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
|
|
646
|
+
h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
k1 = 0;
|
|
650
|
+
|
|
651
|
+
switch (remainder) {
|
|
652
|
+
case 3: k1 ^= (key[i + 2] & 0xff) << 16;
|
|
653
|
+
case 2: k1 ^= (key[i + 1] & 0xff) << 8;
|
|
654
|
+
case 1: k1 ^= (key[i] & 0xff);
|
|
655
|
+
|
|
656
|
+
k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
|
|
657
|
+
k1 = (k1 << 15) | (k1 >>> 17);
|
|
658
|
+
k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
|
|
659
|
+
h1 ^= k1;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
h1 ^= key.length;
|
|
663
|
+
|
|
664
|
+
h1 ^= h1 >>> 16;
|
|
665
|
+
h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
|
|
666
|
+
h1 ^= h1 >>> 13;
|
|
667
|
+
h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
|
|
668
|
+
h1 ^= h1 >>> 16;
|
|
669
|
+
|
|
670
|
+
return h1 >>> 0;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
const murmur = MurmurHashV3;
|
|
674
|
+
murmur.v2 = MurmurHashV2;
|
|
675
|
+
murmur.v3 = MurmurHashV3;
|
|
676
|
+
|
|
677
|
+
{
|
|
678
|
+
module.exports = murmur;
|
|
679
|
+
}
|
|
680
|
+
}());
|
|
681
|
+
} (murmurhash));
|
|
682
|
+
|
|
683
|
+
/*!
|
|
684
|
+
* Convert JS SDK
|
|
685
|
+
* Version 1.0.0
|
|
686
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
687
|
+
* License Apache-2.0
|
|
688
|
+
*/
|
|
689
|
+
/**
|
|
690
|
+
* String formatter tool. Transforms a space-separated string into camelCase
|
|
691
|
+
* @param {string} input
|
|
692
|
+
* @return {string}
|
|
693
|
+
*/
|
|
694
|
+
function camelCase(input) {
|
|
695
|
+
return input
|
|
696
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
|
|
697
|
+
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
698
|
+
})
|
|
699
|
+
.replace(/\s+/g, '');
|
|
700
|
+
}
|
|
3
701
|
|
|
4
702
|
/*!
|
|
5
703
|
* Convert JS SDK
|
|
@@ -58,7 +756,7 @@ class RuleManager {
|
|
|
58
756
|
/**
|
|
59
757
|
* Check input data matching to rule set
|
|
60
758
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
61
|
-
* @param {
|
|
759
|
+
* @param {RuleObject} ruleSet
|
|
62
760
|
* @return {boolean | RuleError}
|
|
63
761
|
*/
|
|
64
762
|
isRuleMatched(data, ruleSet, logEntry) {
|
|
@@ -96,7 +794,7 @@ class RuleManager {
|
|
|
96
794
|
}
|
|
97
795
|
/**
|
|
98
796
|
* Check is rule object valid
|
|
99
|
-
* @param {
|
|
797
|
+
* @param {RuleElement} rule
|
|
100
798
|
* @return {boolean}
|
|
101
799
|
*/
|
|
102
800
|
isValidRule(rule) {
|
|
@@ -169,7 +867,7 @@ class RuleManager {
|
|
|
169
867
|
/**
|
|
170
868
|
* Process single rule item
|
|
171
869
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
172
|
-
* @param {
|
|
870
|
+
* @param {RuleElement} rule A single rule to compare
|
|
173
871
|
* @return {boolean | RuleError} Comparison result
|
|
174
872
|
* @private
|
|
175
873
|
*/
|
|
@@ -183,7 +881,7 @@ class RuleManager {
|
|
|
183
881
|
if (data && typeof data === 'object') {
|
|
184
882
|
// Validate data key-value set.
|
|
185
883
|
if (this.isUsingCustomInterface(data)) {
|
|
186
|
-
//
|
|
884
|
+
// RuleElement object has to have `rule_type` field
|
|
187
885
|
if (rule === null || rule === void 0 ? void 0 : rule.rule_type) {
|
|
188
886
|
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager._processRuleItem()', MESSAGES.RULE_MATCH_START.replace('#', rule.rule_type));
|
|
189
887
|
for (const method of Object.getOwnPropertyNames(data.constructor.prototype)) {
|
|
@@ -203,12 +901,12 @@ class RuleManager {
|
|
|
203
901
|
}
|
|
204
902
|
}
|
|
205
903
|
else if (objectNotEmpty(data)) {
|
|
206
|
-
//
|
|
904
|
+
// only handle RuleElement with a `key` field
|
|
207
905
|
for (const key of Object.keys(data)) {
|
|
208
906
|
const k = this._keys_case_sensitive ? key : key.toLowerCase();
|
|
209
907
|
const rule_k = this._keys_case_sensitive
|
|
210
|
-
? rule
|
|
211
|
-
: rule
|
|
908
|
+
? rule['key']
|
|
909
|
+
: String(rule['key']).toLowerCase();
|
|
212
910
|
if (k === rule_k) {
|
|
213
911
|
return this._comparisonProcessor[matching](data[key], rule.value, negation);
|
|
214
912
|
}
|