capacitor-event-bird 0.0.12 → 0.0.14

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 CHANGED
@@ -17,6 +17,7 @@ npx cap sync
17
17
  * [`logout()`](#logout)
18
18
  * [`waitlistAfterInit()`](#waitlistafterinit)
19
19
  * [`openHelpModal()`](#openhelpmodal)
20
+ * [`getDeviceId()`](#getdeviceid)
20
21
 
21
22
  </docgen-index>
22
23
 
@@ -64,4 +65,15 @@ openHelpModal() => Promise<void>
64
65
 
65
66
  --------------------
66
67
 
68
+
69
+ ### getDeviceId()
70
+
71
+ ```typescript
72
+ getDeviceId() => Promise<{ value: string; }>
73
+ ```
74
+
75
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
76
+
77
+ --------------------
78
+
67
79
  </docgen-api>
package/dist/docs.json CHANGED
@@ -50,6 +50,16 @@
50
50
  "docs": "",
51
51
  "complexTypes": [],
52
52
  "slug": "openhelpmodal"
53
+ },
54
+ {
55
+ "name": "getDeviceId",
56
+ "signature": "() => Promise<{ value: string; }>",
57
+ "parameters": [],
58
+ "returns": "Promise<{ value: string; }>",
59
+ "tags": [],
60
+ "docs": "",
61
+ "complexTypes": [],
62
+ "slug": "getdeviceid"
53
63
  }
54
64
  ],
55
65
  "properties": []
@@ -7,4 +7,7 @@ export interface CapacitorEventBirdPlugin {
7
7
  logout(): Promise<void>;
8
8
  waitlistAfterInit(): Promise<void>;
9
9
  openHelpModal(): Promise<void>;
10
+ getDeviceId(): Promise<{
11
+ value: string;
12
+ }>;
10
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorEventBirdPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n logout(): Promise<void>;\n waitlistAfterInit(): Promise<void>\n openHelpModal(): Promise<void>\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorEventBirdPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n logout(): Promise<void>;\n waitlistAfterInit(): Promise<void>\n openHelpModal(): Promise<void>\n getDeviceId(): Promise<{ value: string }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -9,4 +9,7 @@ export declare class CapacitorEventBirdWeb extends WebPlugin implements Capacito
9
9
  logout(): Promise<void>;
10
10
  openHelpModal(): Promise<void>;
11
11
  waitlistAfterInit(): Promise<void>;
12
+ getDeviceId(): Promise<{
13
+ value: string;
14
+ }>;
12
15
  }
package/dist/esm/web.js CHANGED
@@ -13,5 +13,8 @@ export class CapacitorEventBirdWeb extends WebPlugin {
13
13
  async waitlistAfterInit() {
14
14
  console.log('waitlistAfterInit in web isnt really needed it already works');
15
15
  }
16
+ async getDeviceId() {
17
+ return { value: 'ios device id is not needed for web' };
18
+ }
16
19
  }
17
20
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC9E,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nexport class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async logout(): Promise<void> {\n console.log('logout in web isnt really needed it already works');\n }\n\n async openHelpModal(): Promise<void> {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n\n async waitlistAfterInit(): Promise<void> {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE,CAAC;IAC1D,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nexport class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async logout(): Promise<void> {\n console.log('logout in web isnt really needed it already works');\n }\n\n async openHelpModal(): Promise<void> {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n\n async waitlistAfterInit(): Promise<void> {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n\n async getDeviceId(): Promise<{ value: string }> {\n return { value: 'ios device id is not needed for web' };\n }\n}\n"]}
@@ -20,6 +20,9 @@ class CapacitorEventBirdWeb extends core.WebPlugin {
20
20
  async waitlistAfterInit() {
21
21
  console.log('waitlistAfterInit in web isnt really needed it already works');
22
22
  }
23
+ async getDeviceId() {
24
+ return { value: 'ios device id is not needed for web' };
25
+ }
23
26
  }
24
27
 
25
28
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACzE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;AACxE;AACA,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;AAC/E;AACA,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;AACnF;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n async getDeviceId() {\n return { value: 'ios device id is not needed for web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACzE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;AACxE;AACA,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;AAC/E;AACA,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;AACnF;AACA,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE;AAC/D;AACA;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -19,6 +19,9 @@ var capacitorCapacitorEventBird = (function (exports, core) {
19
19
  async waitlistAfterInit() {
20
20
  console.log('waitlistAfterInit in web isnt really needed it already works');
21
21
  }
22
+ async getDeviceId() {
23
+ return { value: 'ios device id is not needed for web' };
24
+ }
22
25
  }
23
26
 
24
27
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;IACzE,CAAC;;ICFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;IACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;IACxE;IACA,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;IAC/E;IACA,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;IACnF;IACA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n async getDeviceId() {\n return { value: 'ios device id is not needed for web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;IACzE,CAAC;;ICFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;IACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;IACxE;IACA,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;IAC/E;IACA,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;IACnF;IACA,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE;IAC/D;IACA;;;;;;;;;;;;;;;"}
@@ -8,13 +8,19 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
8
8
 
9
9
  public let pluginMethods: [CAPPluginMethod] = [
10
10
  CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise),
11
+ CAPPluginMethod(name: "getFCMToken", returnType: CAPPluginReturnPromise),
11
12
  CAPPluginMethod(name: "logout", returnType: CAPPluginReturnPromise),
12
13
  CAPPluginMethod(name: "waitlistAfterInit", returnType: CAPPluginReturnPromise),
13
14
  CAPPluginMethod(name: "openHelpModal", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "getDeviceId", returnType: CAPPluginReturnPromise),
14
16
  ]
15
17
 
16
18
  private var pendingEchoCalls: [CAPPluginCall] = []
19
+ private var pendingFCMCalls: [CAPPluginCall] = []
20
+
17
21
  private var savedToken: String?
22
+ private var savedFCMToken: String?
23
+
18
24
  private let implementation = CapacitorEventBird()
19
25
 
20
26
  @objc func echo(_ call: CAPPluginCall) {
@@ -27,11 +33,35 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
27
33
  }
28
34
  }
29
35
 
36
+ @objc func getFCMToken(_ call: CAPPluginCall) {
37
+ if let token = savedFCMToken {
38
+ print("[Native] JS called getFCMToken, passing the token.")
39
+ call.resolve(["value": token])
40
+ } else {
41
+ print("[Native] JS called getFCMToken, but token not ready. Queuing callback.")
42
+ pendingFCMCalls.append(call)
43
+ }
44
+ }
45
+
46
+ @objc func getDeviceId(_ call: CAPPluginCall) {
47
+ call.resolve(["value": UIDevice.current.identifierForVendor?.uuidString])
48
+ return
49
+ }
50
+
51
+ @objc public func setFCMToken(_ token: String) {
52
+ print("[Native] Setting FCM token in plugin")
53
+ self.savedFCMToken = token
54
+
55
+ for call in pendingFCMCalls {
56
+ call.resolve(["value": token])
57
+ }
58
+ pendingFCMCalls.removeAll()
59
+ }
60
+
30
61
  @objc public func setAuthToken(_ token: String) {
31
62
  print("[Native] Setting auth token in plugin")
32
63
  self.savedToken = token
33
64
 
34
- // Resolve all pending echo calls
35
65
  for call in pendingEchoCalls {
36
66
  call.resolve(["value": token])
37
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-event-bird",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "returns events back to native env",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",