@open-tender/cloud 0.1.13 → 0.1.15
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.
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import {
|
|
2
|
+
import { GiftCardsPurchase, GiftCardsPurchased, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface GiftCardsState {
|
|
4
4
|
loading: RequestStatus;
|
|
5
5
|
error: RequestError;
|
|
6
6
|
success: boolean;
|
|
7
|
-
giftCards:
|
|
7
|
+
giftCards: GiftCardsPurchased;
|
|
8
8
|
}
|
|
9
9
|
export declare enum GiftCardsActionType {
|
|
10
10
|
PurchaseGiftCards = "giftCards/purchaseGiftCards"
|
|
11
11
|
}
|
|
12
|
-
export declare const purchaseGiftCards: import("@reduxjs/toolkit").AsyncThunk<
|
|
13
|
-
data:
|
|
12
|
+
export declare const purchaseGiftCards: import("@reduxjs/toolkit").AsyncThunk<GiftCardsPurchased, {
|
|
13
|
+
data: GiftCardsPurchase;
|
|
14
14
|
callback?: (() => void) | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
state: AppState;
|
|
@@ -27,6 +27,6 @@ export declare const selectGiftCards: (state: AppState) => {
|
|
|
27
27
|
success: boolean;
|
|
28
28
|
loading: RequestStatus;
|
|
29
29
|
error: RequestError;
|
|
30
|
-
giftCards:
|
|
30
|
+
giftCards: GiftCardsPurchased;
|
|
31
31
|
};
|
|
32
32
|
export declare const giftCardsReducer: import("redux").Reducer<GiftCardsState, import("redux").AnyAction>;
|
|
@@ -14,14 +14,14 @@ var GiftCardsActionType;
|
|
|
14
14
|
(function (GiftCardsActionType) {
|
|
15
15
|
GiftCardsActionType["PurchaseGiftCards"] = "giftCards/purchaseGiftCards";
|
|
16
16
|
})(GiftCardsActionType = exports.GiftCardsActionType || (exports.GiftCardsActionType = {}));
|
|
17
|
-
exports.purchaseGiftCards = (0, toolkit_1.createAsyncThunk)(GiftCardsActionType.PurchaseGiftCards, (
|
|
17
|
+
exports.purchaseGiftCards = (0, toolkit_1.createAsyncThunk)(GiftCardsActionType.PurchaseGiftCards, ({ data, callback }, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
const { api } = getState().config;
|
|
19
19
|
if (!api)
|
|
20
20
|
return;
|
|
21
21
|
try {
|
|
22
|
-
const giftCards = yield api.postPurchaseGiftCards(
|
|
23
|
-
if (
|
|
24
|
-
|
|
22
|
+
const giftCards = yield api.postPurchaseGiftCards(data);
|
|
23
|
+
if (callback)
|
|
24
|
+
callback();
|
|
25
25
|
return giftCards;
|
|
26
26
|
}
|
|
27
27
|
catch (err) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AppState } from '../app';
|
|
2
|
-
import {
|
|
2
|
+
import { GiftCardsPurchase, GiftCardsPurchased, RequestError, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export interface GiftCardsState {
|
|
4
4
|
loading: RequestStatus;
|
|
5
5
|
error: RequestError;
|
|
6
6
|
success: boolean;
|
|
7
|
-
giftCards:
|
|
7
|
+
giftCards: GiftCardsPurchased;
|
|
8
8
|
}
|
|
9
9
|
export declare enum GiftCardsActionType {
|
|
10
10
|
PurchaseGiftCards = "giftCards/purchaseGiftCards"
|
|
11
11
|
}
|
|
12
|
-
export declare const purchaseGiftCards: import("@reduxjs/toolkit").AsyncThunk<
|
|
13
|
-
data:
|
|
12
|
+
export declare const purchaseGiftCards: import("@reduxjs/toolkit").AsyncThunk<GiftCardsPurchased, {
|
|
13
|
+
data: GiftCardsPurchase;
|
|
14
14
|
callback?: (() => void) | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
state: AppState;
|
|
@@ -27,6 +27,6 @@ export declare const selectGiftCards: (state: AppState) => {
|
|
|
27
27
|
success: boolean;
|
|
28
28
|
loading: RequestStatus;
|
|
29
29
|
error: RequestError;
|
|
30
|
-
giftCards:
|
|
30
|
+
giftCards: GiftCardsPurchased;
|
|
31
31
|
};
|
|
32
32
|
export declare const giftCardsReducer: import("redux").Reducer<GiftCardsState, import("redux").AnyAction>;
|
|
@@ -11,14 +11,14 @@ export var GiftCardsActionType;
|
|
|
11
11
|
(function (GiftCardsActionType) {
|
|
12
12
|
GiftCardsActionType["PurchaseGiftCards"] = "giftCards/purchaseGiftCards";
|
|
13
13
|
})(GiftCardsActionType || (GiftCardsActionType = {}));
|
|
14
|
-
export const purchaseGiftCards = createAsyncThunk(GiftCardsActionType.PurchaseGiftCards, (
|
|
14
|
+
export const purchaseGiftCards = createAsyncThunk(GiftCardsActionType.PurchaseGiftCards, ({ data, callback }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
const { api } = getState().config;
|
|
16
16
|
if (!api)
|
|
17
17
|
return;
|
|
18
18
|
try {
|
|
19
|
-
const giftCards = yield api.postPurchaseGiftCards(
|
|
20
|
-
if (
|
|
21
|
-
|
|
19
|
+
const giftCards = yield api.postPurchaseGiftCards(data);
|
|
20
|
+
if (callback)
|
|
21
|
+
callback();
|
|
22
22
|
return giftCards;
|
|
23
23
|
}
|
|
24
24
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|