@ptcwebops/ptcw-design 3.0.2 → 3.0.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.
Files changed (111) hide show
  1. package/dist/cjs/embedded-form.cjs.entry.js +108 -0
  2. package/dist/cjs/footer-form.cjs.entry.js +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/max-width-container.cjs.entry.js +54 -0
  5. package/dist/cjs/ptc-button.cjs.entry.js +52 -0
  6. package/dist/cjs/ptc-data-lookup.cjs.entry.js +496 -0
  7. package/dist/cjs/{embedded-form_9.cjs.entry.js → ptc-form-checkbox_3.cjs.entry.js} +12 -804
  8. package/dist/cjs/ptc-form.cjs.entry.js +1 -1
  9. package/dist/cjs/ptc-modal-quiz.cjs.entry.js +1 -1
  10. package/dist/cjs/ptc-pricing-packaging-table.cjs.entry.js +7 -5
  11. package/dist/cjs/ptc-quote.cjs.entry.js +3 -2
  12. package/dist/cjs/ptc-spacer.cjs.entry.js +38 -0
  13. package/dist/cjs/ptc-title.cjs.entry.js +78 -0
  14. package/dist/cjs/ptc-value-led-card.cjs.entry.js +21 -0
  15. package/dist/cjs/ptc-value-led-content-highlight.cjs.entry.js +19 -0
  16. package/dist/cjs/ptc-value-led-content.cjs.entry.js +19 -0
  17. package/dist/cjs/ptc-value-led-intro.cjs.entry.js +20 -0
  18. package/dist/cjs/ptc-value-led-layout.cjs.entry.js +2 -2
  19. package/dist/cjs/ptc-value-led-speed-bump.cjs.entry.js +32 -0
  20. package/dist/cjs/ptcw-design.cjs.js +1 -1
  21. package/dist/collection/collection-manifest.json +5 -1
  22. package/dist/collection/components/organism-bundles/form/embedded-form/embedded-form.js +1 -1
  23. package/dist/collection/components/organism-bundles/form/footer-form/footer-form.js +1 -1
  24. package/dist/collection/components/organism-bundles/form/ptc-form/ptc-form.js +1 -1
  25. package/dist/collection/components/ptc-button/ptc-button.css +42 -0
  26. package/dist/collection/components/ptc-button/ptc-button.js +20 -1
  27. package/dist/collection/components/ptc-modal-quiz/ptc-modal-quiz.css +6 -1
  28. package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.js +7 -5
  29. package/dist/collection/components/ptc-quote/ptc-quote.css +28 -0
  30. package/dist/collection/components/ptc-quote/ptc-quote.js +4 -3
  31. package/dist/collection/components/ptc-select/ptc-select.js +4 -4
  32. package/dist/collection/components/ptc-textfield/ptc-textfield.js +12 -16
  33. package/dist/collection/components/ptc-value-led-card/ptc-value-led-card.css +36 -0
  34. package/dist/collection/components/ptc-value-led-card/ptc-value-led-card.js +60 -0
  35. package/dist/collection/components/ptc-value-led-content/ptc-value-led-content.css +12 -0
  36. package/dist/collection/components/ptc-value-led-content/ptc-value-led-content.js +18 -0
  37. package/dist/collection/components/ptc-value-led-content-highlight/ptc-value-led-content-highlight.css +31 -0
  38. package/dist/collection/components/ptc-value-led-content-highlight/ptc-value-led-content-highlight.js +18 -0
  39. package/dist/collection/components/ptc-value-led-intro/ptc-value-led-intro.css +16 -0
  40. package/dist/collection/components/ptc-value-led-intro/ptc-value-led-intro.js +42 -0
  41. package/dist/collection/components/ptc-value-led-layout/ptc-value-led-layout.css +22 -3
  42. package/dist/collection/components/ptc-value-led-layout/ptc-value-led-layout.js +1 -1
  43. package/dist/collection/components/ptc-value-led-speed-bump/ptc-value-led-speed-bump.css +63 -0
  44. package/dist/collection/components/ptc-value-led-speed-bump/ptc-value-led-speed-bump.js +97 -0
  45. package/dist/custom-elements/index.d.ts +30 -6
  46. package/dist/custom-elements/index.js +131 -568
  47. package/dist/esm/embedded-form.entry.js +104 -0
  48. package/dist/esm/footer-form.entry.js +1 -1
  49. package/dist/esm/loader.js +1 -1
  50. package/dist/esm/max-width-container.entry.js +50 -0
  51. package/dist/esm/ptc-button.entry.js +48 -0
  52. package/dist/esm/ptc-data-lookup.entry.js +492 -0
  53. package/dist/esm/{embedded-form_9.entry.js → ptc-form-checkbox_3.entry.js} +14 -800
  54. package/dist/esm/ptc-form.entry.js +1 -1
  55. package/dist/esm/ptc-modal-quiz.entry.js +1 -1
  56. package/dist/esm/ptc-pricing-packaging-table.entry.js +7 -5
  57. package/dist/esm/ptc-quote.entry.js +3 -2
  58. package/dist/esm/ptc-spacer.entry.js +34 -0
  59. package/dist/esm/ptc-title.entry.js +74 -0
  60. package/dist/esm/ptc-value-led-card.entry.js +17 -0
  61. package/dist/esm/ptc-value-led-content-highlight.entry.js +15 -0
  62. package/dist/esm/ptc-value-led-content.entry.js +15 -0
  63. package/dist/esm/ptc-value-led-intro.entry.js +16 -0
  64. package/dist/esm/ptc-value-led-layout.entry.js +2 -2
  65. package/dist/esm/ptc-value-led-speed-bump.entry.js +28 -0
  66. package/dist/esm/ptcw-design.js +1 -1
  67. package/dist/ptcw-design/p-036234e7.entry.js +1 -0
  68. package/dist/ptcw-design/{p-ed2cc9da.entry.js → p-08ed517e.entry.js} +1 -1
  69. package/dist/ptcw-design/p-137ddeeb.entry.js +1 -0
  70. package/dist/ptcw-design/p-18dfffd3.entry.js +359 -0
  71. package/dist/ptcw-design/p-236073e1.entry.js +1 -0
  72. package/dist/ptcw-design/p-2e4af711.entry.js +1 -0
  73. package/dist/ptcw-design/p-33c054ff.entry.js +1 -0
  74. package/dist/ptcw-design/{p-f00b4b73.entry.js → p-3ca391ab.entry.js} +1 -1
  75. package/dist/ptcw-design/p-3faffecb.entry.js +1 -0
  76. package/dist/ptcw-design/p-49f06645.entry.js +1 -0
  77. package/dist/ptcw-design/p-641bd525.entry.js +1 -0
  78. package/dist/ptcw-design/p-752f779c.entry.js +1 -0
  79. package/dist/ptcw-design/p-7aa6b7e5.entry.js +1 -0
  80. package/dist/ptcw-design/p-7c079ff8.entry.js +1 -0
  81. package/dist/ptcw-design/p-92bbd407.entry.js +1 -0
  82. package/dist/ptcw-design/p-9a36f7a3.entry.js +1 -0
  83. package/dist/ptcw-design/p-d2c400e2.entry.js +1 -0
  84. package/dist/ptcw-design/p-f1c77113.entry.js +1 -0
  85. package/dist/ptcw-design/ptcw-design.css +2 -2
  86. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  87. package/dist/types/components/ptc-button/ptc-button.d.ts +4 -0
  88. package/dist/types/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.d.ts +2 -0
  89. package/dist/types/components/ptc-quote/ptc-quote.d.ts +1 -1
  90. package/dist/types/components/ptc-select/ptc-select.d.ts +1 -1
  91. package/dist/types/components/ptc-textfield/ptc-textfield.d.ts +1 -1
  92. package/dist/types/components/ptc-value-led-card/ptc-value-led-card.d.ts +5 -0
  93. package/dist/types/components/ptc-value-led-content/ptc-value-led-content.d.ts +3 -0
  94. package/dist/types/components/ptc-value-led-content-highlight/ptc-value-led-content-highlight.d.ts +3 -0
  95. package/dist/types/components/ptc-value-led-intro/ptc-value-led-intro.d.ts +4 -0
  96. package/dist/types/components/ptc-value-led-speed-bump/ptc-value-led-speed-bump.d.ts +10 -0
  97. package/dist/types/components.d.ts +91 -75
  98. package/package.json +1 -1
  99. package/readme.md +1 -1
  100. package/dist/cjs/ptc-pricing-table.cjs.entry.js +0 -536
  101. package/dist/collection/components/ptc-pricing-table/ptc-pricing-table.css +0 -278
  102. package/dist/collection/components/ptc-pricing-table/ptc-pricing-table.js +0 -680
  103. package/dist/esm/ptc-pricing-table.entry.js +0 -532
  104. package/dist/ptcw-design/p-220f86c0.entry.js +0 -1
  105. package/dist/ptcw-design/p-4a865061.entry.js +0 -1
  106. package/dist/ptcw-design/p-b0b4ebd6.entry.js +0 -359
  107. package/dist/ptcw-design/p-c20538ec.entry.js +0 -1
  108. package/dist/ptcw-design/p-f2621425.entry.js +0 -1
  109. package/dist/ptcw-design/p-f29c71fe.entry.js +0 -1
  110. package/dist/types/components/ptc-pricing-table/ptc-pricing-table.d.ts +0 -110
  111. package/dist/types/utils/eloqua.d.ts +0 -8
