notificare-react-preview-components 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -1,5 +1,81 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
+ declare const PUSH_TRANSLATIONS: {
4
+ 'controls.platform': string;
5
+ 'controls.formFactor': string;
6
+ 'controls.operatingSystem': string;
7
+ 'controls.operatingSystem.macos': string;
8
+ 'controls.variant': string;
9
+ 'controls.displayMode.lockScreen': string;
10
+ 'controls.displayMode.expandedLockScreen': string;
11
+ 'controls.displayMode.appUi': string;
12
+ 'preview.error.notGeneratedPreview': string;
13
+ 'preview.error.checkConsole': string;
14
+ 'preview.error.invalidNotification': string;
15
+ 'preview.error.provideGoogleMapsApiKey': string;
16
+ 'preview.error.notSupportedPreviewVariant': string;
17
+ 'preview.error.invalidUrl': string;
18
+ 'preview.error.iosStoreAppNotFound': string;
19
+ 'preview.error.webshotFail': string;
20
+ 'preview.error.notSupportedNotificationTypePreviewVariant': string;
21
+ 'preview.error.notSupportedUrlResolverWithUrlSchemePreview': string;
22
+ 'preview.error.urlResolverInvalidUrl': string;
23
+ 'preview.error.urlResolverNoNotificareWebViewQueryParameter': string;
24
+ 'preview.error.notSupportedUrlResolverWithDynamicLink': string;
25
+ 'preview.error.notSupportedUrlResolverWithRelativeUrl': string;
26
+ 'preview.error.googleMapsAuthFailure': string;
27
+ 'preview.error.googleMapsLoadFailure': string;
28
+ 'preview.error.noValidContentObject': string;
29
+ 'preview.error.iosStoreAppLoadFailure': string;
30
+ 'preview.android.alert.appUi.cancel': string;
31
+ 'preview.android.inAppBrowser.appUi.pageTitleLoading': string;
32
+ 'preview.android.lockscreen.time': string;
33
+ 'preview.ios.alert.appUi.cancel': string;
34
+ 'preview.ios.alert.appUi.ok': string;
35
+ 'preview.ios.inAppBrowser.appUi.done': string;
36
+ 'preview.ios.inAppBrowser.appUi.notSecure': string;
37
+ 'preview.ios.rate.appUi.rateNow': string;
38
+ 'preview.ios.rate.appUi.doNotRate': string;
39
+ 'preview.ios.store.appUi.done': string;
40
+ 'preview.ios.store.appUi.install': string;
41
+ 'preview.ios.store.appUi.ratings': string;
42
+ 'preview.ios.store.appUi.age': string;
43
+ 'preview.ios.store.appUi.yearsOld': string;
44
+ 'preview.ios.store.appUi.category': string;
45
+ 'preview.ios.store.appUi.developer': string;
46
+ 'preview.ios.store.appUi.whatsNew': string;
47
+ 'preview.ios.store.appUi.historyVersion': string;
48
+ 'preview.ios.store.appUi.screenshots': string;
49
+ 'preview.ios.lockScreen.time': string;
50
+ 'preview.web.desktop.macos.lockScreen.time': string;
51
+ 'preview.web.desktop.macos.lockScreen.settings': string;
52
+ 'preview.web.desktop.macos.lockScreen.options': string;
53
+ };
54
+ /**
55
+ * The set of translation keys for push notification previews.
56
+ */
57
+ type NotificarePushTranslationKey = keyof typeof PUSH_TRANSLATIONS;
58
+
59
+ declare const IN_APP_MESSAGING_TRANSLATIONS: {
60
+ 'preview.error.invalidInAppMessage': string;
61
+ 'preview.error.notGeneratedPreview': string;
62
+ 'preview.error.checkConsole': string;
63
+ };
64
+ /**
65
+ * The set of translation keys for in-app message previews.
66
+ */
67
+ type NotificareInAppMessagingTranslationKey = keyof typeof IN_APP_MESSAGING_TRANSLATIONS;
68
+
69
+ declare const PUSH_ONBOARDING_TRANSLATIONS: {
70
+ 'preview.error.invalidPushOnboardingApplicationInfo': string;
71
+ 'preview.error.notGeneratedPreview': string;
72
+ 'preview.error.checkConsole': string;
73
+ };
74
+ /**
75
+ * The set of translation keys for push onboarding previews.
76
+ */
77
+ type NotificarePushOnboardingTranslationKey = keyof typeof PUSH_ONBOARDING_TRANSLATIONS;
78
+
3
79
  /**
4
80
  * Defines the structure of a notification object.
5
81
  *
@@ -60,26 +136,183 @@ interface NotificareNotificationAttachment {
60
136
  /**
61
137
  * Defines the notification preview variant to be shown.
62
138
  */
