289 lines
15 KiB
TypeScript
289 lines
15 KiB
TypeScript
/* Metro module 12294; source: components_native/premium/GiftPurchaseButton.tsx; dependencies: [5, 31, 27, 3808, 5140, 33, 4583, 4573, 566, 5143, 7355, 6771, 10385, 4496, 1244, 3802, 10381, 4579, 12295, 2] */
|
|
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import SubscriptionStore from '../../stores/billing/SubscriptionStore.tsx'; /* Metro dependency 3808 */
|
|
import IAPStoreAndroid from '../../stores/native/IAPStore.android.tsx'; /* Metro dependency 5140 */
|
|
import UseAnalyticsLocations from '../../modules/app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
|
|
import RenderPremiumButtonText from '../../modules/premium/native/renderPremiumButtonText.tsx'; /* Metro dependency 12295 */
|
|
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 FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as TextModule from '../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as BaseTextButtonNativeModule from '../../design/components/Button/native/BaseTextButton.native.tsx'; /* Metro dependency 4579 */
|
|
import * as ButtonHooksNativeModule from '../../design/components/Button/native/ButtonHooks.native.tsx'; /* Metro dependency 4583 */
|
|
import * as ProductIdsAndroidModule from '../../modules/premium/native/ProductIds.android.tsx'; /* Metro dependency 5143 */
|
|
import * as IAPUtilsModule from '../../utils/native/IAPUtils.tsx'; /* Metro dependency 7355 */
|
|
import * as CreateOrReuseGiftOrderModule from '../../modules/payments/native/utils/createOrReuseGiftOrder.tsx'; /* Metro dependency 10385 */
|
|
|
|
function _fun93899(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93899, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12480:6, offset: 0x020c9868, size: 211 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('components_native/premium/GiftPurchaseButton.tsx');
|
|
exports.default = GiftPurchaseButton;
|
|
function GiftPurchaseButton({style, variant, planId, analyticsLocation = {}, recipientUserId}) { // fn#93900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12480:171, offset: 0x020c993b, size: 598 bytes, params: 2, frame: 31
|
|
variant = variant === undefined ? 'primary' : variant;
|
|
const value2 = (ButtonHooksNativeModule).useButtonTextColorStyles(variant);
|
|
const object = {};
|
|
const TextStyleSheet = (TextModule).TextStyleSheet;
|
|
copyDataProperties(object, TextStyleSheet['text-sm/semibold'], undefined);
|
|
copyDataProperties(object, value2, undefined);
|
|
let useStateFromStores = FluxModule.useStateFromStores;
|
|
const premiumSubscription = Reflect.apply(useStateFromStores, FluxModule, [[SubscriptionStore], function() {
|
|
return SubscriptionStore.getPremiumSubscription();
|
|
}]);
|
|
const productIdForGift = (ProductIdsAndroidModule).getProductIdForGift(planId);
|
|
const productIdForGift2 = productIdForGift;
|
|
const value4 = (IAPUtilsModule).useCanPurchaseIAP(productIdForGift);
|
|
useStateFromStores = FluxModule.useStateFromStores;
|
|
const iapStoreAndroidBinding = IAPStoreAndroid;
|
|
const value5 = Reflect.apply(useStateFromStores, FluxModule, [[iapStoreAndroidBinding], _fun93902]);
|
|
const product = FluxModule.useStateFromStores([iapStoreAndroidBinding], _fun93903);
|
|
const r6 = premiumSubscription != null && premiumSubscription.planId === planId;
|
|
const analyticsLocations = (UseAnalyticsLocations)().analyticsLocations;
|
|
const value10 = analyticsLocations.useCallback(productIdForGift2(_fun93905), [planId, recipientUserId,
|
|
analyticsLocation, analyticsLocations,
|
|
(CreateOrReuseGiftOrderModule).useCreateOrReuseGiftOrder('GiftPurchaseButton')]);
|
|
const BaseTextButton = (BaseTextButtonNativeModule).BaseTextButton;
|
|
return (
|
|
<View style={style}>
|
|
<BaseTextButton
|
|
textElement={(RenderPremiumButtonText)({style: object,
|
|
basePlanId: planId, isCurrentPlan: r6, isGift: true, product: product})}
|
|
variant={variant}
|
|
size="sm"
|
|
onPress={value10}
|
|
loading={value5}
|
|
disabled={!value4}
|
|
grow
|
|
/>
|
|
</View>
|
|
);
|
|
function _fun93902() { // fn#93902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12480:543, offset: 0x020c9ba4, size: 27 bytes, params: 1, frame: 11
|
|
return IAPStoreAndroid.isPurchasingProduct(Module00005);
|
|
}
|
|
|
|
function _fun93903() { // fn#93903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12480:608, offset: 0x020c9bbf, size: 27 bytes, params: 1, frame: 11
|
|
return IAPStoreAndroid.getProduct(Module00005);
|
|
}
|
|
|
|
function* _fun93905() { // fn#93905, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12480:764, offset: 0x020c9be5, size: 334 bytes, params: 1, frame: 19
|
|
var object;
|
|
var value3;
|
|
var value4;
|
|
var value5;
|
|
var binding;
|
|
var error;
|
|
var binding3;
|
|
var value10;
|
|
var show;
|
|
var intl;
|
|
var string;
|
|
var t;
|
|
var R0RpRX;
|
|
var CKsXk3;
|
|
if (true) {
|
|
value = environment.__proto__;
|
|
try {
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
try {
|
|
object = {};
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
try {
|
|
object.planId = require;
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
try {
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
try {
|
|
object.recipientUserId = dependencyMap;
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
try {
|
|
value3 = View(object);
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
yield value3;
|
|
try {
|
|
value4 = undefined;
|
|
value5 = false;
|
|
} catch (error) {
|
|
value = environment.__proto__.__proto__;
|
|
binding = env2_1;
|
|
binding3 = env2_2;
|
|
value10 = binding(binding3[13]);
|
|
show = value10.show;
|
|
object = {};
|
|
binding = env2_0;
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
R0RpRX = t.R0RpRX;
|
|
object.title = Reflect.apply(string, intl, [R0RpRX]);
|
|
intl = binding(binding3[14]).intl;
|
|
string = intl.string;
|
|
t = binding(binding3[14]).t;
|
|
CKsXk3 = t.CKsXk3;
|
|
object.body = Reflect.apply(string, intl, [CKsXk3]);
|
|
Reflect.apply(show, value10, [object]);
|
|
return undefined;
|
|
}
|
|
if (value5) {
|
|
return value4;
|
|
}
|
|
binding = env2_0;
|
|
var binding2 = env2_2;
|
|
var {premiumType, planInterval} = binding(binding2[15]).getPremiumTypeFromPlanId(require);
|
|
binding(binding2[16]).openGiftModal({recipientUserId: dependencyMap, premiumType: premiumType,
|
|
planInterval: planInterval, analyticsLocation: importDefault, analyticsLocations: env1_4, order: value4});
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun93899, 12294, [5, 31, 27, 3808, 5140, 33, 4583, 4573, 566, 5143, 7355, 6771, 10385, 4496, 1244, 3802,
|
|
10381, 4579, 12295,
|
|
2]) /* metro module 12294, dependencies: [5, 31, 27, 3808, 5140, 33, 4583, 4573, 566, 5143, 7355, 6771, 10385, 4496, 1244, 3802, 10381, 4579, 12295, 2] */;
|