|
| 1 | +export const reactJS = "React"; |
| 2 | +export const angular = "Angular"; |
| 3 | +export const vue = "Vue"; |
| 4 | +export const nextjs = "Next JS"; |
| 5 | +export const web = "Web"; |
| 6 | +export const mobile = "Mobile"; |
| 7 | +export const gaming = "Gaming"; |
| 8 | +export const enterprise = "Enterprise"; |
| 9 | +export const android = "Android"; |
| 10 | +export const ios = "iOS"; |
| 11 | +export const js = "Javascript"; |
| 12 | +export const macOS = "macOS"; |
| 13 | +export const reactnative = "React Native"; |
| 14 | +export const rnbare = "React Native Bare"; |
| 15 | +export const rnexpo = "React Native Expo"; |
| 16 | +export const rnlist = [rnbare, rnexpo]; |
| 17 | +export const flutter = "Flutter"; |
| 18 | +export const unity = "Unity"; |
| 19 | +export const unreal = "Unreal Engine"; |
| 20 | +export const nodejs = "Node.js"; |
| 21 | +export const weblist = [reactJS, angular, vue, nextjs]; |
| 22 | + |
| 23 | +export const pnp = "Plug and Play"; |
| 24 | +export const sfa = "Single Factor Auth"; |
| 25 | +export const pnpwebmodal = "Plug and Play Web Modal"; |
| 26 | +export const pnpwebnomodal = "Plug and Play Web No Modal"; |
| 27 | +export const pnpandroid = "Plug and Play Android"; |
| 28 | +export const pnpios = "Plug and Play iOS"; |
| 29 | +export const pnprn = "Plug and Play React Native"; |
| 30 | +export const pnpflutter = "Plug and Play Flutter"; |
| 31 | +export const pnpunity = "Plug and Play Unity"; |
| 32 | +export const pnpunreal = "Plug and Play Unreal"; |
| 33 | +export const pnplist = [ |
| 34 | + { label: "Web - Modal", value: pnpwebmodal, platforms: [...weblist] }, |
| 35 | + { label: "Web - No Modal", value: pnpwebnomodal, platforms: [...weblist] }, |
| 36 | + { label: "Android", value: pnpandroid, platforms: [android] }, |
| 37 | + { label: "iOS", value: pnpios, platforms: [ios] }, |
| 38 | + { label: "React Native", value: pnprn, platforms: [...rnlist] }, |
| 39 | + { label: "Flutter", value: pnpflutter, platforms: [flutter] }, |
| 40 | + { label: "Unity", value: pnpunity, platforms: [unity] }, |
| 41 | + { label: "Unreal", value: pnpunreal, platforms: [unreal] }, |
| 42 | +]; |
| 43 | + |
| 44 | +export const mpccorekit = "MPC Core Kit"; |
| 45 | +export const singlefactorauth = "Single Factor Auth"; |
| 46 | +export const singlefactorauthjs = "SFA JS"; |
| 47 | +export const singlefactorauthandroid = "SFA Android"; |
| 48 | +export const singlefactorauthios = "SFA Swift"; |
| 49 | +export const singlefactorauthflutter = "SFA Flutter"; |
| 50 | +export const mpccorekitjs = "MPC Core Kit JS"; |
| 51 | +export const mpccorekitreactnative = "MPC Core Kit React Native"; |
| 52 | + |
| 53 | +export const sfalist = [ |
| 54 | + { label: "SFA JS", value: singlefactorauthjs, platforms: [...weblist, reactnative, nodejs] }, |
| 55 | + { label: "SFA Android", value: singlefactorauthandroid, platforms: [android] }, |
| 56 | + { label: "SFA Swift", value: singlefactorauthios, platforms: [ios, macOS] }, |
| 57 | + { label: "SFA Flutter", value: singlefactorauthflutter, platforms: [flutter] }, |
| 58 | +]; |
| 59 | + |
| 60 | +export const mpccorekitlist = [ |
| 61 | + { label: "MPC Core Kit JS", value: mpccorekitjs, platforms: [...weblist, reactnative, nodejs] }, |
| 62 | + { label: "MPC Core Kit React Native", value: mpccorekitreactnative, platforms: [reactnative] }, |
| 63 | +]; |
| 64 | + |
| 65 | +const getWindowLocation = () => { |
| 66 | + if (typeof window !== "undefined") return window.location.href; |
| 67 | + return "http://localhost"; |
| 68 | +}; |
| 69 | + |
| 70 | +export const getOptionsfromURL = (): Record<string, string> => { |
| 71 | + const url = new URL(getWindowLocation()); |
| 72 | + |
| 73 | + const urlOpts = {}; |
| 74 | + url.searchParams.forEach((value, key) => { |
| 75 | + urlOpts[key] = value; |
| 76 | + }); |
| 77 | + |
| 78 | + return { ...urlOpts }; |
| 79 | +}; |
| 80 | + |
| 81 | +export const setURLfromOptions = (opts: Record<string, string>): string => { |
| 82 | + const url = new URL(getWindowLocation()); |
| 83 | + |
| 84 | + url.search = ""; |
| 85 | + for (const [key, value] of Object.entries(opts)) url.searchParams.append(key, value); |
| 86 | + return url.toString(); |
| 87 | +}; |
0 commit comments