@yusr_systems/core 2.2.3 → 2.2.4

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 (2) hide show
  1. package/dist/yusr-core.js +33 -194
  2. package/package.json +4 -1
package/dist/yusr-core.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { createSlice as e } from "@reduxjs/toolkit";
2
- import t from "react";
3
- import "react-dom";
2
+ import { toast as t } from "sonner";
4
3
  //#region src/auth/authConstants.ts
5
4
  var n = class {
6
5
  static LoggedInUserStorageItemName = "LoggedInUser";
@@ -135,167 +134,7 @@ var n = class {
135
134
  static initialize(e) {
136
135
  this._baseUrl = e;
137
136
  }
138
- };
139
- //#endregion
140
- //#region ../../node_modules/sonner/dist/index.mjs
141
- function _(e) {
142
- if (!e || typeof document > "u") return;
143
- let t = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
144
- n.type = "text/css", t.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e));
145
- }
146
- Array(12).fill(0);
147
- var v = 1, y = new class {
148
- constructor() {
149
- this.subscribe = (e) => (this.subscribers.push(e), () => {
150
- let t = this.subscribers.indexOf(e);
151
- this.subscribers.splice(t, 1);
152
- }), this.publish = (e) => {
153
- this.subscribers.forEach((t) => t(e));
154
- }, this.addToast = (e) => {
155
- this.publish(e), this.toasts = [...this.toasts, e];
156
- }, this.create = (e) => {
157
- let { message: t, ...n } = e, r = typeof e?.id == "number" || e.id?.length > 0 ? e.id : v++, i = this.toasts.find((e) => e.id === r), a = e.dismissible === void 0 ? !0 : e.dismissible;
158
- return this.dismissedToasts.has(r) && this.dismissedToasts.delete(r), i ? this.toasts = this.toasts.map((n) => n.id === r ? (this.publish({
159
- ...n,
160
- ...e,
161
- id: r,
162
- title: t
163
- }), {
164
- ...n,
165
- ...e,
166
- id: r,
167
- dismissible: a,
168
- title: t
169
- }) : n) : this.addToast({
170
- title: t,
171
- ...n,
172
- dismissible: a,
173
- id: r
174
- }), r;
175
- }, this.dismiss = (e) => (e ? (this.dismissedToasts.add(e), requestAnimationFrame(() => this.subscribers.forEach((t) => t({
176
- id: e,
177
- dismiss: !0
178
- })))) : this.toasts.forEach((e) => {
179
- this.subscribers.forEach((t) => t({
180
- id: e.id,
181
- dismiss: !0
182
- }));
183
- }), e), this.message = (e, t) => this.create({
184
- ...t,
185
- message: e
186
- }), this.error = (e, t) => this.create({
187
- ...t,
188
- message: e,
189
- type: "error"
190
- }), this.success = (e, t) => this.create({
191
- ...t,
192
- type: "success",
193
- message: e
194
- }), this.info = (e, t) => this.create({
195
- ...t,
196
- type: "info",
197
- message: e
198
- }), this.warning = (e, t) => this.create({
199
- ...t,
200
- type: "warning",
201
- message: e
202
- }), this.loading = (e, t) => this.create({
203
- ...t,
204
- type: "loading",
205
- message: e
206
- }), this.promise = (e, n) => {
207
- if (!n) return;
208
- let r;
209
- n.loading !== void 0 && (r = this.create({
210
- ...n,
211
- promise: e,
212
- type: "loading",
213
- message: n.loading,
214
- description: typeof n.description == "function" ? void 0 : n.description
215
- }));
216
- let i = Promise.resolve(e instanceof Function ? e() : e), a = r !== void 0, o, s = i.then(async (e) => {
217
- if (o = ["resolve", e], t.isValidElement(e)) a = !1, this.create({
218
- id: r,
219
- type: "default",
220
- message: e
221
- });
222
- else if (x(e) && !e.ok) {
223
- a = !1;
224
- let i = typeof n.error == "function" ? await n.error(`HTTP error! status: ${e.status}`) : n.error, o = typeof n.description == "function" ? await n.description(`HTTP error! status: ${e.status}`) : n.description, s = typeof i == "object" && !t.isValidElement(i) ? i : { message: i };
225
- this.create({
226
- id: r,
227
- type: "error",
228
- description: o,
229
- ...s
230
- });
231
- } else if (e instanceof Error) {
232
- a = !1;
233
- let i = typeof n.error == "function" ? await n.error(e) : n.error, o = typeof n.description == "function" ? await n.description(e) : n.description, s = typeof i == "object" && !t.isValidElement(i) ? i : { message: i };
234
- this.create({
235
- id: r,
236
- type: "error",
237
- description: o,
238
- ...s
239
- });
240
- } else if (n.success !== void 0) {
241
- a = !1;
242
- let i = typeof n.success == "function" ? await n.success(e) : n.success, o = typeof n.description == "function" ? await n.description(e) : n.description, s = typeof i == "object" && !t.isValidElement(i) ? i : { message: i };
243
- this.create({
244
- id: r,
245
- type: "success",
246
- description: o,
247
- ...s
248
- });
249
- }
250
- }).catch(async (e) => {
251
- if (o = ["reject", e], n.error !== void 0) {
252
- a = !1;
253
- let i = typeof n.error == "function" ? await n.error(e) : n.error, o = typeof n.description == "function" ? await n.description(e) : n.description, s = typeof i == "object" && !t.isValidElement(i) ? i : { message: i };
254
- this.create({
255
- id: r,
256
- type: "error",
257
- description: o,
258
- ...s
259
- });
260
- }
261
- }).finally(() => {
262
- a && (this.dismiss(r), r = void 0), n.finally == null || n.finally.call(n);
263
- }), c = () => new Promise((e, t) => s.then(() => o[0] === "reject" ? t(o[1]) : e(o[1])).catch(t));
264
- return typeof r != "string" && typeof r != "number" ? { unwrap: c } : Object.assign(r, { unwrap: c });
265
- }, this.custom = (e, t) => {
266
- let n = t?.id || v++;
267
- return this.create({
268
- jsx: e(n),
269
- id: n,
270
- ...t
271
- }), n;
272
- }, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
273
- }
274
- }(), b = (e, t) => {
275
- let n = t?.id || v++;
276
- return y.addToast({
277
- title: e,
278
- ...t,
279
- id: n
280
- }), n;
281
- }, x = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", S = Object.assign(b, {
282
- success: y.success,
283
- info: y.info,
284
- warning: y.warning,
285
- error: y.error,
286
- custom: y.custom,
287
- message: y.message,
288
- promise: y.promise,
289
- dismiss: y.dismiss,
290
- loading: y.loading
291
- }, {
292
- getHistory: () => y.toasts,
293
- getToasts: () => y.getActiveToasts()
294
- });
295
- _("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
296
- //#endregion
297
- //#region src/networking/services/yusrApiHelper.ts
298
- var C = class e {
137
+ }, _ = class e {
299
138
  static async Get(t, n) {
300
139
  let r = await fetch(t, {
301
140
  method: "GET",
@@ -338,72 +177,72 @@ var C = class e {
338
177
  });
339
178
  return e.handleResponse(i, r);
340
179
  }
341
- static async PostBlob(e, t, n) {
342
- let r = t instanceof FormData, i = {
343
- ...n?.headers || {},
344
- ...!r && t ? { "Content-Type": "application/json" } : {}
345
- }, a = await fetch(e, {
180
+ static async PostBlob(e, n, r) {
181
+ let i = n instanceof FormData, a = {
182
+ ...r?.headers || {},
183
+ ...!i && n ? { "Content-Type": "application/json" } : {}
184
+ }, o = await fetch(e, {
346
185
  method: "POST",
347
186
  credentials: "include",
348
- headers: i,
349
- body: r ? t : JSON.stringify(t),
350
- ...n
187
+ headers: a,
188
+ body: i ? n : JSON.stringify(n),
189
+ ...r
351
190
  });
352
- if (!a.ok) {
353
- let e = await a.json();
354
- S.error(e.title || "حدث خطأ أثناء تحميل التقرير", { description: e.detail || "يرجى المحاولة مرة أخرى لاحقاً" });
191
+ if (!o.ok) {
192
+ let e = await o.json();
193
+ t.error(e.title || "حدث خطأ أثناء تحميل التقرير", { description: e.detail || "يرجى المحاولة مرة أخرى لاحقاً" });
355
194
  return;
356
195
  }
357
- return await a.blob();
196
+ return await o.blob();
358
197
  }
359
- static async handleResponse(e, t) {
360
- if (e.status === 401) return window.dispatchEvent(new Event(n.UnauthorizedEventName)), S.error("انتهت صلاحية الدخول", { description: "سجل الدخول مجددًا." }), {
198
+ static async handleResponse(e, r) {
199
+ if (e.status === 401) return window.dispatchEvent(new Event(n.UnauthorizedEventName)), t.error("انتهت صلاحية الدخول", { description: "سجل الدخول مجددًا." }), {
361
200
  data: void 0,
362
201
  status: 401,
363
202
  errorTitle: "Unauthorized",
364
203
  errorDetails: "Session expired"
365
204
  };
366
- if (e.status === 404) return S.error("لم يتم العثور على طلبك"), {
205
+ if (e.status === 404) return t.error("لم يتم العثور على طلبك"), {
367
206
  data: void 0,
368
207
  status: 404,
369
208
  errorTitle: "Not Found",
370
209
  errorDetails: ""
371
210
  };
372
211
  if (!e.ok) {
373
- let t = await e.json();
374
- return S.error(t.title || "An error occurred", { description: t.detail }), {
212
+ let n = await e.json();
213
+ return t.error(n.title || "An error occurred", { description: n.detail }), {
375
214
  data: void 0,
376
215
  status: e.status,
377
- errorTitle: t.title,
378
- errorDetails: t.detail
216
+ errorTitle: n.title,
217
+ errorDetails: n.detail
379
218
  };
380
219
  }
381
- let r = await e.json();
382
- return t && S.success(t), {
383
- data: r,
220
+ let i = await e.json();
221
+ return r && t.success(r), {
222
+ data: i,
384
223
  status: e.status,
385
224
  errorTitle: "",
386
225
  errorDetails: ""
387
226
  };
388
227
  }
389
- }, w = class {
228
+ }, v = class {
390
229
  async Filter(e, t, n) {
391
- return await C.Post(`${g.baseUrl}/${this.routeName}/Filter?pageNumber=${e}&rowsPerPage=${t}`, n);
230
+ return await _.Post(`${g.baseUrl}/${this.routeName}/Filter?pageNumber=${e}&rowsPerPage=${t}`, n);
392
231
  }
393
- }, T = class extends w {
232
+ }, y = class extends v {
394
233
  async Get(e) {
395
- return await C.Get(`${g.baseUrl}/${this.routeName}/${e}`);
234
+ return await _.Get(`${g.baseUrl}/${this.routeName}/${e}`);
396
235
  }
397
236
  async Add(e) {
398
- return await C.Post(`${g.baseUrl}/${this.routeName}/Add`, e, void 0, "تم حفظ البيانات بنجاح");
237
+ return await _.Post(`${g.baseUrl}/${this.routeName}/Add`, e, void 0, "تم حفظ البيانات بنجاح");
399
238
  }
400
239
  async Update(e) {
401
- return await C.Put(`${g.baseUrl}/${this.routeName}/Update`, e, void 0, "تم تحديث المعلومات بنجاح");
240
+ return await _.Put(`${g.baseUrl}/${this.routeName}/Update`, e, void 0, "تم تحديث المعلومات بنجاح");
402
241
  }
403
242
  async Delete(e) {
404
- return await C.Delete(`${g.baseUrl}/${this.routeName}/${e}`, void 0, "تمت إزالة السجل بنجاح");
243
+ return await _.Delete(`${g.baseUrl}/${this.routeName}/${e}`, void 0, "تمت إزالة السجل بنجاح");
405
244
  }
406
- }, E = class {
245
+ }, b = class {
407
246
  static required(e = "هذا الحقل مطلوب") {
408
247
  return (t) => t == null || t === "" || typeof t == "string" && t.trim() === "" ? e : null;
409
248
  }
@@ -421,4 +260,4 @@ var C = class e {
421
260
  }
422
261
  };
423
262
  //#endregion
424
- export { g as ApiConstants, n as AuthConstants, T as BaseApiService, o as BaseEntity, w as BaseFilterableApiService, s as City, c as CityFilterColumns, l as Country, u as CountryFilterColumns, d as Currency, f as FilterCondition, p as LoginRequest, m as StorageFile, h as StorageFileStatus, a as SystemPermissions, E as Validators, C as YusrApiHelper, i as createAuthSlice };
263
+ export { g as ApiConstants, n as AuthConstants, y as BaseApiService, o as BaseEntity, v as BaseFilterableApiService, s as City, c as CityFilterColumns, l as Country, u as CountryFilterColumns, d as Currency, f as FilterCondition, p as LoginRequest, m as StorageFile, h as StorageFileStatus, a as SystemPermissions, b as Validators, _ as YusrApiHelper, i as createAuthSlice };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yusr_systems/core",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -25,6 +25,9 @@
25
25
  "build": "tsc --noEmit && vite build",
26
26
  "preview": "vite preview"
27
27
  },
28
+ "peerDependencies": {
29
+ "sonner": "^2.0.7"
30
+ },
28
31
  "devDependencies": {
29
32
  "typescript": "~5.9.3",
30
33
  "vite": "^8.0.0",