posthog-js 1.82.2 → 1.82.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/es.js +1 -1
- package/dist/es.js.map +1 -1
- package/dist/module.d.ts +7 -9
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/posthog-surveys.d.ts +1 -1
- package/lib/src/posthog-surveys.js.map +1 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PostHog } from './posthog-core';
|
|
2
|
-
import { SurveyCallback, SurveyUrlMatchType } from 'posthog-surveys-types';
|
|
2
|
+
import { SurveyCallback, SurveyUrlMatchType } from './posthog-surveys-types';
|
|
3
3
|
export declare const surveyUrlValidationMap: Record<SurveyUrlMatchType, (conditionsUrl: string) => boolean>;
|
|
4
4
|
export declare class PostHogSurveys {
|
|
5
5
|
instance: PostHog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog-surveys.js","sourceRoot":"","sources":["../../src/posthog-surveys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAG7C,MAAM,CAAC,IAAM,sBAAsB,GAAmE;IAClG,SAAS,EAAE,UAAC,aAAa,IAAK,OAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,EAA5E,CAA4E;IAC1G,KAAK,EAAE,UAAC,aAAa,IAAK,OAAA,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,EAAxD,CAAwD;IAClF,K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O,QAAQ,CAAC,uBAAuB,CAAC,CAAA;QAC5C,CAAC,EAAE,WAAW,CAAC,CAAA;IACnB,CAAC;IACL,qBAAC;AAAD,CAAC,AA5DD,IA4DC","sourcesContent":["import { PostHog } from './posthog-core'\nimport { SURVEYS } from './constants'\nimport { _isUrlMatchingRegex } from './utils'\nimport { SurveyCallback, SurveyUrlMatchType } from 'posthog-surveys-types'\n\nexport const surveyUrlValidationMap: Record<SurveyUrlMatchType, (conditionsUrl: string) => boolean> = {\n icontains: (conditionsUrl) => window.location.href.toLowerCase().indexOf(conditionsUrl.toLowerCase()) > -1,\n regex: (conditionsUrl) => _isUrlMatchingRegex(window.location.href, conditionsUrl),\n exact: (conditionsUrl) => window.location.href === conditionsUrl,\n}\n\nexport class PostHogSurveys {\n instance: PostHog\n\n constructor(instance: PostHog) {\n this.instance = instance\n }\n\n getSurveys(callback: SurveyCallback, forceReload = false) {\n const existingSurveys = this.instance.get_property(SURVEYS)\n if (!existingSurveys || forceReload) {\n this.instance._send_request(\n `${this.instance.config.api_host}/api/surveys/?token=${this.instance.config.token}`,\n {},\n { method: 'GET' },\n (response) => {\n const surveys = response.surveys || []\n this.instance.persistence?.register({ [SURVEYS]: surveys })\n return callback(surveys)\n }\n )\n } else {\n return callback(existingSurveys)\n }\n }\n\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false) {\n this.getSurveys((surveys) => {\n const activeSurveys = surveys.filter((survey) => {\n return !!(survey.start_date && !survey.end_date)\n })\n const conditionMatchedSurveys = activeSurveys.filter((survey) => {\n if (!survey.conditions) {\n return true\n }\n\n // use urlMatchType to validate url condition, fallback to contains for backwards compatibility\n const urlCheck = survey.conditions?.url\n ? surveyUrlValidationMap[survey.conditions?.urlMatchType ?? 'icontains'](survey.conditions.url)\n : true\n const selectorCheck = survey.conditions?.selector\n ? document.querySelector(survey.conditions.selector)\n : true\n return urlCheck && selectorCheck\n })\n const targetingMatchedSurveys = conditionMatchedSurveys.filter((survey) => {\n if (!survey.linked_flag_key && !survey.targeting_flag_key) {\n return true\n }\n const linkedFlagCheck = survey.linked_flag_key\n ? this.instance.featureFlags.isFeatureEnabled(survey.linked_flag_key)\n : true\n const targetingFlagCheck = survey.targeting_flag_key\n ? this.instance.featureFlags.isFeatureEnabled(survey.targeting_flag_key)\n : true\n return linkedFlagCheck && targetingFlagCheck\n })\n\n return callback(targetingMatchedSurveys)\n }, forceReload)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"posthog-surveys.js","sourceRoot":"","sources":["../../src/posthog-surveys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAG7C,MAAM,CAAC,IAAM,sBAAsB,GAAmE;IAClG,SAAS,EAAE,UAAC,aAAa,IAAK,OAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,EAA5E,CAA4E;IAC1G,KAAK,EAAE,UAAC,aAAa,IAAK,OAAA,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,EAAxD,CAAwD;IAClF,KAAK,EAAE,UAAC,aAAa,IAAK,OAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,aAAa,EAAtC,CAAsC;CACnE,CAAA;AAED;IAGI,wBAAY,QAAiB;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC5B,CAAC;IAED,mCAAU,GAAV,UAAW,QAAwB,EAAE,WAAmB;QAAxD,iBAgBC;QAhBoC,4BAAA,EAAA,mBAAmB;QACpD,IAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC3D,IAAI,CAAC,eAAe,IAAI,WAAW,EAAE;YACjC,IAAI,CAAC,QAAQ,CAAC,aAAa,CACvB,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AC,UAAU,0CAAE,QAAQ;oBAC7C,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;oBACpD,CAAC,CAAC,IAAI,CAAA;gBACV,OAAO,QAAQ,IAAI,aAAa,CAAA;YACpC,CAAC,CAAC,CAAA;YACF,IAAM,uBAAuB,GAAG,uBAAuB,CAAC,MAAM,CAAC,UAAC,MAAM;gBAClE,IAAI,CAAC,MAAM,CAAC,eAAe,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;oBACvD,OAAO,IAAI,CAAA;iBACd;gBACD,IAAM,eAAe,GAAG,MAAM,CAAC,eAAe;oBAC1C,CAAC,CAAC,KAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,eAAe,CAAC;oBACrE,CAAC,CAAC,IAAI,CAAA;gBACV,IAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB;oBAChD,CAAC,CAAC,KAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,kBAAkB,CAAC;oBACxE,CAAC,CAAC,IAAI,CAAA;gBACV,OAAO,eAAe,IAAI,kBAAkB,CAAA;YAChD,CAAC,CAAC,CAAA;YAEF,OAAO,QAAQ,CAAC,uBAAuB,CAAC,CAAA;QAC5C,CAAC,EAAE,WAAW,CAAC,CAAA;IACnB,CAAC;IACL,qBAAC;AAAD,CAAC,AA5DD,IA4DC","sourcesContent":["import { PostHog } from './posthog-core'\nimport { SURVEYS } from './constants'\nimport { _isUrlMatchingRegex } from './utils'\nimport { SurveyCallback, SurveyUrlMatchType } from './posthog-surveys-types'\n\nexport const surveyUrlValidationMap: Record<SurveyUrlMatchType, (conditionsUrl: string) => boolean> = {\n icontains: (conditionsUrl) => window.location.href.toLowerCase().indexOf(conditionsUrl.toLowerCase()) > -1,\n regex: (conditionsUrl) => _isUrlMatchingRegex(window.location.href, conditionsUrl),\n exact: (conditionsUrl) => window.location.href === conditionsUrl,\n}\n\nexport class PostHogSurveys {\n instance: PostHog\n\n constructor(instance: PostHog) {\n this.instance = instance\n }\n\n getSurveys(callback: SurveyCallback, forceReload = false) {\n const existingSurveys = this.instance.get_property(SURVEYS)\n if (!existingSurveys || forceReload) {\n this.instance._send_request(\n `${this.instance.config.api_host}/api/surveys/?token=${this.instance.config.token}`,\n {},\n { method: 'GET' },\n (response) => {\n const surveys = response.surveys || []\n this.instance.persistence?.register({ [SURVEYS]: surveys })\n return callback(surveys)\n }\n )\n } else {\n return callback(existingSurveys)\n }\n }\n\n getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false) {\n this.getSurveys((surveys) => {\n const activeSurveys = surveys.filter((survey) => {\n return !!(survey.start_date && !survey.end_date)\n })\n const conditionMatchedSurveys = activeSurveys.filter((survey) => {\n if (!survey.conditions) {\n return true\n }\n\n // use urlMatchType to validate url condition, fallback to contains for backwards compatibility\n const urlCheck = survey.conditions?.url\n ? surveyUrlValidationMap[survey.conditions?.urlMatchType ?? 'icontains'](survey.conditions.url)\n : true\n const selectorCheck = survey.conditions?.selector\n ? document.querySelector(survey.conditions.selector)\n : true\n return urlCheck && selectorCheck\n })\n const targetingMatchedSurveys = conditionMatchedSurveys.filter((survey) => {\n if (!survey.linked_flag_key && !survey.targeting_flag_key) {\n return true\n }\n const linkedFlagCheck = survey.linked_flag_key\n ? this.instance.featureFlags.isFeatureEnabled(survey.linked_flag_key)\n : true\n const targetingFlagCheck = survey.targeting_flag_key\n ? this.instance.featureFlags.isFeatureEnabled(survey.targeting_flag_key)\n : true\n return linkedFlagCheck && targetingFlagCheck\n })\n\n return callback(targetingMatchedSurveys)\n }, forceReload)\n }\n}\n"]}
|
package/package.json
CHANGED