@adobe/react-native-aepmessaging 6.0.2 → 6.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.
Files changed (48) hide show
  1. package/RCTAEPMessaging.podspec +2 -22
  2. package/README.md +51 -46
  3. package/android/src/main/java/com/adobe/marketing/mobile/reactnative/messaging/RCTAEPMessagingUtil.java +111 -31
  4. package/dist/Messaging.js +1 -1
  5. package/dist/index.d.ts +7 -1
  6. package/dist/index.js +3 -3
  7. package/dist/index.js.map +1 -1
  8. package/dist/models/ContentCard.d.ts +46 -0
  9. package/dist/models/ContentCard.js +14 -0
  10. package/dist/models/ContentCard.js.map +1 -0
  11. package/dist/models/HTMLProposition.d.ts +8 -0
  12. package/dist/models/HTMLProposition.js +14 -0
  13. package/dist/models/HTMLProposition.js.map +1 -0
  14. package/dist/models/InAppMessage.d.ts +15 -0
  15. package/dist/models/InAppMessage.js +14 -0
  16. package/dist/models/InAppMessage.js.map +1 -0
  17. package/dist/models/JSONPropositionItem.d.ts +8 -0
  18. package/dist/models/JSONPropositionItem.js +14 -0
  19. package/dist/models/JSONPropositionItem.js.map +1 -0
  20. package/dist/models/Message.js.map +1 -1
  21. package/dist/models/MessagingEdgeEventType.js +0 -1
  22. package/dist/models/MessagingEdgeEventType.js.map +1 -1
  23. package/dist/models/MessagingProposition.d.ts +5 -5
  24. package/dist/models/MessagingProposition.js +2 -12
  25. package/dist/models/MessagingProposition.js.map +1 -1
  26. package/dist/models/MessagingPropositionItem.d.ts +5 -8
  27. package/dist/models/PersonalizationSchema.d.ts +9 -0
  28. package/dist/models/PersonalizationSchema.js +25 -0
  29. package/dist/models/PersonalizationSchema.js.map +1 -0
  30. package/dist/models/ScopeDetails.d.ts +13 -0
  31. package/dist/models/ScopeDetails.js +14 -0
  32. package/dist/models/ScopeDetails.js.map +1 -0
  33. package/ios/src/RCTAEPMessaging.swift +7 -3
  34. package/ios/src/RCTAEPMessagingDataBridge.swift +3 -20
  35. package/package.json +2 -2
  36. package/src/Messaging.ts +1 -1
  37. package/src/index.ts +14 -1
  38. package/src/models/ContentCard.ts +47 -0
  39. package/src/models/HTMLProposition.ts +21 -0
  40. package/src/models/InAppMessage.ts +28 -0
  41. package/src/models/JSONPropositionItem.ts +21 -0
  42. package/src/models/Message.ts +1 -1
  43. package/src/models/MessagingDelegate.ts +1 -1
  44. package/src/models/MessagingEdgeEventType.ts +8 -8
  45. package/src/models/MessagingProposition.ts +8 -19
  46. package/src/models/MessagingPropositionItem.ts +10 -8
  47. package/src/models/PersonalizationSchema.ts +21 -0
  48. package/src/models/ScopeDetails.ts +27 -0
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /*
3
+ Copyright 2024 Adobe. All rights reserved.
4
+ This file is licensed to you under the Apache License, Version 2.0 (the
5
+ "License"); you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
8
+ or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
10
+ ANY KIND, either express or implied. See the License for the specific
11
+ language governing permissions and limitations under the License.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ //# sourceMappingURL=JSONPropositionItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JSONPropositionItem.js","sourceRoot":"","sources":["../../src/models/JSONPropositionItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,+CAA6C;AAC7C,MAAM,eAAe,GAAG,4BAAa,CAAC,YAAY,CAAC;AAEnD,MAAM,OAAO;IAIX,YAAY,EAAC,EAAE,EAAE,SAAS,GAAG,KAAK,EAAmC;QACnE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAkB;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,iBAA2B;QACjC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAmB,EAAE,SAAiB;QAC1C,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;CACF;AAED,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Message.js","sourceRoot":"","sources":["../../src/models/Message.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,+CAA6C;AAC7C,MAAM,eAAe,GAAG,4BAAa,CAAC,YAAY,CAAC;AAEnD,MAAM,OAAO;IAIX,YAAY,EAAE,EAAE,EAAE,SAAS,GAAG,KAAK,EAAsC;QACvE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAkB;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,iBAA2B;QACjC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAmB,EAAE,SAAiB;QAC1C,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;CACF;AAED,kBAAe,OAAO,CAAC"}
@@ -20,6 +20,5 @@ var MessagingEdgeEventType;
20
20
  MessagingEdgeEventType[MessagingEdgeEventType["PUSH_APPLICATION_OPENED"] = 4] = "PUSH_APPLICATION_OPENED";
21
21
  MessagingEdgeEventType[MessagingEdgeEventType["PUSH_CUSTOM_ACTION"] = 5] = "PUSH_CUSTOM_ACTION";
22
22
  })(MessagingEdgeEventType || (MessagingEdgeEventType = {}));
23
- ;
24
23
  exports.default = MessagingEdgeEventType;
25
24
  //# sourceMappingURL=MessagingEdgeEventType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessagingEdgeEventType.js","sourceRoot":"","sources":["../../src/models/MessagingEdgeEventType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,IAAK,sBAOJ;AAPD,WAAK,sBAAsB;IACvB,yEAAW,CAAA;IACX,2EAAY,CAAA;IACZ,yEAAW,CAAA;IACX,yEAAW,CAAA;IACX,yGAA2B,CAAA;IAC3B,+FAAsB,CAAA;AAC1B,CAAC,EAPI,sBAAsB,KAAtB,sBAAsB,QAO1B;AAAA,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"MessagingEdgeEventType.js","sourceRoot":"","sources":["../../src/models/MessagingEdgeEventType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;AAEF,IAAK,sBAOJ;AAPD,WAAK,sBAAsB;IACzB,yEAAW,CAAA;IACX,2EAAY,CAAA;IACZ,yEAAW,CAAA;IACX,yEAAW,CAAA;IACX,yGAA2B,CAAA;IAC3B,+FAAsB,CAAA;AACxB,CAAC,EAPI,sBAAsB,KAAtB,sBAAsB,QAO1B;AAED,kBAAe,sBAAsB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { MessagingPropositionItem } from './MessagingPropositionItem';
2
- export declare class MessagingProposition {
3
- items: MessagingPropositionItem[];
4
- uniqueId: string;
2
+ import { ScopeDetails } from './ScopeDetails';
3
+ export interface MessagingProposition {
4
+ id: string;
5
5
  scope: string;
6
- scopeDetails: Record<string, any>;
7
- constructor(uniqueId: string, scope: string, scopeDetails: Record<string, any>, items: MessagingPropositionItem[]);
6
+ scopeDetails: ScopeDetails;
7
+ items: MessagingPropositionItem[];
8
8
  }
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessagingProposition = void 0;
4
2
  /*
5
- Copyright 2023 Adobe. All rights reserved.
3
+ Copyright 2024 Adobe. All rights reserved.
6
4
  This file is licensed to you under the Apache License, Version 2.0 (the
7
5
  "License"); you may not use this file except in compliance with the License.
8
6
  You may obtain a copy of the License at
@@ -12,13 +10,5 @@ exports.MessagingProposition = void 0;
12
10
  ANY KIND, either express or implied. See the License for the specific
13
11
  language governing permissions and limitations under the License.
14
12
  */
