diff --git a/modules/Constants.js b/modules/Constants.js index 08cb5e4..d565a83 100644 --- a/modules/Constants.js +++ b/modules/Constants.js @@ -107,7 +107,29 @@ var healthCheckCounterEnum = Object.freeze({ var SDK_VERSION = "23.12.4"; var SDK_NAME = "javascript_native_web"; -// Using this on document.referrer would return an array with 15 elements in it. The 12th element (array[11]) would be the path we are looking for. Others would be things like password and such (use https://regex101.com/ to check more) +// Using this on document.referrer would return an array with 17 elements in it. The 12th element (array[11]) would be the path we are looking for. Others would be things like password and such (use https://regex101.com/ to check more) +// an example URL: +// http://user:pass@host:8080/path/to/resource?query=value#fragment +// this url would yield the following result for matches = urlParseRE.exec(document.referrer); +// +// 0: "http://user:pass@host:8080/path/to/resource?query=value#fragment" +// 1: "http://user:pass@host:8080/path/to/resource?query=value" +// 2: "http://user:pass@host:8080/path/to/resource" +// 3: "http://user:pass@host:8080" +// 4: "http:" +// 5: "//" +// 6: "user:pass@host:8080" +// 7: "user:pass" +// 8: "user" +// 9: "pass" +// 10: "host:8080" +// 11: "host" +// 12: "8080" +// 13: "/path/to/resource" +// 14: "/path/to/" +// 15: "resource" +// 16: "?query=value" +// 17: "#fragment" var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/; export { CDN, DeviceIdTypeInternalEnums, SDK_NAME, SDK_VERSION, configurationDefaultValues, featureEnums, healthCheckCounterEnum, internalEventKeyEnums, internalEventKeyEnumsArray, logLevelEnums, urlParseRE }; \ No newline at end of file