@wasto/sdk 1.0.5 → 1.0.6
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/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
- package/src/client.ts +8 -3
- package/src/types/notifications.types.ts +17 -0
package/dist/index.d.mts
CHANGED
|
@@ -980,6 +980,7 @@ interface UpdateBlogPostRequest {
|
|
|
980
980
|
interface CreateNotificationRequest {
|
|
981
981
|
title: string;
|
|
982
982
|
body: string;
|
|
983
|
+
/** @deprecated Prefer redirectHref; kept for legacy push extras */
|
|
983
984
|
data?: Record<string, unknown>;
|
|
984
985
|
recipientGroupId: string;
|
|
985
986
|
scheduledAt?: string;
|
|
@@ -989,16 +990,30 @@ interface CreateNotificationRequest {
|
|
|
989
990
|
showAsModal?: boolean;
|
|
990
991
|
/** Média CMS affiché dans la modale */
|
|
991
992
|
imageMediaId?: string | null;
|
|
993
|
+
/**
|
|
994
|
+
* true = toutes les apps du groupement.
|
|
995
|
+
* false = uniquement cmsAppId.
|
|
996
|
+
* Requis à la création (pas de défaut silencieux).
|
|
997
|
+
*/
|
|
998
|
+
targetAllApps: boolean;
|
|
999
|
+
/** Requis si targetAllApps === false */
|
|
1000
|
+
cmsAppId?: string | null;
|
|
1001
|
+
/** Href Expo Router optionnel (ex. /(tabs)/calendrier) — uniquement si une app est ciblée */
|
|
1002
|
+
redirectHref?: string | null;
|
|
992
1003
|
}
|
|
993
1004
|
interface UpdateNotificationRequest {
|
|
994
1005
|
title?: string;
|
|
995
1006
|
body?: string;
|
|
1007
|
+
/** @deprecated Prefer redirectHref */
|
|
996
1008
|
data?: Record<string, unknown>;
|
|
997
1009
|
recipientGroupId?: string;
|
|
998
1010
|
scheduledAt?: string;
|
|
999
1011
|
sendPush?: boolean;
|
|
1000
1012
|
showAsModal?: boolean;
|
|
1001
1013
|
imageMediaId?: string | null;
|
|
1014
|
+
targetAllApps?: boolean;
|
|
1015
|
+
cmsAppId?: string | null;
|
|
1016
|
+
redirectHref?: string | null;
|
|
1002
1017
|
}
|
|
1003
1018
|
interface CreateRecipientGroupRequest {
|
|
1004
1019
|
name: string;
|
|
@@ -1038,6 +1053,8 @@ interface PublicAnnouncement {
|
|
|
1038
1053
|
body: string;
|
|
1039
1054
|
imageUrl?: string | null;
|
|
1040
1055
|
sentAt?: string | null;
|
|
1056
|
+
/** Href Expo Router optionnel pour le CTA / deep link */
|
|
1057
|
+
redirectHref?: string | null;
|
|
1041
1058
|
}
|
|
1042
1059
|
|
|
1043
1060
|
interface CreateProviderRequest {
|
|
@@ -2544,12 +2561,13 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2544
2561
|
getById: (id: string) => Promise<unknown>;
|
|
2545
2562
|
};
|
|
2546
2563
|
announcements: {
|
|
2547
|
-
listForCity: (cityId: string) => Promise<{
|
|
2564
|
+
listForCity: (cityId: string, appId: string) => Promise<{
|
|
2548
2565
|
id: string;
|
|
2549
2566
|
title: string;
|
|
2550
2567
|
body: string;
|
|
2551
2568
|
imageUrl?: string | null;
|
|
2552
2569
|
sentAt?: string | null;
|
|
2570
|
+
redirectHref?: string | null;
|
|
2553
2571
|
}[]>;
|
|
2554
2572
|
};
|
|
2555
2573
|
cityGroups: {
|
|
@@ -2598,6 +2616,7 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2598
2616
|
devices: {
|
|
2599
2617
|
registerPushToken: (deviceId: string, body: {
|
|
2600
2618
|
token: string;
|
|
2619
|
+
cmsAppId?: string | null;
|
|
2601
2620
|
cityId?: string | null;
|
|
2602
2621
|
wasteCollectionPlaceId?: string | null;
|
|
2603
2622
|
}) => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -980,6 +980,7 @@ interface UpdateBlogPostRequest {
|
|
|
980
980
|
interface CreateNotificationRequest {
|
|
981
981
|
title: string;
|
|
982
982
|
body: string;
|
|
983
|
+
/** @deprecated Prefer redirectHref; kept for legacy push extras */
|
|
983
984
|
data?: Record<string, unknown>;
|
|
984
985
|
recipientGroupId: string;
|
|
985
986
|
scheduledAt?: string;
|
|
@@ -989,16 +990,30 @@ interface CreateNotificationRequest {
|
|
|
989
990
|
showAsModal?: boolean;
|
|
990
991
|
/** Média CMS affiché dans la modale */
|
|
991
992
|
imageMediaId?: string | null;
|
|
993
|
+
/**
|
|
994
|
+
* true = toutes les apps du groupement.
|
|
995
|
+
* false = uniquement cmsAppId.
|
|
996
|
+
* Requis à la création (pas de défaut silencieux).
|
|
997
|
+
*/
|
|
998
|
+
targetAllApps: boolean;
|
|
999
|
+
/** Requis si targetAllApps === false */
|
|
1000
|
+
cmsAppId?: string | null;
|
|
1001
|
+
/** Href Expo Router optionnel (ex. /(tabs)/calendrier) — uniquement si une app est ciblée */
|
|
1002
|
+
redirectHref?: string | null;
|
|
992
1003
|
}
|
|
993
1004
|
interface UpdateNotificationRequest {
|
|
994
1005
|
title?: string;
|
|
995
1006
|
body?: string;
|
|
1007
|
+
/** @deprecated Prefer redirectHref */
|
|
996
1008
|
data?: Record<string, unknown>;
|
|
997
1009
|
recipientGroupId?: string;
|
|
998
1010
|
scheduledAt?: string;
|
|
999
1011
|
sendPush?: boolean;
|
|
1000
1012
|
showAsModal?: boolean;
|
|
1001
1013
|
imageMediaId?: string | null;
|
|
1014
|
+
targetAllApps?: boolean;
|
|
1015
|
+
cmsAppId?: string | null;
|
|
1016
|
+
redirectHref?: string | null;
|
|
1002
1017
|
}
|
|
1003
1018
|
interface CreateRecipientGroupRequest {
|
|
1004
1019
|
name: string;
|
|
@@ -1038,6 +1053,8 @@ interface PublicAnnouncement {
|
|
|
1038
1053
|
body: string;
|
|
1039
1054
|
imageUrl?: string | null;
|
|
1040
1055
|
sentAt?: string | null;
|
|
1056
|
+
/** Href Expo Router optionnel pour le CTA / deep link */
|
|
1057
|
+
redirectHref?: string | null;
|
|
1041
1058
|
}
|
|
1042
1059
|
|
|
1043
1060
|
interface CreateProviderRequest {
|
|
@@ -2544,12 +2561,13 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2544
2561
|
getById: (id: string) => Promise<unknown>;
|
|
2545
2562
|
};
|
|
2546
2563
|
announcements: {
|
|
2547
|
-
listForCity: (cityId: string) => Promise<{
|
|
2564
|
+
listForCity: (cityId: string, appId: string) => Promise<{
|
|
2548
2565
|
id: string;
|
|
2549
2566
|
title: string;
|
|
2550
2567
|
body: string;
|
|
2551
2568
|
imageUrl?: string | null;
|
|
2552
2569
|
sentAt?: string | null;
|
|
2570
|
+
redirectHref?: string | null;
|
|
2553
2571
|
}[]>;
|
|
2554
2572
|
};
|
|
2555
2573
|
cityGroups: {
|
|
@@ -2598,6 +2616,7 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2598
2616
|
devices: {
|
|
2599
2617
|
registerPushToken: (deviceId: string, body: {
|
|
2600
2618
|
token: string;
|
|
2619
|
+
cmsAppId?: string | null;
|
|
2601
2620
|
cityId?: string | null;
|
|
2602
2621
|
wasteCollectionPlaceId?: string | null;
|
|
2603
2622
|
}) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1952,7 +1952,8 @@ async function handleResponse(res) {
|
|
|
1952
1952
|
if (text) {
|
|
1953
1953
|
try {
|
|
1954
1954
|
const json = JSON.parse(text);
|
|
1955
|
-
|
|
1955
|
+
const raw = json.message ?? json.error ?? text;
|
|
1956
|
+
message = Array.isArray(raw) ? raw.map(String).join("\n") : String(raw);
|
|
1956
1957
|
} catch {
|
|
1957
1958
|
message = text;
|
|
1958
1959
|
}
|
|
@@ -2418,7 +2419,9 @@ function createWastoClient(config) {
|
|
|
2418
2419
|
getById: (id) => requestPublic(`/public/blog-posts/${id}`)
|
|
2419
2420
|
},
|
|
2420
2421
|
announcements: {
|
|
2421
|
-
listForCity: (cityId) => requestPublic(
|
|
2422
|
+
listForCity: (cityId, appId) => requestPublic(
|
|
2423
|
+
`/public/announcements?cityId=${encodeURIComponent(cityId)}&appId=${encodeURIComponent(appId)}`
|
|
2424
|
+
)
|
|
2422
2425
|
},
|
|
2423
2426
|
cityGroups: {
|
|
2424
2427
|
searchStreetSectors: (cityGroupId, params) => {
|
package/dist/index.mjs
CHANGED
|
@@ -1792,7 +1792,8 @@ async function handleResponse(res) {
|
|
|
1792
1792
|
if (text) {
|
|
1793
1793
|
try {
|
|
1794
1794
|
const json = JSON.parse(text);
|
|
1795
|
-
|
|
1795
|
+
const raw = json.message ?? json.error ?? text;
|
|
1796
|
+
message = Array.isArray(raw) ? raw.map(String).join("\n") : String(raw);
|
|
1796
1797
|
} catch {
|
|
1797
1798
|
message = text;
|
|
1798
1799
|
}
|
|
@@ -2258,7 +2259,9 @@ function createWastoClient(config) {
|
|
|
2258
2259
|
getById: (id) => requestPublic(`/public/blog-posts/${id}`)
|
|
2259
2260
|
},
|
|
2260
2261
|
announcements: {
|
|
2261
|
-
listForCity: (cityId) => requestPublic(
|
|
2262
|
+
listForCity: (cityId, appId) => requestPublic(
|
|
2263
|
+
`/public/announcements?cityId=${encodeURIComponent(cityId)}&appId=${encodeURIComponent(appId)}`
|
|
2264
|
+
)
|
|
2262
2265
|
},
|
|
2263
2266
|
cityGroups: {
|
|
2264
2267
|
searchStreetSectors: (cityGroupId, params) => {
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -66,7 +66,8 @@ async function handleResponse<T>(res: Response): Promise<T> {
|
|
|
66
66
|
if (text) {
|
|
67
67
|
try {
|
|
68
68
|
const json = JSON.parse(text);
|
|
69
|
-
|
|
69
|
+
const raw = json.message ?? json.error ?? text;
|
|
70
|
+
message = Array.isArray(raw) ? raw.map(String).join("\n") : String(raw);
|
|
70
71
|
} catch {
|
|
71
72
|
message = text;
|
|
72
73
|
}
|
|
@@ -657,7 +658,7 @@ export function createWastoClient(config: WastoClientConfig) {
|
|
|
657
658
|
getById: (id: string) => requestPublic<unknown>(`/public/blog-posts/${id}`),
|
|
658
659
|
},
|
|
659
660
|
announcements: {
|
|
660
|
-
listForCity: (cityId: string) =>
|
|
661
|
+
listForCity: (cityId: string, appId: string) =>
|
|
661
662
|
requestPublic<
|
|
662
663
|
Array<{
|
|
663
664
|
id: string;
|
|
@@ -665,8 +666,11 @@ export function createWastoClient(config: WastoClientConfig) {
|
|
|
665
666
|
body: string;
|
|
666
667
|
imageUrl?: string | null;
|
|
667
668
|
sentAt?: string | null;
|
|
669
|
+
redirectHref?: string | null;
|
|
668
670
|
}>
|
|
669
|
-
>(
|
|
671
|
+
>(
|
|
672
|
+
`/public/announcements?cityId=${encodeURIComponent(cityId)}&appId=${encodeURIComponent(appId)}`,
|
|
673
|
+
),
|
|
670
674
|
},
|
|
671
675
|
cityGroups: {
|
|
672
676
|
searchStreetSectors: (cityGroupId: string, params: { q: string }) => {
|
|
@@ -752,6 +756,7 @@ export function createWastoClient(config: WastoClientConfig) {
|
|
|
752
756
|
deviceId: string,
|
|
753
757
|
body: {
|
|
754
758
|
token: string;
|
|
759
|
+
cmsAppId?: string | null;
|
|
755
760
|
cityId?: string | null;
|
|
756
761
|
wasteCollectionPlaceId?: string | null;
|
|
757
762
|
},
|
|
@@ -3,6 +3,7 @@ import type { RecipientGroupType } from '../enums';
|
|
|
3
3
|
export interface CreateNotificationRequest {
|
|
4
4
|
title: string;
|
|
5
5
|
body: string;
|
|
6
|
+
/** @deprecated Prefer redirectHref; kept for legacy push extras */
|
|
6
7
|
data?: Record<string, unknown>;
|
|
7
8
|
recipientGroupId: string;
|
|
8
9
|
scheduledAt?: string;
|
|
@@ -12,17 +13,31 @@ export interface CreateNotificationRequest {
|
|
|
12
13
|
showAsModal?: boolean;
|
|
13
14
|
/** Média CMS affiché dans la modale */
|
|
14
15
|
imageMediaId?: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* true = toutes les apps du groupement.
|
|
18
|
+
* false = uniquement cmsAppId.
|
|
19
|
+
* Requis à la création (pas de défaut silencieux).
|
|
20
|
+
*/
|
|
21
|
+
targetAllApps: boolean;
|
|
22
|
+
/** Requis si targetAllApps === false */
|
|
23
|
+
cmsAppId?: string | null;
|
|
24
|
+
/** Href Expo Router optionnel (ex. /(tabs)/calendrier) — uniquement si une app est ciblée */
|
|
25
|
+
redirectHref?: string | null;
|
|
15
26
|
}
|
|
16
27
|
|
|
17
28
|
export interface UpdateNotificationRequest {
|
|
18
29
|
title?: string;
|
|
19
30
|
body?: string;
|
|
31
|
+
/** @deprecated Prefer redirectHref */
|
|
20
32
|
data?: Record<string, unknown>;
|
|
21
33
|
recipientGroupId?: string;
|
|
22
34
|
scheduledAt?: string;
|
|
23
35
|
sendPush?: boolean;
|
|
24
36
|
showAsModal?: boolean;
|
|
25
37
|
imageMediaId?: string | null;
|
|
38
|
+
targetAllApps?: boolean;
|
|
39
|
+
cmsAppId?: string | null;
|
|
40
|
+
redirectHref?: string | null;
|
|
26
41
|
}
|
|
27
42
|
|
|
28
43
|
export interface CreateRecipientGroupRequest {
|
|
@@ -65,4 +80,6 @@ export interface PublicAnnouncement {
|
|
|
65
80
|
body: string;
|
|
66
81
|
imageUrl?: string | null;
|
|
67
82
|
sentAt?: string | null;
|
|
83
|
+
/** Href Expo Router optionnel pour le CTA / deep link */
|
|
84
|
+
redirectHref?: string | null;
|
|
68
85
|
}
|