@qssolutions/ssas-registration-form 1.0.3 → 1.0.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SSASRegistrationForm.d.ts","sourceRoot":"","sources":["../../src/components/SSASRegistrationForm.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;AAY/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAWpD,eAAO,MAAM,WAAW;;;;;CAKvB,CAAA;AAED,UAAU,yBAAyB;IAC/B,MAAM,EAAE,iBAAiB,CAAA;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA4hB9D,CAAA"}
1
+ {"version":3,"file":"SSASRegistrationForm.d.ts","sourceRoot":"","sources":["../../src/components/SSASRegistrationForm.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;AAY/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAWpD,eAAO,MAAM,WAAW;;;;;CAKvB,CAAA;AAED,UAAU,yBAAyB;IAC/B,MAAM,EAAE,iBAAiB,CAAA;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA6hB9D,CAAA"}
package/dist/index.esm.js CHANGED
@@ -36,7 +36,7 @@ var FormType;
36
36
  })(FormType || (FormType = {}));
37
37
 
38
38
  const defaultConfig = {
39
- languageCode: 'en',
39
+ // languageCode: 'en',
40
40
  theme: {
41
41
  // primaryColor: '#006B83',
42
42
  backgroundColor: '#FCFCFF',
@@ -21292,7 +21292,9 @@ class ApiService {
21292
21292
  this.baseUrl = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
21293
21293
  }
21294
21294
  getUrl(path) {
21295
- return `${this.baseUrl}${path}`;
21295
+ const isLocalhost = this.baseUrl.includes("localhost");
21296
+ const apiPrefix = isLocalhost ? "" : "/api";
21297
+ return `${this.baseUrl}${apiPrefix}${path}`;
21296
21298
  }
21297
21299
  /**
21298
21300
  * Add a new user
@@ -21496,13 +21498,10 @@ class ApiService {
21496
21498
  }
21497
21499
  /**
21498
21500
  * Get localization data for FormScreen by language code and partner ID
21499
- * Prioritizes defaultLanguage if provided over languageCode
21500
21501
  */
21501
- async getFormScreenLocalization(languageCode, partnerId, defaultLanguage) {
21502
+ async getFormScreenLocalization(languageCode, partnerId) {
21502
21503
  try {
21503
- // Prioritize defaultLanguage if provided, otherwise use languageCode
21504
- const selectedLanguage = defaultLanguage || languageCode;
21505
- const response = await axios$1.get(this.getUrl(`${API_ENDPOINTS.GET_LOCALIZATION}/${selectedLanguage}/FormScreen/${partnerId}`));
21504
+ const response = await axios$1.get(this.getUrl(`${API_ENDPOINTS.GET_LOCALIZATION}/${languageCode}/FormScreen/${partnerId}`));
21506
21505
  if (response.data.isSuccess) {
21507
21506
  return response.data.data;
21508
21507
  }
@@ -22516,8 +22515,9 @@ const SSASRegistrationForm = ({ config, }) => {
22516
22515
  });
22517
22516
  // Load localization
22518
22517
  setIsLoadingLocalization(true);
22518
+ const selectedLanguage = mergedConfig.languageCode || partnerData.languageCode || "en";
22519
22519
  apiService
22520
- .getFormScreenLocalization(mergedConfig.languageCode || partnerData.languageCode || "en", partnerData.id, mergedConfig.languageCode || partnerData.languageCode)
22520
+ .getFormScreenLocalization(selectedLanguage, partnerData.id)
22521
22521
  .then((localization) => {
22522
22522
  setLocalizationData(localization);
22523
22523
  })
@@ -22527,7 +22527,7 @@ const SSASRegistrationForm = ({ config, }) => {
22527
22527
  .finally(() => {
22528
22528
  setIsLoadingLocalization(false);
22529
22529
  });
22530
- }, [apiService, partnerData]);
22530
+ }, [apiService, partnerData, mergedConfig.languageCode]);
22531
22531
  // Set Default Language based on Country (Australia = English only)
22532
22532
  const countryWatch = useWatch({ control, name: FormModel.Country });
22533
22533
  useEffect(() => {