@clix-so/react-native-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +345 -0
  3. package/lib/module/core/Clix.js +217 -0
  4. package/lib/module/core/Clix.js.map +1 -0
  5. package/lib/module/core/ClixConfig.js +4 -0
  6. package/lib/module/core/ClixConfig.js.map +1 -0
  7. package/lib/module/core/ClixInitCoordinator.js +58 -0
  8. package/lib/module/core/ClixInitCoordinator.js.map +1 -0
  9. package/lib/module/core/ClixVersion.js +17 -0
  10. package/lib/module/core/ClixVersion.js.map +1 -0
  11. package/lib/module/index.js +7 -0
  12. package/lib/module/index.js.map +1 -0
  13. package/lib/module/models/ClixDevice.js +51 -0
  14. package/lib/module/models/ClixDevice.js.map +1 -0
  15. package/lib/module/models/ClixPushNotificationPayload.js +21 -0
  16. package/lib/module/models/ClixPushNotificationPayload.js.map +1 -0
  17. package/lib/module/models/ClixUserProperty.js +44 -0
  18. package/lib/module/models/ClixUserProperty.js.map +1 -0
  19. package/lib/module/package.json +1 -0
  20. package/lib/module/services/ClixAPIClient.js +172 -0
  21. package/lib/module/services/ClixAPIClient.js.map +1 -0
  22. package/lib/module/services/DeviceAPIService.js +112 -0
  23. package/lib/module/services/DeviceAPIService.js.map +1 -0
  24. package/lib/module/services/DeviceService.js +157 -0
  25. package/lib/module/services/DeviceService.js.map +1 -0
  26. package/lib/module/services/EventAPIService.js +36 -0
  27. package/lib/module/services/EventAPIService.js.map +1 -0
  28. package/lib/module/services/EventService.js +29 -0
  29. package/lib/module/services/EventService.js.map +1 -0
  30. package/lib/module/services/NotificationService.js +549 -0
  31. package/lib/module/services/NotificationService.js.map +1 -0
  32. package/lib/module/services/StorageService.js +76 -0
  33. package/lib/module/services/StorageService.js.map +1 -0
  34. package/lib/module/services/TokenService.js +71 -0
  35. package/lib/module/services/TokenService.js.map +1 -0
  36. package/lib/module/utils/ClixError.js +63 -0
  37. package/lib/module/utils/ClixError.js.map +1 -0
  38. package/lib/module/utils/UUID.js +28 -0
  39. package/lib/module/utils/UUID.js.map +1 -0
  40. package/lib/module/utils/logging/ClixLogger.js +55 -0
  41. package/lib/module/utils/logging/ClixLogger.js.map +1 -0
  42. package/lib/typescript/package.json +1 -0
  43. package/lib/typescript/src/core/Clix.d.ts +67 -0
  44. package/lib/typescript/src/core/Clix.d.ts.map +1 -0
  45. package/lib/typescript/src/core/ClixConfig.d.ts +9 -0
  46. package/lib/typescript/src/core/ClixConfig.d.ts.map +1 -0
  47. package/lib/typescript/src/core/ClixInitCoordinator.d.ts +16 -0
  48. package/lib/typescript/src/core/ClixInitCoordinator.d.ts.map +1 -0
  49. package/lib/typescript/src/core/ClixVersion.d.ts +6 -0
  50. package/lib/typescript/src/core/ClixVersion.d.ts.map +1 -0
  51. package/lib/typescript/src/index.d.ts +5 -0
  52. package/lib/typescript/src/index.d.ts.map +1 -0
  53. package/lib/typescript/src/models/ClixDevice.d.ts +42 -0
  54. package/lib/typescript/src/models/ClixDevice.d.ts.map +1 -0
  55. package/lib/typescript/src/models/ClixPushNotificationPayload.d.ts +23 -0
  56. package/lib/typescript/src/models/ClixPushNotificationPayload.d.ts.map +1 -0
  57. package/lib/typescript/src/models/ClixUserProperty.d.ts +19 -0
  58. package/lib/typescript/src/models/ClixUserProperty.d.ts.map +1 -0
  59. package/lib/typescript/src/services/ClixAPIClient.d.ts +35 -0
  60. package/lib/typescript/src/services/ClixAPIClient.d.ts.map +1 -0
  61. package/lib/typescript/src/services/DeviceAPIService.d.ts +13 -0
  62. package/lib/typescript/src/services/DeviceAPIService.d.ts.map +1 -0
  63. package/lib/typescript/src/services/DeviceService.d.ts +20 -0
  64. package/lib/typescript/src/services/DeviceService.d.ts.map +1 -0
  65. package/lib/typescript/src/services/EventAPIService.d.ts +7 -0
  66. package/lib/typescript/src/services/EventAPIService.d.ts.map +1 -0
  67. package/lib/typescript/src/services/EventService.d.ts +9 -0
  68. package/lib/typescript/src/services/EventService.d.ts.map +1 -0
  69. package/lib/typescript/src/services/NotificationService.d.ts +56 -0
  70. package/lib/typescript/src/services/NotificationService.d.ts.map +1 -0
  71. package/lib/typescript/src/services/StorageService.d.ts +10 -0
  72. package/lib/typescript/src/services/StorageService.d.ts.map +1 -0
  73. package/lib/typescript/src/services/TokenService.d.ts +15 -0
  74. package/lib/typescript/src/services/TokenService.d.ts.map +1 -0
  75. package/lib/typescript/src/utils/ClixError.d.ts +41 -0
  76. package/lib/typescript/src/utils/ClixError.d.ts.map +1 -0
  77. package/lib/typescript/src/utils/UUID.d.ts +14 -0
  78. package/lib/typescript/src/utils/UUID.d.ts.map +1 -0
  79. package/lib/typescript/src/utils/logging/ClixLogger.d.ts +18 -0
  80. package/lib/typescript/src/utils/logging/ClixLogger.d.ts.map +1 -0
  81. package/package.json +151 -0
  82. package/src/core/Clix.ts +256 -0
  83. package/src/core/ClixConfig.ts +9 -0
  84. package/src/core/ClixInitCoordinator.ts +65 -0
  85. package/src/core/ClixVersion.ts +17 -0
  86. package/src/index.ts +5 -0
  87. package/src/models/ClixDevice.ts +88 -0
  88. package/src/models/ClixPushNotificationPayload.ts +38 -0
  89. package/src/models/ClixUserProperty.ts +58 -0
  90. package/src/services/ClixAPIClient.ts +248 -0
  91. package/src/services/DeviceAPIService.ts +187 -0
  92. package/src/services/DeviceService.ts +204 -0
  93. package/src/services/EventAPIService.ts +48 -0
  94. package/src/services/EventService.ts +45 -0
  95. package/src/services/NotificationService.ts +730 -0
  96. package/src/services/StorageService.ts +84 -0
  97. package/src/services/TokenService.ts +84 -0
  98. package/src/utils/ClixError.ts +78 -0
  99. package/src/utils/UUID.ts +29 -0
  100. package/src/utils/logging/ClixLogger.ts +61 -0
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ import { MMKV } from 'react-native-mmkv';
4
+ import { ClixLogger } from "../utils/logging/ClixLogger.js";
5
+ export class StorageService {
6
+ constructor() {
7
+ this.storage = new MMKV({
8
+ id: 'clix-storage',
9
+ encryptionKey: undefined // Add encryption if needed
10
+ });
11
+ }
12
+ async set(key, value) {
13
+ if (value === undefined) {
14
+ try {
15
+ this.storage.delete(key);
16
+ } catch (error) {
17
+ ClixLogger.error(`Failed to remove value for key: ${key}`, error);
18
+ }
19
+ return;
20
+ }
21
+ try {
22
+ const encoded = JSON.stringify(value);
23
+ this.storage.set(key, encoded);
24
+ } catch (error) {
25
+ ClixLogger.error(`Failed to set value for key: ${key}`, error);
26
+ // Don't throw storage errors to prevent initialization failure
27
+ return;
28
+ }
29
+ }
30
+ async get(key) {
31
+ try {
32
+ const data = this.storage.getString(key);
33
+ if (data === null || data === undefined) return undefined;
34
+ try {
35
+ const decoded = JSON.parse(data);
36
+ return decoded;
37
+ } catch (jsonError) {
38
+ // Handle legacy string values
39
+ ClixLogger.debug(`Found legacy string value for key: ${key}, migrating to JSON format`);
40
+ await this.set(key, data);
41
+ return data;
42
+ }
43
+ } catch (error) {
44
+ ClixLogger.error(`Failed to get value for key: ${key}`, error);
45
+ // Return undefined instead of throwing to prevent initialization failure
46
+ return undefined;
47
+ }
48
+ }
49
+ async remove(key) {
50
+ try {
51
+ this.storage.delete(key);
52
+ } catch (error) {
53
+ ClixLogger.error(`Failed to remove key: ${key}`, error);
54
+ // Don't throw to prevent initialization failure
55
+ return;
56
+ }
57
+ }
58
+ async clear() {
59
+ try {
60
+ this.storage.clearAll();
61
+ } catch (error) {
62
+ ClixLogger.error('Failed to clear storage', error);
63
+ throw error;
64
+ }
65
+ }
66
+ async getAllKeys() {
67
+ try {
68
+ const keys = this.storage.getAllKeys();
69
+ return Array.from(keys);
70
+ } catch (error) {
71
+ ClixLogger.error('Failed to get all keys', error);
72
+ return [];
73
+ }
74
+ }
75
+ }
76
+ //# sourceMappingURL=StorageService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MMKV","ClixLogger","StorageService","constructor","storage","id","encryptionKey","undefined","set","key","value","delete","error","encoded","JSON","stringify","get","data","getString","decoded","parse","jsonError","debug","remove","clear","clearAll","getAllKeys","keys","Array","from"],"sourceRoot":"../../../src","sources":["services/StorageService.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,mBAAmB;AACxC,SAASC,UAAU,QAAQ,gCAA6B;AAExD,OAAO,MAAMC,cAAc,CAAC;EAG1BC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,OAAO,GAAG,IAAIJ,IAAI,CAAC;MACtBK,EAAE,EAAE,cAAc;MAClBC,aAAa,EAAEC,SAAS,CAAE;IAC5B,CAAC,CAAC;EACJ;EAEA,MAAMC,GAAGA,CAAIC,GAAW,EAAEC,KAAQ,EAAiB;IACjD,IAAIA,KAAK,KAAKH,SAAS,EAAE;MACvB,IAAI;QACF,IAAI,CAACH,OAAO,CAACO,MAAM,CAACF,GAAG,CAAC;MAC1B,CAAC,CAAC,OAAOG,KAAK,EAAE;QACdX,UAAU,CAACW,KAAK,CAAC,mCAAmCH,GAAG,EAAE,EAAEG,KAAK,CAAC;MACnE;MACA;IACF;IAEA,IAAI;MACF,MAAMC,OAAO,GAAGC,IAAI,CAACC,SAAS,CAACL,KAAK,CAAC;MACrC,IAAI,CAACN,OAAO,CAACI,GAAG,CAACC,GAAG,EAAEI,OAAO,CAAC;IAChC,CAAC,CAAC,OAAOD,KAAK,EAAE;MACdX,UAAU,CAACW,KAAK,CAAC,gCAAgCH,GAAG,EAAE,EAAEG,KAAK,CAAC;MAC9D;MACA;IACF;EACF;EAEA,MAAMI,GAAGA,CAAIP,GAAW,EAA0B;IAChD,IAAI;MACF,MAAMQ,IAAI,GAAG,IAAI,CAACb,OAAO,CAACc,SAAS,CAACT,GAAG,CAAC;MACxC,IAAIQ,IAAI,KAAK,IAAI,IAAIA,IAAI,KAAKV,SAAS,EAAE,OAAOA,SAAS;MACzD,IAAI;QACF,MAAMY,OAAO,GAAGL,IAAI,CAACM,KAAK,CAACH,IAAI,CAAC;QAChC,OAAOE,OAAO;MAChB,CAAC,CAAC,OAAOE,SAAS,EAAE;QAClB;QACApB,UAAU,CAACqB,KAAK,CACd,sCAAsCb,GAAG,4BAC3C,CAAC;QACD,MAAM,IAAI,CAACD,GAAG,CAACC,GAAG,EAAEQ,IAAI,CAAC;QACzB,OAAOA,IAAI;MACb;IACF,CAAC,CAAC,OAAOL,KAAK,EAAE;MACdX,UAAU,CAACW,KAAK,CAAC,gCAAgCH,GAAG,EAAE,EAAEG,KAAK,CAAC;MAC9D;MACA,OAAOL,SAAS;IAClB;EACF;EAEA,MAAMgB,MAAMA,CAACd,GAAW,EAAiB;IACvC,IAAI;MACF,IAAI,CAACL,OAAO,CAACO,MAAM,CAACF,GAAG,CAAC;IAC1B,CAAC,CAAC,OAAOG,KAAK,EAAE;MACdX,UAAU,CAACW,KAAK,CAAC,yBAAyBH,GAAG,EAAE,EAAEG,KAAK,CAAC;MACvD;MACA;IACF;EACF;EAEA,MAAMY,KAAKA,CAAA,EAAkB;IAC3B,IAAI;MACF,IAAI,CAACpB,OAAO,CAACqB,QAAQ,CAAC,CAAC;IACzB,CAAC,CAAC,OAAOb,KAAK,EAAE;MACdX,UAAU,CAACW,KAAK,CAAC,yBAAyB,EAAEA,KAAK,CAAC;MAClD,MAAMA,KAAK;IACb;EACF;EAEA,MAAMc,UAAUA,CAAA,EAAsB;IACpC,IAAI;MACF,MAAMC,IAAI,GAAG,IAAI,CAACvB,OAAO,CAACsB,UAAU,CAAC,CAAC;MACtC,OAAOE,KAAK,CAACC,IAAI,CAACF,IAAI,CAAC;IACzB,CAAC,CAAC,OAAOf,KAAK,EAAE;MACdX,UAAU,CAACW,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;MACjD,OAAO,EAAE;IACX;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ import { ClixLogger } from "../utils/logging/ClixLogger.js";
4
+ export class TokenService {
5
+ static CURRENT_TOKEN_KEY = 'clix_current_push_token';
6
+ static PREVIOUS_TOKENS_KEY = 'clix_push_tokens';
7
+ static MAX_TOKENS = 5;
8
+ constructor(storageService) {
9
+ this.storageService = storageService;
10
+ }
11
+ async getCurrentToken() {
12
+ try {
13
+ return await this.storageService.get(TokenService.CURRENT_TOKEN_KEY);
14
+ } catch (error) {
15
+ ClixLogger.error('Failed to get current token', error);
16
+ return undefined;
17
+ }
18
+ }
19
+ async getPreviousTokens() {
20
+ try {
21
+ const result = await this.storageService.get(TokenService.PREVIOUS_TOKENS_KEY);
22
+ if (result === undefined) return [];
23
+ return Array.isArray(result) ? result : [];
24
+ } catch (error) {
25
+ ClixLogger.error('Failed to get previous tokens', error);
26
+ return [];
27
+ }
28
+ }
29
+ async saveToken(token) {
30
+ try {
31
+ await this.storageService.set(TokenService.CURRENT_TOKEN_KEY, token);
32
+ let tokens = await this.getPreviousTokens();
33
+
34
+ // Remove existing token if present
35
+ const currentIndex = tokens.indexOf(token);
36
+ if (currentIndex !== -1) {
37
+ tokens.splice(currentIndex, 1);
38
+ }
39
+
40
+ // Add new token
41
+ tokens.push(token);
42
+
43
+ // Keep only the last MAX_TOKENS
44
+ if (tokens.length > TokenService.MAX_TOKENS) {
45
+ tokens = tokens.slice(-TokenService.MAX_TOKENS);
46
+ }
47
+ await this.storageService.set(TokenService.PREVIOUS_TOKENS_KEY, tokens);
48
+ ClixLogger.debug('Token saved successfully');
49
+ } catch (error) {
50
+ ClixLogger.error('Failed to save token', error);
51
+ throw error;
52
+ }
53
+ }
54
+ async clearTokens() {
55
+ try {
56
+ await this.storageService.remove(TokenService.PREVIOUS_TOKENS_KEY);
57
+ await this.storageService.remove(TokenService.CURRENT_TOKEN_KEY);
58
+ ClixLogger.debug('All tokens cleared');
59
+ } catch (error) {
60
+ ClixLogger.error('Failed to clear tokens', error);
61
+ throw error;
62
+ }
63
+ }
64
+ convertTokenToString(deviceToken) {
65
+ return deviceToken.map(data => data.toString(16).padStart(2, '0')).join('');
66
+ }
67
+ async reset() {
68
+ await this.clearTokens();
69
+ }
70
+ }
71
+ //# sourceMappingURL=TokenService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ClixLogger","TokenService","CURRENT_TOKEN_KEY","PREVIOUS_TOKENS_KEY","MAX_TOKENS","constructor","storageService","getCurrentToken","get","error","undefined","getPreviousTokens","result","Array","isArray","saveToken","token","set","tokens","currentIndex","indexOf","splice","push","length","slice","debug","clearTokens","remove","convertTokenToString","deviceToken","map","data","toString","padStart","join","reset"],"sourceRoot":"../../../src","sources":["services/TokenService.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,gCAA6B;AAGxD,OAAO,MAAMC,YAAY,CAAC;EACxB,OAAwBC,iBAAiB,GAAG,yBAAyB;EACrE,OAAwBC,mBAAmB,GAAG,kBAAkB;EAChE,OAAwBC,UAAU,GAAG,CAAC;EAEtCC,WAAWA,CAAkBC,cAA8B,EAAE;IAAA,KAAhCA,cAA8B,GAA9BA,cAA8B;EAAG;EAE9D,MAAMC,eAAeA,CAAA,EAAgC;IACnD,IAAI;MACF,OAAO,MAAM,IAAI,CAACD,cAAc,CAACE,GAAG,CAClCP,YAAY,CAACC,iBACf,CAAC;IACH,CAAC,CAAC,OAAOO,KAAK,EAAE;MACdT,UAAU,CAACS,KAAK,CAAC,6BAA6B,EAAEA,KAAK,CAAC;MACtD,OAAOC,SAAS;IAClB;EACF;EAEA,MAAMC,iBAAiBA,CAAA,EAAsB;IAC3C,IAAI;MACF,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACN,cAAc,CAACE,GAAG,CAC1CP,YAAY,CAACE,mBACf,CAAC;MACD,IAAIS,MAAM,KAAKF,SAAS,EAAE,OAAO,EAAE;MAEnC,OAAOG,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,GAAGA,MAAM,GAAG,EAAE;IAC5C,CAAC,CAAC,OAAOH,KAAK,EAAE;MACdT,UAAU,CAACS,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;MACxD,OAAO,EAAE;IACX;EACF;EAEA,MAAMM,SAASA,CAACC,KAAa,EAAi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OAAOA,WAAW,CACfC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CACjDC,IAAI,CAAC,EAAE,CAAC;EACb;EAEA,MAAMC,KAAKA,CAAA,EAAkB;IAC3B,MAAM,IAAI,CAACT,WAAW,CAAC,CAAC;EAC1B;AACF","ignoreList":[]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ export let ClixErrorCode = /*#__PURE__*/function (ClixErrorCode) {
4
+ ClixErrorCode["NOT_INITIALIZED"] = "NOT_INITIALIZED";
5
+ ClixErrorCode["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
6
+ ClixErrorCode["INVALID_URL"] = "INVALID_URL";
7
+ ClixErrorCode["INVALID_RESPONSE"] = "INVALID_RESPONSE";
8
+ ClixErrorCode["ENCODING_ERROR"] = "ENCODING_ERROR";
9
+ ClixErrorCode["DECODING_ERROR"] = "DECODING_ERROR";
10
+ ClixErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
11
+ ClixErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
12
+ return ClixErrorCode;
13
+ }({});
14
+ const ClixErrorMessages = {
15
+ [ClixErrorCode.NOT_INITIALIZED]: 'Clix SDK is not initialized. Call Clix.initialize() first.',
16
+ [ClixErrorCode.INVALID_CONFIGURATION]: 'Invalid SDK configuration.',
17
+ [ClixErrorCode.INVALID_URL]: 'The provided URL is invalid.',
18
+ [ClixErrorCode.INVALID_RESPONSE]: 'The response was invalid or permission was denied.',
19
+ [ClixErrorCode.ENCODING_ERROR]: 'Failed to encode request body.',
20
+ [ClixErrorCode.DECODING_ERROR]: 'Failed to decode response body.',
21
+ [ClixErrorCode.NETWORK_ERROR]: 'Network request failed.',
22
+ [ClixErrorCode.UNKNOWN_ERROR]: 'An unknown error occurred.'
23
+ };
24
+ export class ClixError extends Error {
25
+ constructor(code, message, options) {
26
+ super(message ?? ClixErrorMessages[code]);
27
+ this.name = 'ClixError';
28
+ this.code = code;
29
+ if (options?.cause) {
30
+ this.cause = options.cause;
31
+ }
32
+ }
33
+ static notInitialized(options) {
34
+ return new ClixError(ClixErrorCode.NOT_INITIALIZED, undefined, options);
35
+ }
36
+ static invalidConfiguration(options) {
37
+ return new ClixError(ClixErrorCode.INVALID_CONFIGURATION, undefined, options);
38
+ }
39
+ static invalidURL(options) {
40
+ return new ClixError(ClixErrorCode.INVALID_URL, undefined, options);
41
+ }
42
+ static invalidResponse(options) {
43
+ return new ClixError(ClixErrorCode.INVALID_RESPONSE, undefined, options);
44
+ }
45
+ static encodingError(options) {
46
+ return new ClixError(ClixErrorCode.ENCODING_ERROR, undefined, options);
47
+ }
48
+ static decodingError(options) {
49
+ return new ClixError(ClixErrorCode.DECODING_ERROR, undefined, options);
50
+ }
51
+ static networkError(underlyingError) {
52
+ return new ClixError(ClixErrorCode.NETWORK_ERROR, undefined, {
53
+ cause: underlyingError
54
+ });
55
+ }
56
+ static unknownError(options) {
57
+ const msg = options?.reason != null ? `${ClixErrorMessages[ClixErrorCode.UNKNOWN_ERROR]}: ${options.reason}` : undefined;
58
+ return new ClixError(ClixErrorCode.UNKNOWN_ERROR, msg, {
59
+ cause: options?.cause
60
+ });
61
+ }
62
+ }
63
+ //# sourceMappingURL=ClixError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ClixErrorCode","ClixErrorMessages","NOT_INITIALIZED","INVALID_CONFIGURATION","INVALID_URL","INVALID_RESPONSE","ENCODING_ERROR","DECODING_ERROR","NETWORK_ERROR","UNKNOWN_ERROR","ClixError","Error","constructor","code","message","options","name","cause","notInitialized","undefined","invalidConfiguration","invalidURL","invalidResponse","encodingError","decodingError","networkError","underlyingError","unknownError","msg","reason"],"sourceRoot":"../../../src","sources":["utils/ClixError.ts"],"mappings":";;AAAA,WAAYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;E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O,eAAeA,CAACP,OAA6B,EAAE;IACpD,OAAO,IAAIL,SAAS,CAACV,aAAa,CAACK,gBAAgB,EAAEc,SAAS,EAAEJ,OAAO,CAAC;EAC1E;EACA,OAAOQ,aAAaA,CAACR,OAA6B,EAAE;IAClD,OAAO,IAAIL,SAAS,CAACV,aAAa,CAACM,cAAc,EAAEa,SAAS,EAAEJ,OAAO,CAAC;EACxE;EACA,OAAOS,aAAaA,CAACT,OAA6B,EAAE;IAClD,OAAO,IAAIL,SAAS,CAACV,aAAa,CAACO,cAAc,EAAEY,SAAS,EAAEJ,OAAO,CAAC;EACxE;EACA,OAAOU,YAAYA,CAACC,eAAwB,EAAE;IAC5C,OAAO,IAAIhB,SAAS,CAACV,aAAa,CAACQ,aAAa,EAAEW,SAAS,EAAE;MAC3DF,KAAK,EAAES;IACT,CAAC,CAAC;EACJ;EACA,OAAOC,YAAYA,CAACZ,OAA8C,EAAE;IAClE,MAAMa,GAAG,GACPb,OAAO,EAAEc,MAAM,IAAI,IAAI,GACnB,GAAG5B,iBAAiB,CAACD,aAAa,CAACS,aAAa,CAAC,KAAKM,OAAO,CAACc,MAAM,EAAE,GACtEV,SAAS;IACf,OAAO,IAAIT,SAAS,CAACV,aAAa,CAACS,aAAa,EAAEmB,GAAG,EAAE;MACrDX,KAAK,EAAEF,OAAO,EAAEE;IAClB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ import 'react-native-get-random-values';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+ import { ClixLogger } from "./logging/ClixLogger.js";
6
+ export class UUID {
7
+ /**
8
+ * Generates a new UUID v4
9
+ * @returns A new UUID string
10
+ */
11
+ static generate() {
12
+ try {
13
+ return uuidv4();
14
+ } catch (error) {
15
+ ClixLogger.warn('UUID generation failed, using fallback ID generation', error);
16
+ return this.generateFallbackId();
17
+ }
18
+ }
19
+
20
+ /**
21
+ * Generates a fallback ID when UUID generation fails
22
+ * @returns A fallback ID string
23
+ */
24
+ static generateFallbackId() {
25
+ return `clix_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
26
+ }
27
+ }
28
+ //# sourceMappingURL=UUID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["v4","uuidv4","ClixLogger","UUID","generate","error","warn","generateFallbackId","Date","now","Math","random","toString","substr"],"sourceRoot":"../../../src","sources":["utils/UUID.ts"],"mappings":";;AAAA,OAAO,gCAAgC;AACvC,SAASA,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,UAAU,QAAQ,yBAAsB;AAEjD,OAAO,MAAMC,IAAI,CAAC;EAChB;AACF;AACA;AACA;EACE,OAAOC,QAAQA,CAAA,EAAW;IACxB,IAAI;MACF,OAAOH,MAAM,CAAC,CAAC;IACjB,CAAC,CAAC,OAAOI,KAAK,EAAE;MACdH,UAAU,CAACI,IAAI,CACb,sDAAsD,EACtDD,KACF,CAAC;MACD,OAAO,IAAI,CAACE,kBAAkB,CAAC,CAAC;IAClC;EACF;;EAEA;AACF;AACA;AACA;EACE,OAAeA,kBAAkBA,CAAA,EAAW;IAC1C,OAAO,QAAQC,IAAI,CAACC,GAAG,CAAC,CAAC,IAAIC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;EACxE;AACF","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ export let ClixLogLevel = /*#__PURE__*/function (ClixLogLevel) {
4
+ ClixLogLevel[ClixLogLevel["NONE"] = 0] = "NONE";
5
+ ClixLogLevel[ClixLogLevel["ERROR"] = 1] = "ERROR";
6
+ ClixLogLevel[ClixLogLevel["WARN"] = 2] = "WARN";
7
+ ClixLogLevel[ClixLogLevel["INFO"] = 3] = "INFO";
8
+ ClixLogLevel[ClixLogLevel["DEBUG"] = 4] = "DEBUG";
9
+ return ClixLogLevel;
10
+ }({});
11
+ export class ClixLogger {
12
+ static logLevel = ClixLogLevel.INFO;
13
+ static setLogLevel(level) {
14
+ this.logLevel = level;
15
+ }
16
+ static shouldLog(level) {
17
+ return this.logLevel >= level;
18
+ }
19
+ static log(level, message, error) {
20
+ if (level > this.logLevel) {
21
+ return;
22
+ }
23
+ const timestamp = new Date().toISOString();
24
+ const messages = [`[Clix][${timestamp}] ${message}`, error].filter(Boolean);
25
+ switch (level) {
26
+ case ClixLogLevel.DEBUG:
27
+ console.debug(...messages);
28
+ break;
29
+ case ClixLogLevel.INFO:
30
+ console.info(...messages);
31
+ break;
32
+ case ClixLogLevel.WARN:
33
+ console.warn(...messages);
34
+ break;
35
+ case ClixLogLevel.ERROR:
36
+ console.error(...messages);
37
+ break;
38
+ case ClixLogLevel.NONE:
39
+ return;
40
+ }
41
+ }
42
+ static error(message, error) {
43
+ this.log(ClixLogLevel.ERROR, message, error);
44
+ }
45
+ static warn(message, error) {
46
+ this.log(ClixLogLevel.WARN, message, error);
47
+ }
48
+ static info(message, error) {
49
+ this.log(ClixLogLevel.INFO, message, error);
50
+ }
51
+ static debug(message, error) {
52
+ this.log(ClixLogLevel.DEBUG, message, error);
53
+ }
54
+ }
55
+ //# sourceMappingURL=ClixLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ClixLogLevel","ClixLogger","logLevel","INFO","setLogLevel","level","shouldLog","log","message","error","timestamp","Date","toISOString","messages","filter","Boolean","DEBUG","console","debug","info","WARN","warn","ERROR","NONE"],"sourceRoot":"../../../../src","sources":["utils/logging/ClixLogger.ts"],"mappings":";;AAAA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAQxB,OAAO,MAAMC,UAAU,CAAC;EACtB,OAAeC,QAAQ,GAAiBF,YAAY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,OAAOU,IAAIA,CAACX,OAAe,EAAEC,KAAW,EAAQ;IAC9C,IAAI,CAACF,GAAG,CAACP,YAAY,CAACG,IAAI,EAAEK,OAAO,EAAEC,KAAK,CAAC;EAC7C;EAEA,OAAOS,KAAKA,CAACV,OAAe,EAAEC,KAAW,EAAQ;IAC/C,IAAI,CAACF,GAAG,CAACP,YAAY,CAACgB,KAAK,EAAER,OAAO,EAAEC,KAAK,CAAC;EAC9C;AACF","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,67 @@
1
+ import { DeviceService } from '../services/DeviceService';
2
+ import { EventService } from '../services/EventService';
3
+ import { NotificationService } from '../services/NotificationService';
4
+ import { StorageService } from '../services/StorageService';
5
+ import { ClixLogLevel } from '../utils/logging/ClixLogger';
6
+ import type { ClixConfig } from './ClixConfig';
7
+ export declare class Clix {
8
+ private static shared?;
9
+ private static initCoordinator;
10
+ protected storageService?: StorageService;
11
+ protected eventService?: EventService;
12
+ protected deviceService?: DeviceService;
13
+ protected notificationService?: NotificationService;
14
+ private constructor();
15
+ /**
16
+ * Initialize Clix SDK
17
+ */
18
+ static initialize(config: ClixConfig): Promise<void>;
19
+ /**
20
+ * Set user ID
21
+ */
22
+ static setUserId(userId: string): Promise<void>;
23
+ /**
24
+ * Remove user ID
25
+ */
26
+ static removeUserId(): Promise<void>;
27
+ /**
28
+ * Set user property
29
+ */
30
+ static setUserProperty(key: string, value: any): Promise<void>;
31
+ /**
32
+ * Set user properties
33
+ */
34
+ static setUserProperties(userProperties: Record<string, any>): Promise<void>;
35
+ /**
36
+ * Remove user property
37
+ */
38
+ static removeUserProperty(key: string): Promise<void>;
39
+ /**
40
+ * Remove user properties
41
+ */
42
+ static removeUserProperties(keys: string[]): Promise<void>;
43
+ /**
44
+ * Get device ID
45
+ */
46
+ static getDeviceId(): Promise<string | undefined>;
47
+ /**
48
+ * Get push token
49
+ */
50
+ static getPushToken(): Promise<string | undefined>;
51
+ /**
52
+ * Set log level
53
+ */
54
+ static setLogLevel(level: ClixLogLevel): void;
55
+ /**
56
+ * Track event
57
+ */
58
+ protected static trackEvent(name: string, options?: {
59
+ properties?: Record<string, any>;
60
+ messageId?: string;
61
+ }): Promise<void>;
62
+ /**
63
+ * Set configuration
64
+ */
65
+ private setConfig;
66
+ }
67
+ //# sourceMappingURL=Clix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Clix.d.ts","sourceRoot":"","sources":["../../../../src/core/Clix.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAc,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAO;IAC7B,OAAO,CAAC,MAAM,CAAC,eAAe,CAA6B;IAE3D,SAAS,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IAC1C,SAAS,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACtC,SAAS,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACxC,SAAS,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAEpD,OAAO;IAEP;;OAEG;WACU,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB1D;;OAEG;WACU,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrD;;OAEG;WACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAW1C;;OAEG;WACU,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAapE;;OAEG;WACU,iBAAiB,CAC5B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC;IAWhB;;OAEG;WACU,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW3D;;OAEG;WACU,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWhE;;OAEG;WACU,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAcvD;;OAEG;WACU,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAcxD;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAI7C;;OAEG;qBACoB,UAAU,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACjC,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GACA,OAAO,CAAC,IAAI,CAAC;IAehB;;OAEG;YACW,SAAS;CAkDxB"}
@@ -0,0 +1,9 @@
1
+ import { ClixLogLevel } from '../utils/logging/ClixLogger';
2
+ export interface ClixConfig {
3
+ projectId: string;
4
+ apiKey: string;
5
+ endpoint?: string;
6
+ logLevel?: ClixLogLevel;
7
+ extraHeaders?: Record<string, string>;
8
+ }
9
+ //# sourceMappingURL=ClixConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClixConfig.d.ts","sourceRoot":"","sources":["../../../../src/core/ClixConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC"}
@@ -0,0 +1,16 @@
1
+ export declare class ClixInitCoordinator {
2
+ private promise;
3
+ private resolve;
4
+ private reject;
5
+ private isCompleted;
6
+ private isFailed;
7
+ constructor();
8
+ waitForInitialization(): Promise<void>;
9
+ isInitializationFailed(): boolean;
10
+ isInitializationCompleted(): boolean;
11
+ completeInitialization(): void;
12
+ failInitialization(error: Error): void;
13
+ reset(): void;
14
+ private isAlreadyFinalized;
15
+ }
16
+ //# sourceMappingURL=ClixInitCoordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClixInitCoordinator.d.ts","sourceRoot":"","sources":["../../../../src/core/ClixInitCoordinator.ts"],"names":[],"mappings":"AAEA,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,MAAM,CAAyC;IACvD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAS;;IASnB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAO5C,sBAAsB,IAAI,OAAO;IAIjC,yBAAyB,IAAI,OAAO;IAIpC,sBAAsB,IAAI,IAAI;IAQ9B,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAStC,KAAK,IAAI,IAAI;IASb,OAAO,CAAC,kBAAkB;CAO3B"}
@@ -0,0 +1,6 @@
1
+ export declare class ClixVersion {
2
+ private static cachedVersion?;
3
+ private static fallBackVersion;
4
+ static getVersion(): Promise<string>;
5
+ }
6
+ //# sourceMappingURL=ClixVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClixVersion.d.ts","sourceRoot":"","sources":["../../../../src/core/ClixVersion.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAS;IACtC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAmB;WAEpC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;CAY3C"}
@@ -0,0 +1,5 @@
1
+ import { Clix } from './core/Clix';
2
+ import { ClixLogLevel } from './utils/logging/ClixLogger';
3
+ export { ClixLogLevel };
4
+ export default Clix;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAe,IAAI,CAAC"}
@@ -0,0 +1,42 @@
1
+ export declare class ClixDevice {
2
+ readonly id: string;
3
+ readonly platform: string;
4
+ readonly model: string;
5
+ readonly manufacturer: string;
6
+ readonly osName: string;
7
+ readonly osVersion: string;
8
+ readonly localeRegion: string;
9
+ readonly localeLanguage: string;
10
+ readonly timezone: string;
11
+ readonly appName: string;
12
+ readonly appVersion: string;
13
+ readonly sdkType: string;
14
+ readonly sdkVersion: string;
15
+ readonly adId?: string;
16
+ readonly isPushPermissionGranted: boolean;
17
+ readonly pushToken?: string;
18
+ readonly pushTokenType?: string;
19
+ constructor(device: {
20
+ id: string;
21
+ platform: string;
22
+ model: string;
23
+ manufacturer: string;
24
+ osName: string;
25
+ osVersion: string;
26
+ localeRegion: string;
27
+ localeLanguage: string;
28
+ timezone: string;
29
+ appName: string;
30
+ appVersion: string;
31
+ sdkType: string;
32
+ sdkVersion: string;
33
+ adId?: string;
34
+ isPushPermissionGranted: boolean;
35
+ pushToken?: string;
36
+ pushTokenType?: string;
37
+ });
38
+ copyWith(updates: Partial<ClixDevice>): ClixDevice;
39
+ equals(other: ClixDevice): boolean;
40
+ toString(): string;
41
+ }
42
+ //# sourceMappingURL=ClixDevice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClixDevice.d.ts","sourceRoot":"","sources":["../../../../src/models/ClixDevice.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,uBAAuB,EAAE,OAAO,CAAC;IACjD,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnC,SAAgB,aAAa,CAAC,EAAE,MAAM,CAAC;gBAE3B,MAAM,EAAE;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,uBAAuB,EAAE,OAAO,CAAC;QACjC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB;IAoBD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU;IAuBlD,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAIlC,QAAQ,IAAI,MAAM;CAGnB"}
@@ -0,0 +1,23 @@
1
+ export declare class ClixPushNotificationPayload {
2
+ readonly messageId: string;
3
+ readonly campaignId?: string;
4
+ readonly userId?: string;
5
+ readonly deviceId?: string;
6
+ readonly trackingId?: string;
7
+ readonly landingUrl?: string;
8
+ readonly imageUrl?: string;
9
+ readonly customProperties?: Record<string, any>;
10
+ constructor(payload: {
11
+ messageId: string;
12
+ campaignId?: string;
13
+ userId?: string;
14
+ deviceId?: string;
15
+ trackingId?: string;
16
+ landingUrl?: string;
17
+ imageUrl?: string;
18
+ customProperties?: Record<string, any>;
19
+ });
20
+ equals(other: ClixPushNotificationPayload): boolean;
21
+ toString(): string;
22
+ }
23
+ //# sourceMappingURL=ClixPushNotificationPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClixPushNotificationPayload.d.ts","sourceRoot":"","sources":["../../../../src/models/ClixPushNotificationPayload.ts"],"names":[],"mappings":"AAAA,qBAAa,2BAA2B;IACtC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;gBAE3C,OAAO,EAAE;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACxC;IAWD,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO;IAInD,QAAQ,IAAI,MAAM;CAGnB"}
@@ -0,0 +1,19 @@
1
+ export declare enum PropertyType {
2
+ String = "USER_PROPERTY_TYPE_STRING",
3
+ Number = "USER_PROPERTY_TYPE_NUMBER",
4
+ Boolean = "USER_PROPERTY_TYPE_BOOLEAN"
5
+ }
6
+ export declare class ClixUserProperty {
7
+ readonly name: string;
8
+ readonly valueString: any;
9
+ readonly type: PropertyType;
10
+ constructor(property: {
11
+ name: string;
12
+ valueString: any;
13
+ type: PropertyType;
14
+ });
15
+ static of(name: string, value: any): ClixUserProperty;
16
+ equals(other: ClixUserProperty): boolean;
17
+ toString(): string;
18
+ }
19
+ //# sourceMappingURL=ClixUserProperty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClixUserProperty.d.ts","sourceRoot":"","sources":["../../../../src/models/ClixUserProperty.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,MAAM,8BAA8B;IACpC,MAAM,8BAA8B;IACpC,OAAO,+BAA+B;CACvC;AAED,qBAAa,gBAAgB;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,WAAW,EAAE,GAAG,CAAC;IACjC,SAAgB,IAAI,EAAE,YAAY,CAAC;gBAEvB,QAAQ,EAAE;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,GAAG,CAAC;QACjB,IAAI,EAAE,YAAY,CAAC;KACpB;IAMD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,gBAAgB;IAyBrD,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAQxC,QAAQ,IAAI,MAAM;CAGnB"}
@@ -0,0 +1,35 @@
1
+ import type { ClixConfig } from '../core/ClixConfig';
2
+ export interface APIResponse {
3
+ status: number;
4
+ data: any;
5
+ headers: Record<string, string>;
6
+ }
7
+ export declare class ClixAPIClient {
8
+ private readonly config;
9
+ private static readonly API_BASE_PATH;
10
+ constructor(config: ClixConfig);
11
+ private getCommonHeaders;
12
+ private buildUrl;
13
+ private buildUrlWithQuery;
14
+ get(path: string, options?: {
15
+ headers?: Record<string, string>;
16
+ queryParameters?: Record<string, any>;
17
+ }): Promise<APIResponse>;
18
+ post(path: string, options?: {
19
+ headers?: Record<string, string>;
20
+ queryParameters?: Record<string, any>;
21
+ body?: any;
22
+ }): Promise<APIResponse>;
23
+ put(path: string, options?: {
24
+ headers?: Record<string, string>;
25
+ queryParameters?: Record<string, any>;
26
+ body?: any;
27
+ }): Promise<APIResponse>;
28
+ delete(path: string, options?: {
29
+ headers?: Record<string, string>;
30
+ queryParameters?: Record<string, any>;
31
+ }): Promise<APIResponse>;
32
+ private parseResponse;
33
+ private headersToRecord;
34
+ }
35
+ //# sourceMappingURL=ClixAPIClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClixAPIClient.d.ts","sourceRoot":"","sources":["../../../../src/services/ClixAPIClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,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3B,OAAO,CAAC,eAAe;CAOxB"}
@@ -0,0 +1,13 @@
1
+ import { ClixDevice } from '../models/ClixDevice';
2
+ import { ClixUserProperty } from '../models/ClixUserProperty';
3
+ import { ClixAPIClient } from './ClixAPIClient';
4
+ export declare class DeviceAPIService {
5
+ private readonly apiClient;
6
+ constructor(apiClient: ClixAPIClient);
7
+ registerDevice(device: ClixDevice): Promise<void>;
8
+ setProjectUserId(deviceId: string, projectUserId: string): Promise<void>;
9
+ removeProjectUserId(deviceId: string): Promise<void>;
10
+ upsertUserProperties(deviceId: string, properties: ClixUserProperty[]): Promise<void>;
11
+ removeUserProperties(deviceId: string, propertyNames: string[]): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=DeviceAPIService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceAPIService.d.ts","sourceRoot":"","sources":["../../../../src/services/DeviceAPIService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAE/C,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CjD,gBAAgB,CACpB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC;IA+BV,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BpD,oBAAoB,CACxB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,gBAAgB,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC;IAqCV,oBAAoB,CACxB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,IAAI,CAAC;CAgCjB"}
@@ -0,0 +1,20 @@
1
+ import { ClixDevice } from '../models/ClixDevice';
2
+ import { DeviceAPIService } from './DeviceAPIService';
3
+ import { StorageService } from './StorageService';
4
+ import { TokenService } from './TokenService';
5
+ export declare class DeviceService {
6
+ private readonly storageService;
7
+ private readonly tokenService;
8
+ private readonly deviceAPIService;
9
+ private static readonly DEVICE_ID_KEY;
10
+ constructor(storageService: StorageService, tokenService: TokenService, deviceAPIService: DeviceAPIService);
11
+ getCurrentDeviceId(): Promise<string>;
12
+ setProjectUserId(projectUserId: string): Promise<void>;
13
+ removeProjectUserId(): Promise<void>;
14
+ updateUserProperties(properties: Record<string, any>): Promise<void>;
15
+ removeUserProperties(names: string[]): Promise<void>;
16
+ upsertToken(token: string, tokenType?: string): Promise<void>;
17
+ private getPushPermissionStatus;
18
+ createDevice(deviceId: string, token?: string): Promise<ClixDevice>;
19
+ }
20
+ //# sourceMappingURL=DeviceService.d.ts.map