tradly 1.2.5 → 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/App.js CHANGED
@@ -189,7 +189,7 @@ class App {
189
189
  }
190
190
  }
191
191
  async getGroupedSecureConfigList(
192
- param = { paramBody, authKey, domain_id, barrow_access_key }
192
+ param = { paramBody, authKey, domain_id, barrow_access_key },
193
193
  ) {
194
194
  let url = `${GROUPCONFIGLIST}${param.paramBody}&domain_id=${APPCONSTANT.DOMAIN_ID}`;
195
195
  try {
@@ -343,9 +343,8 @@ class App {
343
343
  }
344
344
  async uploadS3Image(param = ImageConfig) {
345
345
  try {
346
- const [error, responseJson] = await network.uploadImage(
347
- param
348
- );
346
+ const [error, responseJson] =
347
+ await network.uploadImage(param);
349
348
  if (error) {
350
349
  return error;
351
350
  } else {
@@ -869,7 +868,7 @@ class App {
869
868
  }
870
869
 
871
870
  async followUnfollowAccounts(
872
- param = { id, authKey, isFollowing: Boolean }
871
+ param = { id, authKey, isFollowing: Boolean },
873
872
  ) {
874
873
  let method = param.isFollowing ? Method.DELETE : Method.POST;
875
874
  let path = ACCOUNTS + `/${param.id}` + FOLLOW;
@@ -990,7 +989,7 @@ class App {
990
989
  param.rule_id == undefined || param.rule_id == ""
991
990
  ? LISTINGS + `/${param.listing_id}/price_rules`
992
991
  : LISTINGS +
993
- `/${param.listing_id}/price_rules/${param.rule_id}`;
992
+ `/${param.listing_id}/price_rules/${param.rule_id}`;
994
993
  try {
995
994
  const [error, responseJson] = await network.networkCall({
996
995
  path: path,
@@ -1013,7 +1012,7 @@ class App {
1013
1012
  }
1014
1013
 
1015
1014
  async getListingsPricingRules(
1016
- param = { bodyParam, authKey, listing_id }
1015
+ param = { bodyParam, authKey, listing_id },
1017
1016
  ) {
1018
1017
  let url =
1019
1018
  param.bodyParam == undefined || param.bodyParam == ""
@@ -1042,7 +1041,7 @@ class App {
1042
1041
  }
1043
1042
  }
1044
1043
  async getListingSinglePricingRule(
1045
- param = { bodyParam, authKey, listing_id, rule_id }
1044
+ param = { bodyParam, authKey, listing_id, rule_id },
1046
1045
  ) {
1047
1046
  let url =
1048
1047
  param.bodyParam == undefined || param.bodyParam == ""
@@ -1072,7 +1071,7 @@ class App {
1072
1071
  }
1073
1072
 
1074
1073
  async deleteListingPricingRule(
1075
- param = { id, authKey, listing_id, rule_id }
1074
+ param = { id, authKey, listing_id, rule_id },
1076
1075
  ) {
1077
1076
  try {
1078
1077
  const [error, responseJson] = await network.networkCall({
@@ -1145,6 +1144,30 @@ class App {
1145
1144
  return error;
1146
1145
  }
1147
1146
  }
1147
+ async getListingsSuggestion(param = { bodyParam, authKey }) {
1148
+ let url =
1149
+ param.bodyParam == undefined || param.bodyParam == ""
1150
+ ? ""
1151
+ : `?${serialization(param.bodyParam)}`;
1152
+ try {
1153
+ const [error, responseJson] = await network.networkCall({
1154
+ path: LISTINGS + "/search/suggestions" + url,
1155
+ method: Method.GET,
1156
+ authKey: param.authKey,
1157
+ currency: param.currency,
1158
+ language: param.language,
1159
+ pkKey: param.pkKey,
1160
+ baseURL: param.baseURL,
1161
+ });
1162
+ if (error) {
1163
+ return error;
1164
+ } else {
1165
+ return responseJson;
1166
+ }
1167
+ } catch (error) {
1168
+ return error;
1169
+ }
1170
+ }
1148
1171
  async getListingDetail(param = { id, slug, authKey }) {
1149
1172
  var path = "";
1150
1173
  if (param.id != undefined) {
@@ -1567,7 +1590,7 @@ class App {
1567
1590
  }
1568
1591
  }
1569
1592
  async getListingVariantDetails(
1570
- param = { authKey, listingId, variant_id }
1593
+ param = { authKey, listingId, variant_id },
1571
1594
  ) {
1572
1595
  try {
1573
1596
  const [error, responseJson] = await network.networkCall({
@@ -1601,9 +1624,9 @@ class App {
1601
1624
  param.id == undefined || param.id == ""
1602
1625
  ? LISTINGS + `/${param.listingId}` + VARIANTS
1603
1626
  : LISTINGS +
1604
- `/${param.listingId}` +
1605
- VARIANTS +
1606
- `/${param.id}`;
1627
+ `/${param.listingId}` +
1628
+ VARIANTS +
1629
+ `/${param.id}`;
1607
1630
  try {
1608
1631
  const [error, responseJson] = await network.networkCall({
1609
1632
  path: path,
@@ -1772,9 +1795,9 @@ class App {
1772
1795
  param.id == undefined || param.id == ""
1773
1796
  ? VARIANTTYPES + `/${param.id}` + VALUES
1774
1797
  : VARIANTTYPES +
1775
- `/${param.id}` +
1776
- VALUES +
1777
- `/${param.valueID}`;
1798
+ `/${param.id}` +
1799
+ VALUES +
1800
+ `/${param.valueID}`;
1778
1801
  let method =
1779
1802
  param.id == undefined || param.id == ""
1780
1803
  ? Method.POST
@@ -1884,7 +1907,7 @@ class App {
1884
1907
  path:
1885
1908
  CATEGORY +
1886
1909
  `/by_slug/${encodeURIComponent(
1887
- param.slug
1910
+ param.slug,
1888
1911
  )}` +
1889
1912
  url,
1890
1913
  method: Method.GET,
@@ -2128,9 +2151,9 @@ class App {
2128
2151
  param.id == undefined || param.id == ""
2129
2152
  ? ATTRIBUTE + `/${param.id}` + VALUES
2130
2153
  : ATTRIBUTE +
2131
- `/${param.id}` +
2132
- VALUES +
2133
- `/${param.valueID}`;
2154
+ `/${param.id}` +
2155
+ VALUES +
2156
+ `/${param.valueID}`;
2134
2157
  let method =
2135
2158
  param.id == undefined || param.id == ""
2136
2159
  ? Method.POST
@@ -2846,7 +2869,7 @@ class App {
2846
2869
  }
2847
2870
  }
2848
2871
  async updateShipmentStatus(
2849
- param = { authKey, id, shipment_id, data, bodyParam }
2872
+ param = { authKey, id, shipment_id, data, bodyParam },
2850
2873
  ) {
2851
2874
  let url =
2852
2875
  param.bodyParam == undefined || param.bodyParam == ""
@@ -2902,7 +2925,7 @@ class App {
2902
2925
  }
2903
2926
  }
2904
2927
  async updateOrderShipment(
2905
- param = { authKey, order_id, shipment_id, data, bodyParam }
2928
+ param = { authKey, order_id, shipment_id, data, bodyParam },
2906
2929
  ) {
2907
2930
  let url =
2908
2931
  param.bodyParam == undefined || param.bodyParam == ""
@@ -3065,7 +3088,7 @@ class App {
3065
3088
  }
3066
3089
  }
3067
3090
  async confirmOrderByUser(
3068
- param = { authKey, data, bodyParam, order_ref, access_key }
3091
+ param = { authKey, data, bodyParam, order_ref, access_key },
3069
3092
  ) {
3070
3093
  try {
3071
3094
  const [error, responseJson] = await network.networkCall({
@@ -3162,7 +3185,7 @@ class App {
3162
3185
 
3163
3186
  //
3164
3187
  async getExternalShipmentMethods(
3165
- param = { authKey, shipping_method_id, bodyParam }
3188
+ param = { authKey, shipping_method_id, bodyParam },
3166
3189
  ) {
3167
3190
  let url =
3168
3191
  param.bodyParam == undefined || param.bodyParam == ""
@@ -3191,7 +3214,7 @@ class App {
3191
3214
  }
3192
3215
 
3193
3216
  async getExternalShipmentLabel(
3194
- param = { authKey, order_id, shipment_id }
3217
+ param = { authKey, order_id, shipment_id },
3195
3218
  ) {
3196
3219
  try {
3197
3220
  const [error, responseJson] = await network.networkCall({
@@ -4367,7 +4390,7 @@ class App {
4367
4390
  }
4368
4391
 
4369
4392
  async postAndEditDigitalContent(
4370
- param = { listing_id, content_id, authKey, data }
4393
+ param = { listing_id, content_id, authKey, data },
4371
4394
  ) {
4372
4395
  let method =
4373
4396
  param.content_id == undefined || param.content_id == ""
@@ -4564,7 +4587,7 @@ class App {
4564
4587
 
4565
4588
  // get subscribeByMangopay details
4566
4589
  async subscribeByMangopay(
4567
- param = { listing_id, authKey, data, currency }
4590
+ param = { listing_id, authKey, data, currency },
4568
4591
  ) {
4569
4592
  try {
4570
4593
  const [error, responseJson] = await network.networkCall({
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.5",
3
+ "version": "1.2.7",
4
4
  "description": "Tradly JS SDK",
5
5
  "main": "index.js",
6
6
  "type": "module",