This PR introduces a comprehensive, display-only template preview system for both WhatsApp and Twilio templates rendering of all supported template types. This lays the foundation for rich template previews across: - Template selection modals - Campaign creation flows - Message composer - Message screen. <img width="1818" height="2058" alt="template-preview" src="https://github.com/user-attachments/assets/9833b28c-f824-4568-8f74-6da09ac61f62" /> --------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: iamsivin <iamsivin@gmail.com> Co-authored-by: Muhsin <12408980+muhsin-k@users.noreply.github.com>
106 lines
2.9 KiB
Vue
106 lines
2.9 KiB
Vue
<script setup>
|
|
import TemplatePreview from './TemplatePreview.vue';
|
|
import {
|
|
whatsAppTemplates,
|
|
getWhatsAppVariables,
|
|
} from './templates/whatsapp-templates.js';
|
|
import { twilioTemplates } from './templates/twilio-templates.js';
|
|
|
|
const findWhatsApp = name => whatsAppTemplates.find(t => t.name === name);
|
|
const findTwilio = name => twilioTemplates.find(t => t.friendly_name === name);
|
|
|
|
const greet = findWhatsApp('greet');
|
|
const eventInvitation = findWhatsApp('event_invitation_static');
|
|
const orderConfirmation = findWhatsApp('order_confirmation');
|
|
const discountCoupon = findWhatsApp('discount_coupon');
|
|
const trainingVideo = findWhatsApp('training_video');
|
|
|
|
const twilioGreet = findTwilio('greet');
|
|
const shoeLaunch = findTwilio('shoe_launch');
|
|
const welcomeMessage = findTwilio('welcome_message_new');
|
|
const courseFeeReminder = findTwilio('course_fee_reminder');
|
|
</script>
|
|
|
|
<template>
|
|
<Story
|
|
title="Components/TemplatePreview"
|
|
:layout="{ type: 'grid', width: 400 }"
|
|
>
|
|
<Variant title="WhatsApp - Simple Text">
|
|
<TemplatePreview
|
|
:template="greet"
|
|
:variables="getWhatsAppVariables(greet)"
|
|
platform="whatsapp"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="WhatsApp - Simple Text (No Variables)">
|
|
<TemplatePreview :template="greet" :variables="{}" platform="whatsapp" />
|
|
</Variant>
|
|
|
|
<Variant title="WhatsApp - Call to Action Buttons">
|
|
<TemplatePreview
|
|
:template="eventInvitation"
|
|
:variables="getWhatsAppVariables(eventInvitation)"
|
|
platform="whatsapp"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="WhatsApp - Image Media">
|
|
<TemplatePreview
|
|
:template="orderConfirmation"
|
|
:variables="getWhatsAppVariables(orderConfirmation)"
|
|
platform="whatsapp"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="WhatsApp - Video Media">
|
|
<TemplatePreview
|
|
:template="trainingVideo"
|
|
:variables="getWhatsAppVariables(trainingVideo)"
|
|
platform="whatsapp"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="WhatsApp - Copy Code">
|
|
<TemplatePreview
|
|
:template="discountCoupon"
|
|
:variables="getWhatsAppVariables(discountCoupon)"
|
|
platform="whatsapp"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="Twilio - Text">
|
|
<TemplatePreview
|
|
:template="twilioGreet"
|
|
:variables="twilioGreet.variables"
|
|
platform="twilio"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="Twilio - Media">
|
|
<TemplatePreview
|
|
:template="shoeLaunch"
|
|
:variables="shoeLaunch.variables"
|
|
platform="twilio"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="Twilio - Quick Reply">
|
|
<TemplatePreview
|
|
:template="welcomeMessage"
|
|
:variables="welcomeMessage.variables"
|
|
platform="twilio"
|
|
/>
|
|
</Variant>
|
|
|
|
<Variant title="Twilio - Call to Action">
|
|
<TemplatePreview
|
|
:template="courseFeeReminder"
|
|
:variables="courseFeeReminder.variables"
|
|
platform="twilio"
|
|
/>
|
|
</Variant>
|
|
</Story>
|
|
</template>
|