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