@ptcwebops/ptcw-design 2.9.1 → 2.9.3
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/dist/cjs/embedded-form_9.cjs.entry.js +57 -48
- package/dist/cjs/ptc-pricing-packaging-table.cjs.entry.js +96 -51
- package/dist/collection/components/organism-bundles/form/embedded-form/embedded-form.js +1 -1
- package/dist/collection/components/ptc-data-lookup/ptc-data-lookup.css +29 -0
- package/dist/collection/components/ptc-data-lookup/ptc-data-lookup.js +1 -0
- package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.js +96 -51
- package/dist/collection/components/ptc-textfield/ptc-textfield.js +1 -1
- package/dist/collection/utils/elq-lib.js +53 -45
- package/dist/custom-elements/index.js +153 -99
- package/dist/esm/embedded-form_9.entry.js +57 -48
- package/dist/esm/ptc-pricing-packaging-table.entry.js +96 -51
- package/dist/ptcw-design/p-220f86c0.entry.js +1 -0
- package/dist/ptcw-design/{p-b8b59f02.entry.js → p-6faf3ced.entry.js} +10 -10
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.d.ts +7 -0
- package/dist/types/utils/elq-lib.d.ts +4 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/ptcw-design/p-58c140ab.entry.js +0 -1
package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.js
CHANGED
|
@@ -174,6 +174,87 @@ export class PtcPricingPackagingTable {
|
|
|
174
174
|
this.handleScrollButtonsVisibility();
|
|
175
175
|
this.handleFillEmptySpace();
|
|
176
176
|
};
|
|
177
|
+
this.preProcessTableDescription = () => {
|
|
178
|
+
let tableDescription = this.el.querySelector('[slot="table-description"]');
|
|
179
|
+
if (tableDescription) {
|
|
180
|
+
this.tableDescription = tableDescription;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
this.preProcessdesktopHeaderFirstCell = () => {
|
|
184
|
+
let desktopHeaderFirstCellSlot = this.el.querySelector('[slot="desktop-header-first-cell"]');
|
|
185
|
+
let desktopHeaderFirstCellText = desktopHeaderFirstCellSlot.innerHTML;
|
|
186
|
+
this.el.insertAdjacentHTML('afterbegin', `<span slot="placeholder-desktop-header-first-cell">${desktopHeaderFirstCellText}</span>`);
|
|
187
|
+
};
|
|
188
|
+
this.preProcessColumnHeaders = () => {
|
|
189
|
+
let columnHeaders = this.el.querySelectorAll('[slot^="column-header"]');
|
|
190
|
+
for (let i = 0; i < this.dataCols; i++) {
|
|
191
|
+
let slotValue = columnHeaders[i].getAttribute('slot');
|
|
192
|
+
let headerText = columnHeaders[i].innerHTML;
|
|
193
|
+
this.el.insertAdjacentHTML('afterbegin', `<span slot="placeholder-${slotValue}">${headerText}</span>`);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
this.preProcessHeaderLinks = () => {
|
|
197
|
+
let headerLink;
|
|
198
|
+
for (let i = 0; i < this.dataCols; i++) {
|
|
199
|
+
headerLink = this.el.querySelector(`[slot^="header-link-${i + 1}"]`);
|
|
200
|
+
if (headerLink) {
|
|
201
|
+
let linkHref = headerLink.getAttribute('href');
|
|
202
|
+
let linkText = headerLink.innerHTML;
|
|
203
|
+
let linkTarget = headerLink.getAttribute('target');
|
|
204
|
+
this.columnHeaderLinks.push({ linkHref, linkText, linkTarget });
|
|
205
|
+
headerLink.remove();
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.columnHeaderLinks.push(null);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
this.preProcessRowHeaders = () => {
|
|
213
|
+
let rowHeader;
|
|
214
|
+
for (let i = 0; i < this.dataRows; i++) {
|
|
215
|
+
rowHeader = this.el.querySelector(`[slot^="row-header-${i + 1}"]`);
|
|
216
|
+
let tableRowHeaderP = rowHeader.querySelectorAll('.table-row-header-p');
|
|
217
|
+
for (let i = 0; i < tableRowHeaderP.length; i++) {
|
|
218
|
+
let ptcPara = document.createElement('ptc-para');
|
|
219
|
+
ptcPara.setAttribute("font-size", "small");
|
|
220
|
+
ptcPara.setAttribute("font-weight", "w-6");
|
|
221
|
+
ptcPara.setAttribute("para-align", "left");
|
|
222
|
+
ptcPara.setAttribute("para-color", "primary-grey");
|
|
223
|
+
ptcPara.setAttribute("para-line-h", "line-height-p");
|
|
224
|
+
ptcPara.setAttribute("para-margin", "margin-flush");
|
|
225
|
+
ptcPara.innerHTML = tableRowHeaderP[i].innerHTML;
|
|
226
|
+
tableRowHeaderP[i].replaceWith(ptcPara);
|
|
227
|
+
}
|
|
228
|
+
let slotValue = rowHeader.getAttribute('slot');
|
|
229
|
+
let headerContent = rowHeader.innerHTML;
|
|
230
|
+
this.el.insertAdjacentHTML('afterbegin', `<div slot="desktop-${slotValue}">${headerContent}</div><div slot="mobile-${slotValue}">${headerContent}</div>`);
|
|
231
|
+
rowHeader.remove();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
this.preProcessCtaButtons = () => {
|
|
235
|
+
let ctaButton;
|
|
236
|
+
this.showCtaButtonsRow = false;
|
|
237
|
+
for (let i = 0; i < this.dataCols; i++) {
|
|
238
|
+
ctaButton = this.el.querySelector(`[slot^="cta-button-${i + 1}"]`);
|
|
239
|
+
if (ctaButton) {
|
|
240
|
+
let linkHref = ctaButton.getAttribute('href');
|
|
241
|
+
let linkText = ctaButton.innerHTML;
|
|
242
|
+
let linkTarget = ctaButton.getAttribute('target');
|
|
243
|
+
this.ctaButtons.push({ linkHref, linkText, linkTarget });
|
|
244
|
+
ctaButton.remove();
|
|
245
|
+
this.showCtaButtonsRow = true;
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
this.ctaButtons.push(null);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
this.preProcessDisclaimers = () => {
|
|
253
|
+
let disclaimers = this.el.querySelectorAll('[slot^="disclaimer"]');
|
|
254
|
+
for (let i = 0; i < this.disclaimerCount; i++) {
|
|
255
|
+
this.disclaimers.push(disclaimers[i].innerHTML);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
177
258
|
this.pageWithSubnav = false;
|
|
178
259
|
this.tableTitle = undefined;
|
|
179
260
|
this.tableSubTitle = "";
|
|
@@ -199,50 +280,13 @@ export class PtcPricingPackagingTable {
|
|
|
199
280
|
this.tableDescription = undefined;
|
|
200
281
|
}
|
|
201
282
|
componentWillLoad() {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.
|
|
209
|
-
let columnHeaders = this.el.querySelectorAll('[slot^="column-header"]');
|
|
210
|
-
for (let i = 0; i < this.dataCols; i++) {
|
|
211
|
-
let slotValue = columnHeaders[i].getAttribute('slot');
|
|
212
|
-
let headerText = columnHeaders[i].innerHTML;
|
|
213
|
-
this.el.insertAdjacentHTML('afterbegin', `<span slot="placeholder-${slotValue}">${headerText}</span>`);
|
|
214
|
-
}
|
|
215
|
-
let headerLinks = this.el.querySelectorAll('[slot^="header-link"]');
|
|
216
|
-
if (headerLinks.length > 0) {
|
|
217
|
-
for (let i = 0; i < this.dataCols; i++) {
|
|
218
|
-
let linkHref = headerLinks[i].getAttribute('href');
|
|
219
|
-
let linkText = headerLinks[i].innerHTML;
|
|
220
|
-
let linkTarget = headerLinks[i].getAttribute('target');
|
|
221
|
-
this.columnHeaderLinks.push({ linkHref, linkText, linkTarget });
|
|
222
|
-
headerLinks[i].remove();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
let rowHeaders = this.el.querySelectorAll('[slot^="row-header"]');
|
|
226
|
-
for (let i = 0; i < this.dataRows; i++) {
|
|
227
|
-
let slotValue = rowHeaders[i].getAttribute('slot');
|
|
228
|
-
let headerText = rowHeaders[i].innerHTML;
|
|
229
|
-
this.el.insertAdjacentHTML('afterbegin', `<span slot="desktop-${slotValue}">${headerText}</span><span slot="mobile-${slotValue}">${headerText}</span>`);
|
|
230
|
-
rowHeaders[i].remove();
|
|
231
|
-
}
|
|
232
|
-
let ctaButtons = this.el.querySelectorAll('[slot^="cta-button"]');
|
|
233
|
-
this.showCtaButtonsRow = (ctaButtons.length !== 0);
|
|
234
|
-
for (let i = 0; i < this.dataCols; i++) {
|
|
235
|
-
this.ctaButtons.push({
|
|
236
|
-
linkHref: ctaButtons[i].getAttribute('href'),
|
|
237
|
-
linkText: ctaButtons[i].innerHTML,
|
|
238
|
-
linkTarget: ctaButtons[i].getAttribute('target')
|
|
239
|
-
});
|
|
240
|
-
ctaButtons[i].remove();
|
|
241
|
-
}
|
|
242
|
-
let disclaimers = this.el.querySelectorAll('[slot^="disclaimer"]');
|
|
243
|
-
for (let i = 0; i < this.disclaimerCount; i++) {
|
|
244
|
-
this.disclaimers.push(disclaimers[i].innerHTML);
|
|
245
|
-
}
|
|
283
|
+
this.preProcessTableDescription();
|
|
284
|
+
this.preProcessdesktopHeaderFirstCell();
|
|
285
|
+
this.preProcessColumnHeaders();
|
|
286
|
+
this.preProcessHeaderLinks();
|
|
287
|
+
this.preProcessRowHeaders();
|
|
288
|
+
this.preProcessCtaButtons();
|
|
289
|
+
this.preProcessDisclaimers();
|
|
246
290
|
}
|
|
247
291
|
componentDidLoad() {
|
|
248
292
|
this.handleTableReset();
|
|
@@ -269,7 +313,7 @@ export class PtcPricingPackagingTable {
|
|
|
269
313
|
return h("div", { id: "table-header", class: this.headerType, onScroll: () => this.handleHorizontalScroll() }, h("div", { class: `desktop-header-first-cell` }, (this.isDesktopView) ?
|
|
270
314
|
h("ptc-para", { "font-size": "medium", "font-weight": "w-7", "para-align": "left", "para-color": "white", "para-line-h": "line-height-p", "para-margin": "margin-flush" }, h("slot", { name: "desktop-header-first-cell" }))
|
|
271
315
|
: null, h("div", { class: "scroll-button", id: "previous-scroll-button" }, h("div", { onClick: () => this.handleBackwardScroll() }, h("icon-asset", { type: "solid", size: "medium", name: "chevron-left", color: "primary-gray" }), h("ptc-para", { "font-size": "small", "font-weight": "w-6", "para-align": "justify", "para-color": "primary-grey", "para-line-h": "line-height-p", "para-margin": "margin-flush" }, "More"))), h("div", { class: "scroll-button", id: "next-scroll-button" }, h("div", { onClick: () => this.handleForwardScroll() }, h("ptc-para", { "font-size": "small", "font-weight": "w-6", "para-align": "justify", "para-color": "primary-grey", "para-line-h": "line-height-p", "para-margin": "margin-flush" }, "More"), h("icon-asset", { type: "solid", size: "medium", name: "chevron-right", color: "primary-gray" })))), ([...Array(this.dataCols).keys()]).map(col => {
|
|
272
|
-
return h("div", { class: `table-cell ${(col + 1) === this.dataCols ? "table-last-cell" : ""}` }, h("ptc-para", { "font-size": "medium", "font-weight": "w-7", "para-align": "center", "para-color": "white", "para-line-h": "line-height-densest", "para-margin": "margin-flush", "para-z-index": "z-1" }, h("slot", { name: `column-header-${col + 1}` })), (this.columnHeaderLinks.length === this.dataCols) ? h(Fragment, null, h("ptc-spacer", { breakpoint: 'small', size: "small" }), h("ptc-spacer", { breakpoint: 'x-small', size: "medium" }), h("ptc-link", { "font-size": "medium", "font-weight": "w-extrabold", href: `${this.columnHeaderLinks[col].linkHref}`, "link-area": "undefined", target: `${this.columnHeaderLinks[col].linkTarget}`, theme: "d-green-underline", styles: "a.ptc-link {line-height: var(--ptc-line-height-p);}" }, this.isDesktopView ?
|
|
316
|
+
return h("div", { class: `table-cell ${(col + 1) === this.dataCols ? "table-last-cell" : ""}` }, h("ptc-para", { "font-size": "medium", "font-weight": "w-7", "para-align": "center", "para-color": "white", "para-line-h": "line-height-densest", "para-margin": "margin-flush", "para-z-index": "z-1" }, h("slot", { name: `column-header-${col + 1}` })), ((this.columnHeaderLinks.length === this.dataCols) && (this.columnHeaderLinks[col])) ? h(Fragment, null, h("ptc-spacer", { breakpoint: 'small', size: "small" }), h("ptc-spacer", { breakpoint: 'x-small', size: "medium" }), h("ptc-link", { "font-size": "medium", "font-weight": "w-extrabold", href: `${this.columnHeaderLinks[col].linkHref}`, "link-area": "undefined", target: `${this.columnHeaderLinks[col].linkTarget}`, theme: "d-green-underline", styles: "a.ptc-link {line-height: var(--ptc-line-height-p);}" }, this.isDesktopView ?
|
|
273
317
|
h("ptc-tooltip", { class: (col === (this.dataCols - 1)) ? "last-column-tooltip" : "", "text-display": "inline", "max-length": "30", "z-index": "z-2", description: this.columnHeaderLinks[col].linkText, position: "top" })
|
|
274
318
|
: this.columnHeaderLinks[col].linkText)) : null);
|
|
275
319
|
}), h("div", { class: `table-filler-cell ${this.showFillerCells ? "show" : ""}` }));
|
|
@@ -278,15 +322,15 @@ export class PtcPricingPackagingTable {
|
|
|
278
322
|
return h("div", { id: "table-header-placeholder", class: this.headerType }, h("div", { class: `desktop-header-first-cell` }, (this.isDesktopView) ?
|
|
279
323
|
h("ptc-para", { "font-size": "medium", "font-weight": "w-7", "para-align": "left", "para-color": "white", "para-line-h": "line-height-p", "para-margin": "margin-flush" }, h("slot", { name: "placeholder-desktop-header-first-cell" }))
|
|
280
324
|
: null), ([...Array(this.dataCols).keys()]).map(col => {
|
|
281
|
-
return h("div", { class: `table-cell ${(col + 1) === this.dataCols ? "table-last-cell" : ""}` }, h("ptc-para", { "font-size": "medium", "font-weight": "w-7", "para-align": "center", "para-color": "white", "para-line-h": "line-height-densest", "para-margin": "margin-flush", "para-z-index": "z-1" }, h("slot", { name: `placeholder-column-header-${col + 1}` })), (this.columnHeaderLinks.length === this.dataCols) ? h(Fragment, null, h("ptc-spacer", { breakpoint: 'small', size: "small" }), h("ptc-spacer", { breakpoint: 'x-small', size: "medium" }), h("ptc-link", { "font-size": "medium", "font-weight": "w-extrabold", href: `${this.columnHeaderLinks[col].linkHref}`, "link-area": "undefined", target: `${this.columnHeaderLinks[col].linkTarget}`, theme: "d-green-underline", styles: "a.ptc-link {line-height: var(--ptc-line-height-p);}" }, this.isDesktopView ?
|
|
325
|
+
return h("div", { class: `table-cell ${(col + 1) === this.dataCols ? "table-last-cell" : ""}` }, h("ptc-para", { "font-size": "medium", "font-weight": "w-7", "para-align": "center", "para-color": "white", "para-line-h": "line-height-densest", "para-margin": "margin-flush", "para-z-index": "z-1" }, h("slot", { name: `placeholder-column-header-${col + 1}` })), ((this.columnHeaderLinks.length === this.dataCols) && (this.columnHeaderLinks[col])) ? h(Fragment, null, h("ptc-spacer", { breakpoint: 'small', size: "small" }), h("ptc-spacer", { breakpoint: 'x-small', size: "medium" }), h("ptc-link", { "font-size": "medium", "font-weight": "w-extrabold", href: `${this.columnHeaderLinks[col].linkHref}`, "link-area": "undefined", target: `${this.columnHeaderLinks[col].linkTarget}`, theme: "d-green-underline", styles: "a.ptc-link {line-height: var(--ptc-line-height-p);}" }, this.isDesktopView ?
|
|
282
326
|
h("ptc-tooltip", { class: (col === (this.dataCols - 1)) ? "last-column-tooltip" : "", "text-display": "inline", "max-length": "30", "z-index": "z-2", description: this.columnHeaderLinks[col].linkText, position: "top" })
|
|
283
327
|
: this.columnHeaderLinks[col].linkText)) : null);
|
|
284
328
|
}), h("div", { class: `table-filler-cell ${this.showFillerCells ? "show" : ""}` }));
|
|
285
329
|
};
|
|
286
330
|
const TableDataRows = () => {
|
|
287
331
|
return ([...Array(this.dataRows).keys()]).map(row => {
|
|
288
|
-
return h(Fragment, null, h("div", { class: "mobile-sticky-row-header" }, h("
|
|
289
|
-
h("div", { class: `desktop-sticky-row-header ${(this.isDesktopView && (row % 2 != 0)) ? "desktop-alternate-row" : ""}` }, h("
|
|
332
|
+
return h(Fragment, null, h("div", { class: "mobile-sticky-row-header" }, h("slot", { name: `mobile-row-header-${row + 1}` })), h("div", { class: `table-row ${(this.isDesktopView && (row % 2 != 0)) ? "desktop-alternate-row" : ""}` }, (this.isDesktopView) ?
|
|
333
|
+
h("div", { class: `desktop-sticky-row-header ${(this.isDesktopView && (row % 2 != 0)) ? "desktop-alternate-row" : ""}` }, h("slot", { name: `desktop-row-header-${row + 1}` })) : null, ([...Array(this.dataCols).keys()]).map(col => {
|
|
290
334
|
return h("div", { class: `table-cell ${(col + 1) === this.dataCols ? "table-last-cell" : ""}` }, h("slot", { name: `cell-r${row + 1}-c${col + 1}` }));
|
|
291
335
|
}), h("div", { class: `table-filler-cell ${this.showFillerCells ? "show" : ""}` })));
|
|
292
336
|
});
|
|
@@ -296,9 +340,10 @@ export class PtcPricingPackagingTable {
|
|
|
296
340
|
h("div", { class: "table-cta-row" }, (this.isDesktopView) ?
|
|
297
341
|
h("div", { class: "desktop-sticky-row-header" })
|
|
298
342
|
: null, ([...Array(this.dataCols).keys()]).map(col => {
|
|
299
|
-
return h("div", { class: `table-cell ${(col + 1) === this.dataCols ? "table-last-cell" : ""}` },
|
|
300
|
-
h("ptc-
|
|
301
|
-
|
|
343
|
+
return h("div", { class: `table-cell ${(col + 1) === this.dataCols ? "table-last-cell" : ""}` }, (this.ctaButtons[col]) ?
|
|
344
|
+
h("ptc-button", { type: "link", color: "ptc-tertiary", "link-href": this.ctaButtons[col].linkHref, target: `${this.ctaButtons[col].linkTarget}` }, this.isDesktopView ?
|
|
345
|
+
h("ptc-tooltip", { class: (col === (this.dataCols - 1)) ? "last-column-tooltip" : "", "text-display": "inline", "max-length": "30", "z-index": "z-2", description: this.ctaButtons[col].linkText, position: "top" })
|
|
346
|
+
: this.ctaButtons[col].linkText) : null);
|
|
302
347
|
}), h("div", { class: `table-filler-cell ${this.showFillerCells ? "show" : ""}` })) : null;
|
|
303
348
|
};
|
|
304
349
|
const TableDisclaimers = () => {
|
|
@@ -148,7 +148,7 @@ export class PtcTextfield {
|
|
|
148
148
|
this.mdcTextfield = mdcTextfield;
|
|
149
149
|
} }, h("span", { class: "mdc-notched-outline ptc-textfield-outline" }, h("span", { class: "mdc-notched-outline__leading" }), h("span", { class: "mdc-notched-outline__trailing" })), h("input", Object.assign({ ref: customInput => {
|
|
150
150
|
this.customInput = customInput;
|
|
151
|
-
} }, (this.getInputClassName() ? { class: this.getInputClassName() } : null), { type: this.type }, (this.required ? { required: true } : null), (this.ptcMaxLength ? { maxlength: this.ptcMaxLength } : null), { "aria-controls": this.name, "aria-describedby": this.name, "data-eloqua-name": this.ptcDataEloquaName, value: this.inputValue }, (this.getValidationPattern() ? { pattern: this.getValidationPattern() } : null)))),
|
|
151
|
+
}, id: this.fieldId }, (this.getInputClassName() ? { class: this.getInputClassName() } : null), { type: this.type }, (this.required ? { required: true } : null), (this.ptcMaxLength ? { maxlength: this.ptcMaxLength } : null), { "aria-controls": this.name, "aria-describedby": this.name, "data-eloqua-name": this.ptcDataEloquaName, value: this.inputValue }, (this.getValidationPattern() ? { pattern: this.getValidationPattern() } : null)))),
|
|
152
152
|
h("div", { class: `mdc-text-field-helper-line
|
|
153
153
|
${!!this.ptcMaxLength ? 'field-with-counter' : ''}` }, h("div", { class: "mdc-text-field-helper-text mdc-text-field-helper-text--validation-msg", id: this.name }, h("svg", { class: "input-error-svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { "clip-path": "url(#clip0_12_1424)" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.3156 0L16 4.68444V11.3156L11.3156 16H4.68444L0 11.3156V4.68444L4.68444 0H11.3156ZM8 10.4C7.36 10.4 6.84444 10.9156 6.84444 11.5556C6.84444 12.1956 7.36 12.7111 8 12.7111C8.64 12.7111 9.15556 12.1956 9.15556 11.5556C9.15556 10.9156 8.64 10.4 8 10.4ZM8.88889 3.55556H7.11111V8.88889H8.88889V3.55556Z", fill: "#AF3231" })), h("defs", null, h("clipPath", { id: "clip0_12_1424" }, h("rect", { width: "16", height: "16", fill: "white" })))), this.helpertext), this.ptcMaxLength ? (h("div", { class: "mdc-text-field-character-counter" }, this.inputValue.length, " / ", this.ptcMaxLength)) : null),
|
|
154
154
|
]) : (h("input", { type: "hidden", "data-eloqua-name": this.ptcDataEloquaName, value: this.inputValue }))));
|
|
@@ -7,7 +7,7 @@ export class ElqLib {
|
|
|
7
7
|
this.visitor_elq_id = null;
|
|
8
8
|
this.field_mappings = [];
|
|
9
9
|
this.callback_queue = [];
|
|
10
|
-
|
|
10
|
+
this.fields_populated = false;
|
|
11
11
|
this.user_elq_email = '';
|
|
12
12
|
this.user_elq_firstname = '';
|
|
13
13
|
this.user_elq_lastname = '';
|
|
@@ -148,8 +148,8 @@ export class ElqLib {
|
|
|
148
148
|
// After processing the queue, update user details or perform other operations
|
|
149
149
|
if (actionSucceeded) {
|
|
150
150
|
this.update_user_details();
|
|
151
|
+
this.populate_mapped_fields();
|
|
151
152
|
}
|
|
152
|
-
//this.populate_mapped_fields();
|
|
153
153
|
// ...additional code to handle the aftermath of callback processing...
|
|
154
154
|
}
|
|
155
155
|
lookup_visitor_by_cookie() {
|
|
@@ -210,39 +210,27 @@ export class ElqLib {
|
|
|
210
210
|
return false;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// log("MAPPING: Could not populate element '" + mapping_element + "' as the Eloqua field '" + mapping_elq_field + "' contained no data");
|
|
230
|
-
// }
|
|
231
|
-
// else {
|
|
232
|
-
// fields_populated = true;
|
|
233
|
-
// element.value = field_value;
|
|
234
|
-
// log("MAPPING: Mapped element '" + mapping_element + "' with Eloqua field '" + mapping_elq_field + "'");
|
|
235
|
-
// }
|
|
236
|
-
// }
|
|
237
|
-
// }
|
|
238
|
-
// console.log("MAPPING: Finished field mapping");
|
|
239
|
-
// // Update notme link
|
|
240
|
-
// //update_notme_link ();
|
|
241
|
-
// }
|
|
213
|
+
populate_mapped_fields() {
|
|
214
|
+
console.log('MAPPING: Starting field mapping');
|
|
215
|
+
this.field_mappings.forEach(({ elementId, elqFieldName }) => {
|
|
216
|
+
const element = document.getElementById(elementId);
|
|
217
|
+
const fieldValue = window.GetElqContentPersonalizationValue(elqFieldName);
|
|
218
|
+
if (element && fieldValue) {
|
|
219
|
+
element.value = fieldValue;
|
|
220
|
+
element.style.display = 'none'; // Hide the field
|
|
221
|
+
this.fields_populated = true;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
console.log('MAPPING: Finished ');
|
|
225
|
+
if (this.fields_populated) {
|
|
226
|
+
this.update_notme_link();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
242
229
|
update_user_details() {
|
|
243
230
|
console.log('displaying user info...');
|
|
244
231
|
if (window.GetElqContentPersonalizationValue(this.params.elq_field_contact_email) !== '') {
|
|
245
|
-
document
|
|
232
|
+
document
|
|
233
|
+
.querySelectorAll('input[type=text], input[type=tel], input[name="phonenumber"], input[name="phonenumbertwo"], input[type=email], select, textarea, span.mdc-select__selected-text')
|
|
246
234
|
.forEach((element) => {
|
|
247
235
|
if (element.tagName === 'SPAN') {
|
|
248
236
|
const spanText = element;
|
|
@@ -321,19 +309,39 @@ export class ElqLib {
|
|
|
321
309
|
// var link = $('<a href="">' + message + '</a>').appendTo(notme_link_element).click(this.remove_user_details);
|
|
322
310
|
// }
|
|
323
311
|
// }
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
312
|
+
update_notme_link() {
|
|
313
|
+
// Assuming the user's first and last name are available from Eloqua fields
|
|
314
|
+
const firstName = window.GetElqContentPersonalizationValue('elq_field_visitor_firstname');
|
|
315
|
+
const lastName = window.GetElqContentPersonalizationValue('elq_field_visitor_lastname');
|
|
316
|
+
const notMeLinkElement = document.getElementById('not-me-link-id'); // Adjust ID as necessary
|
|
317
|
+
if (notMeLinkElement) {
|
|
318
|
+
let message = this.params.notme_message_noname;
|
|
319
|
+
if (firstName && lastName) {
|
|
320
|
+
//message = `Not ${firstName} ${lastName}? Click here.`;
|
|
321
|
+
message = this.params.notme_message.replace('{name}', `${firstName} ${lastName}`);
|
|
322
|
+
}
|
|
323
|
+
notMeLinkElement.innerHTML = `<a href="#" onclick="return false;">${message}</a>`;
|
|
324
|
+
notMeLinkElement.onclick = this.remove_user_details.bind(this);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
remove_user_details() {
|
|
328
|
+
this.user_elq_email = '';
|
|
329
|
+
this.user_elq_firstname = '';
|
|
330
|
+
this.user_elq_lastname = '';
|
|
331
|
+
$('.' + this.params.notme_fields_class).val('');
|
|
332
|
+
$('#' + this.params.notme_link_id)
|
|
333
|
+
.find('a')
|
|
334
|
+
.remove();
|
|
335
|
+
//Flush out old user cookie
|
|
336
|
+
ElqLib._elqQ.push(['elqVisitorGuid', ' ']);
|
|
337
|
+
ElqLib._elqQ.push(['elqTrackPageView']);
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
// private remove_user_details(): boolean {
|
|
341
|
+
// // Clear user data and reset form fields
|
|
342
|
+
// // ... implementation ...
|
|
343
|
+
// return false; // To prevent default link action
|
|
344
|
+
// }
|
|
337
345
|
// Private Method to load Eloqua Scripts
|
|
338
346
|
async_load() {
|
|
339
347
|
const scriptUrl = 'https://img.en25.com/i/elqCfg.min.js';
|