@@ -0,0 +1,496 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-cd9a1b1a.js');
6
+
7
+ // Define the ElqLib class
8
+ class ElqLib {
9
+ constructor(params) {
10
+ this.params = params;
11
+ this.url_vars = {};
12
+ this.visitor_elq_id = null;
13
+ this.field_mappings = [];
14
+ this.callback_queue = [];
15
+ this.fields_populated = false;
16
+ this.user_elq_email = '';
17
+ this.user_elq_firstname = '';
18
+ this.user_elq_lastname = '';
19
+ // Merge defaults with params
20
+ const defaults = {
21
+ elq_site_id: '',
22
+ elq_visitor_lookup_key: '',
23
+ elq_recipient_id_lookup_key: '',
24
+ elq_contact_lookup_key: '',
25
+ elq_field_email_rec_id: 'V_EmailRecipientID',
26
+ elq_field_contact_email: 'C_EmailAddress',
27
+ elq_field_visitor_email: 'V_Email_Address',
28
+ elq_field_visitor_firstname: 'V_First_Name',
29
+ elq_field_visitor_lastname: 'V_Last_Name',
30
+ notme_link_id: 'not-me-link-id',
31
+ notme_fields_class: null,
32
+ notme_message: 'Not {name}? Click here.',
33
+ notme_message_noname: 'Not your details below? Click here.',
34
+ };
35
+ this.params = Object.assign(Object.assign({}, defaults), this.params);
36
+ this.init();
37
+ }
38
+ init() {
39
+ // Merge defaults with user-provided params if not already done in the constructor
40
+ // ...
41
+ // Set Eloqua site ID
42
+ this.setEloquaSiteId();
43
+ // Load Eloqua scripts
44
+ this.async_load();
45
+ // Store URL variables
46
+ this.store_url_vars();
47
+ // Store visitor's Eloqua IDgit
48
+ this.store_visitor_elq_id();
49
+ // init noteme link;
50
+ this.init_notme();
51
+ // Set the global Eloqua callback function
52
+ window.SetElqContent = this.eloqua_callback.bind(this);
53
+ }
54
+ setEloquaSiteId() {
55
+ if (this.params.elq_site_id) {
56
+ ElqLib._elqQ.push(['elqSetSiteId', this.params.elq_site_id]);
57
+ ElqLib._elqQ.push(['elqUseFirstPartyCookie', 'tracking.ptc.com']);
58
+ ElqLib._elqQ.push(['elqTrackPageView', window.location.href]);
59
+ }
60
+ }
61
+ fire_pageview(url) {
62
+ try {
63
+ if (typeof url === 'undefined') {
64
+ ElqLib._elqQ.push(['elqTrackPageView']);
65
+ }
66
+ else {
67
+ ElqLib._elqQ.push(['elqTrackPageView', url]);
68
+ }
69
+ console.log('TRACKING: Eloqua pageview fired for URL: ' + (url || 'current page'));
70
+ }
71
+ catch (e) {
72
+ console.log('TRACKING: Could not fire Eloqua pageview: ', e);
73
+ }
74
+ }
75
+ find_eloqua_contact() {
76
+ console.log('CONTACT LOOKUP: Attempting to find Eloqua contact...');
77
+ // Queue callback action for the return of lookup
78
+ this.callback_queue.push(this.handle_visitor_lookup.bind(this));
79
+ // Start with a recipient lookup if ID was supplied in URL
80
+ if (this.visitor_elq_id !== null) {
81
+ this.lookup_visitor_by_recipient_id();
82
+ }
83
+ else {
84
+ // If no visitor ID, attempt to do a visitor lookup with an Eloqua cookie
85
+ this.lookup_visitor_by_cookie(); //preference center
86
+ this.lookup_contact_by_email();
87
+ }
88
+ }
89
+ add_field_mapping(mapping) {
90
+ this.field_mappings.push(mapping);
91
+ }
92
+ add_queue_action(action) {
93
+ this.callback_queue.push(action);
94
+ }
95
+ store_url_vars() {
96
+ // Clear the current url_vars
97
+ this.url_vars = {};
98
+ // Split the URL by the '?' to get the query string part
99
+ const queryString = window.location.search.substring(1);
100
+ // Split the query string by '&' to get each key-value pair
101
+ queryString.split('&').forEach(paramString => {
102
+ // Split the key-value pairs by '=' to separate keys and values
103
+ let [key, value] = paramString.split('=');
104
+ // Decode URI components to handle URL encoding
105
+ key = decodeURIComponent(key);
106
+ value = decodeURIComponent(value);
107
+ // Store the key-value pair in the url_vars object
108
+ this.url_vars[key] = value;
109
+ });
110
+ // Optionally, log the stored URL variables
111
+ console.log('URL variables stored:', this.url_vars);
112
+ }
113
+ store_visitor_elq_id() {
114
+ console.log("INIT: Looking for visitor's Eloqua ID in URL...");
115
+ const elqIdParam = this.url_vars['elq'];
116
+ if (elqIdParam) {
117
+ const elqId = elqIdParam.toUpperCase().replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5');
118
+ this.visitor_elq_id = elqId;
119
+ console.log(`INIT: ...visitor Eloqua ID found in URL: ${elqId}`);
120
+ }
121
+ else {
122
+ this.visitor_elq_id = null;
123
+ console.log('INIT: ...no visitor Eloqua ID found in URL');
124
+ }
125
+ }
126
+ // private merge(root: any, ...sources: any[]): any {
127
+ // sources.forEach(source => {
128
+ // for (const key in source) {
129
+ // if (source.hasOwnProperty(key)) {
130
+ // root[key] = source[key];
131
+ // }
132
+ // }
133
+ // });
134
+ // return root;
135
+ // }
136
+ eloqua_callback() {
137
+ console.log('LOOKUP: Eloqua lookup finished');
138
+ // Process each action in the callback queue
139
+ let actionSucceeded = true;
140
+ while (actionSucceeded && this.callback_queue.length > 0) {
141
+ const action = this.callback_queue.shift();
142
+ if (action) {
143
+ console.log(`QUEUE: Executing action`);
144
+ actionSucceeded = action(); // Execute the action. It must return a boolean indicating success.
145
+ if (actionSucceeded) {
146
+ console.log('QUEUE: Action executed successfully, removed from queue');
147
+ }
148
+ else {
149
+ console.log('QUEUE: Action failed, re-adding to queue');
150
+ this.callback_queue.unshift(action); // Re-add the action to the front of the queue
151
+ break; // Break out of the loop if an action fails
152
+ }
153
+ }
154
+ }
155
+ // After processing the queue, update user details or perform other operations
156
+ if (actionSucceeded) {
157
+ this.update_user_details();
158
+ this.populate_mapped_fields();
159
+ }
160
+ // ...additional code to handle the aftermath of callback processing...
161
+ }
162
+ lookup_visitor_by_cookie() {
163
+ if (this.params.elq_visitor_lookup_key != '') {
164
+ ElqLib._elqQ.push(['elqDataLookup', escape(this.params.elq_visitor_lookup_key), '']);
165
+ console.log('LOOKUP: Visitor lookup sent using Eloqua cookie');
166
+ }
167
+ else {
168
+ console.log('LOOKUP: A visitor lookup cannot be performed as no lookup key was defined');
169
+ }
170
+ }
171
+ lookup_visitor_by_recipient_id() {
172
+ if (this.params.elq_recipient_id_lookup_key != '') {
173
+ ElqLib._elqQ.push([
174
+ 'elqDataLookup',
175
+ escape(this.params.elq_recipient_id_lookup_key),
176
+ '<' + this.params.elq_field_email_rec_id + '>' + this.visitor_elq_id + '</' + this.params.elq_field_email_rec_id + '>',
177
+ ]);
178
+ console.log('LOOKUP: Visitor lookup sent using email recipient id: ' + this.visitor_elq_id);
179
+ }
180
+ else {
181
+ console.log('LOOKUP: A visitor lookup cannot be performed as no lookup key was defined');
182
+ }
183
+ }
184
+ lookup_contact_by_email() {
185
+ if (this.params.elq_contact_lookup_key != '') {
186
+ ElqLib._elqQ.push([
187
+ 'elqDataLookup',
188
+ escape(this.params.elq_contact_lookup_key),
189
+ '<' + this.params.elq_field_contact_email + '>' + this.user_elq_email + '</' + this.params.elq_field_contact_email + '>',
190
+ ]);
191
+ console.log('LOOKUP: Contact lookup sent using email address: ' + this.user_elq_email);
192
+ }
193
+ else {
194
+ console.log('LOOKUP: A visitor lookup cannot be performed as no lookup key was defined');
195
+ }
196
+ }
197
+ handle_visitor_lookup() {
198
+ //console.log('Contact Email: ' + this.params.elq_field_contact_email)
199
+ const email = window.GetElqContentPersonalizationValue(this.params.elq_field_contact_email); //it was elq_field_visitor_email ( V_Email_Address)
200
+ if (email) {
201
+ console.log(`LOOKUP: Found contact email address: ${email}`);
202
+ this.user_elq_email = email.trim();
203
+ this.lookup_contact_by_email();
204
+ this.callback_queue.push(this.handle_contact_lookup.bind(this));
205
+ return true;
206
+ }
207
+ else {
208
+ return false;
209
+ }
210
+ }
211
+ handle_contact_lookup() {
212
+ if (window.GetElqContentPersonalizationValue(this.params.elq_field_contact_email) != '') {
213
+ console.log('LOOKUP: Found contact email address: ' + window.GetElqContentPersonalizationValue(this.params.elq_field_contact_email));
214
+ return true;
215
+ }
216
+ else {
217
+ return false;
218
+ }
219
+ }
220
+ populate_mapped_fields() {
221
+ console.log('MAPPING: Starting field mapping');
222
+ //debugger;
223
+ this.field_mappings.forEach(({ elementId, elqFieldName }) => {
224
+ const fieldValue = window.GetElqContentPersonalizationValue(elqFieldName);
225
+ if (elementId !== 'contact-country') {
226
+ const element = document.getElementById(elementId);
227
+ console.log('element ID of field mappings: ' + element);
228
+ console.log('fieldValue ID of field mappings: ' + fieldValue);
229
+ if (element && fieldValue) {
230
+ element.value = fieldValue;
231
+ //element.style.display = 'none'; // Hide the field.
232
+ if (element.closest('ptc-textfield')) {
233
+ element.closest('ptc-textfield').style.display = 'none';
234
+ }
235
+ else if (element.closest('ptc-select')) {
236
+ element.closest('ptc-select').style.display = 'none';
237
+ }
238
+ this.fields_populated = true;
239
+ }
240
+ }
241
+ else {
242
+ const countryEle = document.getElementById(elementId);
243
+ if (countryEle && fieldValue) {
244
+ countryEle.textContent = fieldValue;
245
+ }
246
+ // debugger;
247
+ if (countryEle.closest('ptc-select')) {
248
+ countryEle.closest('ptc-select').style.display = 'none';
249
+ }
250
+ }
251
+ });
252
+ console.log('MAPPING: Finished ');
253
+ if (this.fields_populated) {
254
+ this.update_notme_link();
255
+ }
256
+ }
257
+ update_user_details() {
258
+ console.log('displaying user info...');
259
+ if (window.GetElqContentPersonalizationValue(this.params.elq_field_contact_email) !== '') {
260
+ document
261
+ .querySelectorAll('input[type=text], input[type=tel], input[name="phonenumber"], input[name="phonenumbertwo"], input[type=email], select, textarea, span.mdc-select__selected-text')
262
+ .forEach((element) => {
263
+ if (element.tagName === 'SPAN') {
264
+ const spanText = element;
265
+ const spanEloquaName = spanText.getAttribute('data-eloqua-name');
266
+ if (spanEloquaName !== null) {
267
+ const spanElqValue = window.GetElqContentPersonalizationValue(spanEloquaName);
268
+ if (spanElqValue !== '' && spanElqValue.length > 0) {
269
+ spanText.textContent = spanElqValue;
270
+ }
271
+ }
272
+ }
273
+ else if (element.className.includes('intl-tel-input')) {
274
+ const telInput = element;
275
+ const eloquaName = telInput.getAttribute('data-eloqua-name');
276
+ if (eloquaName !== null) {
277
+ const elqValue = window.GetElqContentPersonalizationValue(eloquaName);
278
+ if (elqValue !== '' && elqValue.length > 0) {
279
+ setTimeout(() => {
280
+ telInput.placeholder = elqValue;
281
+ }, 1000);
282
+ }
283
+ }
284
+ }
285
+ else {
286
+ const input = element;
287
+ const eloquaName = input.getAttribute('data-eloqua-name');
288
+ if (eloquaName !== null) {
289
+ const elqValue = window.GetElqContentPersonalizationValue(eloquaName);
290
+ if (elqValue !== '' && elqValue.length > 0) {
291
+ input.value = elqValue;
292
+ }
293
+ }
294
+ }
295
+ });
296
+ }
297
+ if (this.user_elq_email == '' && window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_email) != '') {
298
+ this.user_elq_email = window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_email);
299
+ }
300
+ if (this.user_elq_firstname == '' && window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_firstname) != '') {
301
+ this.user_elq_firstname = window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_firstname);
302
+ }
303
+ if (this.user_elq_lastname == '' && window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_lastname) != '') {
304
+ this.user_elq_lastname = window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_lastname);
305
+ }
306
+ }
307
+ update_notme_link() {
308
+ // Assuming the user's first and last name are available from Eloqua fields
309
+ const firstName = window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_firstname);
310
+ const lastName = window.GetElqContentPersonalizationValue(this.params.elq_field_visitor_lastname);
311
+ const notMeLinkElement = document.getElementById(this.params.notme_link_id);
312
+ const topAdditional = document.getElementById('not-me-additional-top');
313
+ const bottomAdditional = document.getElementById('not-me-additional-bottom');
314
+ if (notMeLinkElement) {
315
+ let message = this.params.notme_message;
316
+ console.log('first name: ' + firstName);
317
+ if (firstName && lastName) {
318
+ message = this.params.notme_message.replace('{name}', lastName + ' ' + firstName);
319
+ }
320
+ notMeLinkElement.innerHTML = `<a href="#">${message}</a>`;
321
+ topAdditional.innerHTML = "Please fill out additional information.";
322
+ bottomAdditional.innerHTML = "Click the button below to recieve email confirmation.";
323
+ topAdditional.style.display = 'block';
324
+ bottomAdditional.style.display = 'block';
325
+ notMeLinkElement.onclick = this.remove_user_details.bind(this);
326
+ }
327
+ }
328
+ init_notme() {
329
+ const topAdditional = document.getElementById('not-me-additional-top');
330
+ const bottomAdditional = document.getElementById('not-me-additional-bottom');
331
+ if (topAdditional)
332
+ topAdditional.style.display = 'none';
333
+ if (bottomAdditional)
334
+ bottomAdditional.style.display = 'none';
335
+ }
336
+ remove_user_details(e) {
337
+ e.preventDefault();
338
+ this.user_elq_email = '';
339
+ this.user_elq_firstname = '';
340
+ this.user_elq_lastname = '';
341
+ // $('.' + this.params.notme_fields_class).val('');
342
+ const linkDiv = document.getElementById(this.params.notme_link_id);
343
+ const topAdditional = document.getElementById('not-me-additional-top');
344
+ const bottomAdditional = document.getElementById('not-me-additional-bottom');
345
+ linkDiv.querySelector('a').remove();
346
+ topAdditional.style.display = 'none';
347
+ bottomAdditional.style.display = 'none';
348
+ this.refreshForm();
349
+ return false;
350
+ }
351
+ refreshForm() {
352
+ this.field_mappings.forEach(({ elementId }) => {
353
+ if (elementId !== 'contact-country') {
354
+ const element = document.getElementById(elementId);
355
+ if (element) {
356
+ console.log('element: ' + element);
357
+ element.value = ''; // Reset the value
358
+ if (element.closest('ptc-textfield')) {
359
+ element.closest('ptc-textfield').style.display = '';
360
+ }
361
+ else if (element.closest('ptc-select')) {
362
+ element.closest('ptc-select').style.display = '';
363
+ }
364
+ }
365
+ }
366
+ else {
367
+ const countryEle = document.getElementById(elementId);
368
+ if (countryEle) {
369
+ countryEle.textContent = '';
370
+ }
371
+ // debugger;
372
+ if (countryEle.closest('ptc-select')) {
373
+ countryEle.closest('ptc-select').style.display = '';
374
+ }
375
+ }
376
+ });
377
+ this.clearEloquaCookie('elq-uid'); // Optionally clear the Eloqua cookie
378
+ this.fields_populated = false;
379
+ //this.update_notme_link(); // Update the 'Not Me' link if necessary
380
+ }
381
+ clearEloquaCookie(name) {
382
+ document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
383
+ console.log('cookie cleared');
384
+ }
385
+ // Private Method to load Eloqua Scripts
386
+ async_load() {
387
+ const scriptUrl = 'https://img.en25.com/i/elqCfg.min.js';
388
+ const scriptElement = document.createElement('script');
389
+ scriptElement.type = 'text/javascript';
390
+ scriptElement.async = true;
391
+ scriptElement.src = scriptUrl;
392
+ // Error handling for script loading
393
+ scriptElement.onerror = errorEvent => {
394
+ console.log(`Error loading script: ${errorEvent}`);
395
+ };
396
+ // Append the script element to the head of the document, or before the first script tag found
397
+ const firstScriptTag = document.getElementsByTagName('script')[0];
398
+ if (firstScriptTag && firstScriptTag.parentNode) {
399
+ firstScriptTag.parentNode.insertBefore(scriptElement, firstScriptTag);
400
+ }
401
+ else {
402
+ document.head.appendChild(scriptElement);
403
+ }
404
+ console.log(`Async loading of script ${scriptUrl} initiated.`);
405
+ }
406
+ }
407
+ ElqLib._elqQ = window['_elqQ'] || [];
408
+ // Static member initialization
409
+ //ElqLib._elqQ = window['_elqQ'] || [];
410
+
411
+ 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);position:relative}#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)}.not-me-additional-text#not-me-additional-bottom{margin-bottom:unset;margin-top:var(--ptc-element-spacing-03)}.ptc-embedded-form>div{max-width:273px;overflow-wrap:break-word}.ptc-embedded-form .iti__country-name{color:var(--color-gray-12)}.ptc-embedded-form .iti--separate-dial-code.iti--show-flags .iti__selected-dial-code{color:var(--color-gray-12)}.ptc-embedded-form .mdc-menu-surface--open{z-index:99999}";
412
+
413
+ const PtcDataLookup = class {
414
+ constructor(hostRef) {
415
+ index.registerInstance(this, hostRef);
416
+ this.elqSiteId = undefined;
417
+ this.elqVisitorLookupKey = undefined;
418
+ this.elqRecipientIdLookupKey = undefined;
419
+ this.elqContactLookupKey = undefined;
420
+ this.elqFieldEmailRecId = 'V_EmailRecipientID';
421
+ this.elqFieldContactEmail = 'C_EmailAddress';
422
+ this.elqFieldVisitorEmail = 'V_Email_Address';
423
+ this.elqFieldVisitorFirstname = 'C_FirstName';
424
+ this.elqFieldVisitorLastname = 'C_LastName';
425
+ this.notmeLinkId = undefined;
426
+ this.notmeFieldsClass = undefined;
427
+ this.notmeMessage = undefined;
428
+ this.notmeMessageNoname = undefined;
429
+ this.isBlindSubmit = true;
430
+ this.isInitialized = false;
431
+ }
432
+ componentWillLoad() {
433
+ this.initializeElqLib();
434
+ if (this.isBlindSubmit) {
435
+ this.populateBlindField();
436
+ }
437
+ }
438
+ initializeElqLib() {
439
+ this.elqLib = new ElqLib({
440
+ elq_site_id: this.elqSiteId,
441
+ elq_visitor_lookup_key: this.elqVisitorLookupKey,
442
+ elq_recipient_id_lookup_key: this.elqRecipientIdLookupKey,
443
+ elq_contact_lookup_key: this.elqContactLookupKey,
444
+ elq_field_email_rec_id: this.elqFieldEmailRecId,
445
+ elq_field_contact_email: this.elqFieldContactEmail,
446
+ elq_field_visitor_email: this.elqFieldVisitorEmail,
447
+ elq_field_visitor_firstname: this.elqFieldVisitorFirstname,
448
+ elq_field_visitor_lastname: this.elqFieldVisitorLastname,
449
+ notme_link_id: this.notmeLinkId,
450
+ notme_fields_class: this.notmeFieldsClass,
451
+ notme_message: this.notmeMessage,
452
+ notme_message_noname: this.notmeMessageNoname,
453
+ });
454
+ this.isInitialized = true;
455
+ }
456
+ populateBlindField() {
457
+ this.elqLib.add_field_mapping({ elementId: 'contact-phone', elqFieldName: 'C_BusPhone' });
458
+ this.elqLib.add_field_mapping({ elementId: 'contact-email', elqFieldName: 'C_EmailAddress' });
459
+ this.elqLib.add_field_mapping({ elementId: 'contact-firstname', elqFieldName: 'C_FirstName' });
460
+ this.elqLib.add_field_mapping({ elementId: 'contact-lastname', elqFieldName: 'C_LastName' });
461
+ this.elqLib.add_field_mapping({ elementId: 'contact-country', elqFieldName: 'C_Country' });
462
+ this.elqLib.add_field_mapping({ elementId: 'contact-phone', elqFieldName: 'C_BusPhone' });
463
+ this.elqLib.add_field_mapping({ elementId: 'company', elqFieldName: 'C_Company' });
464
+ this.elqLib.add_field_mapping({ elementId: 'contact-zipcode', elqFieldName: 'C_Zip_Postal' });
465
+ this.elqLib.add_field_mapping({ elementId: 'contact-job-category', elqFieldName: 'C_Job_Role1' });
466
+ this.elqLib.add_field_mapping({ elementId: 'contact-job-function', elqFieldName: 'C_Job_Function1' });
467
+ this.elqLib.add_field_mapping({ elementId: 'contact-jp-job-title', elqFieldName: 'C_Title' });
468
+ }
469
+ getCookie(name) {
470
+ let cookieValue = null;
471
+ if (document.cookie) {
472
+ const cookies = document.cookie.split(';');
473
+ for (let cookie of cookies) {
474
+ const [key, value] = cookie.trim().split('=');
475
+ if (key === name) {
476
+ cookieValue = decodeURIComponent(value);
477
+ break;
478
+ }
479
+ }
480
+ }
481
+ return cookieValue;
482
+ }
483
+ async performDataLookup() {
484
+ if (this.isInitialized) {
485
+ this.elqLib.user_elq_email = this.getCookie('elq-uid');
486
+ this.elqLib.find_eloqua_contact();
487
+ }
488
+ }
489
+ render() {
490
+ return index.h("slot", null);
491
+ }
492
+ get el() { return index.getElement(this); }
493
+ };
494
+ PtcDataLookup.style = ptcDataLookupCss;
495
+
496
+ exports.ptc_data_lookup = PtcDataLookup;