tradly 1.2.6 → 1.2.7

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/Roots/InitV2.js CHANGED
@@ -11,14 +11,14 @@ const tenantConfigCache = new Map();
11
11
 
12
12
  class InitV2 {
13
13
  async config(
14
- init = { domain, env, custom_header, is_skip_pk_by_domain }
14
+ init = { domain, env, custom_header, is_skip_pk_by_domain },
15
15
  ) {
16
16
  const { domain, env, custom_header, is_skip_pk_by_domain } =
17
17
  init || {};
18
18
 
19
19
  if (!domain || !env) {
20
20
  throw new Error(
21
- "[Tradly InitV2] `domain` and `env` are required for initialization."
21
+ "[Tradly InitV2] `domain` and `env` are required for initialization.",
22
22
  );
23
23
  }
24
24
 
@@ -49,14 +49,19 @@ class InitV2 {
49
49
  authConfig.domain === domain &&
50
50
  authConfig.env === env
51
51
  ) {
52
- const pkData = getCachedPKKeyFromAuth(domain, env);
52
+ const pkData = getCachedPKKeyFromAuth(
53
+ domain,
54
+ env,
55
+ );
53
56
  if (pkData?.key) {
54
57
  // Use auth's PK key
55
58
  APPCONSTANT.TOKEN = pkData.key;
56
- APPCONSTANT.DOMAIN_ID = pkData.domain?.id ?? 0;
59
+ APPCONSTANT.DOMAIN_ID =
60
+ pkData.domain?.id ?? 0;
57
61
  APPCONSTANT.ENVIRONMENT = env;
58
62
  APPCONSTANT.DOMAIN = domain;
59
- APPCONSTANT.CUSTOM_HEADER = custom_header || {};
63
+ APPCONSTANT.CUSTOM_HEADER =
64
+ custom_header || {};
60
65
  APPCONSTANT.IS_SKIP_PK_BY_DOMAIN =
61
66
  is_skip_pk_by_domain ?? false;
62
67
 
@@ -64,10 +69,19 @@ class InitV2 {
64
69
  const result = {
65
70
  status: true,
66
71
  key: pkData.key,
67
- domain_details: pkData.domain || { id: 0 },
68
- tenant_name: pkData.domain?.tenant_name || "",
72
+ domain_details:
73
+ pkData.domain || {
74
+ id: 0,
75
+ },
76
+ tenant_name:
77
+ pkData.domain
78
+ ?.tenant_name ||
79
+ "",
69
80
  };
70
- tenantConfigCache.set(cacheKey, result);
81
+ tenantConfigCache.set(
82
+ cacheKey,
83
+ result,
84
+ );
71
85
 
72
86
  return result;
73
87
  }
@@ -76,7 +90,7 @@ class InitV2 {
76
90
  // Auth package available but not initialized or error, continue normally
77
91
  console.warn(
78
92
  "[Tradly InitV2] Could not sync with auth package:",
79
- e
93
+ e,
80
94
  );
81
95
  }
82
96
  }
@@ -105,8 +119,8 @@ class InitV2 {
105
119
  try {
106
120
  const base =
107
121
  env && env.toString().startsWith("dev")
108
- ? "https://api.dev.tradly.app"
109
- : "https://api.tradly.app";
122
+ ? "https://skua.dev.tradly.app"
123
+ : "https://skua.tradly.app";
110
124
 
111
125
  const response = await axios({
112
126
  url: `${base}/skua/tenants/pk_by_domain?domain=${domain}&env=${env}`,
@@ -119,7 +133,7 @@ class InitV2 {
119
133
 
120
134
  if (!response?.data?.status) {
121
135
  throw new Error(
122
- "[Tradly InitV2] Unable to fetch tenant config for given domain/env."
136
+ "[Tradly InitV2] Unable to fetch tenant config for given domain/env.",
123
137
  );
124
138
  }
125
139
 
package/Roots/SetSDK.js CHANGED
@@ -10,7 +10,7 @@ import app from "./App.js";
10
10
 
11
11
  class SetSDK {
12
12
  async config(
13
- init = { domain, env, custom_header, pk_key, domain_details }
13
+ init = { domain, env, custom_header, pk_key, domain_details },
14
14
  ) {
15
15
  try {
16
16
  if (
@@ -38,8 +38,8 @@ class SetSDK {
38
38
  const response = await axios({
39
39
  url: `${
40
40
  init.env.startsWith("dev")
41
- ? "https://api.dev.tradly.app"
42
- : "https://api.tradly.app"
41
+ ? "https://skua.dev.tradly.app"
42
+ : "https://skua.tradly.app"
43
43
  }/skua/tenants/pk_by_domain?domain=${
44
44
  init.domain
45
45
  }&env=${init.env}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tradly",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "Tradly JS SDK",
5
5
  "main": "index.js",
6
6
  "type": "module",