0.4.26 • Published 2 days ago

@crqlar/expo-sdk v0.4.26

Weekly downloads
-
License
MIT
Repository
-
Last release
2 days ago

@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:

PropertyExplanation
publicKeyThe public key provided to the SDK. It's used for API authentication and requests to the server.
apiUrlThe base URL for all API calls. It's used by the SDK to connect to the server and perform operations.
wsUrlThe URL for WebSocket communication. WebSockets provide full-duplex communication channels over a single TCP connection.
i18ConfigInternationalization (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.
paperPropsThe 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, labelSmallFont configurations within the paperProps object. In this case, each is set to use the 'RotundaVariable-Regular' font family.
customComponentsAn object that defines custom React components. These components will replace the default components in the Paper library.
text, input, buttonThese 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 NameDescription
RestaurantReservationRepresents one restaurant reservation.
RestaurantTableRestaurant table information.
CustomerGovernmentIDID info, such as passport, licence, etc.
RoomRateHotel reservation room rate, OTA.
CustomFormPredefinedValuePredefined value for custom form option.
ServiceReservationRepresents one service (eg. spa) reservation.
ServiceSectorSector info - eg. spa, sports, rental.
ServiceValidityPeriod[]TODO
AmountTypeRepresent some value, such as price, with detailed info like before tax, after tax, validity, etc.
BaseModelBase model for all Crqlar types.
CheckInInvoiceItemOne invoice line.
LocalizedEmailTemplate[]TODO
MediaImage or other media, with provider (storage) info.
Comment
LocalizedContentContent which contains language code and generic JSON content.
ProfileEmailDetailed email info.
ChannelChat message channel.
CustomerBasic profile info such as name, gender, birthday...
ProfileAddressDetailed address info.
ReservationExtraAdditional requests related to hotel reservation.
TotalRepresents amount with currency code.
RatePlan[]TODO
ServiceA service which can be booked.
LocalizedTextContent which contains language code and text value for that language.
PlanWeekly plan.
ProfilePreferenceDetailed profile preference with type and value.
BaseAuditableModelExtension of BaseMode which also contains date of modification.
PostCategoryCategory of app posts.
ResourceStaff or facility related to Service and ServiceReservation.
RoomStayOne hotel room stay with check-in/out dates, room rates, room id, etc.
PostApp post.
GuestAuthClaimsAuth response which contains token and user info.
AdditionalGuestRequestInfo about additional guests; used during check in.
RestaurantSpecialEventMarks that restaurant reservation is for some special event (eg. wedding, birthday)
PagePaging response holder with content.
Price[]TODO
PlanItemOne weekly planner item
RoomType
ResGlobalInfo
StripeSetupIntent
AvailabilityDates
TaxRate
AuthRequest
Restaurant
Company
ProfilePhoneDetailed phone info.
Participant
EmailTemplate
ServiceCategoryCategory of Service
AvailabilityInfo about one availability slot for service or restaurant reservations
ResGuest
CorrespondenceMessageChat message.
HotelReservationHolds all info about one hotel reservation.
GuestApp user

Services

Services are used for making CRQLAR API calls

ServiceFile
AuthServiceLogin, Registration, Push token and other auth related calls.
CorrespondenceMessageServiceGet conversations and send messages.
CheckInServiceSend check in requests, check status, list extras.
PostServiceGet posts list or post details.
PostCategoryServiceGet post categories or category details.
ProfileServiceModify profile data.
CustomFormServiceRead or submit custom forms.
RestaurantServiceList restaurants or check availability.
RestaurantReservationServiceMake restaurant reservations and check status.
PlanServiceGet plan info and plan for specific date range.
ServiceCategoryServiceGet info about service categories.
ServiceReservationServiceMake service (eg. spa) reservations and check status.
ServicesServiceGet info about available services.
PushServiceRequest permissions and subscribe for push notifications.
StompServiceHandle web socket communication.
CloudinaryServiceUpload 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

0.4.26

2 days ago

0.4.25

5 months ago

0.4.24

5 months ago

0.4.23

5 months ago

0.4.22

5 months ago

0.4.21

5 months ago

0.4.20

5 months ago

0.4.19

6 months ago

0.4.18

6 months ago

0.4.17

6 months ago

0.4.16

6 months ago

0.4.15

7 months ago

0.4.14

8 months ago

0.4.13

8 months ago

0.4.12

8 months ago

0.4.10

8 months ago

0.4.9

8 months ago

0.4.8

8 months ago

0.4.7

8 months ago

0.4.6

8 months ago

0.4.5

8 months ago

0.4.4

8 months ago

0.4.3

8 months ago

0.4.2

8 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.3.7

9 months ago

0.3.6

9 months ago

0.3.5

9 months ago

0.3.4

9 months ago

0.3.3

9 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.3.0

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.1.23

9 months ago

0.1.22

9 months ago

0.1.21

9 months ago

0.1.0

10 months ago