Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,36 @@ public void updateVisibleRows(ReadableArray visibleRows) {
// ---------------------------------------------------------------------------------------
// endregion

// ---------------------------------------------------------------------------------------
// region Embedded APIs

@ReactMethod
public void getEmbeddedPlacements(Promise promise) {
IterableLogger.d(TAG, "getEmbeddedPlacements");

// Create test data
JSONArray testPlacements = new JSONArray();
try {
// Test placement 1
JSONObject placement1 = new JSONObject();
placement1.put("placementId", "test_placement_1");
testPlacements.put(placement1);

// Test placement 2
JSONObject placement2 = new JSONObject();
placement2.put("placementId", "test_placement_2");
testPlacements.put(placement2);

promise.resolve(Serialization.convertJsonToArray(testPlacements));
} catch (JSONException e) {

promise.reject("", "Failed to create test placements");
}
}

// ---------------------------------------------------------------------------------------
// endregion

// ---------------------------------------------------------------------------------------
// region Private Serialization Functions

Expand Down
5 changes: 5 additions & 0 deletions ios/RNIterableAPI/RNIterableAPI.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ @interface RCT_EXTERN_REMAP_MODULE(RNIterableAPI, ReactIterableAPI, NSObject)

RCT_EXTERN_METHOD(updateVisibleRows: (nonnull NSArray *) visibleRows)

// MARK: - SDK Embedded Manager Functions

RCT_EXTERN_METHOD(getEmbeddedPlacements: (RCTPromiseResolveBlock) resolve
rejecter: (RCTPromiseRejectBlock) reject)

// MARK: - SDK Auth Manager Functions

RCT_EXTERN_METHOD(passAlongAuthToken: (NSString *) authToken)
Expand Down
18 changes: 17 additions & 1 deletion ios/RNIterableAPI/ReactIterableAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,22 @@ class ReactIterableAPI: RCTEventEmitter {

inboxSessionManager.updateVisibleRows(visibleRows: serializedRows)
}

// MARK: - SDK Embedded Manager Functions

@objc(getEmbeddedPlacements:rejecter:)
func getEmbeddedPlacements(resolver: @escaping RCTPromiseResolveBlock,
rejecter: @escaping RCTPromiseRejectBlock) {
ITBInfo()

// Create test data
let testPlacements: [[String: Any]] = [
["placementId": "test_placement_1"],
["placementId": "test_placement_2"]
]

resolver(testPlacements)
}

// MARK: - SDK Auth Manager Functions

Expand All @@ -481,7 +497,7 @@ class ReactIterableAPI: RCTEventEmitter {

authHandlerSemaphore.signal()
}

// MARK: Private
private var shouldEmit = false
private let _methodQueue = DispatchQueue(label: String(describing: ReactIterableAPI.self))
Expand Down
24 changes: 24 additions & 0 deletions src/embedded/classes/IterableEmbeddedManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { NativeModules } from 'react-native';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]


import { Iterable } from '../../core/classes/Iterable';
import { IterableEmbeddedPlacement } from './IterableEmbeddedPlacement';

const RNIterableAPI = NativeModules.RNIterableAPI;

/**
* Manages embedded messages for the current user.
*
* This class provides methods to interact with embedded messages, including retrieving placements.
*/
export class IterableEmbeddedManager {
/**
* Retrieve the current user's list of embedded placements.
*
* @returns A Promise that resolves to an array of embedded placements.
*/
getPlacements(): Promise<IterableEmbeddedPlacement[]> {
Iterable?.logger?.log('EmbeddedManager.getPlacements');

return RNIterableAPI.getEmbeddedPlacements();
}
}
11 changes: 11 additions & 0 deletions src/embedded/classes/IterableEmbeddedPlacement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

* Iterable embedded placement
* Contains placement id and the associated embedded messages
*/
export class IterableEmbeddedPlacement {
readonly placementId: string;

constructor(placementId: string) {
this.placementId = placementId;
}
}