gatsby-core-theme 30.0.115 → 30.0.116

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,15 @@
1
+ ## [30.0.116](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.115...v30.0.116) (2024-04-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add the option to translate newsletter per page ([bba0490](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/bba04906c05bc5c925fe3527f6dc1fb33e9783ab))
7
+ * add validation ([11e3141](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/11e3141bbf1011c62113c63eb9019c8477ad1e1e))
8
+ * fix translation per page ([646e777](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/646e777fac1967a0f7ba56aef5859e704fe73b19))
9
+
10
+
11
+ * Merge branch 'tm-4315-newsletter' into 'master' ([2e16682](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/2e166829a50958e78f226611711eed9df1b63c95))
12
+
1
13
  ## [30.0.115](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v30.0.114...v30.0.115) (2024-04-22)
2
14
 
3
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "30.0.115",
3
+ "version": "30.0.116",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -47,6 +47,7 @@ const ContactForm = ({
47
47
  successMessage={successMessage}
48
48
  failMessage={failMessage}
49
49
  validationMessage={validationMessage}
50
+ path={page?.path}
50
51
  />
51
52
  </div>
52
53
  </div>
@@ -59,6 +60,7 @@ export default ContactForm;
59
60
  ContactForm.propTypes = {
60
61
  page: PropTypes.shape({
61
62
  market: PropTypes.string,
63
+ path: PropTypes.string,
62
64
  }).isRequired,
63
65
  submitUrl: PropTypes.string,
64
66
  successMessage: PropTypes.string,
@@ -7,7 +7,14 @@ import { translate } from 'gatsby-core-theme/src/helpers/getters';
7
7
  import Form from '../../../organisms/form';
8
8
  import { newsLetterForm } from '../../../../constants/forms';
9
9
 
10
- const NewsletterForm = ({ handleApi, redirectUrl, submitText = 'Submit', market, setErr }) => {
10
+ const NewsletterForm = ({
11
+ handleApi,
12
+ redirectUrl,
13
+ submitText = 'Submit',
14
+ market,
15
+ setErr,
16
+ path,
17
+ }) => {
11
18
  const [ip, setIP] = useState('');
12
19
  const [error, setError] = useState(false);
13
20
  const { translations } = useContext(Context) || {};
@@ -81,6 +88,7 @@ const NewsletterForm = ({ handleApi, redirectUrl, submitText = 'Submit', market,
81
88
  customeSubmit={handelSubmit}
82
89
  customError
83
90
  buttonLabel={submitText}
91
+ path={path}
84
92
  />
85
93
  );
86
94
  };
@@ -90,6 +98,7 @@ NewsletterForm.propTypes = {
90
98
  submitText: PropTypes.string,
91
99
  market: PropTypes.string,
92
100
  setErr: PropTypes.bool,
101
+ path: PropTypes.string,
93
102
  };
94
103
 
95
104
  export default NewsletterForm;
@@ -48,7 +48,7 @@ const Newsletter = ({ page, openBtnText = 'Unlock Bonuses', isSticky = true }) =
48
48
  : `${styles?.form || ''} ${toggleNewsetter ? styles?.active || '' : ''}`
49
49
  }
50
50
  >
51
- <NewsletterForm market={page?.market} redirectUrl={redirectUrl} />
51
+ <NewsletterForm market={page?.market} path={page?.path} redirectUrl={redirectUrl} />
52
52
  {isSticky && (
53
53
  <MdClose
54
54
  className={styles?.closeBtn || ''}
@@ -21,6 +21,7 @@ const FormComponent = ({
21
21
  showLabels = true,
22
22
  customeSubmit = null,
23
23
  customError = false,
24
+ path = '',
24
25
  }) => {
25
26
  const { translations } = useContext(Context) || {};
26
27
  const recaptchaRef = useRef();
@@ -105,18 +106,27 @@ const FormComponent = ({
105
106
 
106
107
  // form not specified on constant
107
108
  if (!Object.keys(formOptions).length) return;
109
+
108
110
  return (
109
111
  <div className={`${styles.formComponent || ''} `}>
110
112
  {formOptions?.title && (
111
113
  <h2>
112
- {translate(translations, formOptions.title?.translationKey, formOptions.title?.label)}
114
+ {translate(
115
+ translations,
116
+ translations && translations[`${path}_${formOptions.title?.translationKey}`]
117
+ ? `${path}_${formOptions.title?.translationKey}`
118
+ : formOptions.title?.translationKey,
119
+ formOptions.title?.label
120
+ )}
113
121
  </h2>
114
122
  )}
115
123
  {formOptions?.description && (
116
124
  <p>
117
125
  {translate(
118
126
  translations,
119
- formOptions.description?.translationKey,
127
+ translations && translations[`${path}_${formOptions?.description?.translationKey}`]
128
+ ? `${path}_${formOptions?.description?.translationKey}`
129
+ : formOptions?.description?.translationKey,
120
130
  formOptions.description?.label
121
131
  )}
122
132
  </p>
@@ -216,5 +226,6 @@ FormComponent.propTypes = {
216
226
  showButtonIcon: PropTypes.bool,
217
227
  customError: PropTypes.bool,
218
228
  customeSubmit: PropTypes.func,
229
+ path: PropTypes.string,
219
230
  };
220
231
  export default FormComponent;
@@ -132,7 +132,7 @@ export const newsLetterForm = {
132
132
  options: [
133
133
  {
134
134
  label:
135
- 'By subscribing, you confirm that you are over 18 years of age and that you accept our. [link]',
135
+ 'By subscribing, you confirm [link] that you are over 18 years of age and that you accept our.[link] ',
136
136
  id: 'checkbox',
137
137
  type: 'checkbox',
138
138
  link: {
@@ -145,6 +145,18 @@ export const newsLetterForm = {
145
145
  },
146
146
  ],
147
147
  },
148
+ {
149
+ type: 'checkbox',
150
+ id: 'checkbox_1',
151
+ options: [
152
+ {
153
+ label: 'Test test ',
154
+ id: 'checkbox',
155
+ type: 'checkbox_1',
156
+ translationKey: 'newsletter_form_privacy_text_1',
157
+ },
158
+ ],
159
+ },
148
160
  ],
149
161
  },
150
162
  // 'ie_en': {