@commercelayer/react-components 4.28.4-beta.1 → 4.28.5-beta.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.
Files changed (39) hide show
  1. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
  2. package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -1
  3. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
  4. package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
  5. package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +1 -1
  6. package/lib/cjs/components/orders/GiftCardAmount.d.ts +1 -1
  7. package/lib/cjs/components/orders/GiftCardAmount.js +1 -1
  8. package/lib/cjs/components/orders/OrderContainer.d.ts +0 -4
  9. package/lib/cjs/components/orders/OrderContainer.js +1 -1
  10. package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
  11. package/lib/cjs/components/orders/TotalAmount.d.ts +1 -1
  12. package/lib/cjs/components/orders/TotalAmount.js +1 -1
  13. package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
  14. package/lib/cjs/reducers/AddressReducer.js +1 -1
  15. package/lib/cjs/reducers/OrderReducer.d.ts +1 -1
  16. package/lib/cjs/utils/adyen/manageGiftCard.js +1 -1
  17. package/lib/cjs/utils/currencies.d.ts +2918 -0
  18. package/lib/cjs/utils/currencies.js +2 -0
  19. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +1 -1
  20. package/lib/esm/components/gift_cards/GiftCardOrCouponCode.js +1 -1
  21. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +3 -3
  22. package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
  23. package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +1 -1
  24. package/lib/esm/components/orders/GiftCardAmount.d.ts +1 -1
  25. package/lib/esm/components/orders/GiftCardAmount.js +1 -1
  26. package/lib/esm/components/orders/OrderContainer.d.ts +0 -4
  27. package/lib/esm/components/orders/OrderContainer.js +1 -1
  28. package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
  29. package/lib/esm/components/orders/TotalAmount.d.ts +1 -1
  30. package/lib/esm/components/orders/TotalAmount.js +1 -1
  31. package/lib/esm/components/payment_source/AdyenPayment.js +1 -1
  32. package/lib/esm/reducers/AddressReducer.js +1 -1
  33. package/lib/esm/reducers/OrderReducer.d.ts +1 -1
  34. package/lib/esm/utils/adyen/manageGiftCard.js +1 -1
  35. package/lib/esm/utils/currencies.d.ts +2918 -0
  36. package/lib/esm/utils/currencies.js +2 -0
  37. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  38. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  39. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.currencies=void 0,exports.getCurrency=getCurrency,exports.getDecimalLength=getDecimalLength,exports.addCurrencySymbol=addCurrencySymbol,exports.makePlaceholder=makePlaceholder,exports.formatCentsToCurrency=formatCentsToCurrency;const isoCurrencies={aed:{priority:100,iso_code:"AED",name:"United Arab Emirates Dirham",symbol:"\u062F.\u0625",alternate_symbols:["DH","Dhs"],subunit:"Fils",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"784",smallest_denomination:25},afn:{priority:100,iso_code:"AFN",name:"Afghan Afghani",symbol:"\u060B",alternate_symbols:["Af","Afs"],subunit:"Pul",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"971",smallest_denomination:100},all:{priority:100,iso_code:"ALL",name:"Albanian Lek",symbol:"L",disambiguate_symbol:"Lek",alternate_symbols:["Lek"],subunit:"Qintar",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"008",smallest_denomination:100},amd:{priority:100,iso_code:"AMD",name:"Armenian Dram",symbol:"\u0564\u0580.",alternate_symbols:["dram"],subunit:"Luma",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"051",smallest_denomination:10},ang:{priority:100,iso_code:"ANG",name:"Netherlands Antillean Gulden",symbol:"\u0192",alternate_symbols:["NA\u0192","NAf","f"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"ƒ",decimal_mark:",",thousands_separator:".",iso_numeric:"532",smallest_denomination:1},aoa:{priority:100,iso_code:"AOA",name:"Angolan Kwanza",symbol:"Kz",alternate_symbols:[],subunit:"C\xEAntimo",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"973",smallest_denomination:10},ars:{priority:100,iso_code:"ARS",name:"Argentine Peso",symbol:"$",disambiguate_symbol:"$m/n",alternate_symbols:["$m/n","m$n"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:",",thousands_separator:".",iso_numeric:"032",smallest_denomination:1},aud:{priority:4,iso_code:"AUD",name:"Australian Dollar",symbol:"$",disambiguate_symbol:"A$",alternate_symbols:["A$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"036",smallest_denomination:5},awg:{priority:100,iso_code:"AWG",name:"Aruban Florin",symbol:"\u0192",alternate_symbols:["Afl"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"ƒ",decimal_mark:".",thousands_separator:",",iso_numeric:"533",smallest_denomination:5},azn:{priority:100,iso_code:"AZN",name:"Azerbaijani Manat",symbol:"\u20BC",alternate_symbols:["m","man"],subunit:"Q\u0259pik",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"944",smallest_denomination:1},bam:{priority:100,iso_code:"BAM",name:"Bosnia and Herzegovina Convertible Mark",symbol:"\u041A\u041C",alternate_symbols:["KM"],subunit:"Fening",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"977",smallest_denomination:5},bbd:{priority:100,iso_code:"BBD",name:"Barbadian Dollar",symbol:"$",disambiguate_symbol:"Bds$",alternate_symbols:["Bds$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"052",smallest_denomination:1},bdt:{priority:100,iso_code:"BDT",name:"Bangladeshi Taka",symbol:"\u09F3",alternate_symbols:["Tk"],subunit:"Paisa",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"050",smallest_denomination:1},bgn:{priority:100,iso_code:"BGN",name:"Bulgarian Lev",symbol:"\u043B\u0432.",alternate_symbols:["lev","leva","\u043B\u0435\u0432","\u043B\u0435\u0432\u0430"],subunit:"Stotinka",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"975",smallest_denomination:1},bhd:{priority:100,iso_code:"BHD",name:"Bahraini Dinar",symbol:"\u062F.\u0628",alternate_symbols:["BD"],subunit:"Fils",subunit_to_unit:1e3,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"048",smallest_denomination:5},bif:{priority:100,iso_code:"BIF",name:"Burundian Franc",symbol:"Fr",disambiguate_symbol:"FBu",alternate_symbols:["FBu"],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"108",smallest_denomination:100},bmd:{priority:100,iso_code:"BMD",name:"Bermudian Dollar",symbol:"$",disambiguate_symbol:"BD$",alternate_symbols:["BD$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"060",smallest_denomination:1},bnd:{priority:100,iso_code:"BND",name:"Brunei Dollar",symbol:"$",disambiguate_symbol:"BND",alternate_symbols:["B$"],subunit:"Sen",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"096",smallest_denomination:1},bob:{priority:100,iso_code:"BOB",name:"Bolivian Boliviano",symbol:"Bs.",alternate_symbols:["Bs"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"068",smallest_denomination:10},brl:{priority:100,iso_code:"BRL",name:"Brazilian Real",symbol:"R$",subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"R$",decimal_mark:",",thousands_separator:".",iso_numeric:"986",smallest_denomination:5},bsd:{priority:100,iso_code:"BSD",name:"Bahamian Dollar",symbol:"$",disambiguate_symbol:"BSD",alternate_symbols:["B$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"044",smallest_denomination:1},btn:{priority:100,iso_code:"BTN",name:"Bhutanese Ngultrum",symbol:"Nu.",alternate_symbols:["Nu"],subunit:"Chertrum",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"064",smallest_denomination:5},bwp:{priority:100,iso_code:"BWP",name:"Botswana Pula",symbol:"P",alternate_symbols:[],subunit:"Thebe",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"072",smallest_denomination:5},byn:{priority:100,iso_code:"BYN",name:"Belarusian Ruble",symbol:"Br",disambiguate_symbol:"BYN",alternate_symbols:["\u0431\u0435\u043B. \u0440\u0443\u0431.","\u0431.\u0440.","\u0440\u0443\u0431.","\u0440."],subunit:"Kapeyka",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:" ",iso_numeric:"933",smallest_denomination:1},byr:{priority:50,iso_code:"BYR",name:"Belarusian Ruble",symbol:"Br",disambiguate_symbol:"BYR",alternate_symbols:["\u0431\u0435\u043B. \u0440\u0443\u0431.","\u0431.\u0440.","\u0440\u0443\u0431.","\u0440."],subunit:null,subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:" ",iso_numeric:"974",smallest_denomination:100},bzd:{priority:100,iso_code:"BZD",name:"Belize Dollar",symbol:"$",disambiguate_symbol:"BZ$",alternate_symbols:["BZ$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"084",smallest_denomination:1},cad:{priority:5,iso_code:"CAD",name:"Canadian Dollar",symbol:"$",disambiguate_symbol:"C$",alternate_symbols:["C$","CAD$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"124",smallest_denomination:5},cdf:{priority:100,iso_code:"CDF",name:"Congolese Franc",symbol:"Fr",disambiguate_symbol:"FC",alternate_symbols:["FC"],subunit:"Centime",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"976",smallest_denomination:1},chf:{priority:100,iso_code:"CHF",name:"Swiss Franc",symbol:"CHF",alternate_symbols:["SFr","Fr"],subunit:"Rappen",subunit_to_unit:100,symbol_first:!0,format:"%u%n",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"756",smallest_denomination:5},clf:{priority:100,iso_code:"CLF",name:"Unidad de Fomento",symbol:"UF",alternate_symbols:[],subunit:"Peso",subunit_to_unit:1e4,symbol_first:!0,html_entity:"₱",decimal_mark:",",thousands_separator:".",iso_numeric:"990"},clp:{priority:100,iso_code:"CLP",name:"Chilean Peso",symbol:"$",disambiguate_symbol:"CLP",alternate_symbols:[],subunit:"Peso",subunit_to_unit:1,symbol_first:!0,html_entity:"$",decimal_mark:",",thousands_separator:".",iso_numeric:"152",smallest_denomination:1},cny:{priority:100,iso_code:"CNY",name:"Chinese Renminbi Yuan",symbol:"\xA5",alternate_symbols:["CN\xA5","\u5143","CN\u5143"],subunit:"Fen",subunit_to_unit:100,symbol_first:!0,html_entity:"\uFFE5",decimal_mark:".",thousands_separator:",",iso_numeric:"156",smallest_denomination:1},cop:{priority:100,iso_code:"COP",name:"Colombian Peso",symbol:"$",disambiguate_symbol:"COL$",alternate_symbols:["COL$"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:",",thousands_separator:".",iso_numeric:"170",smallest_denomination:20},crc:{priority:100,iso_code:"CRC",name:"Costa Rican Col\xF3n",symbol:"\u20A1",alternate_symbols:["\xA2"],subunit:"C\xE9ntimo",subunit_to_unit:100,symbol_first:!0,html_entity:"₡",decimal_mark:",",thousands_separator:".",iso_numeric:"188",smallest_denomination:500},cuc:{priority:100,iso_code:"CUC",name:"Cuban Convertible Peso",symbol:"$",disambiguate_symbol:"CUC$",alternate_symbols:["CUC$"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"931",smallest_denomination:1},cup:{priority:100,iso_code:"CUP",name:"Cuban Peso",symbol:"$",disambiguate_symbol:"$MN",alternate_symbols:["$MN"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"₱",decimal_mark:".",thousands_separator:",",iso_numeric:"192",smallest_denomination:1},cve:{priority:100,iso_code:"CVE",name:"Cape Verdean Escudo",symbol:"$",disambiguate_symbol:"Esc",alternate_symbols:["Esc"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"132",smallest_denomination:100},czk:{priority:100,iso_code:"CZK",name:"Czech Koruna",symbol:"K\u010D",alternate_symbols:[],subunit:"Hal\xE9\u0159",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:" ",iso_numeric:"203",smallest_denomination:100},djf:{priority:100,iso_code:"DJF",name:"Djiboutian Franc",symbol:"Fdj",alternate_symbols:[],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"262",smallest_denomination:100},dkk:{priority:100,iso_code:"DKK",name:"Danish Krone",symbol:"kr.",disambiguate_symbol:"DKK",alternate_symbols:[",-"],subunit:"\xD8re",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:".",iso_numeric:"208",smallest_denomination:50},dop:{priority:100,iso_code:"DOP",name:"Dominican Peso",symbol:"$",disambiguate_symbol:"RD$",alternate_symbols:["RD$"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"₱",decimal_mark:".",thousands_separator:",",iso_numeric:"214",smallest_denomination:100},dzd:{priority:100,iso_code:"DZD",name:"Algerian Dinar",symbol:"\u062F.\u062C",alternate_symbols:["DA"],subunit:"Centime",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"012",smallest_denomination:100},egp:{priority:100,iso_code:"EGP",name:"Egyptian Pound",symbol:"\u062C.\u0645",alternate_symbols:["LE","E\xA3","L.E."],subunit:"Piastre",subunit_to_unit:100,symbol_first:!0,html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"818",smallest_denomination:25},ern:{priority:100,iso_code:"ERN",name:"Eritrean Nakfa",symbol:"Nfk",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"232",smallest_denomination:1},etb:{priority:100,iso_code:"ETB",name:"Ethiopian Birr",symbol:"Br",disambiguate_symbol:"ETB",alternate_symbols:[],subunit:"Santim",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"230",smallest_denomination:1},eur:{priority:2,iso_code:"EUR",name:"Euro",symbol:"\u20AC",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"\u20AC",decimal_mark:",",thousands_separator:".",iso_numeric:"978",smallest_denomination:1},fjd:{priority:100,iso_code:"FJD",name:"Fijian Dollar",symbol:"$",disambiguate_symbol:"FJ$",alternate_symbols:["FJ$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"242",smallest_denomination:5},fkp:{priority:100,iso_code:"FKP",name:"Falkland Pound",symbol:"\xA3",disambiguate_symbol:"FK\xA3",alternate_symbols:["FK\xA3"],subunit:"Penny",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"238",smallest_denomination:1},gbp:{priority:3,iso_code:"GBP",name:"British Pound",symbol:"\xA3",alternate_symbols:[],subunit:"Penny",subunit_to_unit:100,symbol_first:!0,html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"826",smallest_denomination:1},gel:{priority:100,iso_code:"GEL",name:"Georgian Lari",symbol:"\u20BE",alternate_symbols:["lari"],subunit:"Tetri",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"981",smallest_denomination:1},ghs:{priority:100,iso_code:"GHS",name:"Ghanaian Cedi",symbol:"\u20B5",alternate_symbols:["GH\xA2","GH\u20B5"],subunit:"Pesewa",subunit_to_unit:100,symbol_first:!0,html_entity:"₵",decimal_mark:".",thousands_separator:",",iso_numeric:"936",smallest_denomination:1},gip:{priority:100,iso_code:"GIP",name:"Gibraltar Pound",symbol:"\xA3",disambiguate_symbol:"GIP",alternate_symbols:[],subunit:"Penny",subunit_to_unit:100,symbol_first:!0,html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"292",smallest_denomination:1},gmd:{priority:100,iso_code:"GMD",name:"Gambian Dalasi",symbol:"D",alternate_symbols:[],subunit:"Butut",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"270",smallest_denomination:1},gnf:{priority:100,iso_code:"GNF",name:"Guinean Franc",symbol:"Fr",disambiguate_symbol:"FG",alternate_symbols:["FG","GFr"],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"324",smallest_denomination:100},gtq:{priority:100,iso_code:"GTQ",name:"Guatemalan Quetzal",symbol:"Q",alternate_symbols:[],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"320",smallest_denomination:1},gyd:{priority:100,iso_code:"GYD",name:"Guyanese Dollar",symbol:"$",disambiguate_symbol:"G$",alternate_symbols:["G$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"328",smallest_denomination:100},hkd:{priority:100,iso_code:"HKD",name:"Hong Kong Dollar",symbol:"$",disambiguate_symbol:"HK$",alternate_symbols:["HK$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"344",smallest_denomination:10},hnl:{priority:100,iso_code:"HNL",name:"Honduran Lempira",symbol:"L",disambiguate_symbol:"HNL",alternate_symbols:[],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"340",smallest_denomination:5},htg:{priority:100,iso_code:"HTG",name:"Haitian Gourde",symbol:"G",alternate_symbols:[],subunit:"Centime",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"332",smallest_denomination:5},huf:{priority:100,iso_code:"HUF",name:"Hungarian Forint",symbol:"Ft",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:" ",iso_numeric:"348",smallest_denomination:5},idr:{priority:100,iso_code:"IDR",name:"Indonesian Rupiah",symbol:"Rp",alternate_symbols:[],subunit:"Sen",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:",",thousands_separator:".",iso_numeric:"360",smallest_denomination:5e3},ils:{priority:100,iso_code:"ILS",name:"Israeli New Sheqel",symbol:"\u20AA",alternate_symbols:["\u05E9\u05F4\u05D7","NIS"],subunit:"Agora",subunit_to_unit:100,symbol_first:!0,html_entity:"₪",decimal_mark:".",thousands_separator:",",iso_numeric:"376",smallest_denomination:10},inr:{priority:100,iso_code:"INR",name:"Indian Rupee",symbol:"\u20B9",alternate_symbols:["Rs","\u09F3","\u0AF1","\u0BF9","\u0930\u0941","\u20A8"],subunit:"Paisa",subunit_to_unit:100,symbol_first:!0,html_entity:"₹",decimal_mark:".",thousands_separator:",",iso_numeric:"356",smallest_denomination:50},iqd:{priority:100,iso_code:"IQD",name:"Iraqi Dinar",symbol:"\u0639.\u062F",alternate_symbols:[],subunit:"Fils",subunit_to_unit:1e3,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"368",smallest_denomination:5e4},irr:{priority:100,iso_code:"IRR",name:"Iranian Rial",symbol:"\uFDFC",alternate_symbols:[],subunit:null,subunit_to_unit:100,symbol_first:!0,html_entity:"﷼",decimal_mark:".",thousands_separator:",",iso_numeric:"364",smallest_denomination:5e3},isk:{priority:100,iso_code:"ISK",name:"Icelandic Kr\xF3na",symbol:"kr.",alternate_symbols:["\xCDkr"],subunit:null,subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:".",iso_numeric:"352",smallest_denomination:1},jmd:{priority:100,iso_code:"JMD",name:"Jamaican Dollar",symbol:"$",disambiguate_symbol:"J$",alternate_symbols:["J$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"388",smallest_denomination:1},jod:{priority:100,iso_code:"JOD",name:"Jordanian Dinar",symbol:"\u062F.\u0627",alternate_symbols:["JD"],subunit:"Fils",subunit_to_unit:1e3,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"400",smallest_denomination:5},jpy:{priority:6,iso_code:"JPY",name:"Japanese Yen",symbol:"\xA5",alternate_symbols:["\u5186","\u5713"],subunit:null,subunit_to_unit:1,symbol_first:!0,html_entity:"¥",decimal_mark:".",thousands_separator:",",iso_numeric:"392",smallest_denomination:1},kes:{priority:100,iso_code:"KES",name:"Kenyan Shilling",symbol:"KSh",alternate_symbols:["Sh"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"404",smallest_denomination:50},kgs:{priority:100,iso_code:"KGS",name:"Kyrgyzstani Som",symbol:"som",alternate_symbols:["\u0441\u043E\u043C"],subunit:"Tyiyn",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"417",smallest_denomination:1},khr:{priority:100,iso_code:"KHR",name:"Cambodian Riel",symbol:"\u17DB",alternate_symbols:[],subunit:"Sen",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"៛",decimal_mark:".",thousands_separator:",",iso_numeric:"116",smallest_denomination:5e3},kmf:{priority:100,iso_code:"KMF",name:"Comorian Franc",symbol:"Fr",disambiguate_symbol:"CF",alternate_symbols:["CF"],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"174",smallest_denomination:100},kpw:{priority:100,iso_code:"KPW",name:"North Korean Won",symbol:"\u20A9",alternate_symbols:[],subunit:"Ch\u014Fn",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"₩",decimal_mark:".",thousands_separator:",",iso_numeric:"408",smallest_denomination:1},krw:{priority:100,iso_code:"KRW",name:"South Korean Won",symbol:"\u20A9",subunit:null,subunit_to_unit:1,alternate_symbols:[],symbol_first:!0,html_entity:"₩",decimal_mark:".",thousands_separator:",",iso_numeric:"410",smallest_denomination:1},kwd:{priority:100,iso_code:"KWD",name:"Kuwaiti Dinar",symbol:"\u062F.\u0643",alternate_symbols:["K.D."],subunit:"Fils",subunit_to_unit:1e3,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"414",smallest_denomination:5},kyd:{priority:100,iso_code:"KYD",name:"Cayman Islands Dollar",symbol:"$",disambiguate_symbol:"CI$",alternate_symbols:["CI$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"136",smallest_denomination:1},kzt:{priority:100,iso_code:"KZT",name:"Kazakhstani Tenge",symbol:"\u20B8",alternate_symbols:[],subunit:"Tiyn",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"398",smallest_denomination:100},lak:{priority:100,iso_code:"LAK",name:"Lao Kip",symbol:"\u20AD",alternate_symbols:["\u20ADN"],subunit:"Att",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"₭",decimal_mark:".",thousands_separator:",",iso_numeric:"418",smallest_denomination:10},lbp:{priority:100,iso_code:"LBP",name:"Lebanese Pound",symbol:"\u0644.\u0644",alternate_symbols:["\xA3","L\xA3"],subunit:"Piastre",subunit_to_unit:100,symbol_first:!0,html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"422",smallest_denomination:25e3},lkr:{priority:100,iso_code:"LKR",name:"Sri Lankan Rupee",symbol:"\u20A8",disambiguate_symbol:"SLRs",alternate_symbols:["\u0DBB\u0DD4","\u0BB0\u0BC2","SLRs","/-"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"₨",decimal_mark:".",thousands_separator:",",iso_numeric:"144",smallest_denomination:100},lrd:{priority:100,iso_code:"LRD",name:"Liberian Dollar",symbol:"$",disambiguate_symbol:"L$",alternate_symbols:["L$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"430",smallest_denomination:5},lsl:{priority:100,iso_code:"LSL",name:"Lesotho Loti",symbol:"L",disambiguate_symbol:"M",alternate_symbols:["M"],subunit:"Sente",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"426",smallest_denomination:1},lyd:{priority:100,iso_code:"LYD",name:"Libyan Dinar",symbol:"\u0644.\u062F",alternate_symbols:["LD"],subunit:"Dirham",subunit_to_unit:1e3,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"434",smallest_denomination:50},mad:{priority:100,iso_code:"MAD",name:"Moroccan Dirham",symbol:"\u062F.\u0645.",alternate_symbols:[],subunit:"Centime",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"504",smallest_denomination:1},mdl:{priority:100,iso_code:"MDL",name:"Moldovan Leu",symbol:"L",alternate_symbols:["lei"],subunit:"Ban",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"498",smallest_denomination:1},mga:{priority:100,iso_code:"MGA",name:"Malagasy Ariary",symbol:"Ar",alternate_symbols:[],subunit:"Iraimbilanja",subunit_to_unit:5,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"969",smallest_denomination:1},mkd:{priority:100,iso_code:"MKD",name:"Macedonian Denar",symbol:"\u0434\u0435\u043D",alternate_symbols:[],subunit:"Deni",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"807",smallest_denomination:100},mmk:{priority:100,iso_code:"MMK",name:"Myanmar Kyat",symbol:"K",disambiguate_symbol:"MMK",alternate_symbols:[],subunit:"Pya",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"104",smallest_denomination:50},mnt:{priority:100,iso_code:"MNT",name:"Mongolian T\xF6gr\xF6g",symbol:"\u20AE",alternate_symbols:[],subunit:"M\xF6ng\xF6",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"₮",decimal_mark:".",thousands_separator:",",iso_numeric:"496",smallest_denomination:2e3},mop:{priority:100,iso_code:"MOP",name:"Macanese Pataca",symbol:"P",alternate_symbols:["MOP$"],subunit:"Avo",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"446",smallest_denomination:10},mru:{priority:100,iso_code:"MRU",name:"Mauritanian Ouguiya",symbol:"UM",alternate_symbols:[],subunit:"Khoums",subunit_to_unit:5,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"929",smallest_denomination:1},mur:{priority:100,iso_code:"MUR",name:"Mauritian Rupee",symbol:"\u20A8",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"₨",decimal_mark:".",thousands_separator:",",iso_numeric:"480",smallest_denomination:100},mvr:{priority:100,iso_code:"MVR",name:"Maldivian Rufiyaa",symbol:"MVR",alternate_symbols:["MRF","Rf","/-","\u0783"],subunit:"Laari",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"462",smallest_denomination:1},mwk:{priority:100,iso_code:"MWK",name:"Malawian Kwacha",symbol:"MK",alternate_symbols:[],subunit:"Tambala",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"454",smallest_denomination:1},mxn:{priority:100,iso_code:"MXN",name:"Mexican Peso",symbol:"$",disambiguate_symbol:"MEX$",alternate_symbols:["MEX$"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"484",smallest_denomination:5},myr:{priority:100,iso_code:"MYR",name:"Malaysian Ringgit",symbol:"RM",alternate_symbols:[],subunit:"Sen",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"458",smallest_denomination:5},mzn:{priority:100,iso_code:"MZN",name:"Mozambican Metical",symbol:"MTn",alternate_symbols:["MZN"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:",",thousands_separator:".",iso_numeric:"943",smallest_denomination:1},nad:{priority:100,iso_code:"NAD",name:"Namibian Dollar",symbol:"$",disambiguate_symbol:"N$",alternate_symbols:["N$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"516",smallest_denomination:5},ngn:{priority:100,iso_code:"NGN",name:"Nigerian Naira",symbol:"\u20A6",alternate_symbols:[],subunit:"Kobo",subunit_to_unit:100,symbol_first:!0,html_entity:"₦",decimal_mark:".",thousands_separator:",",iso_numeric:"566",smallest_denomination:50},nio:{priority:100,iso_code:"NIO",name:"Nicaraguan C\xF3rdoba",symbol:"C$",disambiguate_symbol:"NIO$",alternate_symbols:[],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"558",smallest_denomination:5},nok:{priority:100,iso_code:"NOK",name:"Norwegian Krone",symbol:"kr",disambiguate_symbol:"NOK",alternate_symbols:[",-"],subunit:"\xD8re",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"kr",decimal_mark:",",thousands_separator:".",iso_numeric:"578",smallest_denomination:100},npr:{priority:100,iso_code:"NPR",name:"Nepalese Rupee",symbol:"Rs.",disambiguate_symbol:"NPR",alternate_symbols:["Rs","\u0930\u0942","\u20A8"],subunit:"Paisa",subunit_to_unit:100,symbol_first:!0,html_entity:"₨",decimal_mark:".",thousands_separator:",",iso_numeric:"524",smallest_denomination:1},nzd:{priority:100,iso_code:"NZD",name:"New Zealand Dollar",symbol:"$",disambiguate_symbol:"NZ$",alternate_symbols:["NZ$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"554",smallest_denomination:10},omr:{priority:100,iso_code:"OMR",name:"Omani Rial",symbol:"\u0631.\u0639.",alternate_symbols:[],subunit:"Baisa",subunit_to_unit:1e3,symbol_first:!0,html_entity:"﷼",decimal_mark:".",thousands_separator:",",iso_numeric:"512",smallest_denomination:5},pab:{priority:100,iso_code:"PAB",name:"Panamanian Balboa",symbol:"B/.",alternate_symbols:[],subunit:"Cent\xE9simo",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"590",smallest_denomination:1},pen:{priority:100,iso_code:"PEN",name:"Peruvian Sol",symbol:"S/",alternate_symbols:[],subunit:"C\xE9ntimo",subunit_to_unit:100,symbol_first:!0,html_entity:"S/",decimal_mark:",",thousands_separator:".",iso_numeric:"604",smallest_denomination:1},pgk:{priority:100,iso_code:"PGK",name:"Papua New Guinean Kina",symbol:"K",disambiguate_symbol:"PGK",alternate_symbols:[],subunit:"Toea",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"598",smallest_denomination:5},php:{priority:100,iso_code:"PHP",name:"Philippine Peso",symbol:"\u20B1",alternate_symbols:["PHP","PhP","P"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"₱",decimal_mark:".",thousands_separator:",",iso_numeric:"608",smallest_denomination:1},pkr:{priority:100,iso_code:"PKR",name:"Pakistani Rupee",symbol:"\u20A8",disambiguate_symbol:"PKR",alternate_symbols:["Rs"],subunit:"Paisa",subunit_to_unit:100,symbol_first:!0,html_entity:"₨",decimal_mark:".",thousands_separator:",",iso_numeric:"586",smallest_denomination:100},pln:{priority:100,iso_code:"PLN",name:"Polish Z\u0142oty",symbol:"z\u0142",alternate_symbols:[],subunit:"Grosz",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"zł",decimal_mark:",",thousands_separator:" ",iso_numeric:"985",smallest_denomination:1},pyg:{priority:100,iso_code:"PYG",name:"Paraguayan Guaran\xED",symbol:"\u20B2",alternate_symbols:[],subunit:"C\xE9ntimo",subunit_to_unit:1,symbol_first:!0,html_entity:"₲",decimal_mark:".",thousands_separator:",",iso_numeric:"600",smallest_denomination:5e3},qar:{priority:100,iso_code:"QAR",name:"Qatari Riyal",symbol:"\u0631.\u0642",alternate_symbols:["QR"],subunit:"Dirham",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"﷼",decimal_mark:".",thousands_separator:",",iso_numeric:"634",smallest_denomination:1},ron:{priority:100,iso_code:"RON",name:"Romanian Leu",symbol:"Lei",alternate_symbols:[],subunit:"Bani",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:".",iso_numeric:"946",smallest_denomination:1},rsd:{priority:100,iso_code:"RSD",name:"Serbian Dinar",symbol:"\u0420\u0421\u0414",alternate_symbols:["RSD","din","\u0434\u0438\u043D"],subunit:"Para",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"941",smallest_denomination:100},rub:{priority:100,iso_code:"RUB",name:"Russian Ruble",symbol:"\u20BD",alternate_symbols:["\u0440\u0443\u0431.","\u0440."],subunit:"Kopeck",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"₽",decimal_mark:",",thousands_separator:".",iso_numeric:"643",smallest_denomination:1},rwf:{priority:100,iso_code:"RWF",name:"Rwandan Franc",symbol:"FRw",alternate_symbols:["RF","R\u20A3"],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"646",smallest_denomination:100},sar:{priority:100,iso_code:"SAR",name:"Saudi Riyal",symbol:"\u0631.\u0633",alternate_symbols:["SR","\uFDFC"],subunit:"Hallallah",subunit_to_unit:100,symbol_first:!0,html_entity:"﷼",decimal_mark:".",thousands_separator:",",iso_numeric:"682",smallest_denomination:5},sbd:{priority:100,iso_code:"SBD",name:"Solomon Islands Dollar",symbol:"$",disambiguate_symbol:"SI$",alternate_symbols:["SI$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"090",smallest_denomination:10},scr:{priority:100,iso_code:"SCR",name:"Seychellois Rupee",symbol:"\u20A8",disambiguate_symbol:"SRe",alternate_symbols:["SRe","SR"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"₨",decimal_mark:".",thousands_separator:",",iso_numeric:"690",smallest_denomination:1},sdg:{priority:100,iso_code:"SDG",name:"Sudanese Pound",symbol:"\xA3",disambiguate_symbol:"SDG",alternate_symbols:[],subunit:"Piastre",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"938",smallest_denomination:1},sek:{priority:100,iso_code:"SEK",name:"Swedish Krona",symbol:"kr",disambiguate_symbol:"SEK",alternate_symbols:[":-"],subunit:"\xD6re",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:",",thousands_separator:" ",iso_numeric:"752",smallest_denomination:100},sgd:{priority:100,iso_code:"SGD",name:"Singapore Dollar",symbol:"$",disambiguate_symbol:"S$",alternate_symbols:["S$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"702",smallest_denomination:1},shp:{priority:100,iso_code:"SHP",name:"Saint Helenian Pound",symbol:"\xA3",disambiguate_symbol:"SHP",alternate_symbols:[],subunit:"Penny",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"654",smallest_denomination:1},skk:{priority:100,iso_code:"SKK",name:"Slovak Koruna",symbol:"Sk",alternate_symbols:[],subunit:"Halier",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"703",smallest_denomination:50},sle:{priority:100,iso_code:"SLE",name:"New Leone",symbol:"Le",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"925",smallest_denomination:1e3},sll:{priority:100,iso_code:"SLL",name:"Sierra Leonean Leone",symbol:"Le",disambiguate_symbol:"SLL",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"694",smallest_denomination:1e3},sos:{priority:100,iso_code:"SOS",name:"Somali Shilling",symbol:"Sh",alternate_symbols:["Sh.So"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"706",smallest_denomination:1},srd:{priority:100,iso_code:"SRD",name:"Surinamese Dollar",symbol:"$",disambiguate_symbol:"SRD",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"968",smallest_denomination:1},ssp:{priority:100,iso_code:"SSP",name:"South Sudanese Pound",symbol:"\xA3",disambiguate_symbol:"SSP",alternate_symbols:[],subunit:"piaster",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"728",smallest_denomination:5},std:{priority:100,iso_code:"STD",name:"S\xE3o Tom\xE9 and Pr\xEDncipe Dobra",symbol:"Db",alternate_symbols:[],subunit:"C\xEAntimo",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"678",smallest_denomination:1e4},stn:{priority:100,iso_code:"STN",name:"S\xE3o Tom\xE9 and Pr\xEDncipe Second Dobra",symbol:"Db",disambiguate_symbol:"STN",alternate_symbols:[],subunit:"C\xEAntimo",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"930",smallest_denomination:10},svc:{priority:100,iso_code:"SVC",name:"Salvadoran Col\xF3n",symbol:"\u20A1",alternate_symbols:["\xA2"],subunit:"Centavo",subunit_to_unit:100,symbol_first:!0,html_entity:"₡",decimal_mark:".",thousands_separator:",",iso_numeric:"222",smallest_denomination:1},syp:{priority:100,iso_code:"SYP",name:"Syrian Pound",symbol:"\xA3S",alternate_symbols:["\xA3","\u0644.\u0633","LS","\u0627\u0644\u0644\u064A\u0631\u0629 \u0627\u0644\u0633\u0648\u0631\u064A\u0629"],subunit:"Piastre",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"760",smallest_denomination:100},szl:{priority:100,iso_code:"SZL",name:"Swazi Lilangeni",symbol:"E",disambiguate_symbol:"SZL",subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"748",smallest_denomination:1},thb:{priority:100,iso_code:"THB",name:"Thai Baht",symbol:"\u0E3F",alternate_symbols:[],subunit:"Satang",subunit_to_unit:100,symbol_first:!0,html_entity:"฿",decimal_mark:".",thousands_separator:",",iso_numeric:"764",smallest_denomination:1},tjs:{priority:100,iso_code:"TJS",name:"Tajikistani Somoni",symbol:"\u0405\u041C",alternate_symbols:[],subunit:"Diram",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"972",smallest_denomination:1},tmt:{priority:100,iso_code:"TMT",name:"Turkmenistani Manat",symbol:"T",alternate_symbols:[],subunit:"Tenge",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"934",smallest_denomination:1},tnd:{priority:100,iso_code:"TND",name:"Tunisian Dinar",symbol:"\u062F.\u062A",alternate_symbols:["TD","DT"],subunit:"Millime",subunit_to_unit:1e3,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"788",smallest_denomination:10},top:{priority:100,iso_code:"TOP",name:"Tongan Pa\u02BBanga",symbol:"T$",alternate_symbols:["PT"],subunit:"Seniti",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"776",smallest_denomination:1},try:{priority:100,iso_code:"TRY",name:"Turkish Lira",symbol:"\u20BA",alternate_symbols:["TL"],subunit:"kuru\u015F",subunit_to_unit:100,symbol_first:!0,html_entity:"₺",decimal_mark:",",thousands_separator:".",iso_numeric:"949",smallest_denomination:1},ttd:{priority:100,iso_code:"TTD",name:"Trinidad and Tobago Dollar",symbol:"$",disambiguate_symbol:"TT$",alternate_symbols:["TT$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"780",smallest_denomination:1},twd:{priority:100,iso_code:"TWD",name:"New Taiwan Dollar",symbol:"$",disambiguate_symbol:"NT$",alternate_symbols:["NT$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"901",smallest_denomination:50},tzs:{priority:100,iso_code:"TZS",name:"Tanzanian Shilling",symbol:"Sh",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"834",smallest_denomination:5e3},uah:{priority:100,iso_code:"UAH",name:"Ukrainian Hryvnia",symbol:"\u20B4",alternate_symbols:[],subunit:"Kopiyka",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"₴",decimal_mark:".",thousands_separator:",",iso_numeric:"980",smallest_denomination:1},ugx:{priority:100,iso_code:"UGX",name:"Ugandan Shilling",symbol:"USh",alternate_symbols:[],subunit:"Cent",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"800",smallest_denomination:1e3},usd:{priority:1,iso_code:"USD",name:"United States Dollar",symbol:"$",disambiguate_symbol:"US$",alternate_symbols:["US$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"840",smallest_denomination:1},uyu:{priority:100,iso_code:"UYU",name:"Uruguayan Peso",symbol:"$U",alternate_symbols:["$U"],subunit:"Cent\xE9simo",subunit_to_unit:100,symbol_first:!0,html_entity:"$U",decimal_mark:",",thousands_separator:".",iso_numeric:"858",smallest_denomination:100},uzs:{priority:100,iso_code:"UZS",name:"Uzbekistan Som",symbol:"so'm",alternate_symbols:["so\u2018m","\u0441\u045E\u043C","\u0441\u0443\u043C","s","\u0441"],subunit:"Tiyin",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"860",smallest_denomination:100},ves:{priority:100,iso_code:"VES",name:"Venezuelan Bol\xEDvar Soberano",symbol:"Bs",alternate_symbols:["Bs.S"],subunit:"C\xE9ntimo",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:",",thousands_separator:".",iso_numeric:"928",smallest_denomination:1},vnd:{priority:100,iso_code:"VND",name:"Vietnamese \u0110\u1ED3ng",symbol:"\u20AB",alternate_symbols:[],subunit:"H\xE0o",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"₫",decimal_mark:",",thousands_separator:".",iso_numeric:"704",smallest_denomination:100},vuv:{priority:100,iso_code:"VUV",name:"Vanuatu Vatu",symbol:"Vt",alternate_symbols:[],subunit:null,subunit_to_unit:1,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"548",smallest_denomination:1},wst:{priority:100,iso_code:"WST",name:"Samoan Tala",symbol:"T",disambiguate_symbol:"WS$",alternate_symbols:["WS$","SAT","ST"],subunit:"Sene",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"882",smallest_denomination:10},xaf:{priority:100,iso_code:"XAF",name:"Central African Cfa Franc",symbol:"CFA",disambiguate_symbol:"FCFA",alternate_symbols:["FCFA"],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"950",smallest_denomination:100},xag:{priority:100,iso_code:"XAG",name:"Silver (Troy Ounce)",symbol:"oz t",disambiguate_symbol:"XAG",alternate_symbols:[],subunit:"oz",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"961"},xau:{priority:100,iso_code:"XAU",name:"Gold (Troy Ounce)",symbol:"oz t",disambiguate_symbol:"XAU",alternate_symbols:[],subunit:"oz",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"959"},xba:{priority:100,iso_code:"XBA",name:"European Composite Unit",symbol:"",disambiguate_symbol:"XBA",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"955"},xbb:{priority:100,iso_code:"XBB",name:"European Monetary Unit",symbol:"",disambiguate_symbol:"XBB",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"956"},xbc:{priority:100,iso_code:"XBC",name:"European Unit of Account 9",symbol:"",disambiguate_symbol:"XBC",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"957"},xbd:{priority:100,iso_code:"XBD",name:"European Unit of Account 17",symbol:"",disambiguate_symbol:"XBD",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"958"},xcd:{priority:100,iso_code:"XCD",name:"East Caribbean Dollar",symbol:"$",disambiguate_symbol:"EX$",alternate_symbols:["EC$"],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"951",smallest_denomination:1},xdr:{priority:100,iso_code:"XDR",name:"Special Drawing Rights",symbol:"SDR",alternate_symbols:["XDR"],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"960"},xof:{priority:100,iso_code:"XOF",name:"West African Cfa Franc",symbol:"Fr",disambiguate_symbol:"CFA",alternate_symbols:["CFA"],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"952",smallest_denomination:100},xpd:{priority:100,iso_code:"XPD",name:"Palladium",symbol:"oz t",disambiguate_symbol:"XPD",alternate_symbols:[],subunit:"oz",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"964"},xpf:{priority:100,iso_code:"XPF",name:"Cfp Franc",symbol:"Fr",alternate_symbols:["F"],subunit:"Centime",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"953",smallest_denomination:100},xpt:{priority:100,iso_code:"XPT",name:"Platinum",symbol:"oz t",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"962",smallest_denomination:""},xts:{priority:100,iso_code:"XTS",name:"Codes specifically reserved for testing purposes",symbol:"",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"963",smallest_denomination:""},yer:{priority:100,iso_code:"YER",name:"Yemeni Rial",symbol:"\uFDFC",alternate_symbols:[],subunit:"Fils",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"﷼",decimal_mark:".",thousands_separator:",",iso_numeric:"886",smallest_denomination:100},zar:{priority:100,iso_code:"ZAR",name:"South African Rand",symbol:"R",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!0,html_entity:"R",decimal_mark:",",thousands_separator:" ",iso_numeric:"710",smallest_denomination:10},zmk:{priority:100,iso_code:"ZMK",name:"Zambian Kwacha",symbol:"ZK",disambiguate_symbol:"ZMK",alternate_symbols:[],subunit:"Ngwee",subunit_to_unit:100,symbol_first:!1,format:"%n %u",html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"894",smallest_denomination:5},zmw:{priority:100,iso_code:"ZMW",name:"Zambian Kwacha",symbol:"K",disambiguate_symbol:"ZMW",alternate_symbols:[],subunit:"Ngwee",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"967",smallest_denomination:5}},nonIsoCurrencies={bch:{priority:100,iso_code:"BCH",name:"Bitcoin Cash",symbol:"\u20BF",disambiguate_symbol:"\u20BFCH",alternate_symbols:["BCH"],subunit:"Satoshi",subunit_to_unit:1e8,symbol_first:!1,format:"%n %u",html_entity:"₿",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1},btc:{priority:100,iso_code:"BTC",name:"Bitcoin",symbol:"\u20BF",alternate_symbols:[],subunit:"Satoshi",subunit_to_unit:1e8,symbol_first:!0,html_entity:"₿",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1},jep:{priority:100,iso_code:"JEP",name:"Jersey Pound",symbol:"\xA3",disambiguate_symbol:"JEP",alternate_symbols:[],subunit:"Penny",subunit_to_unit:100,symbol_first:!0,html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1},ggp:{priority:100,iso_code:"GGP",name:"Guernsey Pound",symbol:"\xA3",disambiguate_symbol:"GGP",alternate_symbols:[],subunit:"Penny",subunit_to_unit:100,symbol_first:!0,html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1},imp:{priority:100,iso_code:"IMP",name:"Isle of Man Pound",symbol:"\xA3",disambiguate_symbol:"IMP",alternate_symbols:["M\xA3"],subunit:"Penny",subunit_to_unit:100,symbol_first:!0,html_entity:"£",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1},xfu:{priority:100,iso_code:"XFU",name:"UIC Franc",symbol:"",disambiguate_symbol:"XFU",alternate_symbols:[],subunit:"",subunit_to_unit:100,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:""},gbx:{priority:100,iso_code:"GBX",name:"British Penny",symbol:"",disambiguate_symbol:"GBX",alternate_symbols:[],subunit:"",subunit_to_unit:1,symbol_first:!0,html_entity:"",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1},cnh:{priority:100,iso_code:"CNH",name:"Chinese Renminbi Yuan Offshore",symbol:"\xA5",disambiguate_symbol:"CNH",alternate_symbols:["CN\xA5","\u5143","CN\u5143"],subunit:"Fen",subunit_to_unit:100,symbol_first:!0,html_entity:"\uFFE5",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1},usdc:{priority:100,iso_code:"USDC",name:"USD Coin",symbol:"USDC",disambiguate_symbol:"USDC",alternate_symbols:[],subunit:"Cent",subunit_to_unit:100,symbol_first:!1,html_entity:"$",decimal_mark:".",thousands_separator:",",iso_numeric:"",smallest_denomination:1}},customCurrencies={dun:{priority:100,iso_code:"DUN",iso_numeric:"999",name:"Dundle Coin",symbol:"DC",subunit_to_unit:1,decimal_mark:",",thousands_separator:".",symbol_first:!1}};exports.currencies={...isoCurrencies,...nonIsoCurrencies,...customCurrencies};function getCurrency(currencyCode){return exports.currencies[currencyCode.toLowerCase()]}function getDecimalLength(currency){return Math.log10(currency.subunit_to_unit)}function addCurrencySymbol({formattedValue,currency}){return formattedValue==null?"":currency.symbol_first?`${currency.symbol}${formattedValue}`:`${formattedValue}${currency.symbol}`}function makePlaceholder(currency,prefix=""){const decimalLength=getDecimalLength(currency);if(decimalLength===0)return"0";const decimals="".padEnd(decimalLength,"0");return`${prefix}0${currency.decimal_mark}${decimals}`}function formatCentsToCurrency(cents,currencyCode,stripZeroDecimals=!1){const currency=getCurrency(currencyCode);if(currency==null)return`${cents}`;const decimalLength=getDecimalLength(currency),unit=cents/currency.subunit_to_unit,value=`${stripZeroDecimals&&unit%1===0?unit.toFixed(0):unit.toFixed(decimalLength)}`.replace(".",currency.decimal_mark);return addCurrencySymbol({formattedValue:value,currency})}
@@ -1,6 +1,6 @@
1
1
  import { type JSX } from "react";
2
- import type { ChildrenFunction } from "../../typings/index";
3
2
  import type { CodeType } from "../../reducers/OrderReducer";
3
+ import type { ChildrenFunction } from "../../typings/index";
4
4
  interface ChildrenProps extends Omit<Props, "children" | "type"> {
5
5
  code?: string | null;
6
6
  hide?: boolean;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";export function GiftCardOrCouponCode({children,type,...props}){const{order,manageAdyenGiftCard}=useContext(OrderContext);let codeType=type?`${type}_code`:void 0;!type&&order&&"coupon_code"in order&&order.coupon_code!==""?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"";let hide=!(order&&code);if(manageAdyenGiftCard&&type==="gift_card"){const giftCardData=manageGiftCard({order});if(!giftCardData)return null;hide=!1;const parentProps2={...props,code:`${giftCardData.cardBrand} ${giftCardData.cardSummary}`,hide};return children?_jsx(Parent,{...parentProps2,children}):hide?null:_jsx("span",{...props,children:code})}const parentProps={...props,code,hide,discountAmountCents:order?.discount_amount_cents,discountAmountFloat:order?.discount_amount_float,formattedDiscountAmount:order?.formatted_discount_amount};return children?_jsx(Parent,{...parentProps,children}):hide?null:_jsx("span",{...props,children:code})}export default GiftCardOrCouponCode;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";export function GiftCardOrCouponCode({children,type,...props}){const{order,managePaymentProviderGiftCards}=useContext(OrderContext);let codeType=type?`${type}_code`:void 0;!type&&order&&"coupon_code"in order&&order.coupon_code!==""?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"";let hide=!(order&&code);if(managePaymentProviderGiftCards&&type==="gift_card"){const giftCardData=manageGiftCard({order});if(!giftCardData)return null;hide=!1;const parentProps2={...props,code:`${giftCardData.cardBrand} ${giftCardData.cardSummary}`,hide};return children?_jsx(Parent,{...parentProps2,children}):hide?null:_jsx("span",{...props,children:code})}const parentProps={...props,code,hide,discountAmountCents:order?.discount_amount_cents,discountAmountFloat:order?.discount_amount_float,formattedDiscountAmount:order?.formatted_discount_amount};return children?_jsx(Parent,{...parentProps,children}):hide?null:_jsx("span",{...props,children:code})}export default GiftCardOrCouponCode;
@@ -1,7 +1,7 @@
1
- import { type ReactNode, type JSX } from "react";
2
- import type { ChildrenFunction } from "../../typings/index";
3
- import type { CodeType, OrderCodeType } from "../../reducers/OrderReducer";
4
1
  import type { Order } from "@commercelayer/sdk";
2
+ import { type JSX, type ReactNode } from "react";
3
+ import type { CodeType, OrderCodeType } from "../../reducers/OrderReducer";
4
+ import type { ChildrenFunction } from "../../typings/index";
5
5
  interface ChildrenProps extends Omit<Props, "children" | "onClick"> {
6
6
  codeType?: OrderCodeType;
7
7
  hide?: boolean;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";export function GiftCardOrCouponRemoveButton(props){const{children,label="Remove",onClick,type,...p}=props,{order,removeGiftCardOrCouponCode,manageAdyenGiftCard,paymentSourceRequest}=useContext(OrderContext);let codeType=type?`${type}_code`:void 0;!type&&order&&"coupon_code"in order&&order.coupon_code!==""?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"";let hide=!(order&&code);const handleClick=async()=>{if(manageAdyenGiftCard&&codeType==="gift_card_code"&&order!=null){const id=order?.payment_source?.id;if(id!=null){const res=await paymentSourceRequest({resource:"adyen_payments",requestType:"update",attributes:{id,payment_request_data:{}},order});onClick!=null&&res!=null&&onClick(res)}}else if(codeType!=null&&removeGiftCardOrCouponCode!=null){const response=await removeGiftCardOrCouponCode({codeType});onClick!=null&&response!=null&&onClick(response)}};if(manageAdyenGiftCard&&type==="gift_card"){if(!manageGiftCard({order}))return null;hide=!1;const parentProps2={...p,label,handleClick,codeType};return children?_jsx(Parent,{...parentProps2,children}):hide?null:_jsx("button",{type:"button",onClick:()=>{handleClick()},...p,children:label})}const parentProps={...p,label,handleClick,codeType};return children?_jsx(Parent,{...parentProps,children}):hide?null:_jsx("button",{type:"button",onClick:()=>{handleClick()},...p,children:label})}export default GiftCardOrCouponRemoveButton;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";export function GiftCardOrCouponRemoveButton(props){const{children,label="Remove",onClick,type,...p}=props,{order,removeGiftCardOrCouponCode,managePaymentProviderGiftCards,paymentSourceRequest}=useContext(OrderContext);let codeType=type?`${type}_code`:void 0;!type&&order&&"coupon_code"in order&&order.coupon_code!==""?codeType="coupon_code":type||(codeType="gift_card_code");const code=order&&codeType?order[codeType]:"";let hide=!(order&&code);const handleClick=async()=>{if(managePaymentProviderGiftCards&&codeType==="gift_card_code"&&order!=null){const id=order?.payment_source?.id;if(id!=null){const res=await paymentSourceRequest({resource:"adyen_payments",requestType:"update",attributes:{id,payment_request_data:{}},order});onClick!=null&&res!=null&&onClick(res)}}else if(codeType!=null&&removeGiftCardOrCouponCode!=null){const response=await removeGiftCardOrCouponCode({codeType});onClick!=null&&response!=null&&onClick(response)}};if(managePaymentProviderGiftCards&&type==="gift_card"){if(!manageGiftCard({order}))return null;hide=!1;const parentProps2={...p,label,handleClick,codeType};return children?_jsx(Parent,{...parentProps2,children}):hide?null:_jsx("button",{type:"button",onClick:()=>{handleClick()},...p,children:label})}const parentProps={...p,label,handleClick,codeType};return children?_jsx(Parent,{...parentProps,children}):hide?null:_jsx("button",{type:"button",onClick:()=>{handleClick()},...p,children:label})}export default GiftCardOrCouponRemoveButton;
@@ -1,4 +1,4 @@
1
- import type { ReactNode, JSX } from "react";
1
+ import type { JSX, ReactNode } from "react";
2
2
  import type { ChildrenFunction } from "../../typings/index";
3
3
  interface ChildrenProps extends Omit<Props, "children"> {
4
4
  }
@@ -1,4 +1,4 @@
1
- import type { BaseAmountComponent } from "../../typings/index";
2
1
  import { type JSX } from "react";
2
+ import type { BaseAmountComponent } from "../../typings/index";
3
3
  export declare function GiftCardAmount(props: BaseAmountComponent): JSX.Element | null;
4
4
  export default GiftCardAmount;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";import{useContext}from"react";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";import Parent from"../utils/Parent";export function GiftCardAmount(props){const{manageAdyenGiftCard,order}=useContext(OrderContext);if(manageAdyenGiftCard){const giftCardData=manageGiftCard({order});if(!giftCardData)return null;const parentProps={priceCents:giftCardData.currentBalanceValue,price:`-${giftCardData?.formattedBalanceValue}`,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...props,children:`-${giftCardData?.formattedBalanceValue}`})}return _jsx(BaseOrderPrice,{base:"amount",type:"gift_card",...props})}export default GiftCardAmount;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";import BaseOrderPrice from"../utils/BaseOrderPrice";export function GiftCardAmount(props){const{managePaymentProviderGiftCards,order}=useContext(OrderContext);if(managePaymentProviderGiftCards){const giftCardData=manageGiftCard({order});if(!giftCardData)return null;const parentProps={priceCents:giftCardData.currentBalanceValue,price:`-${giftCardData?.formattedBalanceValue}`,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...props,children:`-${giftCardData?.formattedBalanceValue}`})}return _jsx(BaseOrderPrice,{base:"amount",type:"gift_card",...props})}export default GiftCardAmount;
@@ -20,10 +20,6 @@ interface Props {
20
20
  * Callback called when the order is updated
21
21
  */
22
22
  fetchOrder?: (order: Order) => void;
23
- /**
24
- * Indicate if Adyen gift card management is enabled
25
- */
26
- manageAdyenGiftCard?: boolean;
27
23
  }
28
24
  /**
29
25
  * This component is responsible for fetching the order and store it in its context.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useMemo,useReducer,useState}from"react";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext,{defaultOrderContext}from"../../context/OrderContext";import OrderStorageContext from"../../context/OrderStorageContext";import orderReducer,{addToCart,createOrder,getApiOrder,getOrderByFields,orderInitialState,paymentSourceRequest,setOrder,setOrderErrors,updateOrder}from"../../reducers/OrderReducer";import compareObjAttribute from"../../utils/compareObjAttribute";import useCustomContext from"../../utils/hooks/useCustomContext";export function OrderContainer(props){const{orderId,children,metadata,attributes,fetchOrder,manageAdyenGiftCard}=props,[state,dispatch]=useReducer(orderReducer,orderInitialState),[lock,setLock]=useState(!1),[lockOrder,setLockOrder]=useState(!0),config=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"OrderContainer",key:"accessToken"}),{persistKey,clearWhenPlaced,getLocalOrder,setLocalOrder,deleteLocalOrder}=useContext(OrderStorageContext),getOrder=async localOrder=>{localOrder&&await getApiOrder({id:localOrder,dispatch,config,persistKey,clearWhenPlaced:!!(persistKey&&clearWhenPlaced),deleteLocalOrder,state})};useEffect(()=>{const localOrder=persistKey?getLocalOrder(persistKey):orderId;state?.orderId&&(localOrder!=null&&state.orderId!==localOrder?getOrder(localOrder):dispatch({type:"setOrderId",payload:{orderId:void 0,order:void 0}}))},[persistKey]),useEffect(()=>{state.withoutIncludes||dispatch({type:"setLoading",payload:{loading:!0}})},[state.withoutIncludes]),useEffect(()=>{if(attributes&&state?.order&&!lock){const updateAttributes=compareObjAttribute({attributes,object:state.order});Object.keys(updateAttributes).length>0&&(updateOrder({id:state.order.id,attributes:updateAttributes,dispatch,config,include:state.include,state}),setLock(!0))}return()=>{if(attributes&&state?.order){const updateAttributes=compareObjAttribute({attributes,object:state.order});state.order&&Object.keys(updateAttributes).length===0&&setLock(!1)}}},[attributes,state?.order,lock]),useEffect(()=>{const localOrder=persistKey?getLocalOrder(persistKey):orderId,startRequest=Object.keys(state?.includeLoaded||{}).filter(key=>state?.includeLoaded?.[key]===!0);return config.accessToken&&state.loading===!1&&state?.order==null?(localOrder&&!state.order&&state.include?.length===startRequest.length&&!state.withoutIncludes&&!lockOrder||state.withoutIncludes&&!state.include?.length&&startRequest.length===0)&&getOrder(localOrder):[config.accessToken,state.order==null,state.loading,state.withoutIncludes].every(Boolean)?dispatch({type:"setLoading",payload:{loading:!1}}):[config.accessToken,state.order==null,state.loading,state.withoutIncludes===!1].every(Boolean)&&dispatch({type:"setLoading",payload:{loading:!1}}),()=>{state.order==null&&state.loading&&state.withoutIncludes===!1&&(state.include?.length===0&&startRequest.length>0?dispatch({type:"setLoading",payload:{loading:!1}}):state.include&&state.include?.length>0&&(dispatch({type:"setIncludesResource",payload:{include:[]}}),setLockOrder(!1)))}},[config.accessToken,Object.keys(state.includeLoaded??{}).length,state.include?.length,orderId,Object.keys(state?.order??{}).length,state.loading,state.withoutIncludes,lockOrder]);const orderValue=useMemo(()=>(fetchOrder!=null&&state?.order!=null&&fetchOrder(state.order),{...state,manageAdyenGiftCard,paymentSourceRequest:async params=>await paymentSourceRequest({...params,dispatch,state,config}),setOrder:order=>{setOrder(order,dispatch)},getOrder:async id=>await getApiOrder({id,dispatch,config,state}),setOrderErrors:errors=>setOrderErrors({dispatch,errors}),createOrder:async()=>await createOrder({persistKey,dispatch,config,state,orderMetadata:metadata,orderAttributes:attributes,setLocalOrder}),addToCart:async params=>await addToCart({...params,persistKey,dispatch,state,config,errors:state.errors,orderMetadata:metadata||{},orderAttributes:attributes,setLocalOrder}),saveAddressToCustomerAddressBook:args=>{defaultOrderContext.saveAddressToCustomerAddressBook({...args,dispatch})},setGiftCardOrCouponCode:async({code,codeType})=>await defaultOrderContext.setGiftCardOrCouponCode({code,codeType,dispatch,order:state.order,config,include:state.include,state}),removeGiftCardOrCouponCode:async({codeType})=>await defaultOrderContext.removeGiftCardOrCouponCode({codeType,dispatch,order:state.order,config,include:state.include,state}),addResourceToInclude:args=>{defaultOrderContext.addResourceToInclude({...args,dispatch,resourcesIncluded:state.include,resourceIncludedLoaded:state.includeLoaded})},updateOrder:async args=>await defaultOrderContext.updateOrder({...args,dispatch,config,include:state.include,state}),getOrderByFields}),[state,config.accessToken,persistKey]);return _jsx(OrderContext.Provider,{value:orderValue,children})}export default OrderContainer;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useMemo,useReducer,useState}from"react";import CommerceLayerContext from"../../context/CommerceLayerContext";import OrderContext,{defaultOrderContext}from"../../context/OrderContext";import OrderStorageContext from"../../context/OrderStorageContext";import orderReducer,{addToCart,createOrder,getApiOrder,getOrderByFields,orderInitialState,paymentSourceRequest,setOrder,setOrderErrors,updateOrder}from"../../reducers/OrderReducer";import compareObjAttribute from"../../utils/compareObjAttribute";import useCustomContext from"../../utils/hooks/useCustomContext";export function OrderContainer(props){const{orderId,children,metadata,attributes,fetchOrder}=props,[state,dispatch]=useReducer(orderReducer,orderInitialState),[lock,setLock]=useState(!1),[lockOrder,setLockOrder]=useState(!0),config=useCustomContext({context:CommerceLayerContext,contextComponentName:"CommerceLayer",currentComponentName:"OrderContainer",key:"accessToken"}),{persistKey,clearWhenPlaced,getLocalOrder,setLocalOrder,deleteLocalOrder}=useContext(OrderStorageContext),getOrder=async localOrder=>{localOrder&&await getApiOrder({id:localOrder,dispatch,config,persistKey,clearWhenPlaced:!!(persistKey&&clearWhenPlaced),deleteLocalOrder,state})};useEffect(()=>{const localOrder=persistKey?getLocalOrder(persistKey):orderId;state?.orderId&&(localOrder!=null&&state.orderId!==localOrder?getOrder(localOrder):dispatch({type:"setOrderId",payload:{orderId:void 0,order:void 0}}))},[persistKey]),useEffect(()=>{state.withoutIncludes||dispatch({type:"setLoading",payload:{loading:!0}})},[state.withoutIncludes]),useEffect(()=>{if(attributes&&state?.order&&!lock){const updateAttributes=compareObjAttribute({attributes,object:state.order});Object.keys(updateAttributes).length>0&&(updateOrder({id:state.order.id,attributes:updateAttributes,dispatch,config,include:state.include,state}),setLock(!0))}return()=>{if(attributes&&state?.order){const updateAttributes=compareObjAttribute({attributes,object:state.order});state.order&&Object.keys(updateAttributes).length===0&&setLock(!1)}}},[attributes,state?.order,lock]),useEffect(()=>{const localOrder=persistKey?getLocalOrder(persistKey):orderId,startRequest=Object.keys(state?.includeLoaded||{}).filter(key=>state?.includeLoaded?.[key]===!0);return config.accessToken&&state.loading===!1&&state?.order==null?(localOrder&&!state.order&&state.include?.length===startRequest.length&&!state.withoutIncludes&&!lockOrder||state.withoutIncludes&&!state.include?.length&&startRequest.length===0)&&getOrder(localOrder):[config.accessToken,state.order==null,state.loading,state.withoutIncludes].every(Boolean)?dispatch({type:"setLoading",payload:{loading:!1}}):[config.accessToken,state.order==null,state.loading,state.withoutIncludes===!1].every(Boolean)&&dispatch({type:"setLoading",payload:{loading:!1}}),()=>{state.order==null&&state.loading&&state.withoutIncludes===!1&&(state.include?.length===0&&startRequest.length>0?dispatch({type:"setLoading",payload:{loading:!1}}):state.include&&state.include?.length>0&&(dispatch({type:"setIncludesResource",payload:{include:[]}}),setLockOrder(!1)))}},[config.accessToken,Object.keys(state.includeLoaded??{}).length,state.include?.length,orderId,Object.keys(state?.order??{}).length,state.loading,state.withoutIncludes,lockOrder]);const orderValue=useMemo(()=>(fetchOrder!=null&&state?.order!=null&&fetchOrder(state.order),{...state,managePaymentProviderGiftCards:state.order?.payment_source?.payment_request_data?.payment_method?.type==="giftcard",paymentSourceRequest:async params=>await paymentSourceRequest({...params,dispatch,state,config}),setOrder:order=>{setOrder(order,dispatch)},getOrder:async id=>await getApiOrder({id,dispatch,config,state}),setOrderErrors:errors=>setOrderErrors({dispatch,errors}),createOrder:async()=>await createOrder({persistKey,dispatch,config,state,orderMetadata:metadata,orderAttributes:attributes,setLocalOrder}),addToCart:async params=>await addToCart({...params,persistKey,dispatch,state,config,errors:state.errors,orderMetadata:metadata||{},orderAttributes:attributes,setLocalOrder}),saveAddressToCustomerAddressBook:args=>{defaultOrderContext.saveAddressToCustomerAddressBook({...args,dispatch})},setGiftCardOrCouponCode:async({code,codeType})=>await defaultOrderContext.setGiftCardOrCouponCode({code,codeType,dispatch,order:state.order,config,include:state.include,state}),removeGiftCardOrCouponCode:async({codeType})=>await defaultOrderContext.removeGiftCardOrCouponCode({codeType,dispatch,order:state.order,config,include:state.include,state}),addResourceToInclude:args=>{defaultOrderContext.addResourceToInclude({...args,dispatch,resourcesIncluded:state.include,resourceIncludedLoaded:state.includeLoaded})},updateOrder:async args=>await defaultOrderContext.updateOrder({...args,dispatch,config,include:state.include,state}),getOrderByFields}),[state,config.accessToken,persistKey]);return _jsx(OrderContext.Provider,{value:orderValue,children})}export default OrderContainer;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import isFunction from"lodash/isFunction";import{useContext,useEffect,useRef,useState}from"react";import OrderContext from"../../context/OrderContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PlaceOrderContext from"../../context/PlaceOrderContext";import useCommerceLayer from"../../hooks/useCommerceLayer";import getCardDetails from"../../utils/getCardDetails";import{checkPaymentIntent}from"../../utils/stripe/retrievePaymentIntent";import Parent from"../utils/Parent";export function PlaceOrderButton(props){const ref=useRef(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus,status}=useContext(PlaceOrderContext),[notPermitted,setNotPermitted]=useState(!0),[forceDisable,setForceDisable]=useState(disabled),[isLoading,setIsLoading]=useState(!1),{sdkClient}=useCommerceLayer(),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order,setOrderErrors,errors}=useContext(OrderContext),isFree=order?.total_amount_with_taxes_cents===0;useEffect(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType!=null,currentPaymentMethodRef?.current?.onsubmit!=null,loading,currentPaymentMethodType,order?.id,paymentSource?.id]),useEffect(()=>{errors&&errors.length>0&&(setNotPermitted(!0),setIsLoading(!1),setForceDisable(!1))},[errors]),useEffect(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType!=null]),useEffect(()=>{if(paymentType==="stripe_payments"&&options?.stripe?.paymentIntentClientSecret&&order?.payment_source?.publishable_key&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=order?.payment_source?.publishable_key,paymentIntentClientSecret=options?.stripe?.paymentIntentClientSecret,getPaymentIntent=async()=>{const paymentIntentResult=await checkPaymentIntent({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}};getPaymentIntent()}},[options?.stripe?.paymentIntentClientSecret!=null,paymentType!=null,order?.payment_source!=null]),useEffect(()=>{if(order?.status!=null&&["draft","pending"].includes(order?.status)){const isAuthorized=order?.payment_source?.payment_response?.resultCode==="Authorised",paymentDetails=order?.payment_source?.payment_request_details?.details!=null,paymentStatus=order?.payment_status;if(console.log("Adyen redirect flow check",{isAuthorized,paymentDetails,redirectResult:options?.adyen?.redirectResult,status,paymentStatus:order?.payment_status}),paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode=res?.payment_response?.resultCode,errorCode=res?.payment_response?.errorCode,message=res?.payment_response?.message;["Authorised","Pending","Received"].includes(resultCode)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else paymentType==="adyen_payments"&&isAuthorized&&paymentDetails&&autoPlaceOrder&&status==="standby"&&!options?.adyen?.redirectResult?order?.payment_source?.payment_response?.merchantReference?.includes(order?.number)&&handleClick():paymentType==="adyen_payments"&&isAuthorized&&paymentStatus==="authorized"&&autoPlaceOrder&&status==="standby"&&(console.log("Adyen order is authorized, placing order..."),handleClick())}},[options?.adyen?.redirectResult!=null,order?.payment_source?.payment_response?.resultCode]),useEffect(()=>{order?.status==="placed"&&order?.payment_status==="authorized"&&paymentType==="adyen_payments"&&onClick?.({placed:!0,order})},[order?.id,order?.payment_status,order?.status,paymentType!=null]),useEffect(()=>{if(paymentType==="checkout_com_payments"&&options?.checkoutCom?.session_id&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const paymentStatus=order?.payment_source?.payment_response?.status;if(paymentStatus&&paymentStatus.toLowerCase()==="pending"){async function placingOrder(){const paymentStatus2=(await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"checkout_com_payments",attributes:{_details:1}}))?.payment_response?.status,isValidStatus=["authorized","captured"].includes(paymentStatus2?.toLowerCase());paymentStatus2&&isValidStatus?handleClick():(options?.checkoutCom&&(options.checkoutCom.session_id=void 0),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentStatus2}]))}placingOrder()}}else if(paymentType==="checkout_com_payments"&&order?.status&&status&&["pending"].includes(order?.status)&&["placing"].includes(status)&&autoPlaceOrder){const paymentSourceStatus=order?.payment_source?.payment_response?.status;paymentSourceStatus&&["captured","authorized"].includes(paymentSourceStatus.toLowerCase())&&setPlaceOrder?.({paymentSource}).then(placed=>{placed?.placed?(onClick?.(placed),setPlaceOrderStatus?.({status:"placing"})):setPlaceOrderStatus?.({status:"standby"})})}},[options?.checkoutCom?.session_id,order?.payment_source?.id,status]),useEffect(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref?.current]),useEffect(()=>{switch(status){case"disabled":case"placing":setNotPermitted(!0);break;default:setNotPermitted(!1);break}},[status!=null]);const handleClick=async e=>{e?.preventDefault(),e?.stopPropagation();const sdk=sdkClient();if(sdk==null||order==null)return;let isValid=!0,currentPaymentStatus="unpaid";if(!(paymentType==="stripe_payments")){const{status:status2,payment_status:paymentStatus}=await sdk.orders.retrieve(order?.id,{fields:["status","payment_status"]});console.log("PlaceOrderButton order status check",{status:status2,paymentStatus});const isAlreadyPlaced=status2==="placed",isDraftOrder=status2==="draft";if(currentPaymentStatus=paymentStatus??"unpaid",isAlreadyPlaced){setPlaceOrderStatus?.({status:"placing"}),onClick?.({placed:!0,order});return}if(isDraftOrder){setPlaceOrderStatus?.({status:"standby"}),onClick?.({placed:!1,order,errors:[{code:"VALIDATION_ERROR",resource:"orders",message:"Draft order cannot be placed"}]}),setOrderErrors([{code:"VALIDATION_ERROR",resource:"orders",message:"Draft order cannot be placed"}]);return}}setIsLoading(!0);const checkPaymentSource=paymentType!=="stripe_payments"?await setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&getCardDetails({paymentType,customerPayment:{payment_source:checkPaymentSource}});currentPaymentMethodRef?.current?.onsubmit&&[!options?.paypalPayerId,!options?.adyen?.MD,!options?.checkoutCom?.session_id].every(Boolean)?(isValid=await currentPaymentMethodRef.current?.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&checkPaymentSource?.payment_response?.resultCode==="Authorised"&&(isValid=!0)):currentPaymentMethodRef?.current?.onsubmit&&options?.checkoutCom?.session_id&&checkPaymentSource?.payment_response?.status&&checkPaymentSource?.payment_response?.status?.toLowerCase()==="declined"?isValid=await currentPaymentMethodRef.current?.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}):card?.brand&&(isValid=!0),currentPaymentStatus==="partially_authorized"&&(isValid=!1),isValid&&setPlaceOrderStatus!=null&&(setPlaceOrderStatus({status:"placing"}),setForceDisable(!0)),console.log("PlaceOrderButton isValid",{isValid,currentPaymentStatus});const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&await setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId});placed&&setPlaceOrderStatus!=null&&(placed.placed?(setPlaceOrderStatus({status:"placing"}),onClick?.(placed)):(setForceDisable(!1),onClick?.(placed),setIsLoading(!1),setPlaceOrderStatus({status:"standby"})))},disabledButton=disabled!==void 0?disabled:notPermitted,labelButton=isLoading?loadingLabel:isFunction(label)?label():label,parentProps={...p,label,disabled:disabledButton,handleClick,parentRef:ref,isLoading};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{ref,type:"button",disabled:disabledButton||forceDisable,onClick:e=>{handleClick(e)},...p,children:labelButton})}export default PlaceOrderButton;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import isFunction from"lodash/isFunction";import{useContext,useEffect,useRef,useState}from"react";import OrderContext from"../../context/OrderContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PlaceOrderContext from"../../context/PlaceOrderContext";import useCommerceLayer from"../../hooks/useCommerceLayer";import getCardDetails from"../../utils/getCardDetails";import{checkPaymentIntent}from"../../utils/stripe/retrievePaymentIntent";import Parent from"../utils/Parent";export function PlaceOrderButton(props){const ref=useRef(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus,status}=useContext(PlaceOrderContext),[notPermitted,setNotPermitted]=useState(!0),[forceDisable,setForceDisable]=useState(disabled),[isLoading,setIsLoading]=useState(!1),{sdkClient}=useCommerceLayer(),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order,setOrderErrors,errors}=useContext(OrderContext),isFree=order?.total_amount_with_taxes_cents===0;useEffect(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType!=null,currentPaymentMethodRef?.current?.onsubmit!=null,loading,currentPaymentMethodType,order?.id,paymentSource?.id]),useEffect(()=>{errors&&errors.length>0&&(setNotPermitted(!0),setIsLoading(!1),setForceDisable(!1))},[errors]),useEffect(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType!=null]),useEffect(()=>{if(paymentType==="stripe_payments"&&options?.stripe?.paymentIntentClientSecret&&order?.payment_source?.publishable_key&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=order?.payment_source?.publishable_key,paymentIntentClientSecret=options?.stripe?.paymentIntentClientSecret,getPaymentIntent=async()=>{const paymentIntentResult=await checkPaymentIntent({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}};getPaymentIntent()}},[options?.stripe?.paymentIntentClientSecret!=null,paymentType!=null,order?.payment_source!=null]),useEffect(()=>{if(order?.status!=null&&["draft","pending"].includes(order?.status)){const isAuthorized=order?.payment_source?.payment_response?.resultCode==="Authorised",paymentDetails=order?.payment_source?.payment_request_details?.details!=null,paymentStatus=order?.payment_status,paymentMethodType=order?.payment_source?.payment_response?.paymentMethod?.type;if(console.log("paymentMethodType",{paymentMethodType}),paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode=res?.payment_response?.resultCode,errorCode=res?.payment_response?.errorCode,message=res?.payment_response?.message;["Authorised","Pending","Received"].includes(resultCode)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else paymentType==="adyen_payments"&&isAuthorized&&paymentDetails&&autoPlaceOrder&&status==="standby"&&!options?.adyen?.redirectResult?order?.payment_source?.payment_response?.merchantReference?.includes(order?.number)&&handleClick():paymentType==="adyen_payments"&&isAuthorized&&paymentStatus==="authorized"&&paymentMethodType==="giftcard"&&autoPlaceOrder&&status==="standby"&&!options?.adyen?.redirectResult&&handleClick()}},[options?.adyen?.redirectResult!=null,order?.payment_source?.payment_response?.resultCode]),useEffect(()=>{order?.status==="placed"&&order?.payment_status==="authorized"&&paymentType==="adyen_payments"&&onClick?.({placed:!0,order})},[order?.id,order?.payment_status,order?.status,paymentType!=null]),useEffect(()=>{if(paymentType==="checkout_com_payments"&&options?.checkoutCom?.session_id&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const paymentStatus=order?.payment_source?.payment_response?.status;if(paymentStatus&&paymentStatus.toLowerCase()==="pending"){async function placingOrder(){const paymentStatus2=(await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"checkout_com_payments",attributes:{_details:1}}))?.payment_response?.status,isValidStatus=["authorized","captured"].includes(paymentStatus2?.toLowerCase());paymentStatus2&&isValidStatus?handleClick():(options?.checkoutCom&&(options.checkoutCom.session_id=void 0),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentStatus2}]))}placingOrder()}}else if(paymentType==="checkout_com_payments"&&order?.status&&status&&["pending"].includes(order?.status)&&["placing"].includes(status)&&autoPlaceOrder){const paymentSourceStatus=order?.payment_source?.payment_response?.status;paymentSourceStatus&&["captured","authorized"].includes(paymentSourceStatus.toLowerCase())&&setPlaceOrder?.({paymentSource}).then(placed=>{placed?.placed?(onClick?.(placed),setPlaceOrderStatus?.({status:"placing"})):setPlaceOrderStatus?.({status:"standby"})})}},[options?.checkoutCom?.session_id,order?.payment_source?.id,status]),useEffect(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref?.current]),useEffect(()=>{switch(status){case"disabled":case"placing":setNotPermitted(!0);break;default:setNotPermitted(!1);break}},[status!=null]);const handleClick=async e=>{e?.preventDefault(),e?.stopPropagation();const sdk=sdkClient();if(sdk==null||order==null)return;let isValid=!0,currentPaymentStatus="unpaid";if(!(paymentType==="stripe_payments")){const{status:status2,payment_status:paymentStatus}=await sdk.orders.retrieve(order?.id,{fields:["status","payment_status"]}),isAlreadyPlaced=status2==="placed",isDraftOrder=status2==="draft";if(currentPaymentStatus=paymentStatus??"unpaid",isAlreadyPlaced){setPlaceOrderStatus?.({status:"placing"}),onClick?.({placed:!0,order});return}if(isDraftOrder){setPlaceOrderStatus?.({status:"standby"}),onClick?.({placed:!1,order,errors:[{code:"VALIDATION_ERROR",resource:"orders",message:"Draft order cannot be placed"}]}),setOrderErrors([{code:"VALIDATION_ERROR",resource:"orders",message:"Draft order cannot be placed"}]);return}}setIsLoading(!0);const checkPaymentSource=paymentType!=="stripe_payments"?await setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&getCardDetails({paymentType,customerPayment:{payment_source:checkPaymentSource}});currentPaymentMethodRef?.current?.onsubmit&&[!options?.paypalPayerId,!options?.adyen?.MD,!options?.checkoutCom?.session_id].every(Boolean)?(isValid=await currentPaymentMethodRef.current?.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&checkPaymentSource?.payment_response?.resultCode==="Authorised"&&(isValid=!0)):currentPaymentMethodRef?.current?.onsubmit&&options?.checkoutCom?.session_id&&checkPaymentSource?.payment_response?.status&&checkPaymentSource?.payment_response?.status?.toLowerCase()==="declined"?isValid=await currentPaymentMethodRef.current?.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}):card?.brand&&(isValid=!0),currentPaymentStatus==="partially_authorized"&&(isValid=!1),isValid&&setPlaceOrderStatus!=null&&(setPlaceOrderStatus({status:"placing"}),setForceDisable(!0));const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&await setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId});placed&&setPlaceOrderStatus!=null&&(placed.placed?(setPlaceOrderStatus({status:"placing"}),onClick?.(placed)):(setForceDisable(!1),onClick?.(placed),setIsLoading(!1),setPlaceOrderStatus({status:"standby"})))},disabledButton=disabled!==void 0?disabled:notPermitted,labelButton=isLoading?loadingLabel:isFunction(label)?label():label,parentProps={...p,label,disabled:disabledButton,handleClick,parentRef:ref,isLoading};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{ref,type:"button",disabled:disabledButton||forceDisable,onClick:e=>{handleClick(e)},...p,children:labelButton})}export default PlaceOrderButton;
@@ -1,4 +1,4 @@
1
- import type { BaseAmountComponent } from "../../typings/index";
2
1
  import { type JSX } from "react";
2
+ import type { BaseAmountComponent } from "../../typings/index";
3
3
  export declare function TotalAmount(props: BaseAmountComponent): JSX.Element | null;
4
4
  export default TotalAmount;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx}from"react/jsx-runtime";import BaseOrderPrice from"../utils/BaseOrderPrice";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";export function TotalAmount(props){const{manageAdyenGiftCard,order}=useContext(OrderContext);if(manageAdyenGiftCard){const giftCardData=manageGiftCard({order});if(!giftCardData)return _jsx(BaseOrderPrice,{base:"total_amount",type:"with_taxes",...props});const parentProps={price:`${giftCardData?.formattedOrderTotal}`,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...props,children:`${giftCardData?.formattedOrderTotal}`})}return _jsx(BaseOrderPrice,{base:"total_amount",type:"with_taxes",...props})}export default TotalAmount;
2
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"../utils/Parent";import OrderContext from"../../context/OrderContext";import{manageGiftCard}from"../../utils/adyen/manageGiftCard";import BaseOrderPrice from"../utils/BaseOrderPrice";export function TotalAmount(props){const{managePaymentProviderGiftCards,order}=useContext(OrderContext);if(managePaymentProviderGiftCards){const giftCardData=manageGiftCard({order});if(!giftCardData)return _jsx(BaseOrderPrice,{base:"total_amount",type:"with_taxes",...props});const parentProps={price:`${giftCardData?.formattedOrderTotal}`,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...props,children:`${giftCardData?.formattedOrderTotal}`})}return _jsx(BaseOrderPrice,{base:"total_amount",type:"with_taxes",...props})}export default TotalAmount;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{AdyenCheckout,Dropin}from"@adyen/adyen-web/auto";import{useContext,useEffect,useRef,useState}from"react";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PlaceOrderContext from"../../context/PlaceOrderContext";import browserInfo,{cleanUrlBy}from"../../utils/browserInfo";import{getPublicIP}from"../../utils/getPublicIp";import{hasSubscriptions}from"../../utils/hasSubscriptions";import{setCustomerOrderParam}from"../../utils/localStorage";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,styles,onDisableStoredPaymentMethod,giftcardErrorComponent,onReady,onSelect,subscriptionPaymentMethods}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState(),[giftcardError,setGiftcardError]=useState(null),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order,updateOrder,getOrderByFields}=useContext(OrderContext),authConfig=useContext(CommerceLayerContext),{placeOrderButtonRef,setPlaceOrder,status}=useContext(PlaceOrderContext),{customers}=useContext(CustomerContext),ref=useRef(null),dropinRef=useRef(null),handleSubmit=async e=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;return savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),dropinRef.current&&dropinRef.current.submit(),!1},handleChange=async state=>{state.isValid&&ref.current&&(ref.current.onsubmit=async()=>await handleSubmit(ref.current),setPaymentRef({ref}))},handleOnAdditionalDetails=async(state,component)=>{const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}),resultCode=pSource?.payment_response?.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode};if(["Cancelled","Refused"].includes(resultCode)){const message=pSource?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return{resultCode}}catch(error){return console.error("Adyen additional details error:",error),{resultCode:"Error"}}},onSubmit=async(state,component)=>{const url=cleanUrlBy(),{type:currentPaymentMethodType2}=state.data.paymentMethod,shopperIp=await getPublicIP(),control=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"}),controlCode=control?.payment_response?.resultCode,paymentMethodType=control?.payment_response?.paymentMethod?.type??control?.payment_request_data?.payment_method?.type,paymentStatus=(await getOrderByFields({orderId:order?.id??"",fields:["status","payment_status"],config:authConfig}))?.payment_status;if(console.log("onSubmit controlCode:",{paymentStatus,controlCode,paymentMethodType,currentPaymentMethodType:currentPaymentMethodType2,control,order}),controlCode==="Authorised"&&paymentMethodType!=="giftcard"&&paymentStatus!=="partially_authorized")return console.log("return resultCode",{controlCode,paymentMethodType,paymentStatus}),{resultCode:controlCode};const attributes={payment_request_data:{...state.data,payment_method:state.data.paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,shopperInteraction:"Ecommerce",browser_info:{...browserInfo()}}};delete attributes.payment_request_data.paymentMethod;try{const psUp=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes});if(console.log("Payment source updated:",psUp),order?.id==null)return console.error("Order id is missing"),{resultCode:"Error"};if(console.log("Submitting payment with method:",currentPaymentMethodType2),currentPaymentMethodType2==="giftcard"){const giftCardBalanceCheck=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_balance:!0}}),currentBalance=giftCardBalanceCheck?.balance??0,totalAmount=order?.total_amount_with_taxes_cents??0,attributes2=currentBalance>=totalAmount?{_authorize:!0}:{_authorization_amount_cents:currentBalance,_authorize:!0};console.log("Gift card balance check:",{giftCardBalanceCheck,attributes:attributes2});const{order:orderUpdated}=await updateOrder({id:order.id,attributes:attributes2});console.log("First gift card authorization:",orderUpdated);const resultCode2=orderUpdated?.payment_source?.payment_response?.resultCode,refusalReasonCode=orderUpdated?.payment_source?.payment_response?.refusalReasonCode,errorCode=orderUpdated?.payment_source?.payment_response?.errorCode,action2=orderUpdated?.payment_source?.payment_response?.action,paymentStatus2=orderUpdated?.payment_status;if(["Cancelled","Refused"].includes(resultCode2)&&refusalReasonCode!=="12"||errorCode){const message=orderUpdated?.payment_response?.refusalReason??orderUpdated?.payment_response?.message;return{resultCode:errorCode?"Refused":resultCode2,message}}return console.log("Gift card authorized:",{resultCode:resultCode2,action:action2,orderUpdated,paymentStatus:paymentStatus2}),{resultCode:"Authorised",paymentMethodType:currentPaymentMethodType2,action:action2,paymentStatus:paymentStatus2}}const res=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_authorize:1}}),action=res?.payment_response?.action,resultCode=res?.payment_response?.resultCode;if(action!=null)return{resultCode,action};const issuerType=res?.payment_instrument?.issuer_type;if(["Authorised","Pending","Received"].includes(resultCode))return["apple pay","google pay"].includes(issuerType)&&setPlaceOrder!=null?(await setPlaceOrder({paymentSource:res,currentCustomerPaymentSourceId}),{resultCode}):(placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode});if(["Cancelled","Refused"].includes(resultCode)){const message=res?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType2,message}]),component&&component.mount("#adyen-dropin")}if(res?.payment_response?.errorType)if(res?.payment_response?.errorCode==="14_006")onSubmit(state,component);else{const message=res?.payment_response?.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType2,message}])}return{resultCode,paymentMethodType:currentPaymentMethodType2}}catch(error){const{message}=error;return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType2,message:message??"An error occurred"}]),{resultCode:"Error"}}};return useEffect(()=>{const paymentMethodsResponse={paymentMethods:paymentSource?.payment_methods?.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:paymentSource?.payment_methods?.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]};paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");let showStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null;order&&hasSubscriptions(order)&&(showStoredPaymentMethods=!1,paymentMethodsResponse.storedPaymentMethods=[],paymentMethodsResponse.paymentMethods=subscriptionPaymentMethods!=null&&subscriptionPaymentMethods.length>0?paymentMethodsResponse.paymentMethods.filter(pm=>subscriptionPaymentMethods.includes(pm.type)):paymentMethodsResponse.paymentMethods);const options={locale:order?.language_code??locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,onAdditionalDetails:(state,element,actions)=>{(async()=>{const{resultCode}=await handleOnAdditionalDetails(state,element);["Cancelled","Refused"].includes(resultCode)?actions.reject():actions.resolve({resultCode})})()},onChange:state=>{handleChange(state)},onSubmit:(state,element,actions)=>{(async()=>{const{resultCode,action,message,paymentStatus}=await onSubmit(state,element);console.log("onSubmit resultCode:",{resultCode,action,message,paymentStatus}),["Cancelled","Refused"].includes(resultCode)?(actions.reject(),message&&setGiftcardError(message)):action!=null?dropinRef.current?.handleAction(action):(actions.resolve({resultCode}),paymentStatus==="partially_authorized"&&dropinRef.current?.mount("#adyen-dropin"),setGiftcardError(null))})()}};if(!ref&&clientKey&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout){const initializeAdyen=async()=>{const checkout2=await AdyenCheckout(options),dropin=new Dropin(checkout2,{disableFinalAnimation:!0,showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],paymentMethodsConfiguration:{showStoredPaymentMethods,paypal:{showPayButton:!0,style:styles?.paypal,...config?.paymentMethodsConfiguration?.paypal},card:{enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1,...config?.paymentMethodsConfiguration?.card},giftcard:{showPayButton:!0,...config?.paymentMethodsConfiguration?.giftcard},...config?.paymentMethodsConfiguration},onDisableStoredPaymentMethod:state=>{const recurringDetailReference=state,shopperReference=customers?.shopper_reference??void 0;onDisableStoredPaymentMethod?.({recurringDetailReference,shopperReference}).then(response=>{response?setPaymentSource({paymentResource:"adyen_payments",order,attributes:{}}):console.error("onDisableStoredPaymentMethod error")}).catch(error=>{console.error("onDisableStoredPaymentMethod error",error)})},onSelect:component=>{const id=component._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=async()=>await handleSubmit(ref.current):ref.current.onsubmit=null,setPaymentRef({ref})),onSelect&&onSelect(component)},onReady(){onReady&&onReady()}}).mount("#adyen-dropin");dropin&&checkout2&&(dropinRef.current=dropin,setCheckout(dropin),setLoadAdyen(!0))},html=document.getElementById("adyen-dropin");!dropinRef.current&&status==="standby"&&html&&initializeAdyen()}return()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null,status]),!clientKey&&!loadAdyen&&!checkout?null:_jsxs("form",{ref,onSubmit:e=>{handleSubmit(e)},children:[_jsx("div",{className:cardContainerClassName,id:"adyen-dropin"}),giftcardError!=null&&giftcardErrorComponent?giftcardErrorComponent(giftcardError):null,templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]})}export default AdyenPayment;
2
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{AdyenCheckout,Dropin}from"@adyen/adyen-web/auto";import{useContext,useEffect,useRef,useState}from"react";import Parent from"../utils/Parent";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PlaceOrderContext from"../../context/PlaceOrderContext";import browserInfo,{cleanUrlBy}from"../../utils/browserInfo";import{getPublicIP}from"../../utils/getPublicIp";import{hasSubscriptions}from"../../utils/hasSubscriptions";import{setCustomerOrderParam}from"../../utils/localStorage";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,styles,onDisableStoredPaymentMethod,giftcardErrorComponent,onReady,onSelect,subscriptionPaymentMethods}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState(),[giftcardError,setGiftcardError]=useState(null),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order,updateOrder,getOrderByFields}=useContext(OrderContext),authConfig=useContext(CommerceLayerContext),{placeOrderButtonRef,setPlaceOrder,status}=useContext(PlaceOrderContext),{customers}=useContext(CustomerContext),ref=useRef(null),dropinRef=useRef(null),handleSubmit=async e=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;return savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),dropinRef.current&&dropinRef.current.submit(),!1},handleChange=async state=>{state.isValid&&ref.current&&(ref.current.onsubmit=async()=>await handleSubmit(ref.current),setPaymentRef({ref}))},handleOnAdditionalDetails=async(state,component)=>{const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}),resultCode=pSource?.payment_response?.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode};if(["Cancelled","Refused"].includes(resultCode)){const message=pSource?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return{resultCode}}catch(error){return console.error("Adyen additional details error:",error),{resultCode:"Error"}}},onSubmit=async(state,component)=>{const url=cleanUrlBy(),{type:currentPaymentMethodType2}=state.data.paymentMethod,shopperIp=await getPublicIP(),control=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"}),controlCode=control?.payment_response?.resultCode,paymentMethodType=control?.payment_response?.paymentMethod?.type??control?.payment_request_data?.payment_method?.type,paymentStatus=(await getOrderByFields({orderId:order?.id??"",fields:["status","payment_status"],config:authConfig}))?.payment_status;if(controlCode==="Authorised"&&paymentMethodType!=="giftcard"&&paymentStatus!=="partially_authorized")return{resultCode:controlCode};const attributes={payment_request_data:{...state.data,payment_method:state.data.paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,shopperInteraction:"Ecommerce",browser_info:{...browserInfo()}}};delete attributes.payment_request_data.paymentMethod;try{if(await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),order?.id==null)return console.error("Order id is missing"),{resultCode:"Error"};if(currentPaymentMethodType2==="giftcard"){const currentBalance=(await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_balance:!0}}))?.balance??0,totalAmount=order?.total_amount_with_taxes_cents??0,attributes2=currentBalance>=totalAmount?{_authorize:!0}:{_authorization_amount_cents:currentBalance,_authorize:!0},{order:orderUpdated}=await updateOrder({id:order.id,attributes:attributes2}),resultCode2=orderUpdated?.payment_source?.payment_response?.resultCode,refusalReasonCode=orderUpdated?.payment_source?.payment_response?.refusalReasonCode,errorCode=orderUpdated?.payment_source?.payment_response?.errorCode,action2=orderUpdated?.payment_source?.payment_response?.action,paymentStatus2=orderUpdated?.payment_status;if(["Cancelled","Refused"].includes(resultCode2)&&refusalReasonCode!=="12"||errorCode){const message=orderUpdated?.payment_response?.refusalReason??orderUpdated?.payment_response?.message;return{resultCode:errorCode?"Refused":resultCode2,message}}return{resultCode:"Authorised",paymentMethodType:currentPaymentMethodType2,action:action2,paymentStatus:paymentStatus2}}const res=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_authorize:1}}),action=res?.payment_response?.action,resultCode=res?.payment_response?.resultCode;if(action!=null)return{resultCode,action};const issuerType=res?.payment_instrument?.issuer_type;if(["Authorised","Pending","Received"].includes(resultCode))return["apple pay","google pay"].includes(issuerType)&&setPlaceOrder!=null?(await setPlaceOrder({paymentSource:res,currentCustomerPaymentSourceId}),{resultCode}):(placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode});if(["Cancelled","Refused"].includes(resultCode)){const message=res?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType2,message}]),component&&component.mount("#adyen-dropin")}if(res?.payment_response?.errorType)if(res?.payment_response?.errorCode==="14_006")onSubmit(state,component);else{const message=res?.payment_response?.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType2,message}])}return{resultCode,paymentMethodType:currentPaymentMethodType2}}catch(error){const{message}=error;return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType2,message:message??"An error occurred"}]),{resultCode:"Error"}}};return useEffect(()=>{const paymentMethodsResponse={paymentMethods:paymentSource?.payment_methods?.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:paymentSource?.payment_methods?.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]};paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");let showStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null;order&&hasSubscriptions(order)&&(showStoredPaymentMethods=!1,paymentMethodsResponse.storedPaymentMethods=[],paymentMethodsResponse.paymentMethods=subscriptionPaymentMethods!=null&&subscriptionPaymentMethods.length>0?paymentMethodsResponse.paymentMethods.filter(pm=>subscriptionPaymentMethods.includes(pm.type)):paymentMethodsResponse.paymentMethods);const options={locale:order?.language_code??locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,onAdditionalDetails:(state,element,actions)=>{(async()=>{const{resultCode}=await handleOnAdditionalDetails(state,element);["Cancelled","Refused"].includes(resultCode)?actions.reject():actions.resolve({resultCode})})()},onChange:state=>{handleChange(state)},onSubmit:(state,element,actions)=>{(async()=>{const{resultCode,action,message,paymentStatus}=await onSubmit(state,element);["Cancelled","Refused"].includes(resultCode)?(actions.reject(),message&&setGiftcardError(message)):action!=null?dropinRef.current?.handleAction(action):(actions.resolve({resultCode}),paymentStatus==="partially_authorized"&&dropinRef.current?.mount("#adyen-dropin"),setGiftcardError(null))})()}};if(!ref&&clientKey&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout){const initializeAdyen=async()=>{const checkout2=await AdyenCheckout(options),dropin=new Dropin(checkout2,{disableFinalAnimation:!0,showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],paymentMethodsConfiguration:{showStoredPaymentMethods,paypal:{showPayButton:!0,style:styles?.paypal,...config?.paymentMethodsConfiguration?.paypal},card:{enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1,...config?.paymentMethodsConfiguration?.card},giftcard:{showPayButton:!0,...config?.paymentMethodsConfiguration?.giftcard},...config?.paymentMethodsConfiguration},onDisableStoredPaymentMethod:state=>{const recurringDetailReference=state,shopperReference=customers?.shopper_reference??void 0;onDisableStoredPaymentMethod?.({recurringDetailReference,shopperReference}).then(response=>{response?setPaymentSource({paymentResource:"adyen_payments",order,attributes:{}}):console.error("onDisableStoredPaymentMethod error")}).catch(error=>{console.error("onDisableStoredPaymentMethod error",error)})},onSelect:component=>{const id=component._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=async()=>await handleSubmit(ref.current):ref.current.onsubmit=null,setPaymentRef({ref})),onSelect&&onSelect(component)},onReady(){onReady&&onReady()}}).mount("#adyen-dropin");dropin&&checkout2&&(dropinRef.current=dropin,setCheckout(dropin),setLoadAdyen(!0))},html=document.getElementById("adyen-dropin");!dropinRef.current&&status==="standby"&&html&&initializeAdyen()}return()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null,status]),!clientKey&&!loadAdyen&&!checkout?null:_jsxs("form",{ref,onSubmit:e=>{handleSubmit(e)},children:[_jsx("div",{className:cardContainerClassName,id:"adyen-dropin"}),giftcardError!=null&&giftcardErrorComponent?giftcardErrorComponent(giftcardError):null,templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]})}export default AdyenPayment;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import camelCase from"lodash/camelCase";import{invertedAddressesHandler,sanitizeMetadataFields}from"../utils/addressesManager";import baseReducer from"../utils/baseReducer";import{formCleaner}from"../utils/formCleaner";import getSdk from"../utils/getSdk";export const addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"],addressInitialState={errors:[]},setAddressErrors=({errors,dispatch,currentErrors=[],resource})=>{const billingErrors=resource==="billing_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="billing_address"),shippingErrors=resource==="shipping_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="shipping_address"),finalErrors=[...billingErrors,...shippingErrors];dispatch&&dispatch({type:"setErrors",payload:{errors:finalErrors}})};export function setAddress({values,resource,dispatch}){const payload={[`${resource}`]:{...formCleaner(values)}};dispatch&&dispatch({type:"setAddress",payload})}export const setCloneAddress=(id,resource,dispatch)=>{dispatch({type:"setCloneAddress",payload:{[`${camelCase(resource)}Id`]:id}})};export async function saveAddresses({config,updateOrder,order,state,customerEmail,customerAddress}){const{shipToDifferentAddress,invertAddresses,billing_address:billingAddressForm,shipping_address:shippingAddressForm,billingAddressId,shippingAddressId}=state;try{const sdk=getSdk(config),billingAddress=formCleaner(billingAddressForm),shippingAddress=formCleaner(shippingAddressForm);if(order){let orderAttributes=null;const billingAddressCloneId=customerAddress?.resource==="billing_address"?customerAddress?.id:billingAddressId,shippingAddressCloneId=customerAddress?.resource==="shipping_address"?customerAddress?.id:shippingAddressId;if(invertAddresses)orderAttributes=await invertedAddressesHandler({billingAddress,billingAddressId:billingAddressCloneId,customerEmail,order,shipToDifferentAddress,shippingAddress,shippingAddressId:shippingAddressCloneId,sdk});else{const doNotShipItems=order?.line_items?.every(lineItem=>lineItem?.item?.do_not_ship===!0),currentBillingAddressRef=order?.billing_address?.reference;if(orderAttributes={id:order?.id,_billing_address_clone_id:billingAddressCloneId,_shipping_address_clone_id:billingAddressCloneId,customer_email:customerEmail},currentBillingAddressRef===billingAddressCloneId&&(orderAttributes._billing_address_clone_id=order?.billing_address?.id,orderAttributes._shipping_address_clone_id=order?.shipping_address?.id),billingAddress!=null&&Object.keys(billingAddress).length>0&&!billingAddressCloneId){delete orderAttributes._billing_address_clone_id,delete orderAttributes._shipping_address_clone_id,doNotShipItems||(orderAttributes._shipping_address_same_as_billing=!0);const billingAddressWithMeta=sanitizeMetadataFields(billingAddress);let address;order?.billing_address?.id&&order?.billing_address?.reference==null?(address=await sdk.addresses.update({id:order.billing_address.id,...billingAddressWithMeta}),orderAttributes._refresh=!0):(address=await sdk.addresses.create(billingAddressWithMeta),orderAttributes.billing_address=sdk.addresses.relationship(address.id))}if(!shipToDifferentAddress&&billingAddressCloneId&&(console.log("Setting shipping address clone ID to billing address clone ID",orderAttributes),orderAttributes._shipping_address_same_as_billing=!0,orderAttributes._shipping_address_clone_id=billingAddressCloneId),shipToDifferentAddress&&(delete orderAttributes._shipping_address_same_as_billing,shippingAddressCloneId&&(orderAttributes._shipping_address_clone_id=shippingAddressCloneId),shippingAddress!=null&&Object.keys(shippingAddress).length>0)){delete orderAttributes._shipping_address_clone_id;const shippingAddressWithMeta=sanitizeMetadataFields(shippingAddress);let address;order?.shipping_address?.id&&order?.shipping_address?.reference==null?(address=await sdk.addresses.update({id:order.shipping_address.id,...shippingAddressWithMeta}),orderAttributes._refresh=!0):(address=await sdk.addresses.create(shippingAddressWithMeta),orderAttributes.shipping_address=sdk.addresses.relationship(address.id))}}if(orderAttributes!=null&&updateOrder){console.log("Updating order with attributes:",{orderAttributes,shipToDifferentAddress,billingAddressCloneId,shippingAddressCloneId});const orderUpdated=await updateOrder({id:order.id,attributes:orderAttributes});return console.log("Order updated:",orderUpdated),{success:!0,order:orderUpdated?.order}}}return{success:!1}}catch(error){return console.error(error),{success:!1,error}}}const type=["setErrors","setAddress","setShipToDifferentAddress","setCloneAddress","cleanup"],addressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default addressReducer;
2
+ import camelCase from"lodash/camelCase";import{invertedAddressesHandler,sanitizeMetadataFields}from"../utils/addressesManager";import baseReducer from"../utils/baseReducer";import{formCleaner}from"../utils/formCleaner";import getSdk from"../utils/getSdk";export const addressFields=["city","company","country_code","first_name","last_name","line_1","line_2","phone","state_code","zip_code"],addressInitialState={errors:[]},setAddressErrors=({errors,dispatch,currentErrors=[],resource})=>{const billingErrors=resource==="billing_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="billing_address"),shippingErrors=resource==="shipping_address"?errors.filter(e=>e.resource===resource):currentErrors.filter(e=>e.resource==="shipping_address"),finalErrors=[...billingErrors,...shippingErrors];dispatch&&dispatch({type:"setErrors",payload:{errors:finalErrors}})};export function setAddress({values,resource,dispatch}){const payload={[`${resource}`]:{...formCleaner(values)}};dispatch&&dispatch({type:"setAddress",payload})}export const setCloneAddress=(id,resource,dispatch)=>{dispatch({type:"setCloneAddress",payload:{[`${camelCase(resource)}Id`]:id}})};export async function saveAddresses({config,updateOrder,order,state,customerEmail,customerAddress}){const{shipToDifferentAddress,invertAddresses,billing_address:billingAddressForm,shipping_address:shippingAddressForm,billingAddressId,shippingAddressId}=state;try{const sdk=getSdk(config),billingAddress=formCleaner(billingAddressForm),shippingAddress=formCleaner(shippingAddressForm);if(order){let orderAttributes=null;const billingAddressCloneId=customerAddress?.resource==="billing_address"?customerAddress?.id:billingAddressId,shippingAddressCloneId=customerAddress?.resource==="shipping_address"?customerAddress?.id:shippingAddressId;if(invertAddresses)orderAttributes=await invertedAddressesHandler({billingAddress,billingAddressId:billingAddressCloneId,customerEmail,order,shipToDifferentAddress,shippingAddress,shippingAddressId:shippingAddressCloneId,sdk});else{const doNotShipItems=order?.line_items?.every(lineItem=>lineItem?.item?.do_not_ship===!0),currentBillingAddressRef=order?.billing_address?.reference;if(orderAttributes={id:order?.id,_billing_address_clone_id:billingAddressCloneId,_shipping_address_clone_id:billingAddressCloneId,customer_email:customerEmail},currentBillingAddressRef===billingAddressCloneId&&(orderAttributes._billing_address_clone_id=order?.billing_address?.id,orderAttributes._shipping_address_clone_id=order?.shipping_address?.id),billingAddress!=null&&Object.keys(billingAddress).length>0&&!billingAddressCloneId){delete orderAttributes._billing_address_clone_id,delete orderAttributes._shipping_address_clone_id,doNotShipItems||(orderAttributes._shipping_address_same_as_billing=!0);const billingAddressWithMeta=sanitizeMetadataFields(billingAddress);let address;order?.billing_address?.id&&order?.billing_address?.reference==null?(address=await sdk.addresses.update({id:order.billing_address.id,...billingAddressWithMeta}),orderAttributes._refresh=!0):(address=await sdk.addresses.create(billingAddressWithMeta),orderAttributes.billing_address=sdk.addresses.relationship(address.id))}if(!shipToDifferentAddress&&billingAddressCloneId&&(orderAttributes._shipping_address_same_as_billing=!0,orderAttributes._shipping_address_clone_id=billingAddressCloneId),shipToDifferentAddress&&(delete orderAttributes._shipping_address_same_as_billing,shippingAddressCloneId&&(orderAttributes._shipping_address_clone_id=shippingAddressCloneId),shippingAddress!=null&&Object.keys(shippingAddress).length>0)){delete orderAttributes._shipping_address_clone_id;const shippingAddressWithMeta=sanitizeMetadataFields(shippingAddress);let address;order?.shipping_address?.id&&order?.shipping_address?.reference==null?(address=await sdk.addresses.update({id:order.shipping_address.id,...shippingAddressWithMeta}),orderAttributes._refresh=!0):(address=await sdk.addresses.create(shippingAddressWithMeta),orderAttributes.shipping_address=sdk.addresses.relationship(address.id))}}if(orderAttributes!=null&&updateOrder)return{success:!0,order:(await updateOrder({id:order.id,attributes:orderAttributes}))?.order}}return{success:!1}}catch(error){return console.error(error),{success:!1,error}}}const type=["setErrors","setAddress","setShipToDifferentAddress","setCloneAddress","cleanup"],addressReducer=(state,reducer)=>baseReducer(state,reducer,type);export default addressReducer;
@@ -37,7 +37,7 @@ export interface OrderPayload {
37
37
  include?: ResourceIncluded[] | undefined;
38
38
  includeLoaded?: ResourceIncludedLoaded;
39
39
  withoutIncludes?: boolean;
40
- manageAdyenGiftCard?: boolean;
40
+ managePaymentProviderGiftCards?: boolean;
41
41
  }
42
42
  export type AddToCartImportValues = Pick<AddToCartImportParams, "lineItems">;
43
43
  export type getOrderContext = (id: string) => Promise<undefined | Order>;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export function manageGiftCard({order}){if(!order||!order?.payment_source)return null;const getPaymentSource=order.payment_source?.type==="adyen_payments"?order.payment_source:null;if(!getPaymentSource||getPaymentSource?.payment_response?.errorCode||getPaymentSource?.payment_response?.refusalReasonCode!=="12"||!(getPaymentSource?.payment_request_data?.payment_method?.type==="giftcard"))return null;const additionalData=getPaymentSource?.payment_response?.additionalData,amount=getPaymentSource?.payment_response?.amount?.value,giftCardData={cardSummary:additionalData?.cardSummary,currentBalanceValue:amount??Number.parseInt(additionalData?.currentBalanceValue),currentBalanceCurrency:additionalData?.currentBalanceCurrency,cardBrand:additionalData?.originalSelectedBrand??additionalData?.paymentMethod,formattedBalanceValue:additionalData?.currentBalanceValue},formattedOrderTotal=((order?.total_amount_with_taxes_cents!=null?order?.total_amount_with_taxes_cents-giftCardData.currentBalanceValue:0)/100).toLocaleString(order.language_code??"en",{style:"currency",currency:order?.currency_code??"USD"}),formattedCurrentBalance=(giftCardData.currentBalanceValue/100).toLocaleString(order.language_code??"en",{style:"currency",currency:order?.currency_code??"USD"});return giftCardData.formattedBalanceValue=formattedCurrentBalance,{...giftCardData,formattedOrderTotal}}
2
+ import{formatCentsToCurrency}from"../currencies";export function manageGiftCard({order}){if(!order||!order?.payment_source)return null;const getPaymentSource=order.payment_source?.type==="adyen_payments"?order.payment_source:null;if(!getPaymentSource||getPaymentSource?.payment_response?.errorCode||!(getPaymentSource?.payment_request_data?.payment_method?.type==="giftcard"))return null;const additionalData=getPaymentSource?.payment_response?.additionalData,amount=getPaymentSource?.payment_response?.amount?.value??0,giftCardData={cardSummary:additionalData?.cardSummary??"",currentBalanceValue:amount??Number.parseInt(additionalData?.currentBalanceValue)??0,currentBalanceCurrency:additionalData?.currentBalanceCurrency??"",cardBrand:additionalData?.originalSelectedBrand??additionalData?.paymentMethod??"",formattedBalanceValue:additionalData?.currentBalanceValue??""},orderTotal=order?.total_amount_with_taxes_cents!=null?order?.total_amount_with_taxes_cents-giftCardData.currentBalanceValue:0,currencyCode=order?.currency_code??"USD",formattedOrderTotal=formatCentsToCurrency(orderTotal,currencyCode),formattedCurrentBalance=formatCentsToCurrency(giftCardData.currentBalanceValue,currencyCode);return giftCardData.formattedBalanceValue=formattedCurrentBalance,giftCardData.cardSummary===""?null:{...giftCardData,formattedOrderTotal}}