@vixoniccom/news-internal 0.4.21 → 0.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.zip CHANGED
Binary file
@@ -2,8 +2,8 @@ import { Group } from '@vixoniccom/modules'
2
2
  import { generalInputs } from './generalInputs'
3
3
  import { elementsInputs } from './elementsInputs'
4
4
 
5
- export const appereanceGroup = new Group({
6
- id: 'appaeranceGroup',
5
+ export const appearanceGroup = new Group({
6
+ id: 'appearanceGroup',
7
7
  label: 'Apariencia',
8
8
  items: [
9
9
  ...generalInputs,
@@ -1,8 +1,8 @@
1
1
  import { Configuration } from '@vixoniccom/modules'
2
- import { appereanceGroup } from './appearanceGroup'
2
+ import { appearanceGroup } from './appearanceGroup'
3
3
  import { newsGroup } from './newsGroup'
4
4
 
5
5
  export const configuration: Configuration = new Configuration({
6
6
  durationFormula: `(_values.news && _values.news.filter(function(newsItem) { return new Date(newsItem.expirationDate) > new Date() || isNaN(new Date(newsItem.expirationDate)) ; }).length || 0) * (_values.showTime || 10)`,
7
- schema: [newsGroup, appereanceGroup],
7
+ schema: [newsGroup, appearanceGroup],
8
8
  })
@@ -3,7 +3,7 @@ import { ShowValidations } from '../utils'
3
3
 
4
4
  export const newsInputs = [
5
5
  new TextInput({
6
- id: 'titleShort',
6
+ id: 'title',
7
7
  label: 'Título corto',
8
8
  required: true,
9
9
  show: ShowValidations.shortTitleEnabled,
@@ -11,7 +11,7 @@ export const newsInputs = [
11
11
  pattern: '^(?!\\s*$).+',
12
12
  }),
13
13
  new TextInput({
14
- id: 'titleMedium',
14
+ id: 'title',
15
15
  label: 'Título mediano',
16
16
  required: true,
17
17
  show: ShowValidations.mediumTitleEnabled,
@@ -19,7 +19,7 @@ export const newsInputs = [
19
19
  pattern: '^(?!\\s*$).+',
20
20
  }),
21
21
  new TextInput({
22
- id: 'titleLarge',
22
+ id: 'title',
23
23
  label: 'Título largo',
24
24
  required: true,
25
25
  show: ShowValidations.largeTitleEnabled,
@@ -28,7 +28,7 @@ export const newsInputs = [
28
28
  }),
29
29
 
30
30
  new TextInput({
31
- id: 'titleExtraLarge',
31
+ id: 'title',
32
32
  label: 'Título extra largo',
33
33
  required: true,
34
34
  show: ShowValidations.extraLargeTitleEnabled,
@@ -37,7 +37,7 @@ export const newsInputs = [
37
37
  }),
38
38
 
39
39
  new TextArea({
40
- id: 'descriptionShort',
40
+ id: 'description',
41
41
  label: 'Descripción corta',
42
42
  required: true,
43
43
  show: ShowValidations.shortDescriptionEnabled,
@@ -47,7 +47,7 @@ export const newsInputs = [
47
47
  }),
48
48
 
49
49
  new TextArea({
50
- id: 'descriptionMedium',
50
+ id: 'description',
51
51
  label: 'Descripción mediana',
52
52
  required: true,
53
53
  show: ShowValidations.mediumDescriptionEnabled,
@@ -57,7 +57,7 @@ export const newsInputs = [
57
57
  }),
58
58
 
59
59
  new TextArea({
60
- id: 'descriptionLarge',
60
+ id: 'description',
61
61
  label: 'Descripción larga',
62
62
  required: true,
63
63
  show: ShowValidations.largeDescriptionEnabled,
@@ -67,7 +67,7 @@ export const newsInputs = [
67
67
  }),
68
68
 
69
69
  new TextArea({
70
- id: 'descriptionExtraLarge',
70
+ id: 'description',
71
71
  label: 'Descripción extra larga',
72
72
  required: true,
73
73
  show: ShowValidations.extraLargeDescriptionEnabled,
@@ -7,7 +7,7 @@
7
7
  "type": "list",
8
8
  "itemSchema": [
9
9
  {
10
- "id": "titleShort",
10
+ "id": "title",
11
11
  "label": "Título corto",
12
12
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'short')",
13
13
  "type": "text-input",
@@ -16,7 +16,7 @@
16
16
  "range": "[1:25]"
17
17
  },
18
18
  {
19
- "id": "titleMedium",
19
+ "id": "title",
20
20
  "label": "Título mediano",
21
21
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'medium')",
22
22
  "type": "text-input",
@@ -25,7 +25,7 @@
25
25
  "range": "[1:40]"
26
26
  },
27
27
  {
28
- "id": "titleLarge",
28
+ "id": "title",
29
29
  "label": "Título largo",
30
30
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'large')",
31
31
  "type": "text-input",
@@ -34,7 +34,7 @@
34
34
  "range": "[1:50]"
35
35
  },
36
36
  {
37
- "id": "titleExtraLarge",
37
+ "id": "title",
38
38
  "label": "Título extra largo",
39
39
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'extra-large')",
40
40
  "type": "text-input",
@@ -43,7 +43,7 @@
43
43
  "range": "[1:70]"
44
44
  },
45
45
  {
46
- "id": "descriptionShort",
46
+ "id": "description",
47
47
  "label": "Descripción corta",
48
48
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'short')",
49
49
  "type": "text-area",
@@ -53,7 +53,7 @@
53
53
  "html": true
54
54
  },
55
55
  {
56
- "id": "descriptionMedium",
56
+ "id": "description",
57
57
  "label": "Descripción mediana",
58
58
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'medium')",
59
59
  "type": "text-area",
@@ -63,7 +63,7 @@
63
63
  "html": true
64
64
  },
65
65
  {
66
- "id": "descriptionLarge",
66
+ "id": "description",
67
67
  "label": "Descripción larga",
68
68
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'large')",
69
69
  "type": "text-area",
@@ -73,7 +73,7 @@
73
73
  "html": true
74
74
  },
75
75
  {
76
- "id": "descriptionExtraLarge",
76
+ "id": "description",
77
77
  "label": "Descripción extra larga",
78
78
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'extra-large')",
79
79
  "type": "text-area",
@@ -129,7 +129,7 @@
129
129
  "sortable": true
130
130
  },
131
131
  {
132
- "id": "appaeranceGroup",
132
+ "id": "appearanceGroup",
133
133
  "label": "Apariencia",
134
134
  "type": "group",
135
135
  "items": [
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "author": {
9
9
  "name": ""
10
10
  },
11
- "version": "0.4.21",
11
+ "version": "0.4.22",
12
12
  "scripts": {
13
13
  "prepublish": "vixonic-module-packager --mode=build",
14
14
  "watch": "vixonic-module-packager --mode=watch",
@@ -36,7 +36,7 @@
36
36
  "@types/react-transition-group": "^4.4.12",
37
37
  "@types/uuid": "^9.0.1",
38
38
  "@vixoniccom/module-packager": "^2.13.0-dev.1",
39
- "@vixoniccom/modules": "^2.22.0-dev.3",
39
+ "@vixoniccom/modules": "^2.25.0-dev.18",
40
40
  "standard-version": "^9.5.0"
41
41
  }
42
42
  }
@@ -1 +1,2 @@
1
- sonar.projectKey=Vixonic_store-news-internal_7997a402-cbee-4f01-a556-e7f3da37d90d
1
+ sonar.projectKey=Vixonic_store-news-internal_7997a402-cbee-4f01-a556-e7f3da37d90d
2
+ sonar.exclusions=.github/**/*
@@ -10,36 +10,21 @@ export type Props = {
10
10
 
11
11
  export const App: React.FunctionComponent<Props> = ({ data }) => {
12
12
  const [news, setNews] = useState<NewsItem[]>([])
13
-
14
- const getPrefixBySize = (n: any, size: string, prefix: string): string => {
15
- const prefixMap: { [key: string]: string } = {
16
- 'short': n[`${prefix}Short`],
17
- 'medium': n[`${prefix}Medium`],
18
- 'large': n[`${prefix}Large`],
19
- 'extra-large': n[`${prefix}ExtraLarge`]
20
- }
21
- return prefixMap[size] || n[`${prefix}Medium`] || ''
22
- }
23
13
 
24
14
  const parseNews = (data?: VixonicData): NewsItem[] => {
25
15
  if (!data) return []
26
- const { news, newsSizeSelect } = data.parameters
16
+ const { news } = data.parameters
27
17
  const parsedNews = news?.map((n) => {
28
18
  const { image, ...rest } = n
29
19
  let parsedImage
30
20
  const qrUrl = n.qrCodeUrl
31
21
  if (image?.filename) parsedImage = `${data.downloadsPath}/${image.filename}`
32
-
33
- let title = getPrefixBySize(n, newsSizeSelect ?? 'medium', 'title')
34
- let description = getPrefixBySize(n, newsSizeSelect ?? 'medium', 'description')
35
22
 
36
23
  return {
37
24
  ...rest,
38
- title,
39
- description,
40
25
  image: parsedImage,
41
26
  id: uuid(),
42
- qrCodeUrl: qrUrl
27
+ qrCodeUrl: qrUrl
43
28
  }
44
29
  }).filter((n) => {
45
30
  const { expirationDate } = n
@@ -18,6 +18,12 @@ export const NewsContainer: React.FunctionComponent<Props> = (props) => {
18
18
  const [currentIndex, setCurrentIndex] = useState(0)
19
19
  const item = props.items.length > currentIndex ? props.items[currentIndex] : undefined
20
20
 
21
+ useEffect(() => {
22
+ if (props.items.length > 0 && currentIndex >= props.items.length) {
23
+ setCurrentIndex(0)
24
+ }
25
+ }, [props.items.length])
26
+
21
27
  useEffect(() => {
22
28
  startTimeout()
23
29
  return () => {
@@ -7,14 +7,8 @@ declare type VixonicData = {
7
7
  declare type VixonicParameters =
8
8
  Partial<{
9
9
  news: {
10
- titleShort: string,
11
- titleMedium: string,
12
- titleLarge: string,
13
- titleExtraLarge: string,
14
- descriptionShort: string,
15
- descriptionMedium: string,
16
- descriptionLarge: string,
17
- descriptionExtraLarge: string,
10
+ title: string,
11
+ description: string,
18
12
  image: {
19
13
  id?: string,
20
14
  filename?: string,
@@ -1,108 +0,0 @@
1
- name: Publish to NPM
2
-
3
- on:
4
- pull_request:
5
- branches:
6
- - development
7
- - master
8
- - main
9
- workflow_dispatch:
10
-
11
- jobs:
12
- publish:
13
- runs-on: ubuntu-latest
14
-
15
- steps:
16
- - name: Checkout code
17
- uses: actions/checkout@v4
18
- with:
19
- fetch-depth: 0
20
-
21
- - name: Setup Node.js 20
22
- uses: actions/setup-node@v4
23
- with:
24
- node-version: '20'
25
- registry-url: 'https://registry.npmjs.org'
26
- scope: '@vixoniccom'
27
-
28
- - name: Configure npm authentication
29
- run: |
30
- echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
31
- echo "@vixoniccom:registry=https://registry.npmjs.org/" >> ~/.npmrc
32
- echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
33
-
34
- - name: Cache node modules
35
- uses: actions/cache@v4
36
- with:
37
- path: ~/.npm
38
- key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
39
- restore-keys: |
40
- ${{ runner.os }}-node-
41
-
42
- - name: Install dependencies
43
- run: npm ci
44
- env:
45
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46
-
47
- - name: Configure Git
48
- run: |
49
- git config --global user.name "github-actions[bot]"
50
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
51
-
52
- - name: Create release version
53
- run: npm run release
54
- env:
55
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56
-
57
- - name: Build package
58
- run: npm run prepublish
59
- env:
60
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61
-
62
- - name: Verify build.zip exists
63
- run: |
64
- if [ ! -f "build.zip" ]; then
65
- echo "❌ Error: build.zip not found after build process"
66
- exit 1
67
- fi
68
- echo "✅ build.zip found successfully"
69
- ls -la build.zip
70
-
71
- - name: Check if version already exists on npm
72
- id: check-version
73
- run: |
74
- PACKAGE_NAME=$(node -p "require('./package.json').name")
75
- PACKAGE_VERSION=$(node -p "require('./package.json').version")
76
-
77
- echo "Checking if $PACKAGE_NAME@$PACKAGE_VERSION exists on npm..."
78
-
79
- if npm view "$PACKAGE_NAME@$PACKAGE_VERSION" version 2>/dev/null; then
80
- echo "version-exists=true" >> $GITHUB_OUTPUT
81
- echo "⚠️ Version $PACKAGE_VERSION already exists on npm"
82
- else
83
- echo "version-exists=false" >> $GITHUB_OUTPUT
84
- echo "✅ Version $PACKAGE_VERSION does not exist on npm - ready to publish"
85
- fi
86
-
87
- - name: Publish to npm
88
- if: steps.check-version.outputs.version-exists == 'false'
89
- run: |
90
- echo "Publishing to npm..."
91
- npm publish --access public
92
- env:
93
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
94
-
95
- - name: Publication success
96
- if: steps.check-version.outputs.version-exists == 'false'
97
- run: |
98
- PACKAGE_NAME=$(node -p "require('./package.json').name")
99
- PACKAGE_VERSION=$(node -p "require('./package.json').version")
100
- echo "🎉 Successfully published $PACKAGE_NAME@$PACKAGE_VERSION to npm!"
101
- echo "📦 Package includes build.zip with the compiled application"
102
-
103
- - name: Skip publication
104
- if: steps.check-version.outputs.version-exists == 'true'
105
- run: |
106
- PACKAGE_VERSION=$(node -p "require('./package.json').version")
107
- echo "⏭️ Skipping publication - version $PACKAGE_VERSION already exists on npm"
108
- echo "💡 To publish a new version, update the version in package.json or run 'npm run release'"