@eventvisor/module-pixel 0.17.0 → 0.19.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/CHANGELOG.md +16 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.19.0](https://github.com/eventvisor/eventvisor/compare/v0.18.0...v0.19.0) (2026-02-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @eventvisor/module-pixel
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.18.0](https://github.com/eventvisor/eventvisor/compare/v0.17.0...v0.18.0) (2026-02-06)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @eventvisor/module-pixel
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [0.17.0](https://github.com/eventvisor/eventvisor/compare/v0.16.0...v0.17.0) (2026-01-10)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @eventvisor/module-pixel
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.EventvisorPixelModule=t():e.EventvisorPixelModule=t()}(this,()=>(()=>{"use strict";var e={};return{166
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.EventvisorPixelModule=t():e.EventvisorPixelModule=t()}(this,()=>(()=>{"use strict";var e={};return{166(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function l(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,l)}u((n=n.apply(e,t||[])).next())})},n=this&&this.__generator||function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=l(0),i.throw=l(1),i.return=l(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(l){return function(u){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.createPixelModule=function(e){var t=this;void 0===e&&(e={});var o=e.name;return{name:void 0===o?"pixel":o,handle:function(e,o){return r(t,[e,o],void 0,function(e,t){var r,o,a,i,l,u,c,s,f,p,d,h,y,m,b=e.step,v=e.payload,x=t.logger,w=t.sourceResolver;return n(this,function(e){switch(e.label){case 0:if(!(r=b.params))return x.error("[module-pixel] No params found in step",{step:b}),[2];if(!r.snippet)return x.error("[module-pixel] No snippet found in params",{params:r}),[2];if(o=r.selector||"body",!(a=document.querySelector(o)))return x.error("[module-pixel] No element found with selector",{selector:o}),[2];i=r.snippet,l=[];try{l=Array.from(i.matchAll(/\{\{\s*([^}]+)\s*\}\}/g),function(e){return e})}catch(e){x.error("[module-pixel] Error parsing snippet for variable keys",{snippet:i,error:e})}if(!(l.length>0))return[3,4];u=0,c=l,e.label=1;case 1:return u<c.length?(s=c[u],f=s[0],p=s[1],d=p.trim(),[4,w.resolve(d,{payload:v})]):[3,4];case 2:h=e.sent(),i=i.replace(f,h),e.label=3;case 3:return u++,[3,1];case 4:return y=new DOMParser,(m=y.parseFromString(i,"text/html")).querySelectorAll("script").forEach(function(e){var t=document.createElement("script");Array.from(e.attributes).forEach(function(e){t.setAttribute(e.name,e.value)}),t.textContent=e.textContent,a.appendChild(t)}),Array.from(m.body.children).filter(function(e){return"SCRIPT"!==e.tagName}).forEach(function(e){a.appendChild(e.cloneNode(!0))}),[2]}})})}}}}}[166].call(e,0,e),e})());
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA+B,sBAAID,IAEnCD,EAA4B,sBAAIC,GACjC,CATD,CASGK,KAAM,I,uBCNLC,EAAsB,CAAC,E,
|
|
1
|
+
{"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA+B,sBAAID,IAEnC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UM,YAAcP,EAAOO,YAG/B7B,EAAG8B,YAAYP,EACjB,GAGsBnB,MAAMC,KAAKa,EAAIa,KAAKC,UAAUC,OAClD,SAACC,GAAU,MAAkB,WAAlBA,EAAMC,OAAN,GAECd,QAAQ,SAACe,GACrBpC,EAAG8B,YAAYM,EAAQC,WAAU,GACnC,G,UAGN,C,GDxFoB,KAAKC,KAAKlD,EAAoB,EAAEA,G","sources":["webpack://EventvisorPixelModule/webpack/universalModuleDefinition","webpack://EventvisorPixelModule/webpack/startup","webpack://EventvisorPixelModule/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"EventvisorPixelModule\"] = factory();\n\telse\n\t\troot[\"EventvisorPixelModule\"] = factory();\n})(this, () => {\nreturn ","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = {};\n__webpack_modules__[166].call(__webpack_exports__,0,__webpack_exports__);\n","import type { Module } from \"@eventvisor/sdk\";\n\nexport type PixelModuleOptions = {\n name?: string;\n};\n\nexport function createPixelModule(options: PixelModuleOptions = {}): Module {\n const { name = \"pixel\" } = options;\n\n return {\n name,\n\n handle: async ({ step, payload }, { logger, sourceResolver }) => {\n const { params } = step;\n\n if (!params) {\n logger.error(\"[module-pixel] No params found in step\", { step });\n\n return;\n }\n\n if (!params.snippet) {\n logger.error(\"[module-pixel] No snippet found in params\", { params });\n\n return;\n }\n\n const selector = params.selector || \"body\";\n\n const el = document.querySelector(selector);\n\n if (!el) {\n logger.error(\"[module-pixel] No element found with selector\", { selector });\n\n return;\n }\n\n let snippet = params.snippet;\n\n let variableKeys: [replace: string, source: string][] = [];\n\n try {\n variableKeys = Array.from(\n snippet.matchAll(/\\{\\{\\s*([^}]+)\\s*\\}\\}/g),\n (match: any) => match,\n );\n } catch (e) {\n logger.error(\"[module-pixel] Error parsing snippet for variable keys\", {\n snippet,\n error: e,\n });\n }\n\n if (variableKeys.length > 0) {\n for (const [replace, variableKey] of variableKeys) {\n const source = variableKey.trim();\n const variableValue = await sourceResolver.resolve(source, { payload });\n\n snippet = snippet.replace(replace, variableValue); // @TODO: /g?\n }\n }\n\n // Parse the snippet to handle both script tags and regular HTML\n const parser = new DOMParser();\n const doc = parser.parseFromString(snippet, \"text/html\");\n\n // Handle script tags separately to ensure they execute\n const scripts = doc.querySelectorAll(\"script\");\n scripts.forEach((script) => {\n const newScript = document.createElement(\"script\");\n\n // Copy all attributes from the original script\n Array.from(script.attributes).forEach((attr) => {\n newScript.setAttribute(attr.name, attr.value);\n });\n\n // Copy the script content\n newScript.textContent = script.textContent;\n\n // Append to the target element\n el.appendChild(newScript);\n });\n\n // Handle other HTML content (non-script elements)\n const otherElements = Array.from(doc.body.children).filter(\n (child) => child.tagName !== \"SCRIPT\",\n );\n otherElements.forEach((element) => {\n el.appendChild(element.cloneNode(true));\n });\n },\n };\n}\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_exports__","options","name","handle","step","payload","logger","sourceResolver","params","error","snippet","selector","el","document","querySelector","variableKeys","Array","from","matchAll","match","e","length","replace","variableKey","source","trim","resolve","variableValue","parser","DOMParser","doc","parseFromString","querySelectorAll","forEach","script","newScript","createElement","attributes","attr","setAttribute","value","textContent","appendChild","body","children","filter","child","tagName","element","cloneNode","call"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventvisor/module-pixel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Eventvisor pixel module",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"url": "https://github.com/eventvisor/eventvisor/issues"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@eventvisor/sdk": "0.
|
|
41
|
+
"@eventvisor/sdk": "0.19.0"
|
|
42
42
|
},
|
|
43
43
|
"license": "MIT",
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "91340e901e9c9cf243f461c766cf0c4143545d03"
|
|
45
45
|
}
|