tradly 1.1.24 → 1.1.26

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.
@@ -4,6 +4,7 @@ export var APPCONSTANT = {
4
4
  ENVIRONMENT: "",
5
5
  DOMAIN: "",
6
6
  DOMAIN_ID: 0,
7
+ CUSTOM_HEADER: {},
7
8
  };
8
9
 
9
10
  export const TYPES = {
@@ -45,6 +45,9 @@ export const FOLLOW = "/follow";
45
45
  export const BLOCK = "/block";
46
46
  export const REPORT = "/report";
47
47
 
48
+ export const SSO_ENABLED = "/v1/users/sso";
49
+ export const SSO_RETURN = "/v1/users/sso_return";
50
+
48
51
  export const LISTINGS = "/products/v1/listings";
49
52
  export const LISTINGSUNIQUELOCATIONS = "/products/v1/listings/unique/locations";
50
53
  export const LIKE = "/likes";
@@ -52,6 +52,12 @@ class NetworkManager {
52
52
  if (config.language != undefined || config.language == "") {
53
53
  header["X-Language"] = config.language;
54
54
  }
55
+ if (Object.keys(APPCONSTANT.CUSTOM_HEADER).length > 0) {
56
+ Object.keys(APPCONSTANT.CUSTOM_HEADER).forEach((key) => {
57
+ header[key] = APPCONSTANT.CUSTOM_HEADER[key];
58
+ });
59
+ }
60
+
55
61
  const [err, response] = await to(
56
62
  axios({
57
63
  url: url,
package/Roots/App.js CHANGED
@@ -73,6 +73,8 @@ import {
73
73
  COLLECTIONS_DATA,
74
74
  ACCOUNTSUNIQUELOCATIONS,
75
75
  NEGOTIATE,
76
+ SSO_RETURN,
77
+ SSO_ENABLED,
76
78
  } from "./../Constants/PathConstant.js";
77
79
  import serialization from "../Helper/Serialization.js";
78
80
  import { ImageConfig } from "../Helper/APIParam.js";
@@ -3032,6 +3034,46 @@ class App {
3032
3034
  return error;
3033
3035
  }
3034
3036
  }
3037
+
3038
+ // SSO
3039
+ async postSsoReturn(param = { authKey, data, currency }) {
3040
+ try {
3041
+ const [error, responseJson] = await network.networkCall({
3042
+ path: SSO_RETURN,
3043
+ method: Method.POST,
3044
+ authKey: param.authKey,
3045
+ currency: param.currency,
3046
+ language: param.language,
3047
+ param: param.data,
3048
+ });
3049
+ if (error) {
3050
+ return error;
3051
+ } else {
3052
+ return responseJson;
3053
+ }
3054
+ } catch (error) {
3055
+ return error;
3056
+ }
3057
+ }
3058
+ async postSsoEnabled(param = { authKey, data, currency }) {
3059
+ try {
3060
+ const [error, responseJson] = await network.networkCall({
3061
+ path: SSO_ENABLED,
3062
+ method: Method.POST,
3063
+ authKey: param.authKey,
3064
+ currency: param.currency,
3065
+ language: param.language,
3066
+ param: param.data,
3067
+ });
3068
+ if (error) {
3069
+ return error;
3070
+ } else {
3071
+ return responseJson;
3072
+ }
3073
+ } catch (error) {
3074
+ return error;
3075
+ }
3076
+ }
3035
3077
  }
3036
3078
  const app = new App();
3037
3079
  export default app;
@@ -8,7 +8,6 @@ class InitializeSDK {
8
8
  async config(init = { token, environment }) {
9
9
  APPCONSTANT.TOKEN = init.token;
10
10
  APPCONSTANT.ENVIRONMENT = init.environment;
11
- console.log("Success!!");
12
11
  }
13
12
  async refreshAPI(refreshKey) {
14
13
  try {
package/Roots/SetSDK.js CHANGED
@@ -9,7 +9,7 @@ import network, { Method } from "./../NetworkManager/NetworkManager.js";
9
9
  import app from "./App.js";
10
10
 
11
11
  class SetSDK {
12
- async config(init = { domain, env }) {
12
+ async config(init = { domain, env, custom_header }) {
13
13
  try {
14
14
  const response = await axios({
15
15
  url: `${
@@ -31,6 +31,9 @@ class SetSDK {
31
31
  response.data.data.domain?.id ?? 0;
32
32
  APPCONSTANT.ENVIRONMENT = init.env;
33
33
  APPCONSTANT.DOMAIN = init.domain;
34
+ APPCONSTANT.CUSTOM_HEADER = init.custom_header
35
+ ? init.custom_header
36
+ : {};
34
37
  return true;
35
38
  }
36
39
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tradly",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "Tradly JS SDK",
5
5
  "main": "index.js",
6
6
  "type": "module",