@gudhub/ssg-web-components-library 1.0.41 → 1.0.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gudhub/ssg-web-components-library",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -15,7 +15,7 @@ class BreadcrumbsComponent extends GHComponent {
15
15
  console.error(error);
16
16
  }
17
17
  } else {
18
- this.breadcrumbsConfig = window.getConfig().componentsConfigs.breadcrumbsConfig;
18
+ this.breadcrumbsConfig = window.getConfig()?.componentsConfigs?.breadcrumbsConfig || window.getConfig()?.breadcrumbsConfig;
19
19
  this.initialRoute = this.breadcrumbsConfig[0].routesTree;
20
20
 
21
21
  let currentUrl = new URL(window.location.href);
@@ -53,7 +53,7 @@
53
53
  ${addressIcon}
54
54
  </div>
55
55
  <div class="flex-wrapper">
56
- <h3>Adress:</h3>
56
+ <h3>Address:</h3>
57
57
  <span>${info.fullAddress}</span>
58
58
  </div>
59
59
  </a>
@@ -126,12 +126,7 @@ class EditMode extends GHComponent {
126
126
  }
127
127
  let ids = await self.findIds();
128
128
 
129
- let currentChapter;
130
- if (document.querySelector('html').hasAttribute('data-current-chapter')) {
131
- currentChapter = document.querySelector('html').getAttribute('data-current-chapter');
132
- } else {
133
- currentChapter = 'pages';
134
- }
129
+ const currentChapter = window?.constants?.currentChapter || 'pages';
135
130
 
136
131
  const data = await gudhub.getDocument({app_id: ids.appId, item_id: ids.itemId, element_id: document.querySelector('html').getAttribute(`data-${currentChapter}-json_field_id`)});
137
132
  const json = JSON.parse(data.data);
@@ -14,7 +14,7 @@ class GetInTouchForm extends GHComponent {
14
14
  this.isFormSubmitted = false;
15
15
 
16
16
  this.placement = 'main';
17
- this.config = window.getConfig().componentsConfigs.formConfig;
17
+ this.config = window.getConfig()?.componentsConfigs?.formConfig || window.getConfig()?.formConfig;
18
18
  }
19
19
 
20
20
  onServerRender() {
@@ -40,9 +40,9 @@ const emailValidation = (input) => {
40
40
  const phoneValidation = (input) => {
41
41
  // const regex = /^\d{10}$/; // Default strict regex for checking phone number
42
42
 
43
- // let isValid = regex.test(input.value);
43
+ const regex = /^\+?\d+$/; // We can write only numbers without special symbols besides "+" sign
44
44
 
45
- let isValid = /^\+?\d+$/; // We can write only numbers without special symbols besides "+" sign
45
+ let isValid = regex.test(input.value);
46
46
 
47
47
  if (!isValid) {
48
48
  input.classList.add('error');