@allboatsrise/expo-marketingcloudsdk 48.0.3 → 48.0.4

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.
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'expo.modules.marketingcloudsdk'
6
- version = '48.0.3'
6
+ version = '48.0.4'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -77,7 +77,7 @@ android {
77
77
  minSdkVersion safeExtGet("minSdkVersion", 21)
78
78
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
79
79
  versionCode 1
80
- versionName "48.0.3"
80
+ versionName "48.0.4"
81
81
  }
82
82
  lintOptions {
83
83
  abortOnError false
@@ -12,7 +12,8 @@ import com.salesforce.marketingcloud.messages.inbox.InboxMessageManager.InboxRes
12
12
  import expo.modules.kotlin.Promise
13
13
  import expo.modules.kotlin.modules.Module
14
14
  import expo.modules.kotlin.modules.ModuleDefinition
15
- import expo.modules.kotlin.types.JSTypeConverter
15
+ import org.json.JSONObject
16
+ import java.text.SimpleDateFormat
16
17
 
17
18
 
18
19
  class ExpoMarketingCloudSdkModule : Module() {
@@ -251,7 +252,37 @@ class ExpoMarketingCloudSdkModule : Module() {
251
252
  } }
252
253
  }
253
254
 
254
- private fun messagesToJSValue(messages: List<InboxMessage>): Any? {
255
- return JSTypeConverter.convertToJSValue(messages)
255
+ private fun messagesToJSValue(messages: List<InboxMessage>): List<Map<String, Any?>> {
256
+ val dateFormatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
257
+
258
+ return messages.map {
259
+ var media = it.media
260
+
261
+ mapOf(
262
+ "id" to it.id,
263
+ "alert" to it.alert,
264
+ "custom" to if (it.custom != null) {
265
+ buildMap<String, String> {
266
+ var obj = JSONObject(it.custom)
267
+ obj.keys().forEach {
268
+ put(it, obj.getString(it))
269
+ }
270
+ }
271
+ } else null,
272
+ "deleted" to it.deleted,
273
+ "endDateUtc" to if (it.endDateUtc != null) dateFormatter.format(it.endDateUtc) else null,
274
+ "media" to if (media != null) mapOf(
275
+ "url" to media.url,
276
+ "altText" to media.altText,
277
+ ) else null,
278
+ "read" to it.read,
279
+ "sendDateUtc" to if (it.sendDateUtc != null) dateFormatter.format(it.sendDateUtc) else null,
280
+ "sound" to it.sound,
281
+ "startDateUtc" to if (it.startDateUtc != null) dateFormatter.format(it.startDateUtc) else null,
282
+ "subject" to it.subject,
283
+ "title" to it.title,
284
+ "url" to it.url,
285
+ )
286
+ }
256
287
  }
257
288
  }
@@ -6,23 +6,23 @@ export type LogEventPayload = {
6
6
  stackTrace?: string;
7
7
  };
8
8
  export type Media = {
9
- altText?: string;
10
- url?: string;
9
+ altText: null | string;
10
+ url: null | string;
11
11
  };
12
12
  export type InboxMessage = {
13
- alert?: string;
14
- custom?: string;
15
- customKeys?: Record<string, string>;
16
- deleted: boolean;
17
- endDateUtc?: string;
13
+ alert: null | string;
14
+ custom?: null | Record<string, string>;
15
+ deleted: boolean | number;
16
+ endDateUtc: null | string;
18
17
  id: string;
19
- media?: Media;
20
- read: boolean;
21
- sendDateUtc?: string;
22
- sound?: string;
23
- startDateUtc?: string;
24
- subject?: string;
25
- title?: string;
18
+ media: null | Media;
19
+ read: boolean | number;
20
+ sendDateUtc: null | string;
21
+ sound: null | string;
22
+ startDateUtc: null | string;
23
+ subject: null | string;
24
+ title: null | string;
25
+ subtitle?: null | string;
26
26
  url: string;
27
27
  };
28
28
  export type InboxResponsePayload = {
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoMarketingCloudSdk.types.d.ts","sourceRoot":"","sources":["../src/ExpoMarketingCloudSdk.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ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AG,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAA;IACzB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAA;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,IAAI,GAAG,KAAK,CAAA;IACnB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;IACtB,WAAW,EAAE,IAAI,GAAG,MAAM,CAAA;IAC1B,KAAK,EAAE,IAAI,GAAG,MAAM,CAAA;IACpB,YAAY,EAAE,IAAI,GAAG,MAAM,CAAA;IAC3B,OAAO,EAAE,IAAI,GAAG,MAAM,CAAA;IACtB,KAAK,EAAE,IAAI,GAAG,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,YAAY,EAAE,CAAA;CACzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoMarketingCloudSdk.types.js","sourceRoot":"","sources":["../src/ExpoMarketingCloudSdk.types.ts"],"names":[],"mappings":"","sourcesContent":["export type LogEventPayload = {\n level: string\n subsystem: string\n category: string\n message: string\n stackTrace?: string\n}\n\nexport type Media = {\n altText?: string\n url?: string\n}\n\nexport type InboxMessage = {\n alert?: string\n custom?: string\n customKeys?: Record<string, string>\n deleted: boolean\n endDateUtc?: string\n id: string\n media?: Media\n read: boolean\n sendDateUtc?: string\n sound?: string\n startDateUtc?: string\n subject?: string\n title?: string\n url: string\n}\n\nexport type InboxResponsePayload = {\n messages: InboxMessage[]\n}\n"]}
1
+ {"version":3,"file":"ExpoMarketingCloudSdk.types.js","sourceRoot":"","sources":["../src/ExpoMarketingCloudSdk.types.ts"],"names":[],"mappings":"","sourcesContent":["export type LogEventPayload = {\n level: string\n subsystem: string\n category: string\n message: string\n stackTrace?: string\n}\n\nexport type Media = {\n altText: null | string\n url: null | string\n}\n\nexport type InboxMessage = {\n alert: null | string\n custom?: null | Record<string, string>\n deleted: boolean | number\n endDateUtc: null | string\n id: string\n media: null | Media\n read: boolean | number\n sendDateUtc: null | string\n sound: null | string\n startDateUtc: null | string\n subject: null | string\n title: null | string\n subtitle?: null | string\n url: string\n}\n\nexport type InboxResponsePayload = {\n messages: InboxMessage[]\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@allboatsrise/expo-marketingcloudsdk",
3
3
  "author": "All Boats Rise Inc.",
4
- "version": "48.0.3",
4
+ "version": "48.0.4",
5
5
  "license": "MIT",
6
6
  "description": "Expo module for Salesforce Marketing Cloud SDK",
7
7
  "homepage": "https://github.com/allboatsrise/expo-marketingcloudsdk",