Skip to content

Commit c377d9d

Browse files
committed
feat: add @SInCE tag to documentation and improve Iterable SDK comments
1 parent d11453d commit c377d9d

File tree

4 files changed

+60
-35
lines changed

4 files changed

+60
-35
lines changed

src/core/classes/Iterable.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const RNEventEmitter = new NativeEventEmitter(RNIterableAPI);
4646
export class Iterable {
4747
/**
4848
* Current configuration of the Iterable SDK
49+
*
50+
* @readonly
4951
*/
5052
static savedConfig: Readonly<IterableConfig> = new IterableConfig();
5153

@@ -75,6 +77,9 @@ export class Iterable {
7577
* This property provides access to authentication functionality including
7678
* pausing the authentication retry mechanism.
7779
*
80+
* @since Introduced in
81+
* [2.2.0](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.2.0)
82+
*
7883
* @example
7984
* ```typescript
8085
* Iterable.authManager.pauseAuthRetries(true);
@@ -88,6 +93,9 @@ export class Iterable {
8893
* This property provides access to user functionality including
8994
* getting the current user's email and setting the current user's email.
9095
*
96+
* @since Introduced in
97+
* [2.2.0](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.2.0)
98+
*
9199
* @example
92100
* ```typescript
93101
* Iterable.user.getEmail().then((email) => {
@@ -103,6 +111,9 @@ export class Iterable {
103111
* This property provides access to tracking functionality including
104112
* setting attribution information, tracking push opens, and tracking events.
105113
*
114+
* @since Introduced in
115+
* [2.2.0](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.2.0)
116+
*
106117
* @example
107118
* ```typescript
108119
* Iterable.track.setAttributionInfo(new IterableAttributionInfo(1234, 5678, 9012));

src/core/classes/IterableAuthManager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { IterableAuthResponse } from './IterableAuthResponse';
55
* @beta
66
* Manages the authentication for the Iterable SDK.
77
*
8+
* @since Introduced in [2.2.0](https://www.npmjs.com/package/@iterable/react-native-sdk/v/2.2.0)
9+
*
810
* @example
911
* ```typescript
1012
* const authManager = new IterableAuthManager();

src/core/classes/IterableConfig.ts

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ export class IterableConfig {
129129
* This example searches for URLs that contain product/, followed by more text. Upon finding this sequence of text, the code displays the appropriate screen and returns `true`. When it's not found, the app returns `false`.
130130
*
131131
* ```typescript
132-
* const config = new IterableConfig();
133-
*
134-
* config.urlHandler = (url, context) => {
135-
* if (url.match(/product\/([^\/]+)/i)) {
136-
* this.navigate(match[1]);
137-
* return true; // handled
138-
* }
139-
* return false; // not handled
140-
* };
132+
* const config = new IterableConfig({
133+
* urlHandler: (url, context) => {
134+
* if (url.match(/product\/([^\/]+)/i)) {
135+
* this.navigate(match[1]);
136+
* return true; // handled
137+
* }
138+
* return false; // not handled
139+
* },
140+
* });
141141
*
142142
* Iterable.initialize('<YOUR_API_KEY>', config);
143143
* ```
@@ -174,16 +174,18 @@ export class IterableConfig {
174174
* @example
175175
* This example responds to the `action://achievedPremierStatus` custom action URL by updating the app's styles and return `true`. Since this is the only custom action handled by the method, it returns `false` for anything else.
176176
* ```typescript
177-
* const config = new IterableConfig();
178-
* config.customActionHandler = (action, context) => {
179-
* if (action.type == "achievedPremierStatus") {
180-
* // For this action, update the app's styles
181-
* this.updateAppStyles("premier");
182-
* return true;
183-
* }
184-
* return false;
185-
* }
186-
* Iterable.initialize('<YOUR_API_KEY>', config);
177+
* const config = new IterableConfig({
178+
* customActionHandler: (action, context) => {
179+
* if (action.type == "achievedPremierStatus") {
180+
* // For this action, update the app's styles
181+
* this.updateAppStyles("premier");
182+
* return true;
183+
* }
184+
* return false;
185+
* },
186+
* });
187+
*
188+
* Iterable.initialize('<YOUR_API_KEY>', config);
187189
* ```
188190
*
189191
* @returns A boolean indicating whether the action was handled.
@@ -257,16 +259,16 @@ export class IterableConfig {
257259
* This example demonstrates how an app that uses a JWT-enabled API key might initialize the SDK.
258260
*
259261
* ```typescript
260-
* const config = new IterableConfig();
261-
*
262-
* config.authHandler = () => {
263-
* // ... Fetch a JWT from your server, or locate one you've already retrieved
264-
* return new Promise(function (resolve, reject) {
265-
* // Resolve the promise with a valid auth token for the current user
266-
* resolve("<AUTH_TOKEN>")
267-
* });
268-
* };
269-
* config.autoPushRegistration = false;
262+
* const config = new IterableConfig({
263+
* authHandler: () => {
264+
* // ... Fetch a JWT from your server, or locate one you've already retrieved
265+
* return new Promise(function (resolve, reject) {
266+
* // Resolve the promise with a valid auth token for the current user
267+
* resolve("<AUTH_TOKEN>")
268+
* });
269+
* },
270+
* autoPushRegistration: false,
271+
* });
270272
*
271273
* Iterable.initialize('<YOUR_API_KEY>', config);
272274
* ```
@@ -289,10 +291,13 @@ export class IterableConfig {
289291
*
290292
* @example
291293
* ```typescript
292-
* const config = new IterableConfig();
293-
* config.onJWTError = (authFailure) => {
294-
* console.error('Error fetching JWT:', authFailure);
295-
* };
294+
* const config = new IterableConfig({
295+
* onJWTError: (authFailure) => {
296+
* console.error('Error fetching JWT:', authFailure);
297+
* },
298+
* });
299+
*
300+
* Iterable.initialize('<YOUR_API_KEY>', config);
296301
* ```
297302
*/
298303
onJWTError?: (authFailure: IterableAuthFailure) => void;
@@ -334,8 +339,11 @@ export class IterableConfig {
334339
* To allow the SDK to handle `http`, `tel`, and `custom` links, use code similar to this:
335340
*
336341
* ```typescript
337-
* const config = new IterableConfig();
338-
* config.allowedProtocols = ["http", "tel", "custom"];
342+
* const config = new IterableConfig({
343+
* allowedProtocols: ["http", "tel", "custom"],
344+
* });
345+
*
346+
* Iterable.initialize('<YOUR_API_KEY>', config);
339347
* ```
340348
*
341349
* @remarks

tsdoc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
{
1717
"tagName": "@license",
1818
"syntaxKind": "block"
19+
},
20+
{
21+
"tagName": "@since",
22+
"syntaxKind": "block"
1923
}
2024
]
2125
}

0 commit comments

Comments
 (0)