224 lines
11 KiB
TypeScript
224 lines
11 KiB
TypeScript
/* Metro module 12290; source: components_native/premium/GiftCodeRow.tsx; dependencies: [6, 7, 15, 17, 18, 31, 27, 661, 33, 4501, 697, 4129, 9212, 8451, 6992, 4573, 4578, 1244, 3738, 1305, 3868, 2] */
|
|
function _fun93884(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:6, offset: 0x020c8995, size: 710 bytes, params: 8, frame: 26
|
|
var object2;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const value2 = require(27) /* metro dependency 27 */;
|
|
const env0_8 = value2.View;
|
|
const StyleSheet = value2.StyleSheet;
|
|
const env0_9 = value2.TouchableWithoutFeedback;
|
|
const env0_10 = (require(661) /* metro dependency 661: Constants */).AnalyticsSections;
|
|
const value3 = require(33) /* metro dependency 33 */;
|
|
const env0_11 = value3.jsx;
|
|
const env0_12 = value3.jsxs;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createLegacyClassComponentStyles = createStylesModule.createLegacyClassComponentStyles;
|
|
object2 = {};
|
|
object2.giftCodeRow = {paddingHorizontal: 16};
|
|
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
|
|
object2.giftCodeRowLegacy = {backgroundColor: BACKGROUND_SURFACE_HIGH};
|
|
const object3 = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between',
|
|
'marginVertical': 8, 'padding': 8};
|
|
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
object3.borderWidth = StyleSheet.hairlineWidth;
|
|
const INPUT_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.INPUT_BACKGROUND_DEFAULT;
|
|
object3.backgroundColor = INPUT_BACKGROUND_DEFAULT;
|
|
object2.giftCodeShare = object3;
|
|
const object6 = {};
|
|
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object6.marginTop = PX_16;
|
|
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
|
|
object6.marginBottom = PX_4;
|
|
object2.giftCodeInput = object6;
|
|
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object2.giftCodeInputContent = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between',
|
|
padding: PX_8};
|
|
object2.giftCodeShareButton = {marginLeft: 12};
|
|
object2.codeText = {flexShrink: 1};
|
|
object2.subTextRow = {'marginBottom': 8, 'flexDirection': 'row', 'alignItems': 'center'};
|
|
object2.expiryText = {'fontSize': 12, 'lineHeight': 16};
|
|
const BLUE_345 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BLUE_345;
|
|
object2.revokeHint = {color: BLUE_345};
|
|
object2.firstRow = {borderWidth: 0};
|
|
object2.buttonContainer = {'flexShrink': 0, 'flexGrow': 1};
|
|
const env0_13 = Reflect.apply(createLegacyClassComponentStyles, createStylesModule, [object2]);
|
|
const PureComponent = value.PureComponent;
|
|
value = _fun93888(PureComponent);
|
|
const ThemeContext = (require(3868) /* metro dependency 3868: native */).ThemeContext;
|
|
value.contextType = ThemeContext;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/premium/GiftCodeRow.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_93885() { // fn#93885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:276, offset: 0x020c8c5b, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_93885_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun93888(a0) { // fn#93888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:1352, offset: 0x020c8cbd, size: 99 bytes, params: 2, frame: 16
|
|
const closure = GiftCodeRow;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: 'handleRevoke', value: value_93891}, {key: 'render', value: value_93892}]);
|
|
}
|
|
|
|
function GiftCodeRow(a0) { // fn#93889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:1364, offset: 0x020c8d20, size: 145 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, GiftCodeRow);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(GiftCodeRow);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_93885()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.handleShare = handleShare_93890;
|
|
return value;
|
|
}
|
|
|
|
function value_93891(a0) { // fn#93891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:1842, offset: 0x020c8e43, size: 41 bytes, params: 2, frame: 12
|
|
const value = environment.__proto__;
|
|
(importDefault(8451) /* metro dependency 8451: GiftCodeActionCreators */).revokeGiftCode(a0);
|
|
}
|
|
|
|
function value_93892() { // fn#93892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:1903, offset: 0x020c8e6c, size: 958 bytes, params: 1, frame: 36
|
|
var environment;
|
|
var view;
|
|
var r8;
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
var moduleValue;
|
|
var items2;
|
|
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var InputFieldContainer;
|
|
var moduleValue2;
|
|
var items4;
|
|
var format;
|
|
var b1BfWD;
|
|
var diff;
|
|
let value = environment.__proto__;
|
|
const value2 = env1_13(this.context);
|
|
const {giftCode, isFirst, isRefreshEnabled} = this.props;
|
|
const items3 = [value2.giftCodeRow];
|
|
const value3 = null;
|
|
items3[1] = isRefreshEnabled ? value3 : value2.giftCodeRowLegacy;
|
|
items3[2] = isFirst ? value2.firstRow : value3;
|
|
if (isRefreshEnabled) {
|
|
var viewBinding3Props = {style: value2.giftCodeInput};
|
|
InputFieldContainer = (require(6992) /* metro dependency 6992: InputFieldContainerNative */).InputFieldContainer;
|
|
var viewBinding3Props2 = {style: value2.giftCodeInputContent};
|
|
var textProps = {'variant': 'text-sm/normal', 'style': null, 'lineClamp': 1, style: value2.codeText};
|
|
moduleValue2 = require(4129) /* metro dependency 4129: GiftCodeUtils */;
|
|
items4 = [<Text {...textProps}>{moduleValue2.getGiftCodeURL(giftCode.code)}</Text>];
|
|
items4[1] = <View style={[value2.buttonContainer,
|
|
value2.giftCodeShareButton]}><Button size="sm" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.h5EvZM)} onPress={this.handleShare} /></View>;
|
|
view = <View {...viewBinding3Props}><InputFieldContainer><View {...viewBinding3Props2}>{items4}</View></InputFieldContainer></View>;
|
|
} else {
|
|
var viewBinding2Props = {style: value2.giftCodeShare};
|
|
var textProps = {'variant': 'text-sm/normal', 'style': null, 'lineClamp': 1, style: value2.codeText};
|
|
moduleValue = require(4129) /* metro dependency 4129: GiftCodeUtils */;
|
|
items2 = [<Text {...textProps}>{moduleValue.getGiftCodeURL(giftCode.code)}</Text>];
|
|
items2[1] = <View style={[value2.buttonContainer,
|
|
value2.giftCodeShareButton]}><Button size="sm" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.h5EvZM)} onPress={this.handleShare} /></View>;
|
|
view = <View {...viewBinding2Props}>{items2}</View>;
|
|
}
|
|
const subTextRow = value2.subTextRow;
|
|
let expiresAt = giftCode.expiresAt;
|
|
if (value3 != expiresAt) {
|
|
format = intl.format;
|
|
b1BfWD = (require(1244) /* metro dependency 1244: indexNative */).t.b1BfWD;
|
|
expiresAt = giftCode.expiresAt;
|
|
diff = expiresAt.diff;
|
|
value = (importDefault(3738) /* metro dependency 3738 */)();
|
|
value = <Text variant="text-xs/normal" color="text-subtle">{Reflect.apply(format, intl, [b1BfWD,
|
|
{hours: Reflect.apply(diff, expiresAt, [value, 'h']), revokeHook: revokeHook}])}</Text>;
|
|
r8 = value;
|
|
} else {
|
|
r8 = value3;
|
|
}
|
|
return (
|
|
<View style={items3}>
|
|
{view}
|
|
<View style={subTextRow}>
|
|
{r8}
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function GiftCodeRowHandleShare() { // fn#93890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:1597, owner: GiftCodeRow.handleShare, offset: 0x020c8db1, size: 146 bytes, params: 1, frame: 18
|
|
var moduleValue2;
|
|
var showShareActionSheet;
|
|
var moduleValue3;
|
|
const {giftCode, sku} = env0_0.props;
|
|
let value = giftCode != null;
|
|
if (value && sku != null) {
|
|
value = environment.__proto__.__proto__;
|
|
(require(4129) /* metro dependency 4129: GiftCodeUtils */).trackGiftCodeCopy(giftCode, sku);
|
|
moduleValue2 = require(9212) /* metro dependency 9212: showShareActionSheetAndroid */;
|
|
showShareActionSheet = moduleValue2.showShareActionSheet;
|
|
moduleValue3 = require(4129) /* metro dependency 4129: GiftCodeUtils */;
|
|
Reflect.apply(showShareActionSheet, moduleValue2, [{url: moduleValue3.getGiftCodeURL(giftCode.code)},
|
|
AnalyticsSections.GIFT_CODE_ROW]);
|
|
}
|
|
}
|
|
|
|
function revokeHook(a0, a1) { // fn#93893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:3024, owner: value_93892.revokeHook, offset: 0x020c922a, size: 128 bytes, params: 3, frame: 19
|
|
const object2 = {accessibilityRole: 'button', onPress: onPress_93894};
|
|
const LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
|
|
const binding = env0_1;
|
|
return (
|
|
<TouchableWithoutFeedback {...object2} key={a1}>
|
|
<LegacyText style={[binding.expiryText, binding.revokeHint]}>
|
|
{a0}
|
|
</LegacyText>
|
|
</TouchableWithoutFeedback>
|
|
);
|
|
}
|
|
|
|
function revokeHookOnPress() { // fn#93894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12476:3071, owner: value_93892.revokeHook.onPress, offset: 0x020c92aa, size: 31 bytes, params: 1, frame: 11
|
|
const binding = env1_0;
|
|
return binding.handleRevoke(giftCode.code);
|
|
}
|
|
|