washday-sdk 0.0.50 → 0.0.53

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.
@@ -12,14 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.updateCompanyTaxInfoById = exports.updateCompanyById = void 0;
15
+ exports.updateCompanyTaxInfoById = exports.updateCompanyLogoById = exports.updateCompanyById = void 0;
16
16
  const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
17
  const GET_SET_COMPANIES = 'api/company';
18
18
  const updateCompanyById = function (companyId, data) {
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
20
  try {
21
21
  const config = {
22
- headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
23
  };
24
24
  const response = yield axiosInstance_1.default.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
25
25
  return response;
@@ -31,6 +31,23 @@ const updateCompanyById = function (companyId, data) {
31
31
  });
32
32
  };
33
33
  exports.updateCompanyById = updateCompanyById;
34
+ const updateCompanyLogoById = function (companyId, data) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ //TODO: company logo requires to have content-type false?
38
+ const config = {
39
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
40
+ };
41
+ const response = yield axiosInstance_1.default.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
42
+ return response;
43
+ }
44
+ catch (error) {
45
+ console.error('Error fetching updateCompanyLogoById:', error);
46
+ throw error;
47
+ }
48
+ });
49
+ };
50
+ exports.updateCompanyLogoById = updateCompanyLogoById;
34
51
  const updateCompanyTaxInfoById = function (companyId, data) {
35
52
  return __awaiter(this, void 0, void 0, function* () {
36
53
  try {
package/dist/api/index.js CHANGED
@@ -6,11 +6,15 @@ const put_1 = require("./companies/put");
6
6
  const get_2 = require("./countries/get");
7
7
  const get_3 = require("./customers/get");
8
8
  const put_2 = require("./products/put");
9
- const get_4 = require("./stores/get");
10
- const post_2 = require("./stores/post");
11
- const put_3 = require("./stores/put");
12
- const post_3 = require("./stripe/post");
13
- const put_4 = require("./users/put");
9
+ const delete_1 = require("./staff/delete");
10
+ const get_4 = require("./staff/get");
11
+ const post_2 = require("./staff/post");
12
+ const put_3 = require("./staff/put");
13
+ const get_5 = require("./stores/get");
14
+ const post_3 = require("./stores/post");
15
+ const put_4 = require("./stores/put");
16
+ const post_4 = require("./stripe/post");
17
+ const put_5 = require("./users/put");
14
18
  const WashdayClient = function WashdayClient(apiToken) {
15
19
  this.apiToken = apiToken;
16
20
  WashdayClient.prototype.customers.apiToken = apiToken;
@@ -20,23 +24,24 @@ const WashdayClient = function WashdayClient(apiToken) {
20
24
  WashdayClient.prototype.countries.apiToken = apiToken;
21
25
  WashdayClient.prototype.companies.apiToken = apiToken;
22
26
  WashdayClient.prototype.stripe.apiToken = apiToken;
27
+ WashdayClient.prototype.staff.apiToken = apiToken;
23
28
  };
24
29
  WashdayClient.prototype.customers = {
25
30
  getCustomerById: get_3.getCustomerById,
26
31
  getCustomerHighlightsById: get_3.getCustomerHighlightsById
27
32
  };
28
33
  WashdayClient.prototype.stores = {
29
- getStores: get_4.getStores,
30
- getStoreById: get_4.getStoreById,
31
- updateStoreById: put_3.updateStoreById,
32
- createStoreImage: post_2.createStoreImage,
33
- getStoreReviewLink: get_4.getStoreReviewLink
34
+ getStores: get_5.getStores,
35
+ getStoreById: get_5.getStoreById,
36
+ updateStoreById: put_4.updateStoreById,
37
+ createStoreImage: post_3.createStoreImage,
38
+ getStoreReviewLink: get_5.getStoreReviewLink
34
39
  };
35
40
  WashdayClient.prototype.products = {
36
41
  bulkUpdate: put_2.bulkUpdate,
37
42
  };
38
43
  WashdayClient.prototype.users = {
39
- updateUserById: put_4.updateUserById,
44
+ updateUserById: put_5.updateUserById,
40
45
  };
41
46
  WashdayClient.prototype.countries = {
42
47
  getCountries: get_2.getCountries,
@@ -44,13 +49,20 @@ WashdayClient.prototype.countries = {
44
49
  WashdayClient.prototype.companies = {
45
50
  getCompanyById: get_1.getCompanyById,
46
51
  updateCompanyById: put_1.updateCompanyById,
52
+ updateCompanyLogoById: put_1.updateCompanyLogoById,
47
53
  updateCompanyTaxInfoById: put_1.updateCompanyTaxInfoById,
48
54
  updateCompanyTaxInfoCertificates: post_1.updateCompanyTaxInfoCertificates,
49
55
  updateCFDIOrgLogo: post_1.updateCFDIOrgLogo
50
56
  };
51
57
  WashdayClient.prototype.stripe = {
52
- createCreateSuscriptionCheckoutSession: post_3.createCreateSuscriptionCheckoutSession,
53
- createCFDISuscrptionCheckoutSession: post_3.createCFDISuscrptionCheckoutSession,
54
- createCustomerPortalSession: post_3.createCustomerPortalSession
58
+ createCreateSuscriptionCheckoutSession: post_4.createCreateSuscriptionCheckoutSession,
59
+ createCFDISuscrptionCheckoutSession: post_4.createCFDISuscrptionCheckoutSession,
60
+ createCustomerPortalSession: post_4.createCustomerPortalSession
61
+ };
62
+ WashdayClient.prototype.staff = {
63
+ getStoreStaff: get_4.getStoreStaff,
64
+ updateStoreStaffById: put_3.updateStoreStaffById,
65
+ createStoreStaff: post_2.createStoreStaff,
66
+ deleteStoreStaffById: delete_1.deleteStoreStaffById,
55
67
  };
56
68
  exports.default = WashdayClient;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.deleteStoreStaffById = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const deleteStoreStaffById = function (storeId, staffId) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ const config = {
21
+ headers: { Authorization: `Bearer ${this.apiToken}` }
22
+ };
23
+ const response = yield axiosInstance_1.default.delete(`api/store/${storeId}/staff/${staffId}`, config);
24
+ return response;
25
+ }
26
+ catch (error) {
27
+ console.error('Error fetching getStoreStaff:', error);
28
+ throw error;
29
+ }
30
+ });
31
+ };
32
+ exports.deleteStoreStaffById = deleteStoreStaffById;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getStoreStaff = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const getStoreStaff = function (storeId, queryParams) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ const config = {
21
+ headers: { Authorization: `Bearer ${this.apiToken}` }
22
+ };
23
+ const response = yield axiosInstance_1.default.get(`api/store/${storeId}/staff?${queryParams}`, config);
24
+ return response;
25
+ }
26
+ catch (error) {
27
+ console.error('Error fetching getStoreStaff:', error);
28
+ throw error;
29
+ }
30
+ });
31
+ };
32
+ exports.getStoreStaff = getStoreStaff;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.createStoreStaff = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_STORES = 'api/store';
18
+ const createStoreStaff = function (storeId, data) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ const response = yield axiosInstance_1.default.post(`api/store/${storeId}/staff`, data, config);
25
+ return response;
26
+ }
27
+ catch (error) {
28
+ console.error('Error fetching createStoreImage:', error);
29
+ throw error;
30
+ }
31
+ });
32
+ };
33
+ exports.createStoreStaff = createStoreStaff;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.updateStoreStaffById = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const updateStoreStaffById = function (storeId, data) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ const config = {
21
+ headers: { Authorization: `Bearer ${this.apiToken}` }
22
+ };
23
+ const response = yield axiosInstance_1.default.put(`api/store/${storeId}/staff`, data, config);
24
+ return response;
25
+ }
26
+ catch (error) {
27
+ console.error('Error fetching getStoreById:', error);
28
+ throw error;
29
+ }
30
+ });
31
+ };
32
+ exports.updateStoreStaffById = updateStoreStaffById;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.50",
3
+ "version": "0.0.53",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -5,7 +5,7 @@ const GET_SET_COMPANIES = 'api/company';
5
5
  export const updateCompanyById = async function (this: WashdayClientInstance, companyId: string, data: any): Promise<any> {
6
6
  try {
7
7
  const config = {
8
- headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
8
+ headers: { Authorization: `Bearer ${this.apiToken}` }
9
9
  };
10
10
  const response = await axiosInstance.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
11
11
  return response;
@@ -15,6 +15,20 @@ export const updateCompanyById = async function (this: WashdayClientInstance, co
15
15
  }
16
16
  };
17
17
 
18
+ export const updateCompanyLogoById = async function (this: WashdayClientInstance, companyId: string, data: any): Promise<any> {
19
+ try {
20
+ //TODO: company logo requires to have content-type false?
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
23
+ };
24
+ const response = await axiosInstance.put(`${GET_SET_COMPANIES}/${companyId}`, data, config);
25
+ return response;
26
+ } catch (error) {
27
+ console.error('Error fetching updateCompanyLogoById:', error);
28
+ throw error;
29
+ }
30
+ };
31
+
18
32
  export const updateCompanyTaxInfoById = async function (this: WashdayClientInstance, companyId: string, data: any): Promise<any> {
19
33
  try {
20
34
  const config = {
package/src/api/index.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { WashdayClientInstance } from "../interfaces/Api";
2
2
  import { getCompanyById } from "./companies/get";
3
3
  import { updateCFDIOrgLogo, updateCompanyTaxInfoCertificates } from "./companies/post";
4
- import { updateCompanyById, updateCompanyTaxInfoById } from "./companies/put";
4
+ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } from "./companies/put";
5
5
  import { getCountries } from "./countries/get";
6
6
  import { getCustomerById, getCustomerHighlightsById } from "./customers/get";
7
7
  import { bulkUpdate } from "./products/put";
8
+ import { deleteStoreStaffById } from "./staff/delete";
9
+ import { getStoreStaff } from "./staff/get";
10
+ import { createStoreStaff } from "./staff/post";
11
+ import { updateStoreStaffById } from "./staff/put";
8
12
  import { getStoreById, getStoreReviewLink, getStores } from "./stores/get";
9
13
  import { createStoreImage } from "./stores/post";
10
14
  import { updateStoreById } from "./stores/put";
@@ -26,6 +30,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
26
30
  WashdayClient.prototype.countries.apiToken = apiToken;
27
31
  WashdayClient.prototype.companies.apiToken = apiToken;
28
32
  WashdayClient.prototype.stripe.apiToken = apiToken;
33
+ WashdayClient.prototype.staff.apiToken = apiToken;
29
34
  } as any;
30
35
 
31
36
  WashdayClient.prototype.customers = {
@@ -57,6 +62,7 @@ WashdayClient.prototype.countries = {
57
62
  WashdayClient.prototype.companies = {
58
63
  getCompanyById: getCompanyById,
59
64
  updateCompanyById: updateCompanyById,
65
+ updateCompanyLogoById: updateCompanyLogoById,
60
66
  updateCompanyTaxInfoById: updateCompanyTaxInfoById,
61
67
  updateCompanyTaxInfoCertificates: updateCompanyTaxInfoCertificates,
62
68
  updateCFDIOrgLogo: updateCFDIOrgLogo
@@ -68,4 +74,11 @@ WashdayClient.prototype.stripe = {
68
74
  createCustomerPortalSession: createCustomerPortalSession
69
75
  };
70
76
 
77
+ WashdayClient.prototype.staff = {
78
+ getStoreStaff: getStoreStaff,
79
+ updateStoreStaffById: updateStoreStaffById,
80
+ createStoreStaff: createStoreStaff,
81
+ deleteStoreStaffById: deleteStoreStaffById,
82
+ };
83
+
71
84
  export default WashdayClient;
@@ -0,0 +1,15 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+
4
+ export const deleteStoreStaffById = async function (this: WashdayClientInstance, storeId: string, staffId: string): Promise<any> {
5
+ try {
6
+ const config = {
7
+ headers: { Authorization: `Bearer ${this.apiToken}` }
8
+ };
9
+ const response = await axiosInstance.delete(`api/store/${storeId}/staff/${staffId}`, config);
10
+ return response;
11
+ } catch (error) {
12
+ console.error('Error fetching getStoreStaff:', error);
13
+ throw error;
14
+ }
15
+ };
@@ -0,0 +1,17 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+ import { IStore } from "../../interfaces/Store";
4
+
5
+
6
+ export const getStoreStaff = async function (this: WashdayClientInstance, storeId: string, queryParams?: string): Promise<any> {
7
+ try {
8
+ const config = {
9
+ headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ };
11
+ const response = await axiosInstance.get(`api/store/${storeId}/staff?${queryParams}`, config);
12
+ return response;
13
+ } catch (error) {
14
+ console.error('Error fetching getStoreStaff:', error);
15
+ throw error;
16
+ }
17
+ };
@@ -0,0 +1,17 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import axiosInstance from "../axiosInstance";
3
+
4
+ const GET_SET_STORES = 'api/store';
5
+
6
+ export const createStoreStaff = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
7
+ try {
8
+ const config = {
9
+ headers: { Authorization: `Bearer ${this.apiToken}` }
10
+ };
11
+ const response = await axiosInstance.post(`api/store/${storeId}/staff`, data, config);
12
+ return response;
13
+ } catch (error) {
14
+ console.error('Error fetching createStoreImage:', error);
15
+ throw error;
16
+ }
17
+ };
@@ -0,0 +1,16 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { IStore } from "../../interfaces/Store";
3
+ import axiosInstance from "../axiosInstance";
4
+
5
+ export const updateStoreStaffById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<any> {
6
+ try {
7
+ const config = {
8
+ headers: { Authorization: `Bearer ${this.apiToken}` }
9
+ };
10
+ const response = await axiosInstance.put(`api/store/${storeId}/staff`, data, config);
11
+ return response;
12
+ } catch (error) {
13
+ console.error('Error fetching getStoreById:', error);
14
+ throw error;
15
+ }
16
+ };
@@ -2,7 +2,9 @@ import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import axiosInstance from "../axiosInstance";
3
3
  const GET_SET_STRIPE = 'api/stripe';
4
4
 
5
- export const createCreateSuscriptionCheckoutSession = async function (this: WashdayClientInstance, data?: any): Promise<any> {
5
+ export const createCreateSuscriptionCheckoutSession = async function (this: WashdayClientInstance, data: {
6
+ priceId: string
7
+ }): Promise<any> {
6
8
  try {
7
9
  const config = {
8
10
  headers: { Authorization: `Bearer ${this.apiToken}` }