react-native-sdk-pianoio 0.2.1 → 0.2.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.
Files changed (35) hide show
  1. package/README.md +10 -9
  2. package/SdkPianoio.podspec +1 -1
  3. package/android/generated/jni/RNSdkPianoioSpec-generated.cpp +1 -65
  4. package/android/generated/jni/RNSdkPianoioSpec.h +0 -7
  5. package/android/generated/jni/react/renderer/components/RNSdkPianoioSpec/RNSdkPianoioSpecJSI-generated.cpp +0 -72
  6. package/android/generated/jni/react/renderer/components/RNSdkPianoioSpec/RNSdkPianoioSpecJSI.h +0 -133
  7. package/ios/ComposerPiano.swift +124 -9
  8. package/ios/MyComposerDelegate.swift +204 -0
  9. package/ios/SdkPianoio.h +2 -4
  10. package/ios/SdkPianoio.mm +90 -48
  11. package/ios/generated/RNSdkPianoioSpec/RNSdkPianoioSpec-generated.mm +0 -86
  12. package/ios/generated/RNSdkPianoioSpec/RNSdkPianoioSpec.h +0 -52
  13. package/ios/generated/RNSdkPianoioSpecJSI-generated.cpp +0 -72
  14. package/ios/generated/RNSdkPianoioSpecJSI.h +0 -133
  15. package/ios/services/ComposerService.swift +49 -0
  16. package/ios/services/TokenService.swift +67 -0
  17. package/lib/commonjs/NativeSdkPianoio.ts +18 -14
  18. package/lib/commonjs/PianoComposer.js +22 -0
  19. package/lib/commonjs/PianoComposer.js.map +1 -1
  20. package/lib/module/NativeSdkPianoio.ts +18 -14
  21. package/lib/module/PianoComposer.js +22 -0
  22. package/lib/module/PianoComposer.js.map +1 -1
  23. package/lib/typescript/commonjs/src/NativeSdkPianoio.d.ts +16 -13
  24. package/lib/typescript/commonjs/src/NativeSdkPianoio.d.ts.map +1 -1
  25. package/lib/typescript/commonjs/src/PianoComposer.d.ts +13 -9
  26. package/lib/typescript/commonjs/src/PianoComposer.d.ts.map +1 -1
  27. package/lib/typescript/module/src/NativeSdkPianoio.d.ts +16 -13
  28. package/lib/typescript/module/src/NativeSdkPianoio.d.ts.map +1 -1
  29. package/lib/typescript/module/src/PianoComposer.d.ts +13 -9
  30. package/lib/typescript/module/src/PianoComposer.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/NativeSdkPianoio.ts +18 -14
  33. package/src/PianoComposer.tsx +95 -71
  34. package/src/index.tsx +0 -2
  35. package/android/generated/java/com/sdkpianoio/NativeSdkPianoioSpec.java +0 -75
@@ -1,81 +1,105 @@
1
1
  import SdkPianoio from './NativeSdkPianoio';
2
2
 