63
- type NotificareNotificationVariant = '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';
139
+ 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';
140
+
141
+ /**
142
+ * Defines the structure of an in-app message object.
143
+ *
144
+ * @property {string} type - The type of the in-app message (e.g., "re.notifica.inappmessage.Banner", "re.notifica.inappmessage.Card").
145
+ * @property {string} [title] - The title of the in-app message (optional).
146
+ * @property {string} [message] - The message of the in-app message (optional).
147
+ * @property {string} [image] - The image of the in-app message (optional).
148
+ * @property {NotificareInAppMessageAction} [primaryAction] - The primary action of the in-app message (optional).
149
+ * @property {NotificareInAppMessageAction} [secondaryAction] - The secondary action of the in-app message (optional).
150
+ */
151
+ interface NotificareInAppMessage {
152
+ readonly type: string;
153
+ readonly title?: string;
154
+ readonly message?: string;
155
+ readonly image?: string;
156
+ readonly primaryAction?: NotificareInAppMessageAction;
157
+ readonly secondaryAction?: NotificareInAppMessageAction;
158
+ }
159
+ /**
160
+ * Defines an action associated with the in-app message.
161
+ *
162
+ * @property {string} [label] - The label for the action (option).
163
+ * @property {boolean} [destructive] - Whether the action performs an irreversible operation (optional).
164
+ */
165
+ interface NotificareInAppMessageAction {
166
+ readonly label?: string;
167
+ readonly destructive?: boolean;
168
+ }
169
+
170
+ /**
171
+ * Defines partial information of a Notificare app.
172
+ *
173
+ * @property {string} [name] - The name of the application (optional).
174
+ * @property {string} websitePushConfig - The Website Push configuration of the app.
175
+ */
176
+ interface NotificarePushOnboardingApplicationInfo {
177
+ readonly name?: string;
178
+ readonly websitePushConfig: NotificarePushOnboardingWebsitePushConfig;
179
+ }
180
+ /**
181
+ * Defines the Website Push configuration of an app.
182
+ *
183
+ * @property {string} [icon] - The icon to be displayed in a native browser notification (optional).
184
+ * @property {NotificarePushOnboardingLaunchConfig} launchConfig - Set of launch options.
185
+ */
186
+ interface NotificarePushOnboardingWebsitePushConfig {
187
+ readonly icon?: string;
188
+ readonly launchConfig: NotificarePushOnboardingLaunchConfig;
189
+ }
190
+ /**
191
+ * Defines the launch configuration of an app.
192
+ *
193
+ * @property {string} [applicationName] - A custom application name to replace the original one at the top of a dialog (optional).
194
+ * @property {NotificarePushOnboardingFloatingButtonOptions} [floatingButtonOptions] - Set of floating button customization options (optional).
195
+ * @property {NotificarePushOnboardingAutoOnboardingOptions} [autoOnboardingOptions] - Set of dialog customization options (optional).
196
+ */
197
+ interface NotificarePushOnboardingLaunchConfig {
198
+ readonly applicationName?: string;
199
+ readonly floatingButtonOptions?: NotificarePushOnboardingFloatingButtonOptions;
200
+ readonly autoOnboardingOptions?: NotificarePushOnboardingAutoOnboardingOptions;
201
+ }
202
+ /**
203
+ * Defines the floating button customization options.
204
+ *
205
+ * @property {NotificarePushOnboardingFloatingButtonAlignment} alignment - Defines the horizontal and vertical alignment of the floating button.
206
+ * @property {NotificarePushOnboardingFloatingButtonPermissionTexts} permissionTexts - Custom texts for the tooltip on the floating button based on the remote notification permission status.
207
+ */
208
+ interface NotificarePushOnboardingFloatingButtonOptions {
209
+ readonly alignment: NotificarePushOnboardingFloatingButtonAlignment;
210
+ readonly permissionTexts: NotificarePushOnboardingFloatingButtonPermissionTexts;
211
+ }
212
+ /**
213
+ * Defines the horizontal and vertical alignment of the floating button.
214
+ *
215
+ * @property {NotificarePushOnboardingFloatingButtonHorizontalAlignment} horizontal - The horizontal alignment.
216
+ * @property {NotificarePushOnboardingFloatingButtonVerticalAlignment} vertical - The vertical alignment.
217
+ */
218
+ interface NotificarePushOnboardingFloatingButtonAlignment {
219
+ readonly horizontal: NotificarePushOnboardingFloatingButtonHorizontalAlignment;
220
+ readonly vertical: NotificarePushOnboardingFloatingButtonVerticalAlignment;
221
+ }
222
+ type NotificarePushOnboardingFloatingButtonHorizontalAlignment = 'start' | 'end';
223
+ type NotificarePushOnboardingFloatingButtonVerticalAlignment = 'top' | 'bottom';
224
+ /**
225
+ * Specifies custom texts for the tooltip on the floating button based on the remote notification permission status.
226
+ *
227
+ * @property {string} default - The text to be displayed when remote notifications were neither allowed nor denied by the user.
228
+ * @property {string} granted - The text to be displayed when the user allows remote notifications.
229
+ * @property {string} denied - The text to be displayed when the user denies remote notifications.
230
+ */
231
+ interface NotificarePushOnboardingFloatingButtonPermissionTexts {
232
+ readonly default: string;
233
+ readonly granted: string;
234
+ readonly denied: string;
235
+ }
236
+ /**
237
+ * Defines the dialog customization options.
238
+ *
239
+ * @property {string} message - The main message of the dialog.
240
+ * @property {string} cancelButton - The text on the cancel button.
241
+ * @property {string} acceptButton - The text on the accept button.
242
+ */
243
+ interface NotificarePushOnboardingAutoOnboardingOptions {
244
+ readonly message: string;
245
+ readonly cancelButton: string;
246
+ readonly acceptButton: string;
247
+ }
248
+
249
+ /**
250
+ * The remote notification permission status.
251
+ */
252
+ type NotificarePushOnboardingPermissionStatus = 'default' | 'granted' | 'denied';
253
+
254
+ /**
255
+ * The language/region code for the UI.
256
+ */
257
+ type NotificareNotificationPreviewLocale = string;
64
258
 
