washday-sdk 0.0.58 → 0.0.59
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/dist/api/index.js +1 -0
- package/dist/api/stores/post.js +21 -1
- package/package.json +1 -1
- package/src/api/index.ts +2 -1
- package/src/api/stores/post.ts +18 -1
package/dist/api/index.js
CHANGED
|
@@ -36,6 +36,7 @@ WashdayClient.prototype.stores = {
|
|
|
36
36
|
getStores: get_6.getStores,
|
|
37
37
|
getStoreById: get_6.getStoreById,
|
|
38
38
|
createStore: post_3.createStore,
|
|
39
|
+
copyStore: post_3.copyStore,
|
|
39
40
|
updateStoreById: put_4.updateStoreById,
|
|
40
41
|
createStoreImage: post_3.createStoreImage,
|
|
41
42
|
getStoreReviewLink: get_6.getStoreReviewLink,
|
package/dist/api/stores/post.js
CHANGED
|
@@ -12,7 +12,7 @@ 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.createStore = exports.createStoreImage = void 0;
|
|
15
|
+
exports.copyStore = exports.createStore = exports.createStoreImage = void 0;
|
|
16
16
|
const axiosInstance_1 = __importDefault(require("../axiosInstance"));
|
|
17
17
|
const GET_SET_STORE_IMAGE = 'api/store-image';
|
|
18
18
|
const GET_SET_STORES = 'api/store';
|
|
@@ -48,3 +48,23 @@ const createStore = function (data) {
|
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
50
|
exports.createStore = createStore;
|
|
51
|
+
const copyStore = function (copyStoreId) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
try {
|
|
54
|
+
if (!copyStoreId)
|
|
55
|
+
throw new Error('store id required');
|
|
56
|
+
const config = {
|
|
57
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
58
|
+
};
|
|
59
|
+
const response = yield axiosInstance_1.default.post(`${GET_SET_STORES}/copy`, {
|
|
60
|
+
fromStoreId: copyStoreId
|
|
61
|
+
}, config);
|
|
62
|
+
return response;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error('Error fetching createStore:', error);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
exports.copyStore = copyStore;
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
|
11
11
|
import { createStoreStaff } from "./staff/post";
|
|
12
12
|
import { updateStoreStaffById } from "./staff/put";
|
|
13
13
|
import { getStoreById, getStoreReviewLink, getStores } from "./stores/get";
|
|
14
|
-
import { createStore, createStoreImage } from "./stores/post";
|
|
14
|
+
import { copyStore, createStore, createStoreImage } from "./stores/post";
|
|
15
15
|
import { deleteStoreById, updateStoreById } from "./stores/put";
|
|
16
16
|
import { createCFDISuscrptionCheckoutSession, createCreateSuscriptionCheckoutSession, createCustomerPortalSession } from "./stripe/post";
|
|
17
17
|
import { updateUserById } from "./users/put";
|
|
@@ -44,6 +44,7 @@ WashdayClient.prototype.stores = {
|
|
|
44
44
|
getStores: getStores,
|
|
45
45
|
getStoreById: getStoreById,
|
|
46
46
|
createStore: createStore,
|
|
47
|
+
copyStore: copyStore,
|
|
47
48
|
updateStoreById: updateStoreById,
|
|
48
49
|
createStoreImage: createStoreImage,
|
|
49
50
|
getStoreReviewLink: getStoreReviewLink,
|
package/src/api/stores/post.ts
CHANGED
|
@@ -29,4 +29,21 @@ export const createStore = async function (this: WashdayClientInstance, data: an
|
|
|
29
29
|
console.error('Error fetching createStore:', error);
|
|
30
30
|
throw error;
|
|
31
31
|
}
|
|
32
|
-
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const copyStore = async function (this: WashdayClientInstance, copyStoreId: string): Promise<any> {
|
|
35
|
+
try {
|
|
36
|
+
if (!copyStoreId) throw new Error('store id required');
|
|
37
|
+
const config = {
|
|
38
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
|
+
};
|
|
40
|
+
const response = await axiosInstance.post(`${GET_SET_STORES}/copy`, {
|
|
41
|
+
fromStoreId: copyStoreId
|
|
42
|
+
}, config);
|
|
43
|
+
return response;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error('Error fetching createStore:', error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|