pds-dev-kit-web 2.2.195 → 2.2.196
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/src/core/pricing/translator.d.ts +1 -1
- package/dist/src/core/pricing/translator.js +1 -1
- package/dist/src/desktop/components/PriceTextLabel/PriceTextLabel.d.ts +2 -3
- package/dist/src/desktop/components/PriceTextLabel/PriceTextLabel.js +4 -2
- package/dist/src/mobile/components/PriceTextLabel/PriceTextLabel.d.ts +2 -3
- package/dist/src/mobile/components/PriceTextLabel/PriceTextLabel.js +4 -2
- package/package.json +1 -1
- package/release-note.md +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CurrencyCodeType, Price, TranslationType } from './types';
|
|
2
2
|
export interface PricingTranslateOptions {
|
|
3
3
|
friendly?: boolean;
|
|
4
|
-
|
|
4
|
+
translation?: TranslationType;
|
|
5
5
|
}
|
|
6
6
|
export declare class PricingTranslator {
|
|
7
7
|
private static browserLanguage;
|
|
@@ -29,7 +29,7 @@ var PricingTranslator = /** @class */ (function () {
|
|
|
29
29
|
PricingTranslator.currency = function (code, opts) {
|
|
30
30
|
var currency = types_1.CURRENCY_MAP[code];
|
|
31
31
|
if (opts === null || opts === void 0 ? void 0 : opts.friendly) {
|
|
32
|
-
return currency.friendlyName(opts.
|
|
32
|
+
return currency.friendlyName(opts.translation);
|
|
33
33
|
}
|
|
34
34
|
return currency.name;
|
|
35
35
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CurrencyCode, ExchangeRateMap, Price
|
|
2
|
+
import { CurrencyCode, ExchangeRateMap, Price } from '../../../core/pricing';
|
|
3
3
|
import type { TextLabelProps } from '../TextLabel/TextLabel';
|
|
4
4
|
type PriceTextLabelProps = Omit<TextLabelProps, 'text' | 'ellipsisMode' | 'lineLimit' | 'userSelectMode' | 'requirementMode' | 'bulletPointMode' | 'wordBreak'> & {
|
|
5
5
|
price: Price;
|
|
6
6
|
useFriendlyName?: 'none' | 'use';
|
|
7
7
|
useMinus?: 'none' | 'use';
|
|
8
|
-
translate?: TranslationType;
|
|
9
8
|
};
|
|
10
|
-
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode,
|
|
9
|
+
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, ...args }: PriceTextLabelProps & {
|
|
11
10
|
selectedCurrency?: CurrencyCode;
|
|
12
11
|
exchangeRates?: ExchangeRateMap;
|
|
13
12
|
userCountryCode?: string;
|
|
@@ -23,10 +23,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
var react_i18next_1 = require("react-i18next");
|
|
26
27
|
var pricing_1 = require("../../../core/pricing");
|
|
27
28
|
var TextLabel_1 = require("../TextLabel");
|
|
28
29
|
function PriceTextLabel(_a) {
|
|
29
|
-
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode,
|
|
30
|
+
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode"]);
|
|
31
|
+
var t = (0, react_i18next_1.useTranslation)('translation').t;
|
|
30
32
|
var targetPrice = price;
|
|
31
33
|
var formattedAmount = useMinus === 'use' ? "-".concat(targetPrice.amount) : targetPrice.amount;
|
|
32
34
|
var priceText = pricing_1.PricingService.translate.priceWithCurrency(exchangeRates && selectedCurrency
|
|
@@ -38,7 +40,7 @@ function PriceTextLabel(_a) {
|
|
|
38
40
|
: price.currency
|
|
39
41
|
}, {
|
|
40
42
|
friendly: useFriendlyName === 'use' ? true : false,
|
|
41
|
-
|
|
43
|
+
translation: t
|
|
42
44
|
});
|
|
43
45
|
return (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, __assign({}, args, { text: priceText }));
|
|
44
46
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CurrencyCode, ExchangeRateMap, Price
|
|
2
|
+
import { CurrencyCode, ExchangeRateMap, Price } from '../../../core/pricing';
|
|
3
3
|
import type { TextLabelProps } from '../TextLabel/TextLabel';
|
|
4
4
|
type PriceTextLabelProps = Omit<TextLabelProps, 'text' | 'ellipsisMode' | 'lineLimit' | 'userSelectMode' | 'requirementMode' | 'bulletPointMode' | 'wordBreak'> & {
|
|
5
5
|
price: Price;
|
|
6
6
|
useFriendlyName?: 'none' | 'use';
|
|
7
7
|
useMinus?: 'none' | 'use';
|
|
8
|
-
translate?: TranslationType;
|
|
9
8
|
};
|
|
10
|
-
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode,
|
|
9
|
+
declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, ...args }: PriceTextLabelProps & {
|
|
11
10
|
selectedCurrency?: CurrencyCode;
|
|
12
11
|
exchangeRates?: ExchangeRateMap;
|
|
13
12
|
userCountryCode?: string;
|
|
@@ -23,10 +23,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
var react_i18next_1 = require("react-i18next");
|
|
26
27
|
var pricing_1 = require("../../../core/pricing");
|
|
27
28
|
var TextLabel_1 = require("../TextLabel");
|
|
28
29
|
function PriceTextLabel(_a) {
|
|
29
|
-
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode,
|
|
30
|
+
var price = _a.price, _b = _a.useFriendlyName, useFriendlyName = _b === void 0 ? 'none' : _b, _c = _a.useMinus, useMinus = _c === void 0 ? 'none' : _c, selectedCurrency = _a.selectedCurrency, exchangeRates = _a.exchangeRates, userCountryCode = _a.userCountryCode, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode"]);
|
|
31
|
+
var t = (0, react_i18next_1.useTranslation)('translation').t;
|
|
30
32
|
var targetPrice = price;
|
|
31
33
|
var formattedAmount = useMinus === 'use' ? "-".concat(targetPrice.amount) : targetPrice.amount;
|
|
32
34
|
var priceText = pricing_1.PricingService.translate.priceWithCurrency(exchangeRates && selectedCurrency
|
|
@@ -38,7 +40,7 @@ function PriceTextLabel(_a) {
|
|
|
38
40
|
: price.currency
|
|
39
41
|
}, {
|
|
40
42
|
friendly: useFriendlyName === 'use' ? true : false,
|
|
41
|
-
|
|
43
|
+
translation: t
|
|
42
44
|
});
|
|
43
45
|
return (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, __assign({}, args, { text: priceText }));
|
|
44
46
|
}
|
package/package.json
CHANGED