@ptcwebops/ptcw-design 2.9.1 → 2.9.2

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.
@@ -95,7 +95,7 @@ const EmbeddedForm = class {
95
95
  }
96
96
  render() {
97
97
  const formClass = this.isSubmitted ? "ptc-form-roll-up" : "";
98
- return (h(Host, null, h("div", { class: "ptc-container ptc-section-standard flex-adjustments" }, h("div", { class: "form-wrapper ptc-embedded-form" }, h("max-width-container", { "max-width": "277", breakpoint: 480 }, h("ptc-title", { type: "h2", "text-align": "center", "title-size": "x-small", "title-color": "gray", upperline: "no-upperline", "title-display": "inline-block", "title-height": "densest", "title-margin": "margin-flush", "title-weight": "w-6", "is-plm-hub": "false" }, "Please fill out the form and a PTC sales representative will be in touch."), h("ptc-spacer", { breakpoint: "x-small", size: "medium" }), h("ptc-spacer", { breakpoint: "x-small", size: "medium" }), h("ptc-spacer", { breakpoint: "small", size: "small" }), h("ptc-spacer", { breakpoint: "small", size: "small" })), h("form", { onSubmit: event => this.handleSubmit(event), class: formClass }, h("ptc-textfield", { "field-id": "contact-firstname", "label-text": "First Name*", type: "text", "ptc-data-eloqua-name": "C_FirstName", name: "firstname" }), h("ptc-textfield", { "field-id": "contact-lastname", "label-text": "Last Name*", type: "text", "ptc-data-eloqua-name": "C_LastName", name: "lastname" }), h("ptc-textfield", { "field-id": "company", "label-text": "Company*", type: "text", "ptc-data-eloqua-name": "C_Company", name: "company-field" }), h("ptc-textfield", { "field-id": "contact-email", "label-text": "Email*", type: "email", "ptc-data-eloqua-name": "C_EmailAddress", name: "email" }), h("ptc-select", { "field-id": "contact-country", label: "Country*", "ptc-data-eloqua-name": "C_Country", name: "country" }, h("ul", { class: "mdc-list" }, h("li", { class: "mdc-list-item", "data-value": "" }, h("span", { class: "mdc-list-item__ripple" })), h("li", { class: "mdc-list-item", "data-value": "USA" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "USA")), h("li", { class: "mdc-list-item", "data-value": "Canada" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Canada")), h("li", { class: "mdc-list-item", "data-value": "China" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "China")))), h("ptc-textfield", { "field-id": "contact-phone", "label-text": "Phone*", type: "tel", "ptc-data-eloqua-name": "C_BusPhone", name: "phone" }), h("ptc-select", { label: "What information are you interested in?*", "ptc-data-eloqua-name": "Inquiry_Reason", name: "inquiryreason", "field-id": "contact-inquiry" }, h("ul", { class: "mdc-list" }, h("li", { class: "mdc-list-item", "data-value": "" }, h("span", { class: "mdc-list-item__ripple" })), h("li", { class: "mdc-list-item", "data-value": "Augmented Reality (AR)" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Augmented Reality (AR)")), h("li", { class: "mdc-list-item", "data-value": "CAD" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Computer Aided Design")), h("li", { class: "mdc-list-item", "data-value": "Retail(FlexPLM)" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Fashion and Retail Product Lifecycle Management")))), h("ptc-textfield", { "field-id": "self-reporting", "label-text": "How can we help you?*", type: "text", "ptc-data-eloqua-name": "HowHearSelfReport", "ptc-max-length": "100", name: "howhearselfreport" }), h("ptc-textfield", { type: "hidden", "ptc-data-eloqua-name": "test", "input-value": "test" }), h("ptc-form-checkbox", { label: "I agree to the policy", "checkbox-id": "policy1" }), h("ptc-button", { class: "form-submit", color: "ptc-quaternary", type: "submit", styles: ":host{align-self:flex-end; margin-top: 48px; display:block; text-align:right;}" }, "Submit"))))));
98
+ return (h(Host, null, h("div", { class: "ptc-container ptc-section-standard flex-adjustments" }, h("div", { class: "form-wrapper ptc-embedded-form" }, h("max-width-container", { "max-width": "277", breakpoint: 480 }, h("ptc-title", { type: "h2", "text-align": "center", "title-size": "x-small", "title-color": "gray", upperline: "no-upperline", "title-display": "inline-block", "title-height": "densest", "title-margin": "margin-flush", "title-weight": "w-6", "is-plm-hub": "false" }, "Please fill out the form and a PTC sales representative will be in touch."), h("ptc-spacer", { breakpoint: "x-small", size: "medium" }), h("ptc-spacer", { breakpoint: "x-small", size: "medium" }), h("ptc-spacer", { breakpoint: "small", size: "small" }), h("ptc-spacer", { breakpoint: "small", size: "small" })), h("form", { onSubmit: event => this.handleSubmit(event), class: formClass }, h("div", { id: "not-me-link-id" }), h("div", { id: "not-me-additional-top", class: "not-me-additional-text" }), h("ptc-textfield", { "field-id": "contact-firstname", "label-text": "First Name*", type: "text", "ptc-data-eloqua-name": "C_FirstName", name: "firstname" }), h("ptc-textfield", { "field-id": "contact-lastname", "label-text": "Last Name*", type: "text", "ptc-data-eloqua-name": "C_LastName", name: "lastname" }), h("ptc-textfield", { "field-id": "company", "label-text": "Company*", type: "text", "ptc-data-eloqua-name": "C_Company", name: "company-field" }), h("ptc-textfield", { "field-id": "contact-email", "label-text": "Email*", type: "email", "ptc-data-eloqua-name": "C_EmailAddress", name: "email" }), h("ptc-select", { "field-id": "contact-country", label: "Country*", "ptc-data-eloqua-name": "C_Country", name: "country" }, h("ul", { class: "mdc-list" }, h("li", { class: "mdc-list-item", "data-value": "" }, h("span", { class: "mdc-list-item__ripple" })), h("li", { class: "mdc-list-item", "data-value": "USA" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "USA")), h("li", { class: "mdc-list-item", "data-value": "Canada" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Canada")), h("li", { class: "mdc-list-item", "data-value": "China" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "China")))), h("ptc-textfield", { "field-id": "contact-phone", "label-text": "Phone*", type: "tel", "ptc-data-eloqua-name": "C_BusPhone", name: "phone" }), h("ptc-select", { label: "What information are you interested in?*", "ptc-data-eloqua-name": "Inquiry_Reason", name: "inquiryreason", "field-id": "contact-inquiry" }, h("ul", { class: "mdc-list" }, h("li", { class: "mdc-list-item", "data-value": "" }, h("span", { class: "mdc-list-item__ripple" })), h("li", { class: "mdc-list-item", "data-value": "Augmented Reality (AR)" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Augmented Reality (AR)")), h("li", { class: "mdc-list-item", "data-value": "CAD" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Computer Aided Design")), h("li", { class: "mdc-list-item", "data-value": "Retail(FlexPLM)" }, h("span", { class: "mdc-list-item__ripple" }), h("span", { class: "mdc-list-item__text" }, "Fashion and Retail Product Lifecycle Management")))), h("ptc-textfield", { "field-id": "self-reporting", "label-text": "How can we help you?*", type: "text", "ptc-data-eloqua-name": "HowHearSelfReport", "ptc-max-length": "100", name: "howhearselfreport" }), h("ptc-textfield", { type: "hidden", "ptc-data-eloqua-name": "test", "input-value": "test" }), h("ptc-form-checkbox", { label: "I agree to the policy", "checkbox-id": "policy1" }), h("div", { id: "not-me-additional-bottom", class: "not-me-additional-text" }), h("ptc-button", { class: "form-submit", color: "ptc-quaternary", type: "submit", styles: ":host{align-self:flex-end; margin-top: 48px; display:block; text-align:right;}" }, "Submit"))))));
99
99
  }
100
100
  get el() { return getElement(this); }
101
101
  };
@@ -199,7 +199,7 @@ class ElqLib {
199
199
  this.visitor_elq_id = null;
200
200
  this.field_mappings = [];
201
201
  this.callback_queue = [];
202
- //private fields_populated: boolean = false;
202
+ this.fields_populated = false;
203
203
  this.user_elq_email = '';
204
204
  this.user_elq_firstname = '';
205
205
  this.user_elq_lastname = '';
@@ -340,8 +340,8 @@ class ElqLib {
340
340
  // After processing the queue, update user details or perform other operations
341
341
  if (actionSucceeded) {
342
342
  this.update_user_details();
343
+ this.populate_mapped_fields();
343
344
  }
344
- //this.populate_mapped_fields();
345
345
  // ...additional code to handle the aftermath of callback processing...
346
346
  }
347
347
  lookup_visitor_by_cookie() {
@@ -402,39 +402,27 @@ class ElqLib {
402
402
  return false;
403
403
  }
404
404
  }
405
- // private populate_mapped_fields(): void {
406
- // console.log("MAPPING: Starting field mapping");
407
- // // Loop through all mappings
408
- // for (mapping_set in field_mappings) {
409
- // for (mapping_element in field_mappings[mapping_set]) {
410
- // var mapping_elq_field = field_mappings[mapping_set][mapping_element];
411
- // var element = document.getElementById(mapping_element);
412
- // var field_value = GetElqContentPersonalizationValue(mapping_elq_field);
413
- // // Check that field exists
414
- // if (element == null) {
415
- // log("MAPPING: Could not populate element '" + mapping_element + "' as it does not exist");
416
- // }
417
- // else if (element.value != '') {
418
- // log("MAPPING: Could not populate element '" + mapping_element + "' as it already contained a value");
419
- // }
420
- // else if (field_value == '') {
421
- // log("MAPPING: Could not populate element '" + mapping_element + "' as the Eloqua field '" + mapping_elq_field + "' contained no data");
422
- // }
423
- // else {
424
- // fields_populated = true;
425
- // element.value = field_value;
426
- // log("MAPPING: Mapped element '" + mapping_element + "' with Eloqua field '" + mapping_elq_field + "'");
427
- // }
428
- // }
429
- // }
430
- // console.log("MAPPING: Finished field mapping");
431
- // // Update notme link
432
- // //update_notme_link ();
433
- // }
405
+ populate_mapped_fields() {
406
+ console.log('MAPPING: Starting field mapping');
407
+ this.field_mappings.forEach(({ elementId, elqFieldName }) => {
408
+ const element = document.getElementById(elementId);
409
+ const fieldValue = window.GetElqContentPersonalizationValue(elqFieldName);
410
+ if (element && fieldValue) {
411
+ element.value = fieldValue;
412
+ element.style.display = 'none'; // Hide the field
413
+ this.fields_populated = true;
414
+ }
415
+ });
416
+ console.log('MAPPING: Finished ');
417
+ if (this.fields_populated) {
418
+ this.update_notme_link();
419
+ }
420
+ }
434
421
  update_user_details() {
435
422
  console.log('displaying user info...');
436
423
  if (window.GetElqContentPersonalizationValue(this.params.elq_field_contact_email) !== '') {
437
- document.querySelectorAll('input[type=text], input[type=tel], input[name="phonenumber"], input[name="phonenumbertwo"], input[type=email], select, textarea, span.mdc-select__selected-text')
424
+ document
425
+ .querySelectorAll('input[type=text], input[type=tel], input[name="phonenumber"], input[name="phonenumbertwo"], input[type=email], select, textarea, span.mdc-select__selected-text')
438
426
  .forEach((element) => {
439
427
  if (element.tagName === 'SPAN') {
440
428
  const spanText = element;
@@ -513,19 +501,39 @@ class ElqLib {
513
501
  // var link = $('<a href="">' + message + '</a>').appendTo(notme_link_element).click(this.remove_user_details);
514
502
  // }
515
503
  // }
516
- // private remove_user_details(): void {
517
- // this.user_elq_email = '';
518
- // this.user_elq_firstname = '';
519
- // this.user_elq_lastname = '';
520
- // $('.' + this.params.notme_fields_class).val('');
521
- // $('#' + this.params.notme_link_id)
522
- // .find('a')
523
- // .remove();
524
- // //Flush out old user cookie
525
- // ElqLib._elqQ.push(['elqVisitorGuid', ' ']);
526
- // ElqLib._elqQ.push(['elqTrackPageView']);
527
- // //return false;
528
- // }
504
+ update_notme_link() {
505
+ // Assuming the user's first and last name are available from Eloqua fields
506
+ const firstName = window.GetElqContentPersonalizationValue('elq_field_visitor_firstname');
507
+ const lastName = window.GetElqContentPersonalizationValue('elq_field_visitor_lastname');
508
+ const notMeLinkElement = document.getElementById('not-me-link-id'); // Adjust ID as necessary
509
+ if (notMeLinkElement) {
510
+ let message = this.params.notme_message_noname;
511
+ if (firstName && lastName) {
512
+ //message = `Not ${firstName} ${lastName}? Click here.`;
513
+ message = this.params.notme_message.replace('{name}', `${firstName} ${lastName}`);
514
+ }
515
+ notMeLinkElement.innerHTML = `<a href="#" onclick="return false;">${message}</a>`;
516
+ notMeLinkElement.onclick = this.remove_user_details.bind(this);
517
+ }
518
+ }
519
+ remove_user_details() {
520
+ this.user_elq_email = '';
521
+ this.user_elq_firstname = '';
522
+ this.user_elq_lastname = '';
523
+ $('.' + this.params.notme_fields_class).val('');
524
+ $('#' + this.params.notme_link_id)
525
+ .find('a')
526
+ .remove();
527
+ //Flush out old user cookie
528
+ ElqLib._elqQ.push(['elqVisitorGuid', ' ']);
529
+ ElqLib._elqQ.push(['elqTrackPageView']);
530
+ return false;
531
+ }
532
+ // private remove_user_details(): boolean {
533
+ // // Clear user data and reset form fields
534
+ // // ... implementation ...
535
+ // return false; // To prevent default link action
536
+ // }
529
537
  // Private Method to load Eloqua Scripts
530
538
  async_load() {
531
539
  const scriptUrl = 'https://img.en25.com/i/elqCfg.min.js';
@@ -552,7 +560,7 @@ ElqLib._elqQ = window['_elqQ'] || [];
552
560
  // Static member initialization
553
561
  //ElqLib._elqQ = window['_elqQ'] || [];
554
562
 
555
- const ptcDataLookupCss = ":host{display:block}";
563
+ const ptcDataLookupCss = ":host{display:block}#not-me-link-id{color:var(--color-gray-10);font-family:var(--ptc-font-latin);font-size:var(--ptc-font-size-medium);font-style:normal;font-weight:var(--ptc-font-weight-bold);line-height:normal;margin-bottom:var(--ptc-element-spacing-03)}#not-me-link-id a{color:var(--color-blue-07);font-family:var(--ptc-font-latin);font-size:var(--ptc-font-size-medium);font-style:normal;font-weight:var(--ptc-font-weight-bold);line-height:normal;text-decoration-line:underline}.not-me-additional-text{color:var(--color-gray-10);font-family:var(--ptc-font-latin);font-size:var(--ptc-font-size-medium);font-style:normal;font-weight:var(--ptc-font-weight-regular);line-height:normal;margin-bottom:var(--ptc-element-spacing-03)}";
556
564
 
557
565
  const PtcDataLookup = class {
558
566
  constructor(hostRef) {
@@ -574,6 +582,7 @@ const PtcDataLookup = class {
574
582
  }
575
583
  componentWillLoad() {
576
584
  this.initializeElqLib();
585
+ this.elqLib.add_field_mapping({ elementId: 'email-field', elqFieldName: 'C_EmailAddress' });
577
586
  }
578
587
  initializeElqLib() {
579
588
  this.elqLib = new ElqLib({
@@ -11309,7 +11318,7 @@ const PtcTextfield = class {
11309
11318
  this.mdcTextfield = mdcTextfield;
11310
11319
  } }, 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 => {
11311
11320
  this.customInput = customInput;
11312
- } }, (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)))),
11321
+ }, 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)))),
11313
11322
  h("div", { class: `mdc-text-field-helper-line
11314
11323
  ${!!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),
11315
11324
  ]) : (h("input", { type: "hidden", "data-eloqua-name": this.ptcDataEloquaName, value: this.inputValue }))));