diff --git a/CHANGELOG.md b/CHANGELOG.md index 027a5869..f66244a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ All notable changes to this project will be documented in this file. -- [#TODO](https://github.com/os2display/display-templates/pull/TODO) +- [#161](https://github.com/os2display/display-templates/pull/161) + - Added social news template. +- [#160](https://github.com/os2display/display-templates/pull/160) - Added option to set image size contain instead of cover. - [#159](https://github.com/os2display/display-templates/pull/159) - Fixed issue where slideshow flickered first image before transitioning to next slide. diff --git a/build/news-feed-admin.json b/build/news-feed-admin.json new file mode 100644 index 00000000..fbad413c --- /dev/null +++ b/build/news-feed-admin.json @@ -0,0 +1,70 @@ +[ + { + "key": "news-feed-form-1", + "input": "header", + "text": "Skabelon: Instagram feed", + "name": "header1", + "formGroupClasses": "h4 mb-3" + }, + { + "key": "news-feed-form-2", + "input": "header-h3", + "text": "Opsæt feed", + "name": "header2", + "formGroupClasses": "h5 mb-3" + }, + { + "key": "news-feed-form-3", + "input": "feed", + "text": "Opsæt feed", + "name": "feeds", + "supportedFeedOutputType": "rss", + "formGroupClasses": "mb-3", + "singleSelect": true + }, + { + "key": "news-feed-form-entry-duration", + "input": "input", + "name": "entryDuration", + "type": "number", + "label": "Varighed pr. nyhed (i sekunder)", + "helpText": "Her skal du skrive varigheden pr. nyhed.", + "formGroupClasses": "mb-3", + "required": true + }, + { + "key": "news-feed-form-readmore", + "input": "input", + "label": "Læs mere tekst", + "helpText": "Hvis den ikke overskrives, står der \"Læs hele nyheden\"", + "name": "readMore", + "formGroupClasses": "mb-3" + }, + { + "key": "news-feed-max-entries", + "input": "input", + "name": "maxEntries", + "type": "number", + "min": 1, + "label": "Maksimalt antal nyheder", + "helpText": "Her kan du skrive maksimalt antal nyheder, der skal vises.", + "formGroupClasses": "mb-3" + }, + { + "key": "rss-form-4", + "multipleImages": false, + "input": "image", + "name": "fallbackImage", + "label": "Fallback-billede", + "helpText": "Dette billede kan vises, hvis nyheden mangler et billede.", + "formGroupClasses": "mb-3" + }, + { + "key": "form-media-contain", + "input": "checkbox", + "name": "mediaContain", + "label": "Deaktivér billedbeskæring", + "helpText": "Billedet vil blive vist ubeskåret med tomme områder omkring", + "formGroupClasses": "mb-3" + } +] diff --git a/build/news-feed-config-develop.json b/build/news-feed-config-develop.json new file mode 100644 index 00000000..42c87135 --- /dev/null +++ b/build/news-feed-config-develop.json @@ -0,0 +1,14 @@ +{ + "title": "Nyheder", + "icon": "", + "id": "01JEWPAFF93YSF418TH72W1SBA", + "description": "Mulighed for at vise nyhedsindhold.", + "resources": { + "component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/news-feed.js?ts=1734244724142", + "admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/news-feed-admin.json?ts=1734244724142", + "schema": "", + "assets": [], + "options": {}, + "content": {} + } +} \ No newline at end of file diff --git a/build/news-feed-config-main.json b/build/news-feed-config-main.json new file mode 100644 index 00000000..673deca8 --- /dev/null +++ b/build/news-feed-config-main.json @@ -0,0 +1,14 @@ +{ + "title": "Nyheder", + "icon": "", + "id": "01JEWPAFF93YSF418TH72W1SBA", + "description": "Mulighed for at vise nyhedsindhold.", + "resources": { + "component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/news-feed.js?ts=1734244724142", + "admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/news-feed-admin.json?ts=1734244724142", + "schema": "", + "assets": [], + "options": {}, + "content": {} + } +} \ No newline at end of file diff --git a/build/news-feed.js b/build/news-feed.js new file mode 100644 index 00000000..62e43bac --- /dev/null +++ b/build/news-feed.js @@ -0,0 +1,2 @@ +/*! For license information please see news-feed.js.LICENSE.txt */ +(()=>{var e={8070:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(6314),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,'.slide{--color-white: #fff;--color-grey-100: hsl(0deg 0% 95%);--color-grey-200: hsl(0deg 0% 85%);--color-grey-300: hsl(0deg 0% 80%);--color-grey-400: hsl(0deg 0% 75%);--color-grey-500: hsl(0deg 0% 70%);--color-grey-600: hsl(0deg 0% 40%);--color-grey-700: hsl(0deg 0% 30%);--color-grey-800: hsl(0deg 0% 20%);--color-grey-900: hsl(0deg 0% 10%);--color-black: #000;--color-blue: hsl(219deg 89% 57%);--color-indigo: indigo;--color-purple: purple;--color-pink: pink;--color-red: red;--color-orange: orange;--color-yellow: yellow;--color-green: green;--color-teal: teal;--color-cyan: cyan;--color-gray: var(--color-grey-500);--color-gray-dark: var(--color-grey-900);--color-primary: var(--color-blue);--color-secondary: var(--color-orange);--color-success: var(--color-green);--color-info: var(--color-teal);--color-warning: var(--color-yellow);--color-danger: var(--color-red);--color-light: var(--color-white);--color-dark: var(--color-black);--bg-light: var(--color-light);--bg-dark: var(--color-dark);--bg-primary: var(--color-primary);--bg-secondary: var(--color-secondary);--bg-transparent: transparent;--text-light: var(--color-light);--text-dark: var(--color-dark);--color-red-oklch-ch: 0.25 29;--color-red-oklch-l: 50%;--color-red-oklch-c: 0.25;--color-red-oklch-h: 29;--color-red-50: oklch(95% calc(var(--color-red-oklch-c) - 0.20) var(--color-red-oklch-h));--color-red-100: oklch(90% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-200: oklch(85% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-300: oklch(80% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-400: oklch(70% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-500: oklch(60% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-600: oklch(var(--color-red-oklch-l) var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-700: oklch(40% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-800: oklch(30% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-900: oklch(20% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-red-950: oklch(15% var(--color-red-oklch-c) var(--color-red-oklch-h));--color-green-oklch-l: 50%;--color-green-oklch-c: 0.17;--color-green-oklch-h: 142;--color-green-50: oklch(95% calc(var(--color-green-oklch-c) - 0.15) var(--color-green-oklch-h));--color-green-100: oklch(90% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-200: oklch(85% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-300: oklch(80% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-400: oklch(70% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-500: oklch(60% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-600: oklch(var(--color-green-oklch-l) var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-700: oklch(40% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-800: oklch(30% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-900: oklch(20% var(--color-green-oklch-c) var(--color-green-oklch-h));--color-green-950: oklch(15% var(--color-green-oklch-c) var(--color-green-oklch-h));--font-family-base: system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;--font-weight-light: 300;--font-weight-normal: 400;--font-weight-bold: 700;--line-height-base: 1.5;--line-height-sm: 1.25;--line-height-lg: 2;--font-size-base: 1rem;--font-size-multiplier-050: 0.5;--font-size-multiplier-075: 0.75;--font-size-multiplier-090: 0.9;--font-size-multiplier-125: 1.25;--font-size-multiplier-150: 1.5;--font-size-multiplier-175: 1.75;--font-size-multiplier-200: 2;--font-size-multiplier-250: 2.5;--font-size-xs: calc(var(--font-size-base) * var(--font-size-multiplier-050));--font-size-sm: calc(var(--font-size-base) * var(--font-size-multiplier-075));--font-size-m: calc(var(--font-size-base) * 1);--font-size-lg: calc(var(--font-size-base) * var(--font-size-multiplier-125));--font-size-xl: calc(var(--font-size-base) * var(--font-size-multiplier-150));--h1-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-250));--h2-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-200));--h3-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-175));--h4-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-150));--h5-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-125));--h6-font-size: calc(var(--font-size-base));--spacer: 12px;--margin-size-base: calc(var(--spacer) * 3);--padding-size-base: calc(var(--spacer) * 3);--box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);--box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);--box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);--box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);--border-size: 1px;--border-style: solid;--border-color: var(--color-grey-900);--border: var(--border-size) var(--border-style) var(--border-color);--border-radius-sm: 3px;--border-radius-md: 5px;--border-radius-lg: 7px;--background-color: var(--bg-light, hsl(0deg, 0%, 100%));--background-color-secondary: var(--color-grey-100, hsl(0deg, 0%, 95%));--text-color: var(--text-dark, hsl(0deg, 0%, 0%))}*,*::before,*::after{box-sizing:border-box}html{font-size:1.125rem;height:100%;background-color:var(--background-color);color:var(--text-color)}body{margin:0;height:100%}@keyframes h1-underline{0%{opacity:0;width:100%}40%{opacity:1;width:100%;margin-top:.938em;height:.375em}70%{opacity:1;width:100%;margin-top:.625em;height:.2em}100%{opacity:1;width:5em;margin-top:.625em}}.color-scheme-dark .slide{--background-color: var(--bg-dark, hsl(0deg, 0%, 10%));--background-color-secondary: var(--bg-dark-secondary, hsl(0deg, 0%, 20%));--text-color: var(--text-light, hsl(0deg, 0%, 100%));--border-color: var(--color-light);--color-grey-100: hsl(0deg 0% 10%);--color-grey-200: hsl(0deg 0% 15%);--color-grey-300: hsl(0deg 0% 20%);--color-grey-400: hsl(0deg 0% 25%);--color-grey-500: hsl(0deg 0% 30%);--color-grey-600: hsl(0deg 0% 45%);--color-grey-700: hsl(0deg 0% 60%);--color-grey-800: hsl(0deg 0% 75%);--color-grey-900: hsl(0deg 0% 90%)}@media screen and (min-width: 1921px)and (orientation: landscape){.slide{--font-size-base: 2rem;--spacer: 24px}}@media screen and (min-width: 1081px)and (orientation: portrait){.slide{--font-size-base: 2rem;--spacer: 24px}}.slide .font-size-xs{--font-size-base: var(--font-size-xs);--h1-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-250));--h2-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-200));--h3-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-175));--h4-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-150));--h5-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-125))}.slide .font-size-s{--font-size-base: var(--font-size-sm);--h1-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-250));--h2-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-200));--h3-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-175));--h4-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-150));--h5-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-125))}.slide .font-size-m{--font-size-base: var(--font-size-m);--h1-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-250));--h2-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-200));--h3-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-175));--h4-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-150));--h5-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-125))}.slide .font-size-lg{--font-size-base: var(--font-size-lg);--h1-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-250));--h2-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-200));--h3-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-175));--h4-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-150));--h5-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-125))}.slide .font-size-xl{--font-size-base: var(--font-size-xl);--h1-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-250));--h2-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-200));--h3-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-175));--h4-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-150));--h5-font-size: calc(var(--font-size-base) * var(--font-size-multiplier-125))}.slide h1{font-size:var(--h1-font-size)}.slide h2{font-size:var(--h2-font-size)}.slide h3{font-size:var(--h3-font-size)}.slide h4{font-size:var(--h4-font-size)}.slide h5{font-size:var(--h5-font-size)}.slide h6{font-size:var(--h6-font-size)}',""]);const i=o},3118:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(6314),o=r.n(n)()((function(e){return e[1]}));o.push([e.id,".template-news-feed{display:grid;height:100%;width:100%;grid-template-columns:repeat(5, 1fr);grid-template-rows:repeat(5, 1fr);grid-column-gap:0;grid-row-gap:0;background-color:var(--background-color);font-family:var(--font-family-base);font-size:var(--font-size-base);position:relative;overflow:hidden}.template-news-feed .media-section{grid-area:1/1/4/4;height:100%;width:100%;background-color:var(--color-secondary);background-size:cover;background-position:top center}.template-news-feed .media-section.media-contain{background-size:contain;background-repeat:no-repeat}.template-news-feed .text-section{position:relative;grid-area:1/4/6/6;width:100%;height:100%;padding:5%;overflow-wrap:break-word;word-wrap:break-word;-webkit-hyphens:auto;-ms-hyphens:auto;-moz-hyphens:auto;hyphens:auto;overflow:hidden;background-color:var(--background-color);color:var(--text-color)}.template-news-feed .text-section h1{font-size:var(--h1-font-size);font-weight:var(--font-weight-bold);margin-top:0}.template-news-feed .text-section .description{font-size:var(--h3-font-size);line-height:var(--line-height-base);color:var(--text-color);margin-top:var(--margin-size-base)}.template-news-feed .text-section .author{font-size:var(--h4-font-size);line-height:var(--line-height-base)}.template-news-feed .text-section .description-fade{position:absolute;bottom:0;width:100%;height:15%;background:var(--background-color);background:linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, var(--background-color) 75%, var(--background-color) 100%)}.template-news-feed .extra-section{grid-area:4/1/6/4;padding:5%;height:100%;width:100%;background-color:var(--color-secondary);display:flex;flex-direction:column;justify-content:end}.template-news-feed .extra-section .qr{width:20%;margin-bottom:2%}.template-news-feed .extra-section .read-more{font-size:var(--h2-font-size)}.template-news-feed .extra-section .link{font-size:var(--h4-font-size)}@media(orientation: portrait){.template-news-feed{display:grid;grid-template-columns:1fr;grid-template-rows:repeat(5, 1fr);grid-column-gap:0;grid-row-gap:0}.template-news-feed .media-section{background-color:var(--background-color);grid-area:1/1/3/2;width:auto;height:var(--percentage-wide)}.template-news-feed .text-section{grid-area:3/1/5/2;width:auto;height:var(--percentage-wide)}.template-news-feed .extra-section{grid-area:5/1/6/2}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}",""]);const i=o},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(n)for(var i=0;i=t?e:""+Array(t+1-n.length).join(r)+e},v={s:m,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),o=r%60;return(t<=0?"+":"-")+m(n,2,"0")+":"+m(o,2,"0")},m:function e(t,r){if(t.date()1)return e(a[0])}else{var s=t.name;b[s]=t,o=s}return!n&&o&&(y=o),o||!n&&y},A=function(e,t){if(k(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new x(r)},C=v;C.l=S,C.i=k,C.w=function(e,t){return A(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var x=function(){function g(e){this.$L=S(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[w]=!0}var m=g.prototype;return m.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(C.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(h);if(n){var o=n[2]-1||0,i=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],o,n[3]||1,n[4]||0,n[5]||0,n[6]||0,i)):new Date(n[1],o,n[3]||1,n[4]||0,n[5]||0,n[6]||0,i)}}return new Date(t)}(e),this.init()},m.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},m.$utils=function(){return C},m.isValid=function(){return!(this.$d.toString()===d)},m.isSame=function(e,t){var r=A(e);return this.startOf(t)<=r&&r<=this.endOf(t)},m.isAfter=function(e,t){return A(e)0,m<=g.r||!g.r){m<=1&&p>0&&(g=d[p-1]);var v=f[g.l];s&&(m=s(""+m)),l="string"==typeof v?v.replace("%d",m):v(m,n,g.l,u);break}}if(n)return l;var y=u?f.future:f.past;return"function"==typeof y?y(l):y.replace("%s",l)},n.to=function(e,t){return i(e,t,this,!0)},n.from=function(e,t){return i(e,t,this)};var a=function(e){return e.$u?r.utc():r()};n.toNow=function(e){return this.to(a(this),e)},n.fromNow=function(e){return this.from(a(this),e)}}}()},6320:e=>{"use strict";var t={single_source_shortest_paths:function(e,r,n){var o={},i={};i[r]=0;var a,s,c,l,u,f,d,h=t.PriorityQueue.make();for(h.push(r,0);!h.empty();)for(c in s=(a=h.pop()).value,l=a.cost,u=e[s]||{})u.hasOwnProperty(c)&&(f=l+u[c],d=i[c],(void 0===i[c]||d>f)&&(i[c]=f,h.push(c,f),o[c]=s));if(void 0!==n&&void 0===i[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var o=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,o={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o.queue=[],o.sorter=e.sorter||n.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},4146:(e,t,r)=>{"use strict";var n=r(3404),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function c(e){return n.isMemo(e)?a:s[e.$$typeof]||o}s[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[n.Memo]=a;var l=Object.defineProperty,u=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,h=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,r,n){if("string"!=typeof r){if(p){var o=h(r);o&&o!==p&&e(t,o,n)}var a=u(r);f&&(a=a.concat(f(r)));for(var s=c(t),g=c(r),m=0;m{"use strict";var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,a=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,l=r?Symbol.for("react.context"):60110,u=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,p=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,m=r?Symbol.for("react.lazy"):60116,v=r?Symbol.for("react.block"):60121,y=r?Symbol.for("react.fundamental"):60117,b=r?Symbol.for("react.responder"):60118,w=r?Symbol.for("react.scope"):60119;function k(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case u:case f:case i:case s:case a:case h:return e;default:switch(e=e&&e.$$typeof){case l:case d:case m:case g:case c:return e;default:return t}}case o:return t}}}function S(e){return k(e)===f}t.AsyncMode=u,t.ConcurrentMode=f,t.ContextConsumer=l,t.ContextProvider=c,t.Element=n,t.ForwardRef=d,t.Fragment=i,t.Lazy=m,t.Memo=g,t.Portal=o,t.Profiler=s,t.StrictMode=a,t.Suspense=h,t.isAsyncMode=function(e){return S(e)||k(e)===u},t.isConcurrentMode=S,t.isContextConsumer=function(e){return k(e)===l},t.isContextProvider=function(e){return k(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return k(e)===d},t.isFragment=function(e){return k(e)===i},t.isLazy=function(e){return k(e)===m},t.isMemo=function(e){return k(e)===g},t.isPortal=function(e){return k(e)===o},t.isProfiler=function(e){return k(e)===s},t.isStrictMode=function(e){return k(e)===a},t.isSuspense=function(e){return k(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===s||e===a||e===h||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===g||e.$$typeof===c||e.$$typeof===l||e.$$typeof===d||e.$$typeof===y||e.$$typeof===b||e.$$typeof===w||e.$$typeof===v)},t.typeOf=k},3404:(e,t,r)=>{"use strict";e.exports=r(3072)},2694:(e,t,r)=>{"use strict";var n=r(6925);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,i,a){if(a!==n){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},5556:(e,t,r)=>{e.exports=r(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},7583:(e,t,r)=>{const n=r(1333),o=r(157),i=r(7899),a=r(6756);function s(e,t,r,i,a){const s=[].slice.call(arguments,1),c=s.length,l="function"==typeof s[c-1];if(!l&&!n())throw new Error("Callback required as last argument");if(!l){if(c<1)throw new Error("Too few arguments provided");return 1===c?(r=t,t=i=void 0):2!==c||t.getContext||(i=r,r=t,t=void 0),new Promise((function(n,a){try{const a=o.create(r,i);n(e(a,t,i))}catch(e){a(e)}}))}if(c<2)throw new Error("Too few arguments provided");2===c?(a=r,r=t,t=i=void 0):3===c&&(t.getContext&&void 0===a?(a=i,i=void 0):(a=i,i=r,r=t,t=void 0));try{const n=o.create(r,i);a(null,e(n,t,i))}catch(e){a(e)}}t.create=o.create,t.toCanvas=s.bind(null,i.render),t.toDataURL=s.bind(null,i.renderToDataURL),t.toString=s.bind(null,(function(e,t,r){return a.render(e,r)}))},1333:e=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},6421:(e,t,r)=>{const n=r(6886).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,r=n(e),o=145===r?26:2*Math.ceil((r-13)/(2*t-2)),i=[r-7];for(let e=1;e{const n=r(208),o=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*o.indexOf(this.data[t]);r+=o.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(o.indexOf(this.data[t]),6)},e.exports=i},9899:e=>{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let r=0;r>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},8820:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,r,n){const o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},5822:(e,t,r)=>{const n=r(208);function o(e){this.mode=n.BYTE,this.data="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}o.getBitsLength=function(e){return 8*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){for(let t=0,r=this.data.length;t{const n=r(9953),o=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case n.L:return o[4*(e-1)+0];case n.M:return o[4*(e-1)+1];case n.Q:return o[4*(e-1)+2];case n.H:return o[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case n.L:return i[4*(e-1)+0];case n.M:return i[4*(e-1)+1];case n.Q:return i[4*(e-1)+2];case n.H:return i[4*(e-1)+3];default:return}}},9953:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return r}}},7756:(e,t,r)=>{const n=r(6886).getSymbolSize;t.getPositions=function(e){const t=n(e);return[[0,0],[t-7,0],[0,t-7]]}},4565:(e,t,r)=>{const n=r(6886),o=n.getBCHDigit(1335);t.getEncodedBits=function(e,t){const r=e.bit<<3|t;let i=r<<10;for(;n.getBCHDigit(i)-o>=0;)i^=1335<{const r=new Uint8Array(512),n=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)r[t]=e,n[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)r[e]=r[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return n[e]},t.exp=function(e){return r[e]},t.mul=function(e,t){return 0===e||0===t?0:r[n[e]+n[t]]}},7242:(e,t,r)=>{const n=r(208),o=r(6886);function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}},e.exports=i},1332:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function r(e,r,n){switch(e){case t.Patterns.PATTERN000:return(r+n)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return n%3==0;case t.Patterns.PATTERN011:return(r+n)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case t.Patterns.PATTERN101:return r*n%2+r*n%3==0;case t.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case t.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let r=0,n=0,o=0,i=null,a=null;for(let s=0;s=5&&(r+=n-5+3),i=t,n=1),t=e.get(c,s),t===a?o++:(o>=5&&(r+=o-5+3),a=t,o=1)}n>=5&&(r+=n-5+3),o>=5&&(r+=o-5+3)}return r},t.getPenaltyN2=function(e){const t=e.size;let r=0;for(let n=0;n=10&&(1488===n||93===n)&&r++,o=o<<1&2047|e.get(a,i),a>=10&&(1488===o||93===o)&&r++}return 40*r},t.getPenaltyN4=function(e){let t=0;const r=e.data.length;for(let n=0;n{const n=r(1878),o=r(7044);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!n.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return o.testNumeric(e)?t.NUMERIC:o.testAlphanumeric(e)?t.ALPHANUMERIC:o.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return r}}},4357:(e,t,r)=>{const n=r(208);function o(e){this.mode=n.NUMERIC,this.data=e.toString()}o.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);const o=this.data.length-t;o>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*o+1))},e.exports=o},4713:(e,t,r)=>{const n=r(2731);t.mul=function(e,t){const r=new Uint8Array(e.length+t.length-1);for(let o=0;o=0;){const e=r[0];for(let o=0;o{const n=r(6886),o=r(9953),i=r(9899),a=r(8820),s=r(6421),c=r(7756),l=r(1332),u=r(7518),f=r(4764),d=r(1427),h=r(4565),p=r(208),g=r(9801);function m(e,t,r){const n=e.size,o=h.getEncodedBits(t,r);let i,a;for(i=0;i<15;i++)a=1==(o>>i&1),i<6?e.set(i,8,a,!0):i<8?e.set(i+1,8,a,!0):e.set(n-15+i,8,a,!0),i<8?e.set(8,n-i-1,a,!0):i<9?e.set(8,15-i-1+1,a,!0):e.set(8,15-i-1,a,!0);e.set(n-8,8,1,!0)}function v(e,t,r,o){let h;if(Array.isArray(e))h=g.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let n=t;if(!n){const t=g.rawSplit(e);n=d.getBestVersionForData(t,r)}h=g.fromString(e,n||40)}}const v=d.getBestVersionForData(h,r);if(!v)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t=0&&t<=6&&(0===n||6===n)||n>=0&&n<=6&&(0===t||6===t)||t>=2&&t<=4&&n>=2&&n<=4?e.set(o+t,i+n,!0,!0):e.set(o+t,i+n,!1,!0))}}(w,t),function(e){const t=e.size;for(let r=8;r=7&&function(e,t){const r=e.size,n=d.getEncodedBits(t);let o,i,a;for(let t=0;t<18;t++)o=Math.floor(t/3),i=t%3+r-8-3,a=1==(n>>t&1),e.set(o,i,a,!0),e.set(i,o,a,!0)}(w,t),function(e,t){const r=e.size;let n=-1,o=r-1,i=7,a=0;for(let s=r-1;s>0;s-=2)for(6===s&&s--;;){for(let r=0;r<2;r++)if(!e.isReserved(o,s-r)){let n=!1;a>>i&1)),e.set(o,s-r,n),i--,-1===i&&(a++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}(w,y),isNaN(o)&&(o=l.getBestMask(w,m.bind(null,w,r))),l.applyMask(o,w),m(w,r,o),{modules:w,version:t,errorCorrectionLevel:r,maskPattern:o,segments:h}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let r,i,a=o.M;return void 0!==t&&(a=o.from(t.errorCorrectionLevel,o.M),r=d.from(t.version),i=l.from(t.maskPattern),t.toSJISFunc&&n.setToSJISFunction(t.toSJISFunc)),v(e,r,a,i)}},4764:(e,t,r)=>{const n=r(4713);function o(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}o.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},o.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const r=n.mod(t,this.genPoly),o=this.degree-r.length;if(o>0){const e=new Uint8Array(this.degree);return e.set(r,o),e}return r},e.exports=o},7044:(e,t)=>{const r="[0-9]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+")(?:.|[\r\n]))+";t.KANJI=new RegExp(n,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(o,"g"),t.NUMERIC=new RegExp(r,"g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const i=new RegExp("^"+n+"$"),a=new RegExp("^"+r+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return a.test(e)},t.testAlphanumeric=function(e){return s.test(e)}},9801:(e,t,r)=>{const n=r(208),o=r(4357),i=r(1433),a=r(5822),s=r(7242),c=r(7044),l=r(6886),u=r(6320);function f(e){return unescape(encodeURIComponent(e)).length}function d(e,t,r){const n=[];let o;for(;null!==(o=e.exec(r));)n.push({data:o[0],index:o.index,mode:t,length:o[0].length});return n}function h(e){const t=d(c.NUMERIC,n.NUMERIC,e),r=d(c.ALPHANUMERIC,n.ALPHANUMERIC,e);let o,i;return l.isKanjiModeEnabled()?(o=d(c.BYTE,n.BYTE,e),i=d(c.KANJI,n.KANJI,e)):(o=d(c.BYTE_KANJI,n.BYTE,e),i=[]),t.concat(r,o,i).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function p(e,t){switch(t){case n.NUMERIC:return o.getBitsLength(e);case n.ALPHANUMERIC:return i.getBitsLength(e);case n.KANJI:return s.getBitsLength(e);case n.BYTE:return a.getBitsLength(e)}}function g(e,t){let r;const c=n.getBestModeForData(e);if(r=n.from(t,c),r!==n.BYTE&&r.bit=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[]))},t.rawSplit=function(e){return t.fromArray(h(e,l.isKanjiModeEnabled()))}},6886:(e,t)=>{let r;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return n[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');r=e},t.isKanjiModeEnabled=function(){return void 0!==r},t.toSJIS=function(e){return r(e)}},1878:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},1427:(e,t,r)=>{const n=r(6886),o=r(7518),i=r(9953),a=r(208),s=r(1878),c=n.getBCHDigit(7973);function l(e,t){return a.getCharCountIndicator(e,t)+4}function u(e,t){let r=0;return e.forEach((function(e){const n=l(e.mode,t);r+=n+e.getBitsLength()})),r}t.from=function(e,t){return s.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,r){if(!s.isValid(e))throw new Error("Invalid QR Code version");void 0===r&&(r=a.BYTE);const i=8*(n.getSymbolTotalCodewords(e)-o.getTotalCodewordsCount(e,t));if(r===a.MIXED)return i;const c=i-l(r,e);switch(r){case a.NUMERIC:return Math.floor(c/10*3);case a.ALPHANUMERIC:return Math.floor(c/11*2);case a.KANJI:return Math.floor(c/13);case a.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,r){let n;const o=i.from(r,i.M);if(Array.isArray(e)){if(e.length>1)return function(e,r){for(let n=1;n<=40;n++)if(u(e,n)<=t.getCapacity(n,r,a.MIXED))return n}(e,o);if(0===e.length)return 1;n=e[0]}else n=e;return function(e,r,n){for(let o=1;o<=40;o++)if(r<=t.getCapacity(o,n,e))return o}(n.mode,n.getLength(),o)},t.getEncodedBits=function(e){if(!s.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;n.getBCHDigit(t)-c>=0;)t^=7973<{const n=r(2726);t.render=function(e,t,r){let o=r,i=t;void 0!==o||t&&t.getContext||(o=t,t=void 0),t||(i=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),o=n.getOptions(o);const a=n.getImageWidth(e.modules.size,o),s=i.getContext("2d"),c=s.createImageData(a,a);return n.qrToImageData(c.data,e,o),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(s,i,a),s.putImageData(c,0,0),i},t.renderToDataURL=function(e,r,n){let o=n;void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={});const i=t.render(e,r,o),a=o.type||"image/png",s=o.rendererOpts||{};return i.toDataURL(a,s.quality)}},6756:(e,t,r)=>{const n=r(2726);function o(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function i(e,t,r){let n=e+t;return void 0!==r&&(n+=" "+r),n}t.render=function(e,t,r){const a=n.getOptions(t),s=e.modules.size,c=e.modules.data,l=s+2*a.margin,u=a.color.light.a?"':"",f="0&&l>0&&e[c-1]||(n+=a?i("M",l+r,.5+u+r):i("m",o,0),o=0,a=!1),l+1',d='viewBox="0 0 '+l+" "+l+'"',h=''+u+f+"\n";return"function"==typeof r&&r(null,h),h}},2726:(e,t)=>{function r(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:t,color:{dark:r(e.color.dark||"#000000ff"),light:r(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,r){const n=t.getScale(e,r);return Math.floor((e+2*r.margin)*n)},t.qrToImageData=function(e,r,n){const o=r.modules.size,i=r.modules.data,a=t.getScale(o,n),s=Math.floor((o+2*n.margin)*a),c=n.margin*a,l=[n.color.light,n.color.dark];for(let t=0;t=c&&r>=c&&t{"use strict";var r=60103,n=60106,o=60107,i=60108,a=60114,s=60109,c=60110,l=60112,u=60113,f=60120,d=60115,h=60116,p=60121,g=60122,m=60117,v=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var b=Symbol.for;r=b("react.element"),n=b("react.portal"),o=b("react.fragment"),i=b("react.strict_mode"),a=b("react.profiler"),s=b("react.provider"),c=b("react.context"),l=b("react.forward_ref"),u=b("react.suspense"),f=b("react.suspense_list"),d=b("react.memo"),h=b("react.lazy"),p=b("react.block"),g=b("react.server.block"),m=b("react.fundamental"),v=b("react.debug_trace_mode"),y=b("react.legacy_hidden")}t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===a||e===v||e===i||e===u||e===f||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===d||e.$$typeof===s||e.$$typeof===c||e.$$typeof===l||e.$$typeof===m||e.$$typeof===p||e[0]===g)},t.typeOf=function(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case o:case a:case i:case u:case f:return e;default:switch(e=e&&e.$$typeof){case c:case l:case h:case d:case s:return e;default:return t}}case n:return t}}}},4363:(e,t,r)=>{"use strict";e.exports=r(2799)},2833:e=>{e.exports=function(e,t,r,n){var o=r?r.call(n,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),c=0;c{"use strict";var n,o=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),i=[];function a(e){for(var t=-1,r=0;r{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nc=void 0;var n={};(()=>{"use strict";r.r(n),r.d(n,{default:()=>nt});const e=require("react");var t=r.n(e),o=r(5556),i=r.n(o),a=r(4353),s=r.n(a),c=r(2706),l=r.n(c),u=r(6279),f=r.n(u),d=r(5750),h=r.n(d),p=r(7583),g=r(4363),m=r(2833),v=r.n(m);const y=function(e){function t(e,n,c,l,d){for(var h,p,g,m,w,S=0,A=0,C=0,x=0,z=0,$=0,R=g=h=0,N=0,D=0,L=0,B=0,j=c.length,Y=j-1,U="",H="",F="",q="";Nh)&&(B=(U=U.replace(" ",":")).length),0<_&&void 0!==(w=s(1,U,n,e,M,E,H.length,l,d,l))&&0===(B=(U=w.trim()).length)&&(U="\0\0"),h=U.charCodeAt(0),p=U.charCodeAt(1),h){case 0:break;case 64:if(105===p||99===p){q+=U+c.charAt(N);break}default:58!==U.charCodeAt(B-1)&&(H+=o(U,h,p,U.charCodeAt(2)))}L=D=R=h=0,U="",p=c.charCodeAt(++N)}}switch(p){case 13:case 10:47===A?A=0:0===1+h&&107!==l&&0n&&(n=(t=t.trim()).charCodeAt(0)),n){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*r&&0c.charCodeAt(8))break;case 115:a=a.replace(c,"-webkit-"+c)+";"+a;break;case 207:case 102:a=a.replace(c,"-webkit-"+(102n.charCodeAt(0)&&(n=n.trim()),n=[n],0<_){var o=s(-1,r,n,n,M,E,0,0,0,0);void 0!==o&&"string"==typeof o&&(r=o)}var i=t(P,n,r,0,0);return 0<_&&void 0!==(o=s(-2,i,n,n,M,E,i.length,0,0,0))&&(i=o),I=0,E=M=1,i}var u=/^\0+/g,f=/[\0\r\f]/g,d=/: */g,h=/zoo|gra/,p=/([,: ])(transform)/g,g=/,\r+?/g,m=/([\t\r\n ])*\f?&/g,v=/@(k\w+)\s*(\S*)\s*/,y=/::(place)/g,b=/:(read-only)/g,w=/[svh]\w+-[tblr]{2}/,k=/\(\s*(.*)\s*\)/g,S=/([\s\S]*?);/g,A=/-self|flex-/g,C=/[^]*?(:[rp][el]a[\w-]+)[^]*/,x=/stretch|:\s*\w+\-(?:conte|avail)/,z=/([^-])(image-set\()/,E=1,M=1,I=0,T=1,P=[],$=[],_=0,R=null,O=0;return l.use=function e(t){switch(t){case void 0:case null:_=$.length=0;break;default:if("function"==typeof t)$[_++]=t;else if("object"==typeof t)for(var r=0,n=t.length;r1?t-1:0),n=1;n0?" Args: "+r.join(", "):""))}var L=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,r=0;r=this.groupSizes.length){for(var r=this.groupSizes,n=r.length,o=n;e>=o;)(o<<=1)<0&&D(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var i=n;i=this.length||0===this.groupSizes[e])return t;for(var r=this.groupSizes[e],n=this.indexOfGroup(e),o=n+r,i=n;i=Y&&(Y=t+1),B.set(e,t),j.set(t,e)},q="style["+_+'][data-styled-version="5.3.11"]',J=new RegExp("^"+_+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),V=function(e,t,r){for(var n,o=r.split(","),i=0,a=o.length;i=0;r--){var n=t[r];if(n&&1===n.nodeType&&n.hasAttribute(_))return n}}(r),i=void 0!==o?o.nextSibling:null;n.setAttribute(_,"active"),n.setAttribute("data-styled-version","5.3.11");var a=K();return a&&n.setAttribute("nonce",a),r.insertBefore(n,i),n},Q=function(){function e(e){var t=this.element=G(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,r=0,n=t.length;r=0){var r=document.createTextNode(t),n=this.nodes[e];return this.element.insertBefore(r,n||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e0&&(l+=e+",")})),n+=""+s+c+'{content:"'+l+'"}/*!sc*/\n'}}}return n}(this)},e}(),ne=/(a)(d)/gi,oe=function(e){return String.fromCharCode(e+(e>25?39:97))};function ie(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=oe(t%52)+r;return(oe(t%52)+r).replace(ne,"$1-$2")}var ae=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},se=function(e){return ae(5381,e)};function ce(e){for(var t=0;t>>0);if(!t.hasNameForId(n,a)){var s=r(i,"."+a,void 0,n);t.insertRules(n,a,s)}o.push(a),this.staticRulesId=a}else{for(var c=this.rules.length,l=ae(this.baseHash,r.hash),u="",f=0;f>>0);if(!t.hasNameForId(n,g)){var m=r(u,"."+g,void 0,n);t.insertRules(n,g,m)}o.push(g)}}return o.join(" ")},e}(),fe=/^\s*\/\/.*$/gm,de=[":","[",".","#"];function he(e){var t,r,n,o,i=void 0===e?I:e,a=i.options,s=void 0===a?I:a,c=i.plugins,l=void 0===c?M:c,u=new y(s),f=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(r,n,o,i,a,s,c,l,u,f){switch(r){case 1:if(0===u&&64===n.charCodeAt(0))return e(n+";"),"";break;case 2:if(0===l)return n+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(o[0]+n),"";default:return n+(0===f?"/*|*/":"")}case-2:n.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),h=function(e,n,i){return 0===n&&-1!==de.indexOf(i[r.length])||i.match(o)?e:"."+t};function p(e,i,a,s){void 0===s&&(s="&");var c=e.replace(fe,""),l=i&&a?a+" "+i+" { "+c+" }":c;return t=s,r=i,n=new RegExp("\\"+r+"\\b","g"),o=new RegExp("(\\"+r+"\\b){2,}"),u(a||!i?"":i,l)}return u.use([].concat(l,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(r)>0&&(o[0]=o[0].replace(n,h))},d,function(e){if(-2===e){var t=f;return f=[],t}}])),p.hash=l.length?l.reduce((function(e,t){return t.name||D(15),ae(e,t.name)}),5381).toString():"",p}var pe=t().createContext(),ge=(pe.Consumer,t().createContext()),me=(ge.Consumer,new re),ve=he();function ye(){return(0,e.useContext)(pe)||me}function be(){return(0,e.useContext)(ge)||ve}function we(r){var n=(0,e.useState)(r.stylisPlugins),o=n[0],i=n[1],a=ye(),s=(0,e.useMemo)((function(){var e=a;return r.sheet?e=r.sheet:r.target&&(e=e.reconstructWithOptions({target:r.target},!1)),r.disableCSSOMInjection&&(e=e.reconstructWithOptions({useCSSOMInjection:!1})),e}),[r.disableCSSOMInjection,r.sheet,r.target]),c=(0,e.useMemo)((function(){return he({options:{prefix:!r.disableVendorPrefixes},plugins:o})}),[r.disableVendorPrefixes,o]);return(0,e.useEffect)((function(){v()(o,r.stylisPlugins)||i(r.stylisPlugins)}),[r.stylisPlugins]),t().createElement(pe.Provider,{value:s},t().createElement(ge.Provider,{value:c},r.children))}var ke=function(){function e(e,t){var r=this;this.inject=function(e,t){void 0===t&&(t=ve);var n=r.name+t.hash;e.hasNameForId(r.id,n)||e.insertRules(r.id,n,t(r.rules,n,"@keyframes"))},this.toString=function(){return D(12,String(r.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=ve),this.name+e.hash},e}(),Se=/([A-Z])/,Ae=/([A-Z])/g,Ce=/^ms-/,xe=function(e){return"-"+e.toLowerCase()};function ze(e){return Se.test(e)?e.replace(Ae,xe).replace(Ce,"-ms-"):e}var Ee=function(e){return null==e||!1===e||""===e};function Me(e,t,r,n){if(Array.isArray(e)){for(var o,i=[],a=0,s=e.length;a1?t-1:0),n=1;n?@[\\\]^`{|}~-]+/g,_e=/(^-|-$)/g;function Re(e){return e.replace($e,"-").replace(_e,"")}var Oe=function(e){return ie(se(e)>>>0)};function Ne(e){return"string"==typeof e&&!0}var De=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Le=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function Be(e,t,r){var n=e[r];De(t)&&De(n)?je(n,t):e[r]=t}function je(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n=0||(o[r]=e[r]);return o}(n,["componentId"]),i=t&&t+"-"+(Ne(e)?e:Re(P(e)));return He(e,x({},r,{attrs:p,componentId:i}),o)},Object.defineProperty(m,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?je({},r.defaultProps,e):e}}),Object.defineProperty(m,"toString",{value:function(){return"."+m.styledComponentId}}),a&&C()(m,r,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),m}var Fe=function(e){return function e(t,r,n){if(void 0===n&&(n=I),!(0,g.isValidElementType)(r))return D(1,String(r));var o=function(){return t(r,n,Te.apply(void 0,arguments))};return o.withConfig=function(o){return e(t,r,x({},n,{},o))},o.attrs=function(o){return e(t,r,x({},n,{attrs:Array.prototype.concat(n.attrs,o).filter(Boolean)}))},o}(He,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(e){Fe[e]=Fe(e)}));var qe,Je,Ve=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=ce(e),re.registerId(this.componentId+1)}var t=e.prototype;return t.createStyles=function(e,t,r,n){var o=n(Me(this.rules,t,r,n).join(""),""),i=this.componentId+e;r.insertRules(i,i,o)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,r,n){e>2&&re.registerId(this.componentId+e),this.removeStyles(e,r),this.createStyles(e,t,r,n)},e}();function We(r){var n=r.id,o=r.css,i=void 0===o?null:o;if(!i)return t().createElement(t().Fragment,null);var a,s,c=i.replaceAll("#SLIDE_ID","#".concat(n)),l=function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i"+t+""},this.getStyleTags=function(){return e.sealed?D(2):e._emitSheetCSS()},this.getStyleElement=function(){var r;if(e.sealed)return D(2);var n=((r={})[_]="",r["data-styled-version"]="5.3.11",r.dangerouslySetInnerHTML={__html:e.instance.toString()},r),o=K();return o&&(n.nonce=o),[t().createElement("style",x({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new re({isServer:!0}),this.sealed=!1}.prototype).collectStyles=function(e){return this.sealed?D(2):t().createElement(we,{sheet:this.instance},e)},qe.interleaveWithNodeStream=function(e){return D(3)},We.propTypes={id:i().string.isRequired,css:i().string};var Ke=r(5072),Ge=r.n(Ke),Qe=r(8070);Ge()(Qe.A,{insert:"head",singleton:!1}),Qe.A.locals;var Ze=r(3118);function Xe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],c=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||et(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function et(e,t){if(e){if("string"==typeof e)return tt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tt(e,t):void 0}}function tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0){var r,n=e[t[0]];return null!=n&&null!==(r=n.assets)&&void 0!==r&&r.uri?n.assets.uri:null!=n&&n.url?n.url:null}return null}(I,c.fallbackImage),L=1e3*P;(0,e.useEffect)((function(){return v&&(x.current=setTimeout((function(){var e=(w.indexOf(v)+1)%Math.min(w.length,O);0===e?d(a):y(w[e])}),L),null!=v&&v.link?p.toDataURL(v.link,{color:{dark:"#000000",light:"#ffffff00"}}).then((function(e){C(e)})):C(null)),function(){null!=x&&x.current&&clearInterval(x.current)}}),[v]),(0,e.useEffect)((function(){w.length>0&&y(w[0])}),[w]),(0,e.useEffect)((function(){E&&Object.hasOwnProperty.call(E,"entries")&&k(E.entries)}),[E]),(0,e.useEffect)((function(){u&&(null==w?void 0:w.length)>0&&y(w[0])}),[u]);var B=v?function(e){var t,r=null!=D?D:null;if((null==e?void 0:e.medias)instanceof Array){var n=function(e){if(Array.isArray(e))return tt(e)}(t=null==e?void 0:e.medias)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||et(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();if((null==n?void 0:n.length)>0){var o=n.pop();null!=o&&o.url&&(r=o.url)}}return r}(v):null;return t().createElement(t().Fragment,null,v&&t().createElement("div",{className:"template-news-feed"},t().createElement("div",{className:"media-section ".concat(_?"media-contain":""),style:{backgroundImage:B?'url("'.concat(B,'")'):""}}),t().createElement("div",{className:"text-section"},t().createElement("h1",{className:"title"},v.title),t().createElement("div",{className:"author"},v.lastModified?s()(v.lastModified).locale(l()).format("ll"):"",v.lastModified&&(null==v||null===(n=v.author)||void 0===n?void 0:n.name)&&" ▪ ",null==v||null===(o=v.author)||void 0===o?void 0:o.name),t().createElement("div",{className:"description"},v.content),t().createElement("div",{className:"description-fade"})),t().createElement("div",{className:"extra-section"},A&&t().createElement("img",{src:A,alt:"QR code link",className:"qr"}),v.link&&t().createElement(t().Fragment,null,t().createElement("div",{className:"read-more"},N||"Læs hele nyheden"),t().createElement("div",{className:"link"},v.link)))),t().createElement(We,{id:g,css:null==a||null===(i=a.theme)||void 0===i?void 0:i.cssStyles}))}Ge()(Ze.A,{insert:"head",singleton:!1}),Ze.A.locals,rt.propTypes={run:i().string.isRequired,slideDone:i().func.isRequired,slide:i().shape({theme:i().shape({cssStyles:i().string}),feedData:i().shape({title:i().string,entries:i().arrayOf(i().shape({title:i().string,content:i().string,author:i().shape({name:i().string}),medias:i().arrayOf(i().shape({url:i().string})),lastModified:i().string,link:i().string}))}).isRequired,mediaData:i().shape({url:i().string,assets:i().shape({uri:i().string})})}).isRequired,content:i().shape({readMore:i().string,entryDuration:i().number,maxEntries:i().number,mediaContain:i().bool,fallbackImage:i().arrayOf(i().string)}).isRequired,executionId:i().string.isRequired};const nt=rt})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); \ No newline at end of file diff --git a/package.json b/package.json index 81104938..e1b60485 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "os2display-grid-generator": "^1.0.9", "postcss-loader": "^5.3.0", "prop-types": "^15.7.2", + "qrcode": "^1.5.4", "react": "^18.2.0", "react-dom": "^18.2.0", "react-intl": "^5.20.12", @@ -52,13 +53,13 @@ "styled-components": "^5.3.1" }, "devDependencies": { - "enzyme": "^3.11.0", + "@svgr/webpack": "^5.5.0", "@testing-library/react": "^12.1.2", "@wojtekmaj/enzyme-adapter-react-17": "^0.6.3", - "@svgr/webpack": "^5.5.0", "babel-eslint": "^10.1.0", "clean-webpack-plugin": "^4.0.0-alpha.0", "copy-webpack-plugin": "^9.0.0", + "enzyme": "^3.11.0", "eslint": "^7.32.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.3.0", diff --git a/src/fixtures/images/sunset-full-hd.jpg b/src/fixtures/images/sunset-full-hd.jpg new file mode 100644 index 00000000..ab20b660 Binary files /dev/null and b/src/fixtures/images/sunset-full-hd.jpg differ diff --git a/src/index.js b/src/index.js index dcfb279a..2586177a 100644 --- a/src/index.js +++ b/src/index.js @@ -29,6 +29,7 @@ import Video from "./video/video"; import Travel from "./travel/travel"; import VimeoPlayer from "./vimeo-player/vimeo-player"; import "./index.css"; +import NewsFeed from "./news-feed/news-feed"; export const renderScreen = (screen) => { const gridTemplateAreas = { @@ -158,6 +159,16 @@ export const renderSlide = (slide) => { executionId="SLIDE_ID" /> ); + case "news-feed": + return ( + + ); case "table": return ( { + if (currentPost) { + timerRef.current = setTimeout(() => { + const currentIndex = posts.indexOf(currentPost); + const nextIndex = + (currentIndex + 1) % Math.min(posts.length, maxEntries); + + if (nextIndex === 0) { + slideDone(slide); + } else { + setCurrentPost(posts[nextIndex]); + } + }, duration); + + if (!currentPost?.link) { + setQr(null); + } else { + QRCode.toDataURL(currentPost.link, { + color: { + dark: "#000000", + light: "#ffffff00", + }, + }).then((data) => { + setQr(data); + }); + } + } + + return function cleanup() { + if (timerRef?.current) { + clearInterval(timerRef.current); + } + }; + }, [currentPost]); + + useEffect(() => { + if (posts.length > 0) { + setCurrentPost(posts[0]); + } + }, [posts]); + + useEffect(() => { + if (feedData && Object.hasOwnProperty.call(feedData, "entries")) { + setPosts(feedData.entries); + } + }, [feedData]); + + useEffect(() => { + if (run) { + if (posts?.length > 0) { + setCurrentPost(posts[0]); + } + } + }, [run]); + + const getImageUrl = (post) => { + let imageUrl = fallbackImageUrl ?? null; + + if (post?.medias instanceof Array) { + const medias = [...post?.medias]; + + if (medias?.length > 0) { + const first = medias.pop(); + + if (first?.url) { + imageUrl = first.url; + } + } + } + + return imageUrl; + }; + + const imageUrl = currentPost ? getImageUrl(currentPost) : null; + + return ( + <> + {currentPost && ( +
+
+
+

{currentPost.title}

+
+ {currentPost.lastModified + ? dayjs(currentPost.lastModified).locale(localeDa).format("ll") + : ""} + {currentPost.lastModified && currentPost?.author?.name && " ▪ "} + {currentPost?.author?.name} +
+
{currentPost.content}
+
+
+
+ {qr && QR code link} + {currentPost.link && ( + <> +
+ {readMore || "Læs hele nyheden"} +
+
{currentPost.link}
+ + )} +
+
+ )} + + + + ); +} + +NewsFeed.propTypes = { + run: PropTypes.string.isRequired, + slideDone: PropTypes.func.isRequired, + slide: PropTypes.shape({ + theme: PropTypes.shape({ + cssStyles: PropTypes.string, + }), + feedData: PropTypes.shape({ + title: PropTypes.string, + entries: PropTypes.arrayOf( + PropTypes.shape({ + title: PropTypes.string, + content: PropTypes.string, + author: PropTypes.shape({ + name: PropTypes.string, + }), + medias: PropTypes.arrayOf( + PropTypes.shape({ + url: PropTypes.string, + }) + ), + lastModified: PropTypes.string, + link: PropTypes.string, + }) + ), + }).isRequired, + mediaData: PropTypes.shape({ + url: PropTypes.string, + assets: PropTypes.shape({ uri: PropTypes.string }), + }), + }).isRequired, + content: PropTypes.shape({ + readMore: PropTypes.string, + entryDuration: PropTypes.number, + maxEntries: PropTypes.number, + mediaContain: PropTypes.bool, + fallbackImage: PropTypes.arrayOf(PropTypes.string), + }).isRequired, + executionId: PropTypes.string.isRequired, +}; + +export default NewsFeed; diff --git a/src/news-feed/news-feed.scss b/src/news-feed/news-feed.scss new file mode 100644 index 00000000..565c92e0 --- /dev/null +++ b/src/news-feed/news-feed.scss @@ -0,0 +1,144 @@ +.template-news-feed { + display: grid; + height: 100%; + width: 100%; + grid-template-columns: repeat(5, 1fr); + grid-template-rows: repeat(5, 1fr); + grid-column-gap: 0; + grid-row-gap: 0; + background-color: var(--background-color); + font-family: var(--font-family-base); + font-size: var(--font-size-base); + position: relative; + overflow: hidden; + + .media-section { + grid-area: 1 / 1 / 4 / 4; + height: 100%; + width: 100%; + background-color: var(--color-secondary); + background-size: cover; + background-position: top center; + + &.media-contain { + background-size: contain; + background-repeat: no-repeat; + } + } + + .text-section { + position: relative; + grid-area: 1 / 4 / 6 / 6; + width: 100%; + height: 100%; + padding: 5%; + overflow-wrap: break-word; + word-wrap: break-word; + -webkit-hyphens: auto; + -ms-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; + overflow: hidden; + background-color: var(--background-color); + color: var(--text-color); + + h1 { + font-size: var(--h1-font-size); + font-weight: var(--font-weight-bold); + margin-top: 0; + } + + .description { + font-size: var(--h3-font-size); + line-height: var(--line-height-base); + color: var(--text-color); + margin-top: var(--margin-size-base); + } + + .author { + font-size: var(--h4-font-size); + line-height: var(--line-height-base); + } + + .description-fade { + position: absolute; + bottom: 0; + width: 100%; + height: 15%; + background: var(--background-color); + background: linear-gradient( + 180deg, + rgba(255, 255, 255, 0) 0%, + var(--background-color) 75%, + var(--background-color) 100% + ); + } + } + + .extra-section { + grid-area: 4 / 1 / 6 / 4; + padding: 5%; + height: 100%; + width: 100%; + background-color: var(--color-secondary); + display: flex; + flex-direction: column; + justify-content: end; + + .qr { + width: 20%; + margin-bottom: 2%; + } + + .read-more { + font-size: var(--h2-font-size); + } + + .link { + font-size: var(--h4-font-size); + } + } + + @media (orientation: portrait) { + display: grid; + grid-template-columns: 1fr; + grid-template-rows: repeat(5, 1fr); + grid-column-gap: 0; + grid-row-gap: 0; + + .media-section { + background-color: var(--background-color); + grid-area: 1 / 1 / 3 / 2; + width: auto; + height: var(--percentage-wide); + } + + .text-section { + grid-area: 3 / 1 / 5 / 2; + width: auto; + height: var(--percentage-wide); + } + + .extra-section { + grid-area: 5 / 1 / 6 / 2; + } + } + + @keyframes fadeIn { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } + } + + @keyframes fadeOut { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } + } +} diff --git a/src/slides.js b/src/slides.js index 771bb768..3155d1e6 100644 --- a/src/slides.js +++ b/src/slides.js @@ -1471,6 +1471,100 @@ const slides = [ mediaContain: true, }, }, + { + id: "slide25-news-feed", + type: "news-feed", + themeFile: "themes/aarhus.css", + // Disable dark mode for slide. + darkModeEnabled: false, + feed: { + configuration: { + numberOfEntries: 5, + entryDuration: 5, + }, + }, + feedData: { + title: "Lorem Ipsum", + entries: [ + { + categories: ["Nyheder"], + author: { + name: "Test Testesen", + uri: null, + email: null, + }, + lastModified: "2024-11-18T08:31:47+00:00", + title: "Aenean scelerisque ligula ante, sed tristique tellus?", + publicId: "136880", + link: "https://example.com/news/1", + host: "https://example.com", + elements: [], + medias: [ + { + nodeName: null, + type: null, + url: "./fixtures/images/sunset-full-hd.jpg", + length: null, + title: null, + description: null, + thumbnail: "./fixtures/images/sunset-full-hd.jpg", + }, + ], + summary: + "Duis volutpat orci lectus, vel fringilla tortor pharetra non. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl.", + content: + "Duis volutpat orci lectus, vel fringilla tortor pharetra non. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Duis volutpat orci lectus, vel fringilla tortor pharetra non. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl.", + }, + { + categories: ["Nyheder"], + author: { + name: "Aenean Scelerisque", + uri: null, + email: null, + }, + lastModified: "2024-11-18T08:31:47+00:00", + title: "Duis volutpat orci lectus.", + publicId: "136880", + link: "https://example.com/news/1", + host: "https://example.com", + elements: [], + medias: [ + { + nodeName: null, + type: null, + url: "./fixtures/images/mountain4.jpeg", + length: null, + title: null, + description: null, + thumbnail: "./fixtures/images/mountain4.jpeg", + }, + ], + summary: + "Duis volutpat orci lectus, vel fringilla tortor pharetra non. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl.", + content: + "Duis volutpat orci lectus, vel fringilla tortor pharetra non. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Duis volutpat orci lectus, vel fringilla tortor pharetra non. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl. Nunc eget dui quam. Quisque non nulla et ante consequat tempor sit amet ut nisl.", + }, + { + title: "Lorem ipsum dolor sit amet.", + lastModified: "2023-02-13T07:00:00.360Z", + content: + "Aenean scelerisque ligula ante, sed tristique tellus blandit sit amet. Vestibulum sagittis lobortis purus quis tempor. Aliquam pretium vitae risus id condimentum.", + }, + ], + }, + mediaData: { + "/v1/media/00000000000000000000000001": { + assets: { + uri: "/fixtures/images/dokk1-rss-template-bg.jpg", + }, + }, + }, + content: { + fontSize: "font-size-m", + mediaContain: false, + fallbackImage: ["/v1/media/00000000000000000000000001"], + }, + }, ]; export default slides; diff --git a/webpack.config.js b/webpack.config.js index 0c5c1ac3..54880eff 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -44,6 +44,10 @@ const entry = devMode "./src/instagram-feed/instagram-feed.js" ), iframe: path.resolve(__dirname, "./src/iframe/iframe.js"), + "news-feed": path.resolve( + __dirname, + "./src/news-feed/news-feed.js" + ), table: path.resolve(__dirname, "./src/table/table.js"), video: path.resolve(__dirname, "./src/video/video.js"), travel: path.resolve(__dirname, "./src/travel/travel.js"), diff --git a/yarn.lock b/yarn.lock index 8a1e0052..fc0eb1d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2805,6 +2805,15 @@ cliui@^5.0.0: strip-ansi "^5.2.0" wrap-ansi "^5.1.0" +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" @@ -3437,6 +3446,11 @@ diff@^5.0.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== +dijkstrajs@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/dijkstrajs/-/dijkstrajs-1.0.3.tgz#4c8dbdea1f0f6478bff94d9c49c784d623e4fc23" + integrity sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -7115,6 +7129,11 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +pngjs@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-5.0.0.tgz#e79dd2b215767fd9c04561c01236df960bce7fbb" + integrity sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw== + portfinder@^1.0.26: version "1.0.32" resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.32.tgz#2fe1b9e58389712429dc2bea5beb2146146c7f81" @@ -7370,6 +7389,15 @@ q@^1.1.2: resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== +qrcode@^1.5.4: + version "1.5.4" + resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.5.4.tgz#5cb81d86eb57c675febb08cf007fff963405da88" + integrity sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg== + dependencies: + dijkstrajs "^1.0.1" + pngjs "^5.0.0" + yargs "^15.3.1" + qs@6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" @@ -9618,6 +9646,14 @@ yargs-parser@^13.1.2: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^20.2.3: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" @@ -9639,6 +9675,23 @@ yargs@^13.3.2: y18n "^4.0.0" yargs-parser "^13.1.2" +yargs@^15.3.1: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yauzl@^2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"