indigitall-capacitor-plugin 0.0.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.
- package/IndigitallCapacitorPlugin.podspec +18 -0
- package/README.md +171 -0
- package/android/build.gradle +60 -0
- package/android/src/main/AndroidManifest.xml +47 -0
- package/android/src/main/java/com/indigitall/capacitor/IndigitallCpPlugin.java +263 -0
- package/android/src/main/java/com/indigitall/capacitor/IndigitallCustomerPlugin.java +143 -0
- package/android/src/main/java/com/indigitall/capacitor/IndigitallInAppPlugin.java +159 -0
- package/android/src/main/java/com/indigitall/capacitor/IndigitallInboxPlugin.java +150 -0
- package/android/src/main/java/com/indigitall/capacitor/implementations/CustomerCp.java +91 -0
- package/android/src/main/java/com/indigitall/capacitor/implementations/InAppCp.java +74 -0
- package/android/src/main/java/com/indigitall/capacitor/implementations/InboxCp.java +118 -0
- package/android/src/main/java/com/indigitall/capacitor/implementations/IndigitallCp.java +130 -0
- package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallParse.java +480 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +155 -0
- package/dist/esm/Customer.d.ts +4 -0
- package/dist/esm/Customer.js +61 -0
- package/dist/esm/Customer.js.map +1 -0
- package/dist/esm/InApp.d.ts +3 -0
- package/dist/esm/InApp.js +187 -0
- package/dist/esm/InApp.js.map +1 -0
- package/dist/esm/Inbox.d.ts +4 -0
- package/dist/esm/Inbox.js +61 -0
- package/dist/esm/Inbox.js.map +1 -0
- package/dist/esm/Push.d.ts +3 -0
- package/dist/esm/Push.js +110 -0
- package/dist/esm/Push.js.map +1 -0
- package/dist/esm/callbacks/callbacksType.d.ts +20 -0
- package/dist/esm/callbacks/callbacksType.js +2 -0
- package/dist/esm/callbacks/callbacksType.js.map +1 -0
- package/dist/esm/definitions/customerDefinitions.d.ts +34 -0
- package/dist/esm/definitions/customerDefinitions.js +2 -0
- package/dist/esm/definitions/customerDefinitions.js.map +1 -0
- package/dist/esm/definitions/inAppDefinitions.d.ts +35 -0
- package/dist/esm/definitions/inAppDefinitions.js +2 -0
- package/dist/esm/definitions/inAppDefinitions.js.map +1 -0
- package/dist/esm/definitions/inboxDefinitions.d.ts +30 -0
- package/dist/esm/definitions/inboxDefinitions.js +2 -0
- package/dist/esm/definitions/inboxDefinitions.js.map +1 -0
- package/dist/esm/definitions/pushDefinitions.d.ts +38 -0
- package/dist/esm/definitions/pushDefinitions.js +2 -0
- package/dist/esm/definitions/pushDefinitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/models/InCustomer.d.ts +16 -0
- package/dist/esm/models/InCustomer.js +8 -0
- package/dist/esm/models/InCustomer.js.map +1 -0
- package/dist/esm/models/InDevice.d.ts +31 -0
- package/dist/esm/models/InDevice.js +2 -0
- package/dist/esm/models/InDevice.js.map +1 -0
- package/dist/esm/models/InInApp.d.ts +31 -0
- package/dist/esm/models/InInApp.js +2 -0
- package/dist/esm/models/InInApp.js.map +1 -0
- package/dist/esm/models/InInbox.d.ts +31 -0
- package/dist/esm/models/InInbox.js +8 -0
- package/dist/esm/models/InInbox.js.map +1 -0
- package/dist/esm/models/InPush.d.ts +22 -0
- package/dist/esm/models/InPush.js +2 -0
- package/dist/esm/models/InPush.js.map +1 -0
- package/dist/esm/params/customerParams.d.ts +11 -0
- package/dist/esm/params/customerParams.js +3 -0
- package/dist/esm/params/customerParams.js.map +1 -0
- package/dist/esm/params/inAppParams.d.ts +17 -0
- package/dist/esm/params/inAppParams.js +3 -0
- package/dist/esm/params/inAppParams.js.map +1 -0
- package/dist/esm/params/inboxParams.d.ts +15 -0
- package/dist/esm/params/inboxParams.js +3 -0
- package/dist/esm/params/inboxParams.js.map +1 -0
- package/dist/esm/params/pushParams.d.ts +22 -0
- package/dist/esm/params/pushParams.js +2 -0
- package/dist/esm/params/pushParams.js.map +1 -0
- package/dist/plugin.cjs.js +434 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +437 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/IndigitallCpPlugin.swift +152 -0
- package/ios/Plugin/IndigitallCustomerPlugin.swift +76 -0
- package/ios/Plugin/IndigitallInAppPlugin.swift +54 -0
- package/ios/Plugin/IndigitallInboxPlugin.swift +81 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/handlers/IndigitallNotificationHandler.swift +38 -0
- package/ios/Plugin/implementations/CustomerCp.swift +56 -0
- package/ios/Plugin/implementations/InAppCp.swift +88 -0
- package/ios/Plugin/implementations/InboxCp.swift +78 -0
- package/ios/Plugin/implementations/IndigitallCp.swift +122 -0
- package/ios/Plugin/interfaces/IndigitallCpPlugin.h +10 -0
- package/ios/Plugin/interfaces/IndigitallCpPlugin.m +19 -0
- package/ios/Plugin/interfaces/IndigitallCustomerPlugin.h +10 -0
- package/ios/Plugin/interfaces/IndigitallCustomerPlugin.m +16 -0
- package/ios/Plugin/interfaces/IndigitallInAppPlugin.h +10 -0
- package/ios/Plugin/interfaces/IndigitallInAppPlugin.m +13 -0
- package/ios/Plugin/interfaces/IndigitallInboxPlugin.h +10 -0
- package/ios/Plugin/interfaces/IndigitallInboxPlugin.m +13 -0
- package/ios/Plugin/utils/IndigitallParse.h +27 -0
- package/ios/Plugin/utils/IndigitallParse.m +351 -0
- package/package.json +79 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
#import <Foundation/Foundation.h>
|
|
3
|
+
#import <Capacitor/Capacitor.h>
|
|
4
|
+
|
|
5
|
+
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
6
|
+
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
7
|
+
CAP_PLUGIN(IndigitallCustomerPlugin, "CustomerCp",
|
|
8
|
+
CAP_PLUGIN_METHOD(getCustomer, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(getCustomerInformation, CAPPluginReturnPromise);
|
|
10
|
+
CAP_PLUGIN_METHOD(assignOrUpdateValueToCustomerFields, CAPPluginReturnPromise);
|
|
11
|
+
CAP_PLUGIN_METHOD(deleteValuesFromCustomerFields, CAPPluginReturnPromise);
|
|
12
|
+
CAP_PLUGIN_METHOD(link, CAPPluginReturnPromise);
|
|
13
|
+
CAP_PLUGIN_METHOD(unlink, CAPPluginReturnPromise);
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
//! Project version number for Plugin.
|
|
4
|
+
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
+
|
|
6
|
+
//! Project version string for Plugin.
|
|
7
|
+
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
+
|
|
9
|
+
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <Capacitor/Capacitor.h>
|
|
3
|
+
|
|
4
|
+
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
|
+
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
+
CAP_PLUGIN(IndigitallInAppPlugin, "InAppCp",
|
|
7
|
+
CAP_PLUGIN_METHOD(inAppGet, CAPPluginReturnPromise);
|
|
8
|
+
CAP_PLUGIN_METHOD(inAppWasShown, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(addNewInAppClick, CAPPluginReturnPromise);
|
|
10
|
+
CAP_PLUGIN_METHOD(addNewInAppToDismissForever, CAPPluginReturnPromise);
|
|
11
|
+
CAP_PLUGIN_METHOD(showPopUp, CAPPluginReturnPromise);
|
|
12
|
+
|
|
13
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
//! Project version number for Plugin.
|
|
4
|
+
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
+
|
|
6
|
+
//! Project version string for Plugin.
|
|
7
|
+
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
+
|
|
9
|
+
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <Capacitor/Capacitor.h>
|
|
3
|
+
|
|
4
|
+
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
|
+
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
+
CAP_PLUGIN(IndigitallInboxPlugin, "InboxCp",
|
|
7
|
+
CAP_PLUGIN_METHOD(getMessageCount, CAPPluginReturnPromise);
|
|
8
|
+
CAP_PLUGIN_METHOD(getInbox, CAPPluginReturnPromise);
|
|
9
|
+
CAP_PLUGIN_METHOD(getNextPage, CAPPluginReturnPromise);
|
|
10
|
+
CAP_PLUGIN_METHOD(massiveEditNotificationsWithSendingIdsList, CAPPluginReturnPromise);
|
|
11
|
+
CAP_PLUGIN_METHOD(getInfoFromNotificationWithSendingId, CAPPluginReturnPromise);
|
|
12
|
+
CAP_PLUGIN_METHOD(modifyStatusFromNotificationWithSendingId, CAPPluginReturnPromise);
|
|
13
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// IndigitallParse.h
|
|
3
|
+
// Plugin
|
|
4
|
+
//
|
|
5
|
+
// Created by indigitall on 10/2/22.
|
|
6
|
+
// Copyright © 2022 Max Lynch. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <Indigitall/Indigitall.h>
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface IndigitallParse : NSObject
|
|
15
|
+
|
|
16
|
+
+ (NSDictionary *)jsonFromDevice: (INDevice *)device;
|
|
17
|
+
+ (NSArray<NSDictionary *>*) jsonArrayFromtopics: (NSArray<INTopic *>*) topics;
|
|
18
|
+
+ (NSDictionary *)jsonFromInApp: (INInApp *)inApp;
|
|
19
|
+
+ (INInApp *)inAppFromJson: (NSDictionary *)json;
|
|
20
|
+
+ (NSDictionary *) jsonFromCustomer: (INCustomer *) customer;
|
|
21
|
+
+ (NSArray<NSDictionary *> *) jsonFromCustomerFields: (NSArray<INCustomerField *>*)customerFields;
|
|
22
|
+
+ (NSDictionary *) jsonFromMessagesCounter: (INInboxCounters *) inboxCounter;
|
|
23
|
+
+ (NSDictionary *) jsonFromInbox: (Inbox *) inbox newNotifications:(nullable NSArray<INInboxNotification *> *)newNotifications;
|
|
24
|
+
+ (NSArray<NSDictionary *>*) jsonArrayFromInboxNotification: (nullable NSArray<INInboxNotification *>*) inboxNotifications;
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
//
|
|
2
|
+
// IndigitallParse.m
|
|
3
|
+
// Plugin
|
|
4
|
+
//
|
|
5
|
+
// Created by indigitall on 10/2/22.
|
|
6
|
+
// Copyright © 2022 Max Lynch. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "IndigitallParse.h"
|
|
10
|
+
|
|
11
|
+
@implementation IndigitallParse
|
|
12
|
+
|
|
13
|
+
+ (NSDictionary *)jsonFromDevice: (INDevice *)device{
|
|
14
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
15
|
+
if (device != nil) {
|
|
16
|
+
|
|
17
|
+
obj = [@{
|
|
18
|
+
@"enable" : device.enabled,
|
|
19
|
+
@"deviceId": device.deviceID ?: @"",
|
|
20
|
+
@"pushToken" : device.pushToken ?: @"",
|
|
21
|
+
@"platform": device.platform ?: @"",
|
|
22
|
+
@"version": device.sdkVersion ?: @"",
|
|
23
|
+
@"productName" : device.productName ?: @"",
|
|
24
|
+
@"productVersion" : device.productVersion ?: @"",
|
|
25
|
+
@"osName": device.osName ?: @"",
|
|
26
|
+
@"osVersion": device.osVersion ?: @"",
|
|
27
|
+
@"deviceBrand": device.deviceBrand ?: @"",
|
|
28
|
+
@"deviceModel": device.deviceModel ?: @"",
|
|
29
|
+
@"operator": device.carrier ?: @"",
|
|
30
|
+
@"deviceType": device.deviceType ?: @"",
|
|
31
|
+
@"appVersion": device.appVersion ?: @"",
|
|
32
|
+
@"locale": device.locale ?: @"",
|
|
33
|
+
@"timeZone": device.timeZone ?: @"",
|
|
34
|
+
@"timeOffset": @(device.timeOffset) ?: 0L,
|
|
35
|
+
@"externalApps": [self jsonArrayFromExternalApps: device.externalApplications]
|
|
36
|
+
} mutableCopy];
|
|
37
|
+
}
|
|
38
|
+
return [obj mutableCopy];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
+ (NSArray<NSDictionary *>*) jsonArrayFromExternalApps: (NSArray<INExternalApp *>*)externalApps{
|
|
42
|
+
NSArray<NSDictionary *>* array = [NSArray new];
|
|
43
|
+
@try{
|
|
44
|
+
if (externalApps != nil){
|
|
45
|
+
for (int i=0;i<externalApps.count;i++){
|
|
46
|
+
NSDictionary *obj = [[NSDictionary alloc]init];
|
|
47
|
+
obj = @{
|
|
48
|
+
@"id" : @(externalApps[i].iNExternalAppId) ?: 0,
|
|
49
|
+
@"name": externalApps[i].name ?: @"",
|
|
50
|
+
@"code" : externalApps[i].iosCode ?: @"",
|
|
51
|
+
};
|
|
52
|
+
array = [array arrayByAddingObject:obj];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} @catch (NSException *exception) {
|
|
56
|
+
NSLog(@"Error jsonArrayFromExternalApps ");
|
|
57
|
+
}
|
|
58
|
+
return array;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
+ (NSArray<NSDictionary *>*) jsonArrayFromtopics: (NSArray<INTopic *>*) topics{
|
|
62
|
+
NSArray<NSDictionary *>* array = [NSArray new];
|
|
63
|
+
@try{
|
|
64
|
+
for (int i=0;i<topics.count;i++){
|
|
65
|
+
NSDictionary *obj = [[NSDictionary alloc]init];
|
|
66
|
+
obj = @{
|
|
67
|
+
@"code" : topics[i].code ?: @"",
|
|
68
|
+
@"name": topics[i].name ?: @"",
|
|
69
|
+
@"parentCode" : topics[i].parentCode ?: @"",
|
|
70
|
+
@"visible" :@(topics[i].visible) ?: false,
|
|
71
|
+
@"subscribed" :@(topics[i].subscribed) ?: false
|
|
72
|
+
};
|
|
73
|
+
array = [array arrayByAddingObject:obj];
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
} @catch (NSException *exception) {
|
|
77
|
+
NSLog(@"Error jsonArrayFromtopics %@", exception);
|
|
78
|
+
}
|
|
79
|
+
return array;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
+ (INInApp *)inAppFromJson: (NSDictionary *)json {
|
|
83
|
+
INInApp *inApp = [[INInApp alloc]init];
|
|
84
|
+
if ([json objectForKey:@"inAppId"]) { inApp.inAppId = [[json objectForKey:@"inAppId"]intValue]; }
|
|
85
|
+
|
|
86
|
+
if ([json objectForKey:@"creationDate"]) { inApp.creationDate = [json objectForKey:@"creationDate"]; }
|
|
87
|
+
if ([json objectForKey:@"schema"]) {
|
|
88
|
+
NSDictionary *schema = [json objectForKey:@"schema"];
|
|
89
|
+
if ([schema objectForKey:@"code"]) { inApp.code = [schema objectForKey:@"code"]; }
|
|
90
|
+
if ([schema objectForKey:@"width"]) { inApp.InAppHeight = [[schema objectForKey:@"width"]intValue]; }
|
|
91
|
+
if ([schema objectForKey:@"height"]) { inApp.InAppWidth = [[schema objectForKey:@"height"]intValue]; }
|
|
92
|
+
}
|
|
93
|
+
if ([json objectForKey:@"properties"]) {
|
|
94
|
+
NSDictionary *properties = [json objectForKey:@"properties"];
|
|
95
|
+
inApp.properties = [[INInAppProperties alloc]init];
|
|
96
|
+
if ([properties objectForKey:@"numberOfClicks"]) { inApp.properties.numberOfClicks = [[properties objectForKey:@"numberOfClicks"]intValue]; }
|
|
97
|
+
if ([properties objectForKey:@"numberOfShows"]) { inApp.properties.numberOfShows = [[properties objectForKey:@"numberOfShows"]intValue]; }
|
|
98
|
+
if ([properties objectForKey:@"contentUrl"]) { inApp.properties.InAppContentUrl = [NSURL URLWithString:[properties objectForKey:@"contentUrl"]]; }
|
|
99
|
+
if ([properties objectForKey:@"dismissForever"] ) { inApp.properties.dismissForever = [[properties objectForKey:@"dismissForever"]boolValue]; }
|
|
100
|
+
inApp.properties.layout = [[INInAppLayout alloc]init];
|
|
101
|
+
if ([properties objectForKey:@"borderRadius"]) { inApp.properties.layout.borderRadius = [[properties objectForKey:@"borderRadius"]intValue]; }
|
|
102
|
+
if ([properties objectForKey:@"layout"]) {
|
|
103
|
+
NSDictionary *layout = [properties objectForKey:@"layout"];
|
|
104
|
+
if ([layout objectForKey:@"borderRadius"]) { inApp.properties.layout.borderRadius = [[properties objectForKey:@"borderRadius"]intValue]; }
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
if ([properties objectForKey:@"action"]) {
|
|
108
|
+
inApp.properties.action = [[INInAppAction alloc]init];
|
|
109
|
+
NSDictionary *actions = [properties objectForKey:@"action"];
|
|
110
|
+
if ([actions objectForKey:@"app"]) { inApp.properties.action.app = [actions objectForKey:@"app"]; }
|
|
111
|
+
if ([actions objectForKey:@"share"]) { inApp.properties.action.share = [actions objectForKey:@"share"]; }
|
|
112
|
+
if ([actions objectForKey:@"call"]) { inApp.properties.action.call = [actions objectForKey:@"call"]; }
|
|
113
|
+
if ([actions objectForKey:@"wallet"]) { inApp.properties.action.wallet = [actions objectForKey:@"wallet"]; }
|
|
114
|
+
if ([actions objectForKey:@"url"]) { inApp.properties.action.url = [actions objectForKey:@"url"]; }
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if ([json objectForKey:@"expiredDate"]) { inApp.expiredDate = [json objectForKey:@"expiredDate"]; }
|
|
119
|
+
if ([json objectForKey:@"showOnce"]) { inApp.showOnce = [[json objectForKey:@"showOnce"]boolValue]; }
|
|
120
|
+
if ([json objectForKey:@"lastVersionId"]) { inApp.lastVersionId = [[json objectForKey:@"lastVersionId"]intValue]; }
|
|
121
|
+
return inApp;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
+ (NSDictionary *)jsonFromInAppShow: (INInApp *)inApp withError: (INError *) error {
|
|
125
|
+
NSMutableDictionary * obj = [NSMutableDictionary new];
|
|
126
|
+
if (inApp != nil) {
|
|
127
|
+
obj = [@{
|
|
128
|
+
@"inApp" : [self jsonFromInApp:inApp],
|
|
129
|
+
@"errorCode": @(error.errorCode),
|
|
130
|
+
@"errorMessage" : error.message ?: @"",
|
|
131
|
+
} mutableCopy];
|
|
132
|
+
}
|
|
133
|
+
return [obj mutableCopy];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
+ (NSDictionary *)jsonFromInApp: (INInApp *)inApp{
|
|
137
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
138
|
+
if (inApp != nil) {
|
|
139
|
+
|
|
140
|
+
obj = [@{
|
|
141
|
+
@"inAppId" : @(inApp.inAppId),
|
|
142
|
+
@"schema" : [self jsonFromInAppSchema:inApp],
|
|
143
|
+
@"lastVersionId": @(inApp.lastVersionId),
|
|
144
|
+
@"properties" : [self jsonFromInAppProperties:inApp.properties],
|
|
145
|
+
@"showOnce" : @(inApp.showOnce),
|
|
146
|
+
@"expiredDate": inApp.expiredDate ?: @"",
|
|
147
|
+
@"creationDate": inApp.creationDate ?: @"",
|
|
148
|
+
} mutableCopy];
|
|
149
|
+
}
|
|
150
|
+
return [obj mutableCopy];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
+ (NSDictionary *)jsonFromInAppSchema: (INInApp *)inApp{
|
|
154
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
155
|
+
obj = [@{
|
|
156
|
+
@"code": inApp.code ?: @"",
|
|
157
|
+
@"width": @(inApp.InAppWidth),
|
|
158
|
+
@"height" : @(inApp.InAppHeight),
|
|
159
|
+
} mutableCopy];
|
|
160
|
+
return [obj mutableCopy];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
+ (NSDictionary *)jsonFromInAppProperties: (INInAppProperties *)properties{
|
|
164
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
165
|
+
if (properties != nil) {
|
|
166
|
+
obj = [@{
|
|
167
|
+
@"contentUrl" : properties.InAppContentUrl.absoluteString ?: @"",
|
|
168
|
+
@"numberOfShows": @(properties.numberOfShows),
|
|
169
|
+
@"numberOfClicks" : @(properties.numberOfClicks),
|
|
170
|
+
@"dismissForever": @(properties.dismissForever),
|
|
171
|
+
@"showTime": @(properties.showTime),
|
|
172
|
+
@"action" : [self jsonFromAction:properties.action],
|
|
173
|
+
@"borderRadius" : @(properties.layout.borderRadius),
|
|
174
|
+
} mutableCopy];
|
|
175
|
+
}
|
|
176
|
+
return [obj mutableCopy];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
+ (NSDictionary *)jsonFromAction: (INBaseAction *)action{
|
|
180
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
181
|
+
if (action != nil) {
|
|
182
|
+
obj = [@{
|
|
183
|
+
@"app" : action.app ?: @"",
|
|
184
|
+
@"url": action.url ?: @"",
|
|
185
|
+
@"share" : action.share ?: @"",
|
|
186
|
+
@"call": action.call ?: @"",
|
|
187
|
+
@"market": action.market ?: @"",
|
|
188
|
+
@"noAction" : action.noAction ?: @"",
|
|
189
|
+
@"wallet" : action.wallet ?: @"",
|
|
190
|
+
@"type" : @(action.type),
|
|
191
|
+
} mutableCopy];
|
|
192
|
+
}
|
|
193
|
+
return [obj mutableCopy];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
+ (NSDictionary *) jsonFromCustomer: (INCustomer *) customer{
|
|
197
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
198
|
+
if (customer != nil) {
|
|
199
|
+
obj = [@{
|
|
200
|
+
@"id" : customer.customerId ?: @"",
|
|
201
|
+
@"customerId": customer.customerId ?: @"",
|
|
202
|
+
@"applicationId" : customer.applicationId ?: @"",
|
|
203
|
+
@"createdAt": customer.createdAt ?: @"",
|
|
204
|
+
@"updatedAt": customer.updatedAt ?: @""
|
|
205
|
+
} mutableCopy];
|
|
206
|
+
}
|
|
207
|
+
return [obj copy];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
+ (NSArray<NSDictionary *> *) jsonFromCustomerFields: (NSArray<INCustomerField *>*)customerFields{
|
|
211
|
+
NSMutableArray<NSDictionary *> *array = [[NSMutableArray alloc]init];
|
|
212
|
+
for (int i = 0; i < customerFields.count; i++) {
|
|
213
|
+
if (customerFields[i].customerFieldKey && customerFields[i].customerFieldValue){
|
|
214
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
215
|
+
obj = [@{
|
|
216
|
+
customerFields[i].customerFieldKey : customerFields[i].customerFieldValue,
|
|
217
|
+
} mutableCopy];
|
|
218
|
+
[array addObject:[obj copy]];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return [array copy];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
+ (NSDictionary *) jsonFromMessagesCounter: (INInboxCounters *) inboxCounter{
|
|
226
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
227
|
+
if (inboxCounter != nil) {
|
|
228
|
+
obj = [@{
|
|
229
|
+
@"click" : @(inboxCounter.click) ?: 0,
|
|
230
|
+
@"sent": @(inboxCounter.sent) ?: 0,
|
|
231
|
+
@"deleted" : @(inboxCounter.deleted) ?: 0,
|
|
232
|
+
@"lastAccess": inboxCounter.unread.lastAccess ?: @"",
|
|
233
|
+
@"count": @(inboxCounter.unread.count) ?: 0
|
|
234
|
+
} mutableCopy];
|
|
235
|
+
}
|
|
236
|
+
return [obj mutableCopy];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
+ (NSDictionary *) jsonFromInbox: (Inbox *) inbox newNotifications:(nullable NSArray<INInboxNotification *> *)newNotifications {
|
|
240
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
241
|
+
if (inbox != nil) {
|
|
242
|
+
|
|
243
|
+
obj = [@{
|
|
244
|
+
@"lastAccess" : inbox.lastAccess ?: @"",
|
|
245
|
+
@"count": @(inbox.count) ?: 0,
|
|
246
|
+
@"pageSize" : inbox.pageSize ?: 0,
|
|
247
|
+
@"numPage": inbox.page ?: 0,
|
|
248
|
+
@"notifications": [self jsonArrayFromInboxNotification: inbox.notifications] ?:@"",
|
|
249
|
+
@"newNotifications": [self jsonArrayFromInboxNotification: newNotifications] ?:@""
|
|
250
|
+
} mutableCopy];
|
|
251
|
+
}
|
|
252
|
+
return [obj mutableCopy];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
+ (NSArray<NSDictionary *>*) jsonArrayFromInboxNotification: (nullable NSArray<INInboxNotification *>*) inboxNotifications{
|
|
256
|
+
NSArray<NSDictionary *>* array = [NSArray new];
|
|
257
|
+
if (inboxNotifications) {
|
|
258
|
+
@try{
|
|
259
|
+
for (int i=0;i<inboxNotifications.count;i++){
|
|
260
|
+
NSDictionary *obj = [[NSDictionary alloc]init];
|
|
261
|
+
obj = @{
|
|
262
|
+
@"id" : inboxNotifications[i].idInboxNotification ?: @"",
|
|
263
|
+
@"sentAt": inboxNotifications[i].sentAt ?: @"",
|
|
264
|
+
@"status" : inboxNotifications[i].inboxStatus ?: InboxStatus.SENT,
|
|
265
|
+
@"sendingId" :inboxNotifications[i].sendingId ?: 0,
|
|
266
|
+
@"campaignId" :inboxNotifications[i].campaignId ?: 0,
|
|
267
|
+
@"message" :[self jsonFromPush:inboxNotifications[i].message]?:@"",
|
|
268
|
+
@"category" :[self jsonFromCategory:inboxNotifications[i].category]?:@""
|
|
269
|
+
};
|
|
270
|
+
if (obj != nil) array = [array arrayByAddingObject:obj];
|
|
271
|
+
|
|
272
|
+
}
|
|
273
|
+
} @catch (NSException *exception) {
|
|
274
|
+
NSLog(@"Error jsonArrayFromInboxNotification %@", exception);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return array;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
+ (NSDictionary *) jsonFromCategory: (InboxCategory *) category{
|
|
281
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
282
|
+
if (category != nil) {
|
|
283
|
+
obj = [@{
|
|
284
|
+
@"id" : @(category.idCategory) ?: 0,
|
|
285
|
+
@"name": category.name ?: @"",
|
|
286
|
+
@"code": category.code ?: @""
|
|
287
|
+
} mutableCopy];
|
|
288
|
+
}
|
|
289
|
+
return [obj mutableCopy];
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
+ (NSDictionary *) jsonFromPush: (INPush *) message{
|
|
293
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
294
|
+
if (message != nil) {
|
|
295
|
+
|
|
296
|
+
obj = [@{
|
|
297
|
+
@"title" : message.title ?: @"",
|
|
298
|
+
@"body": message.body ?: @"",
|
|
299
|
+
@"image": message.image ?: @"",
|
|
300
|
+
@"gif": message.gif ?: @"",
|
|
301
|
+
@"action": [self jsonFromPushAction:message.action] ?: @"",
|
|
302
|
+
@"buttons": [self jsonArrayFromPushButtons:message.buttons] ?: @"",
|
|
303
|
+
@"data": message.data ?: @"",
|
|
304
|
+
@"securedData": message.securedData ?: @""
|
|
305
|
+
|
|
306
|
+
} mutableCopy];
|
|
307
|
+
}
|
|
308
|
+
return [obj mutableCopy];
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
+ (NSDictionary *) jsonFromPushAction: (INPushAction *) action{
|
|
312
|
+
NSMutableDictionary *obj = [[NSMutableDictionary alloc]init];
|
|
313
|
+
if (action != nil) {
|
|
314
|
+
|
|
315
|
+
obj = [@{
|
|
316
|
+
@"url": action.url ?:@"",
|
|
317
|
+
@"app": action.app?:@"",
|
|
318
|
+
@"market": action.market?:@"",
|
|
319
|
+
@"share": action.share?:@"",
|
|
320
|
+
@"call":action.call?:@"",
|
|
321
|
+
@"noAction":action.noAction?:@"",
|
|
322
|
+
@"wallet":action.wallet?:@""
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
} mutableCopy];
|
|
326
|
+
}
|
|
327
|
+
return [obj mutableCopy];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
+ (NSArray<NSDictionary *>*) jsonArrayFromPushButtons: (NSArray<INPushButton *>*) buttons{
|
|
331
|
+
NSArray<NSDictionary *>* array = [NSArray new];
|
|
332
|
+
@try{
|
|
333
|
+
if (buttons != nil){
|
|
334
|
+
for (int i=0;i<buttons.count;i++){
|
|
335
|
+
NSDictionary *obj = [[NSDictionary alloc]init];
|
|
336
|
+
obj = @{
|
|
337
|
+
@"label" : buttons[i].label ?: @"",
|
|
338
|
+
@"action": [self jsonFromPushAction: buttons[i].action] ?:@""
|
|
339
|
+
};
|
|
340
|
+
if (obj != nil) array = [array arrayByAddingObject:obj];
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
}else{
|
|
344
|
+
return nil;
|
|
345
|
+
}
|
|
346
|
+
} @catch (NSException *exception) {
|
|
347
|
+
NSLog(@"Error jsonArrayFromPushButtons %@", exception);
|
|
348
|
+
}
|
|
349
|
+
return array;
|
|
350
|
+
}
|
|
351
|
+
@end
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "indigitall-capacitor-plugin",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Capacitor Indigitall Plugin",
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"unpkg": "dist/plugin.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"android/src/main/",
|
|
11
|
+
"android/build.gradle",
|
|
12
|
+
"dist/",
|
|
13
|
+
"ios/Plugin/",
|
|
14
|
+
"IndigitallCapacitorPlugin.podspec"
|
|
15
|
+
],
|
|
16
|
+
"author": "sdk@indigitall.com",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://gclarfer@bitbucket.org/indigitallfuente/capacitor-sdk.git.git"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://gclarfer@bitbucket.org/indigitallfuente/capacitor-sdk.git/issues"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"capacitor",
|
|
27
|
+
"plugin",
|
|
28
|
+
"native"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
32
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
|
|
33
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
34
|
+
"verify:web": "npm run build",
|
|
35
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
36
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
37
|
+
"eslint": "eslint . --ext ts",
|
|
38
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
39
|
+
"swiftlint": "node-swiftlint",
|
|
40
|
+
"docgen": "docgen --api IndigitallCpPlugin --output-readme README.md --output-json dist/docs.json",
|
|
41
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
|
|
42
|
+
"clean": "rimraf ./dist",
|
|
43
|
+
"watch": "tsc --watch",
|
|
44
|
+
"prepublishOnly": "npm run build",
|
|
45
|
+
"publish": "npm publish sdk/ --token=$token"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@capacitor/android": "^3.0.0",
|
|
49
|
+
"@capacitor/core": "^3.0.0",
|
|
50
|
+
"@capacitor/docgen": "^0.0.18",
|
|
51
|
+
"@capacitor/ios": "^3.0.0",
|
|
52
|
+
"@ionic/eslint-config": "^0.3.0",
|
|
53
|
+
"@ionic/prettier-config": "^1.0.1",
|
|
54
|
+
"@ionic/swiftlint-config": "^1.1.2",
|
|
55
|
+
"eslint": "^7.11.0",
|
|
56
|
+
"prettier": "~2.2.0",
|
|
57
|
+
"prettier-plugin-java": "~1.0.0",
|
|
58
|
+
"rimraf": "^3.0.2",
|
|
59
|
+
"rollup": "^2.32.0",
|
|
60
|
+
"swiftlint": "^1.0.1",
|
|
61
|
+
"typescript": "~4.0.3"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@capacitor/core": "^3.0.0"
|
|
65
|
+
},
|
|
66
|
+
"prettier": "@ionic/prettier-config",
|
|
67
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
68
|
+
"eslintConfig": {
|
|
69
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
70
|
+
},
|
|
71
|
+
"capacitor": {
|
|
72
|
+
"ios": {
|
|
73
|
+
"src": "ios"
|
|
74
|
+
},
|
|
75
|
+
"android": {
|
|
76
|
+
"src": "android"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|