268 lines
15 KiB
TypeScript
268 lines
15 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] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import GiftCodeActionCreators from '../../actions/GiftCodeActionCreators.tsx'; /* Metro dependency 8451 */
|
|
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 JsxRuntimeModule from '../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as NativeModule from '../../design/void/native.tsx'; /* Metro dependency 1305 */
|
|
import * as NativeModule2 from '../../external/discord_common/js/packages/design/native.tsx'; /* Metro dependency 3868 */
|
|
import * as CreateStylesModule from '../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TextModule from '../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as ButtonNativeModule from '../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
|
|
|
|
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
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactModule;
|
|
const StyleSheet = ReactNativeModule.StyleSheet;
|
|
const createLegacyClassComponentStyles = CreateStylesModule.createLegacyClassComponentStyles;
|
|
object = {};
|
|
object.giftCodeRow = {paddingHorizontal: 16};
|
|
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
|
|
object.giftCodeRowLegacy = {backgroundColor: BACKGROUND_SURFACE_HIGH};
|
|
const object4 = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between',
|
|
'marginVertical': 8, 'padding': 8};
|
|
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
object4.borderWidth = StyleSheet.hairlineWidth;
|
|
const INPUT_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.INPUT_BACKGROUND_DEFAULT;
|
|
object4.backgroundColor = INPUT_BACKGROUND_DEFAULT;
|
|
object.giftCodeShare = object4;
|
|
const object5 = {};
|
|
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object5.marginTop = PX_16;
|
|
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
|
|
object5.marginBottom = PX_4;
|
|
object.giftCodeInput = object5;
|
|
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object.giftCodeInputContent = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between',
|
|
padding: PX_8};
|
|
object.giftCodeShareButton = {marginLeft: 12};
|
|
object.codeText = {flexShrink: 1};
|
|
object.subTextRow = {'marginBottom': 8, 'flexDirection': 'row', 'alignItems': 'center'};
|
|
object.expiryText = {'fontSize': 12, 'lineHeight': 16};
|
|
const BLUE_345 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BLUE_345;
|
|
object.revokeHint = {color: BLUE_345};
|
|
object.firstRow = {borderWidth: 0};
|
|
object.buttonContainer = {'flexShrink': 0, 'flexGrow': 1};
|
|
const env0_13 = Reflect.apply(createLegacyClassComponentStyles, CreateStylesModule, [object]);
|
|
const PureComponent = value.PureComponent;
|
|
value = _fun93888(PureComponent);
|
|
const ThemeContext = (NativeModule2).ThemeContext;
|
|
value.contextType = ThemeContext;
|
|
(FileImportTrackerModule).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 GiftCodeRow2 = GiftCodeRow;
|
|
Inherits(GiftCodeRow2, a0);
|
|
return CreateClass(GiftCodeRow2, [{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;
|
|
return value;
|
|
function handleShare() { // 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 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__;
|
|
(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 = (TextModule).Text;
|
|
var moduleValue;
|
|
var items2;
|
|
const Button = (ButtonNativeModule).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 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 object = {accessibilityRole: 'button', onPress: onPress_93894};
|
|
const LegacyText = (NativeModule).LegacyText;
|
|
const binding = env0_1;
|
|
return (
|
|
<TouchableWithoutFeedback {...object} 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);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun93884, 12290, [6, 7, 15, 17, 18, 31, 27, 661, 33, 4501, 697, 4129, 9212, 8451, 6992, 4573, 4578,
|
|
1244, 3738, 1305, 3868,
|
|
2]) /* metro module 12290, dependencies: [6, 7, 15, 17, 18, 31, 27, 661, 33, 4501, 697, 4129, 9212, 8451, 6992, 4573, 4578, 1244, 3738, 1305, 3868, 2] */;
|