washday-sdk 0.0.104 → 0.0.106

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.
@@ -0,0 +1,3 @@
1
+ // export * as deleteModule from './delete';
2
+ export * as postModule from './post';
3
+ // export * as putModule from './put';
@@ -0,0 +1,23 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import axiosInstance from "../axiosInstance";
11
+ const GET_AUTH = "api/v2/washdayapp/auth";
12
+ export const appleLogin = function (params) {
13
+ return __awaiter(this, void 0, void 0, function* () {
14
+ try {
15
+ const config = {};
16
+ return yield axiosInstance.post(`${GET_AUTH}`, params, config);
17
+ }
18
+ catch (error) {
19
+ console.error('Error fetching appleLogin:', error);
20
+ throw error;
21
+ }
22
+ });
23
+ };
package/dist/api/index.js CHANGED
@@ -13,7 +13,7 @@ import { deleteStoreStaffById } from "./staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
14
14
  import { createStoreStaff } from "./staff/post";
15
15
  import { updateStoreStaffById } from "./staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores } from "./stores/get";
16
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "./stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "./stores/post";
18
18
  import { deleteStoreById, updateStoreById } from "./stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
@@ -28,6 +28,7 @@ import * as productsEndpoints from './products';
28
28
  import * as customersEndpoints from './customers';
29
29
  import * as csvExportEndpoints from './csv';
30
30
  import * as ordersEndpoints from './order';
31
+ import * as authEndpoints from './auth';
31
32
  import * as routesEndpoints from './routes';
32
33
  import * as reviewsEndpoints from './reviews';
33
34
  import * as cfdiEndpoints from './cfdi';
@@ -69,6 +70,9 @@ const WashdayClient = function WashdayClient(apiToken) {
69
70
  createRoute: routesEndpoints.postModule.createRoute,
70
71
  closeStoreRoutes: routesEndpoints.putModule.closeStoreRoutes,
71
72
  });
73
+ this.auth = bindMethods(this, {
74
+ appleLogin: authEndpoints.postModule.appleLogin,
75
+ });
72
76
  this.orders = bindMethods(this, {
73
77
  getList: ordersEndpoints.getModule.getList,
74
78
  getOrdersHeaderSummary: ordersEndpoints.getModule.getOrdersHeaderSummary,
@@ -100,6 +104,7 @@ const WashdayClient = function WashdayClient(apiToken) {
100
104
  getStores: getStores,
101
105
  getStoreById: getStoreById,
102
106
  getStoreImages: getStoreImages,
107
+ getStoresByName: getStoresByName,
103
108
  createStore: createStore,
104
109
  copyStore: copyStore,
105
110
  updateStoreById: updateStoreById,
@@ -7,12 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
10
11
  import axiosInstance from "../axiosInstance";
11
12
  const GET_SET_STORES = 'api/store';
12
13
  const GET_SET_STORE_IMAGE = 'api/store-image';
13
14
  const REQUEST_PARAMS = {
14
15
  token: 'LOGGED_USER_TOKEN',
15
16
  };
17
+ const GET_STORES_WASHDAY_APP = 'api/v2/washdayapp/store';
16
18
  export const getStores = function (params) {
17
19
  return __awaiter(this, void 0, void 0, function* () {
18
20
  var _a, _b;
@@ -75,3 +77,18 @@ export const getStoreImages = function (storeId) {
75
77
  }
76
78
  });
77
79
  };
80
+ export const getStoresByName = function (query) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ var _a, _b;
83
+ try {
84
+ const config = {};
85
+ const queryParams = generateQueryParamsStr(['q'], query);
86
+ const response = yield axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
87
+ return ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.stores) || [];
88
+ }
89
+ catch (error) {
90
+ console.error('Error fetching getStoresByName:', error);
91
+ throw error;
92
+ }
93
+ });
94
+ };
@@ -0,0 +1,16 @@
1
+ var AppleAuthenticationUserDetectionStatus;
2
+ (function (AppleAuthenticationUserDetectionStatus) {
3
+ /**
4
+ * The system does not support this determination and there is no data.
5
+ */
6
+ AppleAuthenticationUserDetectionStatus[AppleAuthenticationUserDetectionStatus["UNSUPPORTED"] = 0] = "UNSUPPORTED";
7
+ /**
8
+ * The system has not determined whether the user might be a real person.
9
+ */
10
+ AppleAuthenticationUserDetectionStatus[AppleAuthenticationUserDetectionStatus["UNKNOWN"] = 1] = "UNKNOWN";
11
+ /**
12
+ * The user appears to be a real person.
13
+ */
14
+ AppleAuthenticationUserDetectionStatus[AppleAuthenticationUserDetectionStatus["LIKELY_REAL"] = 2] = "LIKELY_REAL";
15
+ })(AppleAuthenticationUserDetectionStatus || (AppleAuthenticationUserDetectionStatus = {}));
16
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.104",
3
+ "version": "0.0.106",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -0,0 +1,3 @@
1
+ // export * as deleteModule from './delete';
2
+ export * as postModule from './post';
3
+ // export * as putModule from './put';
@@ -0,0 +1,18 @@
1
+
2
+ import { WashdayClientInstance } from "../../interfaces/Api";
3
+ import { AppleAuthenticationCredential } from "../../interfaces/Apple";
4
+ import axiosInstance from "../axiosInstance";
5
+ const GET_AUTH = "api/v2/washdayapp/auth"
6
+
7
+ export const appleLogin = async function (this: WashdayClientInstance, params: {
8
+ storeId: string;
9
+ credentials: AppleAuthenticationCredential,
10
+ }): Promise<any> {
11
+ try {
12
+ const config = {};
13
+ return await axiosInstance.post(`${GET_AUTH}`, params, config);
14
+ } catch (error) {
15
+ console.error('Error fetching appleLogin:', error);
16
+ throw error;
17
+ }
18
+ };
package/src/api/index.ts CHANGED
@@ -14,7 +14,7 @@ import { deleteStoreStaffById } from "./staff/delete";
14
14
  import { getStoreStaff, getStoreStaffById } from "./staff/get";
