constituent-form-loader 1.0.2 → 1.0.4
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 +8 -1
- package/README.md +4 -2
- package/bundles/main.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,15 @@
|
|
|
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.4] - 2026-04-07
|
|
6
|
+
### Fixed
|
|
7
|
+
- npm audit fix to address vulnerabilities
|
|
5
8
|
|
|
6
|
-
## [1.0.
|
|
9
|
+
## [1.0.3] - 2026-01-21
|
|
10
|
+
### Changed
|
|
11
|
+
- Reworked script to work with og-web-loaders
|
|
12
|
+
|
|
13
|
+
## [1.0.2] - 2026-01-20
|
|
7
14
|
### Added
|
|
8
15
|
- Initial release of index.js
|
|
9
16
|
|
package/README.md
CHANGED
|
@@ -7,11 +7,13 @@ Tests can be run with command `npm run test`.
|
|
|
7
7
|
|
|
8
8
|
To run locally, run the command `npm run dev` and then run `node demo/app.js` to run a local Express server.
|
|
9
9
|
Access https://localhost:3000 in your browser to view the demo page.
|
|
10
|
-
When running express locally, you may want to replace `CONSTITUENT_FORM_LOADER_VERSION` in `
|
|
10
|
+
When running express locally, you may want to replace `CONSTITUENT_FORM_LOADER_VERSION` in `constituent-form-loaders.ts` with a valid version, found in `package.json`
|
|
11
11
|
If you need to make changes to what form is loaded, or any other parameters, this can be done in `demo/app.js`.
|
|
12
12
|
|
|
13
13
|
To test passthrough parameters, update `demo/app.js` to use the following format:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
```
|
|
16
|
+
<div data-blackbaud-constituent-form-id="74bd559f-8bad-4e5b-93e2-8c51ba494d35" locale="fr-CA"></div>
|
|
17
|
+
```
|
|
16
18
|
|
|
17
19
|
Note: Passthrough parameters are all optional so you would only need to include what parameters you want to passthrough.
|
package/bundles/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={
|
|
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.4"},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
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A deployable front-end project that publishes a JS script to the Blackbaud CDN.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,6 +53,6 @@
|
|
|
53
53
|
"publishToNPM": true
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@blackbaud-internal/form-loader-core": "1.0.
|
|
56
|
+
"@blackbaud-internal/form-loader-core": "1.0.12"
|
|
57
57
|
}
|
|
58
58
|
}
|