capacitor-actito-loyalty 5.0.0-beta.2
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/CHANGELOG.md +28 -0
- package/CapacitorActitoLoyalty.podspec +20 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +210 -0
- package/Package.swift +27 -0
- package/README.md +54 -0
- package/android/build.gradle +61 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/actito/loyalty/capacitor/ActitoLoyaltyPlugin.kt +89 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/esm/actito-loyalty.d.ts +28 -0
- package/dist/esm/actito-loyalty.js +40 -0
- package/dist/esm/actito-loyalty.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/models/actito-pass.d.ts +20 -0
- package/dist/esm/models/actito-pass.js +2 -0
- package/dist/esm/models/actito-pass.js.map +1 -0
- package/dist/esm/plugin.d.ts +17 -0
- package/dist/esm/plugin.js +5 -0
- package/dist/esm/plugin.js.map +1 -0
- package/dist/esm/web.d.ts +18 -0
- package/dist/esm/web.js +16 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +71 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +74 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/ActitoLoyaltyPlugin/ActitoLoyaltyPlugin.swift +95 -0
- package/package.json +75 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 5.0.0-beta.2
|
|
4
|
+
|
|
5
|
+
- Add Swift Package Manager support
|
|
6
|
+
- Added name and size restrictions to tag names, event names and event payloads
|
|
7
|
+
- Crash reporting is deprecated and disabled by default. We recommend using another solution to collect crash analytics
|
|
8
|
+
|
|
9
|
+
#### Native changes
|
|
10
|
+
|
|
11
|
+
- Add required referrer for embedded YouTube videos
|
|
12
|
+
- Improved network request retry mechanism
|
|
13
|
+
|
|
14
|
+
##### iOS
|
|
15
|
+
|
|
16
|
+
- Add option to enable reader mode in in-app browser
|
|
17
|
+
- Align with Swift 6 and its Strict Concurrency requirements
|
|
18
|
+
- Improved UI for iOS 26
|
|
19
|
+
- Changed the default `presentationOptions` to `[.banner, .badge, .sound]`
|
|
20
|
+
- Offload PKPass loading to the background
|
|
21
|
+
- Fix APNS token registration race condition
|
|
22
|
+
|
|
23
|
+
##### Android
|
|
24
|
+
|
|
25
|
+
- Updated to Kotlin 2.0
|
|
26
|
+
- Fix conflicting flags in geo pending intents
|
|
27
|
+
|
|
28
|
+
Prior to upgrading to v5.x, consult the [Migration Guide](./MIGRATION.md), which outlines all necessary changes and procedures to ensure a smooth migration.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
actito_version = '5.0.0-beta.2'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = 'CapacitorActitoLoyalty'
|
|
8
|
+
s.version = package['version']
|
|
9
|
+
s.summary = package['description']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.homepage = package['repository']['url']
|
|
12
|
+
s.author = package['author']
|
|
13
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
14
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
15
|
+
s.ios.deployment_target = '14.0'
|
|
16
|
+
s.dependency 'Capacitor'
|
|
17
|
+
s.dependency 'Actito/ActitoKit', actito_version
|
|
18
|
+
s.dependency 'Actito/ActitoLoyaltyKit', actito_version
|
|
19
|
+
s.swift_version = '5.1'
|
|
20
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Actito
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# MIGRATING
|
|
2
|
+
|
|
3
|
+
Actito 5.x is a complete rebranding of the Notificare SDK. Most of the migration involves updating the implementation from Notificare to Actito while keeping the original method invocations.
|
|
4
|
+
|
|
5
|
+
## Deprecations
|
|
6
|
+
|
|
7
|
+
Crash reporting is now deprecated and disabled by default. We recommend using another solution to collect crash analytics.
|
|
8
|
+
In case you have explicitly opted in, consider removing the following:
|
|
9
|
+
- Android: remove `re.notifica.crash_reports_enabled` meta-data from your `AndroidManifest.xml`.
|
|
10
|
+
- iOS: remove `CRASH_REPORTING_ENABLED` from your `ActitoOptions.plist`
|
|
11
|
+
|
|
12
|
+
## Breaking changes
|
|
13
|
+
|
|
14
|
+
### Removals
|
|
15
|
+
|
|
16
|
+
- Removed Scannables module.
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
Open your `package.json` file and align dependencies.
|
|
21
|
+
Keep only the dependencies that you already use in your project.
|
|
22
|
+
|
|
23
|
+
```diff
|
|
24
|
+
- "capacitor-notificare": "^4.0.0",
|
|
25
|
+
- "capacitor-notificare-assets": "^4.0.0",
|
|
26
|
+
- "capacitor-notificare-geo": "^4.0.0",
|
|
27
|
+
- "capacitor-notificare-in-app-messaging": "^4.0.0",
|
|
28
|
+
- "capacitor-notificare-inbox": "^4.0.0",
|
|
29
|
+
- "capacitor-notificare-loyalty": "^4.0.0",
|
|
30
|
+
- "capacitor-notificare-push": "^4.0.0",
|
|
31
|
+
- "capacitor-notificare-push-ui": "^4.0.0",
|
|
32
|
+
- "capacitor-notificare-user-inbox": "^4.0.0",
|
|
33
|
+
|
|
34
|
+
+ "capacitor-actito": "^5.0.0",
|
|
35
|
+
+ "capacitor-actito-assets": "^5.0.0",
|
|
36
|
+
+ "capacitor-actito-geo": "^5.0.0",
|
|
37
|
+
+ "capacitor-actito-in-app-messaging": "^5.0.0",
|
|
38
|
+
+ "capacitor-actito-inbox": "^5.0.0",
|
|
39
|
+
+ "capacitor-actito-loyalty": "^5.0.0",
|
|
40
|
+
+ "capacitor-actito-push": "^5.0.0",
|
|
41
|
+
+ "capacitor-actito-push-ui": "^5.0.0",
|
|
42
|
+
+ "capacitor-actito-user-inbox": "^5.0.0",
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Setup
|
|
46
|
+
|
|
47
|
+
#### Android
|
|
48
|
+
|
|
49
|
+
Starting with version 5.0, all SDK artifacts are now published to **Maven Central**.
|
|
50
|
+
You no longer need to include the Notificare Maven repositories, and all artifacts have been moved from the `re.notifica` namespace to the new `com.actito` namespace.
|
|
51
|
+
|
|
52
|
+
This migration simplifies dependency management and aligns the SDK with standard Maven publishing practices.
|
|
53
|
+
|
|
54
|
+
##### Update the root `build.gradle`
|
|
55
|
+
|
|
56
|
+
```diff
|
|
57
|
+
plugins {
|
|
58
|
+
- id 're.notifica.gradle.notificare-services' version '1.0.1' apply false
|
|
59
|
+
+ id 'com.actito.gradle.actito-services' version '1.0.0' apply false
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
allprojects {
|
|
63
|
+
repositories {
|
|
64
|
+
- maven { url 'https://maven.notifica.re/releases' }
|
|
65
|
+
- maven { url 'https://maven.notifica.re/prereleases' }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
##### Update the app `build.gradle`
|
|
71
|
+
|
|
72
|
+
Open your **app module’s** `build.gradle` file and align the plugin implementation.
|
|
73
|
+
|
|
74
|
+
```diff
|
|
75
|
+
plugins {
|
|
76
|
+
- id 're.notifica.gradle.notificare-services'
|
|
77
|
+
+ id 'com.actito.gradle.actito-services'
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
##### Adjust the constants in your `AndroidManifest.xml`
|
|
82
|
+
|
|
83
|
+
Open your `AndroidManifest.xml` file and rename all `re.notifica` constants to `com.actito`. For instance, here's an example of the changes to the trampoline intent:
|
|
84
|
+
|
|
85
|
+
```diff
|
|
86
|
+
<activity android:name=".MainActivity" android:launchMode="singleTask">
|
|
87
|
+
<intent-filter>
|
|
88
|
+
- <action android:name="re.notifica.intent.action.RemoteMessageOpened" />
|
|
89
|
+
+ <action android:name="com.actito.intent.action.RemoteMessageOpened" />
|
|
90
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
91
|
+
</intent-filter>
|
|
92
|
+
</activity>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### iOS
|
|
96
|
+
|
|
97
|
+
##### Notifications Service Extension
|
|
98
|
+
|
|
99
|
+
Align the dependency inside your Notifications Service Extension target in `Podfile`:
|
|
100
|
+
|
|
101
|
+
```diff
|
|
102
|
+
target 'NotificationServiceExtension' do
|
|
103
|
+
- pod 'Notificare/NotificareNotificationServiceExtensionKit', '4.x.x'
|
|
104
|
+
+ pod 'Actito/ActitoNotificationServiceExtensionKit', '5.x.x'
|
|
105
|
+
end
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Configuration file
|
|
109
|
+
|
|
110
|
+
Rename configuration file:
|
|
111
|
+
- Android: `notificare-services.json` -> `actito-services.json`
|
|
112
|
+
- iOS: `NotificareServices.plist` -> `ActitoServices.plist`, also make sure to align the options file `NotificareOptions.plist` -> `ActitoOptions.plist`
|
|
113
|
+
|
|
114
|
+
### Implementation
|
|
115
|
+
|
|
116
|
+
You must update all references to the old Notificare classes and packages throughout your project.
|
|
117
|
+
Replace any class names starting with `Notificare` (for example, `NotificarePush`, `NotificarePushUI`, `NotificareGeo`, etc.) with their Actito equivalents (`ActitoPush`, `ActitoPushUI`, `ActitoGeo`, and so on).
|
|
118
|
+
|
|
119
|
+
Similarly, update all imports from the `import { Notificare* } from 'capacitor-notificare*'` to `import { Actito* } from 'capacitor-actito*'`.
|
|
120
|
+
|
|
121
|
+
Here is an example from the inbox implementation:
|
|
122
|
+
|
|
123
|
+
```diff
|
|
124
|
+
- import { NotificareInbox, NotificareInboxItem } from 'capacitor-notificare-inbox';
|
|
125
|
+
- import { NotificarePushUI } from 'capacitor-notificare-push-ui';
|
|
126
|
+
|
|
127
|
+
+ import { ActitoInbox, ActitoInboxItem } from 'capacitor-actito-inbox';
|
|
128
|
+
+ import { ActitoPushUI } from 'capacitor-actito-push-ui';
|
|
129
|
+
|
|
130
|
+
- async function open(item: NotificareInboxItem) {
|
|
131
|
+
+ async function open(item: ActitoInboxItem) {
|
|
132
|
+
try {
|
|
133
|
+
- const notification = await NotificareInbox.open(item);
|
|
134
|
+
- await NotificarePushUI.presentNotification(notification);
|
|
135
|
+
|
|
136
|
+
+ const notification = await ActitoInbox.open(item);
|
|
137
|
+
+ await ActitoPushUI.presentNotification(notification);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
// handle error
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
> **Tip:**
|
|
145
|
+
>
|
|
146
|
+
> A global search-and-replace can accelerate this migration, but review your code carefully.
|
|
147
|
+
|
|
148
|
+
### Overriding Localizable Resources
|
|
149
|
+
|
|
150
|
+
#### Android
|
|
151
|
+
|
|
152
|
+
If your project overrides SDK-provided localizable strings or other resources, you must update their names to align with the new Actito namespace.
|
|
153
|
+
All resource identifiers previously prefixed with `notificare_` should now use the `actito_` prefix instead.
|
|
154
|
+
|
|
155
|
+
For example, in your `res/values-fr/strings.xml` file:
|
|
156
|
+
|
|
157
|
+
```diff
|
|
158
|
+
- <string name="notificare_dialog_cancel_button">Annuler</string>
|
|
159
|
+
+ <string name="actito_dialog_cancel_button">Annuler</string>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Ensure this change is applied consistently across all localized resource files (for example, values-es, values-fr, etc.) within your res directory.
|
|
163
|
+
|
|
164
|
+
> **Tip:**
|
|
165
|
+
>
|
|
166
|
+
> A global search for `notificare_` in your `res/` folder will help you quickly locate and rename all relevant keys to the new `actito_` format.
|
|
167
|
+
|
|
168
|
+
#### iOS
|
|
169
|
+
|
|
170
|
+
If your project overrides SDK-provided localizable strings or other resources, you must update their names to align with the new Actito namespace.
|
|
171
|
+
All resource identifiers previously prefixed with `notificare_` should now use the `actito_` prefix instead.
|
|
172
|
+
|
|
173
|
+
For example, in your `fr.lproj/Localizable.strings` file:
|
|
174
|
+
|
|
175
|
+
```diff
|
|
176
|
+
- notificare_cancel_button = "Annuler";
|
|
177
|
+
+ actito_cancel_button = "Annuler";
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
> **Tip:**
|
|
181
|
+
>
|
|
182
|
+
> A global search for `notificare_` in your localizable folder will help you quickly locate and rename all relevant keys to the new `actito_` format.
|
|
183
|
+
|
|
184
|
+
### Restricted Tag Naming
|
|
185
|
+
|
|
186
|
+
Tag naming rules have been tightened to ensure consistency.
|
|
187
|
+
Tags added using `Actito.device().addTag()` or `Actito.device().addTags()` must now adhere to the following constraints:
|
|
188
|
+
|
|
189
|
+
- The tag name must be between 3 and 64 characters in length.
|
|
190
|
+
- Tags must start and end with an alphanumeric character.
|
|
191
|
+
- Only letters, digits, underscores (`_`), and hyphens (`-`) are allowed within the name.
|
|
192
|
+
|
|
193
|
+
> **Example:**
|
|
194
|
+
>
|
|
195
|
+
> ✅ `premium_user` ✅ `en-GB` ❌ @user
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
### Restricted Event Naming and Payload Size
|
|
199
|
+
|
|
200
|
+
Event naming and payload validation rules have also been standardized.
|
|
201
|
+
Custom events logged with `Actito.events().logCustom();` must comply with the following:
|
|
202
|
+
|
|
203
|
+
- Event names must be between 3 and 64 characters.
|
|
204
|
+
- Event names must start and end with an alphanumeric character.
|
|
205
|
+
- Only letters, digits, underscores (`_`), and hyphens (`-`) are permitted.
|
|
206
|
+
- The event data payload is limited to 2 KB in size. Ensure you are not sending excessively large or deeply nested objects when calling: `Actito.shared.events().logCustom(eventName, data: data)`.
|
|
207
|
+
|
|
208
|
+
> **Tip:**
|
|
209
|
+
>
|
|
210
|
+
> To avoid exceeding the payload limit, keep your event data minimal — include only the essential key–value pairs required for personalized content or campaign targeting.
|
package/Package.swift
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapacitorActitoLoyalty",
|
|
6
|
+
platforms: [.iOS(.v14)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapacitorActitoLoyalty",
|
|
10
|
+
targets: ["ActitoLoyaltyPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
|
|
14
|
+
.package(url: "https://github.com/Actito/actito-sdk-ios.git", from: "5.0.0-beta.2"),
|
|
15
|
+
],
|
|
16
|
+
targets: [
|
|
17
|
+
.target(
|
|
18
|
+
name: "ActitoLoyaltyPlugin",
|
|
19
|
+
dependencies: [
|
|
20
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
21
|
+
.product(name: "Cordova", package: "capacitor-swift-pm"),
|
|
22
|
+
.product(name: "ActitoKit", package: "actito-sdk-ios"),
|
|
23
|
+
.product(name: "ActitoLoyaltyKit", package: "actito-sdk-ios"),
|
|
24
|
+
],
|
|
25
|
+
path: "ios/Sources/ActitoLoyaltyPlugin"),
|
|
26
|
+
]
|
|
27
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[<img src="https://cdn-mobile.actito.com/logo.png"/>](https://actito.com)
|
|
2
|
+
|
|
3
|
+
# Actito Ionic Native SDK
|
|
4
|
+
|
|
5
|
+
[](https://github.com/actito/actito-sdk-ionic-native/releases)
|
|
6
|
+
[](https://github.com/actito/actito-sdk-ionic-native/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
The Actito Ionic Native SDK makes it quick and easy to communicate efficiently with many of the Actito API services and enables you to seamlessly integrate our various features, from Push Notifications to Contextualised Storage.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Table of contents
|
|
12
|
+
=================
|
|
13
|
+
|
|
14
|
+
* [Features](#features)
|
|
15
|
+
* [Requirements](#requirements)
|
|
16
|
+
* [Getting Started](#getting-started)
|
|
17
|
+
* [Integration](#integration)
|
|
18
|
+
* [Examples](#examples)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
**Push notifications**: Receive push notifications and automatically track its engagement.
|
|
24
|
+
|
|
25
|
+
**Push notifications UI**: Use native screens and elements to display your push notifications and handle its actions with zero effort.
|
|
26
|
+
|
|
27
|
+
**In-app messaging**: Automatically show relevant in-app content to your users with zero effort.
|
|
28
|
+
|
|
29
|
+
**Inbox**: Apps with a built-in message inbox enjoy higher conversions due to its nature of keeping messages around that can be opened as many times as users want. The SDK gives you all the tools necessary to build your inbox UI.
|
|
30
|
+
|
|
31
|
+
**Geo**: Transform your user's location into relevant information, automate how you segment your users based on location behaviour and create truly contextual notifications.
|
|
32
|
+
|
|
33
|
+
**Loyalty**: Harness the power of digital cards that live beyond your app and are always in your customer’s pocket.
|
|
34
|
+
|
|
35
|
+
**Assets**: Add powerful contextual marketing features to your apps. Show the right content to the right users at the right time or location. Maximise the content you're already creating without increasing development costs.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
* Android 6 (API level 23) and above
|
|
41
|
+
* iOS 13 and above
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Getting Started
|
|
45
|
+
|
|
46
|
+
### Integration
|
|
47
|
+
|
|
48
|
+
To integrate the Actito Ionic Native SDK into your application, follow the full setup and implementation guides available in our [official documentation](https://developers.actito.com/docs/push-implementation/ionic-native/implementation/)
|
|
49
|
+
|
|
50
|
+
The documentation includes step-by-step instructions for installation, configuration, and advanced customization across all supported platforms.
|
|
51
|
+
|
|
52
|
+
### Examples
|
|
53
|
+
|
|
54
|
+
The [example project](https://github.com/Actito/actito-sdk-ionic-native/tree/main/packages/sample) demonstrates other integrations in a simplified fashion, to quickly understand how a given feature should be implemented.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
6
|
+
dependencies {
|
|
7
|
+
classpath 'com.android.tools.build:gradle:8.9.2'
|
|
8
|
+
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
apply plugin: 'com.android.library'
|
|
13
|
+
apply plugin: 'kotlin-android'
|
|
14
|
+
|
|
15
|
+
android {
|
|
16
|
+
if (project.android.hasProperty("namespace")) {
|
|
17
|
+
namespace 'com.actito.loyalty.capacitor'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
compileSdkVersion 36
|
|
21
|
+
defaultConfig {
|
|
22
|
+
minSdkVersion 23
|
|
23
|
+
targetSdkVersion 35
|
|
24
|
+
}
|
|
25
|
+
buildTypes {
|
|
26
|
+
release {
|
|
27
|
+
minifyEnabled false
|
|
28
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
lintOptions {
|
|
32
|
+
abortOnError false
|
|
33
|
+
}
|
|
34
|
+
compileOptions {
|
|
35
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
36
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
37
|
+
}
|
|
38
|
+
kotlinOptions {
|
|
39
|
+
jvmTarget = '1.8'
|
|
40
|
+
freeCompilerArgs += [
|
|
41
|
+
'-Xexplicit-api=strict',
|
|
42
|
+
'-Xopt-in=com.actito.InternalActitoApi',
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
repositories {
|
|
48
|
+
google()
|
|
49
|
+
mavenCentral()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
dependencies {
|
|
53
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
54
|
+
implementation project(':capacitor-android')
|
|
55
|
+
|
|
56
|
+
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
57
|
+
|
|
58
|
+
def actito_version = '5.0.0-beta.2'
|
|
59
|
+
api "com.actito:actito:$actito_version"
|
|
60
|
+
api "com.actito:actito-loyalty:$actito_version"
|
|
61
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
package com.actito.loyalty.capacitor
|
|
2
|
+
|
|
3
|
+
import com.actito.Actito
|
|
4
|
+
import com.actito.ActitoCallback
|
|
5
|
+
import com.actito.loyalty.ktx.loyalty
|
|
6
|
+
import com.actito.loyalty.models.ActitoPass
|
|
7
|
+
import com.getcapacitor.JSObject
|
|
8
|
+
import com.getcapacitor.Plugin
|
|
9
|
+
import com.getcapacitor.PluginCall
|
|
10
|
+
import com.getcapacitor.PluginMethod
|
|
11
|
+
import com.getcapacitor.annotation.CapacitorPlugin
|
|
12
|
+
|
|
13
|
+
@CapacitorPlugin(name = "ActitoLoyaltyPlugin")
|
|
14
|
+
public class ActitoLoyaltyPlugin : Plugin() {
|
|
15
|
+
@PluginMethod
|
|
16
|
+
public fun fetchPassBySerial(call: PluginCall) {
|
|
17
|
+
val serial = call.getString("serial") ?: run {
|
|
18
|
+
call.reject("Missing 'serial' parameter.")
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Actito.loyalty().fetchPassBySerial(serial, object : ActitoCallback<ActitoPass> {
|
|
23
|
+
override fun onSuccess(result: ActitoPass) {
|
|
24
|
+
try {
|
|
25
|
+
call.resolve(
|
|
26
|
+
JSObject().apply {
|
|
27
|
+
put("result", result.toJson())
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
} catch (e: Exception) {
|
|
31
|
+
call.reject(e.localizedMessage)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun onFailure(e: Exception) {
|
|
36
|
+
call.reject(e.localizedMessage)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@PluginMethod
|
|
42
|
+
public fun fetchPassByBarcode(call: PluginCall) {
|
|
43
|
+
val barcode = call.getString("barcode") ?: run {
|
|
44
|
+
call.reject("Missing 'barcode' parameter.")
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Actito.loyalty().fetchPassByBarcode(barcode, object : ActitoCallback<ActitoPass> {
|
|
49
|
+
override fun onSuccess(result: ActitoPass) {
|
|
50
|
+
try {
|
|
51
|
+
call.resolve(
|
|
52
|
+
JSObject().apply {
|
|
53
|
+
put("result", result.toJson())
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
} catch (e: Exception) {
|
|
57
|
+
call.reject(e.localizedMessage)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun onFailure(e: Exception) {
|
|
62
|
+
call.reject(e.localizedMessage)
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@PluginMethod
|
|
68
|
+
public fun present(call: PluginCall) {
|
|
69
|
+
val json = call.getObject("pass") ?: run {
|
|
70
|
+
call.reject("Missing 'pass' parameter.")
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
val pass: ActitoPass = try {
|
|
75
|
+
ActitoPass.fromJson(json)
|
|
76
|
+
} catch (e: Exception) {
|
|
77
|
+
call.reject(e.localizedMessage)
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
val activity = activity ?: run {
|
|
82
|
+
call.reject("Cannot present a pass without an activity.")
|
|
83
|
+
return
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
Actito.loyalty().present(activity, pass)
|
|
87
|
+
call.resolve()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ActitoPass } from './models/actito-pass';
|
|
2
|
+
export declare class ActitoLoyalty {
|
|
3
|
+
/**
|
|
4
|
+
* Fetches a pass by its serial number.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} serial - The serial number of the pass to be fetched.
|
|
7
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
8
|
+
* {@link ActitoPass} corresponding to the given serial number.
|
|
9
|
+
*/
|
|
10
|
+
static fetchPassBySerial(serial: string): Promise<ActitoPass>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetches a pass by its barcode.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} barcode - The barcode of the pass to be fetched.
|
|
15
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
16
|
+
* {@link ActitoPass} corresponding to the given barcode.
|
|
17
|
+
*/
|
|
18
|
+
static fetchPassByBarcode(barcode: string): Promise<ActitoPass>;
|
|
19
|
+
/**
|
|
20
|
+
* Presents a pass to the user.
|
|
21
|
+
*
|
|
22
|
+
* @param {ActitoPass} pass - The {@link ActitoPass} to be presented
|
|
23
|
+
* to the user.
|
|
24
|
+
* @returns {Promise<void>} - A promise that resolves when the pass has
|
|
25
|
+
* been successfully presented to the user.
|
|
26
|
+
*/
|
|
27
|
+
static present(pass: ActitoPass): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NativePlugin } from './plugin';
|
|
2
|
+
export class ActitoLoyalty {
|
|
3
|
+
//
|
|
4
|
+
// Methods
|
|
5
|
+
//
|
|
6
|
+
/**
|
|
7
|
+
* Fetches a pass by its serial number.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} serial - The serial number of the pass to be fetched.
|
|
10
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
11
|
+
* {@link ActitoPass} corresponding to the given serial number.
|
|
12
|
+
*/
|
|
13
|
+
static async fetchPassBySerial(serial) {
|
|
14
|
+
const { result } = await NativePlugin.fetchPassBySerial({ serial });
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Fetches a pass by its barcode.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} barcode - The barcode of the pass to be fetched.
|
|
21
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
22
|
+
* {@link ActitoPass} corresponding to the given barcode.
|
|
23
|
+
*/
|
|
24
|
+
static async fetchPassByBarcode(barcode) {
|
|
25
|
+
const { result } = await NativePlugin.fetchPassByBarcode({ barcode });
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Presents a pass to the user.
|
|
30
|
+
*
|
|
31
|
+
* @param {ActitoPass} pass - The {@link ActitoPass} to be presented
|
|
32
|
+
* to the user.
|
|
33
|
+
* @returns {Promise<void>} - A promise that resolves when the pass has
|
|
34
|
+
* been successfully presented to the user.
|
|
35
|
+
*/
|
|
36
|
+
static async present(pass) {
|
|
37
|
+
await NativePlugin.present({ pass });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=actito-loyalty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actito-loyalty.js","sourceRoot":"","sources":["../../src/actito-loyalty.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,OAAO,aAAa;IACxB,EAAE;IACF,UAAU;IACV,EAAE;IAEF;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAc;QAClD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACpE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAe;QACpD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAgB;QAC1C,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ActitoPass {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly type?: string;
|
|
4
|
+
readonly version: number;
|
|
5
|
+
readonly passbook?: string;
|
|
6
|
+
readonly template?: string;
|
|
7
|
+
readonly serial: string;
|
|
8
|
+
readonly barcode: string;
|
|
9
|
+
readonly redeem: string;
|
|
10
|
+
readonly redeemHistory: ActitoPassRedemption[];
|
|
11
|
+
readonly limit: number;
|
|
12
|
+
readonly token: string;
|
|
13
|
+
readonly data: Record<string, any>;
|
|
14
|
+
readonly date: string;
|
|
15
|
+
readonly googlePaySaveLink?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ActitoPassRedemption {
|
|
18
|
+
readonly comments?: string;
|
|
19
|
+
readonly date: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actito-pass.js","sourceRoot":"","sources":["../../../src/models/actito-pass.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ActitoPass } from './models/actito-pass';
|
|
2
|
+
export declare const NativePlugin: ActitoLoyaltyPlugin;
|
|
3
|
+
export interface ActitoLoyaltyPlugin {
|
|
4
|
+
fetchPassBySerial(options: {
|
|
5
|
+
serial: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
result: ActitoPass;
|
|
8
|
+
}>;
|
|
9
|
+
fetchPassByBarcode(options: {
|
|
10
|
+
barcode: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
result: ActitoPass;
|
|
13
|
+
}>;
|
|
14
|
+
present(options: {
|
|
15
|
+
pass: ActitoPass;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAsB,qBAAqB,EAAE;IACrF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;CACvE,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { ActitoPass } from './models/actito-pass';
|
|
3
|
+
import type { ActitoLoyaltyPlugin } from './plugin';
|
|
4
|
+
export declare class ActitoLoyaltyPluginWeb extends WebPlugin implements ActitoLoyaltyPlugin {
|
|
5
|
+
fetchPassBySerial(_options: {
|
|
6
|
+
serial: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
result: ActitoPass;
|
|
9
|
+
}>;
|
|
10
|
+
fetchPassByBarcode(_options: {
|
|
11
|
+
barcode: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
result: ActitoPass;
|
|
14
|
+
}>;
|
|
15
|
+
present(_options: {
|
|
16
|
+
pass: ActitoPass;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class ActitoLoyaltyPluginWeb extends WebPlugin {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
|
+
fetchPassBySerial(_options) {
|
|
5
|
+
throw this.unimplemented('Not implemented on web.');
|
|
6
|
+
}
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
|
+
fetchPassByBarcode(_options) {
|
|
9
|
+
throw this.unimplemented('Not implemented on web.');
|
|
10
|
+
}
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
+
present(_options) {
|
|
13
|
+
throw this.unimplemented('Not implemented on web.');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IACnD,6DAA6D;IAC7D,iBAAiB,CAAC,QAA4B;QAC5C,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,6DAA6D;IAC7D,kBAAkB,CAAC,QAA6B;QAC9C,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,6DAA6D;IAC7D,OAAO,CAAC,QAA8B;QACpC,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@capacitor/core');
|
|
6
|
+
|
|
7
|
+
const NativePlugin = core.registerPlugin('ActitoLoyaltyPlugin', {
|
|
8
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.ActitoLoyaltyPluginWeb()),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
class ActitoLoyalty {
|
|
12
|
+
//
|
|
13
|
+
// Methods
|
|
14
|
+
//
|
|
15
|
+
/**
|
|
16
|
+
* Fetches a pass by its serial number.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} serial - The serial number of the pass to be fetched.
|
|
19
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
20
|
+
* {@link ActitoPass} corresponding to the given serial number.
|
|
21
|
+
*/
|
|
22
|
+
static async fetchPassBySerial(serial) {
|
|
23
|
+
const { result } = await NativePlugin.fetchPassBySerial({ serial });
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Fetches a pass by its barcode.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} barcode - The barcode of the pass to be fetched.
|
|
30
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
31
|
+
* {@link ActitoPass} corresponding to the given barcode.
|
|
32
|
+
*/
|
|
33
|
+
static async fetchPassByBarcode(barcode) {
|
|
34
|
+
const { result } = await NativePlugin.fetchPassByBarcode({ barcode });
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Presents a pass to the user.
|
|
39
|
+
*
|
|
40
|
+
* @param {ActitoPass} pass - The {@link ActitoPass} to be presented
|
|
41
|
+
* to the user.
|
|
42
|
+
* @returns {Promise<void>} - A promise that resolves when the pass has
|
|
43
|
+
* been successfully presented to the user.
|
|
44
|
+
*/
|
|
45
|
+
static async present(pass) {
|
|
46
|
+
await NativePlugin.present({ pass });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
class ActitoLoyaltyPluginWeb extends core.WebPlugin {
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
|
+
fetchPassBySerial(_options) {
|
|
53
|
+
throw this.unimplemented('Not implemented on web.');
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
56
|
+
fetchPassByBarcode(_options) {
|
|
57
|
+
throw this.unimplemented('Not implemented on web.');
|
|
58
|
+
}
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
60
|
+
present(_options) {
|
|
61
|
+
throw this.unimplemented('Not implemented on web.');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
66
|
+
__proto__: null,
|
|
67
|
+
ActitoLoyaltyPluginWeb: ActitoLoyaltyPluginWeb
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
exports.ActitoLoyalty = ActitoLoyalty;
|
|
71
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/plugin.js","esm/actito-loyalty.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nexport const NativePlugin = registerPlugin('ActitoLoyaltyPlugin', {\n web: () => import('./web').then((m) => new m.ActitoLoyaltyPluginWeb()),\n});\n//# sourceMappingURL=plugin.js.map","import { NativePlugin } from './plugin';\nexport class ActitoLoyalty {\n //\n // Methods\n //\n /**\n * Fetches a pass by its serial number.\n *\n * @param {string} serial - The serial number of the pass to be fetched.\n * @return {Promise<ActitoPass>} - A promise that resolves to the fetched\n * {@link ActitoPass} corresponding to the given serial number.\n */\n static async fetchPassBySerial(serial) {\n const { result } = await NativePlugin.fetchPassBySerial({ serial });\n return result;\n }\n /**\n * Fetches a pass by its barcode.\n *\n * @param {string} barcode - The barcode of the pass to be fetched.\n * @return {Promise<ActitoPass>} - A promise that resolves to the fetched\n * {@link ActitoPass} corresponding to the given barcode.\n */\n static async fetchPassByBarcode(barcode) {\n const { result } = await NativePlugin.fetchPassByBarcode({ barcode });\n return result;\n }\n /**\n * Presents a pass to the user.\n *\n * @param {ActitoPass} pass - The {@link ActitoPass} to be presented\n * to the user.\n * @returns {Promise<void>} - A promise that resolves when the pass has\n * been successfully presented to the user.\n */\n static async present(pass) {\n await NativePlugin.present({ pass });\n }\n}\n//# sourceMappingURL=actito-loyalty.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ActitoLoyaltyPluginWeb extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fetchPassBySerial(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fetchPassByBarcode(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n present(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACO,MAAM,YAAY,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;AAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;AAC1E,CAAC,CAAC;;ACFK,MAAM,aAAa,CAAC;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,iBAAiB,CAAC,MAAM,EAAE;AAC3C,QAAQ,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AAC5E,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,kBAAkB,CAAC,OAAO,EAAE;AAC7C,QAAQ,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAC9E,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,OAAO,CAAC,IAAI,EAAE;AAC/B,QAAQ,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7C,KAAK;AACL;;ACrCO,MAAM,sBAAsB,SAASC,cAAS,CAAC;AACtD;AACA,IAAI,iBAAiB,CAAC,QAAQ,EAAE;AAChC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL;AACA,IAAI,kBAAkB,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL;AACA,IAAI,OAAO,CAAC,QAAQ,EAAE;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AAC5D,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var capacitorActitoLoyaltyPlugin = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const NativePlugin = core.registerPlugin('ActitoLoyaltyPlugin', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.ActitoLoyaltyPluginWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class ActitoLoyalty {
|
|
9
|
+
//
|
|
10
|
+
// Methods
|
|
11
|
+
//
|
|
12
|
+
/**
|
|
13
|
+
* Fetches a pass by its serial number.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} serial - The serial number of the pass to be fetched.
|
|
16
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
17
|
+
* {@link ActitoPass} corresponding to the given serial number.
|
|
18
|
+
*/
|
|
19
|
+
static async fetchPassBySerial(serial) {
|
|
20
|
+
const { result } = await NativePlugin.fetchPassBySerial({ serial });
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetches a pass by its barcode.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} barcode - The barcode of the pass to be fetched.
|
|
27
|
+
* @return {Promise<ActitoPass>} - A promise that resolves to the fetched
|
|
28
|
+
* {@link ActitoPass} corresponding to the given barcode.
|
|
29
|
+
*/
|
|
30
|
+
static async fetchPassByBarcode(barcode) {
|
|
31
|
+
const { result } = await NativePlugin.fetchPassByBarcode({ barcode });
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Presents a pass to the user.
|
|
36
|
+
*
|
|
37
|
+
* @param {ActitoPass} pass - The {@link ActitoPass} to be presented
|
|
38
|
+
* to the user.
|
|
39
|
+
* @returns {Promise<void>} - A promise that resolves when the pass has
|
|
40
|
+
* been successfully presented to the user.
|
|
41
|
+
*/
|
|
42
|
+
static async present(pass) {
|
|
43
|
+
await NativePlugin.present({ pass });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
class ActitoLoyaltyPluginWeb extends core.WebPlugin {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
|
+
fetchPassBySerial(_options) {
|
|
50
|
+
throw this.unimplemented('Not implemented on web.');
|
|
51
|
+
}
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
|
+
fetchPassByBarcode(_options) {
|
|
54
|
+
throw this.unimplemented('Not implemented on web.');
|
|
55
|
+
}
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
|
+
present(_options) {
|
|
58
|
+
throw this.unimplemented('Not implemented on web.');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
63
|
+
__proto__: null,
|
|
64
|
+
ActitoLoyaltyPluginWeb: ActitoLoyaltyPluginWeb
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
exports.ActitoLoyalty = ActitoLoyalty;
|
|
68
|
+
|
|
69
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
70
|
+
|
|
71
|
+
return exports;
|
|
72
|
+
|
|
73
|
+
})({}, capacitorExports);
|
|
74
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/plugin.js","esm/actito-loyalty.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nexport const NativePlugin = registerPlugin('ActitoLoyaltyPlugin', {\n web: () => import('./web').then((m) => new m.ActitoLoyaltyPluginWeb()),\n});\n//# sourceMappingURL=plugin.js.map","import { NativePlugin } from './plugin';\nexport class ActitoLoyalty {\n //\n // Methods\n //\n /**\n * Fetches a pass by its serial number.\n *\n * @param {string} serial - The serial number of the pass to be fetched.\n * @return {Promise<ActitoPass>} - A promise that resolves to the fetched\n * {@link ActitoPass} corresponding to the given serial number.\n */\n static async fetchPassBySerial(serial) {\n const { result } = await NativePlugin.fetchPassBySerial({ serial });\n return result;\n }\n /**\n * Fetches a pass by its barcode.\n *\n * @param {string} barcode - The barcode of the pass to be fetched.\n * @return {Promise<ActitoPass>} - A promise that resolves to the fetched\n * {@link ActitoPass} corresponding to the given barcode.\n */\n static async fetchPassByBarcode(barcode) {\n const { result } = await NativePlugin.fetchPassByBarcode({ barcode });\n return result;\n }\n /**\n * Presents a pass to the user.\n *\n * @param {ActitoPass} pass - The {@link ActitoPass} to be presented\n * to the user.\n * @returns {Promise<void>} - A promise that resolves when the pass has\n * been successfully presented to the user.\n */\n static async present(pass) {\n await NativePlugin.present({ pass });\n }\n}\n//# sourceMappingURL=actito-loyalty.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ActitoLoyaltyPluginWeb extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fetchPassBySerial(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fetchPassByBarcode(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n present(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IACO,MAAM,YAAY,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;IAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;IAC1E,CAAC,CAAC;;ICFK,MAAM,aAAa,CAAC;IAC3B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,aAAa,iBAAiB,CAAC,MAAM,EAAE;IAC3C,QAAQ,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5E,QAAQ,OAAO,MAAM,CAAC;IACtB,KAAK;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,aAAa,kBAAkB,CAAC,OAAO,EAAE;IAC7C,QAAQ,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9E,QAAQ,OAAO,MAAM,CAAC;IACtB,KAAK;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,aAAa,OAAO,CAAC,IAAI,EAAE;IAC/B,QAAQ,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,KAAK;IACL;;ICrCO,MAAM,sBAAsB,SAASC,cAAS,CAAC;IACtD;IACA,IAAI,iBAAiB,CAAC,QAAQ,EAAE;IAChC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL;IACA,IAAI,kBAAkB,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL;IACA,IAAI,OAAO,CAAC,QAAQ,EAAE;IACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import ActitoKit
|
|
2
|
+
import ActitoLoyaltyKit
|
|
3
|
+
import Capacitor
|
|
4
|
+
import Foundation
|
|
5
|
+
|
|
6
|
+
@objc(ActitoLoyaltyPlugin)
|
|
7
|
+
public class ActitoLoyaltyPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
8
|
+
public let identifier = "ActitoLoyaltyPlugin"
|
|
9
|
+
public let jsName = "ActitoLoyaltyPlugin"
|
|
10
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
11
|
+
CAPPluginMethod(name: "fetchPassBySerial", returnType: CAPPluginReturnPromise),
|
|
12
|
+
CAPPluginMethod(name: "fetchPassByBarcode", returnType: CAPPluginReturnPromise),
|
|
13
|
+
CAPPluginMethod(name: "present", returnType: CAPPluginReturnPromise),
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
private var rootViewController: UIViewController? {
|
|
17
|
+
get {
|
|
18
|
+
UIApplication.shared.delegate?.window??.rootViewController
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objc func fetchPassBySerial(_ call: CAPPluginCall) {
|
|
23
|
+
guard let serial = call.getString("serial") else {
|
|
24
|
+
call.reject("Missing 'serial' parameter.")
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
DispatchQueue.main.async {
|
|
29
|
+
Actito.shared.loyalty().fetchPass(serial: serial) { result in
|
|
30
|
+
switch result {
|
|
31
|
+
case let .success(pass):
|
|
32
|
+
do {
|
|
33
|
+
call.resolve([
|
|
34
|
+
"result": try pass.toJson()
|
|
35
|
+
])
|
|
36
|
+
} catch {
|
|
37
|
+
call.reject(error.localizedDescription)
|
|
38
|
+
}
|
|
39
|
+
case let .failure(error):
|
|
40
|
+
call.reject(error.localizedDescription)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@objc func fetchPassByBarcode(_ call: CAPPluginCall) {
|
|
47
|
+
guard let barcode = call.getString("barcode") else {
|
|
48
|
+
call.reject("Missing 'barcode' parameter.")
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
DispatchQueue.main.async {
|
|
53
|
+
Actito.shared.loyalty().fetchPass(barcode: barcode) { result in
|
|
54
|
+
switch result {
|
|
55
|
+
case let .success(pass):
|
|
56
|
+
do {
|
|
57
|
+
call.resolve([
|
|
58
|
+
"result": try pass.toJson()
|
|
59
|
+
])
|
|
60
|
+
} catch {
|
|
61
|
+
call.reject(error.localizedDescription)
|
|
62
|
+
}
|
|
63
|
+
case let .failure(error):
|
|
64
|
+
call.reject(error.localizedDescription)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@objc func present(_ call: CAPPluginCall) {
|
|
71
|
+
guard let json = call.getObject("pass") else {
|
|
72
|
+
call.reject("Missing 'pass' parameter.")
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let pass: ActitoPass
|
|
77
|
+
|
|
78
|
+
do {
|
|
79
|
+
pass = try ActitoPass.fromJson(json: json)
|
|
80
|
+
} catch {
|
|
81
|
+
call.reject(error.localizedDescription)
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
DispatchQueue.main.async {
|
|
86
|
+
guard let rootViewController = self.rootViewController else {
|
|
87
|
+
call.reject("Cannot present a pass with a nil root view controller.")
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
Actito.shared.loyalty().present(pass: pass, in: rootViewController)
|
|
92
|
+
call.resolve()
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "capacitor-actito-loyalty",
|
|
3
|
+
"version": "5.0.0-beta.2",
|
|
4
|
+
"description": "Actito Loyalty Capacitor plugin.",
|
|
5
|
+
"author": "Actito <mobile@actito.com> (https://actito.com)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/actito/actito-sdk-ionic-native#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Actito/actito-sdk-ionic-native.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Actito/actito-sdk-ionic-native/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"actito",
|
|
17
|
+
"ionic-native",
|
|
18
|
+
"capacitor",
|
|
19
|
+
"ios",
|
|
20
|
+
"android"
|
|
21
|
+
],
|
|
22
|
+
"main": "dist/plugin.cjs.js",
|
|
23
|
+
"module": "dist/esm/index.js",
|
|
24
|
+
"types": "dist/esm/index.d.ts",
|
|
25
|
+
"unpkg": "dist/plugin.js",
|
|
26
|
+
"files": [
|
|
27
|
+
"android/src/main/",
|
|
28
|
+
"android/build.gradle",
|
|
29
|
+
"dist/",
|
|
30
|
+
"ios/Sources",
|
|
31
|
+
"Package.swift",
|
|
32
|
+
"CapacitorActitoLoyalty.podspec",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"MIGRATION.md"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "yarn clean && tsc && rollup -c rollup.config.js",
|
|
38
|
+
"clean": "rimraf ./dist",
|
|
39
|
+
"typescript": "tsc --noEmit",
|
|
40
|
+
"verify": "yarn verify:android && yarn verify:ios && yarn verify:web",
|
|
41
|
+
"verify:android": "cd android && ./gradlew clean build && cd ..",
|
|
42
|
+
"verify:ios": "xcodebuild -scheme CapacitorActitoLoyalty -destination generic/platform=iOS",
|
|
43
|
+
"verify:web": "yarn build",
|
|
44
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
45
|
+
"pack": "npm pack",
|
|
46
|
+
"prepack": "yarn build; yarn docs:replace-symbolic-links",
|
|
47
|
+
"postpack": "yarn docs:create-symbolic-links",
|
|
48
|
+
"prepare": "yarn build",
|
|
49
|
+
"docs:create-symbolic-links": "rm README.md CHANGELOG.md MIGRATION.md; ln -s ../../README.md ../../CHANGELOG.md ../../MIGRATION.md .",
|
|
50
|
+
"docs:replace-symbolic-links": "rm README.md CHANGELOG.md MIGRATION.md; cp ../../README.md ../../CHANGELOG.md ../../MIGRATION.md ."
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@capacitor/core": "3 - 7",
|
|
54
|
+
"capacitor-actito": "5.0.0-beta.2"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@capacitor/android": "^3.0.0",
|
|
58
|
+
"@capacitor/core": "^3.0.0",
|
|
59
|
+
"@capacitor/docgen": "^0.0.18",
|
|
60
|
+
"@capacitor/ios": "^3.0.0",
|
|
61
|
+
"capacitor-actito": "5.0.0-beta.2",
|
|
62
|
+
"rimraf": "^3.0.2",
|
|
63
|
+
"rollup": "^2.79.2",
|
|
64
|
+
"typescript": "^4.5.4"
|
|
65
|
+
},
|
|
66
|
+
"capacitor": {
|
|
67
|
+
"ios": {
|
|
68
|
+
"src": "ios"
|
|
69
|
+
},
|
|
70
|
+
"android": {
|
|
71
|
+
"src": "android"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"gitHead": "8a12edd857ad3b8f9245683a19b5fe89ce2e51f6"
|
|
75
|
+
}
|