import { listOffers } from '@wix/bex-utils/@wix/ambassador-dealer-v1-serving-offer/http'; import { Offer } from '@wix/bex-utils/@wix/ambassador-dealer-v1-serving-offer/types'; // Sample offers with valid MarketingCardSchema structure const SAMPLE_OFFERS: Offer[] = [ { offerGuid: 'offer-1', asset: { creative: { title: 'Boost Your Sales', description: { text: 'Increase revenue with smart marketing tools and analytics.', learnMore: { text: 'Learn more', link: 'https://support.wix.com/ascend', }, }, imageUrl: 'https://picsum.photos/seed/sales/400/200', ctaButton: { text: 'Get Started', link: 'https://www.wix.com/ascend', skin: 'standard', priority: 'secondary', }, badge: { text: 'New', skin: 'general', }, }, }, }, { offerGuid: 'offer-2', asset: { creative: { title: 'Connect with Customers', description: { text: 'Build lasting relationships with automated email campaigns.', }, imageUrl: 'https://picsum.photos/seed/customers/400/200', ctaButton: { text: 'Try Now', link: 'https://www.wix.com/email-marketing', skin: 'standard', priority: 'secondary', }, badge: { text: 'Popular', skin: 'urgent', }, }, }, }, { offerGuid: 'offer-3', asset: { creative: { title: 'Expand Your Reach', description: { text: 'Get discovered by more customers with SEO tools.', }, imageUrl: 'https://picsum.photos/seed/reach/400/200', ctaButton: { text: 'Learn More', link: 'https://www.wix.com/seo', skin: 'standard', priority: 'secondary', }, }, }, }, { offerGuid: 'offer-4', asset: { creative: { title: 'Grow Your Business', description: { text: 'Grow your business with our marketing tools and analytics.', }, imageUrl: 'https://picsum.photos/seed/grow/400/200', ctaButton: { text: 'Explore', link: 'https://www.wix.com/business', skin: 'standard', priority: 'secondary', }, }, }, }, ]; // Sample offers with a DIFFERENT structure (for translate function example) // This demonstrates offers that don't match MarketingCardSchema directly const CUSTOM_STRUCTURE_OFFERS: Offer[] = [ { offerGuid: 'custom-offer-1', asset: { creative: { headline: 'Supercharge Your Website', body: 'Add powerful features with our premium apps and integrations.', media: { url: 'https://picsum.photos/seed/supercharge/400/200', }, action: { label: 'Browse Apps', url: 'https://www.wix.com/app-market', }, tag: 'Featured', helpLink: 'https://support.wix.com/apps', }, }, }, { offerGuid: 'custom-offer-2', asset: { creative: { headline: 'Go Premium Today', body: 'Unlock all features and remove ads from your site.', media: { url: 'https://picsum.photos/seed/premium/400/200', }, action: { label: 'Upgrade Now', url: 'https://www.wix.com/upgrade', }, }, }, }, { offerGuid: 'custom-offer-3', asset: { creative: { headline: 'Analytics Dashboard', body: 'Track your site performance with detailed insights.', media: { url: 'https://picsum.photos/seed/analytics/400/200', }, action: { label: 'View Analytics', url: 'https://www.wix.com/analytics', }, tag: 'New', }, }, }, ]; export const suggestionsAPIHttpClientMocks = ( whenRequest: typeof import('@wix/http-client-testkit/client').whenRequest, ) => { return [ whenRequest(listOffers) .withData((data) => data.realEstateId === 'your-placement-id') .reply(200, async () => ({ offers: SAMPLE_OFFERS, })) .persist(), whenRequest(listOffers) .withData((data) => data.realEstateId === '3-offers-placement-id') .reply(200, async () => ({ offers: SAMPLE_OFFERS.slice(0, 3), })) .persist(), // Offers with custom structure for translate function example whenRequest(listOffers) .withData((data) => data.realEstateId === 'custom-structure-placement-id') .reply(200, async () => ({ offers: CUSTOM_STRUCTURE_OFFERS, })) .persist(), ]; };