@procore/ai-translations 0.8.0 → 0.8.1

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.
@@ -320,7 +320,7 @@ declare const CustomizableAITranslateText: React.FC<CustomizableAITranslateTextP
320
320
  /**
321
321
  * The key used to store/retrieve the feature flag in local storage.
322
322
  */
323
- declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
323
+ declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
324
324
  /**
325
325
  * Retrieves the LD ID for the AI translation feature flag based on the domain.
326
326
  * @param domain - The domain to determine the LD ID for
@@ -320,7 +320,7 @@ declare const CustomizableAITranslateText: React.FC<CustomizableAITranslateTextP
320
320
  /**
321
321
  * The key used to store/retrieve the feature flag in local storage.
322
322
  */
323
- declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
323
+ declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
324
324
  /**
325
325
  * Retrieves the LD ID for the AI translation feature flag based on the domain.
326
326
  * @param domain - The domain to determine the LD ID for
@@ -1265,12 +1265,13 @@ var _ChromeTranslator = class _ChromeTranslator {
1265
1265
  };
1266
1266
  } catch (error) {
1267
1267
  const message = error instanceof Error ? error.message : "Unknown error";
1268
+ const isPermanentFailure = error instanceof DOMException && error.name === "NotSupportedError";
1268
1269
  return {
1269
1270
  translation: text,
1270
1271
  sourceLanguage: targetLanguage,
1271
1272
  success: false,
1272
1273
  errorMessage: message,
1273
- retryable: true
1274
+ retryable: !isPermanentFailure
1274
1275
  };
1275
1276
  }
1276
1277
  }
@@ -1922,7 +1923,7 @@ var CustomizableAITranslateText = ({
1922
1923
 
1923
1924
  // src/utils/featureFlag.ts
1924
1925
  var import_web_sdk_mfe_utils = require("@procore/web-sdk-mfe-utils");
1925
- var AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
1926
+ var AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
1926
1927
  var getAITranslationLDId = (domain) => {
1927
1928
  const { environment, zone } = (0, import_web_sdk_mfe_utils.getProcoreZone)(domain);
1928
1929
  if ((0, import_web_sdk_mfe_utils.isFederalZone)(zone)) {
@@ -1224,12 +1224,13 @@ var _ChromeTranslator = class _ChromeTranslator {
1224
1224
  };
1225
1225
  } catch (error) {
1226
1226
  const message = error instanceof Error ? error.message : "Unknown error";
1227
+ const isPermanentFailure = error instanceof DOMException && error.name === "NotSupportedError";
1227
1228
  return {
1228
1229
  translation: text,
1229
1230
  sourceLanguage: targetLanguage,
1230
1231
  success: false,
1231
1232
  errorMessage: message,
1232
- retryable: true
1233
+ retryable: !isPermanentFailure
1233
1234
  };
1234
1235
  }
1235
1236
  }
@@ -1887,7 +1888,7 @@ var CustomizableAITranslateText = ({
1887
1888
 
1888
1889
  // src/utils/featureFlag.ts
1889
1890
  import { isFederalZone, getProcoreZone } from "@procore/web-sdk-mfe-utils";
1890
- var AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
1891
+ var AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
1891
1892
  var getAITranslationLDId = (domain) => {
1892
1893
  const { environment, zone } = getProcoreZone(domain);
1893
1894
  if (isFederalZone(zone)) {
@@ -320,7 +320,7 @@ declare const CustomizableAITranslateText: React.FC<CustomizableAITranslateTextP
320
320
  /**
321
321
  * The key used to store/retrieve the feature flag in local storage.
322
322
  */
323
- declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
323
+ declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
324
324
  /**
325
325
  * Retrieves the LD ID for the AI translation feature flag based on the domain.
326
326
  * @param domain - The domain to determine the LD ID for
@@ -320,7 +320,7 @@ declare const CustomizableAITranslateText: React.FC<CustomizableAITranslateTextP
320
320
  /**
321
321
  * The key used to store/retrieve the feature flag in local storage.
322
322
  */
323
- declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
323
+ declare const AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
324
324
  /**
325
325
  * Retrieves the LD ID for the AI translation feature flag based on the domain.
326
326
  * @param domain - The domain to determine the LD ID for
@@ -1244,12 +1244,13 @@ var ChromeTranslator = class _ChromeTranslator {
1244
1244
  };
1245
1245
  } catch (error) {
1246
1246
  const message = error instanceof Error ? error.message : "Unknown error";
1247
+ const isPermanentFailure = error instanceof DOMException && error.name === "NotSupportedError";
1247
1248
  return {
1248
1249
  translation: text,
1249
1250
  sourceLanguage: targetLanguage,
1250
1251
  success: false,
1251
1252
  errorMessage: message,
1252
- retryable: true
1253
+ retryable: !isPermanentFailure
1253
1254
  };
1254
1255
  }
1255
1256
  }
@@ -1899,7 +1900,7 @@ var CustomizableAITranslateText = ({
1899
1900
 
1900
1901
  // src/utils/featureFlag.ts
1901
1902
  var import_web_sdk_mfe_utils = require("@procore/web-sdk-mfe-utils");
1902
- var AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
1903
+ var AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
1903
1904
  var getAITranslationLDId = (domain) => {
1904
1905
  const { environment, zone } = (0, import_web_sdk_mfe_utils.getProcoreZone)(domain);
1905
1906
  if ((0, import_web_sdk_mfe_utils.isFederalZone)(zone)) {
@@ -1201,12 +1201,13 @@ var ChromeTranslator = class _ChromeTranslator {
1201
1201
  };
1202
1202
  } catch (error) {
1203
1203
  const message = error instanceof Error ? error.message : "Unknown error";
1204
+ const isPermanentFailure = error instanceof DOMException && error.name === "NotSupportedError";
1204
1205
  return {
1205
1206
  translation: text,
1206
1207
  sourceLanguage: targetLanguage,
1207
1208
  success: false,
1208
1209
  errorMessage: message,
1209
- retryable: true
1210
+ retryable: !isPermanentFailure
1210
1211
  };
1211
1212
  }
1212
1213
  }
@@ -1862,7 +1863,7 @@ var CustomizableAITranslateText = ({
1862
1863
 
1863
1864
  // src/utils/featureFlag.ts
1864
1865
  import { isFederalZone, getProcoreZone } from "@procore/web-sdk-mfe-utils";
1865
- var AI_TRANSLATION_FEATURE_FLAG_KEY = "pe_ai_translations_web_program_visible";
1866
+ var AI_TRANSLATION_FEATURE_FLAG_KEY = "ai-translation";
1866
1867
  var getAITranslationLDId = (domain) => {
1867
1868
  const { environment, zone } = getProcoreZone(domain);
1868
1869
  if (isFederalZone(zone)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/ai-translations",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Library that provides a solution to use AI to translate text into a language",
5
5
  "main": "dist/legacy/index.js",
6
6
  "types": "dist/legacy/index.d.ts",