Skip to content

Commit bef8d54

Browse files
committed
docs: enhance type definitions and improve documentation in Iterable components
1 parent 2170979 commit bef8d54

File tree

5 files changed

+38
-14
lines changed

5 files changed

+38
-14
lines changed

src/core/classes/Iterable.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ export class Iterable {
5757

5858
/**
5959
* Current configuration of the Iterable SDK
60+
*
61+
* @readonly
6062
*/
61-
static savedConfig: IterableConfig = new IterableConfig();
63+
static savedConfig: Readonly<IterableConfig> = new IterableConfig();
6264

6365
/**
6466
* In-app message manager for the current user.

src/core/classes/IterableConfig.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,11 @@ export class IterableConfig {
301301
*/
302302
toDict() {
303303
return {
304+
/** The name of the Iterable push integration. */
304305
pushIntegrationName: this.pushIntegrationName,
306+
/** Whether automatic push registration is enabled. */
305307
autoPushRegistration: this.autoPushRegistration,
308+
/** The display interval between in-app messages (in seconds). */
306309
inAppDisplayInterval: this.inAppDisplayInterval,
307310
/**
308311
* A boolean indicating if a URL handler is present.
@@ -334,13 +337,22 @@ export class IterableConfig {
334337
authHandlerPresent: this.authHandler != undefined,
335338
/** The log level for the SDK. */
336339
logLevel: this.logLevel,
340+
/** The number of seconds before JWT expiration to refresh the token. */
337341
expiringAuthTokenRefreshPeriod: this.expiringAuthTokenRefreshPeriod,
342+
/** The array of allowed URL protocols that the SDK can handle. */
338343
allowedProtocols: this.allowedProtocols,
344+
/**
345+
* @deprecated Whether to use in-memory storage for in-app messages on Android.
346+
*/
339347
androidSdkUseInMemoryStorageForInApps:
340348
this.androidSdkUseInMemoryStorageForInApps,
349+
/** Whether to use in-memory storage for in-app messages. */
341350
useInMemoryStorageForInApps: this.useInMemoryStorageForInApps,
351+
/** The data region determining the data center and endpoints. */
342352
dataRegion: this.dataRegion,
353+
/** The push platform to use for push notifications. */
343354
pushPlatform: this.pushPlatform,
355+
/** Whether encryption is enforced for PII stored on disk (Android only). */
344356
encryptionEnforced: this.encryptionEnforced,
345357
};
346358
}

src/inbox/components/IterableInbox.tsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { useIsFocused } from '@react-navigation/native';
2-
import { useEffect, useState } from 'react';
2+
import {
3+
useEffect,
4+
useState,
5+
type PropsWithChildren,
6+
type ReactElement,
7+
} from 'react';
38
import {
49
Animated,
510
NativeEventEmitter,
@@ -161,6 +166,9 @@ export interface IterableInboxProps
161166
* It handles fetching messages, displaying them in a list, and showing individual message details.
162167
* It also manages the state of the inbox, including loading state, selected message, and visible message impressions.
163168
*
169+
* @category React Components
170+
* @group React Components
171+
*
164172
* @example
165173
* ```tsx
166174
* const [visible, setVisible] = useState<boolean>(false);
@@ -186,15 +194,18 @@ export interface IterableInboxProps
186194
* )
187195
* ```
188196
*/
189-
export const IterableInbox = ({
190-
returnToInboxTrigger = true,
191-
messageListItemLayout = () => null,
192-
customizations = {} as IterableInboxCustomizations,
193-
tabBarHeight = 80,
194-
tabBarPadding = 20,
195-
safeAreaMode = true,
196-
showNavTitle = true,
197-
}: IterableInboxProps) => {
197+
export const IterableInbox = (
198+
params: PropsWithChildren<IterableInboxProps>
199+
): ReactElement => {
200+
const {
201+
returnToInboxTrigger = true,
202+
messageListItemLayout = () => null,
203+
customizations = {} as IterableInboxCustomizations,
204+
tabBarHeight = 80,
205+
tabBarPadding = 20,
206+
safeAreaMode = true,
207+
showNavTitle = true,
208+
} = params;
198209
const defaultInboxTitle = 'Inbox';
199210
const inboxDataModel = new IterableInboxDataModel();
200211

src/inbox/types/IterableInboxCustomizations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface IterableInboxCustomizations {
2424
noMessagesBody?: string;
2525

2626
/**
27-
* CThe container that holds the unread indicator.
27+
* The container that holds the unread indicator.
2828
*/
2929
unreadIndicatorContainer?: {
3030
/** The flex direction of the container. */

src/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ export {
3939
IterableInboxMetadata,
4040
type IterableHtmlInAppContentRaw,
4141
type IterableInAppContent,
42+
type IterableInAppMessageRaw,
4243
} from './inApp';
4344
export {
4445
IterableInbox,
4546
IterableInboxDataModel,
46-
IterableInboxEmptyState,
47-
IterableInboxMessageCell,
4847
type IterableInboxCustomizations,
4948
type IterableInboxEmptyStateProps,
5049
type IterableInboxImpressionRowInfo,

0 commit comments

Comments
 (0)