65
- declare function NotificareNotificationPreview({ notification, applicationId, showControls, variant, serviceKey, googleMapsAPIKey, }: NotificareNotificationPreviewProps): react_jsx_runtime.JSX.Element;
66
259
  /**
67
260
  * Component that displays a notification preview for different platforms.
68
261
  *
69
262
  * @param {NotificareNotification} notification - The notification to be displayed in the preview.
70
263
  * @param {string} applicationId - The unique identifier of a Notificare application (optional).
71
264
  * @param {boolean} [showControls] - Whether the controls should be shown (optional). It's true by default.
72
- * @param {NotificareNotificationVariant} variant - The variant of the notification preview (optional). It's 'android-lockscreen' by default.
73
- * @property {string} [serviceKey] - A service key provided by a Notificare admin.
74
- * @property {string} [googleMapsAPIKey] - A Google Maps API key (optional).
265
+ * @param {NotificareNotificationPreviewVariant} variant - The variant of the notification preview (optional). It's 'android-lockscreen' by default.
266
+ * @param {string} [serviceKey] - A service key provided by a Notificare admin.
267
+ * @param {string} [googleMapsAPIKey] - A Google Maps API key (optional).
268
+ * @param {string} [locale] - The language/region code for the UI (optional). It's 'en-US' by default.
269
+ * @param {string} [translations] - A set of custom translations to override the default ones (optional).
75
270
  */
