arky-sdk 0.7.60 → 0.7.61
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.cjs +488 -390
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +279 -217
- package/dist/index.d.ts +279 -217
- package/dist/index.js +488 -390
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1897,166 +1897,197 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
1897
1897
|
`${base(params.businessId)}/integrations/config/${params.type}`,
|
|
1898
1898
|
options
|
|
1899
1899
|
);
|
|
1900
|
-
}
|
|
1901
|
-
},
|
|
1902
|
-
cms: {
|
|
1903
|
-
async getNode(params, options) {
|
|
1904
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1905
|
-
let identifier;
|
|
1906
|
-
if (params.id) {
|
|
1907
|
-
identifier = params.id;
|
|
1908
|
-
} else if (params.slug) {
|
|
1909
|
-
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
1910
|
-
} else if (params.key) {
|
|
1911
|
-
identifier = `${businessId}:${params.key}`;
|
|
1912
|
-
} else {
|
|
1913
|
-
throw new Error("GetNodeParams requires id, slug, or key");
|
|
1914
|
-
}
|
|
1915
|
-
const response = await apiConfig.httpClient.get(
|
|
1916
|
-
`${base(businessId)}/nodes/${identifier}`,
|
|
1917
|
-
options
|
|
1918
|
-
);
|
|
1919
|
-
return {
|
|
1920
|
-
...response,
|
|
1921
|
-
getBlock(key) {
|
|
1922
|
-
return getBlockFromArray(response, key, apiConfig.locale);
|
|
1923
|
-
},
|
|
1924
|
-
getBlockValues(key) {
|
|
1925
|
-
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
1926
|
-
},
|
|
1927
|
-
getImage(key) {
|
|
1928
|
-
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
1929
|
-
return getImageUrl(block, true);
|
|
1930
|
-
}
|
|
1931
|
-
};
|
|
1932
1900
|
},
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1901
|
+
location: {
|
|
1902
|
+
getCountries(options) {
|
|
1903
|
+
return apiConfig.httpClient.get(`/v1/platform/countries`, options);
|
|
1904
|
+
},
|
|
1905
|
+
getCountry(countryCode, options) {
|
|
1906
|
+
return apiConfig.httpClient.get(
|
|
1907
|
+
`/v1/platform/countries/${countryCode}`,
|
|
1908
|
+
options
|
|
1909
|
+
);
|
|
1910
|
+
},
|
|
1911
|
+
list(options) {
|
|
1912
|
+
return apiConfig.httpClient.get(`${base()}/locations`, options);
|
|
1913
|
+
},
|
|
1914
|
+
get(id, options) {
|
|
1915
|
+
return apiConfig.httpClient.get(`${base()}/locations/${id}`, options);
|
|
1916
|
+
}
|
|
1939
1917
|
},
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1918
|
+
market: {
|
|
1919
|
+
list(options) {
|
|
1920
|
+
return apiConfig.httpClient.get(`${base()}/markets`, options);
|
|
1921
|
+
},
|
|
1922
|
+
get(id, options) {
|
|
1923
|
+
return apiConfig.httpClient.get(`${base()}/markets/${id}`, options);
|
|
1924
|
+
}
|
|
1946
1925
|
}
|
|
1947
1926
|
},
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1927
|
+
cms: {
|
|
1928
|
+
node: {
|
|
1929
|
+
async get(params, options) {
|
|
1930
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1931
|
+
let identifier;
|
|
1932
|
+
if (params.id) {
|
|
1933
|
+
identifier = params.id;
|
|
1934
|
+
} else if (params.slug) {
|
|
1935
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
1936
|
+
} else if (params.key) {
|
|
1937
|
+
identifier = `${businessId}:${params.key}`;
|
|
1938
|
+
} else {
|
|
1939
|
+
throw new Error("GetNodeParams requires id, slug, or key");
|
|
1940
|
+
}
|
|
1941
|
+
const response = await apiConfig.httpClient.get(
|
|
1942
|
+
`${base(businessId)}/nodes/${identifier}`,
|
|
1943
|
+
options
|
|
1944
|
+
);
|
|
1945
|
+
return {
|
|
1946
|
+
...response,
|
|
1947
|
+
getBlock(key) {
|
|
1948
|
+
return getBlockFromArray(response, key, apiConfig.locale);
|
|
1949
|
+
},
|
|
1950
|
+
getBlockValues(key) {
|
|
1951
|
+
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
1952
|
+
},
|
|
1953
|
+
getImage(key) {
|
|
1954
|
+
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
1955
|
+
return getImageUrl(block, true);
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1958
|
+
},
|
|
1959
|
+
find(params, options) {
|
|
1960
|
+
const { businessId, ...queryParams } = params;
|
|
1961
|
+
return apiConfig.httpClient.get(`${base(businessId)}/nodes`, {
|
|
1962
|
+
...options,
|
|
1963
|
+
params: queryParams
|
|
1964
|
+
});
|
|
1965
|
+
},
|
|
1966
|
+
getChildren(params, options) {
|
|
1967
|
+
const { id, businessId, ...queryParams } = params;
|
|
1968
|
+
return apiConfig.httpClient.get(`${base(businessId)}/nodes/${id}/children`, {
|
|
1969
|
+
...options,
|
|
1970
|
+
params: queryParams
|
|
1971
|
+
});
|
|
1958
1972
|
}
|
|
1959
|
-
return apiConfig.httpClient.get(
|
|
1960
|
-
`${base(businessId)}/forms/${identifier}`,
|
|
1961
|
-
options
|
|
1962
|
-
);
|
|
1963
1973
|
},
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1974
|
+
form: {
|
|
1975
|
+
get(params, options) {
|
|
1976
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1977
|
+
let identifier;
|
|
1978
|
+
if (params.id) {
|
|
1979
|
+
identifier = params.id;
|
|
1980
|
+
} else if (params.key) {
|
|
1981
|
+
identifier = `${businessId}:${params.key}`;
|
|
1982
|
+
} else {
|
|
1983
|
+
throw new Error("GetFormParams requires id or key");
|
|
1984
|
+
}
|
|
1985
|
+
return apiConfig.httpClient.get(
|
|
1986
|
+
`${base(businessId)}/forms/${identifier}`,
|
|
1987
|
+
options
|
|
1988
|
+
);
|
|
1989
|
+
},
|
|
1990
|
+
submit(params, options) {
|
|
1991
|
+
const { businessId, formId, ...payload } = params;
|
|
1992
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1993
|
+
return apiConfig.httpClient.post(
|
|
1994
|
+
`${base(targetBusinessId)}/forms/${formId}/submissions`,
|
|
1995
|
+
{ ...payload, formId, businessId: targetBusinessId },
|
|
1996
|
+
options
|
|
1997
|
+
);
|
|
1984
1998
|
}
|
|
1985
|
-
return apiConfig.httpClient.get(
|
|
1986
|
-
`${base(businessId)}/taxonomies/${identifier}`,
|
|
1987
|
-
options
|
|
1988
|
-
);
|
|
1989
1999
|
},
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
2000
|
+
taxonomy: {
|
|
2001
|
+
get(params, options) {
|
|
2002
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2003
|
+
let identifier;
|
|
2004
|
+
if (params.id) {
|
|
2005
|
+
identifier = params.id;
|
|
2006
|
+
} else if (params.key) {
|
|
2007
|
+
identifier = `${businessId}:${params.key}`;
|
|
2008
|
+
} else {
|
|
2009
|
+
throw new Error("GetTaxonomyParams requires id or key");
|
|
2010
|
+
}
|
|
2011
|
+
return apiConfig.httpClient.get(
|
|
2012
|
+
`${base(businessId)}/taxonomies/${identifier}`,
|
|
2013
|
+
options
|
|
2014
|
+
);
|
|
2015
|
+
},
|
|
2016
|
+
getChildren(params, options) {
|
|
2017
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2018
|
+
return apiConfig.httpClient.get(
|
|
2019
|
+
`${base(businessId)}/taxonomies/${params.id}/children`,
|
|
2020
|
+
options
|
|
2021
|
+
);
|
|
2022
|
+
}
|
|
1996
2023
|
}
|
|
1997
2024
|
},
|
|
1998
2025
|
eshop: {
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2026
|
+
product: {
|
|
2027
|
+
get(params, options) {
|
|
2028
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2029
|
+
let identifier;
|
|
2030
|
+
if (params.id) {
|
|
2031
|
+
identifier = params.id;
|
|
2032
|
+
} else if (params.slug) {
|
|
2033
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
2034
|
+
} else {
|
|
2035
|
+
throw new Error("GetProductParams requires id or slug");
|
|
2036
|
+
}
|
|
2037
|
+
return apiConfig.httpClient.get(
|
|
2038
|
+
`${base(businessId)}/products/${identifier}`,
|
|
2039
|
+
options
|
|
2040
|
+
);
|
|
2041
|
+
},
|
|
2042
|
+
find(params, options) {
|
|
2043
|
+
const { businessId, ...queryParams } = params;
|
|
2044
|
+
return apiConfig.httpClient.get(`${base(businessId)}/products`, {
|
|
2045
|
+
...options,
|
|
2046
|
+
params: queryParams
|
|
2047
|
+
});
|
|
2008
2048
|
}
|
|
2009
|
-
return apiConfig.httpClient.get(
|
|
2010
|
-
`${base(businessId)}/products/${identifier}`,
|
|
2011
|
-
options
|
|
2012
|
-
);
|
|
2013
2049
|
},
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
...
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
`${base(businessId)}/orders
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
const { businessId, ...queryParams } = params;
|
|
2056
|
-
return apiConfig.httpClient.get(`${base(businessId)}/orders`, {
|
|
2057
|
-
...options,
|
|
2058
|
-
params: queryParams
|
|
2059
|
-
});
|
|
2050
|
+
order: {
|
|
2051
|
+
getQuote(params, options) {
|
|
2052
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2053
|
+
const { location, businessId: _businessId, ...rest } = params;
|
|
2054
|
+
const shippingAddress = location ? {
|
|
2055
|
+
country: location.country || "",
|
|
2056
|
+
state: location.state || "",
|
|
2057
|
+
city: location.city || "",
|
|
2058
|
+
postalCode: location.postalCode || "",
|
|
2059
|
+
name: "",
|
|
2060
|
+
street1: "",
|
|
2061
|
+
street2: null
|
|
2062
|
+
} : void 0;
|
|
2063
|
+
return apiConfig.httpClient.post(
|
|
2064
|
+
`${base(businessId)}/orders/quote`,
|
|
2065
|
+
{ ...rest, shippingAddress, market: apiConfig.market },
|
|
2066
|
+
options
|
|
2067
|
+
);
|
|
2068
|
+
},
|
|
2069
|
+
checkout(params, options) {
|
|
2070
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2071
|
+
return apiConfig.httpClient.post(
|
|
2072
|
+
`${base(businessId)}/orders/checkout`,
|
|
2073
|
+
{ ...params, businessId, market: apiConfig.market },
|
|
2074
|
+
options
|
|
2075
|
+
);
|
|
2076
|
+
},
|
|
2077
|
+
get(params, options) {
|
|
2078
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2079
|
+
return apiConfig.httpClient.get(
|
|
2080
|
+
`${base(businessId)}/orders/${params.id}`,
|
|
2081
|
+
options
|
|
2082
|
+
);
|
|
2083
|
+
},
|
|
2084
|
+
find(params, options) {
|
|
2085
|
+
const { businessId, ...queryParams } = params;
|
|
2086
|
+
return apiConfig.httpClient.get(`${base(businessId)}/orders`, {
|
|
2087
|
+
...options,
|
|
2088
|
+
params: queryParams
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2060
2091
|
}
|
|
2061
2092
|
},
|
|
2062
2093
|
booking: {
|
|
@@ -2082,14 +2113,14 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
2082
2113
|
options
|
|
2083
2114
|
);
|
|
2084
2115
|
},
|
|
2085
|
-
|
|
2116
|
+
get(params, options) {
|
|
2086
2117
|
const businessId = params.businessId || apiConfig.businessId;
|
|
2087
2118
|
return apiConfig.httpClient.get(
|
|
2088
2119
|
`${base(businessId)}/bookings/${params.id}`,
|
|
2089
2120
|
options
|
|
2090
2121
|
);
|
|
2091
2122
|
},
|
|
2092
|
-
|
|
2123
|
+
find(params, options) {
|
|
2093
2124
|
const { businessId, ...queryParams } = params;
|
|
2094
2125
|
return apiConfig.httpClient.get(`${base(businessId)}/bookings`, {
|
|
2095
2126
|
...options,
|
|
@@ -2111,51 +2142,7 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
2111
2142
|
{ ...options, params: queryParams }
|
|
2112
2143
|
);
|
|
2113
2144
|
},
|
|
2114
|
-
|
|
2115
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2116
|
-
let identifier;
|
|
2117
|
-
if (params.id) {
|
|
2118
|
-
identifier = params.id;
|
|
2119
|
-
} else if (params.slug) {
|
|
2120
|
-
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
2121
|
-
} else {
|
|
2122
|
-
throw new Error("GetServiceParams requires id or slug");
|
|
2123
|
-
}
|
|
2124
|
-
return apiConfig.httpClient.get(
|
|
2125
|
-
`${base(businessId)}/services/${identifier}`,
|
|
2126
|
-
options
|
|
2127
|
-
);
|
|
2128
|
-
},
|
|
2129
|
-
getServices(params, options) {
|
|
2130
|
-
const { businessId, ...queryParams } = params;
|
|
2131
|
-
return apiConfig.httpClient.get(`${base(businessId)}/services`, {
|
|
2132
|
-
...options,
|
|
2133
|
-
params: queryParams
|
|
2134
|
-
});
|
|
2135
|
-
},
|
|
2136
|
-
getProvider(params, options) {
|
|
2137
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2138
|
-
let identifier;
|
|
2139
|
-
if (params.id) {
|
|
2140
|
-
identifier = params.id;
|
|
2141
|
-
} else if (params.slug) {
|
|
2142
|
-
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
2143
|
-
} else {
|
|
2144
|
-
throw new Error("GetProviderParams requires id or slug");
|
|
2145
|
-
}
|
|
2146
|
-
return apiConfig.httpClient.get(
|
|
2147
|
-
`${base(businessId)}/providers/${identifier}`,
|
|
2148
|
-
options
|
|
2149
|
-
);
|
|
2150
|
-
},
|
|
2151
|
-
getProviders(params, options) {
|
|
2152
|
-
const { businessId, ...queryParams } = params;
|
|
2153
|
-
return apiConfig.httpClient.get(`${base(businessId)}/providers`, {
|
|
2154
|
-
...options,
|
|
2155
|
-
params: queryParams
|
|
2156
|
-
});
|
|
2157
|
-
},
|
|
2158
|
-
cancelBookingItem(params, options) {
|
|
2145
|
+
cancelItem(params, options) {
|
|
2159
2146
|
const { businessId, bookingId, itemId, ...payload } = params;
|
|
2160
2147
|
return apiConfig.httpClient.post(
|
|
2161
2148
|
`${base(businessId)}/bookings/${bookingId}/items/${itemId}/cancel`,
|
|
@@ -2163,84 +2150,117 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
2163
2150
|
options
|
|
2164
2151
|
);
|
|
2165
2152
|
},
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
params
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
)
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2153
|
+
service: {
|
|
2154
|
+
get(params, options) {
|
|
2155
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2156
|
+
let identifier;
|
|
2157
|
+
if (params.id) {
|
|
2158
|
+
identifier = params.id;
|
|
2159
|
+
} else if (params.slug) {
|
|
2160
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
2161
|
+
} else {
|
|
2162
|
+
throw new Error("GetServiceParams requires id or slug");
|
|
2163
|
+
}
|
|
2164
|
+
return apiConfig.httpClient.get(
|
|
2165
|
+
`${base(businessId)}/services/${identifier}`,
|
|
2166
|
+
options
|
|
2167
|
+
);
|
|
2168
|
+
},
|
|
2169
|
+
find(params, options) {
|
|
2170
|
+
const { businessId, ...queryParams } = params;
|
|
2171
|
+
return apiConfig.httpClient.get(`${base(businessId)}/services`, {
|
|
2172
|
+
...options,
|
|
2173
|
+
params: queryParams
|
|
2174
|
+
});
|
|
2175
|
+
},
|
|
2176
|
+
findProviders(params, options) {
|
|
2177
|
+
const { businessId, ...queryParams } = params;
|
|
2178
|
+
return apiConfig.httpClient.get(`${base(businessId)}/service-providers`, {
|
|
2179
|
+
...options,
|
|
2180
|
+
params: queryParams
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2194
2183
|
},
|
|
2195
|
-
|
|
2196
|
-
|
|
2184
|
+
provider: {
|
|
2185
|
+
get(params, options) {
|
|
2186
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2187
|
+
let identifier;
|
|
2188
|
+
if (params.id) {
|
|
2189
|
+
identifier = params.id;
|
|
2190
|
+
} else if (params.slug) {
|
|
2191
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
2192
|
+
} else {
|
|
2193
|
+
throw new Error("GetProviderParams requires id or slug");
|
|
2194
|
+
}
|
|
2195
|
+
return apiConfig.httpClient.get(
|
|
2196
|
+
`${base(businessId)}/providers/${identifier}`,
|
|
2197
|
+
options
|
|
2198
|
+
);
|
|
2199
|
+
},
|
|
2200
|
+
find(params, options) {
|
|
2201
|
+
const { businessId, ...queryParams } = params;
|
|
2202
|
+
return apiConfig.httpClient.get(`${base(businessId)}/providers`, {
|
|
2203
|
+
...options,
|
|
2204
|
+
params: queryParams
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2197
2207
|
}
|
|
2198
2208
|
},
|
|
2199
2209
|
crm: {
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
)
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
)
|
|
2210
|
+
customer: {
|
|
2211
|
+
initialize(params, options) {
|
|
2212
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
2213
|
+
return apiConfig.httpClient.post(
|
|
2214
|
+
`${base(businessId)}/customers/initialize`,
|
|
2215
|
+
{ businessId },
|
|
2216
|
+
options
|
|
2217
|
+
);
|
|
2218
|
+
},
|
|
2219
|
+
signInAnonymously(params, options) {
|
|
2220
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
2221
|
+
return apiConfig.httpClient.post(
|
|
2222
|
+
`${base(businessId)}/customers/initialize`,
|
|
2223
|
+
{ businessId },
|
|
2224
|
+
options
|
|
2225
|
+
);
|
|
2226
|
+
},
|
|
2227
|
+
connect(params, options) {
|
|
2228
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2229
|
+
return apiConfig.httpClient.post(
|
|
2230
|
+
`${base(businessId)}/customers/connect`,
|
|
2231
|
+
{ email: params.email, businessId },
|
|
2232
|
+
options
|
|
2233
|
+
);
|
|
2234
|
+
},
|
|
2235
|
+
requestCode(params, options) {
|
|
2236
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2237
|
+
return apiConfig.httpClient.post(
|
|
2238
|
+
`${base(businessId)}/customers/auth/code`,
|
|
2239
|
+
{ email: params.email, businessId },
|
|
2240
|
+
options
|
|
2241
|
+
);
|
|
2242
|
+
},
|
|
2243
|
+
verify(params, options) {
|
|
2244
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2245
|
+
return apiConfig.httpClient.post(
|
|
2246
|
+
`${base(businessId)}/customers/auth/verify`,
|
|
2247
|
+
{ email: params.email, code: params.code, businessId },
|
|
2248
|
+
options
|
|
2249
|
+
);
|
|
2250
|
+
},
|
|
2251
|
+
refreshToken(params, options) {
|
|
2252
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2253
|
+
return apiConfig.httpClient.post(
|
|
2254
|
+
`${base(businessId)}/customers/auth/refresh`,
|
|
2255
|
+
{ refreshToken: params.refreshToken },
|
|
2256
|
+
options
|
|
2257
|
+
);
|
|
2258
|
+
},
|
|
2259
|
+
getMe(options) {
|
|
2260
|
+
return apiConfig.httpClient.get(`${base()}/customers/me`, options);
|
|
2261
|
+
}
|
|
2242
2262
|
},
|
|
2243
|
-
|
|
2263
|
+
audience: {
|
|
2244
2264
|
get(params, options) {
|
|
2245
2265
|
let identifier;
|
|
2246
2266
|
if (params.id) {
|
|
@@ -2292,74 +2312,133 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
2292
2312
|
params: { token }
|
|
2293
2313
|
});
|
|
2294
2314
|
}
|
|
2315
|
+
},
|
|
2316
|
+
reaction: {
|
|
2317
|
+
DEFAULT_REACTION_KINDS,
|
|
2318
|
+
isValidReactionKind,
|
|
2319
|
+
computeAverageStars,
|
|
2320
|
+
create(params, options) {
|
|
2321
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2322
|
+
return apiConfig.httpClient.post(
|
|
2323
|
+
`${base(businessId)}/reactions`,
|
|
2324
|
+
{
|
|
2325
|
+
businessId,
|
|
2326
|
+
target: params.target,
|
|
2327
|
+
kind: params.kind,
|
|
2328
|
+
blocks: params.blocks || [],
|
|
2329
|
+
parentId: params.parentId,
|
|
2330
|
+
taxonomies: params.taxonomies || []
|
|
2331
|
+
},
|
|
2332
|
+
options
|
|
2333
|
+
);
|
|
2334
|
+
},
|
|
2335
|
+
get(params, options) {
|
|
2336
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2337
|
+
return apiConfig.httpClient.get(
|
|
2338
|
+
`${base(businessId)}/reactions/${params.id}`,
|
|
2339
|
+
options
|
|
2340
|
+
);
|
|
2341
|
+
},
|
|
2342
|
+
find(params, options) {
|
|
2343
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
2344
|
+
const queryParams = { ...params || {} };
|
|
2345
|
+
delete queryParams.businessId;
|
|
2346
|
+
return apiConfig.httpClient.get(`${base(businessId)}/reactions`, {
|
|
2347
|
+
...options,
|
|
2348
|
+
params: queryParams
|
|
2349
|
+
});
|
|
2350
|
+
},
|
|
2351
|
+
update(params, options) {
|
|
2352
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2353
|
+
return apiConfig.httpClient.put(
|
|
2354
|
+
`${base(businessId)}/reactions/${params.id}`,
|
|
2355
|
+
{
|
|
2356
|
+
id: params.id,
|
|
2357
|
+
businessId,
|
|
2358
|
+
blocks: params.blocks,
|
|
2359
|
+
taxonomies: params.taxonomies
|
|
2360
|
+
},
|
|
2361
|
+
options
|
|
2362
|
+
);
|
|
2363
|
+
},
|
|
2364
|
+
remove(params, options) {
|
|
2365
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2366
|
+
return apiConfig.httpClient.delete(
|
|
2367
|
+
`${base(businessId)}/reactions/${params.id}`,
|
|
2368
|
+
options
|
|
2369
|
+
);
|
|
2370
|
+
},
|
|
2371
|
+
summary(params, options) {
|
|
2372
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2373
|
+
return apiConfig.httpClient.get(`${base(businessId)}/reactions/summary`, {
|
|
2374
|
+
...options,
|
|
2375
|
+
params: {
|
|
2376
|
+
businessId,
|
|
2377
|
+
targetType: params.targetType,
|
|
2378
|
+
targetId: params.targetId,
|
|
2379
|
+
parentId: params.parentId
|
|
2380
|
+
}
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2295
2383
|
}
|
|
2296
2384
|
},
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
id
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
return apiConfig.httpClient.get(`${base(businessId)}/reactions/summary`, {
|
|
2355
|
-
...options,
|
|
2356
|
-
params: {
|
|
2357
|
-
businessId,
|
|
2358
|
-
targetType: params.targetType,
|
|
2359
|
-
targetId: params.targetId,
|
|
2360
|
-
parentId: params.parentId
|
|
2361
|
-
}
|
|
2362
|
-
});
|
|
2385
|
+
automation: {
|
|
2386
|
+
agent: {
|
|
2387
|
+
getAgents(params, options) {
|
|
2388
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
2389
|
+
const queryParams = { ...params || {} };
|
|
2390
|
+
delete queryParams.businessId;
|
|
2391
|
+
return apiConfig.httpClient.get(`${base(businessId)}/agents`, {
|
|
2392
|
+
...options,
|
|
2393
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2394
|
+
});
|
|
2395
|
+
},
|
|
2396
|
+
getAgent(params, options) {
|
|
2397
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2398
|
+
return apiConfig.httpClient.get(
|
|
2399
|
+
`${base(businessId)}/agents/${params.id}`,
|
|
2400
|
+
options
|
|
2401
|
+
);
|
|
2402
|
+
},
|
|
2403
|
+
sendMessage(params, options) {
|
|
2404
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2405
|
+
const body = { message: params.message };
|
|
2406
|
+
if (params.chatId) body.chatId = params.chatId;
|
|
2407
|
+
return apiConfig.httpClient.post(
|
|
2408
|
+
`${base(businessId)}/agents/${params.id}/chats/messages`,
|
|
2409
|
+
body,
|
|
2410
|
+
options
|
|
2411
|
+
);
|
|
2412
|
+
},
|
|
2413
|
+
getChat(params, options) {
|
|
2414
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2415
|
+
return apiConfig.httpClient.get(
|
|
2416
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}`,
|
|
2417
|
+
options
|
|
2418
|
+
);
|
|
2419
|
+
},
|
|
2420
|
+
getChatMessages(params, options) {
|
|
2421
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2422
|
+
const queryParams = {};
|
|
2423
|
+
if (params.limit) queryParams.limit = String(params.limit);
|
|
2424
|
+
return apiConfig.httpClient.get(
|
|
2425
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}/messages`,
|
|
2426
|
+
{
|
|
2427
|
+
...options,
|
|
2428
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2429
|
+
}
|
|
2430
|
+
);
|
|
2431
|
+
},
|
|
2432
|
+
rateChat(params, options) {
|
|
2433
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2434
|
+
const body = { rating: params.rating };
|
|
2435
|
+
if (params.comment) body.comment = params.comment;
|
|
2436
|
+
return apiConfig.httpClient.post(
|
|
2437
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}/rate`,
|
|
2438
|
+
body,
|
|
2439
|
+
options
|
|
2440
|
+
);
|
|
2441
|
+
}
|
|
2363
2442
|
}
|
|
2364
2443
|
}
|
|
2365
2444
|
};
|
|
@@ -2635,7 +2714,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
2635
2714
|
}
|
|
2636
2715
|
|
|
2637
2716
|
// src/index.ts
|
|
2638
|
-
var SDK_VERSION = "0.7.
|
|
2717
|
+
var SDK_VERSION = "0.7.61";
|
|
2639
2718
|
var SUPPORTED_FRAMEWORKS = [
|
|
2640
2719
|
"astro",
|
|
2641
2720
|
"react",
|
|
@@ -2715,67 +2794,92 @@ async function createAdmin(config) {
|
|
|
2715
2794
|
const bookingApi = createBookingApi(apiConfig);
|
|
2716
2795
|
const crmApi = createCustomerApi(apiConfig);
|
|
2717
2796
|
const reactionApi = createReactionApi(apiConfig);
|
|
2797
|
+
const locationApi = createLocationApi(apiConfig);
|
|
2798
|
+
const marketApi = createMarketApi(apiConfig);
|
|
2799
|
+
const agentApi = createAgentApi(apiConfig);
|
|
2800
|
+
const workflowApi = createWorkflowApi(apiConfig);
|
|
2801
|
+
const formApi = createFormApi(apiConfig);
|
|
2802
|
+
const taxonomyApi = createTaxonomyApi(apiConfig);
|
|
2803
|
+
const emailTemplateApi = createEmailTemplateApi(apiConfig);
|
|
2718
2804
|
const sdk = {
|
|
2719
2805
|
auth: authApi,
|
|
2720
2806
|
account: accountApi,
|
|
2721
|
-
business:
|
|
2807
|
+
business: {
|
|
2808
|
+
...businessApi,
|
|
2809
|
+
location: locationApi,
|
|
2810
|
+
market: marketApi
|
|
2811
|
+
},
|
|
2722
2812
|
media: createMediaApi(apiConfig),
|
|
2723
2813
|
notification: createNotificationApi(apiConfig),
|
|
2724
2814
|
promoCode: createPromoCodeApi(apiConfig),
|
|
2725
2815
|
platform: platformApi,
|
|
2726
|
-
|
|
2816
|
+
shipping: createShippingApi(apiConfig),
|
|
2817
|
+
cms: {
|
|
2818
|
+
node: cmsApi,
|
|
2819
|
+
form: formApi,
|
|
2820
|
+
taxonomy: taxonomyApi,
|
|
2821
|
+
emailTemplate: emailTemplateApi
|
|
2822
|
+
},
|
|
2727
2823
|
eshop: {
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2824
|
+
product: {
|
|
2825
|
+
create: eshopApi.createProduct,
|
|
2826
|
+
update: eshopApi.updateProduct,
|
|
2827
|
+
delete: eshopApi.deleteProduct,
|
|
2828
|
+
get: eshopApi.getProduct,
|
|
2829
|
+
find: eshopApi.getProducts
|
|
2830
|
+
},
|
|
2831
|
+
order: {
|
|
2832
|
+
create: eshopApi.createOrder,
|
|
2833
|
+
update: eshopApi.updateOrder,
|
|
2834
|
+
get: eshopApi.getOrder,
|
|
2835
|
+
find: eshopApi.getOrders,
|
|
2836
|
+
getQuote: eshopApi.getQuote,
|
|
2837
|
+
processRefund: eshopApi.processRefund
|
|
2838
|
+
}
|
|
2739
2839
|
},
|
|
2740
2840
|
booking: {
|
|
2741
2841
|
addToCart: bookingApi.addToCart,
|
|
2742
2842
|
removeFromCart: bookingApi.removeFromCart,
|
|
2743
2843
|
getCart: bookingApi.getCart,
|
|
2744
2844
|
clearCart: bookingApi.clearCart,
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2845
|
+
create: bookingApi.createBooking,
|
|
2846
|
+
update: bookingApi.updateBooking,
|
|
2847
|
+
get: bookingApi.getBooking,
|
|
2848
|
+
find: bookingApi.searchBookings,
|
|
2749
2849
|
getQuote: bookingApi.getQuote,
|
|
2750
2850
|
processRefund: bookingApi.processRefund,
|
|
2751
2851
|
getAvailability: bookingApi.getAvailability,
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2852
|
+
cancelItem: bookingApi.cancelBookingItem,
|
|
2853
|
+
service: {
|
|
2854
|
+
create: bookingApi.createService,
|
|
2855
|
+
update: bookingApi.updateService,
|
|
2856
|
+
delete: bookingApi.deleteService,
|
|
2857
|
+
get: bookingApi.getService,
|
|
2858
|
+
find: bookingApi.getServices,
|
|
2859
|
+
findProviders: bookingApi.findServiceProviders,
|
|
2860
|
+
createProvider: bookingApi.createServiceProvider,
|
|
2861
|
+
updateProvider: bookingApi.updateServiceProvider,
|
|
2862
|
+
deleteProvider: bookingApi.deleteServiceProvider
|
|
2863
|
+
},
|
|
2864
|
+
provider: {
|
|
2865
|
+
create: bookingApi.createProvider,
|
|
2866
|
+
update: bookingApi.updateProvider,
|
|
2867
|
+
delete: bookingApi.deleteProvider,
|
|
2868
|
+
get: bookingApi.getProvider,
|
|
2869
|
+
find: bookingApi.getProviders
|
|
2870
|
+
}
|
|
2871
|
+
},
|
|
2770
2872
|
crm: {
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2873
|
+
customer: {
|
|
2874
|
+
create: crmApi.create,
|
|
2875
|
+
get: crmApi.get,
|
|
2876
|
+
find: crmApi.find,
|
|
2877
|
+
update: crmApi.update,
|
|
2878
|
+
merge: crmApi.merge,
|
|
2879
|
+
revokeToken: crmApi.revokeToken,
|
|
2880
|
+
revokeAllTokens: crmApi.revokeAllTokens
|
|
2881
|
+
},
|
|
2882
|
+
audience: {
|
|
2779
2883
|
create: crmApi.audiences.create,
|
|
2780
2884
|
update: crmApi.audiences.update,
|
|
2781
2885
|
get: crmApi.audiences.get,
|
|
@@ -2783,15 +2887,13 @@ async function createAdmin(config) {
|
|
|
2783
2887
|
getSubscribers: crmApi.audiences.getSubscribers,
|
|
2784
2888
|
addSubscriber: crmApi.audiences.addSubscriber,
|
|
2785
2889
|
removeSubscriber: crmApi.audiences.removeSubscriber
|
|
2786
|
-
}
|
|
2890
|
+
},
|
|
2891
|
+
reaction: reactionApi
|
|
2892
|
+
},
|
|
2893
|
+
automation: {
|
|
2894
|
+
agent: agentApi,
|
|
2895
|
+
workflow: workflowApi
|
|
2787
2896
|
},
|
|
2788
|
-
reaction: reactionApi,
|
|
2789
|
-
workflow: createWorkflowApi(apiConfig),
|
|
2790
|
-
shipping: createShippingApi(apiConfig),
|
|
2791
|
-
agent: createAgentApi(apiConfig),
|
|
2792
|
-
emailTemplate: createEmailTemplateApi(apiConfig),
|
|
2793
|
-
form: createFormApi(apiConfig),
|
|
2794
|
-
taxonomy: createTaxonomyApi(apiConfig),
|
|
2795
2897
|
analytics: {
|
|
2796
2898
|
track
|
|
2797
2899
|
},
|
|
@@ -2845,14 +2947,10 @@ async function createStorefront(config) {
|
|
|
2845
2947
|
return {
|
|
2846
2948
|
business: storefrontApi.business,
|
|
2847
2949
|
cms: storefrontApi.cms,
|
|
2848
|
-
form: storefrontApi.form,
|
|
2849
|
-
taxonomy: storefrontApi.taxonomy,
|
|
2850
2950
|
eshop: storefrontApi.eshop,
|
|
2851
2951
|
booking: storefrontApi.booking,
|
|
2852
|
-
location: storefrontApi.location,
|
|
2853
|
-
market: storefrontApi.market,
|
|
2854
2952
|
crm: storefrontApi.crm,
|
|
2855
|
-
|
|
2953
|
+
automation: storefrontApi.automation,
|
|
2856
2954
|
analytics: {
|
|
2857
2955
|
track
|
|
2858
2956
|
},
|