{"version":3,"sources":["webpack:///./node_modules/@segment/analytics-next/dist/pkg/lib/is-plan-event-enabled.js","webpack:///./node_modules/@segment/analytics-next/dist/pkg/plugins/schema-filter/index.js"],"names":["isPlanEventEnabled","plan","planEvent","_a","_b","enabled","__default","schemaFilter","track","settings","filter","ctx","ev","event","updateEvent","integrations","All","disabledActions","Object","keys","disabledIntegrations","i","disabledRemotePlugins","remotePlugins","forEach","p","int","creationName","push","name","reduce","acc","includes","sub","concat","partnerAction","disabledActionDestinations","version","isLoaded","load","Promise","resolve","type","page","alias","identify","group"],"mappings":"4FAMO,SAASA,EAAmBC,EAAMC,GACvC,IAAIC,EAAIC,EAGR,MAAyF,mBAA/D,OAAdF,QAAoC,IAAdA,OAAuB,EAASA,EAAUG,SACnEH,EAAUG,QAIiH,QAA5HD,EAA2E,QAArED,EAAc,OAATF,QAA0B,IAATA,OAAkB,EAASA,EAAKK,iBAA8B,IAAPH,OAAgB,EAASA,EAAGE,eAA4B,IAAPD,GAAgBA,CAC9J,CAhBA,iC,oCCAA,yEAsCO,SAASG,EAAaC,EAAOC,GAClC,SAASC,EAAOC,GACd,IAAIV,EAAOO,EACPI,EAAKD,EAAIE,MAAMA,MAEnB,GAAIZ,GAAQW,EAAI,CACd,IAAIV,EAAYD,EAAKW,GAErB,IAAK,YAAmBX,EAAMC,GAK5B,OAJAS,EAAIG,YAAY,eAAgB,YAAS,YAAS,CAAC,EAAGH,EAAIE,MAAME,cAAe,CAC7EC,KAAK,EACL,cAAc,KAETL,EAEP,IAAIM,EAlDZ,SAAoChB,EAAMQ,GACxC,IAAIN,EAAIC,EAER,IAAKH,IAASiB,OAAOC,KAAKlB,GACxB,MAAO,CAAC,EAGV,IAAImB,EAAuBnB,EAAKc,aAAeG,OAAOC,KAAKlB,EAAKc,cAAcL,QAAO,SAAUW,GAC7F,OAAgC,IAAzBpB,EAAKc,aAAaM,EAC3B,IAAK,GAGDC,EAAwB,GAQ5B,OAPmC,QAAjCnB,EAAKM,EAASc,qBAAkC,IAAPpB,EAAgBA,EAAK,IAAIqB,SAAQ,SAAUC,GACpFL,EAAqBI,SAAQ,SAAUE,GACjCD,EAAEE,cAAgBD,GACpBJ,EAAsBM,KAAKH,EAAEI,KAEjC,GACF,KAC0C,QAAjCzB,EAAKK,EAASc,qBAAkC,IAAPnB,EAAgBA,EAAK,IAAI0B,QAAO,SAAUC,EAAKN,GAW/F,OAVIA,EAAEhB,SAAwB,eACxBa,EAAsBU,SAASP,EAAEI,OAEnCJ,EAAEhB,SAAwB,cAAEe,SAC5B,SAAUS,GACR,OAAOF,EAAI,GAAGG,OAAOT,EAAEI,KAAM,KAAKK,OAAOD,EAAIE,iBAAkB,CACjE,IAIGJ,CACT,GAAG,CAAC,EACN,CAiB8BK,CAA2BlC,EAAWO,GAC5DE,EAAIG,YAAY,eAAgB,YAAS,YAAS,YAAS,CAAC,EAAGH,EAAIE,MAAME,cAA6B,OAAdb,QAAoC,IAAdA,OAAuB,EAASA,EAAUa,cAAeE,GAE3K,CAEA,OAAON,CACT,CAEA,MAAO,CACLkB,KAAM,gBACNQ,QAAS,QACTC,SAAU,WACR,OAAO,CACT,EACAC,KAAM,WACJ,OAAOC,QAAQC,SACjB,EACAC,KAAM,SACNC,KAAMjC,EACNkC,MAAOlC,EACPF,MAAOE,EACPmC,SAAUnC,EACVoC,MAAOpC,EAEX,C","file":"js/schemaFilter-60fe94fa7ac63066d851.chunk.js","sourcesContent":["/**\n * Determines whether a track event is allowed to be sent based on the\n * user's tracking plan.\n * If the user does not have a tracking plan or the event is allowed based\n * on the tracking plan configuration, returns true.\n */\nexport function isPlanEventEnabled(plan, planEvent) {\n var _a, _b; // Always prioritize the event's `enabled` status\n\n\n if (typeof (planEvent === null || planEvent === void 0 ? void 0 : planEvent.enabled) === 'boolean') {\n return planEvent.enabled;\n } // Assume absence of a tracking plan means events are enabled\n\n\n return (_b = (_a = plan === null || plan === void 0 ? void 0 : plan.__default) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : true;\n}","import { __assign } from \"tslib\";\nimport { isPlanEventEnabled } from '../../lib/is-plan-event-enabled';\n\nfunction disabledActionDestinations(plan, settings) {\n var _a, _b;\n\n if (!plan || !Object.keys(plan)) {\n return {};\n }\n\n var disabledIntegrations = plan.integrations ? Object.keys(plan.integrations).filter(function (i) {\n return plan.integrations[i] === false;\n }) : []; // This accounts for cases like Fullstory, where the settings.integrations\n // contains a \"Fullstory\" object but settings.remotePlugins contains \"Fullstory (Actions)\"\n\n var disabledRemotePlugins = [];\n ((_a = settings.remotePlugins) !== null && _a !== void 0 ? _a : []).forEach(function (p) {\n disabledIntegrations.forEach(function (int) {\n if (p.creationName == int) {\n disabledRemotePlugins.push(p.name);\n }\n });\n });\n return ((_b = settings.remotePlugins) !== null && _b !== void 0 ? _b : []).reduce(function (acc, p) {\n if (p.settings['subscriptions']) {\n if (disabledRemotePlugins.includes(p.name)) {\n // @ts-expect-error element implicitly has an 'any' type because p.settings is a JSONObject\n p.settings['subscriptions'].forEach( // @ts-expect-error parameter 'sub' implicitly has an 'any' type\n function (sub) {\n return acc[\"\".concat(p.name, \" \").concat(sub.partnerAction)] = false;\n });\n }\n }\n\n return acc;\n }, {});\n}\n\nexport function schemaFilter(track, settings) {\n function filter(ctx) {\n var plan = track;\n var ev = ctx.event.event;\n\n if (plan && ev) {\n var planEvent = plan[ev];\n\n if (!isPlanEventEnabled(plan, planEvent)) {\n ctx.updateEvent('integrations', __assign(__assign({}, ctx.event.integrations), {\n All: false,\n 'Segment.io': true\n }));\n return ctx;\n } else {\n var disabledActions = disabledActionDestinations(planEvent, settings);\n ctx.updateEvent('integrations', __assign(__assign(__assign({}, ctx.event.integrations), planEvent === null || planEvent === void 0 ? void 0 : planEvent.integrations), disabledActions));\n }\n }\n\n return ctx;\n }\n\n return {\n name: 'Schema Filter',\n version: '0.1.0',\n isLoaded: function isLoaded() {\n return true;\n },\n load: function load() {\n return Promise.resolve();\n },\n type: 'before',\n page: filter,\n alias: filter,\n track: filter,\n identify: filter,\n group: filter\n };\n}"],"sourceRoot":""}