271
+ declare function NotificareNotificationPreview({ notification, applicationId, showControls, variant, serviceKey, googleMapsAPIKey, locale, translations, }: NotificareNotificationPreviewProps): react_jsx_runtime.JSX.Element;
76
272
  interface NotificareNotificationPreviewProps {
77
273
  notification: NotificareNotification;
78
274
  applicationId?: string;
79
275
  showControls?: boolean;
80
- variant?: NotificareNotificationVariant;
276
+ variant?: NotificareNotificationPreviewVariant;
81
277
  serviceKey: string;
82
278
  googleMapsAPIKey?: string;
279
+ locale?: NotificareNotificationPreviewLocale;
280
+ translations?: Partial<Record<NotificarePushTranslationKey, string>>;
281
+ }
282
+
283
+ /**
284
+ * Component that displays an in-app message preview.
285
+ *
286
+ * @param {NotificareInAppMessage} inAppMessage - The in-app message to be displayed in the preview.
287
+ * @param {string} [locale] - The language/region code for the UI (optional). It's 'en-US' by default.
288
+ * @param {string} [translations] - A set of custom translations to override the default ones (optional).
289
+ */
290
+ declare function NotificareInAppMessagePreview({ inAppMessage, locale, translations, }: NotificareInAppMessagePreviewProps): react_jsx_runtime.JSX.Element;
291
+ interface NotificareInAppMessagePreviewProps {
292
+ inAppMessage: NotificareInAppMessage;
293
+ locale?: string;
294
+ translations?: Partial<Record<NotificareInAppMessagingTranslationKey, string>>;
295
+ }
296
+
297
+ /**
298
+ * Component that displays a push onboarding preview depending on the launch configurations of an app.
299
+ *
300
+ * @param {string} [applicationId] - The unique identifier of a Notificare application (optional).
301
+ * @param {string} [permissionStatus] - The remote notification permission status (optional). It's 'default' by default.
302
+ * @param {string} applicationInfo - Partial information from a Notificare application.
303
+ * @param {string} [serviceKey] - A service key provided by a Notificare admin (optional).
304
+ * @param {string} [locale] - The language/region code for the UI (optional). It's 'en-US' by default.
305
+ * @param {string} [translations] - A set of custom translations to override the default ones (optional).
306
+ */
307
+ declare function NotificarePushOnboardingPreview({ applicationId, permissionStatus, applicationInfo, serviceKey, locale, translations, }: NotificarePushOnboardingPreviewProps): react_jsx_runtime.JSX.Element;
308
+ interface NotificarePushOnboardingPreviewProps {
309
+ applicationId?: string;
310
+ permissionStatus?: NotificarePushOnboardingPermissionStatus;
311
+ applicationInfo: NotificarePushOnboardingApplicationInfo;
312
+ serviceKey?: string;
313
+ locale?: string;
314
+ translations?: Partial<Record<NotificarePushOnboardingTranslationKey, string>>;
83
315
  }
84
316
 
85
- export { NotificareNotificationPreview };
317
+ export { NotificareInAppMessagePreview, NotificareNotificationPreview, NotificarePushOnboardingPreview };
318
+ export type { NotificareInAppMessage, NotificareInAppMessageAction, NotificareInAppMessagingTranslationKey, NotificareNotification, NotificareNotificationAction, NotificareNotificationAttachment, NotificareNotificationContent, NotificareNotificationPreviewLocale, NotificareNotificationPreviewVariant, NotificarePushOnboardingApplicationInfo, NotificarePushOnboardingAutoOnboardingOptions, NotificarePushOnboardingFloatingButtonAlignment, NotificarePushOnboardingFloatingButtonHorizontalAlignment, NotificarePushOnboardingFloatingButtonOptions, NotificarePushOnboardingFloatingButtonPermissionTexts, NotificarePushOnboardingFloatingButtonVerticalAlignment, NotificarePushOnboardingLaunchConfig, NotificarePushOnboardingPermissionStatus, NotificarePushOnboardingTranslationKey, NotificarePushOnboardingWebsitePushConfig, NotificarePushTranslationKey };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "notificare-react-preview-components",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "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.",
5
5
  "author": "Notificare <info@notificare.com> (https://notificare.com)",
6
6
  "license": "MIT",
7
7
  "homepage": "https://notificare.com/",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/notificare/notificare-react-preview-components.git"
10
+ "url": "git+https://github.com/notificare/notificare-react-preview-components.git"
11
11
  },
