gatsby-core-theme 44.3.1 → 44.4.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # [44.4.0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.3.1...v44.4.0) (2025-07-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * env file ([6140078](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/6140078d6a204672fa9b4e16676fbd23c954229d))
7
+ * revert core theme env file ([2bbe0c1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2bbe0c1e2b3b58796ada45e84300cd2e26caaca3))
8
+
9
+
10
+ * Merge branch 'tm-5584-newsletter-template-block' into 'master' ([a1c4dfd](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/a1c4dfd06b952bd2c46f6879740ea389d3c1f7bb))
11
+
12
+
13
+ ### Features
14
+
15
+ * generators as constants, icon on input field ([7492e94](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/7492e94627f28d3b59f7462d1f06dcd60a6e83b0))
16
+
1
17
  ## [44.3.1](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.3.0...v44.3.1) (2025-06-30)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.3.1",
3
+ "version": "44.4.0",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -5,47 +5,67 @@
5
5
  /* eslint-disable import/prefer-default-export */
6
6
  /* eslint-disable react/react-in-jsx-scope */
7
7
  /* eslint-disable no-undef */
8
- import React from 'react';
9
- import styles from './fields.module.scss';
10
- import { generatePlaceholderString } from '../../../../helpers/generators.mjs';
11
- import useTranslate from '~hooks/useTranslate/useTranslate';
8
+ import React from "react";
9
+ import styles from "~organisms/form/fields/fields.module.scss";
10
+ import { generatePlaceholderString } from "~helpers/generators.mjs";
11
+ import useTranslate from "~hooks/useTranslate/useTranslate";
12
12
 
