m2m-components 3.3.0 → 3.3.1-alpha-aef9a40.0

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 (306) hide show
  1. package/MenuBaseElement.d.mts +24 -0
  2. package/MenuBaseElement.d.ts +12 -8
  3. package/MenuBaseElement.js +177 -102
  4. package/MenuBaseElement.js.map +1 -1
  5. package/MenuBaseElement.mjs +9 -0
  6. package/MenuBaseElement.mjs.map +1 -0
  7. package/{cjs/storage/lib/hub.js → chunk-2X6HV5XJ.mjs} +21 -40
  8. package/chunk-2X6HV5XJ.mjs.map +1 -0
  9. package/chunk-3YQYBFME.mjs +102 -0
  10. package/chunk-3YQYBFME.mjs.map +1 -0
  11. package/chunk-5FHEMJGG.mjs +97 -0
  12. package/chunk-5FHEMJGG.mjs.map +1 -0
  13. package/{cjs/domains.js → chunk-B7STDXYN.mjs} +8 -8
  14. package/chunk-B7STDXYN.mjs.map +1 -0
  15. package/chunk-BFPL6AIR.mjs +74 -0
  16. package/chunk-BFPL6AIR.mjs.map +1 -0
  17. package/chunk-CB56CZRA.mjs +8491 -0
  18. package/chunk-CB56CZRA.mjs.map +1 -0
  19. package/chunk-CEBJL6ZD.mjs +22 -0
  20. package/chunk-CEBJL6ZD.mjs.map +1 -0
  21. package/{cjs/endpoints/matsuri-forms.v1.js → chunk-DYNNGZMQ.mjs} +94 -185
  22. package/chunk-DYNNGZMQ.mjs.map +1 -0
  23. package/chunk-FDRD4YS4.mjs +34 -0
  24. package/chunk-FDRD4YS4.mjs.map +1 -0
  25. package/{cjs/endpoints/m2m-users.v1.js → chunk-GMPQV5TL.mjs} +136 -267
  26. package/chunk-GMPQV5TL.mjs.map +1 -0
  27. package/chunk-H66U7VZB.mjs +9 -0
  28. package/chunk-H66U7VZB.mjs.map +1 -0
  29. package/chunk-IH72EYIB.mjs +9 -0
  30. package/chunk-IH72EYIB.mjs.map +1 -0
  31. package/chunk-IOZIVEOV.mjs +2 -0
  32. package/chunk-IOZIVEOV.mjs.map +1 -0
  33. package/{cjs/endpoints/m2m-notifications.v1.js → chunk-ISOF65DB.mjs} +42 -63
  34. package/chunk-ISOF65DB.mjs.map +1 -0
  35. package/chunk-JUBOAWNR.mjs +61 -0
  36. package/chunk-JUBOAWNR.mjs.map +1 -0
  37. package/chunk-LDSJ6KYP.mjs +28 -0
  38. package/chunk-LDSJ6KYP.mjs.map +1 -0
  39. package/chunk-LYVJL4T5.mjs +78 -0
  40. package/chunk-LYVJL4T5.mjs.map +1 -0
  41. package/chunk-M4ZBTA6A.mjs +19 -0
  42. package/chunk-M4ZBTA6A.mjs.map +1 -0
  43. package/chunk-NO6ZGO5P.mjs +17 -0
  44. package/chunk-NO6ZGO5P.mjs.map +1 -0
  45. package/chunk-UCJSCAN5.mjs +45 -0
  46. package/chunk-UCJSCAN5.mjs.map +1 -0
  47. package/chunk-UM6FAKR4.mjs +152 -0
  48. package/chunk-UM6FAKR4.mjs.map +1 -0
  49. package/{cjs/storage/lib/client.js → chunk-UOPEIK22.mjs} +45 -50
  50. package/chunk-UOPEIK22.mjs.map +1 -0
  51. package/chunk-V4ROE7DI.mjs +54 -0
  52. package/chunk-V4ROE7DI.mjs.map +1 -0
  53. package/chunk-VNCVFELM.mjs +83 -0
  54. package/chunk-VNCVFELM.mjs.map +1 -0
  55. package/chunk-YUHXVW6K.mjs +2 -0
  56. package/chunk-YUHXVW6K.mjs.map +1 -0
  57. package/domains.d.mts +11 -0
  58. package/domains.d.ts +3 -2
  59. package/domains.js +31 -1
  60. package/domains.js.map +1 -1
  61. package/domains.mjs +9 -0
  62. package/domains.mjs.map +1 -0
  63. package/endpoints/m2m-notifications.d.mts +7 -0
  64. package/endpoints/m2m-notifications.d.ts +5 -3
  65. package/endpoints/m2m-notifications.js +129 -4
  66. package/endpoints/m2m-notifications.js.map +1 -1
  67. package/endpoints/m2m-notifications.mjs +12 -0
  68. package/endpoints/m2m-notifications.mjs.map +1 -0
  69. package/endpoints/m2m-notifications.v1.d.mts +1 -0
  70. package/endpoints/m2m-notifications.v1.d.ts +1 -51
  71. package/endpoints/m2m-notifications.v1.js +95 -102
  72. package/endpoints/m2m-notifications.v1.js.map +1 -1
  73. package/endpoints/m2m-notifications.v1.mjs +23 -0
  74. package/endpoints/m2m-notifications.v1.mjs.map +1 -0
  75. package/endpoints/m2m-users.d.mts +7 -0
  76. package/endpoints/m2m-users.d.ts +5 -3
  77. package/endpoints/m2m-users.js +407 -4
  78. package/endpoints/m2m-users.js.map +1 -1
  79. package/endpoints/m2m-users.mjs +12 -0
  80. package/endpoints/m2m-users.mjs.map +1 -0
  81. package/endpoints/m2m-users.v1.d.mts +1 -0
  82. package/endpoints/m2m-users.v1.d.ts +1 -221
  83. package/endpoints/m2m-users.v1.js +327 -475
  84. package/endpoints/m2m-users.v1.js.map +1 -1
  85. package/endpoints/m2m-users.v1.mjs +69 -0
  86. package/endpoints/m2m-users.v1.mjs.map +1 -0
  87. package/endpoints/matsuri-forms.d.mts +7 -0
  88. package/endpoints/matsuri-forms.d.ts +5 -3
  89. package/endpoints/matsuri-forms.js +291 -4
  90. package/endpoints/matsuri-forms.js.map +1 -1
  91. package/endpoints/matsuri-forms.mjs +12 -0
  92. package/endpoints/matsuri-forms.mjs.map +1 -0
  93. package/endpoints/matsuri-forms.v1.d.mts +1 -0
  94. package/endpoints/matsuri-forms.v1.d.ts +1 -177
  95. package/endpoints/matsuri-forms.v1.js +231 -332
  96. package/endpoints/matsuri-forms.v1.js.map +1 -1
  97. package/endpoints/matsuri-forms.v1.mjs +49 -0
  98. package/endpoints/matsuri-forms.v1.mjs.map +1 -0
  99. package/feedback/MultipleTextQuestion.d.mts +6 -0
  100. package/feedback/MultipleTextQuestion.d.ts +6 -3
  101. package/feedback/MultipleTextQuestion.js +43 -10
  102. package/feedback/MultipleTextQuestion.js.map +1 -1
  103. package/feedback/MultipleTextQuestion.mjs +9 -0
  104. package/feedback/MultipleTextQuestion.mjs.map +1 -0
  105. package/feedback/SelectQuestion.d.mts +6 -0
  106. package/feedback/SelectQuestion.d.ts +6 -3
  107. package/feedback/SelectQuestion.js +55 -18
  108. package/feedback/SelectQuestion.js.map +1 -1
  109. package/feedback/SelectQuestion.mjs +9 -0
  110. package/feedback/SelectQuestion.mjs.map +1 -0
  111. package/feedback/getRandomId.d.mts +6 -0
  112. package/feedback/getRandomId.d.ts +3 -2
  113. package/feedback/getRandomId.js +31 -4
  114. package/feedback/getRandomId.js.map +1 -1
  115. package/feedback/getRandomId.mjs +9 -0
  116. package/feedback/getRandomId.mjs.map +1 -0
  117. package/feedback/index.d.mts +15 -0
  118. package/feedback/index.d.ts +7 -5
  119. package/feedback/index.js +8558 -166
  120. package/feedback/index.js.map +1 -1
  121. package/feedback/index.mjs +13 -0
  122. package/feedback/index.mjs.map +1 -0
  123. package/global.d.d.mts +4 -0
  124. package/global.d.d.ts +4 -0
  125. package/global.d.js +20 -0
  126. package/global.d.js.map +1 -0
  127. package/global.d.mjs +2 -0
  128. package/global.d.mjs.map +1 -0
  129. package/index.d.mts +6 -0
  130. package/index.d.ts +6 -9
  131. package/index.js +421 -8
  132. package/index.js.map +1 -1
  133. package/index.mjs +23 -0
  134. package/index.mjs.map +1 -0
  135. package/initM2mComponents.d.mts +7 -0
  136. package/initM2mComponents.d.ts +3 -6
  137. package/initM2mComponents.js +242 -3
  138. package/initM2mComponents.js.map +1 -1
  139. package/initM2mComponents.mjs +11 -0
  140. package/initM2mComponents.mjs.map +1 -0
  141. package/m2m-apps-menu.d.mts +16 -0
  142. package/m2m-apps-menu.d.ts +10 -5
  143. package/m2m-apps-menu.js +265 -43
  144. package/m2m-apps-menu.js.map +1 -1
  145. package/m2m-apps-menu.mjs +11 -0
  146. package/m2m-apps-menu.mjs.map +1 -0
  147. package/m2m-notifications.v1-0186835d.d.ts +73 -0
  148. package/m2m-user-menu.d.mts +17 -0
  149. package/m2m-user-menu.d.ts +10 -5
  150. package/m2m-user-menu.js +327 -53
  151. package/m2m-user-menu.js.map +1 -1
  152. package/m2m-user-menu.mjs +13 -0
  153. package/m2m-user-menu.mjs.map +1 -0
  154. package/m2m-users.v1-c78c72cf.d.ts +289 -0
  155. package/matsuri-forms.v1-0ffee104.d.ts +225 -0
  156. package/notification/NotificationProvider.d.mts +18 -0
  157. package/notification/NotificationProvider.d.ts +10 -7
  158. package/notification/NotificationProvider.js +185 -51
  159. package/notification/NotificationProvider.js.map +1 -1
  160. package/notification/NotificationProvider.mjs +15 -0
  161. package/notification/NotificationProvider.mjs.map +1 -0
  162. package/notification/ServiceIdProvider.d.mts +10 -0
  163. package/notification/ServiceIdProvider.d.ts +8 -5
  164. package/notification/ServiceIdProvider.js +56 -18
  165. package/notification/ServiceIdProvider.js.map +1 -1
  166. package/notification/ServiceIdProvider.mjs +11 -0
  167. package/notification/ServiceIdProvider.mjs.map +1 -0
  168. package/notification/api.d.mts +7 -0
  169. package/notification/api.d.ts +7 -5
  170. package/notification/api.js +157 -59
  171. package/notification/api.js.map +1 -1
  172. package/notification/api.mjs +14 -0
  173. package/notification/api.mjs.map +1 -0
  174. package/notification/domain.d.mts +24 -0
  175. package/notification/domain.d.ts +6 -5
  176. package/notification/domain.js +19 -1
  177. package/notification/domain.js.map +1 -1
  178. package/notification/domain.mjs +3 -0
  179. package/notification/domain.mjs.map +1 -0
  180. package/notification/index.d.mts +6 -0
  181. package/notification/index.d.ts +6 -5
  182. package/notification/index.js +271 -4
  183. package/notification/index.js.map +1 -1
  184. package/notification/index.mjs +30 -0
  185. package/notification/index.mjs.map +1 -0
  186. package/package.json +43 -103
  187. package/releases/m2m-releases-link.d.mts +11 -0
  188. package/releases/m2m-releases-link.d.ts +9 -5
  189. package/releases/m2m-releases-link.js +97 -54
  190. package/releases/m2m-releases-link.js.map +1 -1
  191. package/releases/m2m-releases-link.mjs +69 -0
  192. package/releases/m2m-releases-link.mjs.map +1 -0
  193. package/releases/t.d.mts +3 -0
  194. package/releases/t.d.ts +3 -2
  195. package/releases/t.js +31 -1
  196. package/releases/t.js.map +1 -1
  197. package/releases/t.mjs +9 -0
  198. package/releases/t.mjs.map +1 -0
  199. package/storage/client.d.mts +20 -0
  200. package/storage/client.d.ts +8 -6
  201. package/storage/client.js +260 -85
  202. package/storage/client.js.map +1 -1
  203. package/storage/client.mjs +14 -0
  204. package/storage/client.mjs.map +1 -0
  205. package/storage/hub.d.mts +9 -0
  206. package/storage/hub.d.ts +6 -4
  207. package/storage/hub.js +120 -7
  208. package/storage/hub.js.map +1 -1
  209. package/storage/hub.mjs +10 -0
  210. package/storage/hub.mjs.map +1 -0
  211. package/storage/lib/client.d.mts +27 -0
  212. package/storage/lib/client.d.ts +4 -5
  213. package/storage/lib/client.js +76 -57
  214. package/storage/lib/client.js.map +1 -1
  215. package/storage/lib/client.mjs +9 -0
  216. package/storage/lib/client.mjs.map +1 -0
  217. package/storage/lib/hub.d.mts +15 -0
  218. package/storage/lib/hub.d.ts +4 -4
  219. package/storage/lib/hub.js +57 -46
  220. package/storage/lib/hub.js.map +1 -1
  221. package/storage/lib/hub.mjs +9 -0
  222. package/storage/lib/hub.mjs.map +1 -0
  223. package/storage/useM2mAuth.d.mts +25 -0
  224. package/storage/useM2mAuth.d.ts +10 -8
  225. package/storage/useM2mAuth.js +184 -74
  226. package/storage/useM2mAuth.js.map +1 -1
  227. package/storage/useM2mAuth.mjs +14 -0
  228. package/storage/useM2mAuth.mjs.map +1 -0
  229. package/storage/useM2mAuth.test.d.mts +2 -0
  230. package/storage/useM2mAuth.test.d.ts +2 -0
  231. package/storage/useM2mAuth.test.js +60906 -0
  232. package/storage/useM2mAuth.test.js.map +1 -0
  233. package/storage/useM2mAuth.test.mjs +60682 -0
  234. package/storage/useM2mAuth.test.mjs.map +1 -0
  235. package/cjs/MenuBaseElement.js +0 -207
  236. package/cjs/MenuBaseElement.js.map +0 -1
  237. package/cjs/domains.js.map +0 -1
  238. package/cjs/endpoints/m2m-notifications.js +0 -15
  239. package/cjs/endpoints/m2m-notifications.js.map +0 -1
  240. package/cjs/endpoints/m2m-notifications.v1.js.map +0 -1
  241. package/cjs/endpoints/m2m-users.js +0 -15
  242. package/cjs/endpoints/m2m-users.js.map +0 -1
  243. package/cjs/endpoints/m2m-users.v1.js.map +0 -1
  244. package/cjs/endpoints/matsuri-forms.js +0 -15
  245. package/cjs/endpoints/matsuri-forms.js.map +0 -1
  246. package/cjs/endpoints/matsuri-forms.v1.js.map +0 -1
  247. package/cjs/feedback/MultipleTextQuestion.js +0 -19
  248. package/cjs/feedback/MultipleTextQuestion.js.map +0 -1
  249. package/cjs/feedback/SelectQuestion.js +0 -27
  250. package/cjs/feedback/SelectQuestion.js.map +0 -1
  251. package/cjs/feedback/getRandomId.js +0 -12
  252. package/cjs/feedback/getRandomId.js.map +0 -1
  253. package/cjs/feedback/index.js +0 -185
  254. package/cjs/feedback/index.js.map +0 -1
  255. package/cjs/index.js +0 -11
  256. package/cjs/index.js.map +0 -1
  257. package/cjs/initM2mComponents.js +0 -17
  258. package/cjs/initM2mComponents.js.map +0 -1
  259. package/cjs/m2m-apps-menu.js +0 -95
  260. package/cjs/m2m-apps-menu.js.map +0 -1
  261. package/cjs/m2m-user-menu.js +0 -91
  262. package/cjs/m2m-user-menu.js.map +0 -1
  263. package/cjs/notification/NotificationProvider.js +0 -84
  264. package/cjs/notification/NotificationProvider.js.map +0 -1
  265. package/cjs/notification/ServiceIdProvider.js +0 -33
  266. package/cjs/notification/ServiceIdProvider.js.map +0 -1
  267. package/cjs/notification/api.js +0 -55
  268. package/cjs/notification/api.js.map +0 -1
  269. package/cjs/notification/domain.js +0 -6
  270. package/cjs/notification/domain.js.map +0 -1
  271. package/cjs/notification/index.js +0 -50
  272. package/cjs/notification/index.js.map +0 -1
  273. package/cjs/releases/m2m-releases-link.js +0 -99
  274. package/cjs/releases/m2m-releases-link.js.map +0 -1
  275. package/cjs/releases/t.js +0 -8
  276. package/cjs/releases/t.js.map +0 -1
  277. package/cjs/storage/client.js +0 -89
  278. package/cjs/storage/client.js.map +0 -1
  279. package/cjs/storage/hub.js +0 -19
  280. package/cjs/storage/hub.js.map +0 -1
  281. package/cjs/storage/lib/client.js.map +0 -1
  282. package/cjs/storage/lib/hub.js.map +0 -1
  283. package/cjs/storage/useM2mAuth.js +0 -97
  284. package/cjs/storage/useM2mAuth.js.map +0 -1
  285. package/endpoints/m2m-notifications.d.ts.map +0 -1
  286. package/endpoints/m2m-notifications.v1.d.ts.map +0 -1
  287. package/endpoints/m2m-users.d.ts.map +0 -1
  288. package/endpoints/m2m-users.v1.d.ts.map +0 -1
  289. package/endpoints/matsuri-forms.d.ts.map +0 -1
  290. package/endpoints/matsuri-forms.v1.d.ts.map +0 -1
  291. package/feedback/MultipleTextQuestion.d.ts.map +0 -1
  292. package/feedback/SelectQuestion.d.ts.map +0 -1
  293. package/feedback/getRandomId.d.ts.map +0 -1
  294. package/feedback/index.d.ts.map +0 -1
  295. package/notification/NotificationProvider.d.ts.map +0 -1
  296. package/notification/ServiceIdProvider.d.ts.map +0 -1
  297. package/notification/api.d.ts.map +0 -1
  298. package/notification/domain.d.ts.map +0 -1
  299. package/notification/index.d.ts.map +0 -1
  300. package/releases/m2m-releases-link.d.ts.map +0 -1
  301. package/releases/t.d.ts.map +0 -1
  302. package/storage/client.d.ts.map +0 -1
  303. package/storage/hub.d.ts.map +0 -1
  304. package/storage/lib/client.d.ts.map +0 -1
  305. package/storage/lib/hub.d.ts.map +0 -1
  306. package/storage/useM2mAuth.d.ts.map +0 -1
