@ptkl/sdk 0.9.5 → 0.9.6

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/dist/index.esm.js CHANGED
@@ -35,13 +35,13 @@ const isBrowser = typeof window !== "undefined" &&
35
35
  class PlatformBaseClient extends BaseClient {
36
36
  constructor(options) {
37
37
  var _a, _b;
38
- let { env = null, token = null, host = null, } = options !== null && options !== undefined ? options : {};
38
+ let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
39
39
  let headers = {};
40
40
  var project_uuid = null;
41
41
  if (isBrowser) {
42
42
  console.log("DEBUG", sessionStorage.getItem('protokol_context'));
43
43
  if (sessionStorage.getItem('protokol_context') == "forge") {
44
- headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== undefined ? _a : "dev";
44
+ headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== void 0 ? _a : "dev";
45
45
  }
46
46
  else {
47
47
  // this potentially means that it is running as dev server in local
@@ -50,12 +50,12 @@ class PlatformBaseClient extends BaseClient {
50
50
  }
51
51
  if (typeof window !== "undefined") {
52
52
  // @ts-ignore
53
- const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
54
- host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
53
+ const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
54
+ host = (_b = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _b !== void 0 ? _b : host;
55
55
  // @ts-ignore
56
- env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
57
- token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
58
- project_uuid = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_UUID;
56
+ env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
57
+ token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
58
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
59
59
  }
60
60
  if (token) {
61
61
  headers['Authorization'] = `Bearer ${token}`;
@@ -67,8 +67,8 @@ class PlatformBaseClient extends BaseClient {
67
67
  headers['X-Project-Uuid'] = project_uuid;
68
68
  }
69
69
  const client = axios.create({
70
- baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io",
71
- timeout: 15000,
70
+ baseURL: host !== null && host !== void 0 ? host : "https://lemon.protokol.io",
71
+ timeout: 30000,
72
72
  headers: {
73
73
  ...headers,
74
74
  'Content-Type': 'application/json',
@@ -240,7 +240,7 @@ class Component extends PlatformBaseClient {
240
240
  * )
241
241
  **/
242
242
  async find(filters, opts) {
243
- const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== undefined ? opts : {};
243
+ const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== void 0 ? opts : {};
244
244
  let payload = {
245
245
  context: filters,
246
246
  ref: this.ref,
@@ -280,6 +280,9 @@ class Component extends PlatformBaseClient {
280
280
  }
281
281
  if (opts) {
282
282
  Object.keys(opts).forEach(k => {
283
+ if (['cache', 'buildttl', 'locale'].includes(k)) {
284
+ return;
285
+ }
283
286
  params[`_opt_${k}`] = opts ? opts[k] : null;
284
287
  });
285
288
  }
@@ -535,7 +538,7 @@ class Platform extends PlatformBaseClient {
535
538
  }
536
539
  getPlatformBaseURL() {
537
540
  var _a;
538
- return (_a = this.client.defaults.baseURL) !== null && _a !== undefined ? _a : "";
541
+ return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
539
542
  }
540
543
  apiUser() {
541
544
  return (new APIUser()).setClient(this.client);
@@ -606,12 +609,12 @@ class Invoicing extends PlatformBaseClient {
606
609
  class IntegrationsBaseClient extends BaseClient {
607
610
  constructor(options) {
608
611
  var _a, _b;
609
- let { env = null, token, host, } = options !== null && options !== undefined ? options : {};
612
+ let { env = null, token, host, } = options !== null && options !== void 0 ? options : {};
610
613
  let headers = {};
611
614
  var project_uuid = null;
612
615
  if (isBrowser) {
613
616
  if (sessionStorage.getItem('protokol_context') == "forge") {
614
- headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== undefined ? _a : "dev";
617
+ headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== void 0 ? _a : "dev";
615
618
  }
616
619
  else {
617
620
  // this potentially means that it is running as dev server in local
@@ -620,13 +623,13 @@ class IntegrationsBaseClient extends BaseClient {
620
623
  }
621
624
  if (typeof window !== "undefined") {
622
625
  // @ts-ignore
623
- const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
624
- host = (_b = __global_env__.INTEGRATION_API) !== null && _b !== undefined ? _b : host;
626
+ const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
627
+ host = (_b = __global_env__.INTEGRATION_API) !== null && _b !== void 0 ? _b : host;
625
628
  // @ts-ignore
626
- token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
629
+ token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
627
630
  // @ts-ignore
628
- env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
629
- project_uuid = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_UUID;
631
+ env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
632
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
630
633
  }
631
634
  if (token) {
632
635
  headers['Authorization'] = `Bearer ${token}`;
@@ -638,8 +641,8 @@ class IntegrationsBaseClient extends BaseClient {
638
641
  headers['X-Project-Uuid'] = project_uuid;
639
642
  }
640
643
  const client = axios.create({
641
- baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
642
- timeout: 15000,
644
+ baseURL: host !== null && host !== void 0 ? host : "https://lemon.protokol.io/luma/integrations",
645
+ timeout: 30000,
643
646
  headers: {
644
647
  ...headers,
645
648
  },
@@ -809,7 +812,7 @@ class Payments extends IntegrationsBaseClient {
809
812
  return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
810
813
  totalAmount: options.totalAmount.toString(),
811
814
  description: options.description,
812
- redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
815
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : null,
813
816
  });
814
817
  }
815
818
  }
@@ -36,13 +36,13 @@ var ProtokolSDK09 = (function (exports, axios) {
36
36
  class PlatformBaseClient extends BaseClient {
37
37
  constructor(options) {
38
38
  var _a, _b;
39
- let { env = null, token = null, host = null, } = options !== null && options !== undefined ? options : {};
39
+ let { env = null, token = null, host = null, } = options !== null && options !== void 0 ? options : {};
40
40
  let headers = {};
41
41
  var project_uuid = null;
42
42
  if (isBrowser) {
43
43
  console.log("DEBUG", sessionStorage.getItem('protokol_context'));
44
44
  if (sessionStorage.getItem('protokol_context') == "forge") {
45
- headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== undefined ? _a : "dev";
45
+ headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== void 0 ? _a : "dev";
46
46
  }
47
47
  else {
48
48
  // this potentially means that it is running as dev server in local
@@ -51,12 +51,12 @@ var ProtokolSDK09 = (function (exports, axios) {
51
51
  }
52
52
  if (typeof window !== "undefined") {
53
53
  // @ts-ignore
54
- const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
55
- host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
54
+ const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
55
+ host = (_b = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _b !== void 0 ? _b : host;
56
56
  // @ts-ignore
57
- env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
58
- token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
59
- project_uuid = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_UUID;
57
+ env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
58
+ token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
59
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
60
60
  }
61
61
  if (token) {
62
62
  headers['Authorization'] = `Bearer ${token}`;
@@ -68,8 +68,8 @@ var ProtokolSDK09 = (function (exports, axios) {
68
68
  headers['X-Project-Uuid'] = project_uuid;
69
69
  }
70
70
  const client = axios.create({
71
- baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io",
72
- timeout: 15000,
71
+ baseURL: host !== null && host !== void 0 ? host : "https://lemon.protokol.io",
72
+ timeout: 30000,
73
73
  headers: {
74
74
  ...headers,
75
75
  'Content-Type': 'application/json',
@@ -241,7 +241,7 @@ var ProtokolSDK09 = (function (exports, axios) {
241
241
  * )
242
242
  **/
243
243
  async find(filters, opts) {
244
- const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== undefined ? opts : {};
244
+ const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== void 0 ? opts : {};
245
245
  let payload = {
246
246
  context: filters,
247
247
  ref: this.ref,
@@ -281,6 +281,9 @@ var ProtokolSDK09 = (function (exports, axios) {
281
281
  }
282
282
  if (opts) {
283
283
  Object.keys(opts).forEach(k => {
284
+ if (['cache', 'buildttl', 'locale'].includes(k)) {
285
+ return;
286
+ }
284
287
  params[`_opt_${k}`] = opts ? opts[k] : null;
285
288
  });
286
289
  }
@@ -536,7 +539,7 @@ var ProtokolSDK09 = (function (exports, axios) {
536
539
  }
537
540
  getPlatformBaseURL() {
538
541
  var _a;
539
- return (_a = this.client.defaults.baseURL) !== null && _a !== undefined ? _a : "";
542
+ return (_a = this.client.defaults.baseURL) !== null && _a !== void 0 ? _a : "";
540
543
  }
541
544
  apiUser() {
542
545
  return (new APIUser()).setClient(this.client);
@@ -607,12 +610,12 @@ var ProtokolSDK09 = (function (exports, axios) {
607
610
  class IntegrationsBaseClient extends BaseClient {
608
611
  constructor(options) {
609
612
  var _a, _b;
610
- let { env = null, token, host, } = options !== null && options !== undefined ? options : {};
613
+ let { env = null, token, host, } = options !== null && options !== void 0 ? options : {};
611
614
  let headers = {};
612
615
  var project_uuid = null;
613
616
  if (isBrowser) {
614
617
  if (sessionStorage.getItem('protokol_context') == "forge") {
615
- headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== undefined ? _a : "dev";
618
+ headers['X-Project-Env'] = (_a = sessionStorage.getItem('forge_app_env')) !== null && _a !== void 0 ? _a : "dev";
616
619
  }
617
620
  else {
618
621
  // this potentially means that it is running as dev server in local
@@ -621,13 +624,13 @@ var ProtokolSDK09 = (function (exports, axios) {
621
624
  }
622
625
  if (typeof window !== "undefined") {
623
626
  // @ts-ignore
624
- const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
625
- host = (_b = __global_env__.INTEGRATION_API) !== null && _b !== undefined ? _b : host;
627
+ const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
628
+ host = (_b = __global_env__.INTEGRATION_API) !== null && _b !== void 0 ? _b : host;
626
629
  // @ts-ignore
627
- token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
630
+ token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
628
631
  // @ts-ignore
629
- env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
630
- project_uuid = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_UUID;
632
+ env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
633
+ project_uuid = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_UUID;
631
634
  }
632
635
  if (token) {
633
636
  headers['Authorization'] = `Bearer ${token}`;
@@ -639,8 +642,8 @@ var ProtokolSDK09 = (function (exports, axios) {
639
642
  headers['X-Project-Uuid'] = project_uuid;
640
643
  }
641
644
  const client = axios.create({
642
- baseURL: host !== null && host !== undefined ? host : "https://lemon.protokol.io/luma/integrations",
643
- timeout: 15000,
645
+ baseURL: host !== null && host !== void 0 ? host : "https://lemon.protokol.io/luma/integrations",
646
+ timeout: 30000,
644
647
  headers: {
645
648
  ...headers,
646
649
  },
@@ -810,7 +813,7 @@ var ProtokolSDK09 = (function (exports, axios) {
810
813
  return await this.client.post(`/karadjordje/v1/payment/${provider}/${user}/getPaymentLink`, {
811
814
  totalAmount: options.totalAmount.toString(),
812
815
  description: options.description,
813
- redirectUrl: (_a = options.redirectUrl) !== null && _a !== undefined ? _a : null,
816
+ redirectUrl: (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : null,
814
817
  });
815
818
  }
816
819
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"
@@ -33,6 +33,7 @@
33
33
  "rollup": "^4.30.1",
34
34
  "rollup-plugin-copy": "^3.5.0",
35
35
  "rollup-plugin-polyfill-node": "^0.13.0",
36
+ "tslib": "^2.8.1",
36
37
  "typedoc": "^0.28.4",
37
38
  "typescript": "^5.6.3"
38
39
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"
@@ -33,6 +33,7 @@
33
33
  "rollup": "^4.30.1",
34
34
  "rollup-plugin-copy": "^3.5.0",
35
35
  "rollup-plugin-polyfill-node": "^0.13.0",
36
+ "tslib": "^2.8.1",
36
37
  "typedoc": "^0.28.4",
37
38
  "typescript": "^5.6.3"
38
39
  },