12
12
  "keywords": [
13
13
  "notificare",
@@ -29,13 +29,15 @@
29
29
  "lint": "eslint .",
30
30
  "prepack": "npm run build",
31
31
  "storybook": "storybook dev -p 6006",
32
- "test": "jest"
32
+ "test": "jest",
33
+ "typecheck": "tsc --noEmit"
33
34
  },
34
35
  "files": [
35
36
  "dist"
36
37
  ],
37
38
  "dependencies": {
38
39
  "@vis.gl/react-google-maps": "^1.5.2",
40
+ "react-intl": "^7.1.11",
39
41
  "zod": "^3.24.1"
40
42
  },
41
43
  "peerDependencies": {
@@ -47,20 +49,14 @@
47
49
  "@babel/preset-env": "^7.26.9",
48
50
  "@babel/preset-react": "^7.26.3",
49
51
  "@babel/preset-typescript": "^7.27.0",
50
- "@chromatic-com/storybook": "^3.2.3",
51
52
  "@eslint/js": "^9.18.0",
53
+ "@rollup/plugin-alias": "^5.1.1",
52
54
  "@rollup/plugin-commonjs": "^28.0.3",
53
- "@rollup/plugin-json": "^6.1.0",
54
55
  "@rollup/plugin-node-resolve": "^16.0.1",
55
56
  "@rollup/plugin-terser": "^0.4.4",
56
57
  "@rollup/plugin-typescript": "^12.1.2",
57
- "@storybook/addon-essentials": "^8.6.12",
58
- "@storybook/addon-interactions": "^8.6.12",
59
- "@storybook/addon-onboarding": "^8.6.12",
60
- "@storybook/blocks": "^8.6.12",
61
- "@storybook/react": "^8.6.12",
62
- "@storybook/react-vite": "^8.6.12",
63
- "@storybook/test": "^8.6.12",
58
+ "@storybook/react-vite": "^9.0.4",
59
+ "@svgr/rollup": "^8.1.0",
64
60
  "@testing-library/jest-dom": "^6.6.3",
65
61
  "@testing-library/react": "^16.3.0",
66
62
  "@types/jest": "^29.5.14",
@@ -70,9 +66,12 @@
70
66
  "dotenv": "^16.5.0",
71
67
  "eslint": "^9.18.0",
72
68
  "eslint-config-prettier": "^10.0.1",
69
+ "eslint-import-resolver-typescript": "^4.4.4",
73
70
  "eslint-plugin-import": "^2.31.0",
71
+ "eslint-plugin-prettier": "^5.5.4",
74
72
  "eslint-plugin-react": "^7.37.4",
75
- "eslint-plugin-storybook": "^0.12.0",
73
+ "eslint-plugin-react-hooks": "^5.2.0",
74
+ "eslint-plugin-storybook": "^9.0.4",
76
75
  "globals": "^16.0.0",
77
76
  "identity-obj-proxy": "^3.0.0",
78
77
  "jest": "^29.7.0",
@@ -80,16 +79,23 @@
80
79
  "prettier": "^3.5.3",
81
80
  "react": "^19.1.0",
82
81
  "react-dom": "^19.1.0",
82
+ "react-intl": "^7.1.11",
83
83
  "rollup": "^4.37.0",
84
84
  "rollup-plugin-dts": "^6.2.1",
85
85
  "rollup-plugin-peer-deps-external": "^2.2.4",
86
86
  "rollup-plugin-postcss": "^4.0.2",
87
87
  "rollup-plugin-visualizer": "^5.14.0",
88
- "storybook": "^8.6.12",
88
+ "storybook": "^9.0.4",
89
89
  "style-loader": "^4.0.0",
90
+ "ts-jest": "^29.3.4",
90
91
  "ts-node": "^10.9.2",
91
92
  "tslib": "^2.8.1",
92
93
  "typescript": "^5.7.3",
93
- "typescript-eslint": "^8.20.0"
94
+ "typescript-eslint": "^8.20.0",
95
+ "vite-plugin-svgr": "^4.3.0",
96
+ "vite-tsconfig-paths": "^5.1.4"
97
+ },
98
+ "overrides": {
99
+ "storybook": "$storybook"
94
100
  }
95
101
  }