@@ -1,78 +1,212 @@
1
- import { createContext, useCallback, useContext } from "react";
2
- import { useAuthFetch } from "matsuri-hooks";
3
- import { useMemo } from "react";
4
- import { m2mNotifications_v1 } from "../endpoints/m2m-notifications.v1";
5
- import { useServiceId } from "./ServiceIdProvider";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- var NotificationPermissionContext = /*#__PURE__*/createContext(undefined);
8
- var NotificationsContext = /*#__PURE__*/createContext(undefined);
1
+ 'use client'
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
9
30
 
10
- // ServiceIdProviderの中で使うこと
11
- export var NotificationsProvider = _ref => {
12
- var {
13
- token,
14
- children
15
- } = _ref;
16
- var serviceId = useServiceId();
17
- var {
18
- data: subscriptions,
19
- refetch: refetchSubscriptions
20
- } = useAuthFetch(token, m2mNotifications_v1.findMySubscriptions(), {});
21
- var checkPermission = useCallback(notificationType => {
22
- var subscription = subscriptions === null || subscriptions === void 0 ? void 0 : subscriptions.find(item => {
23
- return item.serviceId === serviceId && item.notificationType === notificationType && item.resourceSubscription.resourceSelectType === "any";
24
- });
25
- return subscription === null || subscription === void 0 ? void 0 : subscription.status;
26
- }, [serviceId, subscriptions]);
27
- var {
31
+ // src/notification/NotificationProvider.tsx
32
+ var NotificationProvider_exports = {};
33
+ __export(NotificationProvider_exports, {
34
+ NotificationsProvider: () => NotificationsProvider,
35
+ useNotificationPermission: () => useNotificationPermission,
36
+ useNotifications: () => useNotifications
37
+ });
38
+ module.exports = __toCommonJS(NotificationProvider_exports);
39
+ var import_react2 = require("react");
40
+
41
+ // src/endpoints/m2m-notifications.v1.ts
42
+ var root = () => {
43
+ let __root = "";
44
+ if (globalThis.M2M_COMPONENTS_ENV === "local") {
45
+ __root = "";
46
+ }
47
+ if (globalThis.M2M_COMPONENTS_ENV === "localDev") {
48
+ __root = "";
49
+ }
50
+ if (globalThis.M2M_COMPONENTS_ENV === "development") {
51
+ __root = "https://api-notifications.dev.m2msystems.cloud";
52
+ }
53
+ if (globalThis.M2M_COMPONENTS_ENV === "production") {
54
+ __root = "https://api-notifications.m2msystems.cloud";
55
+ }
56
+ return __root;
57
+ };
58
+ var healthCheck = () => {
59
+ const __root = root();
60
+ const __queries = Object.entries({}).filter(([_, value]) => {
61
+ return value !== void 0;
62
+ }).map(([key, value]) => {
63
+ return `${key}=${value}`;
64
+ }).join("&");
65
+ const __path = `${__root}/${`health_check`}`;
66
+ return __queries ? `${__path}?${__queries}` : __path;
67
+ };
68
+ var registerNotification = () => {
69
+ const __root = root();
70
+ const __queries = Object.entries({}).filter(([_, value]) => {
71
+ return value !== void 0;
72
+ }).map(([key, value]) => {
73
+ return `${key}=${value}`;
74
+ }).join("&");
75
+ const __path = `${__root}/${`notifications`}`;
76
+ return __queries ? `${__path}?${__queries}` : __path;
77
+ };
78
+ var findNotificationsByServiceId = ({ id }) => {
79
+ const __root = root();
80
+ const __queries = Object.entries({}).filter(([_, value]) => {
81
+ return value !== void 0;
82
+ }).map(([key, value]) => {
83
+ return `${key}=${value}`;
84
+ }).join("&");
85
+ const __path = `${__root}/${`notifications/by_service_id/${id}`}`;
86
+ return __queries ? `${__path}?${__queries}` : __path;
87
+ };
88
+ var updateNotificationStatus = ({ id }) => {
89
+ const __root = root();
90
+ const __queries = Object.entries({}).filter(([_, value]) => {
91
+ return value !== void 0;
92
+ }).map(([key, value]) => {
93
+ return `${key}=${value}`;
94
+ }).join("&");
95
+ const __path = `${__root}/${`notifications/${id}`}`;
96
+ return __queries ? `${__path}?${__queries}` : __path;
97
+ };
98
+ var saveSubscription = () => {
99
+ const __root = root();
100
+ const __queries = Object.entries({}).filter(([_, value]) => {
101
+ return value !== void 0;
102
+ }).map(([key, value]) => {
103
+ return `${key}=${value}`;
104
+ }).join("&");
105
+ const __path = `${__root}/${`subscriptions`}`;
106
+ return __queries ? `${__path}?${__queries}` : __path;
107
+ };
108
+ var findMySubscriptions = () => {
109
+ const __root = root();
110
+ const __queries = Object.entries({}).filter(([_, value]) => {
111
+ return value !== void 0;
112
+ }).map(([key, value]) => {
113
+ return `${key}=${value}`;
114
+ }).join("&");
115
+ const __path = `${__root}/${`subscriptions`}`;
116
+ return __queries ? `${__path}?${__queries}` : __path;
117
+ };
118
+ var m2mNotifications_v1 = {
119
+ healthCheck,
120
+ registerNotification,
121
+ findNotificationsByServiceId,
122
+ updateNotificationStatus,
123
+ saveSubscription,
124
+ findMySubscriptions
125
+ };
126
+
127
+ // src/notification/NotificationProvider.tsx
128
+ var import_matsuri_hooks = require("matsuri-hooks");
129
+ var import_react3 = require("react");
130
+
131
+ // src/notification/ServiceIdProvider.tsx
132
+ var import_react = __toESM(require("react"));
133
+ var import_jsx_runtime = require("react/jsx-runtime");
134
+ var ServiceIdContext = (0, import_react.createContext)(
135
+ void 0
136
+ );
137
+ var useServiceId = () => {
138
+ const context = import_react.default.useContext(ServiceIdContext);
139
+ if (context === void 0) {
140
+ throw new Error("useServiceId must be used within a ServiceIdProvider");
141
+ }
142
+ return context.serviceId;
143
+ };
144
+
145
+ // src/notification/NotificationProvider.tsx
146
+ var import_jsx_runtime2 = require("react/jsx-runtime");
147
+ var NotificationPermissionContext = (0, import_react2.createContext)(void 0);
148
+ var NotificationsContext = (0, import_react2.createContext)(void 0);
149
+ var NotificationsProvider = ({
150
+ token,
151
+ children
152
+ }) => {
153
+ const serviceId = useServiceId();
154
+ const { data: subscriptions, refetch: refetchSubscriptions } = (0, import_matsuri_hooks.useAuthFetch)(token, m2mNotifications_v1.findMySubscriptions(), {});
155
+ const checkPermission = (0, import_react2.useCallback)(
156
+ (notificationType) => {
157
+ const subscription = subscriptions == null ? void 0 : subscriptions.find((item) => {
158
+ return item.serviceId === serviceId && item.notificationType === notificationType && item.resourceSubscription.resourceSelectType === "any";
159
+ });
160
+ return subscription == null ? void 0 : subscription.status;
161
+ },
162
+ [serviceId, subscriptions]
163
+ );
164
+ const {
28
165
  data: notifications,
29
166
  error,
30
167
  refetch: refetchNotifications
31
- } = useAuthFetch(token, m2mNotifications_v1.findNotificationsByServiceId({
32
- id: serviceId
33
- }), {
34
- swrConfig: {
35
- refreshInterval: 1000 * 60 * 5
36
- }
37
- });
168
+ } = (0, import_matsuri_hooks.useAuthFetch)(
169
+ token,
170
+ m2mNotifications_v1.findNotificationsByServiceId({ id: serviceId }),
171
+ { swrConfig: { refreshInterval: 1e3 * 60 * 5 } }
172
+ );
38
173
  if (error) {
39
- // エラーが出てもユーザーは特に困らないので、ユーザーに伝える必要はないが、監視は必要。
40
174
  console.error(error);
41
175
  }
42
- var permissionContextState = useMemo(() => {
176
+ const permissionContextState = (0, import_react3.useMemo)(() => {
43
177
  return {
44
178
  checkPermission,
45
179
  refetch: refetchSubscriptions
46
180
  };
47
181
  }, [checkPermission, refetchSubscriptions]);
48
- var notificationsContextState = useMemo(() => {
49
- var _notifications$data, _notifications$data$e;
182
+ const notificationsContextState = (0, import_react3.useMemo)(() => {
183
+ var _a, _b;
50
184
  return {
51
- notifications: (_notifications$data = notifications === null || notifications === void 0 ? void 0 : notifications.data) !== null && _notifications$data !== void 0 ? _notifications$data : [],
52
- isAllRead: (_notifications$data$e = notifications === null || notifications === void 0 ? void 0 : notifications.data.every(n => n.status === "read")) !== null && _notifications$data$e !== void 0 ? _notifications$data$e : true,
185
+ notifications: (_a = notifications == null ? void 0 : notifications.data) != null ? _a : [],
186
+ isAllRead: (_b = notifications == null ? void 0 : notifications.data.every((n) => n.status === "read")) != null ? _b : true,
53
187
  refetch: refetchNotifications
54
188
  };
55
- }, [refetchNotifications, notifications === null || notifications === void 0 ? void 0 : notifications.data]);
56
- return /*#__PURE__*/_jsx(NotificationPermissionContext.Provider, {
57
- value: permissionContextState,
58
- children: /*#__PURE__*/_jsx(NotificationsContext.Provider, {
59
- value: notificationsContextState,
60
- children: children
61
- })
62
- });
189
+ }, [refetchNotifications, notifications == null ? void 0 : notifications.data]);
190
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NotificationPermissionContext.Provider, { value: permissionContextState, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NotificationsContext.Provider, { value: notificationsContextState, children }) });
63
191
  };
64
- export var useNotifications = () => {
65
- var ctx = useContext(NotificationsContext);
192
+ var useNotifications = () => {
193
+ const ctx = (0, import_react2.useContext)(NotificationsContext);
66
194
  if (!ctx) {
67
195
  throw new Error("NotificatoinProvider is not found");
68
196
  }
69
197
  return ctx;
70
198
  };
71
- export var useNotificationPermission = () => {
72
- var ctx = useContext(NotificationPermissionContext);
199
+ var useNotificationPermission = () => {
200
+ const ctx = (0, import_react2.useContext)(NotificationPermissionContext);
73
201
  if (!ctx) {
74
202
  throw new Error("NotificatoinProvider is not found");
75
203
  }
76
204
  return ctx;
77
205
  };
206
+ // Annotate the CommonJS export names for ESM import in node:
207
+ 0 && (module.exports = {
208
+ NotificationsProvider,
209
+ useNotificationPermission,
210
+ useNotifications
211
+ });
78
212
  //# sourceMappingURL=NotificationProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationProvider.js","names":["createContext","useCallback","useContext","useAuthFetch","useMemo","m2mNotifications_v1","useServiceId","jsx","_jsx","NotificationPermissionContext","undefined","NotificationsContext","NotificationsProvider","_ref","token","children","serviceId","data","subscriptions","refetch","refetchSubscriptions","findMySubscriptions","checkPermission","notificationType","subscription","find","item","resourceSubscription","resourceSelectType","status","notifications","error","refetchNotifications","findNotificationsByServiceId","id","swrConfig","refreshInterval","console","permissionContextState","notificationsContextState","_notifications$data","_notifications$data$e","isAllRead","every","n","Provider","value","useNotifications","ctx","Error","useNotificationPermission"],"sources":["../src/notification/NotificationProvider.tsx"],"sourcesContent":["import {\n createContext,\n PropsWithChildren,\n useCallback,\n useContext,\n} from \"react\";\nimport { useAuthFetch } from \"matsuri-hooks\";\nimport { useMemo } from \"react\";\nimport { m2mNotifications_v1 } from \"../endpoints/m2m-notifications.v1\";\nimport { useServiceId } from \"./ServiceIdProvider\";\nimport { SubscriptionStatus, Subscription, Notification } from \"./domain\";\n\nconst NotificationPermissionContext = createContext<\n | {\n checkPermission: (\n notificationType: string\n ) => SubscriptionStatus | undefined;\n refetch: () => void;\n }\n | undefined\n>(undefined);\n\nconst NotificationsContext = createContext<\n | { notifications: Notification[]; isAllRead: boolean; refetch: () => void }\n | undefined\n>(undefined);\n\n// ServiceIdProviderの中で使うこと\nexport const NotificationsProvider = ({\n token,\n children,\n}: PropsWithChildren<{ token: string }>) => {\n const serviceId = useServiceId();\n\n const { data: subscriptions, refetch: refetchSubscriptions } = useAuthFetch<\n Subscription[]\n >(token, m2mNotifications_v1.findMySubscriptions(), {});\n const checkPermission = useCallback(\n (notificationType: string) => {\n const subscription = subscriptions?.find((item) => {\n return (\n item.serviceId === serviceId &&\n item.notificationType === notificationType &&\n item.resourceSubscription.resourceSelectType === \"any\"\n );\n });\n\n return subscription?.status;\n },\n [serviceId, subscriptions]\n );\n\n const {\n data: notifications,\n error,\n refetch: refetchNotifications,\n } = useAuthFetch<{ data: Notification[] }>(\n token,\n m2mNotifications_v1.findNotificationsByServiceId({ id: serviceId }),\n { swrConfig: { refreshInterval: 1000 * 60 * 5 } }\n );\n if (error) {\n // エラーが出てもユーザーは特に困らないので、ユーザーに伝える必要はないが、監視は必要。\n console.error(error);\n }\n\n const permissionContextState = useMemo(() => {\n return {\n checkPermission,\n refetch: refetchSubscriptions,\n };\n }, [checkPermission, refetchSubscriptions]);\n\n const notificationsContextState = useMemo(() => {\n return {\n notifications: notifications?.data ?? [],\n isAllRead: notifications?.data.every((n) => n.status === \"read\") ?? true,\n refetch: refetchNotifications,\n };\n }, [refetchNotifications, notifications?.data]);\n\n return (\n <NotificationPermissionContext.Provider value={permissionContextState}>\n <NotificationsContext.Provider value={notificationsContextState}>\n {children}\n </NotificationsContext.Provider>\n </NotificationPermissionContext.Provider>\n );\n};\n\nexport const useNotifications = () => {\n const ctx = useContext(NotificationsContext);\n if (!ctx) {\n throw new Error(\"NotificatoinProvider is not found\");\n }\n\n return ctx;\n};\n\nexport const useNotificationPermission = () => {\n const ctx = useContext(NotificationPermissionContext);\n if (!ctx) {\n throw new Error(\"NotificatoinProvider is not found\");\n }\n\n return ctx;\n};\n"],"mappings":"AAAA,SACEA,aAAa,EAEbC,WAAW,EACXC,UAAU,QACL,OAAO;AACd,SAASC,YAAY,QAAQ,eAAe;AAC5C,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,mBAAmB,QAAQ,mCAAmC;AACvE,SAASC,YAAY,QAAQ,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGnD,IAAMC,6BAA6B,gBAAGT,aAAa,CAQjDU,SAAS,CAAC;AAEZ,IAAMC,oBAAoB,gBAAGX,aAAa,CAGxCU,SAAS,CAAC;;AAEZ;AACA,OAAO,IAAME,qBAAqB,GAAGC,IAAA,IAGO;EAAA,IAHN;IACpCC,KAAK;IACLC;EACoC,CAAC,GAAAF,IAAA;EACrC,IAAMG,SAAS,GAAGV,YAAY,CAAC,CAAC;EAEhC,IAAM;IAAEW,IAAI,EAAEC,aAAa;IAAEC,OAAO,EAAEC;EAAqB,CAAC,GAAGjB,YAAY,CAEzEW,KAAK,EAAET,mBAAmB,CAACgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EACvD,IAAMC,eAAe,GAAGrB,WAAW,CAChCsB,gBAAwB,IAAK;I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,CAACf,MAAM,KAAK,MAAM,CAAC,cAAAY,qBAAA,cAAAA,qBAAA,GAAI,IAAI;MACxEtB,OAAO,EAAEa;IACX,CAAC;EACH,CAAC,EAAE,CAACA,oBAAoB,EAAEF,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEb,IAAI,CAAC,CAAC;EAE/C,oBACET,IAAA,CAACC,6BAA6B,CAACoC,QAAQ;IAACC,KAAK,EAAER,sBAAuB;IAAAvB,QAAA,eACpEP,IAAA,CAACG,oBAAoB,CAACkC,QAAQ;MAACC,KAAK,EAAEP,yBAA0B;MAAAxB,QAAA,EAC7DA;IAAQ,CACoB;EAAC,CACM,CAAC;AAE7C,CAAC;AAED,OAAO,IAAMgC,gBAAgB,GAAGA,CAAA,KAAM;EACpC,IAAMC,GAAG,GAAG9C,UAAU,CAACS,oBAAoB,CAAC;EAC5C,IAAI,CAACqC,GAAG,EAAE;IACR,MAAM,IAAIC,KAAK,CAAC,mCAAmC,CAAC;EACtD;EAEA,OAAOD,GAAG;AACZ,CAAC;AAED,OAAO,IAAME,yBAAyB,GAAGA,CAAA,KAAM;EAC7C,IAAMF,GAAG,GAAG9C,UAAU,CAACO,6BAA6B,CAAC;EACrD,IAAI,CAACuC,GAAG,EAAE;IACR,MAAM,IAAIC,KAAK,CAAC,mCAAmC,CAAC;EACtD;EAEA,OAAOD,GAAG;AACZ,CAAC"}
1
+ {"version":3,"sources":["../../src/notification/NotificationProvider.tsx","../../src/endpoints/m2m-notifications.v1.ts","../../src/notification/ServiceIdProvider.tsx"],"sourcesContent":["import { Notification, Subscription, SubscriptionStatus } from \"./domain\";\nimport {\n PropsWithChildren,\n createContext,\n useCallback,\n useContext,\n} from \"react\";\nimport { m2mNotifications_v1 } from \"../endpoints/m2m-notifications.v1\";\nimport { useAuthFetch } from \"matsuri-hooks\";\nimport { useMemo } from \"react\";\nimport { useServiceId } from \"./ServiceIdProvider\";\n\nconst NotificationPermissionContext = createContext<\n | {\n checkPermission: (\n notificationType: string\n ) => SubscriptionStatus | undefined;\n refetch: () => void;\n }\n | undefined\n>(undefined);\n\nconst NotificationsContext = createContext<\n | { notifications: Notification[]; isAllRead: boolean; refetch: () => void }\n | undefined\n>(undefined);\n\n// ServiceIdProviderの中で使うこと\nexport const NotificationsProvider = ({\n token,\n children,\n}: PropsWithChildren<{ token: string }>) => {\n const serviceId = useServiceId();\n\n const { data: subscriptions, refetch: refetchSubscriptions } = useAuthFetch<\n Subscription[]\n >(token, m2mNotifications_v1.findMySubscriptions(), {});\n const checkPermission = useCallback(\n (notificationType: string) => {\n const subscription = subscriptions?.find((item) => {\n return (\n item.serviceId === serviceId &&\n item.notificationType === notificationType &&\n item.resourceSubscription.resourceSelectType === \"any\"\n );\n });\n\n return subscription?.status;\n },\n [serviceId, subscriptions]\n );\n\n const {\n data: notifications,\n error,\n refetch: refetchNotifications,\n } = useAuthFetch<{ data: Notification[] }>(\n token,\n m2mNotifications_v1.findNotificationsByServiceId({ id: serviceId }),\n { swrConfig: { refreshInterval: 1000 * 60 * 5 } }\n );\n if (error) {\n // エラーが出てもユーザーは特に困らないので、ユーザーに伝える必要はないが、監視は必要。\n console.error(error);\n }\n\n const permissionContextState = useMemo(() => {\n return {\n checkPermission,\n refetch: refetchSubscriptions,\n };\n }, [checkPermission, refetchSubscriptions]);\n\n const notificationsContextState = useMemo(() => {\n return {\n notifications: notifications?.data ?? [],\n isAllRead: notifications?.data.every((n) => n.status === \"read\") ?? true,\n refetch: refetchNotifications,\n };\n }, [refetchNotifications, notifications?.data]);\n\n return (\n <NotificationPermissionContext.Provider value={permissionContextState}>\n <NotificationsContext.Provider value={notificationsContextState}>\n {children}\n </NotificationsContext.Provider>\n </NotificationPermissionContext.Provider>\n );\n};\n\nexport const useNotifications = () => {\n const ctx = useContext(NotificationsContext);\n if (!ctx) {\n throw new Error(\"NotificatoinProvider is not found\");\n }\n\n return ctx;\n};\n\nexport const useNotificationPermission = () => {\n const ctx = useContext(NotificationPermissionContext);\n if (!ctx) {\n throw new Error(\"NotificatoinProvider is not found\");\n }\n\n return ctx;\n};\n","/* eslint-disable */\n/**\n * A function that returns the URL part common to the endpoints.\n */\nexport const root = () => {\n let __root = \"\";\n\n if (globalThis.M2M_COMPONENTS_ENV === \"local\") {\n __root = \"\";\n }\n\n if (globalThis.M2M_COMPONENTS_ENV === \"localDev\") {\n __root = \"\";\n }\n\n if (globalThis.M2M_COMPONENTS_ENV === \"development\") {\n __root = \"https://api-notifications.dev.m2msystems.cloud\";\n }\n\n if (globalThis.M2M_COMPONENTS_ENV === \"production\") {\n __root = \"https://api-notifications.m2msystems.cloud\";\n }\n\n return __root;\n};\n/**\n * health check\n *\n */\nexport const healthCheck = () => {\n const __root = root();\n const __queries = Object.entries({})\n .filter(([_, value]) => {\n return value !== undefined;\n })\n .map(([key, value]) => {\n return `${key}=${value}`;\n })\n .join(\"&\");\n const __path = `${__root}/${`health_check`}`;\n return __queries ? `${__path}?${__queries}` : __path;\n};\n\n/**\n * 通知を登録する\n *\n */\nexport const registerNotification = () => {\n const __root = root();\n const __queries = Object.entries({})\n .filter(([_, value]) => {\n return value !== undefined;\n })\n .map(([key, value]) => {\n return `${key}=${value}`;\n })\n .join(\"&\");\n const __path = `${__root}/${`notifications`}`;\n return __queries ? `${__path}?${__queries}` : __path;\n};\n\n/**\n * 自分宛の通知をserviceIdを使って取得する\n *\n */\nexport const findNotificationsByServiceId = ({ id }: { id: string }) => {\n const __root = root();\n const __queries = Object.entries({})\n .filter(([_, value]) => {\n return value !== undefined;\n })\n .map(([key, value]) => {\n return `${key}=${value}`;\n })\n .join(\"&\");\n const __path = `${__root}/${`notifications/by_service_id/${id}`}`;\n return __queries ? `${__path}?${__queries}` : __path;\n};\n\n/**\n * 通知のステータスを更新する\n *\n */\nexport const updateNotificationStatus = ({ id }: { id: string }) => {\n const __root = root();\n const __queries = Object.entries({})\n .filter(([_, value]) => {\n return value !== undefined;\n })\n .map(([key, value]) => {\n return `${key}=${value}`;\n })\n .join(\"&\");\n const __path = `${__root}/${`notifications/${id}`}`;\n return __queries ? `${__path}?${__queries}` : __path;\n};\n\n/**\n * 通知の購読を更新する\n *\n */\nexport const saveSubscription = () => {\n const __root = root();\n const __queries = Object.entries({})\n .filter(([_, value]) => {\n return value !== undefined;\n })\n .map(([key, value]) => {\n return `${key}=${value}`;\n })\n .join(\"&\");\n const __path = `${__root}/${`subscriptions`}`;\n return __queries ? `${__path}?${__queries}` : __path;\n};\n\n/**\n * 自分の購読している通知を取得する\n *\n */\nexport const findMySubscriptions = () => {\n const __root = root();\n const __queries = Object.entries({})\n .filter(([_, value]) => {\n return value !== undefined;\n })\n .map(([key, value]) => {\n return `${key}=${value}`;\n })\n .join(\"&\");\n const __path = `${__root}/${`subscriptions`}`;\n return __queries ? `${__path}?${__queries}` : __path;\n};\nexport const m2mNotifications_v1 = {\n healthCheck,\n registerNotification,\n findNotificationsByServiceId,\n updateNotificationStatus,\n saveSubscription,\n findMySubscriptions,\n};\n","import React, { createContext, useMemo } from \"react\";\n\ninterface ServiceIdContextState {\n serviceId: string;\n}\n\nconst ServiceIdContext = createContext<ServiceIdContextState | undefined>(\n undefined\n);\n\nexport const ServiceIdProvider = ({\n serviceId,\n children,\n}: {\n serviceId: string;\n children: React.ReactNode;\n}) => {\n const state = useMemo(() => ({ serviceId }), [serviceId]);\n\n return (\n <ServiceIdContext.Provider value={state}>\n {children}\n </ServiceIdContext.Provider>\n );\n};\n\nexport const useServiceId = () => {\n const context = React.useContext(ServiceIdContext);\n if (context === undefined) {\n throw new Error(\"useServiceId must be used within a ServiceIdProvider\");\n }\n return context.serviceId;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,gBAKO;;;ACFA,IAAM,OAAO,MAAM;AACxB,MAAI,SAAS;AAEb,MAAI,WAAW,uBAAuB,SAAS;AAC7C,aAAS;AAAA,EACX;AAEA,MAAI,WAAW,uBAAuB,YAAY;AAChD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O;AAAA,MACL;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,CAAC;AAE1C,QAAM,gCAA4B,uBAAQ,MAAM;AAzElD;AA0EI,WAAO;AAAA,MACL,gBAAe,oDAAe,SAAf,YAAuB,CAAC;AAAA,MACvC,YAAW,oDAAe,KAAK,MAAM,CAAC,MAAM,EAAE,WAAW,YAA9C,YAAyD;AAAA,MACpE,SAAS;AAAA,IACX;AAAA,EACF,GAAG,CAAC,sBAAsB,+CAAe,IAAI,CAAC;AAE9C,SACE,6CAAC,8BAA8B,UAA9B,EAAuC,OAAO,wBAC7C,uDAAC,qBAAqB,UAArB,EAA8B,OAAO,2BACnC,UACH,GACF;AAEJ;AAEO,IAAM,mBAAmB,MAAM;AACpC,QAAM,UAAM,0BAAW,oBAAoB;AAC3C,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,SAAO;AACT;AAEO,IAAM,4BAA4B,MAAM;AAC7C,QAAM,UAAM,0BAAW,6BAA6B;AACpD,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,SAAO;AACT;","names":["import_react","import_react","React","import_jsx_runtime"]}
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ import {
3
+ NotificationsProvider,
4
+ useNotificationPermission,
5
+ useNotifications
6
+ } from "../chunk-VNCVFELM.mjs";
7
+ import "../chunk-LDSJ6KYP.mjs";
8
+ import "../chunk-ISOF65DB.mjs";
9
+ import "../chunk-JUBOAWNR.mjs";
10
+ export {
11
+ NotificationsProvider,
12
+ useNotificationPermission,
13
+ useNotifications
14
+ };
15
+ //# sourceMappingURL=NotificationProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ declare const ServiceIdProvider: ({ serviceId, children, }: {
5
+ serviceId: string;
6
+ children: React.ReactNode;
7
+ }) => react_jsx_runtime.JSX.Element;
8
+ declare const useServiceId: () => string;
9
+
10
+ export { ServiceIdProvider, useServiceId };
@@ -1,7 +1,10 @@
1
- import React from "react";
2
- export declare const ServiceIdProvider: ({ serviceId, children, }: {
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ declare const ServiceIdProvider: ({ serviceId, children, }: {
3
5
  serviceId: string;
4
6
  children: React.ReactNode;
5
- }) => import("react/jsx-runtime").JSX.Element;
6
- export declare const useServiceId: () => string;
7
- //# sourceMappingURL=ServiceIdProvider.d.ts.map
7
+ }) => react_jsx_runtime.JSX.Element;
8
+ declare const useServiceId: () => string;
9
+
10
+ export { ServiceIdProvider, useServiceId };
@@ -1,24 +1,62 @@
1
- import React, { createContext, useMemo } from "react";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- var ServiceIdContext = /*#__PURE__*/createContext(undefined);
4
- export var ServiceIdProvider = _ref => {
5
- var {
6
- serviceId,
7
- children
8
- } = _ref;
9
- var state = useMemo(() => ({
10
- serviceId
11
- }), [serviceId]);
12
- return /*#__PURE__*/_jsx(ServiceIdContext.Provider, {
13
- value: state,
14
- children: children
15
- });
1
+ 'use client'
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
16
12
  };
17
- export var useServiceId = () => {
18
- var context = React.useContext(ServiceIdContext);
19
- if (context === undefined) {
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/notification/ServiceIdProvider.tsx
32
+ var ServiceIdProvider_exports = {};
33
+ __export(ServiceIdProvider_exports, {
34
+ ServiceIdProvider: () => ServiceIdProvider,
35
+ useServiceId: () => useServiceId
36
+ });
37
+ module.exports = __toCommonJS(ServiceIdProvider_exports);
38
+ var import_react = __toESM(require("react"));
39
+ var import_jsx_runtime = require("react/jsx-runtime");
40
+ var ServiceIdContext = (0, import_react.createContext)(
41
+ void 0
42
+ );
43
+ var ServiceIdProvider = ({
44
+ serviceId,
45
+ children
46
+ }) => {
47
+ const state = (0, import_react.useMemo)(() => ({ serviceId }), [serviceId]);
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ServiceIdContext.Provider, { value: state, children });
49
+ };
50
+ var useServiceId = () => {
51
+ const context = import_react.default.useContext(ServiceIdContext);
52
+ if (context === void 0) {
20
53
  throw new Error("useServiceId must be used within a ServiceIdProvider");
21
54
  }
22
55
  return context.serviceId;
23
56
  };
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ ServiceIdProvider,
60
+ useServiceId
61
+ });
24
62
  //# sourceMappingURL=ServiceIdProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceIdProvider.js","names":["React","createContext","useMemo","jsx","_jsx","ServiceIdContext","undefined","ServiceIdProvider","_ref","serviceId","children","state","Provider","value","useServiceId","context","useContext","Error"],"sources":["../src/notification/ServiceIdProvider.tsx"],"sourcesContent":["import React, { createContext, useMemo } from \"react\";\n\ninterface ServiceIdContextState {\n serviceId: string;\n}\n\nconst ServiceIdContext = createContext<ServiceIdContextState | undefined>(\n undefined\n);\n\nexport const ServiceIdProvider = ({\n serviceId,\n children,\n}: {\n serviceId: string;\n children: React.ReactNode;\n}) => {\n const state = useMemo(() => ({ serviceId }), [serviceId]);\n\n return (\n <ServiceIdContext.Provider value={state}>\n {children}\n </ServiceIdContext.Provider>\n );\n};\n\nexport const useServiceId = () => {\n const context = React.useContext(ServiceIdContext);\n if (context === undefined) {\n throw new Error(\"useServiceId must be used within a ServiceIdProvider\");\n }\n return context.serviceId;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMtD,IAAMC,gBAAgB,gBAAGJ,aAAa,CACpCK,SACF,CAAC;AAED,OAAO,IAAMC,iBAAiB,GAAGC,IAAA,IAM3B;EAAA,IAN4B;IAChCC,SAAS;IACTC;EAIF,CAAC,GAAAF,IAAA;EACC,IAAMG,KAAK,GAAGT,OAAO,CAAC,OAAO;IAAEO;EAAU,CAAC,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;EAEzD,oBACEL,IAAA,CAACC,gBAAgB,CAACO,QAAQ;IAACC,KAAK,EAAEF,KAAM;IAAAD,QAAA,EACrCA;EAAQ,CACgB,CAAC;AAEhC,CAAC;AAED,OAAO,IAAMI,YAAY,GAAGA,CAAA,KAAM;EAChC,IAAMC,OAAO,GAAGf,KAAK,CAACgB,UAAU,CAACX,gBAAgB,CAAC;EAClD,IAAIU,OAAO,KAAKT,SAAS,EAAE;IACzB,MAAM,IAAIW,KAAK,CAAC,sDAAsD,CAAC;EACzE;EACA,OAAOF,OAAO,CAACN,SAAS;AAC1B,CAAC"}
1
+ {"version":3,"sources":["../../src/notification/ServiceIdProvider.tsx"],"sourcesContent":["import React, { createContext, useMemo } from \"react\";\n\ninterface ServiceIdContextState {\n serviceId: string;\n}\n\nconst ServiceIdContext = createContext<ServiceIdContextState | undefined>(\n undefined\n);\n\nexport const ServiceIdProvider = ({\n serviceId,\n children,\n}: {\n serviceId: string;\n children: React.ReactNode;\n}) => {\n const state = useMemo(() => ({ serviceId }), [serviceId]);\n\n return (\n <ServiceIdContext.Provider value={state}>\n {children}\n </ServiceIdContext.Provider>\n );\n};\n\nexport const useServiceId = () => {\n const context = React.useContext(ServiceIdContext);\n if (context === undefined) {\n throw new Error(\"useServiceId must be used within a ServiceIdProvider\");\n }\n return context.serviceId;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8C;AAoB1C;AAdJ,IAAM,uBAAmB;AAAA,EACvB;AACF;AAEO,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AACF,MAGM;AACJ,QAAM,YAAQ,sBAAQ,OAAO,EAAE,UAAU,IAAI,CAAC,SAAS,CAAC;AAExD,SACE,4CAAC,iBAAiB,UAAjB,EAA0B,OAAO,OAC/B,UACH;AAEJ;AAEO,IAAM,eAAe,MAAM;AAChC,QAAM,UAAU,aAAAA,QAAM,WAAW,gBAAgB;AACjD,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACxE;AACA,SAAO,QAAQ;AACjB;","names":["React"]}
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ import {
3
+ ServiceIdProvider,
4
+ useServiceId
5
+ } from "../chunk-LDSJ6KYP.mjs";
6
+ import "../chunk-JUBOAWNR.mjs";
7
+ export {
8
+ ServiceIdProvider,
9
+ useServiceId
10
+ };
11
+ //# sourceMappingURL=ServiceIdProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,7 @@
1
+ import { Subscription } from './domain.mjs';
2
+
3
+ declare const requestUpdateNotificationStatusToRead: (token: string, id: string) => Promise<void>;
4
+ declare const requestSubscribe: (token: string, serviceId: string, input: Pick<Subscription, "notificationType" | "resourceSubscription">) => Promise<void>;
5
+ declare const requestUnSubscribe: (token: string, serviceId: string, input: Pick<Subscription, "notificationType" | "resourceSubscription">) => Promise<void>;
6
+
7
+ export { requestSubscribe, requestUnSubscribe, requestUpdateNotificationStatusToRead };
@@ -1,5 +1,7 @@
1
- import { Subscription } from "./domain";
2
- export declare const requestUpdateNotificationStatusToRead: (token: string, id: string) => Promise<void>;
3
- export declare const requestSubscribe: (token: string, serviceId: string, input: Pick<Subscription, "notificationType" | "resourceSubscription">) => Promise<void>;
4
- export declare const requestUnSubscribe: (token: string, serviceId: string, input: Pick<Subscription, "notificationType" | "resourceSubscription">) => Promise<void>;
5
- //# sourceMappingURL=api.d.ts.map
1
+ import { Subscription } from './domain.js';
2
+
3
+ declare const requestUpdateNotificationStatusToRead: (token: string, id: string) => Promise<void>;
4
+ declare const requestSubscribe: (token: string, serviceId: string, input: Pick<Subscription, "notificationType" | "resourceSubscription">) => Promise<void>;
5
+ declare const requestUnSubscribe: (token: string, serviceId: string, input: Pick<Subscription, "notificationType" | "resourceSubscription">) => Promise<void>;
6
+
7
+ export { requestSubscribe, requestUnSubscribe, requestUpdateNotificationStatusToRead };