UNPKG

notificare-react-preview-components

Version:

A set of React components for your admin applications that lets you preview how Notificare notifications, in-app messages, and wallet passes will appear on a user’s device.

205 lines (195 loc) 9.88 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; declare const PUSH_TRANSLATIONS: { 'controls.platform': string; 'controls.formFactor': string; 'controls.operatingSystem': string; 'controls.operatingSystem.macos': string; 'controls.variant': string; 'controls.displayMode.lockScreen': string; 'controls.displayMode.expandedLockScreen': string; 'controls.displayMode.appUi': string; 'preview.error.notGeneratedPreview': string; 'preview.error.checkConsole': string; 'preview.error.invalidNotification': string; 'preview.error.provideGoogleMapsApiKey': string; 'preview.error.notSupportedPreviewVariant': string; 'preview.error.invalidUrl': string; 'preview.error.iosStoreAppNotFound': string; 'preview.error.webshotFail': string; 'preview.error.notSupportedNotificationTypePreviewVariant': string; 'preview.error.notSupportedUrlResolverWithUrlSchemePreview': string; 'preview.error.urlResolverInvalidUrl': string; 'preview.error.urlResolverNoNotificareWebViewQueryParameter': string; 'preview.error.notSupportedUrlResolverWithDynamicLink': string; 'preview.error.notSupportedUrlResolverWithRelativeUrl': string; 'preview.error.googleMapsAuthFailure': string; 'preview.error.googleMapsLoadFailure': string; 'preview.error.noValidContentObject': string; 'preview.error.iosStoreAppLoadFailure': string; 'preview.android.alert.appUi.cancel': string; 'preview.android.inAppBrowser.appUi.pageTitleLoading': string; 'preview.android.lockscreen.time': string; 'preview.ios.alert.appUi.cancel': string; 'preview.ios.alert.appUi.ok': string; 'preview.ios.inAppBrowser.appUi.done': string; 'preview.ios.inAppBrowser.appUi.notSecure': string; 'preview.ios.rate.appUi.rateNow': string; 'preview.ios.rate.appUi.doNotRate': string; 'preview.ios.store.appUi.done': string; 'preview.ios.store.appUi.install': string; 'preview.ios.store.appUi.ratings': string; 'preview.ios.store.appUi.age': string; 'preview.ios.store.appUi.yearsOld': string; 'preview.ios.store.appUi.category': string; 'preview.ios.store.appUi.developer': string; 'preview.ios.store.appUi.whatsNew': string; 'preview.ios.store.appUi.historyVersion': string; 'preview.ios.store.appUi.screenshots': string; 'preview.ios.lockScreen.time': string; 'preview.web.desktop.macos.lockScreen.time': string; 'preview.web.desktop.macos.lockScreen.settings': string; 'preview.web.desktop.macos.lockScreen.options': string; }; /** * The set of translation keys for push notification previews. */ type NotificarePushTranslationKey = keyof typeof PUSH_TRANSLATIONS; declare const IN_APP_MESSAGING_TRANSLATIONS: { 'preview.error.invalidInAppMessage': string; 'preview.error.notGeneratedPreview': string; 'preview.error.checkConsole': string; }; /** * The set of translation keys for in-app message previews. */ type NotificareInAppMessagingTranslationKey = keyof typeof IN_APP_MESSAGING_TRANSLATIONS; /** * Defines the structure of a notification object. * * @property {string} type - The type of the notification (e.g., "re.notifica.notification.Alert", "re.notifica.notification.WebView"). * @property {string} [title] - The title of the notification (optional). * @property {string} [subtitle] - The subtitle of the notification (optional). * @property {string} message - The message of the notification. * @property {NotificareNotificationContent[]} [content] - An array of content objects associated with the notification (optional). Their structure depends on the notification type. * @property {NotificareNotificationAction[]} [actions] - An array of actions associated with the notification (optional). * @property {NotificareNotificationAttachment[]} [attachments] - An array of attachments associated with the notification (optional). */ interface NotificareNotification { readonly type: string; readonly title?: string; readonly subtitle?: string; readonly message: string; readonly content?: NotificareNotificationContent[]; readonly actions?: NotificareNotificationAction[]; readonly attachments?: NotificareNotificationAttachment[]; } /** * Defines the content associated with the notification. * * @property {string} type - The type of content. * @property {unknown} data - The content data. Its structure depends on the type. */ interface NotificareNotificationContent { readonly type: string; readonly data: unknown; } /** * Defines an action associated with the notification. * * @property {string} type - The type of action (e.g., "re.notifica.action.Callback", "re.notifica.action.SMS"). * @property {string} label - The label for the action. * @property {string} [target] - The target of the action (optional). * @property {boolean} [camera] - Whether the action involves a camera (optional). * @property {boolean} [keyboard] - Whether the action involves a keyboard (optional). */ interface NotificareNotificationAction { readonly type: string; readonly label: string; readonly target?: string; readonly camera?: boolean; readonly keyboard?: boolean; } /** * Defines an attachment associated with the notification. * * @property {string} mimeType - The MIME type of the attachment (e.g., "image/jpeg", "image/png"). * @property {string} uri - The URI of the attachment. */ interface NotificareNotificationAttachment { readonly mimeType: string; readonly uri: string; } /** * Defines the notification preview variant to be shown. */ type NotificareNotificationPreviewVariant = 'android-lockscreen' | 'android-lockscreen-expanded' | 'android-app-ui' | 'ios-lockscreen' | 'ios-lockscreen-expanded' | 'ios-app-ui' | 'web-desktop-macos' | 'web-iphone-app-ui' | 'web-android-app-ui'; /** * Defines the structure of an in-app message object. * * @property {string} type - The type of the in-app message (e.g., "re.notifica.inappmessage.Banner", "re.notifica.inappmessage.Card"). * @property {string} [title] - The title of the in-app message (optional). * @property {string} [message] - The message of the in-app message (optional). * @property {string} [image] - The image of the in-app message (optional). * @property {NotificareInAppMessageAction} [primaryAction] - The primary action of the in-app message (optional). * @property {NotificareInAppMessageAction} [secondaryAction] - The secondary action of the in-app message (optional). */ interface NotificareInAppMessage { readonly type: string; readonly title?: string; readonly message?: string; readonly image?: string; readonly primaryAction?: NotificareInAppMessageAction; readonly secondaryAction?: NotificareInAppMessageAction; } /** * Defines an action associated with the in-app message. * * @property {string} [label] - The label for the action (option). * @property {boolean} [destructive] - Whether the action performs an irreversible operation (optional). */ interface NotificareInAppMessageAction { readonly label?: string; readonly destructive?: boolean; } /** * The language/region code for the UI. */ type NotificareNotificationPreviewLocale = string; /** * Component that displays a notification preview for different platforms. * * @param {NotificareNotification} notification - The notification to be displayed in the preview. * @param {string} applicationId - The unique identifier of a Notificare application (optional). * @param {boolean} [showControls] - Whether the controls should be shown (optional). It's true by default. * @param {NotificareNotificationPreviewVariant} variant - The variant of the notification preview (optional). It's 'android-lockscreen' by default. * @param {string} [serviceKey] - A service key provided by a Notificare admin. * @param {string} [googleMapsAPIKey] - A Google Maps API key (optional). * @param {string} [locale] - The language/region code for the UI (optional). It's 'en-US' by default. * @param {string} [translations] - A set of custom translations to override the default ones (optional). */ declare function NotificareNotificationPreview({ notification, applicationId, showControls, variant, serviceKey, googleMapsAPIKey, locale, translations, }: NotificareNotificationPreviewProps): react_jsx_runtime.JSX.Element; interface NotificareNotificationPreviewProps { notification: NotificareNotification; applicationId?: string; showControls?: boolean; variant?: NotificareNotificationPreviewVariant; serviceKey: string; googleMapsAPIKey?: string; locale?: NotificareNotificationPreviewLocale; translations?: Partial<Record<NotificarePushTranslationKey, string>>; } /** * Component that displays an in-app message preview. * * @param {NotificareInAppMessage} inAppMessage - The in-app message to be displayed in the preview. * @param {string} [locale] - The language/region code for the UI (optional). It's 'en-US' by default. * @param {string} [translations] - A set of custom translations to override the default ones (optional). */ declare function NotificareInAppMessagePreview({ inAppMessage, locale, translations, }: NotificareInAppMessagePreviewProps): react_jsx_runtime.JSX.Element; interface NotificareInAppMessagePreviewProps { inAppMessage: NotificareInAppMessage; locale?: string; translations?: Partial<Record<NotificareInAppMessagingTranslationKey, string>>; } export { NotificareInAppMessagePreview, NotificareNotificationPreview }; export type { NotificareInAppMessage, NotificareInAppMessageAction, NotificareInAppMessagingTranslationKey, NotificareNotification, NotificareNotificationAction, NotificareNotificationAttachment, NotificareNotificationContent, NotificareNotificationPreviewLocale, NotificareNotificationPreviewVariant, NotificarePushTranslationKey };