🎉 New Year Sale is LIVE! Use code NEWYEAR25 for 25% OFF | Free Shipping on orders above ₹999

Search
Shopping Cart

Your cart is empty

Continue Shopping
Expert's Choice

Complete Home Security
with AI motion detection

Complete 360° Security - Triple the Coverage, Triple the Peace of Mind.

View Camera
5MP + 5MP + 5MP Full HD Lens
30m IR Color Night Vision
360 degrees Pan Tilt

2 Way Talk

SD Card + Cloud

Complete Home Security
View Camera
Parent's Choice

Baby Cameras
with AI night colour vision

Keep your little one safe with Cry Detection & 2 way audio

View Camera
4MP + 4MP Full HD Lens
20m IR Color Night Vision
SD Card + Cloud Storage Support

2 Way Talk

AI Motion Detection

Baby Cameras
View Camera
Shipping Across India
Secure Payments
7 day replacement
6 Month Free Warranty

Tech experts, celebrities and real users -
hear about Maizic from those who love us.

Batman Black 3in1 4G Sim CCTV Camera ...

Rs. 10,000.00 Rs. 3,999.00

Tricam Shark Dual Lens/Triple Screen ...

Rs. 10,000.00 Rs. 2,999.00

Rose 2X Smart Projector – Android 13....

Rs. 8,999.00 Rs. 4,549.00

Baby Robot WiFi CCTV Camera 3MP Full ...

Rs. 3,000.00 Rs. 1,199.00

5+5MP Full HD 10X Optical Zoom Smart ...

Rs. 8,000.00 Rs. 4,999.00

Square Android 11.0 Smart Projector, ...

Rs. 12,000.00 Rs. 3,999.00

Batman Black 3in1 4G Sim CCTV Camera ...

Rs. 10,000.00 Rs. 3,999.00

Tricam Shark Dual Lens/Triple Screen ...

Rs. 10,000.00 Rs. 2,999.00

Rose 2X Smart Projector – Android 13....

Rs. 8,999.00 Rs. 4,549.00

Baby Robot WiFi CCTV Camera 3MP Full ...

Rs. 3,000.00 Rs. 1,199.00

5+5MP Full HD 10X Optical Zoom Smart ...

Rs. 8,000.00 Rs. 4,999.00

Square Android 11.0 Smart Projector, ...

Rs. 12,000.00 Rs. 3,999.00
RELIABLE & SMART

Protecting 1.6 Crore+ Indians

Our AI-powered cameras set the standard for smart security with cutting edge technology

Legacy of Innovation

Protecting Indian homes since 2017 with proven, reliable security solutions.

Learn more →

Pioneers of DIY Security

Zero wiring, zero hassle. No technician needed. Simple setup that anyone can install in minutes.

Learn more →

India's First 4G & Solar

The first to revolutionize Indian security with 4G and Solar-powered camera technology.

Learn more →

Comprehensive Warranty

Includes 6 months free coverage, easily extendable up to 2 years for total peace of mind.

Learn more →

Unbeatable Connectivity

Stay online 24/7 with the most cost-effective and stable data plans in the market.

View plans →

We Are Here to Help

Industry-leading customer support to ensure your security system runs without interruption.

Contact us →

Future-ready. Right now.

Our AI-powered cameras don't just record — they understand, analyze, and protect.

AI Smart Human Detection

Advanced AI filters false alarms (pets/cars), detecting only humans to send instant, accurate alerts to you.

Multi-Lens Split Screen

View multiple angles at once. Multi-lens tech covers wider areas and eliminates blind spots on a single screen.

Hybrid PTZ and Bullet Designs

The stability of a fixed lens plus the tracking of a PTZ lens. Get wide coverage and zoom details in one unit.

End-to-End Encrypted Storage

Your privacy matters. We use full encryption on both Cloud and SD Card storage to keep your footage secure.

New Arrivals

The latest additions to our family

View All →
#BeyondTheLens

India's #1
AI Smarthome Brand

At Maizic, we are redefining the boundaries of a connected lifestyle.

4K HD Android Smart Projector
AI Camera
180° Rotation
Wifi Portable BT

Customer Love is the real Magic

4.5+

Average Rating

Blogs

Security tips, product guides, and industry insights

