PageSourceSearch

https://thesweetsetup.com/wp-content/plugins/affiliate-wp/assets/js/affiliate-signup-widget.min.js?ver=2.27.2

js thesweetsetup.com collected 2026-09-24 10:05:45 UTC 4,630 bytes, 1 lines download raw bytes

1"use strict";document.addEventListener("DOMContentLoaded",function(){function setupWidget(widgetContainer){if(!widgetContainer.shadowRoot){var shadow=widgetContainer.attachShadow({mode:"open"});loadInitialWidget(shadow,widgetContainer)}}function loadInitialWidget(shadow,widgetContainer){fetch(affiliateWidgetParams.cssUrl).then(function(res){return res.text()}).then(function(css){var style=document.createElement("style");style.textContent=css,shadow.appendChild(style);var container=document.createElement("div");container.innerHTML=affiliateWidgetParams.widgetHtml,shadow.appendChild(container),widgetAttachFormSubmitEvent(shadow)}).then(function(){widgetContainer.shadowReadyDispatched||(window.dispatchEvent(new Event("shadowReady")),widgetContainer.shadowReadyDispatched=!0)})}function widgetAttachFormSubmitEvent(shadow){var formInsideShadow=shadow.querySelector("form");formInsideShadow&&formInsideShadow.addEventListener("submit",function(e){e.preventDefault();var ctaButtonInsideShadow=shadow.querySelector("#signup-affiliate");ctaButtonInsideShadow&&(buttonLoadingState(ctaButtonInsideShadow),registerAffiliate(shadow))})}function buttonLoadingState(ctaButtonInsideShadow){var svgSpinner=ctaButtonInsideShadow.querySelector("svg"),originalButtonText=ctaButtonInsideShadow.querySelector("#originalButtonText"),processingText=ctaButtonInsideShadow.querySelector("#processingText");svgSpinner&&svgSpinner.removeAttribute("hidden"),processingText&&processingText.removeAttribute("hidden"),originalButtonText&&originalButtonText.setAttribute("hidden",!0),ctaButtonInsideShadow.disabled=!0,ctaButtonInsideShadow.classList.add("cursor-not-allowed")}function registerAffiliate(shadow){var formInsideShadow=shadow.querySelector("form"),formData=new FormData(formInsideShadow),orderKey=getOrderKeyFromURL();formData.append("action","affiliate_signup"),formData.append("order_key",orderKey),fetch(affiliateWidgetParams.ajaxUrl,{method:"POST",body:formData}).then(function(response){if(!response.ok)throw showError(shadow),new Error("Network response was not ok.");return response.json()}).then(function(data){data.success?showConfirmation(data,shadow):showError(shadow)}).catch(function(error){console.error("Error during registration:",error),showError(shadow)})}function showError(shadow){var initialViewElement=shadow.querySelector("#initial-view");initialViewElement&&(initialViewElement.style.display="none");var errorViewElement=shadow.querySelector("#error-view");errorViewElement&&(errorViewElement.style.display="block")}function getOrderKeyFromURL(){var urlParams=new URLSearchParams(window.location.search);return urlParams.get("key")}function showConfirmation(response,shadowRoot){if(!shadowRoot)return void console.error("shadowRoot is undefined in showConfirmation");if(response&&response.data&&response.data.affiliate_link){var confirmationView=shadowRoot.querySelector("#confirmation-view");confirmationView&&(confirmationView.innerHTML=confirmationView.innerHTML.replace("{affiliateLink}",response.data.affiliate_link),confirmationView.style.display="block");var initialView=shadowRoot.querySelector("#initial-view");initialView&&(initialView.style.display="none")}else console.error("The affiliate_link is not available in the response data:",response);attachCopyLinkButtonEventListener(shadowRoot)}function attachCopyLinkButtonEventListener(shadow){function copyAffiliateLink(){var affiliateLinkInput=shadow.querySelector("#affiliateLink");if(affiliateLinkInput){var affiliateLink=affiliateLinkInput.value;navigator.clipboard.writeText(affiliateLink).then(function(){affiliateLinkInput.select()}).catch(function(error){console.error("Copy failed",error)})}}var copyLinkButton=shadow.querySelector("#copyLinkButton");copyLinkButton&&copyLinkButton.addEventListener("click",function(){copyAffiliateLink();var originalText=copyLinkButton.textContent;copyLinkButton.textContent=affiliateWidgetParams.data.button_copied_text,setTimeout(function(){copyLinkButton.textContent=originalText},3e3)})}function handleShadowReady(event){widgetContainers.forEach(function(widgetContainer){widgetContainer.shadowRoot&&!widgetContainer.shadowReadyDispatched&&(widgetContainer.shadowReadyDispatched=!0)})}var widgetContainers=document.querySelectorAll(".affiliate-signup");
1widgetContainers.forEach(function(widgetContainer){widgetContainer.shadowReadyDispatched=!1,setupWidget(widgetContainer)}),widgetContainers.forEach(function(widgetContainer){widgetContainer.shadowReadyDispatched?handleShadowReady(null,widgetContainer):window.addEventListener("shadowReady",function(){return handleShadowReady(null,widgetContainer)})})});

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.