15
- class MessagingProposition {
16
- constructor(uniqueId, scope, scopeDetails, items) {
17
- this.uniqueId = uniqueId;
18
- this.scope = scope;
19
- this.scopeDetails = scopeDetails;
20
- this.items = items;
21
- }
22
- }
23
- exports.MessagingProposition = MessagingProposition;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
24
14
  //# sourceMappingURL=MessagingProposition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MessagingProposition.js","sourceRoot":"","sources":["../../src/models/MessagingProposition.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;EAUE;AAEF,MAAa,oBAAoB;IAM/B,YACE,QAAgB,EAChB,KAAa,EACb,YAAiC,EACjC,KAAiC;QAEjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAjBD,oDAiBC"}
1
+ {"version":3,"file":"MessagingProposition.js","sourceRoot":"","sources":["../../src/models/MessagingProposition.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"}
@@ -1,8 +1,5 @@
1
- export interface MessagingPropositionItem {
2
- htmlContent?: string;
3
- jsonArrayContent?: string;
4
- jsonContent?: string;
5
- itemData?: Record<string, any>;
6
- schema: string;
7
- uniqueId: string;
8
- }
1
+ import { ContentCard } from './ContentCard';
2
+ import { HTMLProposition } from './HTMLProposition';
3
+ import { JSONPropositionItem } from './JSONPropositionItem';
4
+ import { InAppMessage } from './InAppMessage';
5
+ export type MessagingPropositionItem = ContentCard | HTMLProposition | InAppMessage | JSONPropositionItem;
@@ -0,0 +1,9 @@
1
+ export declare enum PersonalizationSchema {
2
+ CONTENT_CARD = "https://ns.adobe.com/personalization/message/content-card",
3
+ DEFAULT_CONTENT = "https://ns.adobe.com/personalization/default-content-item",
4
+ HTML_CONTENT = "https://ns.adobe.com/personalization/html-content-item",
5
+ IN_APP = "https://ns.adobe.com/personalization/message/in-app",
6
+ JSON_CONTENT = "https://ns.adobe.com/personalization/json-content-item",
7
+ NATIVE_ALERT = "https://ns.adobe.com/personalization/message/native-alert",
8
+ RULESET_ITEM = "https://ns.adobe.com/personalization/ruleset-item"
9
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /*
3
+ Copyright 2024 Adobe. All rights reserved.
4
+ This file is licensed to you under the Apache License, Version 2.0 (the
5
+ "License"); you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
8
+ or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
10
+ ANY KIND, either express or implied. See the License for the specific
11
+ language governing permissions and limitations under the License.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.PersonalizationSchema = void 0;
15
+ var PersonalizationSchema;
16
+ (function (PersonalizationSchema) {
17
+ PersonalizationSchema["CONTENT_CARD"] = "https://ns.adobe.com/personalization/message/content-card";
18
+ PersonalizationSchema["DEFAULT_CONTENT"] = "https://ns.adobe.com/personalization/default-content-item";
19
+ PersonalizationSchema["HTML_CONTENT"] = "https://ns.adobe.com/personalization/html-content-item";
20
+ PersonalizationSchema["IN_APP"] = "https://ns.adobe.com/personalization/message/in-app";
21
+ PersonalizationSchema["JSON_CONTENT"] = "https://ns.adobe.com/personalization/json-content-item";
22
+ PersonalizationSchema["NATIVE_ALERT"] = "https://ns.adobe.com/personalization/message/native-alert";
23
+ PersonalizationSchema["RULESET_ITEM"] = "https://ns.adobe.com/personalization/ruleset-item";
24
+ })(PersonalizationSchema = exports.PersonalizationSchema || (exports.PersonalizationSchema = {}));
25
+ //# sourceMappingURL=PersonalizationSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersonalizationSchema.js","sourceRoot":"","sources":["../../src/models/PersonalizationSchema.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE;;;AAEF,IAAY,qBAQX;AARD,WAAY,qBAAqB;IAC/B,mGAA0E,CAAA;IAC1E,sGAA6E,CAAA;IAC7E,gGAAuE,CAAA;IACvE,uFAA8D,CAAA;IAC9D,gGAAuE,CAAA;IACvE,mGAA0E,CAAA;IAC1E,2FAAkE,CAAA;AACpE,CAAC,EARW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAQhC"}
@@ -0,0 +1,13 @@
1
+ export interface Activity {
2
+ matchedSurfaces: string[];
3
+ id: string;
4
+ }
5
+ export interface Characteristics {
6
+ eventToken: string;
7
+ }
8
+ export interface ScopeDetails {
9
+ activity: Activity;
10
+ characteristics: Characteristics;
11
+ correlationID: string;
12
+ decisionProvider: string;
13
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /*
3
+ Copyright 2024 Adobe. All rights reserved.
4
+ This file is licensed to you under the Apache License, Version 2.0 (the
5
+ "License"); you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
8
+ or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
10
+ ANY KIND, either express or implied. See the License for the specific
11
+ language governing permissions and limitations under the License.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ //# sourceMappingURL=ScopeDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopeDetails.js","sourceRoot":"","sources":["../../src/models/ScopeDetails.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;EAUE"}
@@ -71,13 +71,17 @@ public class RCTAEPMessaging: RCTEventEmitter, MessagingDelegate {
71
71
  withResolver resolve: @escaping RCTPromiseResolveBlock,
72
72
  withRejecter reject: @escaping RCTPromiseRejectBlock
73
73
  ) {
74
- let surfacePaths = surfaces.map { Surface(path: $0) }
75
- Messaging.getPropositionsForSurfaces(surfacePaths) { propositionsDict, error in
74
+ let surfacePaths = surfaces.map { $0.isEmpty ? Surface() : Surface(path: $0) }
75
+ Messaging.getPropositionsForSurfaces(surfacePaths) { propositions, error in
76
76
  guard error == nil else {
77
77
  reject("Unable to Retrieve Propositions", nil, nil)
78
78
  return
79
79
  }
80
- resolve(RCTAEPMessagingDataBridge.transformPropositionDict(dict: propositionsDict!))
80
+ if (propositions != nil && propositions!.isEmpty) {
81
+ resolve([String: Any]());
82
+ return;
83
+ }
84
+ resolve(RCTAEPMessagingDataBridge.transformPropositionDict(dict: propositions!))
81
85
  }
82
86
  }
83
87
 
@@ -15,33 +15,16 @@ import AEPMessaging
15
15
  public class RCTAEPMessagingDataBridge: NSObject {
16
16
  static func transformToMessage(message: Message) -> [String: Any] {
17
17
  return [
18
- "id": message.id, "autoTrack": message.autoTrack,
18
+ "id": message.id, "autoTrack": message.autoTrack
19
19
  ]
20
20
  }
21
21
 
22
- static func transformPropositionDict(dict: [Surface: [Proposition]]) -> [String: [Any]]
22
+ static func transformPropositionDict(dict: [Surface: [Proposition]]) -> [String: [Any?]]
23
23
  {
24
24
  let bundleID = "mobileapp://" + Bundle.main.bundleIdentifier! + "/"
25
25
  return dict.reduce(into: [:]) { result, element in
26
26
  result[element.key.uri.replacingOccurrences(of: bundleID, with: "")] = element.value
27
- .map({ self.transformToProposition(proposition: $0) })
27
+ .map({ $0.asDictionary() })
28
28
  }
29
29
  }
30
-
31
- static func transformToProposition(proposition: Proposition) -> [String: Any?] {
32
- return [
33
- "scope": proposition.scope,
34
- "uniqueId": proposition.uniqueId,
35
- "items": proposition.items.map({ item in
36
- [
37
- "htmlContent": item.htmlContent,
38
- "jsonContentArray": item.jsonContentArray,
39
- "jsonContent": item.jsonContentDictionary,
40
- "itemData": item.itemData as Any?,
41
- "schema": item.schema,
42
- "itemId": item.itemId
43
- ]
44
- }),
45
- ]
46
- }
47
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/react-native-aepmessaging",
3
- "version": "6.0.2",
3
+ "version": "6.0.4",
4
4
  "description": "Adobe Experience Platform support for React Native apps.",
5
5
  "homepage": "https://developer.adobe.com/client-sdks/documentation/",
6
6
  "license": "Apache-2.0",
@@ -39,5 +39,5 @@
39
39
  "installConfig": {
40
40
  "hoistingLimits": "dependencies"
41
41
  },
42
- "gitHead": "dded69cc74199e7350a886731cbfeb61bae5d257"
42
+ "gitHead": "129d28814e8a2f46e59554ce976bd06d5b25aaea"
43
43
  }
package/src/Messaging.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2023 Adobe. All rights reserved.
2
+ Copyright 2024 Adobe. All rights reserved.
3
3
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License. You may obtain a copy
5
5
  of the License at http://www.apache.org/licenses/LICENSE-2.0
package/src/index.ts CHANGED
@@ -11,17 +11,30 @@ governing permissions and limitations under the License.
11
11
  */
12
12
 
13
13
  import Messaging from './Messaging';
14
+ import { ContentCard } from './models/ContentCard';
15
+ import { HTMLProposition } from './models/HTMLProposition';
16
+ import { InAppMessage } from './models/InAppMessage';
17
+ import { JSONPropositionItem } from './models/JSONPropositionItem';
14
18
  import Message from './models/Message';
15
19
  import { MessagingDelegate } from './models/MessagingDelegate';
16
20
  import MessagingEdgeEventType from './models/MessagingEdgeEventType';
17
21
  import { MessagingProposition } from './models/MessagingProposition';
18
22
  import { MessagingPropositionItem } from './models/MessagingPropositionItem';
23
+ import { PersonalizationSchema } from './models/PersonalizationSchema';
24
+ import { Activity, Characteristics } from './models/ScopeDetails';
19
25
 
20
26
  export {
27
+ Activity,
28
+ Characteristics,
29
+ ContentCard,
30
+ HTMLProposition,
31
+ InAppMessage,
32
+ JSONPropositionItem,
21
33
  Messaging,
22
34
  Message,
23
35
  MessagingDelegate,
24
36
  MessagingEdgeEventType,
25
37
  MessagingProposition,
26
- MessagingPropositionItem
38
+ MessagingPropositionItem,
39
+ PersonalizationSchema,
27
40
  };
@@ -0,0 +1,47 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the
4
+ "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
7
+ or agreed to in writing, software distributed under the License is
8
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
9
+ ANY KIND, either express or implied. See the License for the specific
10
+ language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { PersonalizationSchema } from './PersonalizationSchema';
14
+
15
+ type ContentCardTemplate = 'SmallImage';
16
+ type DismissButtonStyle = 'circle' | 'none' | 'simple';
17
+
18
+ export interface ContentCard {
19
+ id: string;
20
+ data: {
21
+ contentType: 'application/json';
22
+ expiryDate: number;
23
+ publishedDate: number;
24
+ content: {
25
+ actionUrl: string;
26
+
27
+ body: { content: string };
28
+ title: { content: string };
29
+ buttons: Array<{
30
+ actionUrl: string;
31
+ id: string;
32
+ text: { content: string };
33
+ interactId: string;
34
+ }>;
35
+ image: { alt: string; url: string };
36
+ dismissBtn: { style: DismissButtonStyle };
37
+ };
38
+ meta: {
39
+ [key: string]: any;
40
+ adobe: { template: ContentCardTemplate };
41
+ dismissState: boolean;
42
+ readState: boolean;
43
+ surface: string;
44
+ };
45
+ };
46
+ schema: PersonalizationSchema.CONTENT_CARD;
47
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the
4
+ "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
7
+ or agreed to in writing, software distributed under the License is
8
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
9
+ ANY KIND, either express or implied. See the License for the specific
10
+ language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { PersonalizationSchema } from './PersonalizationSchema';
14
+
15
+ export interface HTMLProposition {
16
+ id: string;
17
+ data: {
18
+ content: string;
19
+ };
20
+ schema: PersonalizationSchema.HTML_CONTENT;
21
+ }
@@ -0,0 +1,28 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the
4
+ "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
7
+ or agreed to in writing, software distributed under the License is
8
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
9
+ ANY KIND, either express or implied. See the License for the specific
10
+ language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { PersonalizationSchema } from './PersonalizationSchema';
14
+
15
+ export interface InAppMessage {
16
+ id: string;
17
+ schema: PersonalizationSchema.IN_APP;
18
+ data: {
19
+ content: string;
20
+ contentType: 'text/html';
21
+ expiryDate: number;
22
+ publishedDate: number;
23
+ meta?: Record<string, any>;
24
+ mobileParameters?: Record<string, any>;
25
+ webParameters?: Record<string, any>;
26
+ remoteAssets?: string[];
27
+ };
28
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the
4
+ "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
7
+ or agreed to in writing, software distributed under the License is
8
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
9
+ ANY KIND, either express or implied. See the License for the specific
10
+ language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { PersonalizationSchema } from './PersonalizationSchema';
14
+
15
+ export interface JSONPropositionItem {
16
+ id: string;
17
+ data: {
18
+ content: string;
19
+ };
20
+ schema: PersonalizationSchema.JSON_CONTENT;
21
+ }
@@ -17,7 +17,7 @@ class Message {
17
17
  id: string;
18
18
  autoTrack: boolean;
19
19
 
20
- constructor({id, autoTrack = false}: {id: string; autoTrack: boolean}) {
20
+ constructor({ id, autoTrack = false }: { id: string; autoTrack: boolean }) {
21
21
  this.id = id;
22
22
  this.autoTrack = autoTrack;
23
23
  }
@@ -49,5 +49,5 @@ export interface MessagingDelegate {
49
49
  * Android Only - Called when message loads
50
50
  * @param {Message} message: the Message loaded
51
51
  */
52
- onContentLoaded?( message: Message): void;
52
+ onContentLoaded?(message: Message): void;
53
53
  }
@@ -11,12 +11,12 @@ governing permissions and limitations under the License.
11
11
  */
12
12
 
13
13
  enum MessagingEdgeEventType {
14
- DISMISS = 0,
15
- INTERACT = 1,
16
- TRIGGER = 2,
17
- DISPLAY = 3,
18
- PUSH_APPLICATION_OPENED = 4,
19
- PUSH_CUSTOM_ACTION = 5
20
- };
14
+ DISMISS = 0,
15
+ INTERACT = 1,
16
+ TRIGGER = 2,
17
+ DISPLAY = 3,
18
+ PUSH_APPLICATION_OPENED = 4,
19
+ PUSH_CUSTOM_ACTION = 5
20
+ }
21
21
 
22
- export default MessagingEdgeEventType;
22
+ export default MessagingEdgeEventType;
@@ -1,7 +1,5 @@
1
- import { MessagingPropositionItem } from './MessagingPropositionItem';
2
-
3
1
  /*
4
- Copyright 2023 Adobe. All rights reserved.
2
+ Copyright 2024 Adobe. All rights reserved.
5
3
  This file is licensed to you under the Apache License, Version 2.0 (the
6
4
  "License"); you may not use this file except in compliance with the License.
7
5
  You may obtain a copy of the License at
@@ -12,21 +10,12 @@ import { MessagingPropositionItem } from './MessagingPropositionItem';
12
10
  language governing permissions and limitations under the License.
13
11
  */
14
12
 
15
- export class MessagingProposition {
16
- public items: MessagingPropositionItem[];
17
- public uniqueId: string;
18
- public scope: string;
19
- public scopeDetails: Record<string, any>;
13
+ import { MessagingPropositionItem } from './MessagingPropositionItem';
14
+ import { ScopeDetails } from './ScopeDetails';
20
15
 
21
- constructor(
22
- uniqueId: string,
23
- scope: string,
24
- scopeDetails: Record<string, any>,
25
- items: MessagingPropositionItem[]
26
- ) {
27
- this.uniqueId = uniqueId;
28
- this.scope = scope;
29
- this.scopeDetails = scopeDetails;
30
- this.items = items;
31
- }
16
+ export interface MessagingProposition {
17
+ id: string;
18
+ scope: string;
19
+ scopeDetails: ScopeDetails;
20
+ items: MessagingPropositionItem[];
32
21
  }
@@ -10,11 +10,13 @@
10
10
  language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- export interface MessagingPropositionItem {
14
- htmlContent?: string;
15
- jsonArrayContent?: string;
16
- jsonContent?: string;
17
- itemData?: Record<string, any>;
18
- schema: string;
19
- uniqueId: string;
20
- }
13
+ import { ContentCard } from './ContentCard';
14
+ import { HTMLProposition } from './HTMLProposition';
15
+ import { JSONPropositionItem } from './JSONPropositionItem';
16
+ import { InAppMessage } from './InAppMessage';
17
+
18
+ export type MessagingPropositionItem =
19
+ | ContentCard
20
+ | HTMLProposition
21
+ | InAppMessage
22
+ | JSONPropositionItem;
@@ -0,0 +1,21 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the
4
+ "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
7
+ or agreed to in writing, software distributed under the License is
8
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
9
+ ANY KIND, either express or implied. See the License for the specific
10
+ language governing permissions and limitations under the License.
11
+ */
12
+
13
+ export enum PersonalizationSchema {
14
+ CONTENT_CARD = 'https://ns.adobe.com/personalization/message/content-card',
15
+ DEFAULT_CONTENT = 'https://ns.adobe.com/personalization/default-content-item',
16
+ HTML_CONTENT = 'https://ns.adobe.com/personalization/html-content-item',
17
+ IN_APP = 'https://ns.adobe.com/personalization/message/in-app',
18
+ JSON_CONTENT = 'https://ns.adobe.com/personalization/json-content-item',
19
+ NATIVE_ALERT = 'https://ns.adobe.com/personalization/message/native-alert',
20
+ RULESET_ITEM = 'https://ns.adobe.com/personalization/ruleset-item'
21
+ }
@@ -0,0 +1,27 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the
4
+ "License"); you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
7
+ or agreed to in writing, software distributed under the License is
8
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
9
+ ANY KIND, either express or implied. See the License for the specific
10
+ language governing permissions and limitations under the License.
11
+ */
12
+
13
+ export interface Activity {
14
+ matchedSurfaces: string[];
15
+ id: string;
16
+ }
17
+
18
+ export interface Characteristics {
19
+ eventToken: string;
20
+ }
21
+
22
+ export interface ScopeDetails {
23
+ activity: Activity;
24
+ characteristics: Characteristics;
25
+ correlationID: string;
26
+ decisionProvider: string;
27
+ }