@razorpay/blade 9.5.3 → 9.6.0

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.
@@ -25945,33 +25945,406 @@ var amountLineHeights = {
25945
25945
  'heading-large-bold': 400,
25946
25946
  'title-small': 500,
25947
25947
  'title-medium': 600
25948
- };
25948
+ }; // All the supported currency codes are taken from Razorpay's Merchant Dashboard codebase
25949
+
25949
25950
  var currencyPrefixMapping = {
25951
+ AED: {
25952
+ 'currency-symbol': 'د.إ',
25953
+ 'currency-code': 'AED'
25954
+ },
25955
+ ALL: {
25956
+ 'currency-symbol': 'Lek',
25957
+ 'currency-code': 'ALL'
25958
+ },
25959
+ AMD: {
25960
+ 'currency-symbol': '֏',
25961
+ 'currency-code': 'AMD'
25962
+ },
25963
+ ARS: {
25964
+ 'currency-symbol': 'ARS',
25965
+ 'currency-code': 'ARS'
25966
+ },
25967
+ AUD: {
25968
+ 'currency-symbol': 'A$',
25969
+ 'currency-code': 'AUD'
25970
+ },
25971
+ AWG: {
25972
+ 'currency-symbol': 'Afl.',
25973
+ 'currency-code': 'AWG'
25974
+ },
25975
+ BBD: {
25976
+ 'currency-symbol': '$',
25977
+ 'currency-code': 'BBD'
25978
+ },
25979
+ BDT: {
25980
+ 'currency-symbol': '৳',
25981
+ 'currency-code': 'BDT'
25982
+ },
25983
+ BMD: {
25984
+ 'currency-symbol': '$',
25985
+ 'currency-code': 'BMD'
25986
+ },
25987
+ BND: {
25988
+ 'currency-symbol': 'BND',
25989
+ 'currency-code': 'BND'
25990
+ },
25991
+ BOB: {
25992
+ 'currency-symbol': 'Bs',
25993
+ 'currency-code': 'BOB'
25994
+ },
25995
+ BSD: {
25996
+ 'currency-symbol': 'B$',
25997
+ 'currency-code': 'BSD'
25998
+ },
25999
+ BWP: {
26000
+ 'currency-symbol': 'P',
26001
+ 'currency-code': 'BWP'
26002
+ },
26003
+ BZD: {
26004
+ 'currency-symbol': 'BZ$',
26005
+ 'currency-code': 'BZD'
26006
+ },
26007
+ CAD: {
26008
+ 'currency-symbol': 'C$',
26009
+ 'currency-code': 'CAD'
26010
+ },
26011
+ CHF: {
26012
+ 'currency-symbol': 'CHf',
26013
+ 'currency-code': 'CHF'
26014
+ },
26015
+ CNY: {
26016
+ 'currency-symbol': '¥',
26017
+ 'currency-code': 'CNY'
26018
+ },
26019
+ COP: {
26020
+ 'currency-symbol': 'COL$',
26021
+ 'currency-code': 'COP'
26022
+ },
26023
+ CRC: {
26024
+ 'currency-symbol': '₡',
26025
+ 'currency-code': 'CRC'
26026
+ },
26027
+ CUP: {
26028
+ 'currency-symbol': '$MN',
26029
+ 'currency-code': 'CUP'
26030
+ },
26031
+ CZK: {
26032
+ 'currency-symbol': 'Kč',
26033
+ 'currency-code': 'CZK'
26034
+ },
26035
+ DKK: {
26036
+ 'currency-symbol': 'DKK',
26037
+ 'currency-code': 'DKK'
26038
+ },
26039
+ DOP: {
26040
+ 'currency-symbol': 'RD$',
26041
+ 'currency-code': 'DOP'
26042
+ },
26043
+ DZD: {
26044
+ 'currency-symbol': 'د.ج',
26045
+ 'currency-code': 'DZD'
26046
+ },
26047
+ EGP: {
26048
+ 'currency-symbol': 'E£',
26049
+ 'currency-code': 'EGP'
26050
+ },
26051
+ ETB: {
26052
+ 'currency-symbol': 'ብር',
26053
+ 'currency-code': 'ETB'
26054
+ },
26055
+ EUR: {
26056
+ 'currency-symbol': '€',
26057
+ 'currency-code': 'EUR'
26058
+ },
26059
+ FJD: {
26060
+ 'currency-symbol': 'FJ$',
26061
+ 'currency-code': 'FJD'
26062
+ },
26063
+ GBP: {
26064
+ 'currency-symbol': '£',
26065
+ 'currency-code': 'GBP'
26066
+ },
26067
+ GHS: {
26068
+ 'currency-symbol': 'GH₵',
26069
+ 'currency-code': 'GHS'
26070
+ },
26071
+ GIP: {
26072
+ 'currency-symbol': 'GIP',
26073
+ 'currency-code': 'GIP'
26074
+ },
26075
+ GMD: {
26076
+ 'currency-symbol': 'D',
26077
+ 'currency-code': 'GMD'
26078
+ },
26079
+ GTQ: {
26080
+ 'currency-symbol': 'Q',
26081
+ 'currency-code': 'GTQ'
26082
+ },
26083
+ GYD: {
26084
+ 'currency-symbol': 'G$',
26085
+ 'currency-code': 'GYD'
26086
+ },
26087
+ HKD: {
26088
+ 'currency-symbol': 'HK$',
26089
+ 'currency-code': 'HKD'
26090
+ },
26091
+ HNL: {
26092
+ 'currency-symbol': 'HNL',
26093
+ 'currency-code': 'HNL'
26094
+ },
26095
+ HRK: {
26096
+ 'currency-symbol': 'kn',
26097
+ 'currency-code': 'HRK'
26098
+ },
26099
+ HTG: {
26100
+ 'currency-symbol': 'G',
26101
+ 'currency-code': 'HTG'
26102
+ },
26103
+ HUF: {
26104
+ 'currency-symbol': 'Ft',
26105
+ 'currency-code': 'HUF'
26106
+ },
26107
+ IDR: {
26108
+ 'currency-symbol': 'Rp',
26109
+ 'currency-code': 'IDR'
26110
+ },
26111
+ ILS: {
26112
+ 'currency-symbol': '₪',
26113
+ 'currency-code': 'ILS'
26114
+ },
25950
26115
  INR: {
25951
26116
  'currency-symbol': '₹',
25952
26117
  'currency-code': 'INR'
25953
26118
  },
26119
+ JMD: {
26120
+ 'currency-symbol': 'J$',
26121
+ 'currency-code': 'JMD'
26122
+ },
26123
+ KES: {
26124
+ 'currency-symbol': 'Ksh',
26125
+ 'currency-code': 'KES'
26126
+ },
26127
+ KGS: {
26128
+ 'currency-symbol': 'Лв',
26129
+ 'currency-code': 'KGS'
26130
+ },
26131
+ KHR: {
26132
+ 'currency-symbol': '៛',
26133
+ 'currency-code': 'KHR'
26134
+ },
26135
+ KYD: {
26136
+ 'currency-symbol': 'CI$',
26137
+ 'currency-code': 'KYD'
26138
+ },
26139
+ KZT: {
26140
+ 'currency-symbol': '₸',
26141
+ 'currency-code': 'KZT'
26142
+ },
26143
+ LAK: {
26144
+ 'currency-symbol': '₭',
26145
+ 'currency-code': 'LAK'
26146
+ },
26147
+ LKR: {
26148
+ 'currency-symbol': 'රු',
26149
+ 'currency-code': 'LKR'
26150
+ },
26151
+ LRD: {
26152
+ 'currency-symbol': 'L$',
26153
+ 'currency-code': 'LRD'
26154
+ },
26155
+ LSL: {
26156
+ 'currency-symbol': 'LSL',
26157
+ 'currency-code': 'LSL'
26158
+ },
26159
+ MAD: {
26160
+ 'currency-symbol': 'د.م.',
26161
+ 'currency-code': 'MAD'
26162
+ },
26163
+ MDL: {
26164
+ 'currency-symbol': 'MDL',
26165
+ 'currency-code': 'MDL'
26166
+ },
26167
+ MKD: {
26168
+ 'currency-symbol': 'ден',
26169
+ 'currency-code': 'MKD'
26170
+ },
26171
+ MMK: {
26172
+ 'currency-symbol': 'MMK',
26173
+ 'currency-code': 'MMK'
26174
+ },
26175
+ MNT: {
26176
+ 'currency-symbol': '₮',
26177
+ 'currency-code': 'MNT'
26178
+ },
26179
+ MOP: {
26180
+ 'currency-symbol': 'MOP$',
26181
+ 'currency-code': 'MOP'
26182
+ },
26183
+ MUR: {
26184
+ 'currency-symbol': '₨',
26185
+ 'currency-code': 'MUR'
26186
+ },
26187
+ MVR: {
26188
+ 'currency-symbol': 'Rf',
26189
+ 'currency-code': 'MVR'
26190
+ },
26191
+ MWK: {
26192
+ 'currency-symbol': 'MK',
26193
+ 'currency-code': 'MWK'
26194
+ },
26195
+ MXN: {
26196
+ 'currency-symbol': 'Mex$',
26197
+ 'currency-code': 'MXN'
26198
+ },
25954
26199
  MYR: {
25955
26200
  'currency-symbol': 'RM',
25956
26201
  'currency-code': 'MYR'
26202
+ },
26203
+ NAD: {
26204
+ 'currency-symbol': 'N$',
26205
+ 'currency-code': 'NAD'
26206
+ },
26207
+ NGN: {
26208
+ 'currency-symbol': '₦',
26209
+ 'currency-code': 'NGN'
26210
+ },
26211
+ NIO: {
26212
+ 'currency-symbol': 'NIO',
26213
+ 'currency-code': 'NIO'
26214
+ },
26215
+ NOK: {
26216
+ 'currency-symbol': 'NOK',
26217
+ 'currency-code': 'NOK'
26218
+ },
26219
+ NPR: {
26220
+ 'currency-symbol': 'रू',
26221
+ 'currency-code': 'NPR'
26222
+ },
26223
+ NZD: {
26224
+ 'currency-symbol': 'NZ$',
26225
+ 'currency-code': 'NZD'
26226
+ },
26227
+ PEN: {
26228
+ 'currency-symbol': 'S/',
26229
+ 'currency-code': 'PEN'
26230
+ },
26231
+ PGK: {
26232
+ 'currency-symbol': 'PGK',
26233
+ 'currency-code': 'PGK'
26234
+ },
26235
+ PHP: {
26236
+ 'currency-symbol': '₱',
26237
+ 'currency-code': 'PHP'
26238
+ },
26239
+ PKR: {
26240
+ 'currency-symbol': '₨',
26241
+ 'currency-code': 'PKR'
26242
+ },
26243
+ QAR: {
26244
+ 'currency-symbol': 'QR',
26245
+ 'currency-code': 'QAR'
26246
+ },
26247
+ RUB: {
26248
+ 'currency-symbol': '₽',
26249
+ 'currency-code': 'RUB'
26250
+ },
26251
+ SAR: {
26252
+ 'currency-symbol': 'SR',
26253
+ 'currency-code': 'SAR'
26254
+ },
26255
+ SCR: {
26256
+ 'currency-symbol': 'SRe',
26257
+ 'currency-code': 'SCR'
26258
+ },
26259
+ SEK: {
26260
+ 'currency-symbol': 'SEK',
26261
+ 'currency-code': 'SEK'
26262
+ },
26263
+ SGD: {
26264
+ 'currency-symbol': 'S$',
26265
+ 'currency-code': 'SGD'
26266
+ },
26267
+ SLL: {
26268
+ 'currency-symbol': 'Le',
26269
+ 'currency-code': 'SLL'
26270
+ },
26271
+ SOS: {
26272
+ 'currency-symbol': 'Sh.so.',
26273
+ 'currency-code': 'SOS'
26274
+ },
26275
+ SSP: {
26276
+ 'currency-symbol': 'SS£',
26277
+ 'currency-code': 'SSP'
26278
+ },
26279
+ SVC: {
26280
+ 'currency-symbol': '₡',
26281
+ 'currency-code': 'SVC'
26282
+ },
26283
+ SZL: {
26284
+ 'currency-symbol': 'E',
26285
+ 'currency-code': 'SZL'
26286
+ },
26287
+ THB: {
26288
+ 'currency-symbol': '฿',
26289
+ 'currency-code': 'THB'
26290
+ },
26291
+ TTD: {
26292
+ 'currency-symbol': 'TT$',
26293
+ 'currency-code': 'TTD'
26294
+ },
26295
+ TZS: {
26296
+ 'currency-symbol': 'Sh',
26297
+ 'currency-code': 'TZS'
26298
+ },
26299
+ USD: {
26300
+ 'currency-symbol': '$',
26301
+ 'currency-code': 'USD'
26302
+ },
26303
+ UYU: {
26304
+ 'currency-symbol': '$U',
26305
+ 'currency-code': 'UYU'
26306
+ },
26307
+ UZS: {
26308
+ 'currency-symbol': "so'm",
26309
+ 'currency-code': 'UZS'
26310
+ },
26311
+ YER: {
26312
+ 'currency-symbol': '﷼',
26313
+ 'currency-code': 'YER'
26314
+ },
26315
+ ZAR: {
26316
+ 'currency-symbol': 'R',
26317
+ 'currency-code': 'ZAR'
26318
+ },
26319
+ KWD: {
26320
+ 'currency-symbol': 'د.ك',
26321
+ 'currency-code': 'KWD'
26322
+ },
26323
+ BHD: {
26324
+ 'currency-symbol': 'د.ب.',
26325
+ 'currency-code': 'BHD'
26326
+ },
26327
+ OMR: {
26328
+ 'currency-symbol': 'ر.ع.',
26329
+ 'currency-code': 'OMR'
25957
26330
  }
25958
26331
  };
