constituent-form-loader 1.0.3 → 1.0.5

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 CHANGED
@@ -2,6 +2,14 @@
2
2
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3
3
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [1.0.5] - 2026-04-07
6
+ ### Fixed
7
+ - Fixed outstanding vulns
8
+
9
+ ## [1.0.4] - 2026-04-07
10
+ ### Fixed
11
+ - npm audit fix to address vulnerabilities
12
+
5
13
  ## [1.0.3] - 2026-01-21
6
14
  ### Changed
7
15
  - Reworked script to work with og-web-loaders
package/bundles/main.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={150(e,t,r){r.r(t),r.d(t,{EmbeddedForm:()=>m,FORM_PARAMETER_MAP:()=>s,FormUrlService:()=>a,LegacyEmbeddedForm:()=>n,PARAMETER_NAMES:()=>o});class a{constructor(e,t,r){this.baseUrl=e,this.config=t,this.urlParams={};for(const e of o)this.urlParams[e]=r.get(i(r,s[e].queryParamName));this.commonParams={bbfms:r.get("bbfms"),bbeml:r.get("bbeml"),host:window.location.href,referral:document.referrer}}buildUrlWithHtmlElement(e,t){const r=this.resolveFormParametersWithLauncher(t);return this.buildUrl(e,r)}buildLegacyUrl(e,t){const r=this.resolveDomParamsAndUrlParams(t);return this.buildUrl(e,r)}buildUrl(e,t){const r=new URL(this.baseUrl);for(const t of Object.keys(e))r.searchParams.set(t,e[t]);for(const e of Object.keys(t.values))r.searchParams.set(s[e].queryParamName,t.values[e]);for(const e of t.domAttributesUsed)r.searchParams.append("domAttribute",e);return this.commonParams.bbfms&&r.searchParams.set("bbfms",this.commonParams.bbfms),this.commonParams.bbeml&&r.searchParams.set("bbeml",this.commonParams.bbeml),r.searchParams.set("host",document.location.href),r.searchParams.set("referral",document.referrer),r.toString()}resolveFormParametersWithLauncher(e){const t={};if(e){const r=new URLSearchParams(e.getAttribute("href")||"");for(const a of o)r.get(i(r,s[a].queryParamName))?t[a]=r.get(i(r,s[a].queryParamName)):e.getAttribute(s[a].attributeName)&&(t[a]=e.getAttribute(s[a].attributeName))}return this.resolveDomParamsAndUrlParams(t)}resolveDomParamsAndUrlParams(e){const t={},r=[],a=Object.keys(this.config).filter(e=>Boolean(this.config[e]));for(const o of a)this.urlParams[o]?t[o]=this.urlParams[o]:(null==e?void 0:e[o])&&(t[o]=null==e?void 0:e[o],r.push(o));return{values:t,domAttributesUsed:r}}}const o=["desid","desname","appealid","campaignid","locale","onetimeamt","rgamt"],s={appealid:{queryParamName:"appealid",attributeName:"appeal-id"},desid:{queryParamName:"desid",attributeName:"des-id"},desname:{queryParamName:"desname",attributeName:"des-name"},campaignid:{queryParamName:"campaignid",attributeName:"campaign-id"},locale:{queryParamName:"locale",attributeName:"locale"},onetimeamt:{queryParamName:"onetimeamt",attributeName:"one-time-amt"},rgamt:{queryParamName:"rgamt",attributeName:"rg-amt"}};function i(e,t){let r=e.keys();for(;;){let e=r.next();if(e.done)break;let a=e.value;if(a.toLowerCase()===t)return a}return""}class n{constructor(e,t){this.formUrlService=e,this.formOptions=t,this.iFrame=this.createIFrame()}getIFrame(){return this.iFrame}postMessage(e){var t;null===(t=this.iFrame.contentWindow)||void 0===t||t.postMessage(e,"https://host.nxt.blackbaud.com")}createIFrame(){const e=this.formUrlService.buildLegacyUrl({svcid:this.formOptions.svcId,formId:this.formOptions.formId,envid:this.formOptions.environmentId,zone:this.formOptions.zone,loaderVersion:this.formOptions.loaderVersion},this.formOptions.formParameterValues);let t=document.createElement("iframe");t.setAttribute("id","form_"+this.formOptions.formId),t.setAttribute("class",this.formOptions.elementClass),t.setAttribute("title","Donation Form"),t.setAttribute("style","background-color: white; max-width: 600px; min-width: 320px; width: 100%; height: 100%; border: none;"),t.setAttribute("scrolling","no"),t.setAttribute("allow","payment; web-share");const r=`${this.formOptions.elementClass}_${this.formOptions.formId}`,a=document.getElementById(r);if(!a)throw Error("Could not find element with ID: "+r);return a.insertBefore(t,null),t.setAttribute("src",e),t}}class m{constructor(e,t,r){this.formUrlService=e,this.formOptions=t,this.container=r,this.iFrame=this.createIFrame()}getIFrame(){return this.iFrame}postMessage(e){var t;null===(t=this.iFrame.contentWindow)||void 0===t||t.postMessage(e,"https://host.nxt.blackbaud.com")}createIFrame(){const e=this.formUrlService.buildUrlWithHtmlElement({formId:this.formOptions.formId,envid:this.formOptions.environmentId,zone:this.formOptions.zone,loaderVersion:this.formOptions.loaderVersion},this.container);let t=document.createElement("iframe");return t.setAttribute("id","form_"+this.formOptions.formId),t.setAttribute("title","Donation Form"),t.setAttribute("style","background-color: white; max-width: 600px; min-width: 320px; width: 100%; height: 100%; border: none;"),t.setAttribute("scrolling","no"),t.setAttribute("allow","payment; web-share"),this.container.insertBefore(t,null),t.setAttribute("src",e),t}}},489(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.initializeWithEnvironmentAndZone=function(e,t){document.querySelectorAll("[data-blackbaud-constituent-form-id]").forEach(r=>{new o(r,e,t)})};const a=r(150);class o{constructor(e,t,r){this.formId=e.getAttribute("data-blackbaud-constituent-form-id"),this.formUrlService=new a.FormUrlService("https://host.nxt.blackbaud.com/constituent-form",{locale:!0},new URLSearchParams(window.location.search)),this.embeddedForm=new a.EmbeddedForm(this.formUrlService,{environmentId:t,formId:this.formId,zone:r,loaderVersion:"1.0.3"},e),this.setupEventListeners()}setupEventListeners(){window.addEventListener("message",e=>this.handleMessagesFromIFrame(e))}handleMessagesFromIFrame(e){"height-change"===e.data.messageType&&this.handleHeightChange(e.data.message.height)}handleHeightChange(e){this.embeddedForm.getIFrame().style.minHeight=e}}}},t={};function r(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.init=function(){(0,t.initializeWithEnvironmentAndZone)(o,s)};const t=r(489),o=document.currentScript.getAttribute("data-envid"),s=document.currentScript.getAttribute("data-zone")??"usa"})(),window.BBConstituentFormLoader=a})();
1
+ (()=>{"use strict";var e={150(e,t,r){r.r(t),r.d(t,{EmbeddedForm:()=>m,FORM_PARAMETER_MAP:()=>s,FormUrlService:()=>a,LegacyEmbeddedForm:()=>n,PARAMETER_NAMES:()=>o});class a{constructor(e,t,r){this.baseUrl=e,this.config=t,this.urlParams={};for(const e of o)this.urlParams[e]=r.get(i(r,s[e].queryParamName));this.commonParams={bbfms:r.get("bbfms"),bbeml:r.get("bbeml"),host:window.location.href,referral:document.referrer}}buildUrlWithHtmlElement(e,t){const r=this.resolveFormParametersWithLauncher(t);return this.buildUrl(e,r)}buildLegacyUrl(e,t){const r=this.resolveDomParamsAndUrlParams(t);return this.buildUrl(e,r)}buildUrl(e,t){const r=new URL(this.baseUrl);for(const t of Object.keys(e))r.searchParams.set(t,e[t]);for(const e of Object.keys(t.values))r.searchParams.set(s[e].queryParamName,t.values[e]);for(const e of t.domAttributesUsed)r.searchParams.append("domAttribute",e);return this.commonParams.bbfms&&r.searchParams.set("bbfms",this.commonParams.bbfms),this.commonParams.bbeml&&r.searchParams.set("bbeml",this.commonParams.bbeml),r.searchParams.set("host",document.location.href),r.searchParams.set("referral",document.referrer),r.toString()}resolveFormParametersWithLauncher(e){const t={};if(e){const r=new URLSearchParams(e.getAttribute("href")||"");for(const a of o)r.get(i(r,s[a].queryParamName))?t[a]=r.get(i(r,s[a].queryParamName)):e.getAttribute(s[a].attributeName)&&(t[a]=e.getAttribute(s[a].attributeName))}return this.resolveDomParamsAndUrlParams(t)}resolveDomParamsAndUrlParams(e){const t={},r=[],a=Object.keys(this.config).filter(e=>Boolean(this.config[e]));for(const o of a)this.urlParams[o]?t[o]=this.urlParams[o]:(null==e?void 0:e[o])&&(t[o]=null==e?void 0:e[o],r.push(o));return{values:t,domAttributesUsed:r}}}const o=["desid","desname","appealid","campaignid","locale","onetimeamt","rgamt"],s={appealid:{queryParamName:"appealid",attributeName:"appeal-id"},desid:{queryParamName:"desid",attributeName:"des-id"},desname:{queryParamName:"desname",attributeName:"des-name"},campaignid:{queryParamName:"campaignid",attributeName:"campaign-id"},locale:{queryParamName:"locale",attributeName:"locale"},onetimeamt:{queryParamName:"onetimeamt",attributeName:"one-time-amt"},rgamt:{queryParamName:"rgamt",attributeName:"rg-amt"}};function i(e,t){let r=e.keys();for(;;){let e=r.next();if(e.done)break;let a=e.value;if(a.toLowerCase()===t)return a}return""}class n{constructor(e,t){this.formUrlService=e,this.formOptions=t,this.iFrame=this.createIFrame()}getIFrame(){return this.iFrame}postMessage(e){var t;null===(t=this.iFrame.contentWindow)||void 0===t||t.postMessage(e,"https://host.nxt.blackbaud.com")}createIFrame(){const e=this.formUrlService.buildLegacyUrl({svcid:this.formOptions.svcId,formId:this.formOptions.formId,envid:this.formOptions.environmentId,zone:this.formOptions.zone,loaderVersion:this.formOptions.loaderVersion},this.formOptions.formParameterValues);let t=document.createElement("iframe");t.setAttribute("id","form_"+this.formOptions.formId),t.setAttribute("class",this.formOptions.elementClass),t.setAttribute("title","Donation Form"),t.setAttribute("style","background-color: white; max-width: 600px; min-width: 320px; width: 100%; height: 100%; border: none;"),t.setAttribute("scrolling","no"),t.setAttribute("allow","payment; web-share");const r=`${this.formOptions.elementClass}_${this.formOptions.formId}`,a=document.getElementById(r);if(!a)throw Error("Could not find element with ID: "+r);return a.insertBefore(t,null),t.setAttribute("src",e),t}}class m{constructor(e,t,r){this.formUrlService=e,this.formOptions=t,this.container=r,this.iFrame=this.createIFrame()}getIFrame(){return this.iFrame}postMessage(e){var t;null===(t=this.iFrame.contentWindow)||void 0===t||t.postMessage(e,"https://host.nxt.blackbaud.com")}createIFrame(){const e=this.formUrlService.buildUrlWithHtmlElement({formId:this.formOptions.formId,envid:this.formOptions.environmentId,zone:this.formOptions.zone,loaderVersion:this.formOptions.loaderVersion},this.container);let t=document.createElement("iframe");return t.setAttribute("id","form_"+this.formOptions.formId),t.setAttribute("title","Donation Form"),t.setAttribute("style","background-color: white; max-width: 600px; min-width: 320px; width: 100%; height: 100%; border: none;"),t.setAttribute("scrolling","no"),t.setAttribute("allow","payment; web-share"),this.container.insertBefore(t,null),t.setAttribute("src",e),t}}},489(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.initializeWithEnvironmentAndZone=function(e,t){document.querySelectorAll("[data-blackbaud-constituent-form-id]").forEach(r=>{new o(r,e,t)})};const a=r(150);class o{constructor(e,t,r){this.formId=e.getAttribute("data-blackbaud-constituent-form-id"),this.formUrlService=new a.FormUrlService("https://host.nxt.blackbaud.com/constituent-form",{locale:!0},new URLSearchParams(window.location.search)),this.embeddedForm=new a.EmbeddedForm(this.formUrlService,{environmentId:t,formId:this.formId,zone:r,loaderVersion:"1.0.5"},e),this.setupEventListeners()}setupEventListeners(){window.addEventListener("message",e=>this.handleMessagesFromIFrame(e))}handleMessagesFromIFrame(e){"height-change"===e.data.messageType&&this.handleHeightChange(e.data.message.height)}handleHeightChange(e){this.embeddedForm.getIFrame().style.minHeight=e}}}},t={};function r(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.init=function(){(0,t.initializeWithEnvironmentAndZone)(o,s)};const t=r(489),o=document.currentScript.getAttribute("data-envid"),s=document.currentScript.getAttribute("data-zone")??"usa"})(),window.BBConstituentFormLoader=a})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "constituent-form-loader",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A deployable front-end project that publishes a JS script to the Blackbaud CDN.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,13 +24,11 @@
24
24
  "@types/jasmine": "^4.3.5",
25
25
  "@types/uuid": "^9.0.4",
26
26
  "async-test-util": "^2.1.1",
27
- "browserify": "^17.0.0",
28
27
  "cross-replace": "^0.2.0",
29
28
  "express": "^4.18.2",
30
29
  "jasmine": "^5.1.0",
31
30
  "jasmine-core": "^5.1.1",
32
31
  "karma": "^6.4.2",
33
- "karma-browserify": "^8.1.0",
34
32
  "karma-chrome-launcher": "^3.2.0",
35
33
  "karma-jasmine": "^5.1.0",
36
34
  "karma-jasmine-html-reporter": "^2.1.0",