@scayle/storefront-core 7.34.0 → 7.35.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @scayle/storefront-core
2
2
 
3
+ ## 7.35.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Change `oauthForgetPassword` payload signature to accept `email` only
8
+
9
+ ## 7.34.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Fix type errors
14
+
3
15
  ## 7.34.0
4
16
 
5
17
  ### Minor Changes
@@ -26,9 +26,7 @@ export declare class OAuthClient {
26
26
  * Execute a user login on the OAuth API and receive a token set
27
27
  * @param payload
28
28
  */
29
- login(payload: LoginRequest & {
30
- shopId: string;
31
- }): Promise<Oauth>;
29
+ login(payload: LoginRequest): Promise<Oauth>;
32
30
  /**
33
31
  * Execute a guest user login on the OAuth API and receive a token set
34
32
  * @param payload
@@ -76,7 +76,7 @@ const oauthGuestLogin = async (guest, context) => {
76
76
  const shopId = context.shopId;
77
77
  const client = (0, _oauth.getOAuthClient)(context);
78
78
  try {
79
- const tokens = client.guestLogin({
79
+ const tokens = await client.guestLogin({
80
80
  ...guest,
81
81
  shop_id: shopId
82
82
  });
@@ -105,7 +105,7 @@ const refreshAccessToken = async context => {
105
105
  refreshToken: tokens?.refresh_token
106
106
  });
107
107
  return {
108
- success: !!response.data
108
+ success: !!tokens
109
109
  };
110
110
  } catch (error) {
111
111
  const err = convertErrorForRpcCall(error, [_constants.HttpStatusCode.BAD_REQUEST, _constants.HttpStatusCode.UNAUTHORIZED]);
@@ -1,5 +1,5 @@
1
1
  import type { Optional } from 'utility-types';
2
- import type { GuestRequest, LoginRequest, ParamRpcHandler, RegisterRequest, RpcHandler, SendResetPasswordEmailRequest, UpdatePasswordByHashRequest } from '../../types';
2
+ import type { GuestRequest, LoginRequest, ParamRpcHandler, RegisterRequest, RpcHandler, UpdatePasswordByHashRequest } from '../../types';
3
3
  /**
4
4
  * Ensure error is a fetch error with one of the status codes
5
5
  */
@@ -13,7 +13,9 @@ export declare const refreshAccessToken: RpcHandler<{
13
13
  export declare const oauthRevokeToken: RpcHandler<{
14
14
  result: boolean;
15
15
  }>;
16
- export declare const oauthForgetPassword: RpcHandler<SendResetPasswordEmailRequest, {
16
+ export declare const oauthForgetPassword: RpcHandler<{
17
+ email: string;
18
+ }, {
17
19
  success: boolean;
18
20
  }>;
19
21
  export declare const updatePasswordByHash: ParamRpcHandler<Optional<UpdatePasswordByHashRequest, 'shop_id'>, undefined>;
@@ -83,7 +83,7 @@ export const oauthGuestLogin = async (guest, context) => {
83
83
  const shopId = context.shopId;
84
84
  const client = getOAuthClient(context);
85
85
  try {
86
- const tokens = client.guestLogin({
86
+ const tokens = await client.guestLogin({
87
87
  ...guest,
88
88
  shop_id: shopId
89
89
  });
@@ -114,7 +114,7 @@ export const refreshAccessToken = async (context) => {
114
114
  accessToken: tokens?.access_token,
115
115
  refreshToken: tokens?.refresh_token
116
116
  });
117
- return { success: !!response.data };
117
+ return { success: !!tokens };
118
118
  } catch (error) {
119
119
  const err = convertErrorForRpcCall(error, [
120
120
  HttpStatusCode.BAD_REQUEST,
@@ -1,4 +1,5 @@
1
- import type { ProductWith, VariantDetail } from '@aboutyou/backbone';
1
+ import type { ProductWith } from '@aboutyou/backbone';
2
+ import type { VariantDetail } from '@aboutyou/backbone/endpoints/variants/variantsByIds';
2
3
  import { RpcHandler } from '../../types';
3
4
  export interface FetchVariantsParams {
4
5
  ids: number[];
@@ -49,6 +49,8 @@ export interface GuestRequest {
49
49
  }
50
50
  export interface SendResetPasswordEmailRequest {
51
51
  email: string;
52
+ reset_url: string;
53
+ shop_id: number;
52
54
  }
53
55
  export interface UpdatePasswordByHashRequest {
54
56
  password: string;
@@ -105,6 +105,23 @@ export type NumberOfInstallmentsChosenByTheCustomerForTheOrder = number;
105
105
  export type IfTrueTheCustomerElectedToHaveADelayInPaymentCapture = boolean;
106
106
  export type TimestampOfOrderCreation = string;
107
107
  export type TimestampOfLastOrderUpdate = string;
108
+ export interface ThisFieldHoldsDetailsAboutTheIncludedVATTax {
109
+ amount: TheIncludedVATAmount;
110
+ rate: TheIncludedVATRateInPercentAsIntegerRepresentation;
111
+ }
112
+ /**
113
+ * When an item cannot be shipped within the regular delivery timeframe, and the warehouse is already aware of this, prior to the customer placing the order (ie it is not an unintentionally delayed delivery). This is generally the case when the item is out of stock and: the warehouse is waiting for incoming returns to restock the item, the warehouse has ordered fresh stocks from the supplier/manufacturer and is waiting for these to be shipped to the warehouse.
114
+ */
115
+ export interface DeliveryForecastFromWarehouse {
116
+ deliverable?: {
117
+ key?: string;
118
+ [k: string]: unknown;
119
+ };
120
+ subsequentDelivery?: {
121
+ key?: 'endOfJanuary' | 'endOfFebruary' | 'endOfMarch' | 'endOfApril' | 'endOfMay' | 'endOfJune' | 'endOfJuly' | 'endOfAugust' | 'endOfSeptember' | 'endOfOctober' | 'endOfNovember' | 'endOfDecember' | 'midOfJanuary' | 'midOfFebruary' | 'midOfMarch' | 'midOfApril' | 'midOfMay' | 'midOfJune' | 'midOfJuly' | 'midOfAugust' | 'midOfSeptember' | 'midOfOctober' | 'midOfNovember' | 'midOfDecember' | 'easter' | 'christmas' | 'available' | 'directShipping' | 'outsold';
122
+ [k: string]: unknown;
123
+ };
124
+ }
108
125
  export interface Order {
109
126
  /**
110
127
  * This `id` can be applied as a parameter on the url to retrieve an individual order in the [Fetch Order by ID](#fetch-order-by-id) endpoint.
@@ -535,20 +552,3 @@ export interface Order {
535
552
  createdAt: TimestampOfOrderCreation;
536
553
  updatedAt: TimestampOfLastOrderUpdate;
537
554
  }
538
- export interface ThisFieldHoldsDetailsAboutTheIncludedVATTax {
539
- amount: TheIncludedVATAmount;
540
- rate: TheIncludedVATRateInPercentAsIntegerRepresentation;
541
- }
542
- /**
543
- * When an item cannot be shipped within the regular delivery timeframe, and the warehouse is already aware of this, prior to the customer placing the order (ie it is not an unintentionally delayed delivery). This is generally the case when the item is out of stock and: the warehouse is waiting for incoming returns to restock the item, the warehouse has ordered fresh stocks from the supplier/manufacturer and is waiting for these to be shipped to the warehouse.
544
- */
545
- export interface DeliveryForecastFromWarehouse {
546
- deliverable?: {
547
- key?: string;
548
- [k: string]: unknown;
549
- };
550
- subsequentDelivery?: {
551
- key?: 'endOfJanuary' | 'endOfFebruary' | 'endOfMarch' | 'endOfApril' | 'endOfMay' | 'endOfJune' | 'endOfJuly' | 'endOfAugust' | 'endOfSeptember' | 'endOfOctober' | 'endOfNovember' | 'endOfDecember' | 'midOfJanuary' | 'midOfFebruary' | 'midOfMarch' | 'midOfApril' | 'midOfMay' | 'midOfJune' | 'midOfJuly' | 'midOfAugust' | 'midOfSeptember' | 'midOfOctober' | 'midOfNovember' | 'midOfDecember' | 'easter' | 'christmas' | 'available' | 'directShipping' | 'outsold';
552
- [k: string]: unknown;
553
- };
554
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-core",
3
- "version": "7.34.0",
3
+ "version": "7.35.0",
4
4
  "description": "Collection of essential utilities to work with the Storefront API",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",
@@ -48,6 +48,7 @@
48
48
  "clean": "rimraf ./dist",
49
49
  "build:legacy": "tsc -p tsconfig.legacy.json",
50
50
  "build": "unbuild",
51
+ "typecheck": "tsc --noEmit -p tsconfig.json",
51
52
  "format": "prettier --ignore-unknown --log-level warn --check .",
52
53
  "format:fix": "prettier --ignore-unknown --log-level warn --write .",
53
54
  "lint": "eslint . --format gitlab",
@@ -58,7 +59,7 @@
58
59
  "test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit"
59
60
  },
60
61
  "dependencies": {
61
- "@aboutyou/backbone": "16.0.1",
62
+ "@aboutyou/backbone": "16.0.2",
62
63
  "crypto-js": "4.2.0",
63
64
  "jose": "^4.14.4",
64
65
  "radash": "^11.0.0",
@@ -71,19 +72,19 @@
71
72
  "@scayle/eslint-config-storefront": "3.2.6",
72
73
  "@scayle/prettier-config-storefront": "2.0.2",
73
74
  "@types/crypto-js": "4.2.1",
74
- "@types/node": "20.10.5",
75
+ "@types/node": "20.10.7",
75
76
  "@types/webpack-env": "1.18.4",
76
- "@vitest/coverage-v8": "1.1.0",
77
+ "@vitest/coverage-v8": "1.1.3",
77
78
  "eslint": "8.56.0",
78
79
  "eslint-formatter-gitlab": "5.1.0",
79
80
  "prettier": "3.0.0",
80
- "publint": "0.2.6",
81
+ "publint": "0.2.7",
81
82
  "rimraf": "5.0.5",
82
83
  "ts-node": "10.9.2",
83
84
  "typescript": "5.3.3",
84
85
  "unbuild": "2.0.0",
85
86
  "unstorage": "1.10.1",
86
- "vitest": "1.1.0"
87
+ "vitest": "1.1.3"
87
88
  },
88
89
  "optionalDependencies": {
89
90
  "redis": "4"