notificare-react-preview-components 1.0.0 → 1.1.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,71 @@
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
+
3
69
  /**
4
70
  * Defines the structure of a notification object.
5
71
  *
@@ -60,26 +126,79 @@ interface NotificareNotificationAttachment {
60
126
  /**
61
127
  * Defines the notification preview variant to be shown.
62
128
  */
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';
129
+ 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';
130
+
131
+ /**
132
+ * Defines the structure of an in-app message object.
133
+ *
134
+ * @property {string} type - The type of the in-app message (e.g., "re.notifica.inappmessage.Banner", "re.notifica.inappmessage.Card").
135
+ * @property {string} [title] - The title of the in-app message (optional).
136
+ * @property {string} [message] - The message of the in-app message (optional).
137
+ * @property {string} [image] - The image of the in-app message (optional).
138
+ * @property {NotificareInAppMessageAction} [primaryAction] - The primary action of the in-app message (optional).
139
+ * @property {NotificareInAppMessageAction} [secondaryAction] - The secondary action of the in-app message (optional).
140
+ */
141
+ interface NotificareInAppMessage {
142
+ readonly type: string;
143
+ readonly title?: string;
144
+ readonly message?: string;
145
+ readonly image?: string;
146
+ readonly primaryAction?: NotificareInAppMessageAction;
147
+ readonly secondaryAction?: NotificareInAppMessageAction;
148
+ }
149
+ /**
150
+ * Defines an action associated with the in-app message.
151
+ *
152
+ * @property {string} [label] - The label for the action (option).
153
+ * @property {boolean} [destructive] - Whether the action performs an irreversible operation (optional).
154
+ */
155
+ interface NotificareInAppMessageAction {
156
+ readonly label?: string;
157
+ readonly destructive?: boolean;
158
+ }
159
+
160
+ /**
161
+ * The language/region code for the UI.
162
+ */
163
+ type NotificareNotificationPreviewLocale = string;
64
164
 
65
- declare function NotificareNotificationPreview({ notification, applicationId, showControls, variant, serviceKey, googleMapsAPIKey, }: NotificareNotificationPreviewProps): react_jsx_runtime.JSX.Element;
66
165
  /**
67
166
  * Component that displays a notification preview for different platforms.
68
167
  *
69
168
  * @param {NotificareNotification} notification - The notification to be displayed in the preview.
70
169
  * @param {string} applicationId - The unique identifier of a Notificare application (optional).
71
170
  * @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).
171
+ * @param {NotificareNotificationPreviewVariant} variant - The variant of the notification preview (optional). It's 'android-lockscreen' by default.
172
+ * @param {string} [serviceKey] - A service key provided by a Notificare admin.
173
+ * @param {string} [googleMapsAPIKey] - A Google Maps API key (optional).
174
+ * @param {string} [locale] - The language/region code for the UI (optional). It's 'en-US' by default.
175
+ * @param {string} [translations] - A set of custom translations to override the default ones (optional).
75
176
  */
177
+ declare function NotificareNotificationPreview({ notification, applicationId, showControls, variant, serviceKey, googleMapsAPIKey, locale, translations, }: NotificareNotificationPreviewProps): react_jsx_runtime.JSX.Element;
76
178
  interface NotificareNotificationPreviewProps {
77
179
  notification: NotificareNotification;
78
180
  applicationId?: string;
79
181
  showControls?: boolean;
80
- variant?: NotificareNotificationVariant;
182
+ variant?: NotificareNotificationPreviewVariant;
81
183
  serviceKey: string;
82
184
  googleMapsAPIKey?: string;
185
+ locale?: NotificareNotificationPreviewLocale;
186
+ translations?: Partial<Record<NotificarePushTranslationKey, string>>;
187
+ }
188
+
189
+ /**
190
+ * Component that displays an in-app message preview.
191
+ *
192
+ * @param {NotificareInAppMessage} inAppMessage - The in-app message to be displayed in the preview.
193
+ * @param {string} [locale] - The language/region code for the UI (optional). It's 'en-US' by default.
194
+ * @param {string} [translations] - A set of custom translations to override the default ones (optional).
195
+ */
196
+ declare function NotificareInAppMessagePreview({ inAppMessage, locale, translations, }: NotificareInAppMessagePreviewProps): react_jsx_runtime.JSX.Element;
197
+ interface NotificareInAppMessagePreviewProps {
198
+ inAppMessage: NotificareInAppMessage;
199
+ locale?: string;
200
+ translations?: Partial<Record<NotificareInAppMessagingTranslationKey, string>>;
83
201
  }
84
202
 
85
- export { NotificareNotificationPreview };
203
+ export { NotificareInAppMessagePreview, NotificareNotificationPreview };
204
+ export type { NotificareInAppMessage, NotificareInAppMessageAction, NotificareInAppMessagingTranslationKey, NotificareNotification, NotificareNotificationAction, NotificareNotificationAttachment, NotificareNotificationContent, NotificareNotificationPreviewLocale, NotificareNotificationPreviewVariant, 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.1.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,14 +29,16 @@
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",
39
- "zod": "^3.24.1"
40
+ "zod": "^3.24.1",
41
+ "react-intl": "^7.1.11"
40
42
  },
41
43
  "peerDependencies": {
42
44
  "react": "^19.0.0",
@@ -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",
@@ -72,7 +68,7 @@
72
68
  "eslint-config-prettier": "^10.0.1",
73
69
  "eslint-plugin-import": "^2.31.0",
74
70
  "eslint-plugin-react": "^7.37.4",
75
- "eslint-plugin-storybook": "^0.12.0",
71
+ "eslint-plugin-storybook": "^9.0.4",
76
72
  "globals": "^16.0.0",
77
73
  "identity-obj-proxy": "^3.0.0",
78
74
  "jest": "^29.7.0",
@@ -80,16 +76,23 @@
80
76
  "prettier": "^3.5.3",
81
77
  "react": "^19.1.0",
82
78
  "react-dom": "^19.1.0",
79
+ "react-intl": "^7.1.11",
83
80
  "rollup": "^4.37.0",
84
81
  "rollup-plugin-dts": "^6.2.1",
85
82
  "rollup-plugin-peer-deps-external": "^2.2.4",
86
83
  "rollup-plugin-postcss": "^4.0.2",
87
84
  "rollup-plugin-visualizer": "^5.14.0",
88
- "storybook": "^8.6.12",
85
+ "storybook": "^9.0.4",
89
86
  "style-loader": "^4.0.0",
87
+ "ts-jest": "^29.3.4",
90
88
  "ts-node": "^10.9.2",
91
89
  "tslib": "^2.8.1",
92
90
  "typescript": "^5.7.3",
93
- "typescript-eslint": "^8.20.0"
91
+ "typescript-eslint": "^8.20.0",
92
+ "vite-plugin-svgr": "^4.3.0",
93
+ "vite-tsconfig-paths": "^5.1.4"
94
+ },
95
+ "overrides": {
96
+ "storybook": "$storybook"
94
97
  }
95
98
  }