13
13
  const getField = (field, handleChange, elements, state) => {
14
- const { type, id, translationKey, label, placeholder, ...props } = field;
14
+ const {
15
+ type,
16
+ id,
17
+ translationKey,
18
+ label,
19
+ placeholder,
20
+ icon = null,
21
+ ...props
22
+ } = field;
15
23
 
16
24
  switch (type) {
17
- case 'textarea':
25
+ case "textarea":
18
26
  return (
19
- <div className={styles.textareaGroup || ''}>
27
+ <div className={styles.textareaGroup || ""}>
20
28
  <textarea
21
29
  name={id}
22
30
  id={id}
23
- placeholder={useTranslate(placeholder?.translationKey, placeholder?.label)}
31
+ placeholder={useTranslate(
32
+ placeholder?.translationKey,
33
+ placeholder?.label
34
+ )}
24
35
  {...props}
25
36
  value={elements[id]}
26
37
  onChange={(e) => handleChange(e.target.name, e.target.value)}
27
- className={`${styles.textarea || ''} ${(!state.isValid && elements[id] === '' && styles.invalid) || ''}`}
38
+ className={`${
39
+ (!state.isValid && elements[id] === "" && styles.invalid) || ""
40
+ }`}
28
41
  />
29
- {field.maxLength && <span>{`${elements[id].length}/${field.maxLength}`}</span>}
42
+ {field.maxLength && (
43
+ <span>{`${elements[id].length}/${field.maxLength}`}</span>
44
+ )}
30
45
  </div>
31
46
  );
32
- case 'checkbox':
47
+ case "checkbox":
33
48
  return (
34
- <div className={styles.checkboxGroup || ''}>
49
+ <div className={styles.checkboxGroup || ""}>
35
50
  {field.options.map((option) => (
36
51
  <div key={option.id}>
37
52
  <input
38
53
  id={option.id}
39
54
  name={option.id}
40
55
  type={type}
41
- checked={elements[option.id] === 'true'}
42
- onChange={(e) => handleChange(e.target.name, e.target.checked.toString())}
56
+ checked={elements[option.id] === "true"}
57
+ onChange={(e) =>
58
+ handleChange(e.target.name, e.target.checked.toString())
59
+ }
43
60
  required={!!option?.required}
44
61
  />
45
62
  <label
46
63
  htmlFor={option.id}
47
- className={`${styles.checkboxLabel || ''} ${
48
- (!state.isValid && !elements[option.id].length && styles.invalid) || ''
64
+ className={`${
65
+ (!state.isValid &&
66
+ !elements[option.id].length &&
67
+ styles.invalid) ||
68
+ ""
49
69
  }`}
50
70
  dangerouslySetInnerHTML={{
51
71
  __html: generatePlaceholderString(
@@ -59,9 +79,9 @@ const getField = (field, handleChange, elements, state) => {
59
79
  ))}
60
80
  </div>
61
81
  );
62
- case 'radio':
82
+ case "radio":
63
83
  return (
64
- <div className={styles.radioGroup || ''}>
84
+ <div className={styles.radioGroup || ""}>
65
85
  {field.options.map((option) => (
66
86
  <div key={option.id}>
67
87
  <input
@@ -75,7 +95,10 @@ const getField = (field, handleChange, elements, state) => {
75
95
  <label
76
96
  key={option.id}
77
97
  htmlFor={option.id}
78
- className={`${styles.radioLabel || ''} ${(!state.isValid && elements[id] === '' && styles.invalid) || ''}`}
98
+ className={`${
99
+ (!state.isValid && elements[id] === "" && styles.invalid) ||
100
+ ""
101
+ }`}
79
102
  >
80
103
  {useTranslate(option.translationKey, option.label)}
81
104
  </label>
@@ -83,7 +106,7 @@ const getField = (field, handleChange, elements, state) => {
83
106
  ))}
84
107
  </div>
85
108
  );
86
- case 'select':
109
+ case "select":
87
110
  return (
88
111
  <select
89
112
  id={id}
@@ -91,7 +114,9 @@ const getField = (field, handleChange, elements, state) => {
91
114
  name={id}
92
115
  defaultValue={elements[id]}
93
116
  onChange={(e) => handleChange(e.target.name, e.target.value)}
94
- className={`${(!state.isValid && elements[id] === '' && styles.invalid) || ''}`}
117
+ className={`${
118
+ (!state.isValid && elements[id] === "" && styles.invalid) || ""
119
+ }`}
95
120
  >
96
121
  {field.showDefault && (
97
122
  <option value="">
@@ -105,9 +130,9 @@ const getField = (field, handleChange, elements, state) => {
105
130
  ))}
106
131
  </select>
107
132
  );
108
- case 'range':
133
+ case "range":
109
134
  return (
110
- <div className={styles.radioGroup || ''}>
135
+ <div className={styles.radioGroup || ""}>
111
136
  <input
112
137
  name={id}
113
138
  id={id}
@@ -117,31 +142,50 @@ const getField = (field, handleChange, elements, state) => {
117
142
  value={elements[id]}
118
143
  onChange={(e) => handleChange(e.target.name, e.target.value)}
119
144
  />
120
- <div className={styles.rangeValues || ''}>
145
+ <div className={styles.rangeValues || ""}>
121
146
  <span>{field.min}</span>
122
- <span className={`${(!state.isValid && elements[id] === '' && styles.invalid) || ''}`}>
123
- {elements[id] || 'Selected Value'}
147
+ <span
148
+ className={`${
149
+ (!state.isValid && elements[id] === "" && styles.invalid) || ""
150
+ }`}
151
+ >
152
+ {elements[id] || "Selected Value"}
124
153
  </span>
125
154
  <span>{field.max}</span>
126
155
  </div>
127
156
  </div>
128
157
  );
129
- default:
130
- return (
158
+ default: {
159
+ const inputElement = (
131
160
  <input
132
161
  name={id}
133
162
  id={id}
134
163
  type={type}
135
164
  aria-label={useTranslate(translationKey, label)}
136
165
  aria-describedby={id}
137
- placeholder={useTranslate(placeholder?.translationKey, placeholder?.label)}
166
+ placeholder={useTranslate(
167
+ placeholder?.translationKey,
168
+ placeholder?.label
169
+ )}
138
170
  {...props}
139
171
  value={elements[id]}
140
172
  onChange={(e) => handleChange(e.target.name, e.target.value)}
141
- className={`${styles.inputBox || ''} ${(!state.isValid && elements[id] === '' && styles.invalid) || ''}`}
173
+ className={`${styles.inputBox || ""} ${
174
+ (!state.isValid && elements[id] === "" && styles.invalid) || ""
175
+ }`}
142
176
  autoComplete={id}
143
177
  />
144
178
  );
179
+
180
+ return icon ? (
181
+ <div className={styles.inputGroup || ""}>
182
+ {icon}
183
+ {inputElement}
184
+ </div>
185
+ ) : (
186
+ inputElement
187
+ );
188
+ }
145
189
  }
146
190
  };
147
191
 
@@ -0,0 +1,29 @@
1
+ const generatorsPlaceholderRegex =
2
+ /\[MONTH\]|\[YEAR\]|\[currentyear\]|\[sitename\]|\[currentmonth\]|\[title\]|\[currentdate\]|\[operator_name]|\[link\]/gi;
3
+
4
+ const generatorsPlaceholderReplaceObject = (
5
+ data,
6
+ translations,
7
+ month,
8
+ day,
9
+ year
10
+ ) => ({
11
+ "[MONTH]": (translations && translations[month]) || month,
12
+ "[YEAR]": year,
13
+ "[currentdate]": `${
14
+ (translations && translations[month]) || month
15
+ } ${day}, ${year}`,
16
+ "[currentmonth]": (translations && translations[month]) || month,
17
+ "[currentyear]": year,
18
+ "[sitename]": (data && data.siteName) || "",
19
+ "[title]": (data && data.pageTitle) || "",
20
+ "[operator_name]": (data && data.name) || "",
21
+ "[link]": `<a href=${data?.url}>${
22
+ translations?.link_checkbox || data?.text
23
+ } </a>`,
24
+ });
25
+
26
+ export default {
27
+ generatorsPlaceholderRegex,
28
+ generatorsPlaceholderReplaceObject,
29
+ };
@@ -1,4 +1,5 @@
1
- import { months } from '../constants/common.mjs';
1
+ import { months } from "../constants/common.mjs";
2
+ import generatorsConstant from "../constants/generators.mjs";
2
3
 
3
4
  export function generateTrackerLink(operator, trackerType, provider = false) {
4
5
  let defaultTrackerFormat = provider
@@ -9,59 +10,58 @@ export function generateTrackerLink(operator, trackerType, provider = false) {
9
10
  : process.env.TRACKER_LINK_FORMAT_NON_MAIN;
10
11
 
11
12
  if (defaultTrackerFormat && trackerFormat) {
12
- if (operator.type === 'casino') {
13
- defaultTrackerFormat = defaultTrackerFormat.replace('type,', '');
14
- trackerFormat = trackerFormat.replace('type,', '');
13
+ if (operator.type === "casino") {
14
+ defaultTrackerFormat = defaultTrackerFormat.replace("type,", "");
15
+ trackerFormat = trackerFormat.replace("type,", "");
15
16
  }
16
17
  const linkFormatArray =
17
- trackerType === 'main' ? defaultTrackerFormat.split(',') : trackerFormat.split(',');
18
+ trackerType === "main"
19
+ ? defaultTrackerFormat.split(",")
20
+ : trackerFormat.split(",");
18
21
 
19
22
  const trackerArr = linkFormatArray.map((item) => {
20
23
  const customSection = item.match(/\[(.*)\]/);
21
24
  if (customSection) {
22
25
  const sectionName = customSection.pop();
23
- return sectionName === 'tracker' ? trackerType : sectionName;
26
+ return sectionName === "tracker" ? trackerType : sectionName;
24
27
  }
25
28
 
26
- if(item === 'country') {
27
- const markets = operator.market.split('_');
28
- if(markets.length === 2) {
29
+ if (item === "country") {
30
+ const markets = operator.market.split("_");
31
+ if (markets.length === 2) {
29
32
  return markets[0];
30
33
  }
31
34
  }
32
-
35
+
33
36
  return operator[item];
34
37
  });
35
38
 
36
- return `/${trackerArr.join('/')}${process.env.TRAILING_SLASH ? '/' : ''}`;
39
+ return `/${trackerArr.join("/")}${process.env.TRAILING_SLASH ? "/" : ""}`;
37
40
  }
38
41
  }
39
42
 
40
- export function generatePlaceholderString(string = '', translations, data) {
43
+ export function generatePlaceholderString(string = "", translations, data) {
41
44
  const date = new Date();
42
45
  const day = date.getDate();
43
46
  const month = months[date.getMonth()];
44
47
  const year = date.getFullYear();
45
- const regex =
46
- /\[MONTH\]|\[YEAR\]|\[currentyear\]|\[sitename\]|\[currentmonth\]|\[title\]|\[currentdate\]|\[operator_name]|\[link\]/gi;
48
+ const regex = generatorsConstant.generatorsPlaceholderRegex;
47
49
 
48
50
  return string.replace(
49
51
  regex,
50
52
  (match) =>
51
- ({
52
- '[MONTH]': (translations && translations[month]) || month,
53
- '[YEAR]': year,
54
- '[currentdate]': `${(translations && translations[month]) || month} ${day}, ${year}`,
55
- '[currentmonth]': (translations && translations[month]) || month,
56
- '[currentyear]': year,
57
- '[sitename]': (data && data.siteName) || '',
58
- '[title]': (data && data.pageTitle) || '',
59
- '[operator_name]': (data && data.name) || '',
60
- '[link]': `<a href=${data?.url}>${translations?.link_checkbox || data?.text} </a>`
61
- }[match])
53
+ generatorsConstant.generatorsPlaceholderReplaceObject(
54
+ data,
55
+ translations,
56
+ month,
57
+ day,
58
+ year
59
+ )[match]
62
60
  );
63
61
  }
64
62
 
65
63
  export function generateArray(obj) {
66
- return obj !== null && obj !== undefined ? Object.keys(obj).map((key) => obj[key]) : [];
64
+ return obj !== null && obj !== undefined
65
+ ? Object.keys(obj).map((key) => obj[key])
66
+ : [];
67
67
  }