@kameleoon/javascript-sdk 1.3.3 → 1.4.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.
@@ -5,4 +5,15 @@ import { SDKConfigurationType, KameleoonCore } from '@kameleoon/javascript-sdk-c
5
5
  * */
6
6
  export declare class KameleoonClient extends KameleoonCore {
7
7
  constructor(siteCode: string, configuration?: Partial<SDKConfigurationType>);
8
+ /**
9
+ * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached
10
+ * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.
11
+ * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail
12
+ * @throws `KameleoonError` with one of the following `type` s:
13
+ *
14
+ * - `KameleoonException.StorageWrite` Couldn't update storage data
15
+ * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api
16
+ * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed
17
+ */
18
+ initialize(useCache?: boolean): Promise<boolean>;
8
19
  }
@@ -26,11 +26,25 @@ class KameleoonClient extends _javascriptSdkCore.KameleoonCore {
26
26
  externalRequestDispatcher: requestDispatcher,
27
27
  externalPackageInfo: {
28
28
  type: _javascriptSdkCore.SDKType.JavaScript,
29
- version: "1.3.3"
29
+ version: "1.4.1"
30
30
  }
31
31
  }
32
32
  });
33
33
  }
34
+
35
+ /**
36
+ * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached
37
+ * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.
38
+ * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail
39
+ * @throws `KameleoonError` with one of the following `type` s:
40
+ *
41
+ * - `KameleoonException.StorageWrite` Couldn't update storage data
42
+ * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api
43
+ * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed
44
+ */
45
+ async initialize(useCache) {
46
+ return super.initialize(useCache);
47
+ }
34
48
  }
35
49
  exports.KameleoonClient = KameleoonClient;
36
50
  //# sourceMappingURL=kameleoonClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonClient.js","names":["_javascriptSdkCore","require","_storage","_requester","_eventSource","KameleoonClient","KameleoonCore","constructor","siteCode","configuration","storage","StorageConstructor","eventSource","EventSourceConstructor","requestDispatcher","RequestDispatcher","internalConfiguration","externalStorage","externalEventSource","externalRequestDispatcher","externalPackageInfo","type","SDKType","JavaScript","version","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import {\n SDKConfigurationType,\n KameleoonCore,\n SDKType,\n} from '@kameleoon/javascript-sdk-core';\nimport { StorageConstructor } from './storage';\nimport { RequestDispatcher } from './requester';\nimport { EventSourceConstructor } from './eventSource';\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * */\nexport class KameleoonClient extends KameleoonCore {\n constructor(siteCode: string, configuration?: Partial<SDKConfigurationType>) {\n const storage = new StorageConstructor();\n const eventSource = new EventSourceConstructor();\n const requestDispatcher = new RequestDispatcher();\n\n super({\n siteCode,\n configuration,\n internalConfiguration: {\n externalStorage: storage,\n externalEventSource: eventSource,\n externalRequestDispatcher: requestDispatcher,\n externalPackageInfo: {\n type: SDKType.JavaScript,\n version: process.env.npm_package_version as string,\n },\n },\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMI,eAAe,SAASC,gCAAa,CAAC;EACjDC,WAAWA,CAACC,QAAgB,EAAEC,aAA6C,EAAE;IAC3E,MAAMC,OAAO,GAAG,IAAIC,2BAAkB,EAAE;IACxC,MAAMC,WAAW,GAAG,IAAIC,mCAAsB,EAAE;IAChD,MAAMC,iBAAiB,GAAG,IAAIC,4BAAiB,EAAE;IAEjD,KAAK,CAAC;MACJP,QAAQ;MACRC,aAAa;MACbO,qBAAqB,EAAE;QACrBC,eAAe,EAAEP,OAAO;QACxBQ,mBAAmB,EAAEN,WAAW;QAChCO,yBAAyB,EAAEL,iBAAiB;QAC5CM,mBAAmB,EAAE;UACnBC,IAAI,EAAEC,0BAAO,CAACC,UAAU;UACxBC,OAAO;QACT;MACF;IACF,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAApB,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"file":"kameleoonClient.js","names":["_javascriptSdkCore","require","_storage","_requester","_eventSource","KameleoonClient","KameleoonCore","constructor","siteCode","configuration","storage","StorageConstructor","eventSource","EventSourceConstructor","requestDispatcher","RequestDispatcher","internalConfiguration","externalStorage","externalEventSource","externalRequestDispatcher","externalPackageInfo","type","SDKType","JavaScript","version","initialize","useCache","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import {\n SDKConfigurationType,\n KameleoonCore,\n SDKType,\n} from '@kameleoon/javascript-sdk-core';\nimport { StorageConstructor } from './storage';\nimport { RequestDispatcher } from './requester';\nimport { EventSourceConstructor } from './eventSource';\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * */\nexport class KameleoonClient extends KameleoonCore {\n constructor(siteCode: string, configuration?: Partial<SDKConfigurationType>) {\n const storage = new StorageConstructor();\n const eventSource = new EventSourceConstructor();\n const requestDispatcher = new RequestDispatcher();\n\n super({\n siteCode,\n configuration,\n internalConfiguration: {\n externalStorage: storage,\n externalEventSource: eventSource,\n externalRequestDispatcher: requestDispatcher,\n externalPackageInfo: {\n type: SDKType.JavaScript,\n version: process.env.npm_package_version as string,\n },\n },\n });\n }\n\n /**\n * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached\n * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n public async initialize(useCache?: boolean): Promise<boolean> {\n return super.initialize(useCache);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMI,eAAe,SAASC,gCAAa,CAAC;EACjDC,WAAWA,CAACC,QAAgB,EAAEC,aAA6C,EAAE;IAC3E,MAAMC,OAAO,GAAG,IAAIC,2BAAkB,EAAE;IACxC,MAAMC,WAAW,GAAG,IAAIC,mCAAsB,EAAE;IAChD,MAAMC,iBAAiB,GAAG,IAAIC,4BAAiB,EAAE;IAEjD,KAAK,CAAC;MACJP,QAAQ;MACRC,aAAa;MACbO,qBAAqB,EAAE;QACrBC,eAAe,EAAEP,OAAO;QACxBQ,mBAAmB,EAAEN,WAAW;QAChCO,yBAAyB,EAAEL,iBAAiB;QAC5CM,mBAAmB,EAAE;UACnBC,IAAI,EAAEC,0BAAO,CAACC,UAAU;UACxBC,OAAO;QACT;MACF;IACF,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAaC,UAAUA,CAACC,QAAkB,EAAoB;IAC5D,OAAO,KAAK,CAACD,UAAU,CAACC,QAAQ,CAAC;EACnC;AACF;AAACC,OAAA,CAAAtB,eAAA,GAAAA,eAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kameleoon/javascript-sdk",
3
- "version": "1.3.3",
3
+ "version": "1.4.1",
4
4
  "description": "Kameleoon JavaScript SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",