View All →
BACK TO TOP
", defaultCountry, geoCountries.includes(defaultCountry) ); return geoCountries.includes(defaultCountry); }; const startOTPObserverIfEligible = async () => { const shouldRunOTP = await checkDefaultCountry(); if (shouldRunOTP) { codkLog("observePreOrderOTPEnabled running"); observePreOrderOTPEnabled(); } else { codkLog("OTP observer skipped due to geo restrictions."); enableNormalCheckout(); } }; try { console.log( "%c████████████ COD King 2 ████████████", "font-weight: bold; font-size: 14px; background: red; color: white; padding: 4px 8px; border-radius: 4px;" ); disableNormalCheckout(); setTimeout(async function () { codkLog("before calling setting from extension"); let settings; const settingsChanged = sessionStorage.getItem("codk_settings_changed"); const settingsStr = sessionStorage.getItem("settingSession"); if (settingsChanged || !settingsStr) { if (settingsChanged) { sessionStorage.removeItem("codk_settings_changed"); codkLog("Metafield changed - calling fetchSettings() to update settingSession"); } const response = await fetchSettings(); if (response) { const newSettings = codkMapSettingsToCamel({ ...response, routeUrl: ROUTE_URL.replace(/\/$/, ""), shopDomain: window.Shopify.shop, }); sessionStorage.setItem("settingSession", JSON.stringify(newSettings)); startOTPObserverIfEligible(); if (newSettings?.partialPaymentEnabled === true) { callPartialRuleSets(); callPartialDummyVariantId(); } settings = newSettings; } else { codkLog("Failed to load settings from server."); enableNormalCheckout(); return; } } else { settings = JSON.parse(settingsStr); const needsMigration = settings && !("enablePreOrderOtp" in settings) && "enable_pre_order_otp" in settings; if (needsMigration) { const migratedSettings = codkMapSettingsToCamel(settings); sessionStorage.setItem( "settingSession", JSON.stringify(migratedSettings) ); settings = migratedSettings; } startOTPObserverIfEligible(); if (settings?.partialPaymentEnabled === true) { const ruleSets = JSON.parse(sessionStorage.getItem("ruleSets")); if (!ruleSets) { callPartialRuleSets(); } const variantId = sessionStorage.getItem("partialDummyVariantId"); if (!variantId) { callPartialDummyVariantId(); } } } if (settings?.partialPaymentEnabled === true) { initProductHiding(); } loadScript(); }, 10); } catch (e) { codkLog("Error Loading OTP Box, Please reach out to us via chat bubble"); enableNormalCheckout(); } })(); }; const initSvelteApp = function(buttonBlocking, settings) { window.codkInitSvelteApp = () => initSvelteApp(buttonBlocking, settings); if (typeof window.codkingRouteUrl === 'undefined' || !window.codkingRouteUrl || window.codkingRouteUrl.trim() === '') { console.error("❌ ROUTE_URL is empty in initSvelteApp!"); if (buttonBlocking) buttonBlocking.removeButtonListeners(); return; } const ROUTE_URL = window.codkingRouteUrl; const DEBUG = false; const codkLog = (msg, ...args) => { if (DEBUG) console.log(`[notifik_svelte.liquid] ${msg}`, ...args); }; codkLog("***************************** notifik_svelte.liquid loaded (SKELETON) *****************************"); codkLog("✅ web_ux_version is 2, initializing Svelte app"); if (!buttonBlocking) { console.error("❌ buttonBlocking not provided to initSvelteApp!"); return; } const isMobile = () => { const viewportWidth = window.parent && window.parent !== window ? window.parent.innerWidth : window.innerWidth; return viewportWidth <= 640; }; const showIframe = (iframe) => { if (!iframe) return; iframe.setAttribute('data-visible', 'true'); try { if (!window.codkOtpModalOpen) { const parentWindow = window.parent || window; parentWindow.dispatchEvent(new Event("codking:otpModalOpened")); window.codkOtpModalOpen = true; codkLog("đŸ“Ŗ Dispatched codking:otpModalOpened"); const hideCartDrawerFallback = function() { try { const cartDrawerLayouts = getCartDrawerLayouts(); for (const selector of cartDrawerLayouts) { try { const element = document.querySelector(selector); if (!element) continue; const elementAny = element; if (typeof elementAny.close === "function") { try { elementAny.close(); codkLog(" 🔒 Fallback: Closed via " + selector + ".close()"); return true; } catch (e) { codkLog(" âš ī¸ Fallback: " + selector + ".close() failed:", e); } } const dialog = element.querySelector("dialog[open]"); if (dialog) { try { dialog.close(); dialog.removeAttribute("open"); codkLog(" 🔒 Fallback: Closed dialog inside " + selector); return true; } catch (e) { codkLog(" âš ī¸ Fallback: Failed to close dialog in " + selector + ":", e); } } if (element.tagName === "DIALOG" && element.hasAttribute("open")) { try { element.close(); element.removeAttribute("open"); codkLog(" 🔒 Fallback: Closed dialog " + selector); return true; } catch (e) { codkLog(" âš ī¸ Fallback: Failed to close dialog " + selector + ":", e); } } } catch (e) { codkLog(" âš ī¸ Fallback: Invalid selector " + selector + ":", e); } } return false; } catch (e) { codkLog("âš ī¸ Fallback hide failed:", e); return false; } }; hideCartDrawerFallback(); const tryHideDrawer = function(attempt) { try { if (typeof parentWindow.codkingHideDrawer === "function") { parentWindow.codkingHideDrawer(); codkLog("đŸ“Ŗ Called codkingHideDrawer() directly"); return; } } catch (e) {} if ((attempt || 0) < 40) { setTimeout(function() { tryHideDrawer((attempt || 0) + 1); }, 50); } }; tryHideDrawer(0); } } catch (e) { } codkLog("✅ Iframe shown (CSS from Svelte)"); }; const hideIframe = (iframe) => { if (!iframe) return; iframe.setAttribute('data-visible', 'false'); try { if (window.codkOtpModalOpen) { (window.parent || window).dispatchEvent(new Event("codking:otpModalClosed")); window.codkOtpModalOpen = false; codkLog("đŸ“Ŗ Dispatched codking:otpModalClosed"); } } catch (e) { } codkLog("✅ Iframe hidden (CSS from Svelte)"); }; if (!window.codkIframeDestroyListenerAdded) { window.codkIframeDestroyListenerAdded = true; window.addEventListener('message', (event) => { if ( event.data && typeof event.data === 'object' && event.data.type === 'CODK_REQUEST_META_ATTRIBUTION' ) { try { var targetIframe = document.getElementById('codk-full-modal-svelte'); if (!targetIframe || !targetIframe.contentWindow) return; if (event.source !== targetIframe.contentWindow) return; var payload = (typeof window.codkGetMetaClickData === 'function') ? window.codkGetMetaClickData() : {}; targetIframe.contentWindow.postMessage( { type: 'CODK_SET_META_ATTRIBUTION', payload: payload }, '*' ); } catch (e) {} return; } if ( event.data && typeof event.data === 'object' && event.data.type === 'CODK_DESTROY_IFRAME' ) { const iframeId = event.data.iframeId || 'codk-full-modal-svelte'; const targetIframe = document.getElementById(iframeId); if (targetIframe && targetIframe.parentNode) { codkLog("🧹 Removing iframe via CODK_DESTROY_IFRAME message:", iframeId); targetIframe.parentNode.removeChild(targetIframe); try { if (window.codkOtpModalOpen) { (window.parent || window).dispatchEvent(new Event("codking:otpModalClosed")); window.codkOtpModalOpen = false; codkLog("đŸ“Ŗ Dispatched codking:otpModalClosed (destroy)"); } } catch (e) { } } else { codkLog("â„šī¸ CODK_DESTROY_IFRAME: iframe not found (maybe already removed)", iframeId); } const wrapper = document.getElementById('codk-modal-wrapper'); if (wrapper) { wrapper.setAttribute('data-visible', 'false'); wrapper.style.display = 'none'; } iframe = null; window.codkSvelteInitialized = false; window.codkingSvelteReady = false; window.codkSvelteAppMounted = false; window.codkModalShowingSpinner = false; setTimeout(() => { iframe = ensureIframe(); if (typeof window.codkInitSvelteApp === "function") { window.codkInitSvelteApp(); } }, 50); return; } if ( event.data && typeof event.data === 'object' && event.data.type === 'CODK_REDIRECT_TO_CHECKOUT' ) { codkLog("🚀 Received CODK_REDIRECT_TO_CHECKOUT message"); if (typeof enableNormalCheckout === "function") { enableNormalCheckout(); } try { window.location.href = "/checkout"; } catch (redirectError) { console.warn("[app-embed.liquid] âš ī¸ Parent redirect failed:", redirectError); } return; } }); } const ensureIframe = () => { let iframeElement = document.getElementById('codk-full-modal-svelte'); if (!iframeElement) { iframeElement = document.createElement('iframe'); iframeElement.id = 'codk-full-modal-svelte'; iframeElement.setAttribute('data-visible', 'false'); document.body.appendChild(iframeElement); codkLog("✅ Iframe created (CSS handled by Svelte)", { isMobile: isMobile() }); } else { codkLog("â¸ī¸ Iframe already exists - reusing existing iframe"); } return iframeElement; }; let iframe = ensureIframe(); if (window.codkSvelteInitialized) { codkLog("â¸ī¸ Svelte app already initialized - skipping duplicate initialization"); } else { window.codkSvelteInitialized = true; const initializeSvelteApp = () => { try { if (iframe.contentWindow && iframe.contentWindow.codkingSvelteReady) { codkLog("â¸ī¸ Svelte app already ready in iframe - skipping initialization"); return; } try { const iframeDoc = iframe.contentWindow.document; if (iframeDoc && iframeDoc.body) { const existingScript = iframeDoc.querySelector('script[type="module"][src*="notifik_svelte"]'); if (existingScript) { codkLog("â¸ī¸ Script tag already exists in iframe - skipping initialization (app may be loading)"); return; } } } catch (e) { codkLog("âš ī¸ Could not check iframe document (may not be ready yet):", e.message); } codkLog("🚀 Initializing iframe with Svelte app..."); const iframeDoc = iframe.contentWindow.document; iframeDoc.open(); const bodyStyle = isMobile() ? 'margin:0;padding:0;background:transparent;height:100vh;' : 'margin:0;padding:0;background:transparent;height:auto;min-height:100%;'; const htmlStyle = isMobile() ? 'background:transparent;height:100%;' : 'background:transparent;height:auto;min-height:100%;'; window.codkSvelteAppMounted = false; iframeDoc.write( '' + '' + 'COD King OTP' + '' + '' + '
' + '<\/scr' + 'ipt>' + '' ); iframeDoc.close(); codkLog("✅ Svelte app initialized and loading in background"); codkLog("🔗 JS URL: " + ROUTE_URL + 'script/notifik_svelte (auto-redirects to latest build)'); } catch (error) { codkLog("❌ ERROR initializing Svelte:", error); } }; window.codkReinitSvelteIframe = function() { var f = document.getElementById('codk-full-modal-svelte'); if (!f || !f.contentWindow) return; window.codkSvelteAppMounted = false; var cacheBust = '_ri=' + Date.now(); try { var doc = f.contentWindow.document; doc.open(); var bodyStyle = isMobile() ? 'margin:0;padding:0;background:transparent;height:100vh;' : 'margin:0;padding:0;background:transparent;height:auto;min-height:100%;'; var htmlStyle = isMobile() ? 'background:transparent;height:100%;' : 'background:transparent;height:auto;min-height:100%;'; doc.write('COD King OTP<\/head>
<\/div><\/scr' + 'ipt><\/body><\/html>'); doc.close(); codkLog("✅ Iframe reinitialized - Svelte script reloading (cache-bust: " + cacheBust + ")"); } catch (e) { codkLog("❌ Error reinitializing iframe:", e); } }; codkLog("🚀 Pre-loading Svelte app on page load..."); initializeSvelteApp(); } window.addEventListener('codking-svelte-ready', () => { codkLog("✅ Svelte app is ready!"); }); if (!window.__codkPageshowListenerAdded) { window.__codkPageshowListenerAdded = true; window.addEventListener('pageshow', function(event) { if (!event.persisted) return; codkLog("🔄 Page restored from bfcache - checking Svelte status..."); document.body.style.overflow = ''; document.body.style.position = ''; document.body.style.width = ''; document.body.style.top = ''; var currentIframe = document.getElementById('codk-full-modal-svelte'); var svelteWorking = false; try { svelteWorking = currentIframe && currentIframe.contentWindow && currentIframe.contentWindow.appStore && window.codkingSvelteReady; } catch (e) {} if (svelteWorking) { codkLog("✅ Svelte still functional after bfcache restore"); hideIframe(currentIframe); return; } codkLog("âš ī¸ Svelte not functional after bfcache restore - performing full reinit..."); if (currentIframe && currentIframe.parentNode) { currentIframe.parentNode.removeChild(currentIframe); } iframe = null; window.codkSvelteInitialized = false; window.codkingSvelteReady = false; window.codkSvelteAppMounted = false; window.codkModalShowingSpinner = false; window.codkOtpModalOpen = false; iframe = ensureIframe(); try { var iframeDoc = iframe.contentWindow.document; var cacheBust = '_bfc=' + Date.now(); var bodyStyle = isMobile() ? 'margin:0;padding:0;background:transparent;height:100vh;' : 'margin:0;padding:0;background:transparent;height:auto;min-height:100%;'; var htmlStyle = isMobile() ? 'background:transparent;height:100%;' : 'background:transparent;height:auto;min-height:100%;'; window.codkSvelteAppMounted = false; iframeDoc.open(); iframeDoc.write( '' + '' + 'COD King OTP' + '' + '
' + '<\/scr' + 'ipt>' + '' ); iframeDoc.close(); window.codkSvelteInitialized = true; codkLog("✅ Fresh Svelte initialization triggered after bfcache restore (cache-bust: " + cacheBust + ")"); } catch (e) { codkLog("❌ Error during bfcache Svelte reinit:", e); } }); } let resizeTimeout; window.addEventListener('resize', () => { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(() => { const iframe = document.getElementById('codk-full-modal-svelte'); if (iframe && iframe.getAttribute('data-visible') === 'true') { const mobile = isMobile(); if (mobile) { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = '100%'; iframe.contentWindow.document.body.style.height = '100vh'; } } catch (e) { } } else { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = 'auto'; iframe.contentWindow.document.documentElement.style.minHeight = '100%'; iframe.contentWindow.document.body.style.height = 'auto'; iframe.contentWindow.document.body.style.minHeight = '100%'; } } catch (e) { } } codkLog("✅ Iframe document styles updated on resize", { isMobile: mobile, viewportWidth: window.innerWidth }); } }, 150); }); codkLog("đŸ”ĩ TDD Phase 1: Adding button blocking..."); const showSpinner = function() { iframe = iframe || document.getElementById('codk-full-modal-svelte'); if (!iframe) { codkLog("❌ Iframe missing when trying to show spinner. Reinitializing..."); window.codkSvelteInitialized = false; if (typeof window.codkInitSvelteApp === "function") { window.codkInitSvelteApp(); } return; } if (!iframe.contentWindow || !iframe.contentWindow.document) { codkLog("âš ī¸ Iframe document unavailable. Reinitializing..."); window.codkSvelteInitialized = false; if (typeof window.codkInitSvelteApp === "function") { window.codkInitSvelteApp(); } return; } codkLog("đŸ”ĩ TDD Phase 2: Showing spinner (Svelte already loading in background)..."); window.codkModalShowingSpinner = true; window.codkSvelteAppMounted = false; const iframeDoc = iframe.contentWindow.document; const appDiv = iframeDoc.getElementById('app'); if (appDiv) { appDiv.innerHTML = '' + '
' + '' + '
' + '
Loading...
' + '
'; codkLog("✅ Spinner injected into #app (Svelte keeps loading in background)"); } else { codkLog("❌ #app div not found!"); } window.codkScrollY = window.scrollY || 0; document.body.style.overflow = 'hidden'; document.body.style.position = 'fixed'; document.body.style.width = '100%'; document.body.style.top = '-' + window.codkScrollY + 'px'; const mobile = isMobile(); if (mobile) { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = '100%'; iframe.contentWindow.document.body.style.height = '100vh'; } } catch (e) { } } else { try { if (iframe.contentWindow && iframe.contentWindow.document) { iframe.contentWindow.document.documentElement.style.height = 'auto'; iframe.contentWindow.document.documentElement.style.minHeight = '100%'; iframe.contentWindow.document.body.style.height = 'auto'; iframe.contentWindow.document.body.style.minHeight = '100%'; } } catch (e) { } } showIframe(iframe); codkLog("✅ Spinner shown!"); }; const updateMessage = function(message) { codkLog("đŸ”ĩ TDD Phase 3: Updating message to:", message); if (!iframe || !iframe.contentWindow) { codkLog("âš ī¸ Iframe or contentWindow not available (e.g. during redirect), skipping update"); return; } const iframeDoc = iframe.contentWindow.document; const messageEl = iframeDoc.querySelector('.message'); if (messageEl) { messageEl.innerHTML = message; codkLog("✅ Message updated!"); } else { codkLog("❌ Message element not found!"); } }; const checkSvelteStatus = function() { codkLog("đŸ”ĩ TDD Phase 3: Checking if Svelte is ready..."); if (window.codkingSvelteReady) { codkLog("✅ Svelte is ready!"); updateMessage(""); } else { codkLog("âŗ Svelte is NOT ready yet, keeping Loading... message"); } }; const clearSpinner = function() { window.codkModalShowingSpinner = false; codkLog("đŸ”ĩ Clearing spinner HTML..."); try { if (!iframe || !iframe.contentWindow) { codkLog("âš ī¸ Iframe or contentWindow not available (e.g. during redirect), skipping clearSpinner"); return; } const iframeDoc = iframe.contentWindow.document; const appDiv = iframeDoc.getElementById('app'); if (appDiv) { const spinnerContainer = appDiv.querySelector('.container'); const spinnerStyle = iframeDoc.querySelector('style'); const svelteMounted = iframe.contentWindow && iframe.contentWindow.appStore; if (spinnerContainer) { codkLog("âš ī¸ Spinner container still present", { svelteMounted: !!svelteMounted, appDivChildren: appDiv.children.length }); if (!svelteMounted) { codkLog("âš ī¸ Svelte not mounted yet, clearing spinner to allow mount..."); appDiv.innerHTML = ''; codkLog("✅ Spinner cleared - Svelte can now mount"); } else { codkLog("✅ Svelte is mounted, removing spinner container only..."); spinnerContainer.remove(); codkLog("✅ Spinner container removed"); } } if (spinnerStyle && spinnerStyle.textContent.includes('.container')) { spinnerStyle.remove(); codkLog("✅ Spinner style tag removed"); } const computedStyle = iframeDoc.defaultView.getComputedStyle(appDiv); if (computedStyle.position === 'fixed' && computedStyle.zIndex === '999999') { appDiv.style.cssText = ''; codkLog("✅ #app spinner styles reset"); } if (!spinnerContainer && !spinnerStyle) { codkLog("✅ Spinner already cleared by Svelte"); } } else { codkLog("âš ī¸ #app div not found"); } } catch (error) { codkLog("âš ī¸ Error clearing spinner:", error); } }; window.addEventListener('codking-svelte-ready', function() { codkLog("🎉 TDD Phase 3: Received 'codking-svelte-ready' event!"); requestAnimationFrame(function() { clearSpinner(); setTimeout(function() { clearSpinner(); }, 50); }); }); const closeModal = function(isManualClose = true) { window.codkModalShowingSpinner = false; if (window.codkSvelteReadyPollId) { clearInterval(window.codkSvelteReadyPollId); window.codkSvelteReadyPollId = null; } codkLog("đŸ”ĩ ========== CLOSING MODAL ==========", { isManualClose }); const iframeElement = document.getElementById('codk-full-modal-svelte'); if (!iframeElement) { codkLog("❌ CRITICAL: iframe element not found!"); return; } if (iframeElement !== iframe) { codkLog("âš ī¸ WARNING: iframe variable doesn't match DOM element!"); } const scrollY = window.codkScrollY || 0; codkLog("đŸ”ĩ Saved scroll position:", scrollY); codkLog("đŸ”ĩ Hiding iframe (CSS from Svelte)..."); hideIframe(iframe); document.body.style.removeProperty('overflow'); document.body.style.removeProperty('position'); document.body.style.removeProperty('width'); document.body.style.removeProperty('top'); document.body.style.removeProperty('height'); if (document.documentElement) { document.documentElement.style.removeProperty('overflow'); document.documentElement.style.removeProperty('position'); document.documentElement.style.removeProperty('width'); document.documentElement.style.removeProperty('height'); } codkLog("đŸ”ĩ Body styles cleared"); if (scrollY > 0) { window.scrollTo(0, scrollY); codkLog("đŸ”ĩ Scrolled to:", scrollY); } else { window.scrollTo(0, 0); codkLog("đŸ”ĩ Scrolled to top"); } try { if (iframe && iframe.contentWindow && iframe.contentWindow.appStore) { setTimeout(function() { iframe.contentWindow.appStore.update(function(state) { return { ...state, isOpen: false }; }); codkLog("✅ Svelte modal state updated to closed"); }, 0); } } catch (error) { codkLog("âš ī¸ Could not update Svelte store:", error); } if (typeof window.codkIsProcessing !== 'undefined') { window.codkIsProcessing = false; } window.codkScrollY = 0; codkLog("✅ ========== MODAL CLOSE COMPLETE =========="); }; window.addEventListener('message', function(event) { codkLog("đŸ”ĩ Received message from iframe:", event.data, event.origin); var closeModalMessage = event.data === 'codk-close-modal' || (Array.isArray(event.data) && event.data[0] === 'codk-close-modal'); if (closeModalMessage) { if (window.codkModalShowingSpinner === true) { codkLog("âŗ Ignoring 'codk-close-modal' while spinner is showing (Svelte not ready yet) - keeps modal open on Safari/redirect"); return; } codkLog("✅ Received 'codk-close-modal' message - calling closeModal()"); closeModal(true); return; } if (event.data && typeof event.data === 'object' && event.data.type === 'codking:reattachButtonBlock') { if (buttonBlocking && typeof buttonBlocking.observeButtons === 'function') { buttonBlocking.observeButtons(); codkLog("✅ Re-attached button block listeners (cart drawer mutation from Svelte)"); } return; } if (event.data && typeof event.data === 'object' && !Array.isArray(event.data) && event.data.type === 'codk-iframe-height') { const iframe = document.getElementById('codk-full-modal-svelte'); if (iframe && iframe.getAttribute('data-visible') === 'true' && !event.data.isMobile) { const height = event.data.height; const maxHeight = Math.min(height, window.innerHeight * 0.9); iframe.style.height = maxHeight + 'px'; codkLog("✅ Updated iframe height from content:", { contentHeight: height, appliedHeight: maxHeight, viewportHeight: window.innerHeight }); } return; } if (Array.isArray(event.data) && event.data.length >= 1 && (event.data[0] === 'null' || event.data[0] == null)) { return; } codkLog("â„šī¸ Ignoring message (not recognized):", event.data); }); if (!window.__codkScrollYDefined) { let _codkScrollY = 0; Object.defineProperty(window, 'codkScrollY', { get: function() { return _codkScrollY; }, set: function(value) { _codkScrollY = value; }, configurable: true }); window.__codkScrollYDefined = true; } function isShopifyBuyNowButton(buttonElement) { if (!buttonElement) { return false; } const productButtonSelectors = COD_BUTTON_SELECTORS.BUY_NOW; const isBuyNowButton = productButtonSelectors.some(function(selector) { return buttonElement.matches(selector); }); const isBuyNowClass = buttonElement.classList.contains("shopify-payment-button__button") && buttonElement.classList.contains( "shopify-payment-button__button--unbranded" ); const parentElement = buttonElement.closest("shopify-buy-it-now-button"); const hasBuyNowAttributes = parentElement && parentElement.hasAttribute("access-token") && parentElement.hasAttribute("buyer-country") && parentElement.hasAttribute("buyer-currency"); return isBuyNowButton || isBuyNowClass || hasBuyNowAttributes; } function resolveShopifyBuyNowButtonFromClick(clickedButton) { if (!clickedButton || typeof clickedButton.closest !== "function") { return null; } // Any click inside Shopify's custom element (including inner overlays) var host = clickedButton.closest("shopify-buy-it-now-button"); if (host) { var innerBtn = host.querySelector("button.shopify-payment-button__button") || host.querySelector("button[class*='shopify-payment-button__button']"); if (innerBtn && isShopifyBuyNowButton(innerBtn)) { return innerBtn; } } // Optional: some themes (e.g. TPO) add .tpo-buy-it-now-btn — most shops do not. // When absent, the user clicks the real button and checkShopifyBuyNowButtons() // returns true on the first isShopifyBuyNowButton(clickedButton) check. // TPO overlay sits as sibling of shopify-accelerated-checkout, so querySelector // from the overlay never finds the
tag 4. Save. Done. HOW IT WORKS: â€ĸ Appears 7 seconds after page load â€ĸ Shows only ONCE per user (uses localStorage) â€ĸ Email capture required before spin â€ĸ Generates a unique discount code shown on win â€ĸ Auto-copies code to clipboard â€ĸ Mobile responsive (wheel scales down on small screens) âš ī¸ DISCOUNT CODES: The codes shown (SPIN10, SPIN15, etc.) must be CREATED MANUALLY in: Shopify Admin → Discounts → Create discount → set code name to match. ========================================================= -->