commerce-sdk-isomorphic 1.5.1 → 1.5.2

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/README.md CHANGED
@@ -108,7 +108,7 @@ _throwOnBadResponse:_ Default value is false. When set to true, the SDK throws a
108
108
 
109
109
  A collection of helper functions are available in this SDK to simplify [Public
110
110
  Client Shopper Login OAuth
111
- flows](https://developer.salesforce.com/docs/commerce/commerce-api/references#shopper-login-and-api-access:Summary). See sample code above for guest login.
111
+ flows](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-login:Summary). See sample code above for guest login.
112
112
 
113
113
  ## License Information
114
114
 
@@ -5,6 +5,36 @@
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
7
  import { RequestInit as NodeRequestInit } from "node-fetch";
8
+ /*
9
+ * Copyright (c) 2021, salesforce.com, inc.
10
+ * All rights reserved.
11
+ * SPDX-License-Identifier: BSD-3-Clause
12
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
13
+ */
14
+ type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>;
15
+ type RequireParametersUnlessAllAreOptional<T extends {
16
+ parameters?: Record<string, unknown>;
17
+ }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : T & Required<Pick<T, "parameters">>;
18
+ /**
19
+ * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
20
+ * if not specified.
21
+ */
22
+ interface BaseUriParameters {
23
+ shortCode: string;
24
+ version?: string; // Optional, will default to "v1" if not provided.
25
+ }
26
+ /**
27
+ * Generic interface for path parameters.
28
+ */
29
+ interface PathParameters {
30
+ [key: string]: string | number | boolean;
31
+ }
32
+ /**
33
+ * Generic interface for query parameters.
34
+ */
35
+ interface QueryParameters {
36
+ [key: string]: string | number | boolean | string[] | number[];
37
+ }
8
38
  type LoginRequest = {
9
39
  client_id?: string;
10
40
  response_type?: string;
@@ -870,36 +900,6 @@ declare class ShopperLogin<ConfigParameters extends ShopperLoginParameters & Rec
870
900
  };
871
901
  }>, rawResponse?: T): Promise<T extends true ? Response : Object>;
872
902
  }
873
- /*
874
- * Copyright (c) 2021, salesforce.com, inc.
875
- * All rights reserved.
876
- * SPDX-License-Identifier: BSD-3-Clause
877
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
878
- */
879
- type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>;
880
- type RequireParametersUnlessAllAreOptional<T extends {
881
- parameters?: Record<string, unknown>;
882
- }> = Record<string, never> extends NonNullable<T["parameters"]> ? T : T & Required<Pick<T, "parameters">>;
883
- /**
884
- * Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
885
- * if not specified.
886
- */
887
- interface BaseUriParameters {
888
- shortCode: string;
889
- version?: string; // Optional, will default to "v1" if not provided.
890
- }
891
- /**
892
- * Generic interface for path parameters.
893
- */
894
- interface PathParameters {
895
- [key: string]: string | number | boolean;
896
- }
897
- /**
898
- * Generic interface for query parameters.
899
- */
900
- interface QueryParameters {
901
- [key: string]: string | number | boolean | string[] | number[];
902
- }
903
903
  /**
904
904
  * Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
905
905
  * it from the `RequestInit` provided by node-fetch.
@@ -8938,6 +8938,14 @@ declare class TemplateURL extends URL {
8938
8938
  static renderTemplateUri(template: string, parameters?: PathParameters): string;
8939
8939
  }
8940
8940
  declare namespace helpers {
8941
+ /*
8942
+ * Copyright (c) 2022, Salesforce, Inc.
8943
+ * All rights reserved.
8944
+ * SPDX-License-Identifier: BSD-3-Clause
8945
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8946
+ */
8947
+ const isBrowser: boolean;
8948
+ const isNode: boolean;
8941
8949
  /*
8942
8950
  * Copyright (c) 2021, salesforce.com, inc.
8943
8951
  * All rights reserved.
@@ -10047,10 +10055,6 @@ declare namespace helpers {
10047
10055
  };
10048
10056
  }>, rawResponse?: T): Promise<T extends true ? Response : Object>;
10049
10057
  }
10050
- /**
10051
- * Determine if execution is client or server side
10052
- */
10053
- const onClient: boolean;
10054
10058
  const stringToBase64: typeof btoa;
10055
10059
  /**
10056
10060
  * Parse out the code and usid from a redirect url
@@ -10096,7 +10100,7 @@ declare namespace helpers {
10096
10100
  usid: string;
10097
10101
  }>;
10098
10102
  /**
10099
- * A single function to execute the ShopperLogin Public Client Guest Login with proof key for code exchange flow as described in the [API documentation](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-login-and-api-access:Summary).
10103
+ * A single function to execute the ShopperLogin Public Client Guest Login with proof key for code exchange flow as described in the [API documentation](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-login:Summary).
10100
10104
  * @param slasClient a configured instance of the ShopperLogin SDK client.
10101
10105
  * @param parameters - parameters to pass in the API calls.
10102
10106
  * @param parameters.redirectURI - Per OAuth standard, a valid app route. Must be listed in your SLAS configuration. On server, this will not be actually called. On browser, this will be called, but ignored.
@@ -10112,7 +10116,7 @@ declare namespace helpers {
10112
10116
  usid?: string;
10113
10117
  }): Promise<TokenResponse>;
10114
10118
  /**
10115
- * A single function to execute the ShopperLogin Public Client Registered User B2C Login with proof key for code exchange flow as described in the [API documentation](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-login-and-api-access:Summary).
10119
+ * A single function to execute the ShopperLogin Public Client Registered User B2C Login with proof key for code exchange flow as described in the [API documentation](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-login:Summary).
10116
10120
  * @param slasClient a configured instance of the ShopperLogin SDK client.
10117
10121
  * @param credentials - the id and password to login with.
10118
10122
  * @param credentials.username - the id of the user to login with.