@timum/timum_pdk 1.0.5 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timum/timum_pdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "license": "MIT",
5
5
  "description": "Contains timum public and general api endpoints",
6
6
  "homepage": "https://www.timum.de",
package/src/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
1
+ import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
2
2
 
3
- import { reactLocalStorage } from 'reactjs-localstorage';
3
+ import { reactLocalStorage } from "reactjs-localstorage";
4
4
 
5
5
  export const getTimumApiHost = () => {
6
- return reactLocalStorage.get('timumApiHost', 'https://www.timum.de');
6
+ return reactLocalStorage.get("timumApiHost", "https://www.timum.de");
7
7
  };
8
8
 
9
9
  // we do it this way so that the base url can be determined dynamically
10
10
  export const getBaseUrl = () => {
11
- return getTimumApiHost() + '/rest/1';
11
+ return getTimumApiHost() + "/rest/1";
12
12
  };
13
13
 
14
14
  export const constructUrl = (url, plain) => {
15
- if (!url.includes('?')) {
15
+ if (!url.includes("?")) {
16
16
  url = `${url}?X-DISABLE-COOKIES=true`;
17
17
  } else {
18
18
  url = `${url}&X-DISABLE-COOKIES=true`;
@@ -26,12 +26,12 @@ export const constructUrl = (url, plain) => {
26
26
  };
27
27
 
28
28
  export const timumApiSlice = createApi({
29
- reducerPath: 'timumApi',
29
+ reducerPath: "timumApi",
30
30
  baseQuery: fetchBaseQuery({
31
31
  baseUrl: undefined,
32
- credentials: 'include',
32
+ credentials: "include",
33
33
  }),
34
- tagTypes: ['Timeslot', 'Product', 'Account', 'Provider', 'User'],
34
+ tagTypes: ["Timeslot", "Product", "Account", "Provider", "User"],
35
35
  endpoints: (builder) => ({
36
36
  // ##########################################
37
37
  // # ConsumerAPI v2
@@ -41,18 +41,14 @@ export const timumApiSlice = createApi({
41
41
  query: (props) => ({
42
42
  url: constructUrl(`/resources/${props.resourceId}/upcoming_bookables`),
43
43
  }),
44
- providesTags: (/* result = [], error, arg */) => [
45
- 'Timeslot'
46
- ],
44
+ providesTags: (/* result = [], error, arg */) => ["Timeslot"],
47
45
  }),
48
46
 
49
47
  activeProducts: builder.query({
50
48
  query: (props) => ({
51
49
  url: constructUrl(`/resources/${props.resourceId}/active_products`),
52
50
  }),
53
- providesTags: (/* result = [], error, arg */) => [
54
- 'Product'
55
- ],
51
+ providesTags: (/* result = [], error, arg */) => ["Product"],
56
52
  }),
57
53
 
58
54
  createAppointmentWithConsumer: builder.mutation({
@@ -60,10 +56,24 @@ export const timumApiSlice = createApi({
60
56
  url: constructUrl(
61
57
  `/resources/${props.resourceId}/create_appointment_with_consumer`
62
58
  ),
63
- method: 'post',
59
+ method: "post",
64
60
  body: props.body,
65
61
  }),
66
- invalidatesTags: (/* result, error, arg */) => [{ type: 'Timeslot' }],
62
+ invalidatesTags: (/* result, error, arg */) => [{ type: "Timeslot" }],
63
+ }),
64
+
65
+ publicContactData: builder.query({
66
+ query: (props) => ({
67
+ url: constructUrl(`/resources/${props.resourceId}/public_contact_data`),
68
+ }),
69
+ }),
70
+
71
+ identifyCustomer: builder.query({
72
+ query: (props) => ({
73
+ url: constructUrl(
74
+ `/resources/${props.resourceId}/customers/${props.personId}/identify`
75
+ ),
76
+ }),
67
77
  }),
68
78
 
69
79
  // ##########################################
@@ -76,20 +86,18 @@ export const timumApiSlice = createApi({
76
86
  `/crms/${props.platform}/account/${props.accountReference}`
77
87
  ),
78
88
  }),
79
- providesTags: (/* result = [], error, arg */) => [
80
- 'Account'
81
- ],
89
+ providesTags: (/* result = [], error, arg */) => ["Account"],
82
90
  }),
83
91
 
84
92
  createAccount: builder.mutation({
85
93
  query: (props) => {
86
94
  return {
87
95
  url: constructUrl(`/crms/${props.platform}/account`),
88
- method: 'post',
96
+ method: "post",
89
97
  body: JSON.stringify(props.accountData),
90
98
  };
91
99
  },
92
- invalidatesTags: (/* result, error, arg */) => [{ type: 'Account' }],
100
+ invalidatesTags: (/* result, error, arg */) => [{ type: "Account" }],
93
101
  }),
94
102
 
95
103
  getProviders: builder.query({
@@ -98,9 +106,7 @@ export const timumApiSlice = createApi({
98
106
  `/crms/${props.platform}/account/${props.accountReference}/providers`
99
107
  ),
100
108
  }),
101
- providesTags: (/* result = [], error, arg */) => [
102
- 'Product'
103
- ],
109
+ providesTags: (/* result = [], error, arg */) => ["Product"],
104
110
  }),
105
111
 
106
112
  getProvider: builder.query({
@@ -114,7 +120,7 @@ export const timumApiSlice = createApi({
114
120
  createProvider: builder.mutation({
115
121
  query: (props) => ({
116
122
  url: constructUrl(`/crms/${props.platform}/provider`),
117
- method: 'post',
123
+ method: "post",
118
124
  body: JSON.stringify(
119
125
  (() => ({
120
126
  user: props.userData ?? {},
@@ -125,7 +131,7 @@ export const timumApiSlice = createApi({
125
131
  }))()
126
132
  ),
127
133
  }),
128
- invalidatesTags: (/* result, error, arg */) => [{ type: 'Provider' }],
134
+ invalidatesTags: (/* result, error, arg */) => [{ type: "Provider" }],
129
135
  }),
130
136
 
131
137
  // loginUserViaApi: builder.query({
@@ -150,10 +156,10 @@ export const timumApiSlice = createApi({
150
156
  createUser: builder.mutation({
151
157
  query: (props) => ({
152
158
  url: constructUrl(`/crms/${props.platform}/user`),
153
- method: 'post',
159
+ method: "post",
154
160
  body: JSON.stringify(props.userData),
155
161
  }),
156
- invalidatesTags: (/* result, error, arg */) => [{ type: 'User' }],
162
+ invalidatesTags: (/* result, error, arg */) => [{ type: "User" }],
157
163
  }),
158
164
  }),
159
165
  });
@@ -166,6 +172,10 @@ export const {
166
172
  useUpcomingBookablesQuery,
167
173
  useActiveProductsQuery,
168
174
  useCreateAppointmentWithConsumerMutation,
175
+ useIdentifyCustomerQuery,
176
+ useLazyIdentifyCustomerQuery,
177
+ usePublicContactDataQuery,
178
+ useLazyPublicContactDataQuery,
169
179
 
170
180
  // ##########################################
171
181
  // # CRM API requests (general api)