@cords/sdk 0.0.12 → 0.0.13
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.js +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +1 -1
- package/src/index.ts +10 -2
package/dist/index.js
CHANGED
|
@@ -62,7 +62,6 @@ var CordsAPI = ({
|
|
|
62
62
|
baseUrl: customBaseUrl
|
|
63
63
|
}) => {
|
|
64
64
|
const baseUrl = customBaseUrl ? customBaseUrl == null ? void 0 : customBaseUrl.replace(/\/$/, "") : version === "production" ? "https://api.cords.ai" : "https://api.cords.dev";
|
|
65
|
-
console.log("test", baseUrl);
|
|
66
65
|
const request = async (input, init) => {
|
|
67
66
|
const res = await fetch(input, __spreadProps(__spreadValues({}, init), {
|
|
68
67
|
headers: __spreadValues(__spreadValues({
|
|
@@ -112,12 +111,14 @@ var CordsAPI = ({
|
|
|
112
111
|
"calculateCityFromSearchString",
|
|
113
112
|
calculateCityFromSearchString ? "true" : "false"
|
|
114
113
|
);
|
|
115
|
-
if (options.partner)
|
|
114
|
+
if (options.partner && // Don't add if all values are true (defaults to all)
|
|
115
|
+
!Object.values(options.partner).every((value) => value === true)) {
|
|
116
116
|
for (const [key, value] of Object.entries(options.partner)) {
|
|
117
117
|
params.append(`filter[${key}]`, value ? "true" : "false");
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
if (options.delivery)
|
|
120
|
+
if (options.delivery && // Don't add if all values are true (defaults to all)
|
|
121
|
+
!Object.values(options.delivery).every((value) => value === true)) {
|
|
121
122
|
for (const [key, value] of Object.entries(options.delivery)) {
|
|
122
123
|
params.append(
|
|
123
124
|
`filter[delivery][${key}]`,
|
package/dist/index.mjs
CHANGED
|
@@ -39,7 +39,6 @@ var CordsAPI = ({
|
|
|
39
39
|
baseUrl: customBaseUrl
|
|
40
40
|
}) => {
|
|
41
41
|
const baseUrl = customBaseUrl ? customBaseUrl == null ? void 0 : customBaseUrl.replace(/\/$/, "") : version === "production" ? "https://api.cords.ai" : "https://api.cords.dev";
|
|
42
|
-
console.log("test", baseUrl);
|
|
43
42
|
const request = async (input, init) => {
|
|
44
43
|
const res = await fetch(input, __spreadProps(__spreadValues({}, init), {
|
|
45
44
|
headers: __spreadValues(__spreadValues({
|
|
@@ -89,12 +88,14 @@ var CordsAPI = ({
|
|
|
89
88
|
"calculateCityFromSearchString",
|
|
90
89
|
calculateCityFromSearchString ? "true" : "false"
|
|
91
90
|
);
|
|
92
|
-
if (options.partner)
|
|
91
|
+
if (options.partner && // Don't add if all values are true (defaults to all)
|
|
92
|
+
!Object.values(options.partner).every((value) => value === true)) {
|
|
93
93
|
for (const [key, value] of Object.entries(options.partner)) {
|
|
94
94
|
params.append(`filter[${key}]`, value ? "true" : "false");
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
if (options.delivery)
|
|
97
|
+
if (options.delivery && // Don't add if all values are true (defaults to all)
|
|
98
|
+
!Object.values(options.delivery).every((value) => value === true)) {
|
|
98
99
|
for (const [key, value] of Object.entries(options.delivery)) {
|
|
99
100
|
params.append(
|
|
100
101
|
`filter[delivery][${key}]`,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -90,14 +90,22 @@ export const CordsAPI = ({
|
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
// Add partner parameters
|
|
93
|
-
if (
|
|
93
|
+
if (
|
|
94
|
+
options.partner &&
|
|
95
|
+
// Don't add if all values are true (defaults to all)
|
|
96
|
+
!Object.values(options.partner).every((value) => value === true)
|
|
97
|
+
) {
|
|
94
98
|
for (const [key, value] of Object.entries(options.partner)) {
|
|
95
99
|
params.append(`filter[${key}]`, value ? "true" : "false");
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
// Add delivery parameters
|
|
100
|
-
if (
|
|
104
|
+
if (
|
|
105
|
+
options.delivery &&
|
|
106
|
+
// Don't add if all values are true (defaults to all)
|
|
107
|
+
!Object.values(options.delivery).every((value) => value === true)
|
|
108
|
+
) {
|
|
101
109
|
for (const [key, value] of Object.entries(options.delivery)) {
|
|
102
110
|
params.append(
|
|
103
111
|
`filter[delivery][${key}]`,
|