@crqlar/expo-sdk v0.4.26
@crqlar/expo-sdk
An SDK for building hotel apps using Crqlar APIs and Expo.
Installation
yarn add @crqlar/expo-sdk
or
npm install @crqlar/expo-sdk
Usage
// Put this before App function in your App.tsx file
CrqlarSDK.initialize({
publicKey: Constants.expoConfig?.extra?.publicKey,
apiUrl: Constants.expoConfig?.extra?.apiUrl,
wsUrl: Constants.expoConfig?.extra?.wsUrl,
i18Config: {
en: {
translation: require('./assets/translations/en.json')
},
de: {
translation: require('./assets/translations/de.json')
}
},
paperProps: {
theme: {
fonts: {
regular: { fontFamily: 'Arial' }
}
}
} as any,
customComponents: {
text: props => <CustomText {...props} />,
input: (props, ref) => <CustomInput {...props} ref={ref}/>,
button: (props, ref) => <CustomButton {...props} ref={ref}/>,
}
})
// With the SDK initialized, we can start using the app
export default function App() {
const colorScheme = useColorScheme();
const [fontsLoaded] = useFonts({
"ExampleFont": require('./assets/fonts/ExampleFont.otf')
})
const [initializationDone, setInitializationDone] = useState(false);
useEffect(() => {
const init = async () => {
CrqlarSDK.i18Config && (await initLocalization(CrqlarSDK.i18Config, 'en'));
setInitializationDone(true);
};
init();
}, []);
if (!fontsLoaded || !initializationDone) {
return null
}
return (
<CrqlarApp>
<Navigation colorScheme={colorScheme}/>
</CrqlarApp>
);
}
Configuration properties:
Property | Explanation |
---|---|
publicKey | The public key provided to the SDK. It's used for API authentication and requests to the server. |
apiUrl | The base URL for all API calls. It's used by the SDK to connect to the server and perform operations. |
wsUrl | The URL for WebSocket communication. WebSockets provide full-duplex communication channels over a single TCP connection. |
i18Config | Internationalization (i18n) configuration object. This is used for localization of your application, providing translations for the languages you will use. The translations are fetched from *.json files. |
paperProps | The properties for the react-native-paper library, which is used for UI components in React Native. This particular configuration sets the theme's fonts. |
regular , light , thin , medium , labelLarge , labelMedium , labelSmall | Font configurations within the paperProps object. In this case, each is set to use the 'RotundaVariable-Regular' font family. |
customComponents | An object that defines custom React components. These components will replace the default components in the Paper library. |
text , input , button | These are custom components defined within customComponents . The text is a custom text component, input is a custom input component, and button is a custom button component. Each custom component takes props and, for the input and button components, a ref. |
This table explains the high-level concepts of each property. For a more in-depth explanation, you would need to consult the CrqlarSDK documentation, as the specifics can vary based on implementation.
Models
This is a brief explanation of most commonly used data models
Interface Name | Description | |
---|---|---|
RestaurantReservation | Represents one restaurant reservation. | |
RestaurantTable | Restaurant table information. | |
CustomerGovernmentID | ID info, such as passport, licence, etc. | |
RoomRate | Hotel reservation room rate, OTA. | |
CustomFormPredefinedValue | Predefined value for custom form option. | |
ServiceReservation | Represents one service (eg. spa) reservation. | |
ServiceSector | Sector info - eg. spa, sports, rental. | |
ServiceValidityPeriod | []TODO | |
AmountType | Represent some value, such as price, with detailed info like before tax, after tax, validity, etc. | |
BaseModel | Base model for all Crqlar types. | |
CheckInInvoiceItem | One invoice line. | |
LocalizedEmailTemplate | []TODO | |
Media | Image or other media, with provider (storage) info. | |
Comment | ||
LocalizedContent | Content which contains language code and generic JSON content. | |
ProfileEmail | Detailed email info. | |
Channel | Chat message channel. | |
Customer | Basic profile info such as name, gender, birthday... | |
ProfileAddress | Detailed address info. | |
ReservationExtra | Additional requests related to hotel reservation. | |
Total | Represents amount with currency code. | |
RatePlan | []TODO | |
Service | A service which can be booked. | |
LocalizedText | Content which contains language code and text value for that language. | |
Plan | Weekly plan. | |
ProfilePreference | Detailed profile preference with type and value. | |
BaseAuditableModel | Extension of BaseMode which also contains date of modification. | |
PostCategory | Category of app posts. | |
Resource | Staff or facility related to Service and ServiceReservation . | |
RoomStay | One hotel room stay with check-in/out dates, room rates, room id, etc. | |
Post | App post. | |
GuestAuthClaims | Auth response which contains token and user info. | |
AdditionalGuestRequest | Info about additional guests; used during check in. | |
RestaurantSpecialEvent | Marks that restaurant reservation is for some special event (eg. wedding, birthday) | |
Page | Paging response holder with content. | |
Price | []TODO | |
PlanItem | One weekly planner item | |
RoomType | ||
ResGlobalInfo | ||
StripeSetupIntent | ||
AvailabilityDates | ||
TaxRate | ||
AuthRequest | ||
Restaurant | ||
Company | ||
ProfilePhone | Detailed phone info. | |
Participant | ||
EmailTemplate | ||
ServiceCategory | Category of Service | |
Availability | Info about one availability slot for service or restaurant reservations | |
ResGuest | ||
CorrespondenceMessage | Chat message. | |
HotelReservation | Holds all info about one hotel reservation. | |
Guest | App user |
Services
Services are used for making CRQLAR API calls
Service | File |
---|---|
AuthService | Login, Registration, Push token and other auth related calls. |
CorrespondenceMessageService | Get conversations and send messages. |
CheckInService | Send check in requests, check status, list extras. |
PostService | Get posts list or post details. |
PostCategoryService | Get post categories or category details. |
ProfileService | Modify profile data. |
CustomFormService | Read or submit custom forms. |
RestaurantService | List restaurants or check availability. |
RestaurantReservationService | Make restaurant reservations and check status. |
PlanService | Get plan info and plan for specific date range. |
ServiceCategoryService | Get info about service categories. |
ServiceReservationService | Make service (eg. spa) reservations and check status. |
ServicesService | Get info about available services. |
PushService | Request permissions and subscribe for push notifications. |
StompService | Handle web socket communication. |
CloudinaryService | Upload files |
Components
[] Add component descriptions
Utils
[] Add a list of util functions
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library
2 days ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago