washday-sdk 0.0.105 → 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
@@ -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,
@@ -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.105",
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
@@ -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,
@@ -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;
@@ -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
+