pds-dev-kit-web 2.2.194 → 2.2.195

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.
@@ -40,6 +40,7 @@
40
40
  "str_please_enter_price": "Please enter the price.",
41
41
  "str_channel_min_price": "ex) {{channelMinPrice}}",
42
42
  "str_friendly_currency_won": "KRW",
43
+ "str_friendly_currency_jpy": "JPY",
43
44
  "str_friendly_currency_dollar": "USD"
44
45
  }
45
46
  }
@@ -40,6 +40,7 @@
40
40
  "str_please_enter_price": "Por favor, introduzca un precio.",
41
41
  "str_channel_min_price": "ex) {{channelMinPrice}}",
42
42
  "str_friendly_currency_won": "ganó",
43
+ "str_friendly_currency_jpy": "JPY",
43
44
  "str_friendly_currency_dollar": "dólares"
44
45
  }
45
46
  }
@@ -40,6 +40,7 @@
40
40
  "str_please_enter_price": "Mangyaring maglagay ng presyo.",
41
41
  "str_channel_min_price": "ex) {{channelMinPrice}}",
42
42
  "str_friendly_currency_won": "nalo",
43
+ "str_friendly_currency_jpy": "JPY",
43
44
  "str_friendly_currency_dollar": "dolyar"
44
45
  }
45
46
  }
@@ -41,6 +41,7 @@ declare const locale: {
41
41
  str_please_enter_price: string;
42
42
  str_channel_min_price: string;
43
43
  str_friendly_currency_won: string;
44
+ str_friendly_currency_jpy: string;
44
45
  str_friendly_currency_dollar: string;
45
46
  };
46
47
  };
@@ -86,6 +87,7 @@ declare const locale: {
86
87
  str_please_enter_price: string;
87
88
  str_channel_min_price: string;
88
89
  str_friendly_currency_won: string;
90
+ str_friendly_currency_jpy: string;
89
91
  str_friendly_currency_dollar: string;
90
92
  };
91
93
  };
@@ -131,6 +133,7 @@ declare const locale: {
131
133
  str_please_enter_price: string;
132
134
  str_channel_min_price: string;
133
135
  str_friendly_currency_won: string;
136
+ str_friendly_currency_jpy: string;
134
137
  str_friendly_currency_dollar: string;
135
138
  };
136
139
  };
@@ -176,6 +179,7 @@ declare const locale: {
176
179
  str_please_enter_price: string;
177
180
  str_channel_min_price: string;
178
181
  str_friendly_currency_won: string;
182
+ str_friendly_currency_jpy: string;
179
183
  str_friendly_currency_dollar: string;
180
184
  };
181
185
  };
@@ -221,6 +225,7 @@ declare const locale: {
221
225
  str_please_enter_price: string;
222
226
  str_channel_min_price: string;
223
227
  str_friendly_currency_won: string;
228
+ str_friendly_currency_jpy: string;
224
229
  str_friendly_currency_dollar: string;
225
230
  };
226
231
  };
@@ -266,6 +271,7 @@ declare const locale: {
266
271
  str_please_enter_price: string;
267
272
  str_channel_min_price: string;
268
273
  str_friendly_currency_won: string;
274
+ str_friendly_currency_jpy: string;
269
275
  str_friendly_currency_dollar: string;
270
276
  };
271
277
  };
@@ -311,6 +317,7 @@ declare const locale: {
311
317
  str_please_enter_price: string;
312
318
  str_channel_min_price: string;
313
319
  str_friendly_currency_won: string;
320
+ str_friendly_currency_jpy: string;
314
321
  str_friendly_currency_dollar: string;
315
322
  };
316
323
  };
@@ -40,6 +40,7 @@
40
40
  "str_please_enter_price": "価格を入力してください。",
41
41
  "str_channel_min_price": "ex) {{channelMinPrice}}",
42
42
  "str_friendly_currency_won": "ウォン",
43
+ "str_friendly_currency_jpy": "JPY",
43
44
  "str_friendly_currency_dollar": "ドル"
44
45
  }
45
46
  }
@@ -40,6 +40,7 @@
40
40
  "str_please_enter_price": "가격을 입력해 주세요.",
41
41
  "str_channel_min_price": "예) {{channelMinPrice}}",
42
42
  "str_friendly_currency_won": "원",
