41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
// Metro module 14798 (f14799).
|
|
import { useState, useCallback } from "react";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import ToastActionCreators from "../../toast/native/ToastActionCreators";
|
|
import { Card } from "../../../design/components/Card/native/Card.native";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { TextInput } from "../../../design/components/TextInput/native/TextInput.native";
|
|
import { Button } from "../../../design/components/Button/native/Button.native";
|
|
const useStyles = createStyles({
|
|
textInput: {
|
|
marginBottom: 16
|
|
},
|
|
title: {
|
|
marginBottom: 8
|
|
}
|
|
});
|
|
export default function OrbCheckoutMenu() {
|
|
const styles = useStyles();
|
|
const [state, setState] = useState("1409898407849365565");
|
|
return <Card>
|
|
<Text style={styles.title} variant="text-md/bold">Redeem SKU for Orbs</Text>
|
|
<TextInput containerStyle={styles.textInput} label="SKU ID" value={state} onChange={(event) => setState(event)} isClearable />
|
|
<Text style={styles.title} variant="text-md/bold">Checkout will open with the orb price of the product, if it exists</Text>
|
|
<Button text="Open Orbs Checkout" variant="primary" onPress={useCallback(() => {
|
|
if (state != null) {
|
|
ModalActionCreators.pushLazy(import("../checkout/native/OrbCheckoutModal"), {
|
|
skuId: state,
|
|
analyticsLocations: [],
|
|
onCheckoutSuccess: () => {
|
|
ToastActionCreators.open({
|
|
key: "ORB_CHECKOUT_SUCCESS",
|
|
content: "Successfully redeemed item with Orbs"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}, [state])} disabled={state == null} />
|
|
</Card>;
|
|
};
|