Skip to content

Commit

Permalink
chore: core changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritish Budhiraja committed Mar 12, 2024
1 parent 3e02834 commit d1b529b
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Payments/PaypalSDK.res
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let make = (~sessionObj: SessionsType.token, ~list: PaymentMethodsRecord.list) =
{client: clientInstance},
(paypalCheckoutErr, paypalCheckoutInstance) => {
switch paypalCheckoutErr->Nullable.toOption {
| Some(val) => Js.Console.warn(`INTEGRATION ERROR: ${val.message}`)
| Some(val) => Console.warn(`INTEGRATION ERROR: ${val.message}`)
| None => ()
}
paypalCheckoutInstance.loadPayPalSDK(.
Expand Down
4 changes: 2 additions & 2 deletions src/Utilities/ErrorUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ let manageErrorWarning = (
~logCategory=USER_ERROR,
(),
)
Js.Console.warn(string)
Console.warn(string)
| (Error, Dynamic(fn)) =>
logger.setLogError(
~value=fn(dynamicStr),
Expand All @@ -156,7 +156,7 @@ let manageErrorWarning = (
~logCategory=USER_ERROR,
(),
)
Js.Console.warn(fn(dynamicStr))
Console.warn(fn(dynamicStr))
}
}
| None => ()
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/PaymentBody.res
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ let savedCardBody = (~paymentToken, ~customerId, ~cvcNumber) => [
let customerAcceptanceBody =
[
("acceptance_type", "online"->JSON.Encode.string),
("accepted_at", Js.Date.now()->Js.Date.fromFloat->Js.Date.toISOString->JSON.Encode.string),
("accepted_at", Date.now()->Js.Date.fromFloat->Date.toISOString->JSON.Encode.string),
(
"online",
[("user_agent", BrowserSpec.navigator.userAgent->JSON.Encode.string)]
Expand Down
5 changes: 1 addition & 4 deletions src/Utilities/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ let getInt = (dict, key, default: int) => {
->Belt.Float.toInt
}

let getFloatFromString = (str, default) => {
let val = str->Js.Float.fromString
val->Js.Float.isNaN ? default : val
}
let getFloatFromString = (str, default) => str->Float.fromString->Option.getOr(default)

let getFloatFromJson = (json, default) => {
switch json->JSON.Classify.classify {
Expand Down
2 changes: 1 addition & 1 deletion src/Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ external style: Dom.element => style = "style"
@send external paymentRequest: (JSON.t, JSON.t, JSON.t) => JSON.t = "PaymentRequest"
@send external click: Dom.element => unit = "click"

let iframePostMessage = (iframeRef: Js.nullable<Dom.element>, message) => {
let iframePostMessage = (iframeRef: nullable<Dom.element>, message) => {
switch iframeRef->Nullable.toOption {
| Some(ref) =>
try {
Expand Down
2 changes: 1 addition & 1 deletion src/orca-loader/Hyper.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let checkAndAppend = (selector, child) => {

if (
Window.querySelectorAll(`script[src="${GlobalVars.sentryScriptUrl}"]`)->Array.length === 0 &&
Js.typeof(GlobalVars.sentryScriptUrl) !== "undefined"
GlobalVars.sentryScriptUrl->typeof !== #undefined
) {
try {
let script = Window.createElement("script")
Expand Down
2 changes: 1 addition & 1 deletion src/orca-loader/LoaderPaymentElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ let make = (componentType, options, setIframeRef, iframeRef, mountPostMessage) =
switch oElement->Nullable.toOption {
| Some(elem) => elem->Window.innerHTML("")
| None =>
Js.Console.warn(
Console.warn(
"INTEGRATION ERROR: Div does not seem to exist on which payment element is to mount/unmount",
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/orca-loader/Types.res
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type eventHandler = option<JSON.t> => unit
module This = {
type t
@get
external iframeElem: t => option<Js.nullable<Dom.element>> = "iframeElem"
external iframeElem: t => option<nullable<Dom.element>> = "iframeElem"
}

type paymentElement = {
Expand Down

0 comments on commit d1b529b

Please sign in to comment.