@elasticpath/js-sdk 24.3.3 → 25.0.0

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.js CHANGED
@@ -530,7 +530,7 @@ if (!globalThis.fetch) {
530
530
  globalThis.Response = fetch$1.Response;
531
531
  }
532
532
 
533
- var version = "24.3.3";
533
+ var version = "25.0.0";
534
534
 
535
535
  var LocalStorageFactory = /*#__PURE__*/function () {
536
536
  function LocalStorageFactory() {
@@ -723,6 +723,9 @@ function formatQueryString(key, value) {
723
723
  if (key === 'limit' || key === 'offset') {
724
724
  return "page".concat(value);
725
725
  }
726
+ if (key === 'total_method') {
727
+ return "page[total_method]=".concat(value);
728
+ }
726
729
  if (key === 'filter') {
727
730
  var filterValues = [];
728
731
 
@@ -822,7 +825,8 @@ function buildQueryParams(_ref) {
822
825
  limit = _ref.limit,
823
826
  offset = _ref.offset,
824
827
  filter = _ref.filter,
825
- useTemplateSlugs = _ref.useTemplateSlugs;
828
+ useTemplateSlugs = _ref.useTemplateSlugs,
829
+ total_method = _ref.total_method;
826
830
  var query = {};
827
831
  if (includes) {
828
832
  query.include = includes;
@@ -830,7 +834,7 @@ function buildQueryParams(_ref) {
830
834
  if (sort) {
831
835
  query.sort = "".concat(sort);
832
836
  }
833
- if (limit) {
837
+ if (limit !== undefined && limit !== null) {
834
838
  query.limit = "[limit]=".concat(limit);
835
839
  }
836
840
  if (offset) {
@@ -842,6 +846,9 @@ function buildQueryParams(_ref) {
842
846
  if (useTemplateSlugs) {
843
847
  query.useTemplateSlugs = useTemplateSlugs;
844
848
  }
849
+ if (total_method) {
850
+ query.total_method = total_method;
851
+ }
845
852
  return Object.keys(query).map(function (k) {
846
853
  return formatQueryString(k, query[k]);
847
854
  }).join('&');
@@ -852,7 +859,7 @@ function formatQueryParams(query) {
852
859
  }).join('&');
853
860
  }
854
861
  function buildURL(endpoint, params) {
855
- if (params.includes || params.sort || params.limit || params.offset || params.filter || params.useTemplateSlugs) {
862
+ if (params.includes || params.sort || params.limit !== undefined && params.limit !== null || params.offset || params.filter || params.useTemplateSlugs || params.total_method) {
856
863
  var paramsString = buildQueryParams(params);
857
864
  return "".concat(endpoint, "?").concat(paramsString);
858
865
  }
@@ -2206,6 +2213,34 @@ var CustomersEndpoint = /*#__PURE__*/function (_CRUDExtend) {
2206
2213
  value: function Token(email, password) {
2207
2214
  return this.TokenViaPassword(email, password);
2208
2215
  }
2216
+ }, {
2217
+ key: "TotalMethod",
2218
+ value: function TotalMethod(totalMethod) {
2219
+ this.total_method = totalMethod;
2220
+ return this;
2221
+ }
2222
+ }, {
2223
+ key: "All",
2224
+ value: function All() {
2225
+ var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2226
+ var includes = this.includes,
2227
+ sort = this.sort,
2228
+ limit = this.limit,
2229
+ offset = this.offset,
2230
+ filter = this.filter,
2231
+ total_method = this.total_method;
2232
+ this.call = this.request.send(buildURL(this.endpoint, _objectSpread2({
2233
+ includes: includes,
2234
+ sort: sort,
2235
+ limit: limit,
2236
+ offset: offset,
2237
+ filter: filter
2238
+ }, total_method && {
2239
+ total_method: total_method
2240
+ })), 'GET', undefined, token, this);
2241
+ this.total_method = undefined;
2242
+ return this.call;
2243
+ }
2209
2244
  }]);
2210
2245
  return CustomersEndpoint;
2211
2246
  }(CRUDExtend);
package/dist/index.d.ts CHANGED
@@ -176,6 +176,7 @@ interface ResourcePage<R, I = never> extends ResourceList<R> {
176
176
  }
177
177
  results: {
178
178
  total: number
179
+ total_method?: 'observed' | 'exact'
179
180
  }
180
181
  }
181
182
  included?: I
@@ -2714,6 +2715,14 @@ interface CustomersEndpoint
2714
2715
  codeVerifier: string,
2715
2716
  headers?: object
2716
2717
  ): Promise<Resource<CustomerToken>>
2718
+
2719
+ /**
2720
+ * Total Method
2721
+ * Description: The total method to use for the customer endpoint.
2722
+ * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/orders-and-customers/customers/index.html
2723
+ * @param totalMethod [string] the total method to use for the customer endpoint
2724
+ */
2725
+ TotalMethod(totalMethod: string): this
2717
2726
  }
2718
2727
 
2719
2728
  /**
package/dist/index.esm.js CHANGED
@@ -519,7 +519,7 @@ if (!globalThis.fetch) {
519
519
  globalThis.Response = Response;
520
520
  }
521
521
 
522
- var version = "24.3.3";
522
+ var version = "25.0.0";
523
523
 
524
524
  var LocalStorageFactory = /*#__PURE__*/function () {
525
525
  function LocalStorageFactory() {
@@ -712,6 +712,9 @@ function formatQueryString(key, value) {
712
712
  if (key === 'limit' || key === 'offset') {
713
713
  return "page".concat(value);
714
714
  }
715
+ if (key === 'total_method') {
716
+ return "page[total_method]=".concat(value);
717
+ }
715
718
  if (key === 'filter') {
716
719
  var filterValues = [];
717
720
 
@@ -811,7 +814,8 @@ function buildQueryParams(_ref) {
811
814
  limit = _ref.limit,
812
815
  offset = _ref.offset,
813
816
  filter = _ref.filter,
814
- useTemplateSlugs = _ref.useTemplateSlugs;
817
+ useTemplateSlugs = _ref.useTemplateSlugs,
818
+ total_method = _ref.total_method;
815
819
  var query = {};
816
820
  if (includes) {
817
821
  query.include = includes;
@@ -819,7 +823,7 @@ function buildQueryParams(_ref) {
819
823
  if (sort) {
820
824
  query.sort = "".concat(sort);
821
825
  }
822
- if (limit) {
826
+ if (limit !== undefined && limit !== null) {
823
827
  query.limit = "[limit]=".concat(limit);
824
828
  }
825
829
  if (offset) {
@@ -831,6 +835,9 @@ function buildQueryParams(_ref) {
831
835
  if (useTemplateSlugs) {
832
836
  query.useTemplateSlugs = useTemplateSlugs;
833
837
  }
838
+ if (total_method) {
839
+ query.total_method = total_method;
840
+ }
834
841
  return Object.keys(query).map(function (k) {
835
842
  return formatQueryString(k, query[k]);
836
843
  }).join('&');
@@ -841,7 +848,7 @@ function formatQueryParams(query) {
841
848
  }).join('&');
842
849
  }
843
850
  function buildURL(endpoint, params) {
844
- if (params.includes || params.sort || params.limit || params.offset || params.filter || params.useTemplateSlugs) {
851
+ if (params.includes || params.sort || params.limit !== undefined && params.limit !== null || params.offset || params.filter || params.useTemplateSlugs || params.total_method) {
845
852
  var paramsString = buildQueryParams(params);
846
853
  return "".concat(endpoint, "?").concat(paramsString);
847
854
  }
@@ -2195,6 +2202,34 @@ var CustomersEndpoint = /*#__PURE__*/function (_CRUDExtend) {
2195
2202
  value: function Token(email, password) {
2196
2203
  return this.TokenViaPassword(email, password);
2197
2204
  }
2205
+ }, {
2206
+ key: "TotalMethod",
2207
+ value: function TotalMethod(totalMethod) {
2208
+ this.total_method = totalMethod;
2209
+ return this;
2210
+ }
2211
+ }, {
2212
+ key: "All",
2213
+ value: function All() {
2214
+ var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2215
+ var includes = this.includes,
2216
+ sort = this.sort,
2217
+ limit = this.limit,
2218
+ offset = this.offset,
2219
+ filter = this.filter,
2220
+ total_method = this.total_method;
2221
+ this.call = this.request.send(buildURL(this.endpoint, _objectSpread2({
2222
+ includes: includes,
2223
+ sort: sort,
2224
+ limit: limit,
2225
+ offset: offset,
2226
+ filter: filter
2227
+ }, total_method && {
2228
+ total_method: total_method
2229
+ })), 'GET', undefined, token, this);
2230
+ this.total_method = undefined;
2231
+ return this.call;
2232
+ }
2198
2233
  }]);
2199
2234
  return CustomersEndpoint;
2200
2235
  }(CRUDExtend);
package/dist/index.js CHANGED
@@ -1085,7 +1085,7 @@
1085
1085
  globalThis.Response = browserPonyfill.exports.Response;
1086
1086
  }
1087
1087
 
1088
- var version = "24.3.3";
1088
+ var version = "25.0.0";
1089
1089
 
1090
1090
  var LocalStorageFactory = /*#__PURE__*/function () {
1091
1091
  function LocalStorageFactory() {
@@ -1880,6 +1880,9 @@
1880
1880
  if (key === 'limit' || key === 'offset') {
1881
1881
  return "page".concat(value);
1882
1882
  }
1883
+ if (key === 'total_method') {
1884
+ return "page[total_method]=".concat(value);
1885
+ }
1883
1886
  if (key === 'filter') {
1884
1887
  var filterValues = [];
1885
1888
 
@@ -1979,7 +1982,8 @@
1979
1982
  limit = _ref.limit,
1980
1983
  offset = _ref.offset,
1981
1984
  filter = _ref.filter,
1982
- useTemplateSlugs = _ref.useTemplateSlugs;
1985
+ useTemplateSlugs = _ref.useTemplateSlugs,
1986
+ total_method = _ref.total_method;
1983
1987
  var query = {};
1984
1988
  if (includes) {
1985
1989
  query.include = includes;
@@ -1987,7 +1991,7 @@
1987
1991
  if (sort) {
1988
1992
  query.sort = "".concat(sort);
1989
1993
  }
1990
- if (limit) {
1994
+ if (limit !== undefined && limit !== null) {
1991
1995
  query.limit = "[limit]=".concat(limit);
1992
1996
  }
1993
1997
  if (offset) {
@@ -1999,6 +2003,9 @@
1999
2003
  if (useTemplateSlugs) {
2000
2004
  query.useTemplateSlugs = useTemplateSlugs;
2001
2005
  }
2006
+ if (total_method) {
2007
+ query.total_method = total_method;
2008
+ }
2002
2009
  return Object.keys(query).map(function (k) {
2003
2010
  return formatQueryString(k, query[k]);
2004
2011
  }).join('&');
@@ -2009,7 +2016,7 @@
2009
2016
  }).join('&');
2010
2017
  }
2011
2018
  function buildURL(endpoint, params) {
2012
- if (params.includes || params.sort || params.limit || params.offset || params.filter || params.useTemplateSlugs) {
2019
+ if (params.includes || params.sort || params.limit !== undefined && params.limit !== null || params.offset || params.filter || params.useTemplateSlugs || params.total_method) {
2013
2020
  var paramsString = buildQueryParams(params);
2014
2021
  return "".concat(endpoint, "?").concat(paramsString);
2015
2022
  }
@@ -3363,6 +3370,34 @@
3363
3370
  value: function Token(email, password) {
3364
3371
  return this.TokenViaPassword(email, password);
3365
3372
  }
3373
+ }, {
3374
+ key: "TotalMethod",
3375
+ value: function TotalMethod(totalMethod) {
3376
+ this.total_method = totalMethod;
3377
+ return this;
3378
+ }
3379
+ }, {
3380
+ key: "All",
3381
+ value: function All() {
3382
+ var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
3383
+ var includes = this.includes,
3384
+ sort = this.sort,
3385
+ limit = this.limit,
3386
+ offset = this.offset,
3387
+ filter = this.filter,
3388
+ total_method = this.total_method;
3389
+ this.call = this.request.send(buildURL(this.endpoint, _objectSpread2({
3390
+ includes: includes,
3391
+ sort: sort,
3392
+ limit: limit,
3393
+ offset: offset,
3394
+ filter: filter
3395
+ }, total_method && {
3396
+ total_method: total_method
3397
+ })), 'GET', undefined, token, this);
3398
+ this.total_method = undefined;
3399
+ return this.call;
3400
+ }
3366
3401
  }]);
3367
3402
  return CustomersEndpoint;
3368
3403
  }(CRUDExtend);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elasticpath/js-sdk",
3
3
  "description": "SDK for the Elastic Path eCommerce API",
4
- "version": "24.3.3",
4
+ "version": "25.0.0",
5
5
  "homepage": "https://github.com/elasticpath/js-sdk",
6
6
  "author": "Elastic Path (https://elasticpath.com/)",
7
7
  "files": [