From b9044220bbd72f590695f6f6a38a84f8bc748fe9 Mon Sep 17 00:00:00 2001 From: Tiago de Andrade Freire Date: Mon, 25 Oct 2021 16:05:30 -0300 Subject: [PATCH] feat: region-banner --- manifest.json | 4 +- messages/bg-BG.json | 34 ++++ messages/bs-BA.json | 34 ++++ messages/context.json | 36 ++++ messages/en.json | 40 +++- messages/es.json | 40 +++- messages/fr-FR.json | 34 ++++ messages/it-IT.json | 34 ++++ messages/ja-JP.json | 34 ++++ messages/ko-KR.json | 34 ++++ messages/nl-NL.json | 34 ++++ messages/pt.json | 40 +++- messages/ro-RO.json | 34 ++++ react/RegionBanner.tsx | 3 + .../components/RegionBanner/RegionBanner.css | 4 + .../components/RegionBanner/RegionBanner.tsx | 90 +++++++++ react/components/RegionBanner/schema.ts | 76 ++++++++ react/package.json | 4 +- react/typings/region-banner.d.ts | 2 + react/yarn.lock | 8 + store/contentSchemas.json | 173 ++++++++++++++++++ store/interfaces.json | 30 ++- 22 files changed, 799 insertions(+), 23 deletions(-) create mode 100644 messages/bg-BG.json create mode 100644 messages/bs-BA.json create mode 100644 messages/context.json mode change 100755 => 100644 messages/en.json mode change 100755 => 100644 messages/es.json create mode 100644 messages/fr-FR.json create mode 100644 messages/it-IT.json create mode 100644 messages/ja-JP.json create mode 100644 messages/ko-KR.json create mode 100644 messages/nl-NL.json mode change 100755 => 100644 messages/pt.json create mode 100644 messages/ro-RO.json create mode 100644 react/RegionBanner.tsx create mode 100644 react/components/RegionBanner/RegionBanner.css create mode 100644 react/components/RegionBanner/RegionBanner.tsx create mode 100644 react/components/RegionBanner/schema.ts create mode 100644 react/typings/region-banner.d.ts create mode 100644 store/contentSchemas.json diff --git a/manifest.json b/manifest.json index 245fd01..72428f5 100755 --- a/manifest.json +++ b/manifest.json @@ -5,6 +5,7 @@ "builders": { "store": "0.x", "react": "3.x", + "messages": "1.x", "docs": "0.x" }, "dependencies": { @@ -25,7 +26,8 @@ "vtex.add-to-cart-button": "0.x", "vtex.order-items": "0.x", "vtex.product-summary": "2.x", - "vtex.apps-graphql": "2.x" + "vtex.apps-graphql": "2.x", + "vtex.store-image": "0.x" }, "registries": [], "policies": [], diff --git a/messages/bg-BG.json b/messages/bg-BG.json new file mode 100644 index 0000000..0d8d884 --- /dev/null +++ b/messages/bg-BG.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "Изображение", + "admin/editor.store-image.src.title": "Изображение", + "admin/editor.store-image.alt.title": "Алтернативен текст", + "admin/editor.store-image.title.title": "Заглавие на изображението", + "admin/editor.store-image.title.description": "Заглавието се показва при задържане на мишката", + "admin/editor.image-list.title": "Списък с изображения", + "admin/editor.image-list.description": "Показва списък с изображения", + "admin/editor.image-list.images.title": "Изображения", + "admin/editor.image-list.images.image.title": "Изображение", + "admin/editor.image-list.images.mobileImage.title": "Изображение за мобилно устройство", + "admin/editor.image-list.images.description.title": "Алтернативен текст за изображение", + "admin/editor.image-list.images.title.title": "Заглавие на изображение", + "admin/editor.image-list.images.link.url.title": "URL адрес с линк за изображението", + "admin/editor.image-list.images.link.openNewTab.title": "Би трябвало да се отваря в нов раздел", + "admin/editor.image-list.images.link.noFollow.title": "Би трябвало да е nofollow линк", + "admin/editor.image-list.images.link.title.title": "Заглавие на линка", + "admin/editor.image-list.height.title": "Максимална височина за всяко изображение (px)", + "admin/editor.image-list.images.width.title": "Широчина на изображението", + "admin/editor.image-list.images.width.description": "Широчина на изображението за единично изображение (% или px)", + "admin/editor.image-slider.title": "Слайдер на изображението", + "admin/editor.image-slider.description": "Слайдер на изображението", + "admin/editor.image-slider.slider.title": "Опции на слайдера", + "admin/editor.image-slider.slider.infinite": "Безкрайно", + "admin/editor.image-slider.slider.showNavigation": "Показване на навигационни стрелки", + "admin/editor.image-slider.slider.showPaginationDots": "Показване на точки за страниране", + "admin/editor.image-slider.slider.usePagination": "Използване на страниране", + "admin/editor.image.analytics.title": "Събитие за анализ", + "admin/editor.image.analytics.none": "Не", + "admin/editor.image.analytics.provide": "Да", + "admin/editor.image.analytics.promotionId": "ИД на промоция", + "admin/editor.image.analytics.promotionName": "Име на промоция", + "admin/editor.image.analytics.promotionPosition": "Креативно позициониране" +} diff --git a/messages/bs-BA.json b/messages/bs-BA.json new file mode 100644 index 0000000..d927433 --- /dev/null +++ b/messages/bs-BA.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "crwdns133862:0crwdne133862:0", + "admin/editor.store-image.src.title": "crwdns133864:0crwdne133864:0", + "admin/editor.store-image.alt.title": "crwdns133866:0crwdne133866:0", + "admin/editor.store-image.title.title": "crwdns133868:0crwdne133868:0", + "admin/editor.store-image.title.description": "crwdns133870:0crwdne133870:0", + "admin/editor.image-list.title": "crwdns133872:0crwdne133872:0", + "admin/editor.image-list.description": "crwdns133874:0crwdne133874:0", + "admin/editor.image-list.images.title": "crwdns133876:0crwdne133876:0", + "admin/editor.image-list.images.image.title": "crwdns133878:0crwdne133878:0", + "admin/editor.image-list.images.mobileImage.title": "crwdns133880:0crwdne133880:0", + "admin/editor.image-list.images.description.title": "crwdns133882:0crwdne133882:0", + "admin/editor.image-list.images.title.title": "crwdns133884:0crwdne133884:0", + "admin/editor.image-list.images.link.url.title": "crwdns133886:0crwdne133886:0", + "admin/editor.image-list.images.link.openNewTab.title": "crwdns133888:0crwdne133888:0", + "admin/editor.image-list.images.link.noFollow.title": "crwdns133890:0crwdne133890:0", + "admin/editor.image-list.images.link.title.title": "crwdns133892:0crwdne133892:0", + "admin/editor.image-list.height.title": "crwdns133894:0crwdne133894:0", + "admin/editor.image-list.images.width.title": "crwdns133896:0crwdne133896:0", + "admin/editor.image-list.images.width.description": "crwdns133898:0crwdne133898:0", + "admin/editor.image-slider.title": "crwdns133900:0crwdne133900:0", + "admin/editor.image-slider.description": "crwdns133902:0crwdne133902:0", + "admin/editor.image-slider.slider.title": "crwdns133904:0crwdne133904:0", + "admin/editor.image-slider.slider.infinite": "crwdns133906:0crwdne133906:0", + "admin/editor.image-slider.slider.showNavigation": "crwdns133908:0crwdne133908:0", + "admin/editor.image-slider.slider.showPaginationDots": "crwdns133910:0crwdne133910:0", + "admin/editor.image-slider.slider.usePagination": "crwdns133912:0crwdne133912:0", + "admin/editor.image.analytics.title": "crwdns133914:0crwdne133914:0", + "admin/editor.image.analytics.none": "crwdns133916:0crwdne133916:0", + "admin/editor.image.analytics.provide": "crwdns133918:0crwdne133918:0", + "admin/editor.image.analytics.promotionId": "crwdns133920:0crwdne133920:0", + "admin/editor.image.analytics.promotionName": "crwdns133922:0crwdne133922:0", + "admin/editor.image.analytics.promotionPosition": "crwdns133924:0crwdne133924:0" +} diff --git a/messages/context.json b/messages/context.json new file mode 100644 index 0000000..39baf05 --- /dev/null +++ b/messages/context.json @@ -0,0 +1,36 @@ +{ + "admin/editor.store-image.title": "Image", + "admin/editor.store-image.src.title": "Image", + "admin/editor.store-image.alt.title": "Alternative text", + "admin/editor.store-image.title.title": "Image title", + "admin/editor.store-image.title.description": "Title to be shown on hover", + "admin/editor.image-list.title": "Image List", + "admin/editor.image-list.description": "Show a list of images", + "admin/editor.image-list.images.title": "Images", + "admin/editor.image-list.images.image.title": "Image", + "admin/editor.image-list.images.mobileImage.title": "Image for mobile", + "admin/editor.image-list.images.description.title": "Image alt text", + "admin/editor.image-list.images.title.title": "Image title", + "admin/editor.image-list.images.link.url.title": "Image link URL", + "admin/editor.image-list.images.link.openNewTab.title": "Should open on new tab", + "admin/editor.image-list.images.link.noFollow.title": "Should be a nofollow link", + "admin/editor.image-list.images.link.title.title": "Title for the link", + "admin/editor.image-list.height.title": "Maximum height for each image (px)", + "admin/editor.image-list.images.width.title": "Image width", + "admin/editor.image-list.images.franchises.title": "Franchises", + "admin/editor.image-list.images.franchises.description": "Franchise names separated by commas", + "admin/editor.image-list.images.width.description": "Image width for a single image (% or px)", + "admin/editor.image-slider.title": "Image Slider", + "admin/editor.image-slider.description": "Image Slider", + "admin/editor.image-slider.slider.title": "Slider options", + "admin/editor.image-slider.slider.infinite": "Infinite", + "admin/editor.image-slider.slider.showNavigation": "Show navigation arrows", + "admin/editor.image-slider.slider.showPaginationDots": "Show pagination dots", + "admin/editor.image-slider.slider.usePagination": "Use pagination", + "admin/editor.image.analytics.title": "Analytics event", + "admin/editor.image.analytics.none": "No", + "admin/editor.image.analytics.provide": "Yes", + "admin/editor.image.analytics.promotionId": "Promotion ID", + "admin/editor.image.analytics.promotionName": "Promotion Name", + "admin/editor.image.analytics.promotionPosition": "Creative position" +} \ No newline at end of file diff --git a/messages/en.json b/messages/en.json old mode 100755 new mode 100644 index 340f269..52042e2 --- a/messages/en.json +++ b/messages/en.json @@ -1,4 +1,36 @@ -{ - "admin/test": "test", - "store/test": "test" -} +{ + "admin/editor.store-image.title": "Image", + "admin/editor.store-image.src.title": "Image", + "admin/editor.store-image.alt.title": "Alternative text", + "admin/editor.store-image.title.title": "Image title", + "admin/editor.store-image.title.description": "Title to be shown on hover", + "admin/editor.image-list.title": "Image List", + "admin/editor.image-list.description": "Show a list of images", + "admin/editor.image-list.images.title": "Images", + "admin/editor.image-list.images.image.title": "Image", + "admin/editor.image-list.images.mobileImage.title": "Image for mobile", + "admin/editor.image-list.images.description.title": "Image alt text", + "admin/editor.image-list.images.title.title": "Image title", + "admin/editor.image-list.images.link.url.title": "Image link URL", + "admin/editor.image-list.images.link.openNewTab.title": "Should open on new tab", + "admin/editor.image-list.images.link.noFollow.title": "Should be a nofollow link", + "admin/editor.image-list.images.link.title.title": "Title for the link", + "admin/editor.image-list.height.title": "Maximum height for each image (px)", + "admin/editor.image-list.images.width.title": "Image width", + "admin/editor.image-list.images.franchises.title": "Franchises", + "admin/editor.image-list.images.franchises.description": "Franchise names separated by commas", + "admin/editor.image-list.images.width.description": "Image width for a single image (% or px)", + "admin/editor.image-slider.title": "Image Slider", + "admin/editor.image-slider.description": "Image Slider", + "admin/editor.image-slider.slider.title": "Slider options", + "admin/editor.image-slider.slider.infinite": "Infinite", + "admin/editor.image-slider.slider.showNavigation": "Show navigation arrows", + "admin/editor.image-slider.slider.showPaginationDots": "Show pagination dots", + "admin/editor.image-slider.slider.usePagination": "Use pagination", + "admin/editor.image.analytics.title": "Analytics event", + "admin/editor.image.analytics.none": "No", + "admin/editor.image.analytics.provide": "Yes", + "admin/editor.image.analytics.promotionId": "Promotion ID", + "admin/editor.image.analytics.promotionName": "Promotion Name", + "admin/editor.image.analytics.promotionPosition": "Creative position" +} diff --git a/messages/es.json b/messages/es.json old mode 100755 new mode 100644 index bdf4127..61038a8 --- a/messages/es.json +++ b/messages/es.json @@ -1,4 +1,36 @@ -{ - "admin/test": "teste", - "store/test": "teste" -} +{ + "admin/editor.store-image.title": "Imagen", + "admin/editor.store-image.src.title": "Imagen", + "admin/editor.store-image.alt.title": "Texto alternativo", + "admin/editor.store-image.title.title": "Título de la imagen", + "admin/editor.store-image.title.description": "Título que se mostrará al pasar el mouse sobre la imagen", + "admin/editor.image-list.title": "Lista de imágenes", + "admin/editor.image-list.description": "Mostrar una lista de imágenes", + "admin/editor.image-list.images.title": "Imágenes", + "admin/editor.image-list.images.image.title": "Imagen", + "admin/editor.image-list.images.mobileImage.title": "Imagen para móvil", + "admin/editor.image-list.images.description.title": "Texto alternativo de la imagen", + "admin/editor.image-list.images.title.title": "Título de la imagen", + "admin/editor.image-list.images.link.url.title": "URL del enlace de la imagen", + "admin/editor.image-list.images.link.openNewTab.title": "Abrir en una nueva pestaña", + "admin/editor.image-list.images.link.noFollow.title": "Debe ser un enlace nofollow", + "admin/editor.image-list.images.link.title.title": "Título del enlace", + "admin/editor.image-list.height.title": "Altura máxima de cada imagen (px)", + "admin/editor.image-list.images.width.title": "Anchura de la imagen", + "admin/editor.image-list.images.franchises.title": "Franquicias", + "admin/editor.image-list.images.franchises.description": "Nombres de franquicias separados por comas", + "admin/editor.image-list.images.width.description": "Anchura de la imagen para una sola imagen (% o px)", + "admin/editor.image-slider.title": "Control deslizante de imágenes", + "admin/editor.image-slider.description": "Control deslizante de imágenes", + "admin/editor.image-slider.slider.title": "Opciones del control deslizante", + "admin/editor.image-slider.slider.infinite": "Infinito", + "admin/editor.image-slider.slider.showNavigation": "Mostrar flechas de navegación", + "admin/editor.image-slider.slider.showPaginationDots": "Mostrar puntos de paginación", + "admin/editor.image-slider.slider.usePagination": "Usar paginación", + "admin/editor.image.analytics.title": "Evento de Analytics", + "admin/editor.image.analytics.none": "No", + "admin/editor.image.analytics.provide": "Sí", + "admin/editor.image.analytics.promotionId": "ID de la promoción", + "admin/editor.image.analytics.promotionName": "Nombre de la promoción", + "admin/editor.image.analytics.promotionPosition": "Posición creativa" +} diff --git a/messages/fr-FR.json b/messages/fr-FR.json new file mode 100644 index 0000000..5fc6c66 --- /dev/null +++ b/messages/fr-FR.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "Photo", + "admin/editor.store-image.src.title": "Photo", + "admin/editor.store-image.alt.title": "Texte alternatif", + "admin/editor.store-image.title.title": "Titre de l’image", + "admin/editor.store-image.title.description": "Titre à afficher par pointage", + "admin/editor.image-list.title": "Liste d’images", + "admin/editor.image-list.description": "Afficher une liste d’images", + "admin/editor.image-list.images.title": "Images", + "admin/editor.image-list.images.image.title": "Photo", + "admin/editor.image-list.images.mobileImage.title": "Image pour mobile", + "admin/editor.image-list.images.description.title": "Texte de remplacement de l’image", + "admin/editor.image-list.images.title.title": "Titre de l’mage", + "admin/editor.image-list.images.link.url.title": "URL du lien de l’image", + "admin/editor.image-list.images.link.openNewTab.title": "Devrait s’ouvrir dans un nouvel onglet", + "admin/editor.image-list.images.link.noFollow.title": "Devrait être un lien nofollow", + "admin/editor.image-list.images.link.title.title": "Titre pour le lien", + "admin/editor.image-list.height.title": "Hauteur maximale pour chaque image (px)", + "admin/editor.image-list.images.width.title": "Largeur de l’image", + "admin/editor.image-list.images.width.description": "Largeur de l’image pour une seule image (% ou px)", + "admin/editor.image-slider.title": "Curseur image", + "admin/editor.image-slider.description": "Curseur image", + "admin/editor.image-slider.slider.title": "Options du curseur", + "admin/editor.image-slider.slider.infinite": "Infini", + "admin/editor.image-slider.slider.showNavigation": "Afficher les flèches de navigation", + "admin/editor.image-slider.slider.showPaginationDots": "Afficher les points de pagination", + "admin/editor.image-slider.slider.usePagination": "Utiliser la pagination", + "admin/editor.image.analytics.title": "Évènement d’analyse", + "admin/editor.image.analytics.none": "Non", + "admin/editor.image.analytics.provide": "Oui", + "admin/editor.image.analytics.promotionId": "ID de promotion", + "admin/editor.image.analytics.promotionName": "Nom de promotion", + "admin/editor.image.analytics.promotionPosition": "Position créative" +} diff --git a/messages/it-IT.json b/messages/it-IT.json new file mode 100644 index 0000000..1e51e68 --- /dev/null +++ b/messages/it-IT.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "Immagine", + "admin/editor.store-image.src.title": "Immagine", + "admin/editor.store-image.alt.title": "Descrizione alternativa", + "admin/editor.store-image.title.title": "Titolo dell'immagine", + "admin/editor.store-image.title.description": "Titolo da mostrare al passaggio del mouse", + "admin/editor.image-list.title": "Elenco di immagini", + "admin/editor.image-list.description": "Mostra un elenco di immagini", + "admin/editor.image-list.images.title": "Immagini", + "admin/editor.image-list.images.image.title": "Immagine", + "admin/editor.image-list.images.mobileImage.title": "Immagine per dispositivi mobili", + "admin/editor.image-list.images.description.title": "Descrizione alternativa dell'immagine", + "admin/editor.image-list.images.title.title": "Titolo dell'immagine", + "admin/editor.image-list.images.link.url.title": "URL del link dell'immagine", + "admin/editor.image-list.images.link.openNewTab.title": "Aprire in una nuova scheda", + "admin/editor.image-list.images.link.noFollow.title": "Link nofollow", + "admin/editor.image-list.images.link.title.title": "Titolo del link", + "admin/editor.image-list.height.title": "Altezza massima per ciascuna immagine (px)", + "admin/editor.image-list.images.width.title": "Larghezza immagine", + "admin/editor.image-list.images.width.description": "Larghezza per una singola immagine (% o px)", + "admin/editor.image-slider.title": "Slider di immagini", + "admin/editor.image-slider.description": "Slider di immagini", + "admin/editor.image-slider.slider.title": "Opzioni dello slider", + "admin/editor.image-slider.slider.infinite": "Infinito", + "admin/editor.image-slider.slider.showNavigation": "Mostra frecce di navigazione", + "admin/editor.image-slider.slider.showPaginationDots": "Mostra punti di impaginazione", + "admin/editor.image-slider.slider.usePagination": "Utilizza impaginazione", + "admin/editor.image.analytics.title": "Evento di \"Analisi\"", + "admin/editor.image.analytics.none": "No", + "admin/editor.image.analytics.provide": "Sì", + "admin/editor.image.analytics.promotionId": "ID della promozione", + "admin/editor.image.analytics.promotionName": "Nome della promozione", + "admin/editor.image.analytics.promotionPosition": "Posizione creativa" +} diff --git a/messages/ja-JP.json b/messages/ja-JP.json new file mode 100644 index 0000000..d8dc5e2 --- /dev/null +++ b/messages/ja-JP.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "画像", + "admin/editor.store-image.src.title": "画像", + "admin/editor.store-image.alt.title": "代替テキスト", + "admin/editor.store-image.title.title": "画像のタイトル", + "admin/editor.store-image.title.description": "重ねて生じされるタイトル", + "admin/editor.image-list.title": "画像リスト", + "admin/editor.image-list.description": "画像のリストを表示する", + "admin/editor.image-list.images.title": "画像", + "admin/editor.image-list.images.image.title": "画像", + "admin/editor.image-list.images.mobileImage.title": "モバイル用画像", + "admin/editor.image-list.images.description.title": "画像代替テキスト", + "admin/editor.image-list.images.title.title": "画像のタイトル", + "admin/editor.image-list.images.link.url.title": "画像リンク URL", + "admin/editor.image-list.images.link.openNewTab.title": "新しいタブで開いてください", + "admin/editor.image-list.images.link.noFollow.title": "フォローのないリンクにしてください", + "admin/editor.image-list.images.link.title.title": "リンクのタイトル", + "admin/editor.image-list.height.title": "それぞれの画像の最大高 (px)", + "admin/editor.image-list.images.width.title": "画像幅", + "admin/editor.image-list.images.width.description": "1つの画像に対する画像幅 (% または px)", + "admin/editor.image-slider.title": "画像スライダ", + "admin/editor.image-slider.description": "画像スライダ", + "admin/editor.image-slider.slider.title": "スライダオプション", + "admin/editor.image-slider.slider.infinite": "上限なし", + "admin/editor.image-slider.slider.showNavigation": "方向矢印を表示する", + "admin/editor.image-slider.slider.showPaginationDots": "ページネーションドットを表示する", + "admin/editor.image-slider.slider.usePagination": "ページネーションを使う", + "admin/editor.image.analytics.title": "アナリティクスイベント", + "admin/editor.image.analytics.none": "いいえ", + "admin/editor.image.analytics.provide": "はい", + "admin/editor.image.analytics.promotionId": "プロモーション ID", + "admin/editor.image.analytics.promotionName": "プロモーション名", + "admin/editor.image.analytics.promotionPosition": "クリエイティブポジション" +} diff --git a/messages/ko-KR.json b/messages/ko-KR.json new file mode 100644 index 0000000..12a9048 --- /dev/null +++ b/messages/ko-KR.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "이미지", + "admin/editor.store-image.src.title": "이미지", + "admin/editor.store-image.alt.title": "대체 텍스트", + "admin/editor.store-image.title.title": "이미지 제목", + "admin/editor.store-image.title.description": "가리키면 표시할 제목", + "admin/editor.image-list.title": "이미지 목록", + "admin/editor.image-list.description": "이미지 목록 표시", + "admin/editor.image-list.images.title": "이미지", + "admin/editor.image-list.images.image.title": "이미지", + "admin/editor.image-list.images.mobileImage.title": "모바일용 이미지", + "admin/editor.image-list.images.description.title": "이미지 alt 텍스트", + "admin/editor.image-list.images.title.title": "이미지 제목", + "admin/editor.image-list.images.link.url.title": "이미지 링크 URL", + "admin/editor.image-list.images.link.openNewTab.title": "새 탭에서 열어야 함", + "admin/editor.image-list.images.link.noFollow.title": "nofollow 링크여야 함", + "admin/editor.image-list.images.link.title.title": "링크 제목", + "admin/editor.image-list.height.title": "각 이미지의 최대 높이(px)", + "admin/editor.image-list.images.width.title": "이미지 너비", + "admin/editor.image-list.images.width.description": "단일 이미지의 이미지 너비(% 또는 px)", + "admin/editor.image-slider.title": "이미지 슬라이더", + "admin/editor.image-slider.description": "이미지 슬라이더", + "admin/editor.image-slider.slider.title": "슬라이더 옵션", + "admin/editor.image-slider.slider.infinite": "무한", + "admin/editor.image-slider.slider.showNavigation": "탐색 화살표 표시", + "admin/editor.image-slider.slider.showPaginationDots": "페이지 번호 점 표시", + "admin/editor.image-slider.slider.usePagination": "페이지 번호 사용", + "admin/editor.image.analytics.title": "애널리틱스 이벤트", + "admin/editor.image.analytics.none": "아니요", + "admin/editor.image.analytics.provide": "예", + "admin/editor.image.analytics.promotionId": "프로모션 ID", + "admin/editor.image.analytics.promotionName": "프로모션 이름", + "admin/editor.image.analytics.promotionPosition": "창의적 위치" +} diff --git a/messages/nl-NL.json b/messages/nl-NL.json new file mode 100644 index 0000000..9ea5c21 --- /dev/null +++ b/messages/nl-NL.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "Afbeelding", + "admin/editor.store-image.src.title": "Afbeelding", + "admin/editor.store-image.alt.title": "Alternatieve tekst", + "admin/editor.store-image.title.title": "Titel van de afbeelding", + "admin/editor.store-image.title.description": "Titel die moet worden weergegeven bij zweven", + "admin/editor.image-list.title": "Afbeeldinglijst", + "admin/editor.image-list.description": "Toon een lijst van afbeeldingen", + "admin/editor.image-list.images.title": "Afbeeldingen", + "admin/editor.image-list.images.image.title": "Afbeelding", + "admin/editor.image-list.images.mobileImage.title": "Afbeelding voor mobiel", + "admin/editor.image-list.images.description.title": "Afbeelding alt-tekst", + "admin/editor.image-list.images.title.title": "Titel van de afbeelding", + "admin/editor.image-list.images.link.url.title": "URL van afbeeldingslink", + "admin/editor.image-list.images.link.openNewTab.title": "Moet openen op een nieuwe tab", + "admin/editor.image-list.images.link.noFollow.title": "Moet een nofollow link zijn", + "admin/editor.image-list.images.link.title.title": "Titel voor de link", + "admin/editor.image-list.height.title": "Maximale hoogte voor elke afbeelding (px)", + "admin/editor.image-list.images.width.title": "Afbeeldingsbreedte", + "admin/editor.image-list.images.width.description": "Afbeeldingsbreedte voor één afbeelding (% of px)", + "admin/editor.image-slider.title": "Afbeelding schuifregelaar", + "admin/editor.image-slider.description": "Afbeelding schuifregelaar", + "admin/editor.image-slider.slider.title": "Schuifregelaar opties", + "admin/editor.image-slider.slider.infinite": "Oneindig", + "admin/editor.image-slider.slider.showNavigation": "Toon navigatiepijlen", + "admin/editor.image-slider.slider.showPaginationDots": "Toon pagineringstippen", + "admin/editor.image-slider.slider.usePagination": "Gebruik paginering", + "admin/editor.image.analytics.title": "Analytics-gebeurtenis", + "admin/editor.image.analytics.none": "Nee", + "admin/editor.image.analytics.provide": "Ja", + "admin/editor.image.analytics.promotionId": "Promotie-id", + "admin/editor.image.analytics.promotionName": "Promotienaam", + "admin/editor.image.analytics.promotionPosition": "Creatieve positie" +} diff --git a/messages/pt.json b/messages/pt.json old mode 100755 new mode 100644 index bdf4127..3d0581f --- a/messages/pt.json +++ b/messages/pt.json @@ -1,4 +1,36 @@ -{ - "admin/test": "teste", - "store/test": "teste" -} +{ + "admin/editor.store-image.title": "Imagem", + "admin/editor.store-image.src.title": "Imagem", + "admin/editor.store-image.alt.title": "Texto alternativo", + "admin/editor.store-image.title.title": "Título da imagem", + "admin/editor.store-image.title.description": "Título a ser mostrado quando você passa o mouse pela imagem", + "admin/editor.image-list.title": "Lista de imagens", + "admin/editor.image-list.description": "Exiba uma lista de imagens", + "admin/editor.image-list.images.title": "Imagens", + "admin/editor.image-list.images.image.title": "Imagem", + "admin/editor.image-list.images.mobileImage.title": "Imagem para mobile", + "admin/editor.image-list.images.description.title": "Descrição alternativa para a imagem", + "admin/editor.image-list.images.title.title": "Título da imagem", + "admin/editor.image-list.images.link.url.title": "URL do link da imagem", + "admin/editor.image-list.images.link.openNewTab.title": "Abrir em uma nova aba", + "admin/editor.image-list.images.link.noFollow.title": "Link nofollow", + "admin/editor.image-list.images.link.title.title": "Título para o link", + "admin/editor.image-list.height.title": "Altura máxima de cada imagem (px)", + "admin/editor.image-list.images.width.title": "Largura da imagem", + "admin/editor.image-list.images.franchises.title": "Franquias", + "admin/editor.image-list.images.franchises.description": "Nomes das franquias separados por vírgula", + "admin/editor.image-list.images.width.description": "Largura de imagem para uma única imagem (% ou px)", + "admin/editor.image-slider.title": "Slider de imagens", + "admin/editor.image-slider.description": "Slider de imagens", + "admin/editor.image-slider.slider.title": "Configurações do slider", + "admin/editor.image-slider.slider.infinite": "Infinito", + "admin/editor.image-slider.slider.showNavigation": "Mostrar setas para navegação", + "admin/editor.image-slider.slider.showPaginationDots": "Mostrar indicadores de paginação", + "admin/editor.image-slider.slider.usePagination": "Usar paginação", + "admin/editor.image.analytics.title": "Evento do Analytics", + "admin/editor.image.analytics.none": "Não", + "admin/editor.image.analytics.provide": "Sim", + "admin/editor.image.analytics.promotionId": "Id da promoção", + "admin/editor.image.analytics.promotionName": "Nome da promoção", + "admin/editor.image.analytics.promotionPosition": "Posição do criativo" +} diff --git a/messages/ro-RO.json b/messages/ro-RO.json new file mode 100644 index 0000000..b9e346d --- /dev/null +++ b/messages/ro-RO.json @@ -0,0 +1,34 @@ +{ + "admin/editor.store-image.title": "Imagine", + "admin/editor.store-image.src.title": "Imagine", + "admin/editor.store-image.alt.title": "Text alternativ", + "admin/editor.store-image.title.title": "Titlu imagine", + "admin/editor.store-image.title.description": "Titlul va fi afișat prin trecere", + "admin/editor.image-list.title": "Listă imagine", + "admin/editor.image-list.description": "Arată o listă de imagini", + "admin/editor.image-list.images.title": "Imagini", + "admin/editor.image-list.images.image.title": "Imagine", + "admin/editor.image-list.images.mobileImage.title": "Imagini pentru mobil", + "admin/editor.image-list.images.description.title": "Text imagine alternativă", + "admin/editor.image-list.images.title.title": "Titlu imagine", + "admin/editor.image-list.images.link.url.title": "URL link imagine", + "admin/editor.image-list.images.link.openNewTab.title": "Trebuie să se deschidă într-o filă nouă", + "admin/editor.image-list.images.link.noFollow.title": "Trebuie să fie un link nofollow", + "admin/editor.image-list.images.link.title.title": "Titlul link-ului", + "admin/editor.image-list.height.title": "Înălțime maximă pentru fiecare imagine (px)", + "admin/editor.image-list.images.width.title": "Lățime imagine", + "admin/editor.image-list.images.width.description": "Lățimea maximă a imaginii pentru o singură imagine (% sau px)", + "admin/editor.image-slider.title": "Glisor imagine", + "admin/editor.image-slider.description": "Glisor imagine", + "admin/editor.image-slider.slider.title": "Opțiuni glisor", + "admin/editor.image-slider.slider.infinite": "Infinit", + "admin/editor.image-slider.slider.showNavigation": "Arată săgețile de navigare", + "admin/editor.image-slider.slider.showPaginationDots": "Arată punctele de paginație", + "admin/editor.image-slider.slider.usePagination": "Folosește paginația", + "admin/editor.image.analytics.title": "Eveniment Analytics", + "admin/editor.image.analytics.none": "Nu", + "admin/editor.image.analytics.provide": "Da", + "admin/editor.image.analytics.promotionId": "ID Promoție", + "admin/editor.image.analytics.promotionName": "Denumire Promoție", + "admin/editor.image.analytics.promotionPosition": "Poziție creativă" +} diff --git a/react/RegionBanner.tsx b/react/RegionBanner.tsx new file mode 100644 index 0000000..e1ba8b0 --- /dev/null +++ b/react/RegionBanner.tsx @@ -0,0 +1,3 @@ +import RegionBanner from "./components/RegionBanner/RegionBanner"; + +export default RegionBanner; diff --git a/react/components/RegionBanner/RegionBanner.css b/react/components/RegionBanner/RegionBanner.css new file mode 100644 index 0000000..fa25843 --- /dev/null +++ b/react/components/RegionBanner/RegionBanner.css @@ -0,0 +1,4 @@ +.bannersLoading :global(.vtex-styleguide-9-x-rotate) { + width: 50px; + margin: 30px calc((100% - 50px) / 2); +} diff --git a/react/components/RegionBanner/RegionBanner.tsx b/react/components/RegionBanner/RegionBanner.tsx new file mode 100644 index 0000000..0d9da3d --- /dev/null +++ b/react/components/RegionBanner/RegionBanner.tsx @@ -0,0 +1,90 @@ +import React, { useEffect, useState } from "react"; +import type { PropsWithChildren } from "react"; +import { ImageList } from "vtex.store-image"; +import { IMAGE_LIST_SCHEMA } from "./schema"; +import { Spinner } from "vtex.styleguide"; +import "./RegionBanner.css"; +import { useCssHandles } from "vtex.css-handles"; + +const CSS_HANDLES = ["bannersLoading"]; + +interface Link { + url: string; + attributeNofollow: boolean; + attributeTitle?: string; + openNewTab?: boolean; + newTab?: boolean; +} + +export type ImagesSchema = Array<{ + image: string; + mobileImage: string; + link?: Link; + title?: string; + franchises?: string; + description: string; + experimentalPreventLayoutShift?: boolean; + width?: number | string; + analyticsProperties?: "none" | "provide"; + promotionId?: string; + promotionName?: string; + promotionPosition?: string; +}>; + +export interface ImageListProps { + images: ImagesSchema | null; + height?: number; + preload?: boolean; +} + +const RegionBanner = ({ images, height = 420, children, preload }: PropsWithChildren) => { + const [filteredImages, setFilteredImages] = useState(null); + const handles = useCssHandles(CSS_HANDLES); + + useEffect(() => { + const regionSelected = JSON.parse(localStorage.getItem("region-selected") as string); + const country = regionSelected?.country; + const postalCode = regionSelected?.postalCode; + //SP = 04538132 + //RJ = 22081050 + + fetch("/api/sessions", { + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + public: { country: { value: country }, postalCode: { value: postalCode } }, + }), + method: "POST", + credentials: "same-origin", + }) + .then((res) => res.json()) + .then((res) => { + const { regionId } = JSON.parse(atob(res.segmentToken)); + const selectedFranchise = atob(regionId).slice(3); + setFilteredImages( + images + ? images.filter((image) => { + const franchises = image.franchises && !/^\s*$/.test(image.franchises) ? image.franchises?.trim().split(/\s*,\s*/) : null; + if (!franchises) { + return true; + } + return franchises?.includes(selectedFranchise); + }) + : null + ); + }); + }, []); + + if (!filteredImages) { + return ( +
+ +
+ ); + } + + return ; +}; + +RegionBanner.schema = IMAGE_LIST_SCHEMA; + +export default RegionBanner; diff --git a/react/components/RegionBanner/schema.ts b/react/components/RegionBanner/schema.ts new file mode 100644 index 0000000..0f45d78 --- /dev/null +++ b/react/components/RegionBanner/schema.ts @@ -0,0 +1,76 @@ +import { defineMessages } from "react-intl"; + +const IMAGE_LIST_MESSAGES = defineMessages({ + title: { id: "admin/editor.image-list.title" }, + description: { + id: "admin/editor.image-list.description", + }, + imagesImageTitle: { + id: "admin/editor.image-list.images.image.title", + }, + imagesMobileImageTitle: { + id: "admin/editor.image-list.images.mobileImage.title", + }, + imagesImageDescription: { + id: "admin/editor.image-list.images.description.title", + }, + imagesImageAttributeTitle: { + id: "admin/editor.image-list.images.title.title", + }, + imagesImageLinkUrl: { + id: "admin/editor.image-list.images.link.url.title", + }, + imagesImageLinkOpenNewTab: { + id: "admin/editor.image-list.images.link.openNewTab.title", + }, + imagesImageLinkNoFollow: { + id: "admin/editor.image-list.images.link.noFollow.title", + }, + imagesImageLinkTitle: { + id: "admin/editor.image-list.images.link.title.title", + }, + imagesTitle: { + id: "admin/editor.image-list.images.title", + }, + heightTitle: { + id: "admin/editor.image-list.height.title", + }, + widthTitle: { + id: "admin/editor.image-list.images.width.title", + }, + widthDescription: { + id: "admin/editor.image-list.images.width.description", + }, + analyticsTitle: { + id: "admin/editor.image.analytics.title", + }, + analyticsNone: { + id: "admin/editor.image.analytics.none", + }, + analyticsProvide: { + id: "admin/editor.image.analytics.provide", + }, + analyticsPromotionId: { + id: "admin/editor.image.analytics.promotionId", + }, + analyticsPromotionName: { + id: "admin/editor.image.analytics.promotionName", + }, + analyticsPromotionPosition: { + id: "admin/editor.image.analytics.promotionPosition", + }, +}); + +export const IMAGE_LIST_SCHEMA = { + title: IMAGE_LIST_MESSAGES.title.id, + description: IMAGE_LIST_MESSAGES.description.id, + type: "object", + properties: { + height: { + default: 420, + isLayout: false, + title: IMAGE_LIST_MESSAGES.heightTitle.id, + type: "number", + }, + }, +}; diff --git a/react/package.json b/react/package.json index 57bf00f..53e2275 100755 --- a/react/package.json +++ b/react/package.json @@ -29,6 +29,8 @@ "vtex.store-components": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.138.2/public/@types/vtex.store-components", "vtex.store-resources": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-resources@0.75.1/public/@types/vtex.store-resources", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.134.1/public/@types/vtex.styleguide", - "vtex.apps-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.apps-graphql@2.8.0/public/@types/vtex.apps-graphql" + "vtex.apps-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.apps-graphql@2.8.0/public/@types/vtex.apps-graphql", + "vtex.store-image": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-image@0.14.2/public/@types/vtex.store-image", + "vtex.list-context": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.list-context@0.2.0/public/@types/vtex.list-context" } } diff --git a/react/typings/region-banner.d.ts b/react/typings/region-banner.d.ts new file mode 100644 index 0000000..c7b9aa3 --- /dev/null +++ b/react/typings/region-banner.d.ts @@ -0,0 +1,2 @@ +declare module "vtex.store-image/ImageList"; +declare module "vtex.styleguide"; diff --git a/react/yarn.lock b/react/yarn.lock index c7fcee3..068777d 100755 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -4959,6 +4959,10 @@ verror@1.10.0: version "0.4.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles#8c45c6decf9acd2b944e07261686decff93d6422" +"vtex.list-context@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.list-context@0.2.0/public/@types/vtex.list-context": + version "0.2.0" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.list-context@0.2.0/public/@types/vtex.list-context#935b748d394851ced7f3b06bbedf59f4ee3ca8a6" + "vtex.my-account-commons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.5.2/public/@types/vtex.my-account-commons": version "1.5.2" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.5.2/public/@types/vtex.my-account-commons#71beef3822cd90f459b83fdd23a2ababcfc58e11" @@ -4991,6 +4995,10 @@ verror@1.10.0: version "3.138.2" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-components@3.138.2/public/@types/vtex.store-components#683f2f1ecfb86193cb7269d83027f8846970e865" +"vtex.store-image@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-image@0.14.2/public/@types/vtex.store-image": + version "0.14.2" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-image@0.14.2/public/@types/vtex.store-image#8110d7fe7a27c8e08cab98f52426ca239be38694" + "vtex.store-resources@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-resources@0.75.1/public/@types/vtex.store-resources": version "0.75.1" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-resources@0.75.1/public/@types/vtex.store-resources#6374ad0729cb1ee5b06f7e094b4bdbeb1e2679d0" diff --git a/store/contentSchemas.json b/store/contentSchemas.json new file mode 100644 index 0000000..f8097bd --- /dev/null +++ b/store/contentSchemas.json @@ -0,0 +1,173 @@ +{ + "definitions": { + "Image": { + "title": "admin/editor.store-image.title", + "properties": { + "src": { + "title": "admin/editor.image.src.title", + "$ref": "app:vtex.native-types#/definitions/url", + "default": "", + "widget": { + "ui:widget": "image-uploader" + } + }, + "link": { + "$ref": "app:vtex.native-types#/definitions/link", + "default": "" + }, + "alt": { + "title": "admin/editor.image.alt.title", + "$ref": "app:vtex.native-types#/definitions/text", + "default": "" + }, + "title": { + "title": "admin/editor.image.title.title", + "description": "admin/editor.image.title.description", + "$ref": "app:vtex.native-types#/definitions/text", + "default": "" + }, + "analyticsProperties": { + "title": "admin/editor.image.analytics.title", + "description": "admin/editor.image.analytics.description", + "enum": ["none", "provide"], + "enumNames": ["admin/editor.image.analytics.none", "admin/editor.image.analytics.provide"], + "widget": { + "ui:widget": "radio" + }, + "default": "none" + } + }, + "dependencies": { + "analyticsProperties": { + "oneOf": [ + { + "properties": { + "analyticsProperties": { + "enum": ["provide"] + }, + "promotionId": { + "title": "admin/editor.image.analytics.promotionId", + "type": "string", + "default": "" + }, + "promotionName": { + "title": "admin/editor.image.analytics.promotionName", + "type": "string", + "default": "" + }, + "promotionPosition": { + "title": "admin/editor.image.analytics.promotionPosition", + "type": "string", + "default": "" + } + } + }, + { + "properties": { + "analyticsProperties": { + "enum": ["none"] + } + } + } + ] + } + } + }, + "Images": { + "type": "array", + "title": "admin/editor.image-list.images.title", + "items": { + "properties": { + "image": { + "$ref": "app:vtex.native-types#/definitions/url", + "default": "", + "title": "admin/editor.image-list.images.image.title", + "widget": { + "ui:widget": "image-uploader" + } + }, + "mobileImage": { + "$ref": "app:vtex.native-types#/definitions/url", + "default": "", + "title": "admin/editor.image-list.images.mobileImage.title", + "widget": { + "ui:widget": "image-uploader" + } + }, + "description": { + "$ref": "app:vtex.native-types#/definitions/text", + "default": "", + "title": "admin/editor.image-list.images.description.title" + }, + "title": { + "title": "admin/editor.image-list.images.title.title", + "$ref": "app:vtex.native-types#/definitions/text", + "default": "" + }, + "link": { + "default": "", + "title": "", + "$ref": "app:vtex.native-types#/definitions/link" + }, + "width": { + "title": "admin/editor.image-list.images.width.title", + "description": "admin/editor.image-list.images.width.description", + "$ref": "app:vtex.native-types#/definitions/text", + "default": "100%" + }, + "franchises": { + "title": "admin/editor.image-list.images.franchises.title", + "description": "admin/editor.image-list.images.franchises.description", + "$ref": "app:vtex.native-types#/definitions/text", + "default": "" + }, + "analyticsProperties": { + "title": "admin/editor.image.analytics.title", + "description": "admin/editor.image.analytics.description", + "enum": ["none", "provide"], + "enumNames": ["admin/editor.image.analytics.none", "admin/editor.image.analytics.provide"], + "widget": { + "ui:widget": "radio" + }, + "default": "none" + } + }, + "dependencies": { + "analyticsProperties": { + "oneOf": [ + { + "properties": { + "analyticsProperties": { + "enum": ["provide"] + }, + "promotionId": { + "title": "admin/editor.image.analytics.promotionId", + "type": "string", + "default": "" + }, + "promotionName": { + "title": "admin/editor.image.analytics.promotionName", + "type": "string", + "default": "" + }, + "promotionPosition": { + "title": "admin/editor.image.analytics.promotionPosition", + "type": "string", + "default": "" + } + } + }, + { + "properties": { + "analyticsProperties": { + "enum": ["none"] + } + } + } + ] + } + } + } + } + } +} diff --git a/store/interfaces.json b/store/interfaces.json index 709dc8e..5bf327f 100755 --- a/store/interfaces.json +++ b/store/interfaces.json @@ -1,11 +1,23 @@ { - "current-address-component": { - "component": "CurrentAddressComponent" - }, - "current-address-modal": { - "component": "AddressModal" - }, - "seller-text": { - "component": "SellerText" - } + "current-address-component": { + "component": "CurrentAddressComponent" + }, + "current-address-modal": { + "component": "AddressModal" + }, + "seller-text": { + "component": "SellerText" + }, + "region-banner": { + "component": "RegionBanner", + "composition": "children", + "allowed": "*", + "content": { + "properties": { + "images": { + "$ref": "app:bravtexgrocerystore.bravtexgrocery-newcomponents#/definitions/Images" + } + } + } + } }