@procore/ai-translations 0.6.1 → 0.6.2
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/README.md +1 -0
- package/dist/legacy/index.d.mts +3 -1
- package/dist/legacy/index.d.ts +3 -1
- package/dist/legacy/index.js +8 -1
- package/dist/legacy/index.mjs +7 -1
- package/dist/modern/index.d.mts +3 -1
- package/dist/modern/index.d.ts +3 -1
- package/dist/modern/index.js +8 -1
- package/dist/modern/index.mjs +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,7 @@ type ToolConfig = {
|
|
|
144
144
|
- Frontend strategy depends on Chrome-family AI support; behavior differs by browser support.
|
|
145
145
|
- Backend/config endpoints are resolved from `window.location.origin` under `/rest/`.
|
|
146
146
|
- Translation cache uses IndexedDB; some restricted browser environments may limit persistence.
|
|
147
|
+
- For error handling behavior and failure modes, see [`docs/error-handling.md`](./docs/error-handling.md).
|
|
147
148
|
|
|
148
149
|
## Development
|
|
149
150
|
|
package/dist/legacy/index.d.mts
CHANGED
|
@@ -209,6 +209,8 @@ interface UseAIAnalyticsReturn {
|
|
|
209
209
|
*/
|
|
210
210
|
declare function useAIAnalytics(): UseAIAnalyticsReturn;
|
|
211
211
|
|
|
212
|
+
declare function isSupportedBrowser(): boolean;
|
|
213
|
+
|
|
212
214
|
interface AITranslationProviderProps {
|
|
213
215
|
children: ReactNode;
|
|
214
216
|
locale: string;
|
|
@@ -279,4 +281,4 @@ declare global {
|
|
|
279
281
|
var _BACKEND_AI_TRANSLATION_IN_PROGRESS_: boolean;
|
|
280
282
|
}
|
|
281
283
|
|
|
282
|
-
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, useAIAnalytics, useAITranslation, useConfig };
|
|
284
|
+
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, isSupportedBrowser, useAIAnalytics, useAITranslation, useConfig };
|
package/dist/legacy/index.d.ts
CHANGED
|
@@ -209,6 +209,8 @@ interface UseAIAnalyticsReturn {
|
|
|
209
209
|
*/
|
|
210
210
|
declare function useAIAnalytics(): UseAIAnalyticsReturn;
|
|
211
211
|
|
|
212
|
+
declare function isSupportedBrowser(): boolean;
|
|
213
|
+
|
|
212
214
|
interface AITranslationProviderProps {
|
|
213
215
|
children: ReactNode;
|
|
214
216
|
locale: string;
|
|
@@ -279,4 +281,4 @@ declare global {
|
|
|
279
281
|
var _BACKEND_AI_TRANSLATION_IN_PROGRESS_: boolean;
|
|
280
282
|
}
|
|
281
283
|
|
|
282
|
-
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, useAIAnalytics, useAITranslation, useConfig };
|
|
284
|
+
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, isSupportedBrowser, useAIAnalytics, useAITranslation, useConfig };
|
package/dist/legacy/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
buildEventKey: () => buildEventKey,
|
|
32
32
|
buildObject: () => buildObject,
|
|
33
33
|
getAITranslationLDId: () => getAITranslationLDId,
|
|
34
|
+
isSupportedBrowser: () => isSupportedBrowser,
|
|
34
35
|
useAIAnalytics: () => useAIAnalytics,
|
|
35
36
|
useAITranslation: () => useAITranslation,
|
|
36
37
|
useConfig: () => useConfig
|
|
@@ -1455,6 +1456,7 @@ var aitFunction = async (text, translationRegistry, config2, tool) => {
|
|
|
1455
1456
|
};
|
|
1456
1457
|
|
|
1457
1458
|
// src/utils/browser.ts
|
|
1459
|
+
var supportedBrowsers = ["chrome", "arc", "opera"];
|
|
1458
1460
|
function detectBrowser() {
|
|
1459
1461
|
const ua = navigator.userAgent;
|
|
1460
1462
|
if (ua.includes("Arc/")) return "arc";
|
|
@@ -1465,6 +1467,10 @@ function detectBrowser() {
|
|
|
1465
1467
|
if (ua.includes("Chrome/")) return "chrome";
|
|
1466
1468
|
return "unknown";
|
|
1467
1469
|
}
|
|
1470
|
+
function isSupportedBrowser() {
|
|
1471
|
+
const browser = detectBrowser();
|
|
1472
|
+
return supportedBrowsers.includes(browser);
|
|
1473
|
+
}
|
|
1468
1474
|
|
|
1469
1475
|
// src/Provider.tsx
|
|
1470
1476
|
var import_react_query2 = require("@tanstack/react-query");
|
|
@@ -1742,7 +1748,7 @@ var TranslatedIcon = ({
|
|
|
1742
1748
|
"path",
|
|
1743
1749
|
{
|
|
1744
1750
|
fill: color,
|
|
1745
|
-
d: "
|
|
1751
|
+
d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.79 4.21 10.21L9 15V16C9 17.1 9.9 18 11 18V19.93ZM17.9 17.39C17.64 16.58 16.9 16 16 16H15V13C15 12.45 14.55 12 14 12H8V10H10C10.55 10 11 9.55 11 9V7H13C14.1 7 15 6.1 15 5V4.59C17.93 5.78 20 8.65 20 12C20 14.08 19.2 15.97 17.9 17.39Z"
|
|
1746
1752
|
}
|
|
1747
1753
|
)
|
|
1748
1754
|
}
|
|
@@ -1848,6 +1854,7 @@ var getAITranslationLDId = (domain) => {
|
|
|
1848
1854
|
buildEventKey,
|
|
1849
1855
|
buildObject,
|
|
1850
1856
|
getAITranslationLDId,
|
|
1857
|
+
isSupportedBrowser,
|
|
1851
1858
|
useAIAnalytics,
|
|
1852
1859
|
useAITranslation,
|
|
1853
1860
|
useConfig
|
package/dist/legacy/index.mjs
CHANGED
|
@@ -1426,6 +1426,7 @@ var aitFunction = async (text, translationRegistry, config2, tool) => {
|
|
|
1426
1426
|
};
|
|
1427
1427
|
|
|
1428
1428
|
// src/utils/browser.ts
|
|
1429
|
+
var supportedBrowsers = ["chrome", "arc", "opera"];
|
|
1429
1430
|
function detectBrowser() {
|
|
1430
1431
|
const ua = navigator.userAgent;
|
|
1431
1432
|
if (ua.includes("Arc/")) return "arc";
|
|
@@ -1436,6 +1437,10 @@ function detectBrowser() {
|
|
|
1436
1437
|
if (ua.includes("Chrome/")) return "chrome";
|
|
1437
1438
|
return "unknown";
|
|
1438
1439
|
}
|
|
1440
|
+
function isSupportedBrowser() {
|
|
1441
|
+
const browser = detectBrowser();
|
|
1442
|
+
return supportedBrowsers.includes(browser);
|
|
1443
|
+
}
|
|
1439
1444
|
|
|
1440
1445
|
// src/Provider.tsx
|
|
1441
1446
|
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
@@ -1719,7 +1724,7 @@ var TranslatedIcon = ({
|
|
|
1719
1724
|
"path",
|
|
1720
1725
|
{
|
|
1721
1726
|
fill: color,
|
|
1722
|
-
d: "
|
|
1727
|
+
d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.79 4.21 10.21L9 15V16C9 17.1 9.9 18 11 18V19.93ZM17.9 17.39C17.64 16.58 16.9 16 16 16H15V13C15 12.45 14.55 12 14 12H8V10H10C10.55 10 11 9.55 11 9V7H13C14.1 7 15 6.1 15 5V4.59C17.93 5.78 20 8.65 20 12C20 14.08 19.2 15.97 17.9 17.39Z"
|
|
1723
1728
|
}
|
|
1724
1729
|
)
|
|
1725
1730
|
}
|
|
@@ -1824,6 +1829,7 @@ export {
|
|
|
1824
1829
|
buildEventKey,
|
|
1825
1830
|
buildObject,
|
|
1826
1831
|
getAITranslationLDId,
|
|
1832
|
+
isSupportedBrowser,
|
|
1827
1833
|
useAIAnalytics,
|
|
1828
1834
|
useAITranslation,
|
|
1829
1835
|
useConfig
|
package/dist/modern/index.d.mts
CHANGED
|
@@ -209,6 +209,8 @@ interface UseAIAnalyticsReturn {
|
|
|
209
209
|
*/
|
|
210
210
|
declare function useAIAnalytics(): UseAIAnalyticsReturn;
|
|
211
211
|
|
|
212
|
+
declare function isSupportedBrowser(): boolean;
|
|
213
|
+
|
|
212
214
|
interface AITranslationProviderProps {
|
|
213
215
|
children: ReactNode;
|
|
214
216
|
locale: string;
|
|
@@ -279,4 +281,4 @@ declare global {
|
|
|
279
281
|
var _BACKEND_AI_TRANSLATION_IN_PROGRESS_: boolean;
|
|
280
282
|
}
|
|
281
283
|
|
|
282
|
-
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, useAIAnalytics, useAITranslation, useConfig };
|
|
284
|
+
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, isSupportedBrowser, useAIAnalytics, useAITranslation, useConfig };
|
package/dist/modern/index.d.ts
CHANGED
|
@@ -209,6 +209,8 @@ interface UseAIAnalyticsReturn {
|
|
|
209
209
|
*/
|
|
210
210
|
declare function useAIAnalytics(): UseAIAnalyticsReturn;
|
|
211
211
|
|
|
212
|
+
declare function isSupportedBrowser(): boolean;
|
|
213
|
+
|
|
212
214
|
interface AITranslationProviderProps {
|
|
213
215
|
children: ReactNode;
|
|
214
216
|
locale: string;
|
|
@@ -279,4 +281,4 @@ declare global {
|
|
|
279
281
|
var _BACKEND_AI_TRANSLATION_IN_PROGRESS_: boolean;
|
|
280
282
|
}
|
|
281
283
|
|
|
282
|
-
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, useAIAnalytics, useAITranslation, useConfig };
|
|
284
|
+
export { ACTION, type AIAnalyticsEventProperties, type AIAnalyticsTracker, AITranslateText, type AITranslateTextProps, AITranslationProvider, AI_TRANSLATION_FEATURE_FLAG_KEY, type Action, type AnalyticEvent, BUTTON_TYPE, type BuildAnalyticEventParams, type ButtonType, type EventKeyParts, type Scope, type TranslatedIconProps, type UseAIAnalyticsReturn, type UseConfigOptions, buildAnalyticEvent, buildEventKey, buildObject, getAITranslationLDId, isSupportedBrowser, useAIAnalytics, useAITranslation, useConfig };
|
package/dist/modern/index.js
CHANGED
|
@@ -29,6 +29,7 @@ __export(index_exports, {
|
|
|
29
29
|
buildEventKey: () => buildEventKey,
|
|
30
30
|
buildObject: () => buildObject,
|
|
31
31
|
getAITranslationLDId: () => getAITranslationLDId,
|
|
32
|
+
isSupportedBrowser: () => isSupportedBrowser,
|
|
32
33
|
useAIAnalytics: () => useAIAnalytics,
|
|
33
34
|
useAITranslation: () => useAITranslation,
|
|
34
35
|
useConfig: () => useConfig
|
|
@@ -1432,6 +1433,7 @@ var aitFunction = async (text, translationRegistry, config2, tool) => {
|
|
|
1432
1433
|
};
|
|
1433
1434
|
|
|
1434
1435
|
// src/utils/browser.ts
|
|
1436
|
+
var supportedBrowsers = ["chrome", "arc", "opera"];
|
|
1435
1437
|
function detectBrowser() {
|
|
1436
1438
|
const ua = navigator.userAgent;
|
|
1437
1439
|
if (ua.includes("Arc/")) return "arc";
|
|
@@ -1442,6 +1444,10 @@ function detectBrowser() {
|
|
|
1442
1444
|
if (ua.includes("Chrome/")) return "chrome";
|
|
1443
1445
|
return "unknown";
|
|
1444
1446
|
}
|
|
1447
|
+
function isSupportedBrowser() {
|
|
1448
|
+
const browser = detectBrowser();
|
|
1449
|
+
return supportedBrowsers.includes(browser);
|
|
1450
|
+
}
|
|
1445
1451
|
|
|
1446
1452
|
// src/Provider.tsx
|
|
1447
1453
|
var import_react_query2 = require("@tanstack/react-query");
|
|
@@ -1719,7 +1725,7 @@ var TranslatedIcon = ({
|
|
|
1719
1725
|
"path",
|
|
1720
1726
|
{
|
|
1721
1727
|
fill: color,
|
|
1722
|
-
d: "
|
|
1728
|
+
d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.79 4.21 10.21L9 15V16C9 17.1 9.9 18 11 18V19.93ZM17.9 17.39C17.64 16.58 16.9 16 16 16H15V13C15 12.45 14.55 12 14 12H8V10H10C10.55 10 11 9.55 11 9V7H13C14.1 7 15 6.1 15 5V4.59C17.93 5.78 20 8.65 20 12C20 14.08 19.2 15.97 17.9 17.39Z"
|
|
1723
1729
|
}
|
|
1724
1730
|
)
|
|
1725
1731
|
}
|
|
@@ -1825,6 +1831,7 @@ var getAITranslationLDId = (domain) => {
|
|
|
1825
1831
|
buildEventKey,
|
|
1826
1832
|
buildObject,
|
|
1827
1833
|
getAITranslationLDId,
|
|
1834
|
+
isSupportedBrowser,
|
|
1828
1835
|
useAIAnalytics,
|
|
1829
1836
|
useAITranslation,
|
|
1830
1837
|
useConfig
|
package/dist/modern/index.mjs
CHANGED
|
@@ -1401,6 +1401,7 @@ var aitFunction = async (text, translationRegistry, config2, tool) => {
|
|
|
1401
1401
|
};
|
|
1402
1402
|
|
|
1403
1403
|
// src/utils/browser.ts
|
|
1404
|
+
var supportedBrowsers = ["chrome", "arc", "opera"];
|
|
1404
1405
|
function detectBrowser() {
|
|
1405
1406
|
const ua = navigator.userAgent;
|
|
1406
1407
|
if (ua.includes("Arc/")) return "arc";
|
|
@@ -1411,6 +1412,10 @@ function detectBrowser() {
|
|
|
1411
1412
|
if (ua.includes("Chrome/")) return "chrome";
|
|
1412
1413
|
return "unknown";
|
|
1413
1414
|
}
|
|
1415
|
+
function isSupportedBrowser() {
|
|
1416
|
+
const browser = detectBrowser();
|
|
1417
|
+
return supportedBrowsers.includes(browser);
|
|
1418
|
+
}
|
|
1414
1419
|
|
|
1415
1420
|
// src/Provider.tsx
|
|
1416
1421
|
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
@@ -1694,7 +1699,7 @@ var TranslatedIcon = ({
|
|
|
1694
1699
|
"path",
|
|
1695
1700
|
{
|
|
1696
1701
|
fill: color,
|
|
1697
|
-
d: "
|
|
1702
|
+
d: "M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM11 19.93C7.05 19.44 4 16.08 4 12C4 11.38 4.08 10.79 4.21 10.21L9 15V16C9 17.1 9.9 18 11 18V19.93ZM17.9 17.39C17.64 16.58 16.9 16 16 16H15V13C15 12.45 14.55 12 14 12H8V10H10C10.55 10 11 9.55 11 9V7H13C14.1 7 15 6.1 15 5V4.59C17.93 5.78 20 8.65 20 12C20 14.08 19.2 15.97 17.9 17.39Z"
|
|
1698
1703
|
}
|
|
1699
1704
|
)
|
|
1700
1705
|
}
|
|
@@ -1799,6 +1804,7 @@ export {
|
|
|
1799
1804
|
buildEventKey,
|
|
1800
1805
|
buildObject,
|
|
1801
1806
|
getAITranslationLDId,
|
|
1807
|
+
isSupportedBrowser,
|
|
1802
1808
|
useAIAnalytics,
|
|
1803
1809
|
useAITranslation,
|
|
1804
1810
|
useConfig
|
package/package.json
CHANGED