25959
- var currencyLocaleMapping = {
25960
- INR: 'en-IN',
25961
- MYR: 'en-MY'
25962
- };
25963
- var currencyAbbreviationsMapping = {
25964
- INR: [{
25965
- value: 1e7,
25966
- symbol: 'Cr'
25967
- }, {
25968
- value: 1e5,
25969
- symbol: 'L'
25970
- }, {
25971
- value: 1e3,
25972
- symbol: 'k'
25973
- }],
25974
- MYR: [{
26332
+
26333
+ var getCurrencyAbbreviations = function getCurrencyAbbreviations(currency) {
26334
+ if (currency === 'INR') {
26335
+ return [{
26336
+ value: 1e7,
26337
+ symbol: 'Cr'
26338
+ }, {
26339
+ value: 1e5,
26340
+ symbol: 'L'
26341
+ }, {
26342
+ value: 1e3,
26343
+ symbol: 'k'
26344
+ }];
26345
+ }
26346
+
26347
+ return [{
25975
26348
  value: 1e9,
25976
26349
  symbol: 'B'
25977
26350
  }, {
@@ -25980,7 +26353,7 @@ var currencyAbbreviationsMapping = {
25980
26353
  }, {
25981
26354
  value: 1e3,
25982
26355
  symbol: 'K'
25983
- }]
26356
+ }];
25984
26357
  };
25985
26358
 
25986
26359
  var _excluded$3 = ["value", "suffix", "size", "isAffixSubtle", "intent", "prefix", "testID", "currency"];
@@ -26055,7 +26428,9 @@ var getFlooredFixed = function getFlooredFixed(value, decimalPlaces) {
26055
26428
  };
26056
26429
  var addCommas = function addCommas(amountValue, currency) {
26057
26430
  var decimalPlaces = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
26058
- var locale = currencyLocaleMapping[currency];
26431
+ // If the currency is 'INR', set the locale to 'en-IN' (Indian English).
26432
+ // Otherwise, set the locale to 'en-US' (U.S. English).
26433
+ var locale = currency === 'INR' ? 'en-IN' : 'en-US';
26059
26434
  return amountValue.toLocaleString(locale, {
26060
26435
  minimumFractionDigits: decimalPlaces
26061
26436
  });
@@ -26067,7 +26442,7 @@ var addCommas = function addCommas(amountValue, currency) {
26067
26442
  */
26068
26443
 
26069
26444
  var getHumanizedAmount = function getHumanizedAmount(amountValue, currency) {
26070
- var abbreviations = currencyAbbreviationsMapping[currency];
26445
+ var abbreviations = getCurrencyAbbreviations(currency);
26071
26446
  var abbreviation = abbreviations.find(function (abbr) {
26072
26447
  return amountValue >= abbr.value;
26073
26448
  });