constituent-form-loader 1.0.6 → 1.0.7
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 +4 -0
- package/bundles/main.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.7] - 2026-11-04
|
|
6
|
+
### Fixed
|
|
7
|
+
- Ignore `height-change` messages from other iframes so a constituent form no longer takes the height of another Blackbaud form on the same page
|
|
8
|
+
|
|
5
9
|
## [1.0.6] - 2026-07-08
|
|
6
10
|
### Fixed
|
|
7
11
|
- Add the same init guard from donor-form-loader to skip re-initializing containers that already have a form mounted
|
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=>{r.querySelector("iframe")||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.
|
|
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=>{r.querySelector("iframe")||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.7"},e),this.setupEventListeners()}setupEventListeners(){window.addEventListener("message",e=>this.handleMessagesFromIFrame(e))}handleMessagesFromIFrame(e){e.source===this.embeddedForm.getIFrame().contentWindow&&"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})();
|