@workos-inc/widgets 1.19.0-next.1790711729944 → 1.19.0-next.1790711846478
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,6 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.19.0-next.
|
|
3
|
+
## 1.19.0-next.1790711846478
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
- Sync generated API from upstream schema.
|
|
14
14
|
|
|
15
|
-
- Fix a React missing `key` warning when a translated message interpolates elements.
|
|
16
|
-
|
|
17
15
|
## 1.18.0
|
|
18
16
|
|
|
19
17
|
### Minor Changes
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
8
|
for (var name in all)
|
|
@@ -18,34 +16,29 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var translation_exports = {};
|
|
31
21
|
__export(translation_exports, {
|
|
32
22
|
Translation: () => Translation
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(translation_exports);
|
|
35
|
-
var
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
26
|
var import_intl_context = require("./intl-context.js");
|
|
37
27
|
const Translation = (props) => {
|
|
38
28
|
const { defaultMessage, id, description, trailingSpace, values } = props;
|
|
39
29
|
const i18n = (0, import_intl_context.useIntl)();
|
|
40
30
|
if (i18n) {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
const str = i18n.formatMessage({ id, defaultMessage, description }, values);
|
|
32
|
+
return trailingSpace ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
33
|
+
str,
|
|
34
|
+
" "
|
|
35
|
+
] }) : str;
|
|
46
36
|
}
|
|
47
37
|
if (!values) {
|
|
48
|
-
return
|
|
38
|
+
return trailingSpace ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
39
|
+
defaultMessage,
|
|
40
|
+
" "
|
|
41
|
+
] }) : defaultMessage;
|
|
49
42
|
}
|
|
50
43
|
const parts = [];
|
|
51
44
|
let lastIndex = 0;
|
|
@@ -62,17 +55,11 @@ const Translation = (props) => {
|
|
|
62
55
|
if (lastIndex < defaultMessage.length) {
|
|
63
56
|
parts.push(defaultMessage.substring(lastIndex));
|
|
64
57
|
}
|
|
65
|
-
return
|
|
58
|
+
return trailingSpace ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
59
|
+
parts,
|
|
60
|
+
" "
|
|
61
|
+
] }) : parts;
|
|
66
62
|
};
|
|
67
|
-
function renderMessage(message, trailingSpace) {
|
|
68
|
-
const parts = Array.isArray(message) ? message : [message];
|
|
69
|
-
return React.createElement(
|
|
70
|
-
React.Fragment,
|
|
71
|
-
null,
|
|
72
|
-
...parts,
|
|
73
|
-
trailingSpace ? " " : null
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
77
64
|
0 && (module.exports = {
|
|
78
65
|
Translation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/i18n/translation.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n useIntl,\n type MessageDescriptor,\n type MessageValues,\n} from \"./intl-context.js\";\n\ntype TranslationProps = MessageDescriptor & {\n trailingSpace?: boolean;\n values?: MessageValues;\n};\n\n/**\n * Translation component that gracefully degrades when no I18nProvider is present.\n *\n * - With I18nProvider: Uses react-intl for full i18n support (react-intl will be bundled)\n * - Without I18nProvider: Renders the defaultMessage with simple value interpolation (no react-intl bundled)\n */\nexport const Translation: React.FC<TranslationProps> = (props) => {\n const { defaultMessage, id, description, trailingSpace, values } = props;\n const i18n = useIntl();\n\n // If I18nProvider is present, use react-intl's formatting\n if (i18n) {\n const
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/i18n/translation.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n useIntl,\n type MessageDescriptor,\n type MessageValues,\n} from \"./intl-context.js\";\n\ntype TranslationProps = MessageDescriptor & {\n trailingSpace?: boolean;\n values?: MessageValues;\n};\n\n/**\n * Translation component that gracefully degrades when no I18nProvider is present.\n *\n * - With I18nProvider: Uses react-intl for full i18n support (react-intl will be bundled)\n * - Without I18nProvider: Renders the defaultMessage with simple value interpolation (no react-intl bundled)\n */\nexport const Translation: React.FC<TranslationProps> = (props) => {\n const { defaultMessage, id, description, trailingSpace, values } = props;\n const i18n = useIntl();\n\n // If I18nProvider is present, use react-intl's formatting\n if (i18n) {\n const str = i18n.formatMessage({ id, defaultMessage, description }, values);\n return trailingSpace ? <>{str} </> : str;\n }\n\n // If no I18nProvider is present, render the defaultMessage with simple interpolation\n if (!values) {\n return trailingSpace ? <>{defaultMessage} </> : defaultMessage;\n }\n\n // Simple interpolation: split by placeholders and interleave with values\n const parts: React.ReactNode[] = [];\n let lastIndex = 0;\n const regex = /\\{(\\w+)\\}/g;\n let match;\n\n while ((match = regex.exec(defaultMessage)) !== null) {\n const [placeholder, key] = match;\n\n // Add text before the placeholder\n if (match.index > lastIndex) {\n parts.push(defaultMessage.substring(lastIndex, match.index));\n }\n\n // Add the interpolated value or placeholder if not found\n parts.push(values[key] ?? placeholder);\n lastIndex = match.index + placeholder.length;\n }\n\n // Add remaining text\n if (lastIndex < defaultMessage.length) {\n parts.push(defaultMessage.substring(lastIndex));\n }\n\n return trailingSpace ? <>{parts} </> : parts;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2B2B;AAxB3B,0BAIO;AAaA,MAAM,cAA0C,CAAC,UAAU;AAChE,QAAM,EAAE,gBAAgB,IAAI,aAAa,eAAe,OAAO,IAAI;AACnE,QAAM,WAAO,6BAAQ;AAGrB,MAAI,MAAM;AACR,UAAM,MAAM,KAAK,cAAc,EAAE,IAAI,gBAAgB,YAAY,GAAG,MAAM;AAC1E,WAAO,gBAAgB,4EAAG;AAAA;AAAA,MAAI;AAAA,OAAC,IAAM;AAAA,EACvC;AAGA,MAAI,CAAC,QAAQ;AACX,WAAO,gBAAgB,4EAAG;AAAA;AAAA,MAAe;AAAA,OAAC,IAAM;AAAA,EAClD;AAGA,QAAM,QAA2B,CAAC;AAClC,MAAI,YAAY;AAChB,QAAM,QAAQ;AACd,MAAI;AAEJ,UAAQ,QAAQ,MAAM,KAAK,cAAc,OAAO,MAAM;AACpD,UAAM,CAAC,aAAa,GAAG,IAAI;AAG3B,QAAI,MAAM,QAAQ,WAAW;AAC3B,YAAM,KAAK,eAAe,UAAU,WAAW,MAAM,KAAK,CAAC;AAAA,IAC7D;AAGA,UAAM,KAAK,OAAO,GAAG,KAAK,WAAW;AACrC,gBAAY,MAAM,QAAQ,YAAY;AAAA,EACxC;AAGA,MAAI,YAAY,eAAe,QAAQ;AACrC,UAAM,KAAK,eAAe,UAAU,SAAS,CAAC;AAAA,EAChD;AAEA,SAAO,gBAAgB,4EAAG;AAAA;AAAA,IAAM;AAAA,KAAC,IAAM;AACzC;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import { Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import {
|
|
4
4
|
useIntl
|
|
5
5
|
} from "./intl-context.js";
|
|
@@ -7,14 +7,17 @@ const Translation = (props) => {
|
|
|
7
7
|
const { defaultMessage, id, description, trailingSpace, values } = props;
|
|
8
8
|
const i18n = useIntl();
|
|
9
9
|
if (i18n) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const str = i18n.formatMessage({ id, defaultMessage, description }, values);
|
|
11
|
+
return trailingSpace ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
+
str,
|
|
13
|
+
" "
|
|
14
|
+
] }) : str;
|
|
15
15
|
}
|
|
16
16
|
if (!values) {
|
|
17
|
-
return
|
|
17
|
+
return trailingSpace ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
+
defaultMessage,
|
|
19
|
+
" "
|
|
20
|
+
] }) : defaultMessage;
|
|
18
21
|
}
|
|
19
22
|
const parts = [];
|
|
20
23
|
let lastIndex = 0;
|
|
@@ -31,17 +34,11 @@ const Translation = (props) => {
|
|
|
31
34
|
if (lastIndex < defaultMessage.length) {
|
|
32
35
|
parts.push(defaultMessage.substring(lastIndex));
|
|
33
36
|
}
|
|
34
|
-
return
|
|
37
|
+
return trailingSpace ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
parts,
|
|
39
|
+
" "
|
|
40
|
+
] }) : parts;
|
|
35
41
|
};
|
|
36
|
-
function renderMessage(message, trailingSpace) {
|
|
37
|
-
const parts = Array.isArray(message) ? message : [message];
|
|
38
|
-
return React.createElement(
|
|
39
|
-
React.Fragment,
|
|
40
|
-
null,
|
|
41
|
-
...parts,
|
|
42
|
-
trailingSpace ? " " : null
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
42
|
export {
|
|
46
43
|
Translation
|
|
47
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/lib/i18n/translation.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n useIntl,\n type MessageDescriptor,\n type MessageValues,\n} from \"./intl-context.js\";\n\ntype TranslationProps = MessageDescriptor & {\n trailingSpace?: boolean;\n values?: MessageValues;\n};\n\n/**\n * Translation component that gracefully degrades when no I18nProvider is present.\n *\n * - With I18nProvider: Uses react-intl for full i18n support (react-intl will be bundled)\n * - Without I18nProvider: Renders the defaultMessage with simple value interpolation (no react-intl bundled)\n */\nexport const Translation: React.FC<TranslationProps> = (props) => {\n const { defaultMessage, id, description, trailingSpace, values } = props;\n const i18n = useIntl();\n\n // If I18nProvider is present, use react-intl's formatting\n if (i18n) {\n const
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/i18n/translation.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n useIntl,\n type MessageDescriptor,\n type MessageValues,\n} from \"./intl-context.js\";\n\ntype TranslationProps = MessageDescriptor & {\n trailingSpace?: boolean;\n values?: MessageValues;\n};\n\n/**\n * Translation component that gracefully degrades when no I18nProvider is present.\n *\n * - With I18nProvider: Uses react-intl for full i18n support (react-intl will be bundled)\n * - Without I18nProvider: Renders the defaultMessage with simple value interpolation (no react-intl bundled)\n */\nexport const Translation: React.FC<TranslationProps> = (props) => {\n const { defaultMessage, id, description, trailingSpace, values } = props;\n const i18n = useIntl();\n\n // If I18nProvider is present, use react-intl's formatting\n if (i18n) {\n const str = i18n.formatMessage({ id, defaultMessage, description }, values);\n return trailingSpace ? <>{str} </> : str;\n }\n\n // If no I18nProvider is present, render the defaultMessage with simple interpolation\n if (!values) {\n return trailingSpace ? <>{defaultMessage} </> : defaultMessage;\n }\n\n // Simple interpolation: split by placeholders and interleave with values\n const parts: React.ReactNode[] = [];\n let lastIndex = 0;\n const regex = /\\{(\\w+)\\}/g;\n let match;\n\n while ((match = regex.exec(defaultMessage)) !== null) {\n const [placeholder, key] = match;\n\n // Add text before the placeholder\n if (match.index > lastIndex) {\n parts.push(defaultMessage.substring(lastIndex, match.index));\n }\n\n // Add the interpolated value or placeholder if not found\n parts.push(values[key] ?? placeholder);\n lastIndex = match.index + placeholder.length;\n }\n\n // Add remaining text\n if (lastIndex < defaultMessage.length) {\n parts.push(defaultMessage.substring(lastIndex));\n }\n\n return trailingSpace ? <>{parts} </> : parts;\n};\n"],"mappings":";AA2B2B;AAxB3B;AAAA,EACE;AAAA,OAGK;AAaA,MAAM,cAA0C,CAAC,UAAU;AAChE,QAAM,EAAE,gBAAgB,IAAI,aAAa,eAAe,OAAO,IAAI;AACnE,QAAM,OAAO,QAAQ;AAGrB,MAAI,MAAM;AACR,UAAM,MAAM,KAAK,cAAc,EAAE,IAAI,gBAAgB,YAAY,GAAG,MAAM;AAC1E,WAAO,gBAAgB,iCAAG;AAAA;AAAA,MAAI;AAAA,OAAC,IAAM;AAAA,EACvC;AAGA,MAAI,CAAC,QAAQ;AACX,WAAO,gBAAgB,iCAAG;AAAA;AAAA,MAAe;AAAA,OAAC,IAAM;AAAA,EAClD;AAGA,QAAM,QAA2B,CAAC;AAClC,MAAI,YAAY;AAChB,QAAM,QAAQ;AACd,MAAI;AAEJ,UAAQ,QAAQ,MAAM,KAAK,cAAc,OAAO,MAAM;AACpD,UAAM,CAAC,aAAa,GAAG,IAAI;AAG3B,QAAI,MAAM,QAAQ,WAAW;AAC3B,YAAM,KAAK,eAAe,UAAU,WAAW,MAAM,KAAK,CAAC;AAAA,IAC7D;AAGA,UAAM,KAAK,OAAO,GAAG,KAAK,WAAW;AACrC,gBAAY,MAAM,QAAQ,YAAY;AAAA,EACxC;AAGA,MAAI,YAAY,eAAe,QAAQ;AACrC,UAAM,KAAK,eAAe,UAAU,SAAS,CAAC;AAAA,EAChD;AAEA,SAAO,gBAAgB,iCAAG;AAAA;AAAA,IAAM;AAAA,KAAC,IAAM;AACzC;","names":[]}
|