1const CORE_ACTION_REDIRECT = "redirect"; 2 3function get_core_action(response) { 4 const data = response?.data; 5 if (!data) { 6 return undefined; 7 } 8 9 return data.action; 10} 11 12function get_core_response_redirect(response) { 13 return get_core_response_data(response, "redirect"); 14} 15 16function get_core_response_data(response, key) { 17 const data = response?.data?.data; 18 if (data && data.hasOwnProperty(key)) { 19 return data[key]; 20 } 21 return undefined; 22} 23 24function is_valid_core_response(response) { 25 if (!response) { 26 return false; 27 } 28 29 if (!response.success) { 30 return false; 31 } 32 33 if (!response.data) { 34 return false; 35 } 36 37 if (!response.data.core) { 38 return false; 39 } 40 41 if (!response.data.action) { 42 return false; 43 } 44 45 return true; 46} 47 48const core_form_step_cache = []; 49async function track_core_form_step(step, data, id = null) { 50 if (core_form_step_cache.includes(step)) { 51 return; 52 } 53 54 const payload = { 55 id: ssr.id, 56 step: step, 57 data: data, 58 }; 59 60 const response = await wordpress_request("core_track_process", payload); 61 if (response.success) { 62 core_form_step_cache.push(step); 63 } 64} 65 66function track_core_response(response) { 67 if (!is_valid_core_response(response)) { 68 return false; 69 } 70 71 const tracking = response.data.data.tracking; 72 if (tracking) { 73 const gtm = tracking.gtm; 74 if (gtm.publish) { 75 const events = gtm.events; 76 const gtm_consent_manager = ConsentManager.instance(); 77 if (events) { 78 for (const event of events) { 79 gtm_consent_manager.gtm_publish_with_consents( 80 "event", 81 event.event, 82 event.data, 83 ); 84 } 85 } 86 } 87 } 88}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.