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