3
3
  class PianoComposer {
4
- aid: string;
5
- tags: string[] = [];
6
- zoneId: string | null = null;
7
- referrer: string | null = null;
8
- customVariables: { [key: string]: string } = {};
9
- userToken: string | null = null;
10
- url: string | null = null;
11
-
12
-
13
- private constructor(aid: string) {
14
- this.aid = aid;
15
- }
16
-
17
- static async create(aid: string): Promise<PianoComposer> {
18
- await SdkPianoio.initializeComposer(aid);
19
- return new PianoComposer(aid);
20
- }
21
-
22
- async addTag(tag: string) {
23
- this.tags.push(tag);
24
- return SdkPianoio.addComposerTag(tag);
25
- }
26
-
27
- async addTags(tags: string[]) {
28
- this.tags.push(...tags);
29
- return SdkPianoio.addComposerTags(tags);
30
- }
31
-
32
- async setZoneId(zoneId: string) {
33
- this.zoneId = zoneId;
34
- return SdkPianoio.setComposerZoneId(zoneId);
35
- }
36
-
37
- async setReferrer(referrer: string) {
38
- this.referrer = referrer;
39
- return SdkPianoio.setComposerReferrer(referrer);
40
- }
41
-
42
- async setCustomVariable(name: string, value: string) {
43
- this.customVariables[name] = value;
44
-
45
- return SdkPianoio.setComposerCustomVariable(name, value);
46
- }
47
-
48
- async setUserToken(token: string) {
49
- this.userToken = token;
50
- return SdkPianoio.setComposerUserToken(token);
51
- }
4
+ aid: string;
5
+ tags: string[] = [];
6
+ zoneId: string | null = null;
7
+ referrer: string | null = null;
8
+ customVariables: { [key: string]: string } = {};
9
+ userToken: string | null = null;
10
+ url: string | null = null;
52
11
 
53
- async setUrl(url: string) {
54
- this.url = url;
55
- return SdkPianoio.setComposerUrl(url);
56
- }
57
-
58
- async execute() {
59
- return SdkPianoio.executeComposer();
12
+ private constructor(aid: string) {
13
+ this.aid = aid;
14
+ }
15
+
16
+ static async create(aid: string): Promise<PianoComposer> {
17
+ await SdkPianoio.initializeComposer(aid);
18
+ return new PianoComposer(aid);
19
+ }
20
+
21
+ async addTag(tag: string) {
22
+ this.tags.push(tag);
23
+ return SdkPianoio.addComposerTag(tag);
24
+ }
25
+
26
+ async addTags(tags: string[]) {
27
+ this.tags.push(...tags);
28
+ return SdkPianoio.addComposerTags(tags);
29
+ }
30
+
31
+ async setZoneId(zoneId: string) {
32
+ this.zoneId = zoneId;
33
+ return SdkPianoio.setComposerZoneId(zoneId);
34
+ }
35
+
36
+ async setReferrer(referrer: string) {
37
+ this.referrer = referrer;
38
+ return SdkPianoio.setComposerReferrer(referrer);
39
+ }
40
+
41
+ async setCustomVariable(name: string, value: string) {
42
+ this.customVariables[name] = value;
43
+
44
+ return SdkPianoio.setComposerCustomVariable(name, value);
45
+ }
46
+
47
+ async setUserToken(token: string) {
48
+ this.userToken = token;
49
+ return SdkPianoio.setComposerUserToken(token);
50
+ }
51
+
52
+ async setUrl(url: string) {
53
+ this.url = url;
54
+ return SdkPianoio.setComposerUrl(url);
55
+ }
56
+
57
+ async execute() {
58
+ return SdkPianoio.executeComposer();
59
+ }
60
+
61
+ async executeExperience() {
62
+ return SdkPianoio.experienceExecute();
63
+ }
64
+
65
+ async showForm() {
66
+ return SdkPianoio.showForm();
67
+ }
68
+
69
+ async showLogin() {
70
+ try {
71
+ await SdkPianoio.showLogin();
72
+ console.log('Login triggered');
73
+ } catch (e) {
74
+ console.error('Errore nel login:', e);
60
75
  }
61
-
62
- static async isInitialized(): Promise<boolean> {
63
- try {
64
- const result = await SdkPianoio.getComposer();
65
- return result !== null;
66
- } catch (e) {
67
- return false;
68
- }
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);
69
84
  }
85
+ }
70
86
 
71
- static async getComposerFromSdkIOS() {
72
- const result = await SdkPianoio.getComposer();
73
-
74
- return result;
87
+ static async isInitialized(): Promise<boolean> {
88
+ try {
89
+ const result = await SdkPianoio.getComposer();
90
+ return result !== null;
91
+ } catch (e) {
92
+ return false;
75
93
  }
94
+ }
95
+
96
+ static async getComposerFromSdkIOS() {
97
+ const result = await SdkPianoio.getComposer();
76
98
 
77
- async toString(){
78
- return `PianoComposer {
99
+ return result;
100
+ }
101
+ async toString() {
102
+ return `PianoComposer {
79
103
  aid: ${this.aid},
80
104
  tags: ${this.tags},
81
105
  zoneId: ${this.zoneId},
@@ -84,7 +108,7 @@ class PianoComposer {
84
108
  userToken: ${this.userToken},
85
109
  url: ${this.url}
86
110
  }`;
87
- }
111
+ }
88
112
  }
89
113
 
90
- export default PianoComposer;
114
+ export default PianoComposer;
package/src/index.tsx CHANGED
@@ -13,5 +13,3 @@ export { default as PianoComposer } from './PianoComposer';
13
13
  // setComposerUserToken,
14
14
  // executeComposer
15
15
  // } = SdkPianoio;
16
-
17
-
@@ -1,75 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.sdkpianoio;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.Promise;
17
- import com.facebook.react.bridge.ReactApplicationContext;
18
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
- import com.facebook.react.bridge.ReactMethod;
20
- import com.facebook.react.bridge.ReadableArray;
21
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
22
- import javax.annotation.Nonnull;
23
-
24
- public abstract class NativeSdkPianoioSpec extends ReactContextBaseJavaModule implements TurboModule {
25
- public static final String NAME = "SdkPianoio";
26
-
27
- public NativeSdkPianoioSpec(ReactApplicationContext reactContext) {
28
- super(reactContext);
29
- }
30
-
31
- @Override
32
- public @Nonnull String getName() {
33
- return NAME;
34
- }
35
-
36
- @ReactMethod
37
- @DoNotStrip
38
- public abstract void initializeComposer(String aid, Promise promise);
39
-
40
- @ReactMethod
41
- @DoNotStrip
42
- public abstract void getComposer(Promise promise);
43
-
44
- @ReactMethod
45
- @DoNotStrip
46
- public abstract void addComposerTag(String tag, Promise promise);
47
-
48
- @ReactMethod
49
- @DoNotStrip
50
- public abstract void addComposerTags(ReadableArray tags, Promise promise);
51
-
52
- @ReactMethod
53
- @DoNotStrip
54
- public abstract void setComposerZoneId(String zoneId, Promise promise);
55
-
56
- @ReactMethod
57
- @DoNotStrip
58
- public abstract void setComposerReferrer(String referrer, Promise promise);
59
-
60
- @ReactMethod
61
- @DoNotStrip
62
- public abstract void setComposerUrl(String url, Promise promise);
63
-
64
- @ReactMethod
65
- @DoNotStrip
66
- public abstract void setComposerCustomVariable(String name, String value, Promise promise);
67
-
68
- @ReactMethod
69
- @DoNotStrip
70
- public abstract void setComposerUserToken(String token, Promise promise);
71
-
72
- @ReactMethod
73
- @DoNotStrip
74
- public abstract void executeComposer(Promise promise);
75
- }