15
15
  import { createStoreStaff } from "./staff/post";
16
16
  import { updateStoreStaffById } from "./staff/put";
17
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores } from "./stores/get";
17
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "./stores/get";
18
18
  import { copyStore, createStore, createStoreImage } from "./stores/post";
19
19
  import { deleteStoreById, updateStoreById } from "./stores/put";
20
20
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "./stripe/post";
@@ -29,6 +29,7 @@ import * as productsEndpoints from './products';
29
29
  import * as customersEndpoints from './customers';
30
30
  import * as csvExportEndpoints from './csv';
31
31
  import * as ordersEndpoints from './order';
32
+ import * as authEndpoints from './auth';
32
33
  import * as routesEndpoints from './routes';
33
34
  import * as reviewsEndpoints from './reviews';
34
35
  import * as cfdiEndpoints from './cfdi';
@@ -75,6 +76,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
75
76
  createRoute: routesEndpoints.postModule.createRoute,
76
77
  closeStoreRoutes: routesEndpoints.putModule.closeStoreRoutes,
77
78
  });
79
+ this.auth = bindMethods(this, {
80
+ appleLogin: authEndpoints.postModule.appleLogin,
81
+ });
78
82
  this.orders = bindMethods(this, {
79
83
  getList: ordersEndpoints.getModule.getList,
80
84
  getOrdersHeaderSummary: ordersEndpoints.getModule.getOrdersHeaderSummary,
@@ -106,6 +110,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
106
110
  getStores: getStores,
107
111
  getStoreById: getStoreById,
108
112
  getStoreImages: getStoreImages,
113
+ getStoresByName: getStoresByName,
109
114
  createStore: createStore,
110
115
  copyStore: copyStore,
111
116
  updateStoreById: updateStoreById,
@@ -1,5 +1,6 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import { IStore } from "../../interfaces/Store";
3
+ import { generateQueryParamsStr } from "../../utils/apiUtils";
3
4
  import axiosInstance from "../axiosInstance";
4
5
 
5
6
  const GET_SET_STORES = 'api/store';
@@ -7,6 +8,7 @@ const GET_SET_STORE_IMAGE = 'api/store-image';
7
8
  const REQUEST_PARAMS = {
8
9
  token: 'LOGGED_USER_TOKEN',
9
10
  };
11
+ const GET_STORES_WASHDAY_APP = 'api/v2/washdayapp/store';
10
12
 
11
13
  export const getStores = async function (this: WashdayClientInstance, params: {
12
14
  isActive?: string
@@ -62,3 +64,17 @@ export const getStoreImages = async function (this: WashdayClientInstance, store
62
64
  throw error;
63
65
  }
64
66
  };
67
+
68
+ export const getStoresByName = async function (this: WashdayClientInstance, query: {
69
+ q?: string
70
+ }): Promise<{ stores: IStore[] }> {
71
+ try {
72
+ const config = {};
73
+ const queryParams = generateQueryParamsStr(['q'], query);
74
+ const response = await axiosInstance.get(`${GET_STORES_WASHDAY_APP}?${queryParams}`, config);
75
+ return response.data?.data?.stores || [];
76
+ } catch (error) {
77
+ console.error('Error fetching getStoresByName:', error);
78
+ throw error;
79
+ }
80
+ };
@@ -13,7 +13,7 @@ import { deleteStoreStaffById } from "../api/staff/delete";
13
13
  import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
14
14
  import { createStoreStaff } from "../api/staff/post";
15
15
  import { updateStoreStaffById } from "../api/staff/put";
16
- import { getStoreById, getStoreImages, getStoreReviewLink, getStores } from "../api/stores/get";
16
+ import { getStoreById, getStoreImages, getStoreReviewLink, getStores, getStoresByName } from "../api/stores/get";
17
17
  import { copyStore, createStore, createStoreImage } from "../api/stores/post";
18
18
  import { deleteStoreById, updateStoreById } from "../api/stores/put";
19
19
  import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession, createGetMoreCheckoutSession } from "../api/stripe/post";
@@ -32,6 +32,7 @@ import * as routesEndpoints from '../api/routes';
32
32
  import * as reviewsEndpoints from '../api/reviews';
33
33
  import * as cfdiEndpoints from '../api/cfdi';
34
34
  import * as cashupsEndpoints from '../api/cashups';
35
+ import * as authEndpoints from '../api/auth';
35
36
 
36
37
  export interface WashdayClientInstance {
37
38
  apiToken: string;
@@ -51,6 +52,9 @@ export interface WashdayClientInstance {
51
52
  createGlobalCFDI: typeof cfdiEndpoints.postModule.createGlobalCFDI
52
53
  cancelCFDI: typeof cfdiEndpoints.deleteModule.cancelCFDI
53
54
  }
55
+ auth: {
56
+ appleLogin: typeof authEndpoints.postModule.appleLogin;
57
+ }
54
58
  review: {
55
59
  getList: typeof reviewsEndpoints.getModule.getList;
56
60
  requestStoreReviewByCustomerId: typeof reviewsEndpoints.getModule.requestStoreReviewByCustomerId;
@@ -92,6 +96,7 @@ export interface WashdayClientInstance {
92
96
  getStores: typeof getStores;
93
97
  getStoreById: typeof getStoreById;
94
98
  getStoreImages: typeof getStoreImages;
99
+ getStoresByName: typeof getStoresByName;
95
100
  createStore: typeof createStore;
96
101
  copyStore: typeof copyStore;
97
102
  updateStoreById: typeof updateStoreById;
@@ -0,0 +1,74 @@
1
+
2
+ export type AppleAuthenticationFullName = {
3
+ namePrefix: string | null;
4
+ givenName: string | null;
5
+ middleName: string | null;
6
+ familyName: string | null;
7
+ nameSuffix: string | null;
8
+ nickname: string | null;
9
+ };
10
+
11
+ enum AppleAuthenticationUserDetectionStatus {
12
+ /**
13
+ * The system does not support this determination and there is no data.
14
+ */
15
+ UNSUPPORTED = 0,
16
+ /**
17
+ * The system has not determined whether the user might be a real person.
18
+ */
19
+ UNKNOWN = 1,
20
+ /**
21
+ * The user appears to be a real person.
22
+ */
23
+ LIKELY_REAL = 2,
24
+ }
25
+
26
+ export type AppleAuthenticationCredential = {
27
+ /**
28
+ * An identifier associated with the authenticated user. You can use this to check if the user is
29
+ * still authenticated later. This is stable and can be shared across apps released under the same
30
+ * development team. The same user will have a different identifier for apps released by other
31
+ * developers.
32
+ */
33
+ user: string;
34
+
35
+ /**
36
+ * An arbitrary string that your app provided as `state` in the request that generated the
37
+ * credential. Used to verify that the response was from the request you made. Can be used to
38
+ * avoid replay attacks. If you did not provide `state` when making the sign-in request, this field
39
+ * will be `null`.
40
+ */
41
+ state: string | null;
42
+
43
+ /**
44
+ * The user's name. May be `null` or contain `null` values if you didn't request the `FULL_NAME`
45
+ * scope, if the user denied access, or if this is not the first time the user has signed into
46
+ * your app.
47
+ */
48
+ fullName: AppleAuthenticationFullName | null;
49
+
50
+ /**
51
+ * The user's email address. Might not be present if you didn't request the `EMAIL` scope. May
52
+ * also be null if this is not the first time the user has signed into your app. If the user chose
53
+ * to withhold their email address, this field will instead contain an obscured email address with
54
+ * an Apple domain.
55
+ */
56
+ email: string | null;
57
+
58
+ /**
59
+ * A value that indicates whether the user appears to the system to be a real person.
60
+ */
61
+ realUserStatus: AppleAuthenticationUserDetectionStatus;
62
+
63
+ /**
64
+ * A JSON Web Token (JWT) that securely communicates information about the user to your app.
65
+ */
66
+ identityToken: string | null;
67
+
68
+ /**
69
+ * A short-lived session token used by your app for proof of authorization when interacting with
70
+ * the app's server counterpart. Unlike `user`, this is ephemeral and will change each session.
71
+ */
72
+ authorizationCode: string | null;
73
+ };
74
+