/** * WC Licensed Product - Frontend Scripts * * @package Jeremias\WcLicensedProduct */ (function($) { 'use strict'; var WCLicensedProductFrontend = { init: function() { this.bindEvents(); }, bindEvents: function() { $(document).on('click', '.copy-license-btn', this.copyLicenseKey); }, /** * Copy license key to clipboard */ copyLicenseKey: function(e) { e.preventDefault(); var $btn = $(this); var licenseKey = $btn.data('license-key'); if (!licenseKey) { return; } // Use modern clipboard API if available if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(licenseKey) .then(function() { WCLicensedProductFrontend.showCopyFeedback($btn, true); }) .catch(function() { WCLicensedProductFrontend.fallbackCopy(licenseKey, $btn); }); } else { WCLicensedProductFrontend.fallbackCopy(licenseKey, $btn); } }, /** * Fallback copy method for older browsers */ fallbackCopy: function(text, $btn) { var $temp = $('