-
Notifications
You must be signed in to change notification settings - Fork 577
/
features.ts
392 lines (378 loc) · 12.9 KB
/
features.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
import { useToast } from "app/Components/Toast/toastHook"
import { GlobalStore, unsafe__getEnvironment } from "app/store/GlobalStore"
import { setupSentry } from "app/system/errorReporting/setupSentry"
import { echoLaunchJson } from "app/utils/jsonFiles"
import Config from "react-native-config"
interface FeatureDescriptorCommonTypes {
/** Provide a short description for the Dev Menu. */
readonly description?: string
/** Whether or not to show the feature flag in the Dev Menu. Consider also providing a description. */
readonly showInDevMenu?: boolean
}
export interface FeatureDescriptorReadyForRelease {
/**
* Set readyForRelease to `true` when the feature is ready to be exposed outside of dev mode.
* If an echo flag key is specified, the echo flag's value will be used after this
* is set to `true`.
*/
readonly readyForRelease: true
/**
* Provide an echo feature flag key to allow this feature to be toggled globally via echo.
* Make sure to add the flag to echo before setting this value. Then run `./scripts/setup/update-echo`.
*/
readonly echoFlagKey: string
}
interface FeatureDescriptorNotReadyForRelease {
/**
* Set readyForRelease to `false` when the feature is still in progress.
*/
readonly readyForRelease: false
readonly echoFlagKey?: string
}
export type FeatureDescriptor = (
| FeatureDescriptorReadyForRelease
| FeatureDescriptorNotReadyForRelease
) &
FeatureDescriptorCommonTypes
export type FeatureName = keyof typeof features
export const features = {
ARDarkModeSupport: {
readyForRelease: false,
description: "Support dark mode",
},
AREnableEditorialNews: {
readyForRelease: true,
description: "Enable news app in the home screen",
echoFlagKey: "AREnableEditorialNews",
showInDevMenu: true,
},
// TODO: need to refresh it before releasing to avoid leaking the feature in not ready releases, marked as ready since 15 months ago
AREnableArtworksConnectionForAuction: {
readyForRelease: true,
description: "Use artworksConnection for Auction screen",
echoFlagKey: "AREnableArtworksConnectionForAuction",
},
ARImpressionsTrackingHomeRailViews: {
description: "Enable tracking rail views on home screen",
readyForRelease: true,
echoFlagKey: "ARImpressionsTrackingHomeRailViews",
},
ARImpressionsTrackingHomeItemViews: {
description: "Enable Tracking Items views on Home Screen",
readyForRelease: true,
echoFlagKey: "ARImpressionsTrackingHomeItemViews",
},
AREnableNewAuctionsRailCard: {
description: "Enable New Auctions Home Rail Card",
readyForRelease: true,
echoFlagKey: "AREnableNewAuctionsRailCard",
},
// TODO: need to refresh it, not released yet but marked as ready since 3 months
AREnableLongPressOnArtworkCards: {
description: "Enable Context Menu on artwork cards",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableLongPressOnArtworkCards",
},
AREnableShowsForYouLocation: {
description: "Enable Shows For You Location",
readyForRelease: true,
echoFlagKey: "AREnableShowsForYouLocation",
},
AREnableGalleriesForYou: {
description: "Enable Galleries For You",
readyForRelease: true,
echoFlagKey: "AREnableGalleriesForYou",
},
AREnableAdditionalSiftAndroidTracking: {
description: "Send additional events to Sift on Android",
readyForRelease: true,
echoFlagKey: "AREnableAdditionalSiftAndroidTracking",
},
AREnableAuctionHeaderAlertCTA: {
description: "Enable Auction Header Alert CTA",
readyForRelease: true,
echoFlagKey: "AREnableAuctionHeaderAlertCTA",
},
ARShowCreateAlertInArtistArtworksListFooter: {
description: "Show create alert in artist artworks list footer",
readyForRelease: true,
echoFlagKey: "ARShowCreateAlertInArtistArtworksListFooter",
},
AREnableLatestActivityRail: {
description: "Enable Latest Activity Rail",
readyForRelease: true,
echoFlagKey: "AREnableLatestActivityRail",
},
AREnableAlertsFilters: {
description: "Enable filters in alerts screen",
readyForRelease: true,
echoFlagKey: "AREnableAlertsFilters",
},
AREnableAlertsFiltersSizeFiltering: {
description: "Enable size filtering in alerts filters screen",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableAlertsFiltersSizeFiltering",
},
AREnableAlertDetailsInput: {
description: "Enable 'details' text input for alerts",
readyForRelease: true,
echoFlagKey: "AREnableAlertDetailsInput",
},
AREnableArtistSeriesFilter: {
description: "Enable artist series filter on Artist screen",
readyForRelease: true,
echoFlagKey: "AREnableArtistSeriesFilter",
},
AREnableAlertsSuggestedFilters: {
description: "Enable alerts suggested filters",
readyForRelease: true,
echoFlagKey: "AREnableAlertsSuggestedFilters",
},
AREnablePartnerOffersNotificationSwitch: {
description: "Enable partner offers notification switch",
readyForRelease: true,
echoFlagKey: "AREnablePartnerOffersNotificationSwitch",
},
AREnablePartnerOffer: {
description: "Enable partner offer content in the app",
readyForRelease: true,
echoFlagKey: "AREnablePartnerOffer",
},
AREnableExpiredPartnerOffers: {
description: "Enable expired partner offers handling",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableExpiredPartnerOffers",
},
AREnableArtistSeriesSuggestions: {
description: "Enable artist series suggestions",
readyForRelease: true,
echoFlagKey: "AREnableArtistSeriesSuggestions",
},
AREnableProgressiveOnboardingAlerts: {
description: "Enable progressive onboarding alerts",
readyForRelease: false,
showInDevMenu: true,
echoFlagKey: "AREnableProgressiveOnboardingAlerts",
},
AREnableAlertsFiltersArtistSeriesFiltering: {
description: 'Enable artist series selection on "More Filters" screen',
readyForRelease: true,
echoFlagKey: "AREnableAlertsFiltersArtistSeriesFiltering",
},
AREnableArtworksFeedView: {
description: "Enable artworks feed view",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableArtworksFeedView",
},
AREnableArtworkListOfferability: {
description: "Enable Parnter Offer v1.5, edit sharing artwork list with partners for offers",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableArtworkListOfferability",
},
ARUsePaletteImage: {
description: "Use Palette Image Component",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "ARUsePaletteImageComponent",
},
ARShowBlurhashImagePlaceholder: {
description: "Show blurhash image placeholder (works only when using Palette Image Component)",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "ARShowBlurhashImagePlaceholder",
},
AREnableAlertBottomSheet: {
description: "Enable tapping on alerts to show bottom sheet",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableAlertBottomSheet",
},
AREnableLongPressOnNewForYouRail: {
description: "Enable Context Menu on artwork cards on new for you rail",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableLongPressOnNewForYouRail",
},
AREnablePartnerOfferOnArtworkScreen: {
description: "Enable partner offer on artwork screen",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnablePartnerOfferOnArtworkScreen",
},
AREnableMyCollectionInterestedInSellingTooltip: {
description: "Enable My Collection 'Interested in Selling?' tooltip",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableMyCollectionInterestedInSellingTooltip",
},
ARSWAMakeAllDimensionsOptional: {
description: "Make all dimensions optional in SWA submit flow",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "ARSWAMakeAllDimensionsOptional",
},
AREnableSubmitArtworkTier2Information: {
description: "Enable submit artwork tier 2 information",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableSubmitArtworkTier2Information",
},
AREnableCollectionsWithoutHeaderImage: {
description: "Remove the header image from collections",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableCollectionsWithoutHeaderImage",
},
ARUseMetaphysicsCDN: {
description: "Use Metaphysics CDN (requires app restart)",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "ARUseMetaphysicsCDN",
},
AREnableCacheableDirective: {
description: "Enable @cacheable Directive",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableCacheableDirective",
},
AREnableSignupLoginFusion: {
description: "Enable the fused signup and login flow",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableSignupLoginFusion",
},
AREnableMarketingCollectionsCategories: {
description: "Enable marketing collections categories elements in the home view",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableMarketingCollectionsCategories",
},
AREnableHomeViewTasksSection: {
description: "Enable the Home view tasks section",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableHomeViewTasksSection",
},
AREnableNewNavigation: {
description: "Enable new navigation infra (Requires App Restart!)",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableNewNavigation",
},
AREnableNewSaveAndFollowOnArtworkCard: {
description: "Redesign Save CTA and Add Follow CTA on Artwork Grid/Rail",
readyForRelease: false,
showInDevMenu: true,
echoFlagKey: "AREnableNewSaveAndFollowOnArtworkCard",
},
AREnablePaymentFailureBanner: {
description: "Enable payment failure banner",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnablePaymentFailureBanner",
},
AREnableNewSearchModal: {
description: "Enable new search modal",
readyForRelease: true,
showInDevMenu: true,
echoFlagKey: "AREnableNewSearchModal",
},
} satisfies { [key: string]: FeatureDescriptor }
export interface DevToggleDescriptor {
/**
* Provide a short description for the Dev Menu.
*/
readonly description: string
/**
* Provide some action/thunk to run when the toggle value is changed.
*/
readonly onChange?: (value: boolean, { toast }: { toast: ReturnType<typeof useToast> }) => void
}
export type DevToggleName = keyof typeof devToggles
export const devToggles: { [key: string]: DevToggleDescriptor } = {
DTShowPlayground: {
description: "Show Playground",
},
DTShowQuickAccessInfo: {
description: "Quick Access Info",
},
DTDisableEchoRemoteFetch: {
description: "Disable fetching remote echo",
onChange: (value, { toast }) => {
if (value) {
GlobalStore.actions.artsyPrefs.echo.setEchoState(echoLaunchJson())
toast.show("Loaded bundled echo config", "middle")
} else {
GlobalStore.actions.artsyPrefs.echo.fetchRemoteEcho()
toast.show("Fetched remote echo config", "middle")
}
},
},
DTShowAnalyticsVisualiser: {
description: "Analytics visualiser",
},
DTLocationDetectionVisialiser: {
description: "Location detection visualiser",
},
DTShowNavigationVisualiser: {
description: "Navigation visualiser",
},
DTEasyMyCollectionArtworkCreation: {
description: "MyCollection artworks easy add",
},
DTMyCollectionDeleteAllArtworks: {
description: "MyCollection delete all artworks",
},
DTShowWebviewIndicator: {
description: "Webview indicator",
},
DTShowInstagramShot: {
description: "Instagram viewshot debug",
},
DTDebugSentry: {
description: "Enable sentry debug mode and send exceptions to sentry",
onChange: (value, { toast }) => {
if (!Config.SENTRY_DSN) {
toast.show(
`No Sentry DSN available ${__DEV__ ? "Set it in .env.shared and re-build the app." : ""}`,
"middle"
)
return
}
const environment = unsafe__getEnvironment()
setupSentry({
environment: environment.env,
debug: value,
})
if (value) {
toast.show("Sentry debugging enabled", "middle")
} else {
toast.show("Sentry debugging disabled", "middle")
}
},
},
DTFPSCounter: {
description: "FPS counter",
},
DTUseProductionUnleash: {
description: "Use Production Unleash",
},
DTShowErrorInLoadFailureView: {
description: "Show error in load failure view",
},
DTEnableNewImageLabel: {
description: "Show a label on new OpaqueImageView",
},
DTDisableNavigationStateRehydration: {
description:
"Disable navigation state rehydration. This change only affects DEV builds. In release builds, navigation state is never rehydrated.",
},
}
export const isDevToggle = (name: FeatureName | DevToggleName): name is DevToggleName => {
return Object.keys(devToggles).includes(name as string)
}