gt-react 2.0.184 → 2.0.186
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/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -5
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/next.d.ts +2 -2
- package/dist/next.d.ts.map +1 -1
- package/dist/next.js +3 -3
- package/dist/next.js.map +1 -1
- package/dist/primitives/value/client/RenderClientVariable.js +2 -2
- package/dist/primitives/value/client/RenderClientVariable.js.map +1 -1
- package/dist/primitives/value/renderVariable.d.ts.map +1 -1
- package/dist/primitives/value/renderVariable.js +5 -4
- package/dist/primitives/value/renderVariable.js.map +1 -1
- package/dist/primitives/variable/currency/ClientCurrencyVariable.d.ts +36 -0
- package/dist/primitives/variable/currency/ClientCurrencyVariable.d.ts.map +1 -0
- package/dist/primitives/variable/currency/ClientCurrencyVariable.js +33 -0
- package/dist/primitives/variable/currency/ClientCurrencyVariable.js.map +1 -0
- package/dist/primitives/variable/currency/CurrencyVariable.d.ts +38 -0
- package/dist/primitives/variable/currency/CurrencyVariable.d.ts.map +1 -0
- package/dist/primitives/variable/currency/CurrencyVariable.js +48 -0
- package/dist/primitives/variable/currency/CurrencyVariable.js.map +1 -0
- package/dist/primitives/variable/date/ClientDateVariable.d.ts +13 -2
- package/dist/primitives/variable/date/ClientDateVariable.d.ts.map +1 -1
- package/dist/primitives/variable/date/ClientDateVariable.js +23 -3
- package/dist/primitives/variable/date/ClientDateVariable.js.map +1 -1
- package/dist/primitives/variable/date/DateVariable.d.ts +13 -2
- package/dist/primitives/variable/date/DateVariable.d.ts.map +1 -1
- package/dist/primitives/variable/date/DateVariable.js +19 -3
- package/dist/primitives/variable/date/DateVariable.js.map +1 -1
- package/dist/primitives/variable/defaultVariableNames.d.ts +3 -0
- package/dist/primitives/variable/defaultVariableNames.d.ts.map +1 -0
- package/dist/primitives/variable/defaultVariableNames.js +10 -0
- package/dist/primitives/variable/defaultVariableNames.js.map +1 -0
- package/dist/primitives/variable/number/ClientNumberVariable.d.ts +14 -2
- package/dist/primitives/variable/number/ClientNumberVariable.d.ts.map +1 -1
- package/dist/primitives/variable/number/ClientNumberVariable.js +22 -4
- package/dist/primitives/variable/number/ClientNumberVariable.js.map +1 -1
- package/dist/primitives/variable/number/NumberVariable.d.ts +14 -2
- package/dist/primitives/variable/number/NumberVariable.d.ts.map +1 -1
- package/dist/primitives/variable/number/NumberVariable.js +20 -6
- package/dist/primitives/variable/number/NumberVariable.js.map +1 -1
- package/dist/primitives/variable/variable/ClientVariable.d.ts +10 -0
- package/dist/primitives/variable/variable/ClientVariable.d.ts.map +1 -1
- package/dist/primitives/variable/variable/ClientVariable.js +10 -0
- package/dist/primitives/variable/variable/ClientVariable.js.map +1 -1
- package/dist/primitives/variable/variable/Variable.d.ts +10 -0
- package/dist/primitives/variable/variable/Variable.d.ts.map +1 -1
- package/dist/primitives/variable/variable/Variable.js +10 -0
- package/dist/primitives/variable/variable/Variable.js.map +1 -1
- package/dist/server/helpers/addGTIdentifier.d.ts.map +1 -1
- package/dist/server/helpers/addGTIdentifier.js.map +1 -1
- package/dist/server/helpers/writeChildrenAsObjects.d.ts.map +1 -1
- package/dist/server/helpers/writeChildrenAsObjects.js +3 -3
- package/dist/server/helpers/writeChildrenAsObjects.js.map +1 -1
- package/dist/server/renderChildren.d.ts.map +1 -1
- package/dist/server/renderChildren.js +28 -11
- package/dist/server/renderChildren.js.map +1 -1
- package/package.json +1 -1
- package/dist/primitives/variable/currency/ClientCurrency.d.ts +0 -13
- package/dist/primitives/variable/currency/ClientCurrency.d.ts.map +0 -1
- package/dist/primitives/variable/currency/ClientCurrency.js +0 -17
- package/dist/primitives/variable/currency/ClientCurrency.js.map +0 -1
- package/dist/primitives/variable/currency/Currency.d.ts +0 -14
- package/dist/primitives/variable/currency/Currency.d.ts.map +0 -1
- package/dist/primitives/variable/currency/Currency.js +0 -31
- package/dist/primitives/variable/currency/Currency.js.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import useGT from "./client/useGT";
|
|
2
2
|
import Numeric from "./primitives/numeric/client/ClientNumeric";
|
|
3
3
|
import Value from "./primitives/value/client/ClientValue";
|
|
4
|
-
import Variable from "./primitives/variable/variable/ClientVariable";
|
|
5
4
|
import useDefaultLanguage from "./client/useDefaultLanguage";
|
|
6
5
|
import useCurrentLanguage from "./client/useCurrentLanguage";
|
|
7
|
-
import
|
|
6
|
+
import ClientVariable from "./primitives/variable/variable/ClientVariable";
|
|
7
|
+
import ClientCurrencyVariable from "./primitives/variable/currency/ClientCurrencyVariable";
|
|
8
8
|
import ClientDateVariable from "./primitives/variable/date/ClientDateVariable";
|
|
9
9
|
import ClientNumberVariable from "./primitives/variable/number/ClientNumberVariable";
|
|
10
|
-
export { useGT, useDefaultLanguage, useCurrentLanguage, Numeric, Value, Variable, ClientNumberVariable as NumberVariable, ClientDateVariable as DateVariable,
|
|
10
|
+
export { useGT, useDefaultLanguage, useCurrentLanguage, Numeric, Value, ClientVariable as Variable, ClientNumberVariable as NumberVariable, ClientDateVariable as DateVariable, ClientCurrencyVariable as CurrencyVariable };
|
|
11
11
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,OAAO,MAAM,2CAA2C,CAAC;AAChE,OAAO,KAAK,MAAM,uCAAuC,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,OAAO,MAAM,2CAA2C,CAAC;AAChE,OAAO,KAAK,MAAM,uCAAuC,CAAC;AAC1D,OAAO,kBAAkB,MAAM,6BAA6B,CAAC;AAC7D,OAAO,kBAAkB,MAAM,6BAA6B,CAAC;AAC7D,OAAO,cAAc,MAAM,+CAA+C,CAAA;AAC1E,OAAO,sBAAsB,MAAM,uDAAuD,CAAC;AAC3F,OAAO,kBAAkB,MAAM,+CAA+C,CAAC;AAC/E,OAAO,oBAAoB,MAAM,mDAAmD,CAAC;AACrF,OAAO,EACH,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAC7C,OAAO,EAAE,KAAK,EACd,cAAc,IAAI,QAAQ,EAC1B,oBAAoB,IAAI,cAAc,EACtC,kBAAkB,IAAI,YAAY,EAClC,sBAAsB,IAAI,gBAAgB,EAC7C,CAAA"}
|
package/dist/client.js
CHANGED
|
@@ -3,21 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.CurrencyVariable = exports.DateVariable = exports.NumberVariable = exports.Variable = exports.Value = exports.Numeric = exports.useCurrentLanguage = exports.useDefaultLanguage = exports.useGT = void 0;
|
|
7
7
|
const useGT_1 = __importDefault(require("./client/useGT"));
|
|
8
8
|
exports.useGT = useGT_1.default;
|
|
9
9
|
const ClientNumeric_1 = __importDefault(require("./primitives/numeric/client/ClientNumeric"));
|
|
10
10
|
exports.Numeric = ClientNumeric_1.default;
|
|
11
11
|
const ClientValue_1 = __importDefault(require("./primitives/value/client/ClientValue"));
|
|
12
12
|
exports.Value = ClientValue_1.default;
|
|
13
|
-
const ClientVariable_1 = __importDefault(require("./primitives/variable/variable/ClientVariable"));
|
|
14
|
-
exports.Variable = ClientVariable_1.default;
|
|
15
13
|
const useDefaultLanguage_1 = __importDefault(require("./client/useDefaultLanguage"));
|
|
16
14
|
exports.useDefaultLanguage = useDefaultLanguage_1.default;
|
|
17
15
|
const useCurrentLanguage_1 = __importDefault(require("./client/useCurrentLanguage"));
|
|
18
16
|
exports.useCurrentLanguage = useCurrentLanguage_1.default;
|
|
19
|
-
const
|
|
20
|
-
exports.
|
|
17
|
+
const ClientVariable_1 = __importDefault(require("./primitives/variable/variable/ClientVariable"));
|
|
18
|
+
exports.Variable = ClientVariable_1.default;
|
|
19
|
+
const ClientCurrencyVariable_1 = __importDefault(require("./primitives/variable/currency/ClientCurrencyVariable"));
|
|
20
|
+
exports.CurrencyVariable = ClientCurrencyVariable_1.default;
|
|
21
21
|
const ClientDateVariable_1 = __importDefault(require("./primitives/variable/date/ClientDateVariable"));
|
|
22
22
|
exports.DateVariable = ClientDateVariable_1.default;
|
|
23
23
|
const ClientNumberVariable_1 = __importDefault(require("./primitives/variable/number/ClientNumberVariable"));
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAmC;AAU/B,gBAVG,eAAK,CAUH;AATT,8FAAgE;AAU5D,kBAVG,uBAAO,CAUH;AATX,wFAA0D;AAS7C,gBATN,qBAAK,CASM;AARlB,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAmC;AAU/B,gBAVG,eAAK,CAUH;AATT,8FAAgE;AAU5D,kBAVG,uBAAO,CAUH;AATX,wFAA0D;AAS7C,gBATN,qBAAK,CASM;AARlB,qFAA6D;AAOlD,6BAPJ,4BAAkB,CAOI;AAN7B,qFAA6D;AAM9B,6BANxB,4BAAkB,CAMwB;AALjD,mGAA0E;AAOpD,mBAPf,wBAAc,CAOS;AAN9B,mHAA2F;AAS7D,2BATvB,gCAAsB,CASiB;AAR9C,uGAA+E;AAOrD,uBAPnB,4BAAkB,CAOa;AANtC,6GAAqF;AAKzD,yBALrB,8BAAoB,CAKe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import Value from "./primitives/value/Value";
|
|
|
5
5
|
import Variable from "./primitives/variable/variable/Variable";
|
|
6
6
|
import intl from "./intl/intl";
|
|
7
7
|
import GTProvider from "./client/GTProvider";
|
|
8
|
-
import
|
|
8
|
+
import CurrencyVariable from "./primitives/variable/currency/CurrencyVariable";
|
|
9
9
|
import DateVariable from "./primitives/variable/date/DateVariable";
|
|
10
10
|
import NumberVariable from "./primitives/variable/number/NumberVariable";
|
|
11
|
-
export { ServerI18N as I18N, intl, Private, Numeric, Value, Variable, NumberVariable, DateVariable,
|
|
11
|
+
export { ServerI18N as I18N, intl, Private, Numeric, Value, Variable, NumberVariable, DateVariable, CurrencyVariable, GTProvider };
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAC7C,OAAO,QAAQ,MAAM,yCAAyC,CAAA;AAC9D,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAC7C,OAAO,QAAQ,MAAM,yCAAyC,CAAA;AAC9D,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,gBAAgB,MAAM,iDAAiD,CAAC;AAC/E,OAAO,YAAY,MAAM,yCAAyC,CAAC;AACnE,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,EACH,UAAU,IAAI,IAAI,EAClB,IAAI,EACJ,OAAO,EAAE,OAAO,EAAE,KAAK,EACvB,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EACxD,UAAU,EACb,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GTProvider = exports.
|
|
6
|
+
exports.GTProvider = exports.CurrencyVariable = exports.DateVariable = exports.NumberVariable = exports.Variable = exports.Value = exports.Numeric = exports.Private = exports.intl = exports.I18N = void 0;
|
|
7
7
|
const ServerI18N_1 = __importDefault(require("./server/ServerI18N"));
|
|
8
8
|
exports.I18N = ServerI18N_1.default;
|
|
9
9
|
const Private_1 = __importDefault(require("./primitives/private/Private"));
|
|
@@ -18,8 +18,8 @@ const intl_1 = __importDefault(require("./intl/intl"));
|
|
|
18
18
|
exports.intl = intl_1.default;
|
|
19
19
|
const GTProvider_1 = __importDefault(require("./client/GTProvider"));
|
|
20
20
|
exports.GTProvider = GTProvider_1.default;
|
|
21
|
-
const
|
|
22
|
-
exports.
|
|
21
|
+
const CurrencyVariable_1 = __importDefault(require("./primitives/variable/currency/CurrencyVariable"));
|
|
22
|
+
exports.CurrencyVariable = CurrencyVariable_1.default;
|
|
23
23
|
const DateVariable_1 = __importDefault(require("./primitives/variable/date/DateVariable"));
|
|
24
24
|
exports.DateVariable = DateVariable_1.default;
|
|
25
25
|
const NumberVariable_1 = __importDefault(require("./primitives/variable/number/NumberVariable"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qEAA6C;AAW3B,eAXX,oBAAU,CAWK;AAVtB,2EAAmD;AAY/C,kBAZG,iBAAO,CAYH;AAXX,2EAAmD;AAWtC,kBAXN,iBAAO,CAWM;AAVpB,qEAA6C;AAUvB,gBAVf,eAAK,CAUe;AAT3B,uFAA8D;AAU1D,mBAVG,kBAAQ,CAUH;AATZ,uDAA+B;AAO3B,eAPG,cAAI,CAOH;AANR,qEAA6C;AASzC,qBATG,oBAAU,CASH;AARd,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qEAA6C;AAW3B,eAXX,oBAAU,CAWK;AAVtB,2EAAmD;AAY/C,kBAZG,iBAAO,CAYH;AAXX,2EAAmD;AAWtC,kBAXN,iBAAO,CAWM;AAVpB,qEAA6C;AAUvB,gBAVf,eAAK,CAUe;AAT3B,uFAA8D;AAU1D,mBAVG,kBAAQ,CAUH;AATZ,uDAA+B;AAO3B,eAPG,cAAI,CAOH;AANR,qEAA6C;AASzC,qBATG,oBAAU,CASH;AARd,uGAA+E;AAOnC,2BAPrC,0BAAgB,CAOqC;AAN5D,2FAAmE;AAMrC,uBANvB,sBAAY,CAMuB;AAL1C,iGAAyE;AAK3D,yBALP,wBAAc,CAKO"}
|
package/dist/next.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import Numeric from "./primitives/numeric/Numeric";
|
|
|
5
5
|
import Value from "./primitives/value/Value";
|
|
6
6
|
import Private from "./primitives/private/Private";
|
|
7
7
|
import Variable from "./primitives/variable/variable/Variable";
|
|
8
|
-
import
|
|
8
|
+
import CurrencyVariable from "./primitives/variable/currency/CurrencyVariable";
|
|
9
9
|
import DateVariable from "./primitives/variable/date/DateVariable";
|
|
10
10
|
import NumberVariable from "./primitives/variable/number/NumberVariable";
|
|
11
|
-
export { NextI18N as I18N, nextIntl as intl, NextGTProvider as GTProvider, Numeric, Value, Private, Variable, NumberVariable, DateVariable,
|
|
11
|
+
export { NextI18N as I18N, nextIntl as intl, NextGTProvider as GTProvider, Numeric, Value, Private, Variable, NumberVariable, DateVariable, CurrencyVariable };
|
|
12
12
|
//# sourceMappingURL=next.d.ts.map
|
package/dist/next.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAC7C,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAC7C,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAC/D,OAAO,gBAAgB,MAAM,iDAAiD,CAAC;AAC/E,OAAO,YAAY,MAAM,yCAAyC,CAAC;AACnE,OAAO,cAAc,MAAM,6CAA6C,CAAC;AAEzE,OAAO,EACH,QAAQ,IAAI,IAAI,EAChB,QAAQ,IAAI,IAAI,EAChB,cAAc,IAAI,UAAU,EAC5B,OAAO,EAAE,KAAK,EAAE,OAAO,EACvB,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAC3D,CAAC"}
|
package/dist/next.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.CurrencyVariable = exports.DateVariable = exports.NumberVariable = exports.Variable = exports.Private = exports.Value = exports.Numeric = exports.GTProvider = exports.intl = exports.I18N = void 0;
|
|
7
7
|
const NextI18N_1 = __importDefault(require("./next/NextI18N"));
|
|
8
8
|
exports.I18N = NextI18N_1.default;
|
|
9
9
|
const intl_1 = __importDefault(require("./next/intl"));
|
|
@@ -18,8 +18,8 @@ const Private_1 = __importDefault(require("./primitives/private/Private"));
|
|
|
18
18
|
exports.Private = Private_1.default;
|
|
19
19
|
const Variable_1 = __importDefault(require("./primitives/variable/variable/Variable"));
|
|
20
20
|
exports.Variable = Variable_1.default;
|
|
21
|
-
const
|
|
22
|
-
exports.
|
|
21
|
+
const CurrencyVariable_1 = __importDefault(require("./primitives/variable/currency/CurrencyVariable"));
|
|
22
|
+
exports.CurrencyVariable = CurrencyVariable_1.default;
|
|
23
23
|
const DateVariable_1 = __importDefault(require("./primitives/variable/date/DateVariable"));
|
|
24
24
|
exports.DateVariable = DateVariable_1.default;
|
|
25
25
|
const NumberVariable_1 = __importDefault(require("./primitives/variable/number/NumberVariable"));
|
package/dist/next.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next.js","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAuC;AAYvB,eAZT,kBAAQ,CAYK;AAXpB,uDAAmC;AAYnB,eAZT,cAAQ,CAYK;AAXpB,2EAAmD;AAY7B,qBAZf,wBAAc,CAYW;AAXhC,2EAAmD;AAY/C,kBAZG,iBAAO,CAYH;AAXX,qEAA6C;AAWhC,gBAXN,eAAK,CAWM;AAVlB,2EAAmD;AAU/B,kBAVb,iBAAO,CAUa;AAT3B,uFAA+D;AAU3D,mBAVG,kBAAQ,CAUH;AATZ,
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAuC;AAYvB,eAZT,kBAAQ,CAYK;AAXpB,uDAAmC;AAYnB,eAZT,cAAQ,CAYK;AAXpB,2EAAmD;AAY7B,qBAZf,wBAAc,CAYW;AAXhC,2EAAmD;AAY/C,kBAZG,iBAAO,CAYH;AAXX,qEAA6C;AAWhC,gBAXN,eAAK,CAWM;AAVlB,2EAAmD;AAU/B,kBAVb,iBAAO,CAUa;AAT3B,uFAA+D;AAU3D,mBAVG,kBAAQ,CAUH;AATZ,uGAA+E;AASnC,2BATrC,0BAAgB,CASqC;AAR5D,2FAAmE;AAQrC,uBARvB,sBAAY,CAQuB;AAP1C,iGAAyE;AAO3D,yBAPP,wBAAc,CAOO"}
|
|
@@ -32,7 +32,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
32
32
|
const react_1 = __importStar(require("react"));
|
|
33
33
|
const ClientNumberVariable_1 = __importDefault(require("../../variable/number/ClientNumberVariable"));
|
|
34
34
|
const ClientDateVariable_1 = __importDefault(require("../../variable/date/ClientDateVariable"));
|
|
35
|
-
const
|
|
35
|
+
const ClientCurrencyVariable_1 = __importDefault(require("../../variable/currency/ClientCurrencyVariable"));
|
|
36
36
|
/**
|
|
37
37
|
* Handles a single child element by cloning it with new properties if it is a valid React element,
|
|
38
38
|
* or wrapping it in a React Fragment if it is a valid React node object.
|
|
@@ -57,7 +57,7 @@ function SingleChild({ children, variables }) {
|
|
|
57
57
|
return (0, jsx_runtime_1.jsx)(ClientDateVariable_1.default, { defaultValue: value, name: props['data-gt-variable-name'], options: props['data-gt-variable-options'] });
|
|
58
58
|
}
|
|
59
59
|
if (variableType === "currency") {
|
|
60
|
-
return (0, jsx_runtime_1.jsx)(
|
|
60
|
+
return (0, jsx_runtime_1.jsx)(ClientCurrencyVariable_1.default, { defaultValue: value, name: props['data-gt-variable-name'], currency: props['data-gt-variable-currency'] });
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderClientVariable.js","sourceRoot":"","sources":["../../../../src/primitives/value/client/RenderClientVariable.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDZ,uCAaC;;AA5DD,+CAA6D;AAI7D,sGAA8E;AAC9E,gGAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"RenderClientVariable.js","sourceRoot":"","sources":["../../../../src/primitives/value/client/RenderClientVariable.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDZ,uCAaC;;AA5DD,+CAA6D;AAI7D,sGAA8E;AAC9E,gGAAwE;AACxE,4GAA4E;AAE5E;;;;;;GAMG;AAEH,SAAS,WAAW,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAmD;IACxF,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAChI,IAAI,eAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAQ,QAAQ,CAAC;QACtC,IAAI,SAAS,IAAI,KAAK,CAAC,uBAAuB,CAAC,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;YACxD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;gBACjD,IAAI,KAAK,CAAC,uBAAuB,CAAC,EAAE,CAAC;oBACjC,MAAM,YAAY,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC;oBACpD,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;wBAC5B,OAAO,uBAAC,8BAAoB,IAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,GAAG,CAAA;oBAC7F,CAAC;oBACD,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;wBAC1B,OAAO,uBAAC,4BAAkB,IAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,GAAG,CAAA;oBACvI,CAAC;oBACD,IAAI,YAAY,KAAK,UAAU,EAAE,CAAC;wBAC9B,OAAO,uBAAC,gCAAc,IAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,2BAA2B,CAAC,GAAG,CAAA;oBACrI,CAAC;gBACL,CAAC;YAEL,CAAC;QACL,CAAC;QACD,IAAI,QAAQ,qBAAQ,KAAK,CAAE,CAAC;QAC5B,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,CAAC;YAClB,QAAQ,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAC,WAAW,IAAC,SAAS,EAAE,SAAS,YAAG,KAAK,GAAe,CAAC,CAAC;QAC9H,CAAC;QACD,OAAO,eAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAwB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAsD;IAEpH,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAC,QAAQ,CAAC,CAAC;IAEnE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,mBAAmB,CAAC,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAC,WAAW,IAAC,SAAS,EAAE,SAAS,YAAG,KAAK,GAAe,CAAC,CAAC,CAAA;IACxH,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;IAEzB,OAAO,CACH,2DACK,gBAAgB,GAClB,CACN,CAAA;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderVariable.d.ts","sourceRoot":"","sources":["../../../src/primitives/value/renderVariable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderVariable.d.ts","sourceRoot":"","sources":["../../../src/primitives/value/renderVariable.tsx"],"names":[],"mappings":"AA8CA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAG1F"}
|
|
@@ -8,7 +8,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const isValidReactNode_1 = __importDefault(require("./isValidReactNode"));
|
|
10
10
|
const Variable_1 = __importDefault(require("../variable/variable/Variable"));
|
|
11
|
-
const
|
|
11
|
+
const CurrencyVariable_1 = __importDefault(require("../variable/currency/CurrencyVariable"));
|
|
12
12
|
const DateVariable_1 = __importDefault(require("../variable/date/DateVariable"));
|
|
13
13
|
const NumberVariable_1 = __importDefault(require("../variable/number/NumberVariable"));
|
|
14
14
|
/**
|
|
@@ -28,14 +28,15 @@ const handleSingleChild = (child, variables) => {
|
|
|
28
28
|
const name = props.name;
|
|
29
29
|
const variableType = ((_a = transformation.split('-')) === null || _a === void 0 ? void 0 : _a[1]) || "variable";
|
|
30
30
|
const value = variables[props.name];
|
|
31
|
+
const options = (props === null || props === void 0 ? void 0 : props.options) || {};
|
|
31
32
|
if (variableType === "number") {
|
|
32
|
-
return (0, jsx_runtime_1.jsx)(NumberVariable_1.default, { defaultValue: value, name: name });
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(NumberVariable_1.default, { defaultValue: value, name: name, options: options });
|
|
33
34
|
}
|
|
34
35
|
if (variableType === "date") {
|
|
35
|
-
return (0, jsx_runtime_1.jsx)(DateVariable_1.default, { defaultValue: value, name: name });
|
|
36
|
+
return (0, jsx_runtime_1.jsx)(DateVariable_1.default, { defaultValue: value, name: name, options: options });
|
|
36
37
|
}
|
|
37
38
|
if (variableType === "currency") {
|
|
38
|
-
return (0, jsx_runtime_1.jsx)(
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(CurrencyVariable_1.default, { defaultValue: value, name: name, options: options });
|
|
39
40
|
}
|
|
40
41
|
return (0, jsx_runtime_1.jsx)(Variable_1.default, { defaultValue: value, name: name });
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderVariable.js","sourceRoot":"","sources":["../../../src/primitives/value/renderVariable.tsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"renderVariable.js","sourceRoot":"","sources":["../../../src/primitives/value/renderVariable.tsx"],"names":[],"mappings":";;;;;AAoDA,iCAGC;;AAvDD,kDAAyB;AACzB,0EAAkD;AAClD,6EAAqD;AACrD,6FAAqE;AACrE,iFAAyD;AACzD,uFAA+D;AAE/D;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAU,EAAE,SAA+B,EAAO,EAAE;;IAC3E,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAQ,KAAK,CAAC;QACnC,gCAAgC;QAChC,MAAM,cAAc,GAAW,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CAAE,IAAY,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxG,IAAI,SAAS,KAAI,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,CAAC,UAAU,CAAC,CAAA,KAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAA,EAAE,CAAC;YAErE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YACxB,MAAM,YAAY,GAAG,CAAA,MAAA,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,KAAI,UAAU,CAAC;YAClE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpC,MAAM,OAAO,GAAG,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,KAAI,EAAE,CAAC;YACrC,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;gBAC5B,OAAO,uBAAC,wBAAc,IAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,CAAA;YAC/E,CAAC;YACD,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;gBAC1B,OAAO,uBAAC,sBAAY,IAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,CAAA;YAC7E,CAAC;YACD,IAAI,YAAY,KAAK,UAAU,EAAE,CAAC;gBAC9B,OAAO,uBAAC,0BAAgB,IAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,CAAA;YACjF,CAAC;YACD,OAAO,uBAAC,kBAAQ,IAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,CAAA;QACxD,CAAC;QACD,IAAI,QAAQ,qBAAQ,KAAK,CAAE,CAAC;QAE5B,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,CAAC;YAClB,QAAQ,CAAC,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC9C,CAAC;IACD,IAAI,IAAA,0BAAgB,EAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;AAC9C,CAAC,CAAA;AAED;;;;;GAKG;AACH,SAAwB,cAAc,CAAC,QAAa,EAAE,SAA+B;IACjF,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,KAAa,EAAE,EAAE,CAAC,uBAAC,eAAK,CAAC,QAAQ,cAAc,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,IAA3C,KAAK,CAAwD,CAAC,CAAC;;QAC/J,OAAO,iBAAiB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;AACtD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the ClientCurrencyVariable component.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} VariableProps
|
|
6
|
+
* @property {ReactNode} [children] - The value to be formatted. If provided, overrides defaultValue.
|
|
7
|
+
* @property {string} name - The name attribute for the data-gt-variable-name.
|
|
8
|
+
* @property {number} [defaultValue] - The default value to be formatted if children is not provided.
|
|
9
|
+
* @property {string} [currency] - The currency code to use for formatting. Default is "USD".
|
|
10
|
+
* @property {Record<string, any>} [options] - Additional options to pass to the Intl.NumberFormat constructor.
|
|
11
|
+
*/
|
|
12
|
+
type VariableProps = {
|
|
13
|
+
children?: any;
|
|
14
|
+
name: string;
|
|
15
|
+
defaultValue?: any;
|
|
16
|
+
currency?: string;
|
|
17
|
+
options?: Record<string, any>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* CurrencyVariable component formats a number as a currency string based on the current language settings.
|
|
21
|
+
* It uses Intl.NumberFormat for currency formatting.
|
|
22
|
+
*
|
|
23
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
24
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
25
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
26
|
+
* @param {number} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
27
|
+
* @param {string} [props.currency="USD"] - The currency code to use for formatting.
|
|
28
|
+
* @param {Record<string, any>} [props.options] - Options for number formatting.
|
|
29
|
+
* @returns {ReactNode} A span element containing the formatted currency with specific data attributes
|
|
30
|
+
*/
|
|
31
|
+
declare const ClientCurrencyVariable: {
|
|
32
|
+
({ children, name, defaultValue, currency, options }?: VariableProps): ReactNode;
|
|
33
|
+
gtTransformation: string;
|
|
34
|
+
};
|
|
35
|
+
export default ClientCurrencyVariable;
|
|
36
|
+
//# sourceMappingURL=ClientCurrencyVariable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientCurrencyVariable.d.ts","sourceRoot":"","sources":["../../../../src/primitives/variable/currency/ClientCurrencyVariable.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAGlD;;;;;;;;;GASG;AACH,KAAK,aAAa,GAAG;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,sBAAsB;2DAA+E,aAAa,GAAsB,SAAS;;CAkBtJ,CAAC;AAKF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const client_1 = require("../../../client");
|
|
7
|
+
/**
|
|
8
|
+
* CurrencyVariable component formats a number as a currency string based on the current language settings.
|
|
9
|
+
* It uses Intl.NumberFormat for currency formatting.
|
|
10
|
+
*
|
|
11
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
12
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
13
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
14
|
+
* @param {number} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
15
|
+
* @param {string} [props.currency="USD"] - The currency code to use for formatting.
|
|
16
|
+
* @param {Record<string, any>} [props.options] - Options for number formatting.
|
|
17
|
+
* @returns {ReactNode} A span element containing the formatted currency with specific data attributes
|
|
18
|
+
*/
|
|
19
|
+
const ClientCurrencyVariable = ({ children, name = "cost", defaultValue, currency = "USD", options = {} } = { name: "cost" }) => {
|
|
20
|
+
const currentLanguage = (0, client_1.useCurrentLanguage)();
|
|
21
|
+
const formattedValue = (0, react_1.useMemo)(() => {
|
|
22
|
+
// Determine the value to be formatted
|
|
23
|
+
let value = (typeof children !== 'undefined' && typeof defaultValue === 'undefined') ? children : defaultValue;
|
|
24
|
+
value = (typeof value === 'string') ? parseFloat(value) : value;
|
|
25
|
+
// Format the value using Intl.NumberFormat
|
|
26
|
+
return typeof value === 'number' ? new Intl.NumberFormat(currentLanguage, Object.assign({ style: 'currency', currency }, options)).format(value) : value;
|
|
27
|
+
}, [children, defaultValue, currentLanguage, currency, options]);
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-gt-variable-name": name, "data-gt-variable-type": "currency", "data-gt-variable-options": Object.assign({ style: 'currency', currency }, options), children: formattedValue }));
|
|
29
|
+
};
|
|
30
|
+
// Static property to indicate the transformation type
|
|
31
|
+
ClientCurrencyVariable.gtTransformation = "variable-currency";
|
|
32
|
+
exports.default = ClientCurrencyVariable;
|
|
33
|
+
//# sourceMappingURL=ClientCurrencyVariable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientCurrencyVariable.js","sourceRoot":"","sources":["../../../../src/primitives/variable/currency/ClientCurrencyVariable.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;AAEZ,iCAAkD;AAClD,4CAAqD;AAoBrD;;;;;;;;;;;GAWG;AACH,MAAM,sBAAsB,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,YAAY,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,GAAG,EAAE,KAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,EAAa,EAAE;IAEtJ,MAAM,eAAe,GAAG,IAAA,2BAAkB,GAAE,CAAC;IAE7C,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAChC,sCAAsC;QACtC,IAAI,KAAK,GAAG,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC;QAC/G,KAAK,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAChE,2CAA2C;QAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,kBAAI,KAAK,EAAE,UAAU,EAAE,QAAQ,IAAK,OAAO,EAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACjJ,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAEjE,OAAO,CACH,0DAA6B,IAAI,2BAAyB,UAAU,8CAA8B,KAAK,EAAE,UAAU,EAAE,QAAQ,IAAK,OAAO,aACpI,cAAc,GACZ,CACV,CAAC;AAEN,CAAC,CAAC;AAEF,sDAAsD;AACtD,sBAAsB,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAE9D,kBAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the CurrencyVariable component.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} VariableProps
|
|
6
|
+
* @property {ReactNode} [children] - The value to be formatted. If provided, overrides defaultValue.
|
|
7
|
+
* @property {string} name - The name attribute for the data-gt-variable-name.
|
|
8
|
+
* @property {number} [defaultValue] - The default value to be formatted if children is not provided.
|
|
9
|
+
* @property {string} [currency] - The currency code to use for formatting. Default is "USD".
|
|
10
|
+
* @property {Record<string, any>} ["data-generaltranslation"] - General translation data passed to the component.
|
|
11
|
+
* @property {Record<string, any>} [options] - Additional options to pass to the Intl.NumberFormat constructor.
|
|
12
|
+
*/
|
|
13
|
+
type VariableProps = {
|
|
14
|
+
children?: any;
|
|
15
|
+
name: string;
|
|
16
|
+
defaultValue?: any;
|
|
17
|
+
currency?: string;
|
|
18
|
+
"data-generaltranslation"?: Record<string, any>;
|
|
19
|
+
options?: Record<string, any>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* CurrencyVariable component formats a number as a currency string based on the current language settings.
|
|
23
|
+
* It uses Intl.NumberFormat for currency formatting.
|
|
24
|
+
*
|
|
25
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
26
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
27
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
28
|
+
* @param {number} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
29
|
+
* @param {string} [props.currency="USD"] - The currency code to use for formatting.
|
|
30
|
+
* @param {Record<string, any>} [props.options] - Options for number formatting.
|
|
31
|
+
* @returns {ReactNode} A span element containing the formatted currency with specific data attributes
|
|
32
|
+
*/
|
|
33
|
+
declare const CurrencyVariable: {
|
|
34
|
+
({ children, name, defaultValue, currency, options, ...props }?: VariableProps): ReactNode;
|
|
35
|
+
gtTransformation: string;
|
|
36
|
+
};
|
|
37
|
+
export default CurrencyVariable;
|
|
38
|
+
//# sourceMappingURL=CurrencyVariable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrencyVariable.d.ts","sourceRoot":"","sources":["../../../../src/primitives/variable/currency/CurrencyVariable.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC;;;;;;;;;;GAUG;AACH,KAAK,aAAa,GAAG;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB;qEAAyF,aAAa,GAAsB,SAAS;;CAyB1J,CAAC;AAKF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
const I18NConfig_1 = __importDefault(require("../../../config/I18NConfig"));
|
|
19
|
+
/**
|
|
20
|
+
* CurrencyVariable component formats a number as a currency string based on the current language settings.
|
|
21
|
+
* It uses Intl.NumberFormat for currency formatting.
|
|
22
|
+
*
|
|
23
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
24
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
25
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
26
|
+
* @param {number} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
27
|
+
* @param {string} [props.currency="USD"] - The currency code to use for formatting.
|
|
28
|
+
* @param {Record<string, any>} [props.options] - Options for number formatting.
|
|
29
|
+
* @returns {ReactNode} A span element containing the formatted currency with specific data attributes
|
|
30
|
+
*/
|
|
31
|
+
const CurrencyVariable = (_a = { name: "cost" }) => {
|
|
32
|
+
var { children, name = "cost", defaultValue, currency = "USD", options = {} } = _a, props = __rest(_a, ["children", "name", "defaultValue", "currency", "options"]);
|
|
33
|
+
const { "data-generaltranslation": generaltranslation } = props;
|
|
34
|
+
// Determine the value to be formatted
|
|
35
|
+
let value = (typeof children !== 'undefined' && typeof defaultValue === 'undefined') ? children : defaultValue;
|
|
36
|
+
value = (typeof value === 'string') ? parseFloat(value) : value;
|
|
37
|
+
// Get the current language setting
|
|
38
|
+
const currentLanguage = I18NConfig_1.default.getCurrentLanguage();
|
|
39
|
+
// Format the number as currency according to the locale
|
|
40
|
+
const formattedValue = (typeof value === 'number')
|
|
41
|
+
? new Intl.NumberFormat(currentLanguage, Object.assign({ style: 'currency', currency }, options)).format(value)
|
|
42
|
+
: value;
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "currency", "data-gt-variable-options": Object.assign({ style: 'currency', currency }, options), children: formattedValue }));
|
|
44
|
+
};
|
|
45
|
+
// Static property to indicate the transformation type
|
|
46
|
+
CurrencyVariable.gtTransformation = "variable-currency";
|
|
47
|
+
exports.default = CurrencyVariable;
|
|
48
|
+
//# sourceMappingURL=CurrencyVariable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrencyVariable.js","sourceRoot":"","sources":["../../../../src/primitives/variable/currency/CurrencyVariable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,4EAAoD;AAsBpD;;;;;;;;;;;GAWG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAqG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAa,EAAE;QAApI,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,YAAY,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,GAAG,EAAE,OAA8C,EAAzC,KAAK,cAAjF,2DAAmF,CAAF;IACvG,MAAM,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAEhE,sCAAsC;IACtC,IAAI,KAAK,GAAG,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC;IAC/G,KAAK,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEhE,mCAAmC;IACnC,MAAM,eAAe,GAAG,oBAAU,CAAC,kBAAkB,EAAE,CAAC;IAExD,wDAAwD;IACxD,MAAM,cAAc,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;QAC9C,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,kBAAI,KAAK,EAAE,UAAU,EAAE,QAAQ,IAAK,OAAO,EAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QACnG,CAAC,CAAC,KAAK,CAAC;IAEZ,OAAO,CACH,4DAC6B,kBAAkB,2BACpB,IAAI,2BACJ,UAAU,8CACL,KAAK,EAAE,UAAU,EAAE,QAAQ,IAAK,OAAO,aAElE,cAAc,GACZ,CACV,CAAC;AACN,CAAC,CAAC;AAEF,sDAAsD;AACtD,gBAAgB,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;AAExD,kBAAe,gBAAgB,CAAC"}
|
|
@@ -2,11 +2,22 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
type VariableProps = {
|
|
3
3
|
children?: any;
|
|
4
4
|
name: string;
|
|
5
|
-
defaultValue?:
|
|
5
|
+
defaultValue?: any;
|
|
6
6
|
options?: Record<string, any>;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* DateVariable component formats and displays a date based on the current language settings.
|
|
10
|
+
* It converts different types of date inputs and formats them according to the locale.
|
|
11
|
+
*
|
|
12
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
13
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
14
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
15
|
+
* @param {number | Date | string} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
16
|
+
* @param {Record<string, any>} [props.options] - Options for date formatting.
|
|
17
|
+
* @returns {ReactNode} A span element containing the formatted date with specific data attributes
|
|
18
|
+
*/
|
|
8
19
|
declare const ClientDateVariable: {
|
|
9
|
-
({ children, name, defaultValue, options }
|
|
20
|
+
({ children, name, defaultValue, options }?: VariableProps): ReactNode;
|
|
10
21
|
gtTransformation: string;
|
|
11
22
|
};
|
|
12
23
|
export default ClientDateVariable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientDateVariable.d.ts","sourceRoot":"","sources":["../../../../src/primitives/variable/date/ClientDateVariable.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAIlD,KAAK,aAAa,GAAG;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ClientDateVariable.d.ts","sourceRoot":"","sources":["../../../../src/primitives/variable/date/ClientDateVariable.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAIlD,KAAK,aAAa,GAAG;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC,CAAA;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,kBAAkB;iDAA6D,aAAa,GAAsB,SAAS;;CAkChI,CAAC;AAKF,eAAe,kBAAkB,CAAC"}
|
|
@@ -4,12 +4,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const client_1 = require("../../../client");
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* DateVariable component formats and displays a date based on the current language settings.
|
|
9
|
+
* It converts different types of date inputs and formats them according to the locale.
|
|
10
|
+
*
|
|
11
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
12
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
13
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
14
|
+
* @param {number | Date | string} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
15
|
+
* @param {Record<string, any>} [props.options] - Options for date formatting.
|
|
16
|
+
* @returns {ReactNode} A span element containing the formatted date with specific data attributes
|
|
17
|
+
*/
|
|
18
|
+
const ClientDateVariable = ({ children, name = "date", defaultValue, options = {} } = { name: "date" }) => {
|
|
19
|
+
// Retrieve the current language using a custom hook
|
|
8
20
|
const currentLanguage = (0, client_1.useCurrentLanguage)();
|
|
21
|
+
// Memoize the formatted date value to optimize performance
|
|
9
22
|
const formattedValue = (0, react_1.useMemo)(() => {
|
|
10
23
|
let dateValue;
|
|
24
|
+
// Determine the default value to use
|
|
25
|
+
defaultValue = (typeof children !== 'undefined' && typeof defaultValue === 'undefined') ? children : defaultValue;
|
|
26
|
+
// Convert defaultValue to a Date object based on its type
|
|
11
27
|
if (typeof defaultValue === 'number') {
|
|
12
|
-
dateValue = new Date(defaultValue * 1000); //
|
|
28
|
+
dateValue = new Date(defaultValue * 1000); // Unix time in seconds
|
|
13
29
|
}
|
|
14
30
|
else if (typeof defaultValue === 'string') {
|
|
15
31
|
dateValue = new Date(defaultValue);
|
|
@@ -17,12 +33,16 @@ const ClientDateVariable = ({ children, name = "date", defaultValue, options = {
|
|
|
17
33
|
else if (defaultValue instanceof Date) {
|
|
18
34
|
dateValue = defaultValue;
|
|
19
35
|
}
|
|
36
|
+
// Return an empty string if dateValue is undefined
|
|
20
37
|
if (typeof dateValue === 'undefined')
|
|
21
38
|
return '';
|
|
22
|
-
|
|
39
|
+
// Format the date using Intl.DateTimeFormat or toLocaleString
|
|
40
|
+
return new Intl.DateTimeFormat(currentLanguage, options).format(dateValue) || dateValue.toLocaleString(currentLanguage, options) || '';
|
|
23
41
|
}, [children, defaultValue, options, currentLanguage]);
|
|
42
|
+
// Render the formatted date within a span element
|
|
24
43
|
return ((0, jsx_runtime_1.jsx)("span", { "data-gt-variable-name": name, "data-gt-variable-type": "date", "data-gt-variable-options": options, children: formattedValue }));
|
|
25
44
|
};
|
|
45
|
+
// Static property for transformation type
|
|
26
46
|
ClientDateVariable.gtTransformation = "variable-date";
|
|
27
47
|
exports.default = ClientDateVariable;
|
|
28
48
|
//# sourceMappingURL=ClientDateVariable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientDateVariable.js","sourceRoot":"","sources":["../../../../src/primitives/variable/date/ClientDateVariable.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;AAEZ,iCAAkD;AAClD,4CAAqD;AAUrD,MAAM,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"ClientDateVariable.js","sourceRoot":"","sources":["../../../../src/primitives/variable/date/ClientDateVariable.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;AAEZ,iCAAkD;AAClD,4CAAqD;AAUrD;;;;;;;;;;GAUG;AACH,MAAM,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE,KAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,EAAa,EAAE;IAEhI,oDAAoD;IACpD,MAAM,eAAe,GAAG,IAAA,2BAAkB,GAAE,CAAC;IAE7C,2DAA2D;IAC3D,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAChC,IAAI,SAA2B,CAAC;QAEhC,qCAAqC;QACrC,YAAY,GAAG,CAAC,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC;QAElH,0DAA0D;QAC1D,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YACnC,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,uBAAuB;QACtE,CAAC;aAAM,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC1C,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,YAAY,YAAY,IAAI,EAAE,CAAC;YACtC,SAAS,GAAG,YAAY,CAAC;QAC7B,CAAC;QAED,mDAAmD;QACnD,IAAI,OAAO,SAAS,KAAK,WAAW;YAAE,OAAO,EAAE,CAAC;QAEhD,8DAA8D;QAC9D,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,cAAc,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC3I,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IAEvD,kDAAkD;IAClD,OAAO,CACH,0DAA6B,IAAI,2BAAyB,MAAM,8BAA4B,OAAO,YAC9F,cAAc,GACZ,CACV,CAAC;AACN,CAAC,CAAC;AAEF,0CAA0C;AAC1C,kBAAkB,CAAC,gBAAgB,GAAG,eAAe,CAAC;AAEtD,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
type VariableProps = {
|
|
2
2
|
children?: any;
|
|
3
3
|
name: string;
|
|
4
|
-
defaultValue?:
|
|
4
|
+
defaultValue?: any;
|
|
5
5
|
options?: Record<string, any>;
|
|
6
6
|
"data-generaltranslation"?: Record<string, any> | undefined;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* DateVariable component formats and displays a date based on the current language settings.
|
|
10
|
+
* It converts different types of date inputs and formats them according to the locale.
|
|
11
|
+
*
|
|
12
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
13
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
14
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
15
|
+
* @param {number | Date | string} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
16
|
+
* @param {Record<string, any>} [props.options] - Options for date formatting.
|
|
17
|
+
* @returns {ReactNode} A span element containing the formatted date with specific data attributes
|
|
18
|
+
*/
|
|
8
19
|
declare const DateVariable: {
|
|
9
|
-
({ children, name, defaultValue, options, ...props }
|
|
20
|
+
({ children, name, defaultValue, options, ...props }?: VariableProps): JSX.Element;
|
|
10
21
|
gtTransformation: string;
|
|
11
22
|
};
|
|
12
23
|
export default DateVariable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateVariable.d.ts","sourceRoot":"","sources":["../../../../src/primitives/variable/date/DateVariable.tsx"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"DateVariable.d.ts","sourceRoot":"","sources":["../../../../src/primitives/variable/date/DateVariable.tsx"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,yBAAyB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CAC/D,CAAA;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,YAAY;2DAAuE,aAAa,GAAsB,GAAG,CAAC,OAAO;;CAsCtI,CAAC;AAKF,eAAe,YAAY,CAAC"}
|
|
@@ -16,14 +16,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
18
|
const I18NConfig_1 = __importDefault(require("../../../config/I18NConfig"));
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* DateVariable component formats and displays a date based on the current language settings.
|
|
21
|
+
* It converts different types of date inputs and formats them according to the locale.
|
|
22
|
+
*
|
|
23
|
+
* @param {VariableProps} props - The properties passed to the component
|
|
24
|
+
* @param {ReactNode} [props.children] - The child elements to be rendered if provided.
|
|
25
|
+
* @param {string} props.name - The name attribute for the variable.
|
|
26
|
+
* @param {number | Date | string} [props.defaultValue] - The default value to be rendered if children is not provided.
|
|
27
|
+
* @param {Record<string, any>} [props.options] - Options for date formatting.
|
|
28
|
+
* @returns {ReactNode} A span element containing the formatted date with specific data attributes
|
|
29
|
+
*/
|
|
30
|
+
const DateVariable = (_a = { name: "date" }) => {
|
|
20
31
|
var { children, name = "date", defaultValue, options = {} } = _a, props = __rest(_a, ["children", "name", "defaultValue", "options"]);
|
|
32
|
+
// Extract general translation data from props
|
|
21
33
|
const { "data-generaltranslation": generaltranslation } = props;
|
|
34
|
+
// Determine the default value to use
|
|
22
35
|
if (typeof children !== 'undefined' && typeof defaultValue === 'undefined') {
|
|
23
36
|
defaultValue = children;
|
|
24
37
|
}
|
|
38
|
+
// Retrieve the current language from the I18N configuration
|
|
25
39
|
const locale = I18NConfig_1.default.getCurrentLanguage();
|
|
26
|
-
// Convert defaultValue to a Date object if it's a Unix time, string or Date object
|
|
40
|
+
// Convert defaultValue to a Date object if it's a Unix time, string, or Date object
|
|
27
41
|
let dateValue;
|
|
28
42
|
if (typeof defaultValue === 'number') {
|
|
29
43
|
dateValue = new Date(defaultValue * 1000); // Assuming Unix time is in seconds
|
|
@@ -35,9 +49,11 @@ const DateVariable = (_a) => {
|
|
|
35
49
|
dateValue = defaultValue;
|
|
36
50
|
}
|
|
37
51
|
// Format the date according to the locale and options
|
|
38
|
-
const formattedValue = typeof dateValue !== 'undefined' ? (new Intl.DateTimeFormat(locale, options).format(dateValue) || dateValue.toLocaleString() || '') : '';
|
|
52
|
+
const formattedValue = typeof dateValue !== 'undefined' ? (new Intl.DateTimeFormat(locale, options).format(dateValue) || dateValue.toLocaleString(locale, options) || '') : '';
|
|
53
|
+
// Render the formatted date within a span element
|
|
39
54
|
return ((0, jsx_runtime_1.jsx)("span", { "data-generaltranslation": generaltranslation, "data-gt-variable-name": name, "data-gt-variable-type": "date", "data-gt-variable-options": options, children: formattedValue }));
|
|
40
55
|
};
|
|
56
|
+
// Static property for transformation type
|
|
41
57
|
DateVariable.gtTransformation = "variable-date";
|
|
42
58
|
exports.default = DateVariable;
|
|
43
59
|
//# sourceMappingURL=DateVariable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateVariable.js","sourceRoot":"","sources":["../../../../src/primitives/variable/date/DateVariable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,4EAAoD;AAWpD,MAAM,YAAY,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"DateVariable.js","sourceRoot":"","sources":["../../../../src/primitives/variable/date/DateVariable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,4EAAoD;AAWpD;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,CAAC,KAAmF,EAAE,IAAI,EAAE,MAAM,EAAE,EAAe,EAAE;QAApH,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,EAAE,OAA8C,EAAzC,KAAK,cAA/D,+CAAiE,CAAF;IAEjF,8CAA8C;IAC9C,MAAM,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAEhE,qCAAqC;IACrC,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;QACzE,YAAY,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,4DAA4D;IAC5D,MAAM,MAAM,GAAG,oBAAU,CAAC,kBAAkB,EAAE,CAAC;IAE/C,oFAAoF;IACpF,IAAI,SAA2B,CAAC;IAEhC,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QACnC,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,mCAAmC;IAClF,CAAC;SAAM,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC1C,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;SAAM,IAAI,YAAY,YAAY,IAAI,EAAE,CAAC;QACtC,SAAS,GAAG,YAAY,CAAC;IAC7B,CAAC;IAED,sDAAsD;IACtD,MAAM,cAAc,GAAG,OAAO,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/K,kDAAkD;IAClD,OAAO,CACH,4DAC6B,kBAAkB,2BACpB,IAAI,2BACJ,MAAM,8BACH,OAAO,YAEhC,cAAc,GACZ,CACV,CAAC;AACN,CAAC,CAAC;AAEF,0CAA0C;AAC1C,YAAY,CAAC,gBAAgB,GAAG,eAAe,CAAC;AAEhD,kBAAe,YAAY,CAAC"}
|