Skip to content

Commit

Permalink
Merge branch 'main' of github.com:juspay/hyperswitch-web into refacto…
Browse files Browse the repository at this point in the history
…r/rescript-core-changes-json
  • Loading branch information
Pritish Budhiraja committed Mar 11, 2024
2 parents 8aa21a4 + 6d95afe commit 293f11f
Show file tree
Hide file tree
Showing 26 changed files with 344 additions and 266 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [0.28.0](https://github.com/juspay/hyperswitch-web/compare/v0.27.5...v0.28.0) (2024-03-08)


### Features

* **PaymentElement:** moved SavedCards component outside card form ([#197](https://github.com/juspay/hyperswitch-web/issues/197)) ([8e11c40](https://github.com/juspay/hyperswitch-web/commit/8e11c4087773a0c36d82f3b63358c3e9f6a9917f))

## [0.27.5](https://github.com/juspay/hyperswitch-web/compare/v0.27.4...v0.27.5) (2024-03-08)

## [0.27.4](https://github.com/juspay/hyperswitch-web/compare/v0.27.3...v0.27.4) (2024-03-08)
Expand Down
179 changes: 121 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
"version": "0.27.5",
"version": "0.28.0",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/CardTheme.res
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ let getLocaleObject = string => {
}
LocaleString.localeStrings
->Array.filter(item => item.locale == val)
->Belt.Array.get(0)
->Array.get(0)
->Option.getOr(LocaleString.defaultLocale)
}
let defaultRecoilConfig: recoilConfig = {
Expand Down
26 changes: 13 additions & 13 deletions src/CardUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ let getQueryParamsDictforKey = (searchParams, keyName) => {
->String.split("&")
->Array.forEach(paramStr => {
let keyValArr = String.split(paramStr, "=")
let key = keyValArr->Belt.Array.get(0)->Option.getOr("")
let key = keyValArr->Array.get(0)->Option.getOr("")
let value = if keyValArr->Array.length > 0 {
keyValArr->Belt.Array.get(1)->Option.getOr("")
keyValArr->Array.get(1)->Option.getOr("")
} else {
""
}
Expand Down Expand Up @@ -116,7 +116,7 @@ let getobjFromCardPattern = cardBrand => {
->Array.filter(item => {
cardBrand === item.issuer
})
->Belt.Array.get(0)
->Array.get(0)
->Option.getOr(CardPattern.defaultCardPattern)
}

Expand All @@ -129,7 +129,7 @@ let slice = (val, start: int, end: int) => {
}

let getStrFromIndex = (arr: array<string>, index) => {
arr->Belt.Array.get(index)->Option.getOr("")
arr->Array.get(index)->Option.getOr("")
}

let formatCVCNumber = (val, cardType) => {
Expand All @@ -145,8 +145,8 @@ let getCurrentMonthAndYear = (dateTimeIsoString: string) => {
let date = tempTimeDate[0]->Option.getOr("")
let dateComponents = date->String.split("-")

let currentMonth = dateComponents->Belt.Array.get(1)->Option.getOr("")
let currentYear = dateComponents->Belt.Array.get(0)->Option.getOr("")
let currentMonth = dateComponents->Array.get(1)->Option.getOr("")
let currentYear = dateComponents->Array.get(0)->Option.getOr("")

(currentMonth->toInt, currentYear->toInt)
}
Expand Down Expand Up @@ -178,8 +178,8 @@ let formatCardNumber = (val, cardType) => {
let splitExpiryDates = val => {
let split = val->String.split("/")
let value = split->Array.map(item => item->String.trim)
let month = value->Belt.Array.get(0)->Option.getOr("")
let year = value->Belt.Array.get(1)->Option.getOr("")
let month = value->Array.get(0)->Option.getOr("")
let year = value->Array.get(1)->Option.getOr("")
(month, year)
}
let getExpiryDates = val => {
Expand Down Expand Up @@ -274,7 +274,7 @@ let getCardBrand = cardNumber => {
}
})
->Array.filter(item => item !== "")
->Belt.Array.get(0)
->Array.get(0)
->Option.getOr("")
}
} catch {
Expand Down Expand Up @@ -307,8 +307,8 @@ let calculateLuhn = value => {
}
})

let sumofCheckArr = Belt.Array.reduce(checkArr, 0, (acc, val) => acc + val->toInt)
let sumofUnCheckedArr = Belt.Array.reduce(unCheckArr, 0, (acc, val) => acc + val->toInt)
let sumofCheckArr = Array.reduce(checkArr, 0, (acc, val) => acc + val->toInt)
let sumofUnCheckedArr = Array.reduce(unCheckArr, 0, (acc, val) => acc + val->toInt)
let totalSum = sumofCheckArr + sumofUnCheckedArr
mod(totalSum, 10) == 0
}
Expand Down Expand Up @@ -425,7 +425,7 @@ let genreateFontsLink = (fonts: array<CardThemeType.fonts>) => {
}
let maxCardLength = cardBrand => {
let obj = getobjFromCardPattern(cardBrand)
Belt.Array.reduce(obj.length, 0, (acc, val) => acc > val ? acc : val)
Array.reduce(obj.length, 0, (acc, val) => acc > val ? acc : val)
}

let cardValid = (cardNumber, cardBrand) => {
Expand Down Expand Up @@ -513,7 +513,7 @@ let pincodeVisibility = cardNumber => {
let brandPattern =
CardPattern.cardPatterns
->Array.filter(obj => obj.issuer == brand)
->Belt.Array.get(0)
->Array.get(0)
->Option.getOr(CardPattern.defaultCardPattern)
brandPattern.pincodeRequired
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/AccordionContainer.res
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Loader = {
open PaymentElementShimmer
switch list {
| SemiLoaded =>
Belt.Array.make(cardShimmerCount - 1, "")
Array.make(~length=cardShimmerCount - 1, "")
->Array.mapWithIndex((_, i) => {
let borderStyle = layoutClass.spacedAccordionItems
? themeObj.borderRadius
Expand Down
2 changes: 1 addition & 1 deletion src/Components/DropdownField.res
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let make = (
}, [themeObj])
React.useEffect0(() => {
if value === "" {
setValue(_ => options->Belt.Array.get(0)->Option.getOr(""))
setValue(_ => options->Array.get(0)->Option.getOr(""))
}
None
})
Expand Down
4 changes: 2 additions & 2 deletions src/Components/DynamicFields.res
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ let make = (
)

React.useEffect0(() => {
let bank = bankNames->Belt.Array.get(0)->Option.getOr("")
let bank = bankNames->Array.get(0)->Option.getOr("")
setSelectedBank(_ => bank)
None
})
Expand Down Expand Up @@ -254,7 +254,7 @@ let make = (
requiredFieldType.field_type === item &&
requiredFieldType.display_name === "card_holder_name"
)
->Belt.Array.length > 0
->Array.length > 0
) {
Some(localeString.cardHolderName)
} else {
Expand Down
Loading

0 comments on commit 293f11f

Please sign in to comment.