react-native-sdk-pianoio 0.3.1 → 0.3.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.
- package/README.md +176 -186
- package/android/build.gradle +29 -42
- package/android/gradle.properties +33 -14
- package/android/src/main/java/com/sdkpianoio/ComposerPianoImpl.kt +366 -0
- package/android/src/main/java/com/sdkpianoio/SdkPianoioModule.kt +281 -507
- package/android/src/main/java/com/sdkpianoio/TokenService.kt +139 -0
- package/android/test.sh +494 -0
- package/ios/ComposerPianoImpl.swift +128 -225
- package/ios/MyComposerDelegate.swift +142 -109
- package/ios/SdkPianoio.swift +69 -143
- package/ios/SdkPianoioBridge.m +18 -46
- package/ios/TokenService.swift +219 -0
- package/lib/commonjs/NativeSdkPianoio.ts +35 -22
- package/lib/commonjs/PianoComposer.js +89 -132
- package/lib/commonjs/PianoComposer.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeSdkPianoio.ts +35 -22
- package/lib/module/PianoComposer.js +90 -132
- package/lib/module/PianoComposer.js.map +1 -1
- package/lib/module/index.js +0 -14
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeSdkPianoio.d.ts +28 -21
- package/lib/typescript/commonjs/src/NativeSdkPianoio.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/PianoComposer.d.ts +55 -31
- package/lib/typescript/commonjs/src/PianoComposer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeSdkPianoio.d.ts +28 -21
- package/lib/typescript/module/src/NativeSdkPianoio.d.ts.map +1 -1
- package/lib/typescript/module/src/PianoComposer.d.ts +55 -31
- package/lib/typescript/module/src/PianoComposer.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/NativeSdkPianoio.ts +35 -22
- package/src/PianoComposer.tsx +78 -141
- package/src/index.tsx +0 -14
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/ios/services/TokenService.swift +0 -70
@@ -6,158 +6,115 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = void 0;
|
7
7
|
var _NativeSdkPianoio = _interopRequireDefault(require("./NativeSdkPianoio"));
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
|
+
/**
|
10
|
+
* A wrapper class for the native SdkPianoio module that provides a clean,
|
11
|
+
* object-oriented API for interacting with the Piano SDK.
|
12
|
+
*/
|
9
13
|
class PianoComposer {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
customVariables = {};
|
14
|
-
userToken = null;
|
15
|
-
url = null;
|
16
|
-
constructor(aid) {
|
17
|
-
this.aid = aid;
|
14
|
+
// The constructor is private to force users to use the async `create` method.
|
15
|
+
constructor() {
|
16
|
+
// This constructor is intentionally empty.
|
18
17
|
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Creates and initializes a new PianoComposer instance.
|
21
|
+
* This is the main entry point for using the library.
|
22
|
+
* @param aid Your Application ID from Piano.io
|
23
|
+
*/
|
19
24
|
static async create(aid) {
|
20
|
-
|
21
|
-
|
25
|
+
// Call the corrected native initialize method
|
26
|
+
await _NativeSdkPianoio.default.initialize(aid);
|
27
|
+
return new PianoComposer();
|
22
28
|
}
|
29
|
+
|
30
|
+
// --- Configuration Methods ---
|
31
|
+
|
23
32
|
async addTag(tag) {
|
24
|
-
|
25
|
-
return _NativeSdkPianoio.default.addComposerTag(tag);
|
33
|
+
return _NativeSdkPianoio.default.addTag(tag);
|
26
34
|
}
|
27
35
|
async addTags(tags) {
|
28
|
-
|
29
|
-
return _NativeSdkPianoio.default.addComposerTags(tags);
|
36
|
+
return _NativeSdkPianoio.default.addTags(tags);
|
30
37
|
}
|
31
38
|
async setZoneId(zoneId) {
|
32
|
-
|
33
|
-
return _NativeSdkPianoio.default.setComposerZoneId(zoneId);
|
39
|
+
return _NativeSdkPianoio.default.setZoneId(zoneId);
|
34
40
|
}
|
35
41
|
async setReferrer(referrer) {
|
36
|
-
|
37
|
-
return _NativeSdkPianoio.default.setComposerReferrer(referrer);
|
42
|
+
return _NativeSdkPianoio.default.setReferrer(referrer);
|
38
43
|
}
|
39
44
|
async setCustomVariable(name, value) {
|
40
|
-
|
41
|
-
|
45
|
+
return _NativeSdkPianoio.default.addCustomVariable(name, value);
|
46
|
+
}
|
47
|
+
async setCustomVariables(variables) {
|
48
|
+
return _NativeSdkPianoio.default.setCustomVariables(variables);
|
42
49
|
}
|
43
50
|
async setUserToken(token) {
|
44
|
-
|
45
|
-
return _NativeSdkPianoio.default.setComposerUserToken(token);
|
51
|
+
return _NativeSdkPianoio.default.setUserToken(token);
|
46
52
|
}
|
47
53
|
async setUrl(url) {
|
48
|
-
|
49
|
-
|
54
|
+
return _NativeSdkPianoio.default.setUrl(url);
|
55
|
+
}
|
56
|
+
|
57
|
+
// --- Authentication Methods ---
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Signs in the user with Piano.
|
61
|
+
* @returns A promise that resolves with user information.
|
62
|
+
*/
|
63
|
+
async signIn() {
|
64
|
+
return _NativeSdkPianoio.default.signIn();
|
50
65
|
}
|
51
|
-
|
52
|
-
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Signs out the current user.
|
69
|
+
* @returns A promise that resolves when sign out is complete.
|
70
|
+
*/
|
71
|
+
async signOut() {
|
72
|
+
return _NativeSdkPianoio.default.signOut();
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Gets information about the current authenticated user.
|
77
|
+
* @returns A promise that resolves with user information.
|
78
|
+
*/
|
79
|
+
async getCurrentUser() {
|
80
|
+
return _NativeSdkPianoio.default.getCurrentUser();
|
53
81
|
}
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Checks if a user is currently authenticated.
|
85
|
+
* @returns A promise that resolves with the authentication status.
|
86
|
+
*/
|
87
|
+
async isAuthenticated() {
|
88
|
+
return _NativeSdkPianoio.default.isAuthenticated();
|
89
|
+
}
|
90
|
+
|
91
|
+
// --- Core Execution Method ---
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Executes the Piano experience with the current configuration.
|
95
|
+
* This is the primary method to get a decision from the Piano backend.
|
96
|
+
* @returns A promise that resolves with the event data object from the native SDK.
|
97
|
+
*/
|
54
98
|
async executeExperience() {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
async
|
73
|
-
return _NativeSdkPianoio.default.
|
74
|
-
}
|
75
|
-
async showLogin() {
|
76
|
-
try {
|
77
|
-
await _NativeSdkPianoio.default.showLogin();
|
78
|
-
console.log('Login triggered');
|
79
|
-
} catch (e) {
|
80
|
-
console.error('Errore nel login:', e);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
async showTemplate() {
|
84
|
-
try {
|
85
|
-
await _NativeSdkPianoio.default.showTemplate();
|
86
|
-
console.log('Template triggered');
|
87
|
-
} catch (e) {
|
88
|
-
console.error('Errore nel Template:', e);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
async showRecommendations() {
|
92
|
-
try {
|
93
|
-
await _NativeSdkPianoio.default.showRecommendations();
|
94
|
-
console.log('showRecommendations triggered');
|
95
|
-
} catch (e) {
|
96
|
-
console.error('Errore nel Template:', e);
|
97
|
-
}
|
98
|
-
}
|
99
|
-
async nonSite() {
|
100
|
-
try {
|
101
|
-
await _NativeSdkPianoio.default.nonSite();
|
102
|
-
console.log('nonSite triggered');
|
103
|
-
} catch (e) {
|
104
|
-
console.error('Errore nel Template:', e);
|
105
|
-
}
|
106
|
-
}
|
107
|
-
async userSegmentTrue() {
|
108
|
-
try {
|
109
|
-
await _NativeSdkPianoio.default.userSegmentTrue();
|
110
|
-
console.log('userSegmentTrue triggered');
|
111
|
-
} catch (e) {
|
112
|
-
console.error('Errore nel userSegmentTrue:', e);
|
113
|
-
}
|
114
|
-
}
|
115
|
-
async userSegmentFalse() {
|
116
|
-
try {
|
117
|
-
await _NativeSdkPianoio.default.userSegmentFalse();
|
118
|
-
console.log('userSegmentFalse triggered');
|
119
|
-
} catch (e) {
|
120
|
-
console.error('Errore nel userSegmentFalse:', e);
|
121
|
-
}
|
122
|
-
}
|
123
|
-
async meterActive() {
|
124
|
-
try {
|
125
|
-
await _NativeSdkPianoio.default.meterActive();
|
126
|
-
console.log('Template meterActive');
|
127
|
-
} catch (e) {
|
128
|
-
console.error('Errore nel meterActive:', e);
|
129
|
-
}
|
130
|
-
}
|
131
|
-
async meterExpired() {
|
132
|
-
try {
|
133
|
-
await _NativeSdkPianoio.default.meterExpired();
|
134
|
-
console.log('meterExpired triggered');
|
135
|
-
} catch (e) {
|
136
|
-
console.error('Errore nel meterExpired:', e);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
static async isInitialized() {
|
140
|
-
try {
|
141
|
-
const result = await _NativeSdkPianoio.default.getComposer();
|
142
|
-
return result !== null;
|
143
|
-
} catch (e) {
|
144
|
-
return false;
|
145
|
-
}
|
146
|
-
}
|
147
|
-
static async getComposerFromSdkIOS() {
|
148
|
-
const result = await _NativeSdkPianoio.default.getComposer();
|
149
|
-
return result;
|
150
|
-
}
|
151
|
-
async toString() {
|
152
|
-
return `PianoComposer {
|
153
|
-
aid: ${this.aid},
|
154
|
-
tags: ${this.tags},
|
155
|
-
zoneId: ${this.zoneId},
|
156
|
-
referrer: ${this.referrer},
|
157
|
-
customVariables: ${JSON.stringify(this.customVariables)},
|
158
|
-
userToken: ${this.userToken},
|
159
|
-
url: ${this.url}
|
160
|
-
}`;
|
99
|
+
return _NativeSdkPianoio.default.executeExperience();
|
100
|
+
}
|
101
|
+
|
102
|
+
// --- Utility and Cleanup Methods ---
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Gets the current status of the SDK.
|
106
|
+
* @returns A promise that resolves with status information.
|
107
|
+
*/
|
108
|
+
async getStatus() {
|
109
|
+
return _NativeSdkPianoio.default.getStatus();
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Clears all configured tags and custom variables.
|
114
|
+
* @returns A promise that resolves when the configuration is cleared.
|
115
|
+
*/
|
116
|
+
async clearConfiguration() {
|
117
|
+
return _NativeSdkPianoio.default.clearConfiguration();
|
161
118
|
}
|
162
119
|
}
|
163
120
|
var _default = exports.default = PianoComposer;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_NativeSdkPianoio","_interopRequireDefault","require","e","__esModule","default","PianoComposer","
|
1
|
+
{"version":3,"names":["_NativeSdkPianoio","_interopRequireDefault","require","e","__esModule","default","PianoComposer","constructor","create","aid","SdkPianoio","initialize","addTag","tag","addTags","tags","setZoneId","zoneId","setReferrer","referrer","setCustomVariable","name","value","addCustomVariable","setCustomVariables","variables","setUserToken","token","setUrl","url","signIn","signOut","getCurrentUser","isAuthenticated","executeExperience","getStatus","clearConfiguration","_default","exports"],"sourceRoot":"../../src","sources":["PianoComposer.tsx"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C;AACA;AACA;AACA;AACA,MAAMG,aAAa,CAAC;EAClB;EACQC,WAAWA,CAAA,EAAG;IACpB;EAAA;;EAGF;AACF;AACA;AACA;AACA;EACE,aAAaC,MAAMA,CAACC,GAAW,EAA0B;IACvD;IACA,MAAMC,yBAAU,CAACC,UAAU,CAACF,GAAG,CAAC;IAChC,OAAO,IAAIH,aAAa,CAAC,CAAC;EAC5B;;EAEA;;EAEA,MAAMM,MAAMA,CAACC,GAAW,EAAoB;IAC1C,OAAOH,yBAAU,CAACE,MAAM,CAACC,GAAG,CAAC;EAC/B;EAEA,MAAMC,OAAOA,CAACC,IAAc,EAAoB;IAC9C,OAA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ACvC;;EAEA;;EAEA;AACF;AACA;AACA;EACE,MAAMC,SAASA,CAAA,EAAiB;IAC9B,OAAOzB,yBAAU,CAACyB,SAAS,CAAC,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;EACE,MAAMC,kBAAkBA,CAAA,EAAqB;IAC3C,OAAO1B,yBAAU,CAAC0B,kBAAkB,CAAC,CAAC;EACxC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjC,OAAA,GAEcC,aAAa","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_PianoComposer","_interopRequireDefault","require","_debug","e","__esModule","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"names":["_PianoComposer","_interopRequireDefault","require","_debug","e","__esModule","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAA4C,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
@@ -1,28 +1,41 @@
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
2
2
|
|
3
|
+
/**
|
4
|
+
* This interface defines the full API surface of the native module.
|
5
|
+
* It is a complete and accurate representation of the methods exposed
|
6
|
+
* in SdkPianoioModule.kt.
|
7
|
+
*/
|
3
8
|
interface SdkPianoioType {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
9
|
+
// Initialization
|
10
|
+
initialize(aid: string): Promise<boolean>;
|
11
|
+
|
12
|
+
// Configuration
|
13
|
+
addTag(tag: string): Promise<boolean>;
|
14
|
+
addTags(tags: string[]): Promise<boolean>;
|
15
|
+
setZoneId(zoneId: string): Promise<boolean>;
|
16
|
+
setReferrer(referrer: string): Promise<boolean>;
|
17
|
+
setUrl(url: string): Promise<boolean>;
|
18
|
+
setUserToken(token: string): Promise<boolean>;
|
19
|
+
addCustomVariable(key: string, value: string): Promise<boolean>;
|
20
|
+
setCustomVariables(variables: { [key: string]: string }): Promise<boolean>;
|
21
|
+
|
22
|
+
// Execution
|
23
|
+
executeExperience(): Promise<any>;
|
24
|
+
|
25
|
+
// Authentication
|
26
|
+
signIn(): Promise<any>;
|
27
|
+
signOut(): Promise<any>;
|
28
|
+
getCurrentUser(): Promise<any>;
|
29
|
+
isAuthenticated(): Promise<any>;
|
30
|
+
|
31
|
+
// Status & Cleanup
|
32
|
+
getStatus(): Promise<any>;
|
33
|
+
isInitialized(): Promise<boolean>;
|
34
|
+
clearConfiguration(): Promise<boolean>;
|
35
|
+
removeTag(tag: string): Promise<boolean>;
|
36
|
+
removeCustomVariable(key: string): Promise<boolean>;
|
37
|
+
clearTags(): Promise<boolean>;
|
38
|
+
clearCustomVariables(): Promise<boolean>;
|
26
39
|
}
|
27
40
|
|
28
41
|
const SdkPianoio = NativeModules.SdkPianoio;
|
@@ -1,158 +1,116 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import SdkPianoio from './NativeSdkPianoio';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* A wrapper class for the native SdkPianoio module that provides a clean,
|
7
|
+
* object-oriented API for interacting with the Piano SDK.
|
8
|
+
*/
|
4
9
|
class PianoComposer {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
customVariables = {};
|
9
|
-
userToken = null;
|
10
|
-
url = null;
|
11
|
-
constructor(aid) {
|
12
|
-
this.aid = aid;
|
10
|
+
// The constructor is private to force users to use the async `create` method.
|
11
|
+
constructor() {
|
12
|
+
// This constructor is intentionally empty.
|
13
13
|
}
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Creates and initializes a new PianoComposer instance.
|
17
|
+
* This is the main entry point for using the library.
|
18
|
+
* @param aid Your Application ID from Piano.io
|
19
|
+
*/
|
14
20
|
static async create(aid) {
|
15
|
-
|
16
|
-
|
21
|
+
// Call the corrected native initialize method
|
22
|
+
await SdkPianoio.initialize(aid);
|
23
|
+
return new PianoComposer();
|
17
24
|
}
|
25
|
+
|
26
|
+
// --- Configuration Methods ---
|
27
|
+
|
18
28
|
async addTag(tag) {
|
19
|
-
|
20
|
-
return SdkPianoio.addComposerTag(tag);
|
29
|
+
return SdkPianoio.addTag(tag);
|
21
30
|
}
|
22
31
|
async addTags(tags) {
|
23
|
-
|
24
|
-
return SdkPianoio.addComposerTags(tags);
|
32
|
+
return SdkPianoio.addTags(tags);
|
25
33
|
}
|
26
34
|
async setZoneId(zoneId) {
|
27
|
-
|
28
|
-
return SdkPianoio.setComposerZoneId(zoneId);
|
35
|
+
return SdkPianoio.setZoneId(zoneId);
|
29
36
|
}
|
30
37
|
async setReferrer(referrer) {
|
31
|
-
|
32
|
-
return SdkPianoio.setComposerReferrer(referrer);
|
38
|
+
return SdkPianoio.setReferrer(referrer);
|
33
39
|
}
|
34
40
|
async setCustomVariable(name, value) {
|
35
|
-
|
36
|
-
|
41
|
+
return SdkPianoio.addCustomVariable(name, value);
|
42
|
+
}
|
43
|
+
async setCustomVariables(variables) {
|
44
|
+
return SdkPianoio.setCustomVariables(variables);
|
37
45
|
}
|
38
46
|
async setUserToken(token) {
|
39
|
-
|
40
|
-
return SdkPianoio.setComposerUserToken(token);
|
47
|
+
return SdkPianoio.setUserToken(token);
|
41
48
|
}
|
42
49
|
async setUrl(url) {
|
43
|
-
|
44
|
-
|
50
|
+
return SdkPianoio.setUrl(url);
|
51
|
+
}
|
52
|
+
|
53
|
+
// --- Authentication Methods ---
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Signs in the user with Piano.
|
57
|
+
* @returns A promise that resolves with user information.
|
58
|
+
*/
|
59
|
+
async signIn() {
|
60
|
+
return SdkPianoio.signIn();
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Signs out the current user.
|
65
|
+
* @returns A promise that resolves when sign out is complete.
|
66
|
+
*/
|
67
|
+
async signOut() {
|
68
|
+
return SdkPianoio.signOut();
|
45
69
|
}
|
46
|
-
|
47
|
-
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Gets information about the current authenticated user.
|
73
|
+
* @returns A promise that resolves with user information.
|
74
|
+
*/
|
75
|
+
async getCurrentUser() {
|
76
|
+
return SdkPianoio.getCurrentUser();
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Checks if a user is currently authenticated.
|
81
|
+
* @returns A promise that resolves with the authentication status.
|
82
|
+
*/
|
83
|
+
async isAuthenticated() {
|
84
|
+
return SdkPianoio.isAuthenticated();
|
48
85
|
}
|
86
|
+
|
87
|
+
// --- Core Execution Method ---
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Executes the Piano experience with the current configuration.
|
91
|
+
* This is the primary method to get a decision from the Piano backend.
|
92
|
+
* @returns A promise that resolves with the event data object from the native SDK.
|
93
|
+
*/
|
49
94
|
async executeExperience() {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
async
|
68
|
-
return SdkPianoio.
|
69
|
-
}
|
70
|
-
async showLogin() {
|
71
|
-
try {
|
72
|
-
await SdkPianoio.showLogin();
|
73
|
-
console.log('Login triggered');
|
74
|
-
} catch (e) {
|
75
|
-
console.error('Errore nel login:', e);
|
76
|
-
}
|
77
|
-
}
|
78
|
-
async showTemplate() {
|
79
|
-
try {
|
80
|
-
await SdkPianoio.showTemplate();
|
81
|
-
console.log('Template triggered');
|
82
|
-
} catch (e) {
|
83
|
-
console.error('Errore nel Template:', e);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
async showRecommendations() {
|
87
|
-
try {
|
88
|
-
await SdkPianoio.showRecommendations();
|
89
|
-
console.log('showRecommendations triggered');
|
90
|
-
} catch (e) {
|
91
|
-
console.error('Errore nel Template:', e);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
async nonSite() {
|
95
|
-
try {
|
96
|
-
await SdkPianoio.nonSite();
|
97
|
-
console.log('nonSite triggered');
|
98
|
-
} catch (e) {
|
99
|
-
console.error('Errore nel Template:', e);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
async userSegmentTrue() {
|
103
|
-
try {
|
104
|
-
await SdkPianoio.userSegmentTrue();
|
105
|
-
console.log('userSegmentTrue triggered');
|
106
|
-
} catch (e) {
|
107
|
-
console.error('Errore nel userSegmentTrue:', e);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
async userSegmentFalse() {
|
111
|
-
try {
|
112
|
-
await SdkPianoio.userSegmentFalse();
|
113
|
-
console.log('userSegmentFalse triggered');
|
114
|
-
} catch (e) {
|
115
|
-
console.error('Errore nel userSegmentFalse:', e);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
async meterActive() {
|
119
|
-
try {
|
120
|
-
await SdkPianoio.meterActive();
|
121
|
-
console.log('Template meterActive');
|
122
|
-
} catch (e) {
|
123
|
-
console.error('Errore nel meterActive:', e);
|
124
|
-
}
|
125
|
-
}
|
126
|
-
async meterExpired() {
|
127
|
-
try {
|
128
|
-
await SdkPianoio.meterExpired();
|
129
|
-
console.log('meterExpired triggered');
|
130
|
-
} catch (e) {
|
131
|
-
console.error('Errore nel meterExpired:', e);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
static async isInitialized() {
|
135
|
-
try {
|
136
|
-
const result = await SdkPianoio.getComposer();
|
137
|
-
return result !== null;
|
138
|
-
} catch (e) {
|
139
|
-
return false;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
static async getComposerFromSdkIOS() {
|
143
|
-
const result = await SdkPianoio.getComposer();
|
144
|
-
return result;
|
145
|
-
}
|
146
|
-
async toString() {
|
147
|
-
return `PianoComposer {
|
148
|
-
aid: ${this.aid},
|
149
|
-
tags: ${this.tags},
|
150
|
-
zoneId: ${this.zoneId},
|
151
|
-
referrer: ${this.referrer},
|
152
|
-
customVariables: ${JSON.stringify(this.customVariables)},
|
153
|
-
userToken: ${this.userToken},
|
154
|
-
url: ${this.url}
|
155
|
-
}`;
|
95
|
+
return SdkPianoio.executeExperience();
|
96
|
+
}
|
97
|
+
|
98
|
+
// --- Utility and Cleanup Methods ---
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Gets the current status of the SDK.
|
102
|
+
* @returns A promise that resolves with status information.
|
103
|
+
*/
|
104
|
+
async getStatus() {
|
105
|
+
return SdkPianoio.getStatus();
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Clears all configured tags and custom variables.
|
110
|
+
* @returns A promise that resolves when the configuration is cleared.
|
111
|
+
*/
|
112
|
+
async clearConfiguration() {
|
113
|
+
return SdkPianoio.clearConfiguration();
|
156
114
|
}
|
157
115
|
}
|
158
116
|
export default PianoComposer;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["SdkPianoio","PianoComposer","
|
1
|
+
{"version":3,"names":["SdkPianoio","PianoComposer","constructor","create","aid","initialize","addTag","tag","addTags","tags","setZoneId","zoneId","setReferrer","referrer","setCustomVariable","name","value","addCustomVariable","setCustomVariables","variables","setUserToken","token","setUrl","url","signIn","signOut","getCurrentUser","isAuthenticated","executeExperience","getStatus","clearConfiguration"],"sourceRoot":"../../src","sources":["PianoComposer.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,oBAAoB;;AAE3C;AACA;AACA;AACA;AACA,MAAMC,aAAa,CAAC;EAClB;EACQC,WAAWA,CAAA,EAAG;IACpB;EAAA;;EAGF;AACF;AACA;AACA;AACA;EACE,aAAaC,MAAMA,CAACC,GAAW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AAC0B,cAAc,CAAC,CAAC;EACpC;;EAEA;AACF;AACA;AACA;EACE,MAAMC,eAAeA,CAAA,EAAiB;IACpC,OAAO3B,UAAU,CAAC2B,eAAe,CAAC,CAAC;EACrC;;EAEA;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAMC,iBAAiBA,CAAA,EAAiB;IACtC,OAAO5B,UAAU,CAAC4B,iBAAiB,CAAC,CAAC;EACvC;;EAEA;;EAEA;AACF;AACA;AACA;EACE,MAAMC,SAASA,CAAA,EAAiB;IAC9B,OAAO7B,UAAU,CAAC6B,SAAS,CAAC,CAAC;EAC/B;;EAEA;AACF;AACA;AACA;EACE,MAAMC,kBAAkBA,CAAA,EAAqB;IAC3C,OAAO9B,UAAU,CAAC8B,kBAAkB,CAAC,CAAC;EACxC;AACF;AAEA,eAAe7B,aAAa","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -1,19 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
// import SdkPianoio from './NativeSdkPianoio';
|
4
3
|
export { default as PianoComposer } from "./PianoComposer.js";
|
5
4
|
export { debugNativeModule } from "./debug.js";
|
6
|
-
|
7
|
-
// export const {
|
8
|
-
// initializeComposer,
|
9
|
-
// getComposer,
|
10
|
-
// addComposerTag,
|
11
|
-
// addComposerTags,
|
12
|
-
// setComposerZoneId,
|
13
|
-
// setComposerReferrer,
|
14
|
-
// setComposerUrl,
|
15
|
-
// setComposerCustomVariable,
|
16
|
-
// setComposerUserToken,
|
17
|
-
// executeComposer
|
18
|
-
// } = SdkPianoio;
|
19
5
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["default","PianoComposer","debugNativeModule"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA
|
1
|
+
{"version":3,"names":["default","PianoComposer","debugNativeModule"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,aAAa,QAAQ,oBAAiB;AAC1D,SAASC,iBAAiB,QAAQ,YAAS","ignoreList":[]}
|