@wasto/sdk 1.0.4 → 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 +63 -3
- package/dist/index.d.ts +63 -3
- package/dist/index.js +77 -2
- package/dist/index.mjs +77 -2
- package/package.json +1 -1
- package/src/client.ts +99 -4
- package/src/dashboard-apps.ts +17 -0
- package/src/types/notifications.types.ts +17 -0
- package/src/types/waste-collection-places.types.ts +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -273,7 +273,9 @@ declare enum DashboardAppSlug {
|
|
|
273
273
|
MAPSO = "MAPSO",
|
|
274
274
|
IAGO = "IAGO",
|
|
275
275
|
PEDAGO = "PEDAGO",
|
|
276
|
-
MARKETO = "MARKETO"
|
|
276
|
+
MARKETO = "MARKETO",
|
|
277
|
+
/** Connect'O — API agents / MCP (hors free self-serve) */
|
|
278
|
+
CONNECTO = "CONNECTO"
|
|
277
279
|
}
|
|
278
280
|
type DashboardAppDefinition = {
|
|
279
281
|
slug: DashboardAppSlug;
|
|
@@ -572,7 +574,8 @@ interface CreateWasteCollectionDayRequest {
|
|
|
572
574
|
wasteTypeId: string;
|
|
573
575
|
name: string;
|
|
574
576
|
description?: string;
|
|
575
|
-
|
|
577
|
+
/** Fréquence en semaines (1 = hebdo, 2 = toutes les 2 semaines, …). */
|
|
578
|
+
everyWeeks?: number;
|
|
576
579
|
startDate?: string;
|
|
577
580
|
}
|
|
578
581
|
interface CreateWasteCollectionExceptionRequest {
|
|
@@ -977,6 +980,7 @@ interface UpdateBlogPostRequest {
|
|
|
977
980
|
interface CreateNotificationRequest {
|
|
978
981
|
title: string;
|
|
979
982
|
body: string;
|
|
983
|
+
/** @deprecated Prefer redirectHref; kept for legacy push extras */
|
|
980
984
|
data?: Record<string, unknown>;
|
|
981
985
|
recipientGroupId: string;
|
|
982
986
|
scheduledAt?: string;
|
|
@@ -986,16 +990,30 @@ interface CreateNotificationRequest {
|
|
|
986
990
|
showAsModal?: boolean;
|
|
987
991
|
/** Média CMS affiché dans la modale */
|
|
988
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;
|
|
989
1003
|
}
|
|
990
1004
|
interface UpdateNotificationRequest {
|
|
991
1005
|
title?: string;
|
|
992
1006
|
body?: string;
|
|
1007
|
+
/** @deprecated Prefer redirectHref */
|
|
993
1008
|
data?: Record<string, unknown>;
|
|
994
1009
|
recipientGroupId?: string;
|
|
995
1010
|
scheduledAt?: string;
|
|
996
1011
|
sendPush?: boolean;
|
|
997
1012
|
showAsModal?: boolean;
|
|
998
1013
|
imageMediaId?: string | null;
|
|
1014
|
+
targetAllApps?: boolean;
|
|
1015
|
+
cmsAppId?: string | null;
|
|
1016
|
+
redirectHref?: string | null;
|
|
999
1017
|
}
|
|
1000
1018
|
interface CreateRecipientGroupRequest {
|
|
1001
1019
|
name: string;
|
|
@@ -1035,6 +1053,8 @@ interface PublicAnnouncement {
|
|
|
1035
1053
|
body: string;
|
|
1036
1054
|
imageUrl?: string | null;
|
|
1037
1055
|
sentAt?: string | null;
|
|
1056
|
+
/** Href Expo Router optionnel pour le CTA / deep link */
|
|
1057
|
+
redirectHref?: string | null;
|
|
1038
1058
|
}
|
|
1039
1059
|
|
|
1040
1060
|
interface CreateProviderRequest {
|
|
@@ -2443,6 +2463,42 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2443
2463
|
unlinkCity: (wasteTypeId: string, cityId: string) => Promise<void>;
|
|
2444
2464
|
};
|
|
2445
2465
|
};
|
|
2466
|
+
surveys: {
|
|
2467
|
+
findAll: (params?: {
|
|
2468
|
+
page?: number;
|
|
2469
|
+
pageSize?: number;
|
|
2470
|
+
cityId?: string;
|
|
2471
|
+
cityGroupId?: string;
|
|
2472
|
+
status?: string;
|
|
2473
|
+
light?: boolean;
|
|
2474
|
+
}) => Promise<PaginatedResponse<unknown>>;
|
|
2475
|
+
getById: (id: string) => Promise<unknown>;
|
|
2476
|
+
getStats: (id: string) => Promise<unknown>;
|
|
2477
|
+
getTerrainOverview: (params?: {
|
|
2478
|
+
cityId?: string;
|
|
2479
|
+
cityGroupId?: string;
|
|
2480
|
+
}) => Promise<unknown>;
|
|
2481
|
+
};
|
|
2482
|
+
fieldReports: {
|
|
2483
|
+
findAllForms: (params?: {
|
|
2484
|
+
page?: number;
|
|
2485
|
+
pageSize?: number;
|
|
2486
|
+
cityId?: string;
|
|
2487
|
+
cityGroupId?: string;
|
|
2488
|
+
status?: string;
|
|
2489
|
+
light?: boolean;
|
|
2490
|
+
}) => Promise<PaginatedResponse<unknown>>;
|
|
2491
|
+
getForm: (id: string) => Promise<unknown>;
|
|
2492
|
+
findAllReports: (params?: {
|
|
2493
|
+
page?: number;
|
|
2494
|
+
pageSize?: number;
|
|
2495
|
+
cityId?: string;
|
|
2496
|
+
cityGroupId?: string;
|
|
2497
|
+
status?: string;
|
|
2498
|
+
formId?: string;
|
|
2499
|
+
}) => Promise<PaginatedResponse<unknown>>;
|
|
2500
|
+
getReport: (id: string) => Promise<unknown>;
|
|
2501
|
+
};
|
|
2446
2502
|
public: {
|
|
2447
2503
|
cities: {
|
|
2448
2504
|
findAll: (params?: {
|
|
@@ -2505,12 +2561,13 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2505
2561
|
getById: (id: string) => Promise<unknown>;
|
|
2506
2562
|
};
|
|
2507
2563
|
announcements: {
|
|
2508
|
-
listForCity: (cityId: string) => Promise<{
|
|
2564
|
+
listForCity: (cityId: string, appId: string) => Promise<{
|
|
2509
2565
|
id: string;
|
|
2510
2566
|
title: string;
|
|
2511
2567
|
body: string;
|
|
2512
2568
|
imageUrl?: string | null;
|
|
2513
2569
|
sentAt?: string | null;
|
|
2570
|
+
redirectHref?: string | null;
|
|
2514
2571
|
}[]>;
|
|
2515
2572
|
};
|
|
2516
2573
|
cityGroups: {
|
|
@@ -2559,6 +2616,9 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2559
2616
|
devices: {
|
|
2560
2617
|
registerPushToken: (deviceId: string, body: {
|
|
2561
2618
|
token: string;
|
|
2619
|
+
cmsAppId?: string | null;
|
|
2620
|
+
cityId?: string | null;
|
|
2621
|
+
wasteCollectionPlaceId?: string | null;
|
|
2562
2622
|
}) => Promise<void>;
|
|
2563
2623
|
};
|
|
2564
2624
|
analytics: {
|
package/dist/index.d.ts
CHANGED
|
@@ -273,7 +273,9 @@ declare enum DashboardAppSlug {
|
|
|
273
273
|
MAPSO = "MAPSO",
|
|
274
274
|
IAGO = "IAGO",
|
|
275
275
|
PEDAGO = "PEDAGO",
|
|
276
|
-
MARKETO = "MARKETO"
|
|
276
|
+
MARKETO = "MARKETO",
|
|
277
|
+
/** Connect'O — API agents / MCP (hors free self-serve) */
|
|
278
|
+
CONNECTO = "CONNECTO"
|
|
277
279
|
}
|
|
278
280
|
type DashboardAppDefinition = {
|
|
279
281
|
slug: DashboardAppSlug;
|
|
@@ -572,7 +574,8 @@ interface CreateWasteCollectionDayRequest {
|
|
|
572
574
|
wasteTypeId: string;
|
|
573
575
|
name: string;
|
|
574
576
|
description?: string;
|
|
575
|
-
|
|
577
|
+
/** Fréquence en semaines (1 = hebdo, 2 = toutes les 2 semaines, …). */
|
|
578
|
+
everyWeeks?: number;
|
|
576
579
|
startDate?: string;
|
|
577
580
|
}
|
|
578
581
|
interface CreateWasteCollectionExceptionRequest {
|
|
@@ -977,6 +980,7 @@ interface UpdateBlogPostRequest {
|
|
|
977
980
|
interface CreateNotificationRequest {
|
|
978
981
|
title: string;
|
|
979
982
|
body: string;
|
|
983
|
+
/** @deprecated Prefer redirectHref; kept for legacy push extras */
|
|
980
984
|
data?: Record<string, unknown>;
|
|
981
985
|
recipientGroupId: string;
|
|
982
986
|
scheduledAt?: string;
|
|
@@ -986,16 +990,30 @@ interface CreateNotificationRequest {
|
|
|
986
990
|
showAsModal?: boolean;
|
|
987
991
|
/** Média CMS affiché dans la modale */
|
|
988
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;
|
|
989
1003
|
}
|
|
990
1004
|
interface UpdateNotificationRequest {
|
|
991
1005
|
title?: string;
|
|
992
1006
|
body?: string;
|
|
1007
|
+
/** @deprecated Prefer redirectHref */
|
|
993
1008
|
data?: Record<string, unknown>;
|
|
994
1009
|
recipientGroupId?: string;
|
|
995
1010
|
scheduledAt?: string;
|
|
996
1011
|
sendPush?: boolean;
|
|
997
1012
|
showAsModal?: boolean;
|
|
998
1013
|
imageMediaId?: string | null;
|
|
1014
|
+
targetAllApps?: boolean;
|
|
1015
|
+
cmsAppId?: string | null;
|
|
1016
|
+
redirectHref?: string | null;
|
|
999
1017
|
}
|
|
1000
1018
|
interface CreateRecipientGroupRequest {
|
|
1001
1019
|
name: string;
|
|
@@ -1035,6 +1053,8 @@ interface PublicAnnouncement {
|
|
|
1035
1053
|
body: string;
|
|
1036
1054
|
imageUrl?: string | null;
|
|
1037
1055
|
sentAt?: string | null;
|
|
1056
|
+
/** Href Expo Router optionnel pour le CTA / deep link */
|
|
1057
|
+
redirectHref?: string | null;
|
|
1038
1058
|
}
|
|
1039
1059
|
|
|
1040
1060
|
interface CreateProviderRequest {
|
|
@@ -2443,6 +2463,42 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2443
2463
|
unlinkCity: (wasteTypeId: string, cityId: string) => Promise<void>;
|
|
2444
2464
|
};
|
|
2445
2465
|
};
|
|
2466
|
+
surveys: {
|
|
2467
|
+
findAll: (params?: {
|
|
2468
|
+
page?: number;
|
|
2469
|
+
pageSize?: number;
|
|
2470
|
+
cityId?: string;
|
|
2471
|
+
cityGroupId?: string;
|
|
2472
|
+
status?: string;
|
|
2473
|
+
light?: boolean;
|
|
2474
|
+
}) => Promise<PaginatedResponse<unknown>>;
|
|
2475
|
+
getById: (id: string) => Promise<unknown>;
|
|
2476
|
+
getStats: (id: string) => Promise<unknown>;
|
|
2477
|
+
getTerrainOverview: (params?: {
|
|
2478
|
+
cityId?: string;
|
|
2479
|
+
cityGroupId?: string;
|
|
2480
|
+
}) => Promise<unknown>;
|
|
2481
|
+
};
|
|
2482
|
+
fieldReports: {
|
|
2483
|
+
findAllForms: (params?: {
|
|
2484
|
+
page?: number;
|
|
2485
|
+
pageSize?: number;
|
|
2486
|
+
cityId?: string;
|
|
2487
|
+
cityGroupId?: string;
|
|
2488
|
+
status?: string;
|
|
2489
|
+
light?: boolean;
|
|
2490
|
+
}) => Promise<PaginatedResponse<unknown>>;
|
|
2491
|
+
getForm: (id: string) => Promise<unknown>;
|
|
2492
|
+
findAllReports: (params?: {
|
|
2493
|
+
page?: number;
|
|
2494
|
+
pageSize?: number;
|
|
2495
|
+
cityId?: string;
|
|
2496
|
+
cityGroupId?: string;
|
|
2497
|
+
status?: string;
|
|
2498
|
+
formId?: string;
|
|
2499
|
+
}) => Promise<PaginatedResponse<unknown>>;
|
|
2500
|
+
getReport: (id: string) => Promise<unknown>;
|
|
2501
|
+
};
|
|
2446
2502
|
public: {
|
|
2447
2503
|
cities: {
|
|
2448
2504
|
findAll: (params?: {
|
|
@@ -2505,12 +2561,13 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2505
2561
|
getById: (id: string) => Promise<unknown>;
|
|
2506
2562
|
};
|
|
2507
2563
|
announcements: {
|
|
2508
|
-
listForCity: (cityId: string) => Promise<{
|
|
2564
|
+
listForCity: (cityId: string, appId: string) => Promise<{
|
|
2509
2565
|
id: string;
|
|
2510
2566
|
title: string;
|
|
2511
2567
|
body: string;
|
|
2512
2568
|
imageUrl?: string | null;
|
|
2513
2569
|
sentAt?: string | null;
|
|
2570
|
+
redirectHref?: string | null;
|
|
2514
2571
|
}[]>;
|
|
2515
2572
|
};
|
|
2516
2573
|
cityGroups: {
|
|
@@ -2559,6 +2616,9 @@ declare function createWastoClient(config: WastoClientConfig): {
|
|
|
2559
2616
|
devices: {
|
|
2560
2617
|
registerPushToken: (deviceId: string, body: {
|
|
2561
2618
|
token: string;
|
|
2619
|
+
cmsAppId?: string | null;
|
|
2620
|
+
cityId?: string | null;
|
|
2621
|
+
wasteCollectionPlaceId?: string | null;
|
|
2562
2622
|
}) => Promise<void>;
|
|
2563
2623
|
};
|
|
2564
2624
|
analytics: {
|
package/dist/index.js
CHANGED
|
@@ -467,6 +467,7 @@ var DashboardAppSlug = /* @__PURE__ */ ((DashboardAppSlug2) => {
|
|
|
467
467
|
DashboardAppSlug2["IAGO"] = "IAGO";
|
|
468
468
|
DashboardAppSlug2["PEDAGO"] = "PEDAGO";
|
|
469
469
|
DashboardAppSlug2["MARKETO"] = "MARKETO";
|
|
470
|
+
DashboardAppSlug2["CONNECTO"] = "CONNECTO";
|
|
470
471
|
return DashboardAppSlug2;
|
|
471
472
|
})(DashboardAppSlug || {});
|
|
472
473
|
var WASTO_SECTIONS = [
|
|
@@ -541,6 +542,14 @@ var WASTO_SECTIONS = [
|
|
|
541
542
|
label: "ASSIST'O",
|
|
542
543
|
sectionLabel: "Support",
|
|
543
544
|
dashboardPath: "/support"
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
slug: "CONNECTO" /* CONNECTO */,
|
|
548
|
+
key: "connecto",
|
|
549
|
+
label: "CONNECT'O",
|
|
550
|
+
sectionLabel: "API & agents",
|
|
551
|
+
dashboardPath: "/integrations",
|
|
552
|
+
isDevOnly: true
|
|
544
553
|
}
|
|
545
554
|
];
|
|
546
555
|
var DASHBOARD_APPS = [
|
|
@@ -612,6 +621,13 @@ var DASHBOARD_APPS = [
|
|
|
612
621
|
label: "MARKET'O",
|
|
613
622
|
dashboardPath: "/analyses",
|
|
614
623
|
isDevOnly: true
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
slug: "CONNECTO" /* CONNECTO */,
|
|
627
|
+
key: "connecto",
|
|
628
|
+
label: "CONNECT'O",
|
|
629
|
+
dashboardPath: "/integrations",
|
|
630
|
+
isDevOnly: true
|
|
615
631
|
}
|
|
616
632
|
];
|
|
617
633
|
var WASTO_SECTION_BY_KEY = Object.fromEntries(
|
|
@@ -1936,7 +1952,8 @@ async function handleResponse(res) {
|
|
|
1936
1952
|
if (text) {
|
|
1937
1953
|
try {
|
|
1938
1954
|
const json = JSON.parse(text);
|
|
1939
|
-
|
|
1955
|
+
const raw = json.message ?? json.error ?? text;
|
|
1956
|
+
message = Array.isArray(raw) ? raw.map(String).join("\n") : String(raw);
|
|
1940
1957
|
} catch {
|
|
1941
1958
|
message = text;
|
|
1942
1959
|
}
|
|
@@ -2236,6 +2253,62 @@ function createWastoClient(config) {
|
|
|
2236
2253
|
)
|
|
2237
2254
|
})
|
|
2238
2255
|
},
|
|
2256
|
+
surveys: {
|
|
2257
|
+
findAll: (params) => {
|
|
2258
|
+
const q = new URLSearchParams();
|
|
2259
|
+
if (params?.page != null) q.set("page", String(params.page));
|
|
2260
|
+
if (params?.pageSize != null) q.set("pageSize", String(params.pageSize));
|
|
2261
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2262
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2263
|
+
if (params?.status) q.set("status", params.status);
|
|
2264
|
+
if (params?.light) q.set("light", "1");
|
|
2265
|
+
const query = q.toString();
|
|
2266
|
+
return request(
|
|
2267
|
+
`/surveys${query ? `?${query}` : ""}`
|
|
2268
|
+
);
|
|
2269
|
+
},
|
|
2270
|
+
getById: (id) => request(`/surveys/${id}`),
|
|
2271
|
+
getStats: (id) => request(`/surveys/${id}/stats`),
|
|
2272
|
+
getTerrainOverview: (params) => {
|
|
2273
|
+
const q = new URLSearchParams();
|
|
2274
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2275
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2276
|
+
const query = q.toString();
|
|
2277
|
+
return request(
|
|
2278
|
+
`/surveys/terrain/overview${query ? `?${query}` : ""}`
|
|
2279
|
+
);
|
|
2280
|
+
}
|
|
2281
|
+
},
|
|
2282
|
+
fieldReports: {
|
|
2283
|
+
findAllForms: (params) => {
|
|
2284
|
+
const q = new URLSearchParams();
|
|
2285
|
+
if (params?.page != null) q.set("page", String(params.page));
|
|
2286
|
+
if (params?.pageSize != null) q.set("pageSize", String(params.pageSize));
|
|
2287
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2288
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2289
|
+
if (params?.status) q.set("status", params.status);
|
|
2290
|
+
if (params?.light) q.set("light", "1");
|
|
2291
|
+
const query = q.toString();
|
|
2292
|
+
return request(
|
|
2293
|
+
`/field-reports/forms${query ? `?${query}` : ""}`
|
|
2294
|
+
);
|
|
2295
|
+
},
|
|
2296
|
+
getForm: (id) => request(`/field-reports/forms/${id}`),
|
|
2297
|
+
findAllReports: (params) => {
|
|
2298
|
+
const q = new URLSearchParams();
|
|
2299
|
+
if (params?.page != null) q.set("page", String(params.page));
|
|
2300
|
+
if (params?.pageSize != null) q.set("pageSize", String(params.pageSize));
|
|
2301
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2302
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2303
|
+
if (params?.status) q.set("status", params.status);
|
|
2304
|
+
if (params?.formId) q.set("formId", params.formId);
|
|
2305
|
+
const query = q.toString();
|
|
2306
|
+
return request(
|
|
2307
|
+
`/field-reports${query ? `?${query}` : ""}`
|
|
2308
|
+
);
|
|
2309
|
+
},
|
|
2310
|
+
getReport: (id) => request(`/field-reports/${id}`)
|
|
2311
|
+
},
|
|
2239
2312
|
public: {
|
|
2240
2313
|
cities: {
|
|
2241
2314
|
findAll: (params) => {
|
|
@@ -2346,7 +2419,9 @@ function createWastoClient(config) {
|
|
|
2346
2419
|
getById: (id) => requestPublic(`/public/blog-posts/${id}`)
|
|
2347
2420
|
},
|
|
2348
2421
|
announcements: {
|
|
2349
|
-
listForCity: (cityId) => requestPublic(
|
|
2422
|
+
listForCity: (cityId, appId) => requestPublic(
|
|
2423
|
+
`/public/announcements?cityId=${encodeURIComponent(cityId)}&appId=${encodeURIComponent(appId)}`
|
|
2424
|
+
)
|
|
2350
2425
|
},
|
|
2351
2426
|
cityGroups: {
|
|
2352
2427
|
searchStreetSectors: (cityGroupId, params) => {
|
package/dist/index.mjs
CHANGED
|
@@ -307,6 +307,7 @@ var DashboardAppSlug = /* @__PURE__ */ ((DashboardAppSlug2) => {
|
|
|
307
307
|
DashboardAppSlug2["IAGO"] = "IAGO";
|
|
308
308
|
DashboardAppSlug2["PEDAGO"] = "PEDAGO";
|
|
309
309
|
DashboardAppSlug2["MARKETO"] = "MARKETO";
|
|
310
|
+
DashboardAppSlug2["CONNECTO"] = "CONNECTO";
|
|
310
311
|
return DashboardAppSlug2;
|
|
311
312
|
})(DashboardAppSlug || {});
|
|
312
313
|
var WASTO_SECTIONS = [
|
|
@@ -381,6 +382,14 @@ var WASTO_SECTIONS = [
|
|
|
381
382
|
label: "ASSIST'O",
|
|
382
383
|
sectionLabel: "Support",
|
|
383
384
|
dashboardPath: "/support"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
slug: "CONNECTO" /* CONNECTO */,
|
|
388
|
+
key: "connecto",
|
|
389
|
+
label: "CONNECT'O",
|
|
390
|
+
sectionLabel: "API & agents",
|
|
391
|
+
dashboardPath: "/integrations",
|
|
392
|
+
isDevOnly: true
|
|
384
393
|
}
|
|
385
394
|
];
|
|
386
395
|
var DASHBOARD_APPS = [
|
|
@@ -452,6 +461,13 @@ var DASHBOARD_APPS = [
|
|
|
452
461
|
label: "MARKET'O",
|
|
453
462
|
dashboardPath: "/analyses",
|
|
454
463
|
isDevOnly: true
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
slug: "CONNECTO" /* CONNECTO */,
|
|
467
|
+
key: "connecto",
|
|
468
|
+
label: "CONNECT'O",
|
|
469
|
+
dashboardPath: "/integrations",
|
|
470
|
+
isDevOnly: true
|
|
455
471
|
}
|
|
456
472
|
];
|
|
457
473
|
var WASTO_SECTION_BY_KEY = Object.fromEntries(
|
|
@@ -1776,7 +1792,8 @@ async function handleResponse(res) {
|
|
|
1776
1792
|
if (text) {
|
|
1777
1793
|
try {
|
|
1778
1794
|
const json = JSON.parse(text);
|
|
1779
|
-
|
|
1795
|
+
const raw = json.message ?? json.error ?? text;
|
|
1796
|
+
message = Array.isArray(raw) ? raw.map(String).join("\n") : String(raw);
|
|
1780
1797
|
} catch {
|
|
1781
1798
|
message = text;
|
|
1782
1799
|
}
|
|
@@ -2076,6 +2093,62 @@ function createWastoClient(config) {
|
|
|
2076
2093
|
)
|
|
2077
2094
|
})
|
|
2078
2095
|
},
|
|
2096
|
+
surveys: {
|
|
2097
|
+
findAll: (params) => {
|
|
2098
|
+
const q = new URLSearchParams();
|
|
2099
|
+
if (params?.page != null) q.set("page", String(params.page));
|
|
2100
|
+
if (params?.pageSize != null) q.set("pageSize", String(params.pageSize));
|
|
2101
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2102
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2103
|
+
if (params?.status) q.set("status", params.status);
|
|
2104
|
+
if (params?.light) q.set("light", "1");
|
|
2105
|
+
const query = q.toString();
|
|
2106
|
+
return request(
|
|
2107
|
+
`/surveys${query ? `?${query}` : ""}`
|
|
2108
|
+
);
|
|
2109
|
+
},
|
|
2110
|
+
getById: (id) => request(`/surveys/${id}`),
|
|
2111
|
+
getStats: (id) => request(`/surveys/${id}/stats`),
|
|
2112
|
+
getTerrainOverview: (params) => {
|
|
2113
|
+
const q = new URLSearchParams();
|
|
2114
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2115
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2116
|
+
const query = q.toString();
|
|
2117
|
+
return request(
|
|
2118
|
+
`/surveys/terrain/overview${query ? `?${query}` : ""}`
|
|
2119
|
+
);
|
|
2120
|
+
}
|
|
2121
|
+
},
|
|
2122
|
+
fieldReports: {
|
|
2123
|
+
findAllForms: (params) => {
|
|
2124
|
+
const q = new URLSearchParams();
|
|
2125
|
+
if (params?.page != null) q.set("page", String(params.page));
|
|
2126
|
+
if (params?.pageSize != null) q.set("pageSize", String(params.pageSize));
|
|
2127
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2128
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2129
|
+
if (params?.status) q.set("status", params.status);
|
|
2130
|
+
if (params?.light) q.set("light", "1");
|
|
2131
|
+
const query = q.toString();
|
|
2132
|
+
return request(
|
|
2133
|
+
`/field-reports/forms${query ? `?${query}` : ""}`
|
|
2134
|
+
);
|
|
2135
|
+
},
|
|
2136
|
+
getForm: (id) => request(`/field-reports/forms/${id}`),
|
|
2137
|
+
findAllReports: (params) => {
|
|
2138
|
+
const q = new URLSearchParams();
|
|
2139
|
+
if (params?.page != null) q.set("page", String(params.page));
|
|
2140
|
+
if (params?.pageSize != null) q.set("pageSize", String(params.pageSize));
|
|
2141
|
+
if (params?.cityId) q.set("cityId", params.cityId);
|
|
2142
|
+
if (params?.cityGroupId) q.set("cityGroupId", params.cityGroupId);
|
|
2143
|
+
if (params?.status) q.set("status", params.status);
|
|
2144
|
+
if (params?.formId) q.set("formId", params.formId);
|
|
2145
|
+
const query = q.toString();
|
|
2146
|
+
return request(
|
|
2147
|
+
`/field-reports${query ? `?${query}` : ""}`
|
|
2148
|
+
);
|
|
2149
|
+
},
|
|
2150
|
+
getReport: (id) => request(`/field-reports/${id}`)
|
|
2151
|
+
},
|
|
2079
2152
|
public: {
|
|
2080
2153
|
cities: {
|
|
2081
2154
|
findAll: (params) => {
|
|
@@ -2186,7 +2259,9 @@ function createWastoClient(config) {
|
|
|
2186
2259
|
getById: (id) => requestPublic(`/public/blog-posts/${id}`)
|
|
2187
2260
|
},
|
|
2188
2261
|
announcements: {
|
|
2189
|
-
listForCity: (cityId) => requestPublic(
|
|
2262
|
+
listForCity: (cityId, appId) => requestPublic(
|
|
2263
|
+
`/public/announcements?cityId=${encodeURIComponent(cityId)}&appId=${encodeURIComponent(appId)}`
|
|
2264
|
+
)
|
|
2190
2265
|
},
|
|
2191
2266
|
cityGroups: {
|
|
2192
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
|
}
|
|
@@ -452,6 +453,89 @@ export function createWastoClient(config: WastoClientConfig) {
|
|
|
452
453
|
}),
|
|
453
454
|
},
|
|
454
455
|
|
|
456
|
+
surveys: {
|
|
457
|
+
findAll: (params?: {
|
|
458
|
+
page?: number;
|
|
459
|
+
pageSize?: number;
|
|
460
|
+
cityId?: string;
|
|
461
|
+
cityGroupId?: string;
|
|
462
|
+
status?: string;
|
|
463
|
+
light?: boolean;
|
|
464
|
+
}) => {
|
|
465
|
+
const q = new URLSearchParams();
|
|
466
|
+
if (params?.page != null) q.set('page', String(params.page));
|
|
467
|
+
if (params?.pageSize != null) q.set('pageSize', String(params.pageSize));
|
|
468
|
+
if (params?.cityId) q.set('cityId', params.cityId);
|
|
469
|
+
if (params?.cityGroupId) q.set('cityGroupId', params.cityGroupId);
|
|
470
|
+
if (params?.status) q.set('status', params.status);
|
|
471
|
+
if (params?.light) q.set('light', '1');
|
|
472
|
+
const query = q.toString();
|
|
473
|
+
return request<PaginatedResponse<unknown>>(
|
|
474
|
+
`/surveys${query ? `?${query}` : ''}`,
|
|
475
|
+
);
|
|
476
|
+
},
|
|
477
|
+
getById: (id: string) => request<unknown>(`/surveys/${id}`),
|
|
478
|
+
getStats: (id: string) => request<unknown>(`/surveys/${id}/stats`),
|
|
479
|
+
getTerrainOverview: (params?: {
|
|
480
|
+
cityId?: string;
|
|
481
|
+
cityGroupId?: string;
|
|
482
|
+
}) => {
|
|
483
|
+
const q = new URLSearchParams();
|
|
484
|
+
if (params?.cityId) q.set('cityId', params.cityId);
|
|
485
|
+
if (params?.cityGroupId) q.set('cityGroupId', params.cityGroupId);
|
|
486
|
+
const query = q.toString();
|
|
487
|
+
return request<unknown>(
|
|
488
|
+
`/surveys/terrain/overview${query ? `?${query}` : ''}`,
|
|
489
|
+
);
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
fieldReports: {
|
|
494
|
+
findAllForms: (params?: {
|
|
495
|
+
page?: number;
|
|
496
|
+
pageSize?: number;
|
|
497
|
+
cityId?: string;
|
|
498
|
+
cityGroupId?: string;
|
|
499
|
+
status?: string;
|
|
500
|
+
light?: boolean;
|
|
501
|
+
}) => {
|
|
502
|
+
const q = new URLSearchParams();
|
|
503
|
+
if (params?.page != null) q.set('page', String(params.page));
|
|
504
|
+
if (params?.pageSize != null) q.set('pageSize', String(params.pageSize));
|
|
505
|
+
if (params?.cityId) q.set('cityId', params.cityId);
|
|
506
|
+
if (params?.cityGroupId) q.set('cityGroupId', params.cityGroupId);
|
|
507
|
+
if (params?.status) q.set('status', params.status);
|
|
508
|
+
if (params?.light) q.set('light', '1');
|
|
509
|
+
const query = q.toString();
|
|
510
|
+
return request<PaginatedResponse<unknown>>(
|
|
511
|
+
`/field-reports/forms${query ? `?${query}` : ''}`,
|
|
512
|
+
);
|
|
513
|
+
},
|
|
514
|
+
getForm: (id: string) =>
|
|
515
|
+
request<unknown>(`/field-reports/forms/${id}`),
|
|
516
|
+
findAllReports: (params?: {
|
|
517
|
+
page?: number;
|
|
518
|
+
pageSize?: number;
|
|
519
|
+
cityId?: string;
|
|
520
|
+
cityGroupId?: string;
|
|
521
|
+
status?: string;
|
|
522
|
+
formId?: string;
|
|
523
|
+
}) => {
|
|
524
|
+
const q = new URLSearchParams();
|
|
525
|
+
if (params?.page != null) q.set('page', String(params.page));
|
|
526
|
+
if (params?.pageSize != null) q.set('pageSize', String(params.pageSize));
|
|
527
|
+
if (params?.cityId) q.set('cityId', params.cityId);
|
|
528
|
+
if (params?.cityGroupId) q.set('cityGroupId', params.cityGroupId);
|
|
529
|
+
if (params?.status) q.set('status', params.status);
|
|
530
|
+
if (params?.formId) q.set('formId', params.formId);
|
|
531
|
+
const query = q.toString();
|
|
532
|
+
return request<PaginatedResponse<unknown>>(
|
|
533
|
+
`/field-reports${query ? `?${query}` : ''}`,
|
|
534
|
+
);
|
|
535
|
+
},
|
|
536
|
+
getReport: (id: string) => request<unknown>(`/field-reports/${id}`),
|
|
537
|
+
},
|
|
538
|
+
|
|
455
539
|
public: {
|
|
456
540
|
cities: {
|
|
457
541
|
findAll: (params?: { page?: number; pageSize?: number }) => {
|
|
@@ -574,7 +658,7 @@ export function createWastoClient(config: WastoClientConfig) {
|
|
|
574
658
|
getById: (id: string) => requestPublic<unknown>(`/public/blog-posts/${id}`),
|
|
575
659
|
},
|
|
576
660
|
announcements: {
|
|
577
|
-
listForCity: (cityId: string) =>
|
|
661
|
+
listForCity: (cityId: string, appId: string) =>
|
|
578
662
|
requestPublic<
|
|
579
663
|
Array<{
|
|
580
664
|
id: string;
|
|
@@ -582,8 +666,11 @@ export function createWastoClient(config: WastoClientConfig) {
|
|
|
582
666
|
body: string;
|
|
583
667
|
imageUrl?: string | null;
|
|
584
668
|
sentAt?: string | null;
|
|
669
|
+
redirectHref?: string | null;
|
|
585
670
|
}>
|
|
586
|
-
>(
|
|
671
|
+
>(
|
|
672
|
+
`/public/announcements?cityId=${encodeURIComponent(cityId)}&appId=${encodeURIComponent(appId)}`,
|
|
673
|
+
),
|
|
587
674
|
},
|
|
588
675
|
cityGroups: {
|
|
589
676
|
searchStreetSectors: (cityGroupId: string, params: { q: string }) => {
|
|
@@ -665,7 +752,15 @@ export function createWastoClient(config: WastoClientConfig) {
|
|
|
665
752
|
}),
|
|
666
753
|
},
|
|
667
754
|
devices: {
|
|
668
|
-
registerPushToken: (
|
|
755
|
+
registerPushToken: (
|
|
756
|
+
deviceId: string,
|
|
757
|
+
body: {
|
|
758
|
+
token: string;
|
|
759
|
+
cmsAppId?: string | null;
|
|
760
|
+
cityId?: string | null;
|
|
761
|
+
wasteCollectionPlaceId?: string | null;
|
|
762
|
+
},
|
|
763
|
+
) =>
|
|
669
764
|
requestPublic<void>(`/public/devices/${encodeURIComponent(deviceId)}/push-token`, {
|
|
670
765
|
method: 'POST',
|
|
671
766
|
body: JSON.stringify(body),
|
package/src/dashboard-apps.ts
CHANGED
|
@@ -14,6 +14,8 @@ export enum DashboardAppSlug {
|
|
|
14
14
|
IAGO = 'IAGO',
|
|
15
15
|
PEDAGO = 'PEDAGO',
|
|
16
16
|
MARKETO = 'MARKETO',
|
|
17
|
+
/** Connect'O — API agents / MCP (hors free self-serve) */
|
|
18
|
+
CONNECTO = 'CONNECTO',
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export type DashboardAppDefinition = {
|
|
@@ -107,6 +109,14 @@ export const WASTO_SECTIONS: WastoSectionDefinition[] = [
|
|
|
107
109
|
sectionLabel: 'Support',
|
|
108
110
|
dashboardPath: '/support',
|
|
109
111
|
},
|
|
112
|
+
{
|
|
113
|
+
slug: DashboardAppSlug.CONNECTO,
|
|
114
|
+
key: 'connecto',
|
|
115
|
+
label: "CONNECT'O",
|
|
116
|
+
sectionLabel: 'API & agents',
|
|
117
|
+
dashboardPath: '/integrations',
|
|
118
|
+
isDevOnly: true,
|
|
119
|
+
},
|
|
110
120
|
];
|
|
111
121
|
|
|
112
122
|
export const DASHBOARD_APPS: DashboardAppDefinition[] = [
|
|
@@ -179,6 +189,13 @@ export const DASHBOARD_APPS: DashboardAppDefinition[] = [
|
|
|
179
189
|
dashboardPath: '/analyses',
|
|
180
190
|
isDevOnly: true,
|
|
181
191
|
},
|
|
192
|
+
{
|
|
193
|
+
slug: DashboardAppSlug.CONNECTO,
|
|
194
|
+
key: 'connecto',
|
|
195
|
+
label: "CONNECT'O",
|
|
196
|
+
dashboardPath: '/integrations',
|
|
197
|
+
isDevOnly: true,
|
|
198
|
+
},
|
|
182
199
|
];
|
|
183
200
|
|
|
184
201
|
export const WASTO_SECTION_BY_KEY = Object.fromEntries(
|
|
@@ -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
|
}
|
|
@@ -11,7 +11,8 @@ export interface CreateWasteCollectionDayRequest {
|
|
|
11
11
|
wasteTypeId: string;
|
|
12
12
|
name: string;
|
|
13
13
|
description?: string;
|
|
14
|
-
|
|
14
|
+
/** Fréquence en semaines (1 = hebdo, 2 = toutes les 2 semaines, …). */
|
|
15
|
+
everyWeeks?: number;
|
|
15
16
|
startDate?: string;
|
|
16
17
|
}
|
|
17
18
|
|