43
+ "str_friendly_currency_jpy": "엔",
43
44
  "str_friendly_currency_dollar": "달러"
44
45
  }
45
46
  }
@@ -40,6 +40,7 @@
40
40
  "str_please_enter_price": "请输入价格。",
41
41
  "str_channel_min_price": "ex) {{channelMinPrice}}",
42
42
  "str_friendly_currency_won": "韩元",
43
+ "str_friendly_currency_jpy": "JPY",
43
44
  "str_friendly_currency_dollar": "美元"
44
45
  }
45
46
  }
@@ -40,6 +40,7 @@
40
40
  "str_please_enter_price": "請輸入價格。",
41
41
  "str_channel_min_price": "ex) {{channelMinPrice}}",
42
42
  "str_friendly_currency_won": "韓元",
43
+ "str_friendly_currency_jpy": "JPY",
43
44
  "str_friendly_currency_dollar": "美元"
44
45
  }
45
46
  }
@@ -1,6 +1,7 @@
1
- import type { CurrencyCodeType, Price } from './types';
1
+ import type { CurrencyCodeType, Price, TranslationType } from './types';
2
2
  export interface PricingTranslateOptions {
3
3
  friendly?: boolean;
4
+ translate?: TranslationType;
4
5
  }
5
6
  export declare class PricingTranslator {
6
7
  private static browserLanguage;
@@ -28,7 +28,10 @@ var PricingTranslator = /** @class */ (function () {
28
28
  */
29
29
  PricingTranslator.currency = function (code, opts) {
30
30
  var currency = types_1.CURRENCY_MAP[code];
31
- return (opts === null || opts === void 0 ? void 0 : opts.friendly) ? currency.friendlyName() : currency.name;
31
+ if (opts === null || opts === void 0 ? void 0 : opts.friendly) {
32
+ return currency.friendlyName(opts.translate);
33
+ }
34
+ return currency.name;
32
35
  };
33
36
  /**
34
37
  * 포맷된 금액과 통화 문자열을 결합합니다
@@ -4,10 +4,11 @@ export declare enum CurrencyCode {
4
4
  JPY = "JPY"
5
5
  }
6
6
  export type CurrencyCodeType = CurrencyCode | string;
7
+ export type TranslationType = (key: string) => string;
7
8
  export interface Currency {
8
9
  code: CurrencyCode;
9
10
  name: string;
10
- friendlyName: () => string;
11
+ friendlyName: (translate?: TranslationType) => string;
11
12
  decimalDigits: number;
12
13
  }
13
14
  export declare const CURRENCY_MAP: Record<CurrencyCode, Currency>;
@@ -1,34 +1,31 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  var _a;
6
3
  Object.defineProperty(exports, "__esModule", { value: true });
7
4
  exports.CURRENCY_MAP = exports.CurrencyCode = void 0;
8
- var i18next_1 = __importDefault(require("i18next"));
9
5
  var CurrencyCode;
10
6
  (function (CurrencyCode) {
11
7
  CurrencyCode["KRW"] = "KRW";
12
8
  CurrencyCode["USD"] = "USD";
13
9
  CurrencyCode["JPY"] = "JPY";
14
10
  })(CurrencyCode = exports.CurrencyCode || (exports.CurrencyCode = {}));
11
+ var translateFriendlyName = function (key) { return function (t) { var _a; return (_a = t === null || t === void 0 ? void 0 : t(key)) !== null && _a !== void 0 ? _a : key; }; };
15
12
  exports.CURRENCY_MAP = (_a = {},
16
13
  _a[CurrencyCode.KRW] = {
17
14
  code: CurrencyCode.KRW,
18
15
  name: CurrencyCode.KRW,
19
- friendlyName: function () { return i18next_1.default.t('str_friendly_currency_won'); },
16
+ friendlyName: translateFriendlyName('str_friendly_currency_won'),
20
17
  decimalDigits: 0
21
18
  },
22
19
  _a[CurrencyCode.USD] = {
23
20
  code: CurrencyCode.USD,
24
21
  name: CurrencyCode.USD,
25
- friendlyName: function () { return i18next_1.default.t('str_friendly_currency_dollar'); },
22
+ friendlyName: translateFriendlyName('str_friendly_currency_dollar'),
26
23
  decimalDigits: 2
27
24
  },
28
25
  _a[CurrencyCode.JPY] = {
29
26
  code: CurrencyCode.JPY,
30
27
  name: CurrencyCode.JPY,
31
- friendlyName: function () { return i18next_1.default.t('str_friendly_currency_jpy'); },
28
+ friendlyName: translateFriendlyName('str_friendly_currency_jpy'),
32
29
  decimalDigits: 0
33
30
  },
34
31
  _a);
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { CurrencyCode, ExchangeRateMap, Price } from '../../../core/pricing';
2
+ import { CurrencyCode, ExchangeRateMap, Price, TranslationType } 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;
8
9
  };
9
- declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, ...args }: PriceTextLabelProps & {
10
+ declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, translate, ...args }: PriceTextLabelProps & {
10
11
  selectedCurrency?: CurrencyCode;
11
12
  exchangeRates?: ExchangeRateMap;
12
13
  userCountryCode?: string;
@@ -26,7 +26,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
26
26
  var pricing_1 = require("../../../core/pricing");
27
27
  var TextLabel_1 = require("../TextLabel");
28
28
  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, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode"]);
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, translate = _a.translate, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode", "translate"]);
30
30
  var targetPrice = price;
31
31
  var formattedAmount = useMinus === 'use' ? "-".concat(targetPrice.amount) : targetPrice.amount;
32
32
  var priceText = pricing_1.PricingService.translate.priceWithCurrency(exchangeRates && selectedCurrency
@@ -37,7 +37,8 @@ function PriceTextLabel(_a) {
37
37
  ? pricing_1.PricingService.getDefaultPreferredCurrency(userCountryCode.toLocaleLowerCase())
38
38
  : price.currency
39
39
  }, {
40
- friendly: useFriendlyName === 'use' ? true : false
40
+ friendly: useFriendlyName === 'use' ? true : false,
41
+ translate: translate
41
42
  });
42
43
  return (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, __assign({}, args, { text: priceText }));
43
44
  }
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { CurrencyCode, ExchangeRateMap, Price } from '../../../core/pricing';
2
+ import { CurrencyCode, ExchangeRateMap, Price, TranslationType } 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;
8
9
  };
9
- declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, ...args }: PriceTextLabelProps & {
10
+ declare function PriceTextLabel({ price, useFriendlyName, useMinus, selectedCurrency, exchangeRates, userCountryCode, translate, ...args }: PriceTextLabelProps & {
10
11
  selectedCurrency?: CurrencyCode;
11
12
  exchangeRates?: ExchangeRateMap;
12
13
  userCountryCode?: string;
@@ -26,7 +26,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
26
26
  var pricing_1 = require("../../../core/pricing");
27
27
  var TextLabel_1 = require("../TextLabel");
28
28
  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, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode"]);
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, translate = _a.translate, args = __rest(_a, ["price", "useFriendlyName", "useMinus", "selectedCurrency", "exchangeRates", "userCountryCode", "translate"]);
30
30
  var targetPrice = price;
31
31
  var formattedAmount = useMinus === 'use' ? "-".concat(targetPrice.amount) : targetPrice.amount;
32
32
  var priceText = pricing_1.PricingService.translate.priceWithCurrency(exchangeRates && selectedCurrency
@@ -37,7 +37,8 @@ function PriceTextLabel(_a) {
37
37
  ? pricing_1.PricingService.getDefaultPreferredCurrency(userCountryCode.toLocaleLowerCase())
38
38
  : price.currency
39
39
  }, {
40
- friendly: useFriendlyName === 'use' ? true : false
40
+ friendly: useFriendlyName === 'use' ? true : false,
41
+ translate: translate
41
42
  });
42
43
  return (0, jsx_runtime_1.jsx)(TextLabel_1.TextLabel, __assign({}, args, { text: priceText }));
43
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web",
3
- "version": "2.2.194",
3
+ "version": "2.2.195",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
package/release-note.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # PDS-DEV-KIT-WEB Release Notes
2
- ## [v2.2.194]
2
+ ## [v2.2.195]
3
3
  ## daily|https://design.storybook.publ.biz/
4
4
 
5
5
  ### 업데이트 사항
6
- * [PDS-1320] PriceTextField 컴포넌트 추가
7
- * [PDS-1321] PriceTextLabel 컴포넌트 추가
6
+ * [FIX] PriceTextLabel translate 함수 추가
8
7