@blueconic/blueconic-react-native 1.1.1 → 1.3.1

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.
@@ -1,65 +1,63 @@
1
- import Foundation
2
- import BlueConicClient
3
-
4
- /**
5
- The BlueConicInteraction class is a custom BlueConic plugin that receives parameters from the BlueConic backend
6
- and passes these on to the (iOS) Native Module
7
- */
8
- public class BlueConicInteraction: BlueConicPlugin {
9
- private var client: BlueConicClient?
10
- private var context: InteractionContext?
11
- private var parameters: Dictionary<String, [String]>?
12
- private var properties: Dictionary<String, Any>?
13
- private var interactionId: String?
14
- private var positionId: String?
15
-
16
- /**
17
- Called by the BlueConic SDK for iOS when a dialogue of this type is configured to be present on the current
18
- screen.
19
- - parameter client: The BlueConicClient
20
- - parameter context: The InteractionContext of the interaction plugin
21
- */
22
- public required convenience init(client: BlueConicClient, context: InteractionContext) {
23
- self.init()
24
- self.client = client
25
- self.context = context
26
- }
27
-
28
- /**
29
- Called when the plugin is registered and active on the server. It retreives the configured parameters
30
- and sends these to the Native Module.
31
- */
32
- public func onLoad() {
33
- guard let context = context,
34
- let interactionId = context.getInteractionId() else {
35
- return
36
- }
37
- self.parameters = context.getParameters()
38
- var properties = [String: Any]()
39
-
40
- properties["id"] = interactionId
41
- properties["name"] = context.getInteractionName() ?? ""
42
- properties["type"] = context.getInteractionTypeId() ?? ""
43
- properties["pluginType"] = context.getPluginType() ?? ""
44
- properties["dialogueId"] = context.getDialogueId() ?? ""
45
- properties["dialogueName"] = context.getDialogueName() ?? ""
46
- properties["positionId"] = context.getPositionIdentifier() ?? ""
47
- properties["positionName"] = context.getPositionName() ?? ""
48
- properties["paramters"] = context.getParameters()
49
-
50
- self.properties = properties
51
-
52
- if (self.properties != nil) {
53
- BlueConicClientModule.publishDialogueEvent(properties, eventName: "onBlueConicPluginLoad")
54
- }
55
- }
56
-
57
- /**
58
- Called when the interaction should close.
59
- */
60
- public func onDestroy() {
61
- if let properties = self.properties {
62
- BlueConicClientModule.publishDialogueEvent(properties, eventName: "onBlueConicPluginDestroyed")
63
- }
64
- }
65
- }
1
+ import Foundation
2
+ import BlueConicClient
3
+
4
+ /**
5
+ The BlueConicInteraction class is a custom BlueConic plugin that receives parameters from the BlueConic backend
6
+ and passes these on to the (iOS) Native Module
7
+ */
8
+ public class BlueConicInteraction: BlueConicPlugin {
9
+ private var client: BlueConicClient?
10
+ private var context: InteractionContext?
11
+ private var properties: Dictionary<String, Any>?
12
+ private var interactionId: String?
13
+ private var positionId: String?
14
+
15
+ /**
16
+ Called by the BlueConic SDK for iOS when a dialogue of this type is configured to be present on the current
17
+ screen.
18
+ - parameter client: The BlueConicClient
19
+ - parameter context: The InteractionContext of the interaction plugin
20
+ */
21
+ public required convenience init(client: BlueConicClient, context: InteractionContext) {
22
+ self.init()
23
+ self.client = client
24
+ self.context = context
25
+ }
26
+
27
+ /**
28
+ Called when the plugin is registered and active on the server. It retreives the configured parameters
29
+ and sends these to the Native Module.
30
+ */
31
+ public func onLoad() {
32
+ guard let context = context,
33
+ let interactionId = context.getInteractionId() else {
34
+ return
35
+ }
36
+ var properties = [String: Any]()
37
+
38
+ properties["id"] = interactionId
39
+ properties["name"] = context.getInteractionName() ?? ""
40
+ properties["type"] = context.getInteractionTypeId() ?? ""
41
+ properties["pluginType"] = context.getPluginType() ?? ""
42
+ properties["dialogueId"] = context.getDialogueId() ?? ""
43
+ properties["dialogueName"] = context.getDialogueName() ?? ""
44
+ properties["positionId"] = context.getPositionIdentifier() ?? ""
45
+ properties["positionName"] = context.getPositionName() ?? ""
46
+ properties["parameters"] = context.getParameters()
47
+
48
+ self.properties = properties
49
+
50
+ if (self.properties != nil) {
51
+ BlueConicClientModule.publishDialogueEvent(properties, eventName: "onBlueConicPluginLoad")
52
+ }
53
+ }
54
+
55
+ /**
56
+ Called when the interaction should close.
57
+ */
58
+ public func onDestroy() {
59
+ if let properties = self.properties {
60
+ BlueConicClientModule.publishDialogueEvent(properties, eventName: "onBlueConicPluginDestroyed")
61
+ }
62
+ }
63
+ }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
- {
2
- "name": "@blueconic/blueconic-react-native",
3
- "version": "1.1.1",
4
- "description": "The BlueConicClient Framework provides the basis for communication with BlueConic.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [
10
- "react-native",
11
- "BlueConic"
12
- ],
13
- "author": "BlueConic (info@blueconic.com)",
14
- "license": "SEE LICENSE IN LICENSE",
15
- "peerDependencies": {
16
- "react-native": "^0.60.4"
17
- }
18
- }
1
+ {
2
+ "name": "@blueconic/blueconic-react-native",
3
+ "version": "1.3.1",
4
+ "description": "The BlueConicClient Framework provides the basis for communication with BlueConic.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [
10
+ "react-native",
11
+ "BlueConic"
12
+ ],
13
+ "author": "BlueConic (info@blueconic.com)",
14
+ "license": "SEE LICENSE IN LICENSE",
15
+ "peerDependencies": {
16
+ "react-native": "<1.0.0"
17
+ }
18
+ }