/* Metro module 12283; source: components_native/premium/OutboundPromotionClaimAlert.tsx; dependencies: [57, 31, 27, 661, 33, 4501, 697, 12284, 6771, 6789, 7286, 12285, 1305, 1244, 4573, 4578, 6797, 12286, 4596, 3853, 2] */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import Alert from '../common/Alert.tsx'; /* Metro dependency 4596 */
import UseAnalyticsLocations from '../../modules/app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import AnalyticsLocation from '../../modules/app_analytics/AnalyticsLocation.tsx'; /* Metro dependency 6789 */
import UseResettingValue from '../../hooks/useResettingValue.tsx'; /* Metro dependency 12284 */
import Module12286 from '../../by-id/module-12286.js'; /* Metro dependency 12286 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as TextModule from '../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
function _fun93847(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12469:6, offset: 0x020c6a5f, size: 638 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_5 = value.ActivityIndicator;
const env0_6 = value.View;
const env0_7 = value.Image;
const env0_8 = value.ScrollView;
const Fonts = (ConstantsModule).Fonts;
value = require(33) /* metro dependency 33 */;
const env0_9 = value.jsx;
const env0_10 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
object.loading = {marginVertical: 80};
object.body = {alignItems: 'center'};
const MOBILE_TEXT_HEADING_PRIMARY = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_TEXT_HEADING_PRIMARY;
const PRIMARY_BOLD = Fonts.PRIMARY_BOLD;
object.title = {'fontSize': 24, 'lineHeight': 30, 'color': null, 'fontFamily': null, 'marginBottom': 8,
color: MOBILE_TEXT_HEADING_PRIMARY, fontFamily: PRIMARY_BOLD};
object.errorTitle = {'lineHeight': 24, 'marginBottom': 8};
object.bodyText = {'textAlign': 'center', 'lineHeight': 20};
const object5 = {'backgroundColor': null, 'marginTop': 16, 'padding': 12};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object5.backgroundColor = BACKGROUND_SURFACE_HIGH;
object5.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.copyInputContainer = object5;
object.copyInputLabel = {'lineHeight': 20, 'marginBottom': 8};
const object6 = {'borderWidth': 1, 'borderColor': null, 'borderRadius': null, 'padding': 8, 'marginBottom': 8,
'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between'};
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
object6.borderColor = BACKGROUND_BASE_LOWEST;
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
object.copyInput = object6;
const ICON_FEEDBACK_POSITIVE = (importDefault(697) /* metro dependency 697: native */).colors.ICON_FEEDBACK_POSITIVE;
object.copyInputCopied = {borderColor: ICON_FEEDBACK_POSITIVE};
object.copyButton = {'paddingHorizontal': 8, 'marginLeft': 8};
object.promotionArt = {'width': 200, 'height': 100, 'marginBottom': 20};
object.errorArt = {'width': 141, 'height': 99, 'marginBottom': 20};
const env0_11 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('components_native/premium/OutboundPromotionClaimAlert.tsx');
exports.default = OutboundPromotionClaimAlert;
function OutboundPromotionClaimAlert({onCancel, onClaim, code, outboundPromotion}) { // fn#93848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12469:1113, offset: 0x020c6cdd, size: 1599 bytes, params: 2, frame: 38
var r15;
var r4;
var items5;
var LegacyText;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const Text = (TextModule).Text;
var items2;
var object3;
var copyInput;
var object4;
var items3;
var Button;
const outboundPromotion2 = outboundPromotion;
const styles = useStyles();
const binding = env0_4;
const value3 = binding.useState(null);
const binding2 = outboundPromotion2;
const value4 = binding2(value3, 2);
const property = value4[0];
var env0_4 = value4[1];
const value5 = binding2((UseResettingValue)(false, 2000), 2);
const property2 = value5[0];
const env0_5 = value5[1];
const value6 = code != null;
const defaultImport2 = UseAnalyticsLocations;
const USER_SETTINGS_GIFT_INVENTORY = (AnalyticsLocation).USER_SETTINGS_GIFT_INVENTORY;
binding.useEffect(_fun93849, [value6, outboundPromotion.id, outboundPromotion.outboundTitle,
outboundPromotion.partnerId, onClaim, defaultImport2(USER_SETTINGS_GIFT_INVENTORY).analyticsLocations]);
if (code != null) {
var viewBindingProps = {style: styles.body};
items5 = [
,
];
LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
string = intl.string;
items5[1] = (
{Reflect.apply(string, intl, [t['23BfZh']])}
);
items5[2] = (
{outboundPromotion.outboundRedemptionModalBody}
);
var viewBindingProps2 = {style: styles.copyInputContainer};
string = intl.string;
items2 = [
{Reflect.apply(string, intl, [t.s9LFQh])}
,
];
object3 = {};
copyInput = styles.copyInput;
if (property2) {
object4 = {};
copyDataProperties(object4, copyInput, 13);
copyDataProperties(object4, styles.copyInputCopied, 13);
r15 = object4;
} else {
r15 = copyInput;
}
object3.style = r15;
items3 = [
{code}
,
];
var viewBinding2Props = {style: styles.copyButton};
Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
string = intl.string;
items3[1] = (
);
items2[1] = (
{items3}
);
items2[2] = (
{'This code is included in your confirmation email'}
);
items5[3] = (
{items2}
);
r4 = (
{items5}
);
} else {
r4 = ;
}
const items4 = [
,
];
items4[1] = (
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.iufib1)}
);
items4[2] = (
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.eAn6z2)}
);
const view = (
{items4}
);
const r11 = property != null ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.cpT0Cq) : intl.string((require(1244) /* metro dependency 1244: indexNative */).t['+zx47d']);
const r8 = property != null ? undefined : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.TulDPl);
r4 = property != null ? view : r4;
return (
{r4}
);
function _fun93849() { // fn#93849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12469:1384, offset: 0x020c731c, size: 134 bytes, params: 1, frame: 15
var environment;
var value2;
var moduleValue;
var claimOutboundPromotion;
var outboundPromotionBinding;
var value;
if (!result) {
value2 = environment.__proto__;
moduleValue = require(7286) /* metro dependency 7286: PromotionUtils */;
claimOutboundPromotion = moduleValue.claimOutboundPromotion;
outboundPromotionBinding = outboundPromotion;
value = Reflect.apply(claimOutboundPromotion, moduleValue, [{promotionId: outboundPromotionBinding.id,
promotionTitle: outboundPromotionBinding.outboundTitle, partnerId: outboundPromotionBinding.partnerId,
analyticsLocations: analyticsLocations}]);
value = value.then(function(a0) {
return onClaim(a0);
});
value.catch(_fun93851);
}
function _fun93851(a0) { // fn#93851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12469:1541, offset: 0x01e1b407, size: 19 bytes, params: 2, frame: 11
return env1_4(a0);
}
}
function OutboundPromotionClaimAlertOnPress() { // fn#93853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12469:2559, owner: OutboundPromotionClaimAlert.onPress, offset: 0x020c73a2, size: 56 bytes, params: 1, frame: 13
let value = environment.__proto__;
value = require(6797) /* metro dependency 6797: ClipboardUtilsNative */;
value.copy(code);
env0_5(true);
}
function OutboundPromotionClaimAlertOnConfirm() { // fn#93854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12469:3219, owner: OutboundPromotionClaimAlert.onConfirm, offset: 0x020c73da, size: 97 bytes, params: 1, frame: 17
var value2;
var moduleValue;
if (code != null) {
value2 = environment.__proto__;
moduleValue = require(7286) /* metro dependency 7286: PromotionUtils */;
(importDefault(3853) /* metro dependency 3853: Linking */).openURL(moduleValue.getOutboundPromotionRedemptionUrl(code,
outboundPromotion));
}
onCancel();
}
}
}
global.__d(_fun93847, 12283, [57, 31, 27, 661, 33, 4501, 697, 12284, 6771, 6789, 7286, 12285, 1305, 1244, 4573,
4578, 6797, 12286, 4596, 3853,
2]) /* metro module 12283, dependencies: [57, 31, 27, 661, 33, 4501, 697, 12284, 6771, 6789, 7286, 12285, 1305, 1244, 4573, 4578, 6797, 12286, 4596, 3853, 2] */;