@open-tender/cloud 0.4.14 → 0.4.16

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.
Files changed (51) hide show
  1. package/dist/cjs/app/hooks.d.ts +1 -1
  2. package/dist/cjs/app/store.d.ts +3 -3
  3. package/dist/cjs/services/api.d.ts +2 -2
  4. package/dist/cjs/services/api.js +8 -8
  5. package/dist/cjs/slices/allergens.d.ts +1 -1
  6. package/dist/cjs/slices/announcements.d.ts +2 -2
  7. package/dist/cjs/slices/config.d.ts +2 -2
  8. package/dist/cjs/slices/customer/creditCards.d.ts +1 -1
  9. package/dist/cjs/slices/customer/index.d.ts +2 -2
  10. package/dist/cjs/slices/customer/index.js +3 -3
  11. package/dist/cjs/slices/customer/loyalty.d.ts +2 -2
  12. package/dist/cjs/slices/customer/order.d.ts +1 -1
  13. package/dist/cjs/slices/customer/pointsShop.d.ts +9 -9
  14. package/dist/cjs/slices/customer/pointsShop.js +7 -7
  15. package/dist/cjs/slices/customer/tpls.d.ts +3 -3
  16. package/dist/cjs/slices/customer/tplsPointsShop.d.ts +38 -0
  17. package/dist/cjs/slices/customer/tplsPointsShop.js +88 -0
  18. package/dist/cjs/slices/groupOrder.d.ts +4 -4
  19. package/dist/cjs/slices/order.d.ts +3 -3
  20. package/dist/cjs/slices/quote.d.ts +1 -1
  21. package/dist/cjs/slices/tags.d.ts +1 -1
  22. package/dist/cjs/slices/types.d.ts +1 -1
  23. package/dist/cjs/slices/types.js +1 -1
  24. package/dist/esm/app/hooks.d.ts +1 -1
  25. package/dist/esm/app/store.d.ts +3 -3
  26. package/dist/esm/services/api.d.ts +2 -2
  27. package/dist/esm/services/api.js +8 -8
  28. package/dist/esm/slices/allergens.d.ts +1 -1
  29. package/dist/esm/slices/announcements.d.ts +2 -2
  30. package/dist/esm/slices/config.d.ts +2 -2
  31. package/dist/esm/slices/customer/creditCards.d.ts +1 -1
  32. package/dist/esm/slices/customer/index.d.ts +2 -2
  33. package/dist/esm/slices/customer/index.js +3 -3
  34. package/dist/esm/slices/customer/loyalty.d.ts +2 -2
  35. package/dist/esm/slices/customer/order.d.ts +1 -1
  36. package/dist/esm/slices/customer/pointsShop.d.ts +9 -9
  37. package/dist/esm/slices/customer/pointsShop.js +7 -7
  38. package/dist/esm/slices/customer/tpls.d.ts +3 -3
  39. package/dist/esm/slices/customer/tplsPointsShop.d.ts +38 -0
  40. package/dist/esm/slices/customer/tplsPointsShop.js +84 -0
  41. package/dist/esm/slices/groupOrder.d.ts +4 -4
  42. package/dist/esm/slices/order.d.ts +3 -3
  43. package/dist/esm/slices/quote.d.ts +1 -1
  44. package/dist/esm/slices/tags.d.ts +1 -1
  45. package/dist/esm/slices/types.d.ts +1 -1
  46. package/dist/esm/slices/types.js +1 -1
  47. package/package.json +2 -2
  48. package/dist/cjs/slices/customer/pointsShopV2.d.ts +0 -38
  49. package/dist/cjs/slices/customer/pointsShopV2.js +0 -88
  50. package/dist/esm/slices/customer/pointsShopV2.d.ts +0 -38
  51. package/dist/esm/slices/customer/pointsShopV2.js +0 -84
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pointsShopV2Reducer = exports.selectPointsShopV2 = exports.resetPointsShopV2 = exports.exchangePointsShopRewardV2 = exports.fetchPointsShopV2 = exports.PointsShopV2ActionType = void 0;
4
- const tslib_1 = require("tslib");
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const types_1 = require("../types");
7
- const types_2 = require("@open-tender/types");
8
- const account_1 = require("./account");
9
- const initialState = {
10
- entities: [],
11
- data: null,
12
- error: null,
13
- loading: 'idle'
14
- };
15
- var PointsShopV2ActionType;
16
- (function (PointsShopV2ActionType) {
17
- PointsShopV2ActionType["FetchPointsShop"] = "pointsShopV2/fetchPointsShop";
18
- PointsShopV2ActionType["ExchangePointsShopReward"] = "pointsShopV2/exchangePointsShopReward";
19
- })(PointsShopV2ActionType = exports.PointsShopV2ActionType || (exports.PointsShopV2ActionType = {}));
20
- exports.fetchPointsShopV2 = (0, toolkit_1.createAsyncThunk)(PointsShopV2ActionType.FetchPointsShop, (_, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
21
- try {
22
- const { api } = getState().config;
23
- if (!api)
24
- return;
25
- const token = (0, account_1.selectToken)(getState());
26
- if (!token)
27
- throw new Error(types_2.MISSING_CUSTOMER);
28
- return yield api.getPointsShopV2(token);
29
- }
30
- catch (err) {
31
- return rejectWithValue(err);
32
- }
33
- }));
34
- exports.exchangePointsShopRewardV2 = (0, toolkit_1.createAsyncThunk)(PointsShopV2ActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
35
- try {
36
- const { api } = getState().config;
37
- if (!api)
38
- return { data: null, entities: [] };
39
- const token = (0, account_1.selectToken)(getState());
40
- if (!token)
41
- throw new Error(types_2.MISSING_CUSTOMER);
42
- const data = yield api.postPointsShopRewardV2(token, rewardId);
43
- const entities = yield api.getPointsShop(token);
44
- return { data, entities };
45
- }
46
- catch (err) {
47
- return rejectWithValue(err);
48
- }
49
- }));
50
- const pointsShopV2Slice = (0, toolkit_1.createSlice)({
51
- name: types_1.ReducerType.PointsShop,
52
- initialState,
53
- reducers: {
54
- resetPointsShop: () => initialState
55
- },
56
- extraReducers: builder => {
57
- builder
58
- .addCase(exports.fetchPointsShopV2.fulfilled, (state, action) => {
59
- state.entities = action.payload;
60
- state.loading = 'idle';
61
- state.error = null;
62
- })
63
- .addCase(exports.fetchPointsShopV2.pending, state => {
64
- state.loading = 'pending';
65
- })
66
- .addCase(exports.fetchPointsShopV2.rejected, (state, action) => {
67
- state.error = action.payload;
68
- state.loading = 'idle';
69
- })
70
- .addCase(exports.exchangePointsShopRewardV2.fulfilled, (state, action) => {
71
- state.entities = action.payload.entities;
72
- state.data = action.payload.data;
73
- state.loading = 'idle';
74
- state.error = null;
75
- })
76
- .addCase(exports.exchangePointsShopRewardV2.pending, state => {
77
- state.loading = 'pending';
78
- })
79
- .addCase(exports.exchangePointsShopRewardV2.rejected, (state, action) => {
80
- state.error = action.payload;
81
- state.loading = 'idle';
82
- });
83
- }
84
- });
85
- exports.resetPointsShopV2 = pointsShopV2Slice.actions.resetPointsShop;
86
- const selectPointsShopV2 = (state) => state.customer.pointsShop;
87
- exports.selectPointsShopV2 = selectPointsShopV2;
88
- exports.pointsShopV2Reducer = pointsShopV2Slice.reducer;
@@ -1,38 +0,0 @@
1
- import { AppState } from '../../app';
2
- import { RequestError, RequestStatus, TPLSPointsShopRewardV2, TPLSPointsShopRewardsV2 } from '@open-tender/types';
3
- export interface PointsShopV2State {
4
- entities: TPLSPointsShopRewardsV2;
5
- data: TPLSPointsShopRewardV2 | null;
6
- error: RequestError;
7
- loading: RequestStatus;
8
- }
9
- export declare enum PointsShopV2ActionType {
10
- FetchPointsShop = "pointsShopV2/fetchPointsShop",
11
- ExchangePointsShopReward = "pointsShopV2/exchangePointsShopReward"
12
- }
13
- export declare const fetchPointsShopV2: import("@reduxjs/toolkit").AsyncThunk<TPLSPointsShopRewardsV2, void, {
14
- state: AppState;
15
- rejectValue: RequestError;
16
- dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
17
- extra?: unknown;
18
- serializedErrorType?: unknown;
19
- pendingMeta?: unknown;
20
- fulfilledMeta?: unknown;
21
- rejectedMeta?: unknown;
22
- }>;
23
- export declare const exchangePointsShopRewardV2: import("@reduxjs/toolkit").AsyncThunk<{
24
- data: TPLSPointsShopRewardV2;
25
- entities: TPLSPointsShopRewardsV2;
26
- }, string, {
27
- state: AppState;
28
- rejectValue: RequestError;
29
- dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
30
- extra?: unknown;
31
- serializedErrorType?: unknown;
32
- pendingMeta?: unknown;
33
- fulfilledMeta?: unknown;
34
- rejectedMeta?: unknown;
35
- }>;
36
- export declare const resetPointsShopV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"pointsShop/resetPointsShop">;
37
- export declare const selectPointsShopV2: (state: AppState) => import("./pointsShop").PointsShopState;
38
- export declare const pointsShopV2Reducer: import("redux").Reducer<PointsShopV2State, import("redux").AnyAction>;
@@ -1,84 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
3
- import { ReducerType } from '../types';
4
- import { MISSING_CUSTOMER } from '@open-tender/types';
5
- import { selectToken } from './account';
6
- const initialState = {
7
- entities: [],
8
- data: null,
9
- error: null,
10
- loading: 'idle'
11
- };
12
- export var PointsShopV2ActionType;
13
- (function (PointsShopV2ActionType) {
14
- PointsShopV2ActionType["FetchPointsShop"] = "pointsShopV2/fetchPointsShop";
15
- PointsShopV2ActionType["ExchangePointsShopReward"] = "pointsShopV2/exchangePointsShopReward";
16
- })(PointsShopV2ActionType || (PointsShopV2ActionType = {}));
17
- export const fetchPointsShopV2 = createAsyncThunk(PointsShopV2ActionType.FetchPointsShop, (_, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
18
- try {
19
- const { api } = getState().config;
20
- if (!api)
21
- return;
22
- const token = selectToken(getState());
23
- if (!token)
24
- throw new Error(MISSING_CUSTOMER);
25
- return yield api.getPointsShopV2(token);
26
- }
27
- catch (err) {
28
- return rejectWithValue(err);
29
- }
30
- }));
31
- export const exchangePointsShopRewardV2 = createAsyncThunk(PointsShopV2ActionType.ExchangePointsShopReward, (rewardId, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
32
- try {
33
- const { api } = getState().config;
34
- if (!api)
35
- return { data: null, entities: [] };
36
- const token = selectToken(getState());
37
- if (!token)
38
- throw new Error(MISSING_CUSTOMER);
39
- const data = yield api.postPointsShopRewardV2(token, rewardId);
40
- const entities = yield api.getPointsShop(token);
41
- return { data, entities };
42
- }
43
- catch (err) {
44
- return rejectWithValue(err);
45
- }
46
- }));
47
- const pointsShopV2Slice = createSlice({
48
- name: ReducerType.PointsShop,
49
- initialState,
50
- reducers: {
51
- resetPointsShop: () => initialState
52
- },
53
- extraReducers: builder => {
54
- builder
55
- .addCase(fetchPointsShopV2.fulfilled, (state, action) => {
56
- state.entities = action.payload;
57
- state.loading = 'idle';
58
- state.error = null;
59
- })
60
- .addCase(fetchPointsShopV2.pending, state => {
61
- state.loading = 'pending';
62
- })
63
- .addCase(fetchPointsShopV2.rejected, (state, action) => {
64
- state.error = action.payload;
65
- state.loading = 'idle';
66
- })
67
- .addCase(exchangePointsShopRewardV2.fulfilled, (state, action) => {
68
- state.entities = action.payload.entities;
69
- state.data = action.payload.data;
70
- state.loading = 'idle';
71
- state.error = null;
72
- })
73
- .addCase(exchangePointsShopRewardV2.pending, state => {
74
- state.loading = 'pending';
75
- })
76
- .addCase(exchangePointsShopRewardV2.rejected, (state, action) => {
77
- state.error = action.payload;
78
- state.loading = 'idle';
79
- });
80
- }
81
- });
82
- export const { resetPointsShop: resetPointsShopV2 } = pointsShopV2Slice.actions;
83
- export const selectPointsShopV2 = (state) => state.customer.pointsShop;
84
- export const pointsShopV2Reducer = pointsShopV2Slice.reducer;