Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/engrid.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*
* ENGRID PAGE TEMPLATE ASSETS
*
* Date: Thursday, November 13, 2025 @ 00:28:58 ET
* By: fernando
* Date: Thursday, November 13, 2025 @ 08:00:35 ET
* By: michael
* ENGrid styles: v0.23.0
* ENGrid scripts: v0.23.2
*
Expand Down
72 changes: 70 additions & 2 deletions dist/engrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
*
* ENGRID PAGE TEMPLATE ASSETS
*
* Date: Thursday, November 13, 2025 @ 00:28:58 ET
* By: fernando
* Date: Thursday, November 13, 2025 @ 08:00:35 ET
* By: michael
* ENGrid styles: v0.23.0
* ENGrid scripts: v0.23.2
*
Expand Down Expand Up @@ -26967,6 +26967,71 @@ class AddDAF {
});
}

}
;// CONCATENATED MODULE: ./src/scripts/Bridger.ts

class Bridger {
constructor() {
_defineProperty(this, "endpoint", "https://wwfusprdenbridgercheckeus1.azurewebsites.net/api/createsearch");

_defineProperty(this, "key", "-CDxXc3SdzG6a_LLJGKA_p3qJMnZnnsH3DLDGeK97nwXAzFuFmfh5g==");

_defineProperty(this, "bridgerAmountThreshold", window.BridgerAmountThreshold || 500);

if (!this.shouldRun()) return;
this.createBridgerSearchRecord();
}

shouldRun() {
return window.pageJson.giftProcess && window.pageJson.amount >= this.bridgerAmountThreshold && window.pageJson.currency === "USD";
}

createBridgerSearchRecord() {
this.sendApiRequest().then(data => {//console.log(data);
});
}

async sendApiRequest() {
let data = null;

try {
const body = JSON.stringify({
firstName: this.getUserData("firstName"),
lastName: this.getUserData("lastName"),
address1: `${this.getUserData("address1")} ${this.getUserData("address2")}`,
city: this.getUserData("city"),
country: this.getUserData("country"),
postalCode: this.getUserData("zipCode")
});
const response = await fetch(this.endpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-functions-key": this.key
},
body: body
});

if (response.ok) {
data = await response.json();
} else {
console.log("API request failed");
}
} catch (error) {
console.log("API request failed");
}

return data;
}

getUserData(property) {
if (!window.userData || !window.userData[property] || window.userData[property].startsWith("{")) {
return "";
}

return window.userData[property];
}

}
;// CONCATENATED MODULE: ./src/index.ts
// Uses ENGrid via NPM
Expand All @@ -26987,6 +27052,7 @@ class AddDAF {




const options = {
AutoYear: true,
applePay: false,
Expand Down Expand Up @@ -27155,6 +27221,8 @@ const options = {

unsubscribeAllRadio.closest(".en__field")?.classList.add("hide");
}

new Bridger();
},
onResize: () => console.log("Starter Theme Window Resized"),
onSubmit: () => {
Expand Down
4 changes: 2 additions & 2 deletions dist/engrid.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/engrid.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { AnnualLimit } from "./scripts/annual-limit";
import { OnLoadModal } from "./scripts/on-load-modal";
import MultistepForm from "./scripts/multistep-form";
import { AddDAF } from "./scripts/add-daf";
import { Bridger } from "./scripts/Bridger";

const options: Options = {
AutoYear: true,
Expand Down Expand Up @@ -217,6 +218,7 @@ const options: Options = {
// Hide the unsubscribe all radio button
unsubscribeAllRadio.closest(".en__field")?.classList.add("hide");
}
new Bridger();
},
onResize: () => console.log("Starter Theme Window Resized"),

Expand Down
86 changes: 86 additions & 0 deletions src/scripts/Bridger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
declare global {
interface Window {
userData: Record<string, string>;
pageJson: {
giftProcess: boolean;
amount: number;
currency: string;
};
BridgerAmountThreshold: number;
}
}

export class Bridger {
private endpoint: string =
"https://wwfusprdenbridgercheckeus1.azurewebsites.net/api/createsearch";
private key: string =
"-CDxXc3SdzG6a_LLJGKA_p3qJMnZnnsH3DLDGeK97nwXAzFuFmfh5g==";
private bridgerAmountThreshold: number = window.BridgerAmountThreshold || 500;

constructor() {
if (!this.shouldRun()) return;
this.createBridgerSearchRecord();
}

private shouldRun(): boolean {
return (
window.pageJson.giftProcess &&
window.pageJson.amount >= this.bridgerAmountThreshold &&
window.pageJson.currency === "USD"
);
}

private createBridgerSearchRecord() {
this.sendApiRequest().then((data) => {
//console.log(data);
});
}

private async sendApiRequest() {
let data = null;

try {
const body = JSON.stringify({
firstName: this.getUserData("firstName"),
lastName: this.getUserData("lastName"),
address1: `${this.getUserData("address1")} ${this.getUserData(
"address2"
)}`,
city: this.getUserData("city"),
country: this.getUserData("country"),
postalCode: this.getUserData("zipCode"),
});

const response = await fetch(this.endpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-functions-key": this.key,
},
body: body,
});

if (response.ok) {
data = await response.json();
} else {
console.log("API request failed");
}
} catch (error) {
console.log("API request failed");
}

return data;
}

private getUserData(property: string) {
if (
!window.userData ||
!window.userData[property] ||
window.userData[property].startsWith("{")
) {
return "";
}

return window.userData[property];
}
}
Loading