Keep Studio business branding in verified client storage

This commit is contained in:
khondokartowsif171
2026-10-19 11:54:13 +06:00
parent 165320cc9f
commit 54091f4578
11 changed files with 151 additions and 38 deletions
+25 -20
View File
@@ -746,7 +746,7 @@ Details & Offer: {{field2}}
Write 3 distinct ready-to-send Bengali fashion customer responses:
1. Aesthetic luxury product appreciation highlighting fabric softness, elegant drape, and premium feel.
2. Complete size guidance and direct order closure asking for delivery address and phone number.
3. 1-Click WhatsApp booking link: https://wa.me/8801712426871 with cash-on-delivery trial assurance.`
3. 1-Click WhatsApp booking link: {{wa_link}} with cash-on-delivery trial assurance.`
},
{
id: 'panjabi_closer',
@@ -769,7 +769,7 @@ Details & Offer: {{field2}}
Write 3 distinct high-converting, courteous Bengali responses:
1. Royal aesthetic appreciation highlighting fine thread embroidery, pre-shrunk premium cotton/silk comfort, and festive elegance.
2. Accurate size guidance (chest & length fit) with doorstep size trial assurance.
3. 1-Click WhatsApp booking link: https://wa.me/8801712426871 with cash on delivery across Bangladesh.`
3. 1-Click WhatsApp booking link: {{wa_link}} with cash on delivery across Bangladesh.`
},
{
id: 'gadget_explainer',
@@ -792,7 +792,7 @@ Specs & Offer: {{field2}}
Generate 3 high-trust Bengali customer responses:
1. Power-packed feature breakdown (battery, AMOLED screen, sound quality, water resistance).
2. Official warranty guarantee & risk-free Cash on Delivery verification guide.
3. Fast 1-Click WhatsApp purchase link: https://wa.me/8801712426871.`
3. Fast 1-Click WhatsApp purchase link: {{wa_link}}.`
},
{
id: 'organic_honey_lab',
@@ -861,7 +861,7 @@ Store context: {{field2}}
Write 3 distinct ready-to-copy Bengali replies:
1. Instant sweet greeting with price & benefits
2. Direct order closing script asking for Name, Address, Phone
3. 1-Click WhatsApp direct order message with link https://wa.me/8801712426871`
3. 1-Click WhatsApp direct order message with link {{wa_link}}`
},
{
id: 'veo_prompter',
@@ -1216,14 +1216,14 @@ document.addEventListener('aura-studio-ready', () => {
statusMsg.classList.remove('hidden');
statusMsg.style.color = '#C084FC';
statusMsg.textContent = '⏳ Processing with Gemini 3.5 AI...';
execBtn.disabled = true;
// Extract form values & dynamic store metadata
const inputs = document.querySelectorAll('.runner-input');
const selectedBrandKey = document.getElementById('brandWatermarkSelect')?.value || 'glamourstouch';
const activeBrand = getBrandProfile(selectedBrandKey);
const cleanPhone = (activeBrand.footerHotline || '').replace(/\D/g, '');
const dynamicWaLink = `https://wa.me/88${cleanPhone}`;
const dynamicWaLink = window.AuraStudio.whatsappUrl(activeBrand.footerHotline);
if (!dynamicWaLink) { alert('Settings-এ country code সহ WhatsApp নম্বর দিন।'); return; }
execBtn.disabled = true;
let prompt = currentRunningApp.promptTemplate || 'Generate helpful response for the user.';
@@ -1239,7 +1239,6 @@ document.addEventListener('aura-studio-ready', () => {
prompt = prompt.replace(/{{brand_site}}/g, activeBrand.footerSite);
prompt = prompt.replace(/{{brand_name}}/g, activeBrand.headerTitle);
prompt = prompt.replace(/{{wa_link}}/g, dynamicWaLink);
prompt = prompt.replace(/https:\/\/wa\.me\/8801712426871/g, dynamicWaLink);
const apiKey = window.AuraStudio.local.getItem('opal_gemini_api_key') || '';
const model = currentRunningApp.model || window.AuraStudio.local.getItem('opal_selected_model') || 'gemini-2.0-flash';
@@ -1715,10 +1714,11 @@ function initPosterLab() {
shareWhatsAppBtn.addEventListener('click', () => {
const selectedBrand = document.getElementById('brandWatermarkSelect')?.value || 'glamourstouch';
const activeBrand = getBrandProfile(selectedBrand);
const cleanPhone = (activeBrand.footerHotline || '').replace(/\D/g, '');
const pTitle = productInput.value.trim() || 'Authentic Product';
const waLink = window.AuraStudio.whatsappUrl(activeBrand.footerHotline);
if (!waLink) { alert('Settings-এ country code সহ WhatsApp নম্বর দিন।'); return; }
const pTitle = productInput.value.trim() || 'Product';
const text = encodeURIComponent(`✨ Hello! I want to order: ${pTitle}\nWebsite: https://${activeBrand.footerSite || ''}\nHotline: ${activeBrand.footerHotline}`);
window.open(`https://wa.me/88${cleanPhone}?text=${text}`, '_blank');
window.open(`${waLink}?text=${text}`, '_blank', 'noopener');
});
// n8n Auto-Post Webhook
@@ -1742,18 +1742,20 @@ function initPosterLab() {
try {
const selectedBrand = document.getElementById('brandWatermarkSelect')?.value || 'glamourstouch';
const activeBrand = getBrandProfile(selectedBrand);
const cleanPhone = (activeBrand.footerHotline || '').replace(/\D/g, '');
const pTitle = productInput.value.trim() || 'Authentic Product';
const pPrice = productPrice.value.trim() || '৳ ১,০৬০';
const pPrice = productPrice.value.trim();
const waLink = window.AuraStudio.whatsappUrl(activeBrand.footerHotline);
const website = window.AuraStudio.workspace.brand?.website || '';
const caption = [`✨ ${pTitle} ✨`, pPrice ? `💰 মূল্য: ${pPrice}` : '', waLink ? `💬 WhatsApp: ${waLink}` : '', website ? `🌐 ${website}` : ''].filter(Boolean).join('\n\n');
const posterDataUrl = posterCanvas.toDataURL('image/jpeg', 0.92);
const payload = {
title: pTitle,
price: pPrice,
caption: `✨ ${pTitle} ✨\n\n💰 অফার মূল্য: ${pPrice}\n🛡️ ১০০% অরিজিনাল গ্যারান্টি!\n\n💬 সরাসরি WhatsApp এ অর্ডার করতে ইনবক্স করুন:\n👉 https://wa.me/88${cleanPhone}\n📞 হটলাইন: ${activeBrand.footerHotline}\n🌐 ওয়েবসাইট: https://${activeBrand.footerSite}`,
caption,
image_url: posterDataUrl,
store: activeBrand.headerTitle || "Official Store",
website: `https://${activeBrand.footerSite}`,
website,
whatsapp: activeBrand.footerHotline,
timestamp: new Date().toISOString()
};
@@ -1802,7 +1804,10 @@ function getDynamicBrandProfiles() {
function getBrandProfile(brandKey) {
const all = getDynamicBrandProfiles();
return all[brandKey] || all.workspace;
if (brandKey && brandKey !== 'workspace' && all[brandKey]) return all[brandKey];
const brand = window.AuraStudio.workspace.brand || {};
return { ...all.workspace, headerTitle: brand.name || window.AuraStudio.workspace.name,
footerSite: (brand.website || '').replace(/^https?:\/\//, ''), footerHotline: brand.phone || '' };
}
// Universal Dynamic Product Resolver
@@ -6139,8 +6144,8 @@ async function drawWhatsAppQrOnCanvas(ctx, x, y, size, hotline = '') {
roundRect(ctx, x - 4, y - 4, size + 8, size + 8, 10);
ctx.fill();
const rawPhone = hotline.replace(/\D/g, '');
const waUrl = `https://wa.me/88${rawPhone.startsWith('88') ? rawPhone.slice(2) : rawPhone.replace(/^0/, '')}`;
const waUrl = window.AuraStudio.whatsappUrl(hotline);
if (!waUrl) return;
const qrContainer = document.getElementById('qrcodeHidden');
if (qrContainer && typeof QRCode !== 'undefined') {
@@ -6199,8 +6204,8 @@ function initInboxAI() {
const selectedBrand = document.getElementById('brandWatermarkSelect')?.value || 'glamourstouch';
const activeBrand = getBrandProfile(selectedBrand);
const cleanPhone = (activeBrand.footerHotline || '').replace(/\D/g, '');
const dynamicWaLink = `https://wa.me/88${cleanPhone}`;
const dynamicWaLink = window.AuraStudio.whatsappUrl(activeBrand.footerHotline);
if (!dynamicWaLink) { alert('Settings-এ country code সহ WhatsApp নম্বর দিন।'); return; }
if (!query) {
alert('Please enter a customer message');