Skip to content

fix(util-defaults-mode-browser): import bowser by default export #3203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { memoize } from "@aws-sdk/property-provider";
import type { DefaultsMode, ResolvedDefaultsMode } from "@aws-sdk/smithy-client";
import type { Provider } from "@aws-sdk/types";
import { parse } from "bowser";
import bowser from "bowser";

import { DEFAULTS_MODE_OPTIONS } from "./constants";

Expand Down Expand Up @@ -45,7 +45,9 @@ export const resolveDefaultsModeConfig = ({

const isMobileBrowser = (): boolean => {
const parsedUA =
typeof window !== "undefined" && window?.navigator?.userAgent ? parse(window.navigator.userAgent) : undefined;
typeof window !== "undefined" && window?.navigator?.userAgent
? bowser.parse(window.navigator.userAgent)
: undefined;
const platform = parsedUA?.platform?.type;
// Reference: https://github.com/lancedikson/bowser/blob/master/src/constants.js#L86
return platform === "tablet" || platform === "mobile";
Expand Down