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 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
- getNodes(params, options) {
1934
- const { businessId, ...queryParams } = params;
1935
- return apiConfig.httpClient.get(`${base(businessId)}/nodes`, {
1936
- ...options,
1937
- params: queryParams
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
- getNodeChildren(params, options) {
1941
- const { id, businessId, ...queryParams } = params;
1942
- return apiConfig.httpClient.get(`${base(businessId)}/nodes/${id}/children`, {
1943
- ...options,
1944
- params: queryParams
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
- form: {
1949
- getForm(params, options) {
1950
- const businessId = params.businessId || apiConfig.businessId;
1951
- let identifier;
1952
- if (params.id) {
1953
- identifier = params.id;
1954
- } else if (params.key) {
1955
- identifier = `${businessId}:${params.key}`;
1956
- } else {
1957
- throw new Error("GetFormParams requires id or key");
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
- submit(params, options) {
1965
- const { businessId, formId, ...payload } = params;
1966
- const targetBusinessId = businessId || apiConfig.businessId;
1967
- return apiConfig.httpClient.post(
1968
- `${base(targetBusinessId)}/forms/${formId}/submissions`,
1969
- { ...payload, formId, businessId: targetBusinessId },
1970
- options
1971
- );
1972
- }
1973
- },
1974
- taxonomy: {
1975
- getTaxonomy(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("GetTaxonomyParams requires id or key");
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
- getTaxonomyChildren(params, options) {
1991
- const businessId = params.businessId || apiConfig.businessId;
1992
- return apiConfig.httpClient.get(
1993
- `${base(businessId)}/taxonomies/${params.id}/children`,
1994
- options
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
- getProduct(params, options) {
2000
- const businessId = params.businessId || apiConfig.businessId;
2001
- let identifier;
2002
- if (params.id) {
2003
- identifier = params.id;
2004
- } else if (params.slug) {
2005
- identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
2006
- } else {
2007
- throw new Error("GetProductParams requires id or slug");
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
- getProducts(params, options) {
2015
- const { businessId, ...queryParams } = params;
2016
- return apiConfig.httpClient.get(`${base(businessId)}/products`, {
2017
- ...options,
2018
- params: queryParams
2019
- });
2020
- },
2021
- getQuote(params, options) {
2022
- const businessId = params.businessId || apiConfig.businessId;
2023
- const { location, businessId: _businessId, ...rest } = params;
2024
- const shippingAddress = location ? {
2025
- country: location.country || "",
2026
- state: location.state || "",
2027
- city: location.city || "",
2028
- postalCode: location.postalCode || "",
2029
- name: "",
2030
- street1: "",
2031
- street2: null
2032
- } : void 0;
2033
- return apiConfig.httpClient.post(
2034
- `${base(businessId)}/orders/quote`,
2035
- { ...rest, shippingAddress, market: apiConfig.market },
2036
- options
2037
- );
2038
- },
2039
- checkout(params, options) {
2040
- const businessId = params.businessId || apiConfig.businessId;
2041
- return apiConfig.httpClient.post(
2042
- `${base(businessId)}/orders/checkout`,
2043
- { ...params, businessId, market: apiConfig.market },
2044
- options
2045
- );
2046
- },
2047
- getOrder(params, options) {
2048
- const businessId = params.businessId || apiConfig.businessId;
2049
- return apiConfig.httpClient.get(
2050
- `${base(businessId)}/orders/${params.id}`,
2051
- options
2052
- );
2053
- },
2054
- getOrders(params, options) {
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
- getBooking(params, options) {
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
- searchBookings(params, options) {
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
- getService(params, options) {
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
- findServiceProviders(params, options) {
2167
- const { businessId, ...queryParams } = params;
2168
- return apiConfig.httpClient.get(`${base(businessId)}/service-providers`, {
2169
- ...options,
2170
- params: queryParams
2171
- });
2172
- }
2173
- },
2174
- location: {
2175
- getCountries(options) {
2176
- return apiConfig.httpClient.get(`/v1/platform/countries`, options);
2177
- },
2178
- getCountry(countryCode, options) {
2179
- return apiConfig.httpClient.get(
2180
- `/v1/platform/countries/${countryCode}`,
2181
- options
2182
- );
2183
- },
2184
- list(options) {
2185
- return apiConfig.httpClient.get(`${base()}/locations`, options);
2186
- },
2187
- get(id, options) {
2188
- return apiConfig.httpClient.get(`${base()}/locations/${id}`, options);
2189
- }
2190
- },
2191
- market: {
2192
- list(options) {
2193
- return apiConfig.httpClient.get(`${base()}/markets`, options);
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
- get(id, options) {
2196
- return apiConfig.httpClient.get(`${base()}/markets/${id}`, options);
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
- requestCode(params, options) {
2201
- const businessId = params.businessId || apiConfig.businessId;
2202
- return apiConfig.httpClient.post(
2203
- `${base(businessId)}/customers/auth/code`,
2204
- { email: params.email, businessId },
2205
- options
2206
- );
2207
- },
2208
- verify(params, options) {
2209
- const businessId = params.businessId || apiConfig.businessId;
2210
- return apiConfig.httpClient.post(
2211
- `${base(businessId)}/customers/auth/verify`,
2212
- { email: params.email, code: params.code, businessId },
2213
- options
2214
- );
2215
- },
2216
- refreshToken(params, options) {
2217
- const businessId = params.businessId || apiConfig.businessId;
2218
- return apiConfig.httpClient.post(
2219
- `${base(businessId)}/customers/auth/refresh`,
2220
- { refreshToken: params.refreshToken },
2221
- options
2222
- );
2223
- },
2224
- getMe(options) {
2225
- return apiConfig.httpClient.get(`${base()}/customers/me`, options);
2226
- },
2227
- initialize(params, options) {
2228
- const businessId = params?.businessId || apiConfig.businessId;
2229
- return apiConfig.httpClient.post(
2230
- `${base(businessId)}/customers/initialize`,
2231
- { businessId },
2232
- options
2233
- );
2234
- },
2235
- connect(params, options) {
2236
- const businessId = params.businessId || apiConfig.businessId;
2237
- return apiConfig.httpClient.post(
2238
- `${base(businessId)}/customers/connect`,
2239
- { email: params.email, businessId },
2240
- options
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
- audiences: {
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
- reaction: {
2298
- DEFAULT_REACTION_KINDS,
2299
- isValidReactionKind,
2300
- computeAverageStars,
2301
- create(params, options) {
2302
- const businessId = params.businessId || apiConfig.businessId;
2303
- return apiConfig.httpClient.post(
2304
- `${base(businessId)}/reactions`,
2305
- {
2306
- businessId,
2307
- target: params.target,
2308
- kind: params.kind,
2309
- blocks: params.blocks || [],
2310
- parentId: params.parentId,
2311
- taxonomies: params.taxonomies || []
2312
- },
2313
- options
2314
- );
2315
- },
2316
- get(params, options) {
2317
- const businessId = params.businessId || apiConfig.businessId;
2318
- return apiConfig.httpClient.get(
2319
- `${base(businessId)}/reactions/${params.id}`,
2320
- options
2321
- );
2322
- },
2323
- find(params, options) {
2324
- const businessId = params?.businessId || apiConfig.businessId;
2325
- const queryParams = { ...params || {} };
2326
- delete queryParams.businessId;
2327
- return apiConfig.httpClient.get(`${base(businessId)}/reactions`, {
2328
- ...options,
2329
- params: queryParams
2330
- });
2331
- },
2332
- update(params, options) {
2333
- const businessId = params.businessId || apiConfig.businessId;
2334
- return apiConfig.httpClient.put(
2335
- `${base(businessId)}/reactions/${params.id}`,
2336
- {
2337
- id: params.id,
2338
- businessId,
2339
- blocks: params.blocks,
2340
- taxonomies: params.taxonomies
2341
- },
2342
- options
2343
- );
2344
- },
2345
- remove(params, options) {
2346
- const businessId = params.businessId || apiConfig.businessId;
2347
- return apiConfig.httpClient.delete(
2348
- `${base(businessId)}/reactions/${params.id}`,
2349
- options
2350
- );
2351
- },
2352
- summary(params, options) {
2353
- const businessId = params.businessId || apiConfig.businessId;
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.59";
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: businessApi,
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
- cms: cmsApi,
2816
+ shipping: createShippingApi(apiConfig),
2817
+ cms: {
2818
+ node: cmsApi,
2819
+ form: formApi,
2820
+ taxonomy: taxonomyApi,
2821
+ emailTemplate: emailTemplateApi
2822
+ },
2727
2823
  eshop: {
2728
- createProduct: eshopApi.createProduct,
2729
- updateProduct: eshopApi.updateProduct,
2730
- deleteProduct: eshopApi.deleteProduct,
2731
- getProduct: eshopApi.getProduct,
2732
- getProducts: eshopApi.getProducts,
2733
- createOrder: eshopApi.createOrder,
2734
- updateOrder: eshopApi.updateOrder,
2735
- getOrder: eshopApi.getOrder,
2736
- getOrders: eshopApi.getOrders,
2737
- getQuote: eshopApi.getQuote,
2738
- processRefund: eshopApi.processRefund
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
- createBooking: bookingApi.createBooking,
2746
- updateBooking: bookingApi.updateBooking,
2747
- getBooking: bookingApi.getBooking,
2748
- searchBookings: bookingApi.searchBookings,
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
- createService: bookingApi.createService,
2753
- updateService: bookingApi.updateService,
2754
- deleteService: bookingApi.deleteService,
2755
- getService: bookingApi.getService,
2756
- getServices: bookingApi.getServices,
2757
- createProvider: bookingApi.createProvider,
2758
- updateProvider: bookingApi.updateProvider,
2759
- deleteProvider: bookingApi.deleteProvider,
2760
- getProvider: bookingApi.getProvider,
2761
- getProviders: bookingApi.getProviders,
2762
- cancelBookingItem: bookingApi.cancelBookingItem,
2763
- findServiceProviders: bookingApi.findServiceProviders,
2764
- createServiceProvider: bookingApi.createServiceProvider,
2765
- updateServiceProvider: bookingApi.updateServiceProvider,
2766
- deleteServiceProvider: bookingApi.deleteServiceProvider
2767
- },
2768
- location: createLocationApi(apiConfig),
2769
- market: createMarketApi(apiConfig),
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
- create: crmApi.create,
2772
- get: crmApi.get,
2773
- find: crmApi.find,
2774
- update: crmApi.update,
2775
- merge: crmApi.merge,
2776
- revokeToken: crmApi.revokeToken,
2777
- revokeAllTokens: crmApi.revokeAllTokens,
2778
- audiences: {
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
- reaction: storefrontApi.reaction,
2953
+ automation: storefrontApi.automation,
2856
2954
  analytics: {
2857
2955
  track
2858
2956
  },