Skip to content
This repository was archived by the owner on Feb 5, 2026. It is now read-only.

Commit 621e71f

Browse files
committed
Updated logic and documentation related to the structure of the type returned from getPlacement() function
1 parent dc107c9 commit 621e71f

4 files changed

Lines changed: 8 additions & 17 deletions

File tree

BridgeAPI.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,14 @@ Returns Placement for given parameters.
327327
- Description: Experience identifier
328328

329329
### Result
330-
Promise with a map describing Placement object. Example:
330+
Promise with a map describing Placement object:
331331

332332
{
333-
"image": "https://image.store.com/images/example.jpeg",
334-
"message": "Hello World",
335-
"url": "https://www.qubit.com"
333+
"content": { ... }
336334
"impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
337335
"clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
338336
}
339-
337+
The structure of response content depends on the type of placement that is being called.
340338

341339
### Exceptions
342340
- Exception is thrown, when SDK is not initialized.

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,7 @@ async () => {
247247
}
248248

249249
{
250-
"image": "https://image.store.com/images/example.jpeg",
251-
"message": "Hello World",
252-
"url": "https://www.qubit.com"
253-
"impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
254-
"clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
250+
"content": { ... }
255251
}
256252
```
257253

android/src/main/java/com/qubit/reactnative/sdk/QubitSDKModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ public void getPlacement(
164164
getAttributesJson(attributes),
165165
new PlacementPreviewOptions(campaignId, experienceId),
166166
placement -> {
167-
JsonObject placementJson = placement.getContent();
167+
JsonObject placementJson = new JsonObject();
168+
placementJson.add("content", placement.getContent());
168169
placementJson.addProperty("impressionUrl", placement.getImpressionUrl());
169170
placementJson.addProperty("clickthroughUrl", placement.getClickthroughUrl());
170171
placementPromise.resolve(WritableMapConverter.convertJsonToMap(placementJson));

src/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,7 @@ class QubitSDK {
220220
* }
221221
*
222222
* {
223-
* "image": "https://image.store.com/images/example.jpeg",
224-
* "message": "Hello World",
225-
* "url": "https://www.qubit.com"
226-
* "impressionUrl": "https://api.qubit.com/placements/callback?data=ggW4eyJtZXRhIjp7ImlkIjo",
227-
* "clickthroughUrl": "https://api.qubit.com/placements/callback?data=mQW4eyJtZXRhIjp7Imlkx"
223+
* "content": { ... }
228224
* }
229225
*/
230226
public getPlacement(
@@ -242,7 +238,7 @@ class QubitSDK {
242238
experienceId
243239
)
244240
.then(placement => ({
245-
...placement,
241+
content: placement.content,
246242
impression: () => { NativeModules.QubitSDK.placementImpression(placement.impressionUrl || '') },
247243
clickthrough: () => { NativeModules.QubitSDK.placementClickthrough(placement.clickthroughUrl || '') }
248244
}))

0 commit comments

Comments
 (0)