@open-tender/cloud 0.4.36 → 0.4.37
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/cjs/services/api.d.ts +1 -0
- package/dist/cjs/services/api.js +3 -0
- package/dist/cjs/slices/unsubscribe.d.ts +12 -0
- package/dist/cjs/slices/unsubscribe.js +25 -1
- package/dist/esm/services/api.d.ts +1 -0
- package/dist/esm/services/api.js +3 -0
- package/dist/esm/slices/unsubscribe.d.ts +12 -0
- package/dist/esm/slices/unsubscribe.js +24 -0
- package/package.json +3 -3
|
@@ -104,6 +104,7 @@ declare class OpenTenderAPI {
|
|
|
104
104
|
getSubscriber(email: string): Promise<unknown>;
|
|
105
105
|
postSubscriber(email: string): Promise<unknown>;
|
|
106
106
|
postUnsubscribe(customer_id: string, campaign_id: string): Promise<unknown>;
|
|
107
|
+
postUnsubscribeByKey(key: string): Promise<unknown>;
|
|
107
108
|
postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
|
|
108
109
|
postCustomerSignIn(data: CustomerSignIn): Promise<void | Auth | null | undefined>;
|
|
109
110
|
postThanxLogin(email: string, origin?: string): Promise<unknown>;
|
package/dist/cjs/services/api.js
CHANGED
|
@@ -512,6 +512,9 @@ class OpenTenderAPI {
|
|
|
512
512
|
postUnsubscribe(customer_id, campaign_id) {
|
|
513
513
|
return this.request(`/unsubscribe/campaign/${customer_id}/${campaign_id}`, 'POST');
|
|
514
514
|
}
|
|
515
|
+
postUnsubscribeByKey(key) {
|
|
516
|
+
return this.request(`/unsubscribe/campaign/${key}`, 'POST');
|
|
517
|
+
}
|
|
515
518
|
postSignUp(data) {
|
|
516
519
|
return this.request(`/customer`, 'POST', data);
|
|
517
520
|
}
|
|
@@ -21,6 +21,18 @@ export declare const unsubscribe: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
|
21
21
|
fulfilledMeta?: unknown;
|
|
22
22
|
rejectedMeta?: unknown;
|
|
23
23
|
}>;
|
|
24
|
+
export declare const unsubscribeByKey: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
25
|
+
key: string;
|
|
26
|
+
}, {
|
|
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
|
+
}>;
|
|
24
36
|
export declare const resetUnsubscribe: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"Unsubscribe/resetUnsubscribe">;
|
|
25
37
|
export declare const selectUnsubscribe: (state: AppState) => UnsubscribeState;
|
|
26
38
|
export declare const unsubscribeReducer: import("redux").Reducer<UnsubscribeState, import("redux").AnyAction>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unsubscribeReducer = exports.selectUnsubscribe = exports.resetUnsubscribe = exports.unsubscribe = exports.UnsubscribeActionType = void 0;
|
|
3
|
+
exports.unsubscribeReducer = exports.selectUnsubscribe = exports.resetUnsubscribe = exports.unsubscribeByKey = exports.unsubscribe = exports.UnsubscribeActionType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const types_1 = require("./types");
|
|
@@ -25,6 +25,18 @@ exports.unsubscribe = (0, toolkit_1.createAsyncThunk)(UnsubscribeActionType.Unsu
|
|
|
25
25
|
return rejectWithValue(err);
|
|
26
26
|
}
|
|
27
27
|
}));
|
|
28
|
+
exports.unsubscribeByKey = (0, toolkit_1.createAsyncThunk)(UnsubscribeActionType.Unsubscribe, ({ key }, { getState, rejectWithValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
const { api } = getState().config;
|
|
30
|
+
if (!api)
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
yield api.postUnsubscribeByKey(key);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
return rejectWithValue(err);
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
28
40
|
const unsubscribeSlice = (0, toolkit_1.createSlice)({
|
|
29
41
|
name: types_1.ReducerType.Unsubscribe,
|
|
30
42
|
initialState,
|
|
@@ -44,6 +56,18 @@ const unsubscribeSlice = (0, toolkit_1.createSlice)({
|
|
|
44
56
|
.addCase(exports.unsubscribe.rejected, (state, action) => {
|
|
45
57
|
state.loading = 'idle';
|
|
46
58
|
state.error = action.payload;
|
|
59
|
+
})
|
|
60
|
+
.addCase(exports.unsubscribeByKey.fulfilled, state => {
|
|
61
|
+
state.success = true;
|
|
62
|
+
state.loading = 'idle';
|
|
63
|
+
state.error = null;
|
|
64
|
+
})
|
|
65
|
+
.addCase(exports.unsubscribeByKey.pending, state => {
|
|
66
|
+
state.loading = 'pending';
|
|
67
|
+
})
|
|
68
|
+
.addCase(exports.unsubscribeByKey.rejected, (state, action) => {
|
|
69
|
+
state.loading = 'idle';
|
|
70
|
+
state.error = action.payload;
|
|
47
71
|
});
|
|
48
72
|
}
|
|
49
73
|
});
|
|
@@ -104,6 +104,7 @@ declare class OpenTenderAPI {
|
|
|
104
104
|
getSubscriber(email: string): Promise<unknown>;
|
|
105
105
|
postSubscriber(email: string): Promise<unknown>;
|
|
106
106
|
postUnsubscribe(customer_id: string, campaign_id: string): Promise<unknown>;
|
|
107
|
+
postUnsubscribeByKey(key: string): Promise<unknown>;
|
|
107
108
|
postSignUp(data: CustomerCreate): Promise<Customer | null | undefined>;
|
|
108
109
|
postCustomerSignIn(data: CustomerSignIn): Promise<void | Auth | null | undefined>;
|
|
109
110
|
postThanxLogin(email: string, origin?: string): Promise<unknown>;
|
package/dist/esm/services/api.js
CHANGED
|
@@ -510,6 +510,9 @@ class OpenTenderAPI {
|
|
|
510
510
|
postUnsubscribe(customer_id, campaign_id) {
|
|
511
511
|
return this.request(`/unsubscribe/campaign/${customer_id}/${campaign_id}`, 'POST');
|
|
512
512
|
}
|
|
513
|
+
postUnsubscribeByKey(key) {
|
|
514
|
+
return this.request(`/unsubscribe/campaign/${key}`, 'POST');
|
|
515
|
+
}
|
|
513
516
|
postSignUp(data) {
|
|
514
517
|
return this.request(`/customer`, 'POST', data);
|
|
515
518
|
}
|
|
@@ -21,6 +21,18 @@ export declare const unsubscribe: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
|
21
21
|
fulfilledMeta?: unknown;
|
|
22
22
|
rejectedMeta?: unknown;
|
|
23
23
|
}>;
|
|
24
|
+
export declare const unsubscribeByKey: import("@reduxjs/toolkit").AsyncThunk<void, {
|
|
25
|
+
key: string;
|
|
26
|
+
}, {
|
|
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
|
+
}>;
|
|
24
36
|
export declare const resetUnsubscribe: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"Unsubscribe/resetUnsubscribe">;
|
|
25
37
|
export declare const selectUnsubscribe: (state: AppState) => UnsubscribeState;
|
|
26
38
|
export declare const unsubscribeReducer: import("redux").Reducer<UnsubscribeState, import("redux").AnyAction>;
|
|
@@ -22,6 +22,18 @@ export const unsubscribe = createAsyncThunk(UnsubscribeActionType.Unsubscribe, (
|
|
|
22
22
|
return rejectWithValue(err);
|
|
23
23
|
}
|
|
24
24
|
}));
|
|
25
|
+
export const unsubscribeByKey = createAsyncThunk(UnsubscribeActionType.Unsubscribe, ({ key }, { getState, rejectWithValue }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
const { api } = getState().config;
|
|
27
|
+
if (!api)
|
|
28
|
+
return;
|
|
29
|
+
try {
|
|
30
|
+
yield api.postUnsubscribeByKey(key);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
return rejectWithValue(err);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
25
37
|
const unsubscribeSlice = createSlice({
|
|
26
38
|
name: ReducerType.Unsubscribe,
|
|
27
39
|
initialState,
|
|
@@ -41,6 +53,18 @@ const unsubscribeSlice = createSlice({
|
|
|
41
53
|
.addCase(unsubscribe.rejected, (state, action) => {
|
|
42
54
|
state.loading = 'idle';
|
|
43
55
|
state.error = action.payload;
|
|
56
|
+
})
|
|
57
|
+
.addCase(unsubscribeByKey.fulfilled, state => {
|
|
58
|
+
state.success = true;
|
|
59
|
+
state.loading = 'idle';
|
|
60
|
+
state.error = null;
|
|
61
|
+
})
|
|
62
|
+
.addCase(unsubscribeByKey.pending, state => {
|
|
63
|
+
state.loading = 'pending';
|
|
64
|
+
})
|
|
65
|
+
.addCase(unsubscribeByKey.rejected, (state, action) => {
|
|
66
|
+
state.loading = 'idle';
|
|
67
|
+
state.error = action.payload;
|
|
44
68
|
});
|
|
45
69
|
}
|
|
46
70
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.37",
|
|
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",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"private": false,
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.19.1",
|
|
37
|
-
"@open-tender/types": "^0.4.
|
|
38
|
-
"@open-tender/utils": "^0.4.
|
|
37
|
+
"@open-tender/types": "^0.4.96",
|
|
38
|
+
"@open-tender/utils": "^0.4.69",
|
|
39
39
|
"@reduxjs/toolkit": "^1.8.5",
|
|
40
40
|
"@types/react": "^18.0.18",
|
|
41
41
|
"@types/react-dom": "^18.0.6",
|