Created
July 25, 2023 15:12
-
-
Save meshaabi/5db831d03f1964afa0f10bdc13ee1bc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { WeekDay } from 'components/pages/ChatOptions/constants'; | |
import { StoreCode, StoreLocale } from '../stores/types'; | |
export type FirebaseEnabled = { | |
enabled: boolean; | |
}; | |
type FirebaseThreshold = { enabled: boolean; threshold: number }; | |
// AR | |
export type ARSurface = { | |
shadow_enabled_surfaces: string[]; | |
fake_wall_dialog_image_url: string; | |
}; | |
export type ARMessages = { | |
messages_opacity_controls: number; | |
}; | |
type ViewInRoom = { copy: string }; | |
// Callouts | |
export type CalloutTranslationKey = | |
| 'NEW' | |
| 'EXPRESS' | |
| 'OUTOFSTOCK' | |
| 'ALWAYS' | |
| 'STOP' | |
| 'CAMPAIGN' | |
| 'FLASH' | |
| 'SALE_BUY'; | |
export type InTimeFor = { label: string }; | |
// Product Details Page | |
type EmergencyMessage = { | |
enabled: boolean; | |
showOnAllSkus: boolean; | |
skusToShow: string[]; | |
link: string; | |
message: string; | |
backgroundColour: string; | |
}; | |
// Recently Viwed | |
export type RecentlyViewHpFlag = { enabled: boolean; position: number }; | |
// Uncategorized | |
export type ContactCentreItemData = { | |
enabled: boolean; | |
headerText: string; | |
icon: string; | |
iconSize: number; | |
contentText: string; | |
url: string; | |
phoneNumber: string; | |
type: 'link' | 'email' | 'phone' | 'chat'; | |
}; | |
type ChatVisibilityConfig = { | |
basketEnabled: boolean; | |
checkoutEnabled: boolean; | |
liveChatEnabled: boolean; | |
messengerEnabled: boolean; | |
whatsappEnabled: boolean; | |
}; | |
export type CustomerSupportOpenningHours = { | |
day: WeekDay; | |
open: string | boolean; | |
close: string | boolean; | |
}; | |
export type ChatRemoteConfig = { | |
visibilityConfig: ChatVisibilityConfig; | |
openingHours: string[]; | |
customerSupportHours: CustomerSupportOpenningHours[]; | |
messengerLink: string; | |
whatsappLink: string; | |
}; | |
type FiltersToTranslate = { | |
keys: string[]; | |
}; | |
export type RemoteConfigByStore = { | |
// Callouts | |
CALLOUTS_CUSTOM_PRIORITIES: PartialRecord<StoreCode, CalloutTranslationKey[]>; | |
// Finance | |
KLARNA: PartialRecord<StoreCode, FirebaseEnabled>; | |
ONEY: PartialRecord<StoreCode, FirebaseEnabled>; | |
// Product Details Page | |
BASKET_TOTAL_FREE_DELIVERY: PartialRecord<StoreCode, FirebaseThreshold>; | |
EMERGENCY_MESSAGE: PartialRecord<StoreCode, EmergencyMessage>; | |
EXPRESS_DELIVER_LEAD_TIME: PartialRecord<StoreCode, number>; | |
FREE_DELIVERY: PartialRecord<StoreCode, FirebaseEnabled>; | |
LONG_LEADTIME: PartialRecord<StoreCode, FirebaseThreshold>; | |
OLAPIC: PartialRecord<StoreCode, FirebaseEnabled>; | |
PDP_PRISMIC_MAP: PartialRecord<StoreCode, Record<string, string>>; | |
YOTPO_REVIEW: PartialRecord<StoreCode, FirebaseEnabled>; | |
// Recently Viewed | |
RECENTLY_VIEWED_HP: PartialRecord<StoreCode, RecentlyViewHpFlag>; | |
// AR | |
MEASURE_MY_SPACE: PartialRecord<StoreCode, FirebaseEnabled>; | |
// uncategorised | |
CHAT: PartialRecord<StoreCode, ChatRemoteConfig>; | |
CONTACT_CENTRE: PartialRecord<StoreCode, ContactCentreItemData[]>; | |
// payment solutions | |
APPLE_PAY: PartialRecord<StoreCode, FirebaseEnabled>; | |
}; | |
export type RemoteConfigByLocale = { | |
// AR | |
AR_MESSAGES: PartialRecord<StoreLocale, ARMessages>; | |
AR_SURFACES: PartialRecord<StoreLocale, ARSurface>; | |
VIEW_IN_ROOM: PartialRecord<StoreLocale, ViewInRoom>; | |
// Callouts | |
CALLOUTS: PartialRecord<StoreLocale, Record<CalloutTranslationKey, string>>; | |
IN_TIME_FOR: PartialRecord<StoreLocale, InTimeFor>; | |
}; | |
type InAppBrowserLinks = { | |
paths: string[]; | |
}; | |
type RemoteConfigUncategorized = { | |
// AR | |
AR: FirebaseEnabled; | |
// User | |
APPLE_SIGN_IN: FirebaseEnabled; | |
FACEBOOK_LOGIN: FirebaseEnabled; | |
// uncategorised | |
FORCE_UPDATE: FirebaseEnabled; | |
FILTERS_TO_TRANSLATE: FiltersToTranslate; | |
GROUPED_PLP_NO_SWATCH_AXES: string[]; | |
// In app browser links | |
IN_APP_BROWSER_LINKS: InAppBrowserLinks; | |
}; | |
export type RemoteConfigState = Partial< | |
RemoteConfigByStore & RemoteConfigByLocale & RemoteConfigUncategorized | |
>; | |
export type RemoteConfigUseState = { | |
isRemoteConfigReady: boolean; | |
remoteConfig: RemoteConfigState; | |
setRemoteConfig: (config: RemoteConfigState) => void; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment