@nizza/core 0.1.0 → 0.1.1-beta.2

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.
@@ -1,15 +1,15 @@
1
1
  export declare const environment: {
2
2
  AWS: {
3
- region: string | undefined;
3
+ region: any;
4
4
  cognito: {
5
5
  userPoolId: string;
6
6
  userPoolWebClientId: string;
7
7
  };
8
8
  };
9
9
  apiUrls: {
10
- restV1: string;
11
- restV2: string;
12
- graphql: string;
10
+ restV1: any;
11
+ restV2: any;
12
+ graphql: any;
13
13
  };
14
14
  publicUrls: {
15
15
  platformSite: string;
package/dist/index.es.js CHANGED
@@ -1,12 +1,484 @@
1
- var P=Object.defineProperty;var V=(e,n,i)=>n in e?P(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i;var s=(e,n,i)=>(V(e,typeof n!="symbol"?n+"":n,i),i);import U,{createContext as G,useContext as C,useMemo as M,lazy as q,Suspense as $}from"react";class h{constructor(n){s(this,"aggregate");s(this,"_numSetPropsApplied",0);this.aggregate=n}setProps(n){for(const[i,a]of Object.entries(n))i in this.aggregate&&(this.aggregate[i]=a);this._numSetPropsApplied++}get isFirstSetProps(){return this._numSetPropsApplied===1}}class c extends Error{constructor(n,i,a){super(i),this.message=i,this.value=a,this.name=n}toDTO(){return{name:this.name,message:this.message,...this.value&&{value:this.value}}}}class L extends c{constructor(n){super("RESOURCE_NOT_FOUND_ERROR",`Resource with id '${n}' not found.`,n)}}class z extends c{constructor(n){var i;super("APP_UNEXPECTED_ERROR",(i=n.message)!=null?i:"An unexpected error occurred.",n)}}class B extends c{constructor(){super("APP_ACCOUNT_INVALID_ERROR","Account not defined")}}var b={exports:{}},u={};/*
1
+ var V = Object.defineProperty;
2
+ var U = (n, e, i) => e in n ? V(n, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[e] = i;
3
+ var s = (n, e, i) => (U(n, typeof e != "symbol" ? e + "" : e, i), i);
4
+ import G, { createContext as L, useContext as I, useMemo as M, lazy as q, Suspense as z } from "react";
5
+ class $ {
6
+ constructor(e) {
7
+ s(this, "aggregate");
8
+ s(this, "_numSetPropsApplied", 0);
9
+ this.aggregate = e;
10
+ }
11
+ setProps(e) {
12
+ for (const [i, a] of Object.entries(e))
13
+ i in this.aggregate && (this.aggregate[i] = a);
14
+ this._numSetPropsApplied++;
15
+ }
16
+ get isFirstSetProps() {
17
+ return this._numSetPropsApplied === 1;
18
+ }
19
+ }
20
+ class y extends Error {
21
+ constructor(e, i, a) {
22
+ super(i), this.value = a, this.name = e;
23
+ }
24
+ toDTO() {
25
+ return {
26
+ name: this.name,
27
+ message: this.message,
28
+ ...this.value && { value: this.value }
29
+ };
30
+ }
31
+ }
32
+ class Se extends y {
33
+ constructor(e) {
34
+ super(
35
+ "RESOURCE_NOT_FOUND_ERROR",
36
+ `Resource with id '${e}' not found.`,
37
+ e
38
+ );
39
+ }
40
+ }
41
+ class ge extends y {
42
+ constructor(e) {
43
+ var i;
44
+ super(
45
+ "APP_UNEXPECTED_ERROR",
46
+ (i = e.message) != null ? i : "An unexpected error occurred.",
47
+ e
48
+ );
49
+ }
50
+ }
51
+ class ye extends y {
52
+ constructor() {
53
+ super("APP_ACCOUNT_INVALID_ERROR", "Account not defined");
54
+ }
55
+ }
56
+ var _ = { exports: {} }, u = {};
57
+ /*
2
58
  object-assign
3
59
  (c) Sindre Sorhus
4
60
  @license MIT
5
- */var E=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;function X(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function J(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var n={},i=0;i<10;i++)n["_"+String.fromCharCode(i)]=i;var a=Object.getOwnPropertyNames(n).map(function(d){return n[d]});if(a.join("")!=="0123456789")return!1;var t={};return"abcdefghijklmnopqrst".split("").forEach(function(d){t[d]=d}),Object.keys(Object.assign({},t)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}J();/** @license React v17.0.2
61
+ */
62
+ var h = Object.getOwnPropertySymbols, W = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
63
+ function Q(n) {
64
+ if (n == null)
65
+ throw new TypeError("Object.assign cannot be called with null or undefined");
66
+ return Object(n);
67
+ }
68
+ function J() {
69
+ try {
70
+ if (!Object.assign)
71
+ return !1;
72
+ var n = new String("abc");
73
+ if (n[5] = "de", Object.getOwnPropertyNames(n)[0] === "5")
74
+ return !1;
75
+ for (var e = {}, i = 0; i < 10; i++)
76
+ e["_" + String.fromCharCode(i)] = i;
77
+ var a = Object.getOwnPropertyNames(e).map(function(d) {
78
+ return e[d];
79
+ });
80
+ if (a.join("") !== "0123456789")
81
+ return !1;
82
+ var t = {};
83
+ return "abcdefghijklmnopqrst".split("").forEach(function(d) {
84
+ t[d] = d;
85
+ }), Object.keys(Object.assign({}, t)).join("") === "abcdefghijklmnopqrst";
86
+ } catch {
87
+ return !1;
88
+ }
89
+ }
90
+ J();
91
+ /** @license React v17.0.2
6
92
  * react-jsx-runtime.production.min.js
7
93
  *
8
94
  * Copyright (c) Facebook, Inc. and its affiliates.
9
95
  *
10
96
  * This source code is licensed under the MIT license found in the
11
97
  * LICENSE file in the root directory of this source tree.
12
- */var W=U,O=60103;if(u.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var D=Symbol.for;O=D("react.element"),u.Fragment=D("react.fragment")}var Y=W.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Z=Object.prototype.hasOwnProperty,K={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,i){var a,t={},d=null,l=null;i!==void 0&&(d=""+i),n.key!==void 0&&(d=""+n.key),n.ref!==void 0&&(l=n.ref);for(a in n)Z.call(n,a)&&!K.hasOwnProperty(a)&&(t[a]=n[a]);if(e&&e.defaultProps)for(a in n=e.defaultProps,n)t[a]===void 0&&(t[a]=n[a]);return{$$typeof:O,type:e,key:d,ref:l,props:t,_owner:Y.current}}u.jsx=T,u.jsxs=T,b.exports=u;const f=b.exports.jsx;let S=new Map;const g=G(S),ee=({children:e,stores:n})=>{const i=C(g),a=M(()=>{if(!n.length)return i;const t=new Map;return n.forEach(d=>{let l;try{l=d()}catch{l=new d}t.set(d,l)}),S=new Map([...i,...t])},[n]);return f(g.Provider,{value:a,children:e})};function ne(e){return C(g).get(e)}function ie(e){return S.get(e)}var I=(e=>(e.Add="add",e.Remove="remove",e))(I||{}),_=(e=>(e.Active="active",e.Inactive="inactive",e))(_||{});const ae={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"AddCollection"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CreateCollectionInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createCollection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"data"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"CollectionSuccess"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Error"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ErrorGeneral"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}}]}}]}}]},te={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteCollection"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"QueryInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deleteCollection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"data"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Error"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ErrorGeneral"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}}]}}]}}]},de={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"FindCollection"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"QueryInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"findCollection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"data"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"CollectionSuccess"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"account"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"createdat"}},{kind:"Field",name:{kind:"Name",value:"products"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"account"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"link"}},{kind:"Field",name:{kind:"Name",value:"pictures"}},{kind:"Field",name:{kind:"Name",value:"price"}},{kind:"Field",name:{kind:"Name",value:"salesprice"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"createdat"}}]}}]}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Error"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ErrorGeneral"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}}]}}]}}]},le={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"GetAllCollections"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"QueryInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"getAllCollection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"data"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"CollectionSuccessArray"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"account"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"createdat"}},{kind:"Field",name:{kind:"Name",value:"products"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"account"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"link"}},{kind:"Field",name:{kind:"Name",value:"pictures"}},{kind:"Field",name:{kind:"Name",value:"price"}},{kind:"Field",name:{kind:"Name",value:"salesprice"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"createdat"}}]}}]}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Error"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ErrorGeneral"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}}]}}]}}]},oe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"ManageCollectionProduct"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ManageCollectionProductInInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"manageCollectionProduct"},arguments:[{kind:"Argument",name:{kind:"Name",value:"data"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Error"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ErrorGeneral"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}}]}}]}}]},re={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SearchCollections"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"QueryInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"searchCollection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"data"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"CollectionSuccessArray"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"account"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"createdat"}},{kind:"Field",name:{kind:"Name",value:"products"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"account"}},{kind:"Field",name:{kind:"Name",value:"title"}},{kind:"Field",name:{kind:"Name",value:"link"}},{kind:"Field",name:{kind:"Name",value:"pictures"}},{kind:"Field",name:{kind:"Name",value:"price"}},{kind:"Field",name:{kind:"Name",value:"salesprice"}},{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"createdat"}}]}}]}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Error"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ErrorGeneral"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}}]}}]}}]},me={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateCollection"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"data"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UpdateCollectionInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateCollection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"data"},value:{kind:"Variable",name:{kind:"Name",value:"data"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename"}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Error"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}},{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"ErrorGeneral"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"statusCode"}},{kind:"Field",name:{kind:"Name",value:"timestamp"}}]}}]}}]}}]};var se=Object.freeze(Object.defineProperty({__proto__:null,Methods:I,Status:_,AddCollectionDocument:ae,DeleteCollectionDocument:te,FindCollectionDocument:de,GetAllCollectionsDocument:le,ManageCollectionProductDocument:oe,SearchCollectionsDocument:re,UpdateCollectionDocument:me},Symbol.toStringTag,{value:"Module"}));async function ue({url:e,method:n="GET",raw:i=!1,...a}){var r;const t={"Content-Type":"application/json",...a.headers},d=await fetch(e,{method:n,...a,headers:t});if(i)return d;const l=await d.json();if(!d.ok){const m=(r=l==null?void 0:l.message)!=null?r:d.statusText;throw new Error(m)}return l}function ke(e=8){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";const a=n.length;for(let t=0;t<e;t++)i+=n.charAt(Math.floor(Math.random()*a));return i}function ce(e){return new h(e)}const ve=e=>{const n=Object.entries(e).map(([i,a])=>`${i}=${a}`).join("&");return n?`?${n}`:""},pe=(e,n,i={fallback:null})=>{let a=e;n&&(a=()=>e().then(d=>({default:n(d)})));const t=q(a);return d=>f($,{fallback:i.fallback,children:f(t,{...d})})};class k{constructor(n,i,a){s(this,"isOk");s(this,"isErr");s(this,"error");s(this,"_value");if(n&&i)throw new Error("InvalidOperation: A result cannot be successful and contain an error");if(!n&&!i)throw new Error("InvalidOperation: A failing result needs to contain an error message");this.isOk=n,this.isErr=!n,this.error=i,this._value=a,Object.freeze(this)}get value(){if(this.isErr)throw new Error("Can't get the value of an error result. Use 'errorValue' instead.");return this._value}static ok(n){return new k(!0,void 0,n)}static fail(n){return new k(!1,n)}static combine(n){for(const i of n)if(i.isErr)return i;return k.ok()}}class w{constructor(n){s(this,"value");this.value=n}isErr(){return!0}isOk(){return!1}}class A{constructor(n){s(this,"value");this.value=n}isErr(){return!1}isOk(){return!0}}const Ne=e=>new w(e),fe=e=>new A(e);/*! js-cookie v3.0.1 | MIT */function v(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var a in i)e[a]=i[a]}return e}var Se={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function F(e,n){function i(t,d,l){if(typeof document!="undefined"){l=v({},n,l),typeof l.expires=="number"&&(l.expires=new Date(Date.now()+l.expires*864e5)),l.expires&&(l.expires=l.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var r="";for(var m in l)!l[m]||(r+="; "+m,l[m]!==!0&&(r+="="+l[m].split(";")[0]));return document.cookie=t+"="+e.write(d,t)+r}}function a(t){if(!(typeof document=="undefined"||arguments.length&&!t)){for(var d=document.cookie?document.cookie.split("; "):[],l={},r=0;r<d.length;r++){var m=d[r].split("="),x=m.slice(1).join("=");try{var N=decodeURIComponent(m[0]);if(l[N]=e.read(x,N),t===N)break}catch{}}return t?l[t]:l}}return Object.create({set:i,get:a,remove:function(t,d){i(t,"",v({},d,{expires:-1}))},withAttributes:function(t){return F(this.converter,v({},this.attributes,t))},withConverter:function(t){return F(v({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(e)}})}var j=F(Se,{path:"/"}),p,ge=new Uint8Array(16);function Fe(){if(!p&&(p=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!p))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return p(ge)}var ye=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ce(e){return typeof e=="string"&&ye.test(e)}for(var o=[],y=0;y<256;++y)o.push((y+256).toString(16).substr(1));function he(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=(o[e[n+0]]+o[e[n+1]]+o[e[n+2]]+o[e[n+3]]+"-"+o[e[n+4]]+o[e[n+5]]+"-"+o[e[n+6]]+o[e[n+7]]+"-"+o[e[n+8]]+o[e[n+9]]+"-"+o[e[n+10]]+o[e[n+11]]+o[e[n+12]]+o[e[n+13]]+o[e[n+14]]+o[e[n+15]]).toLowerCase();if(!Ce(i))throw TypeError("Stringified UUID is invalid");return i}function be(e,n,i){e=e||{};var a=e.random||(e.rng||Fe)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,n){i=i||0;for(var t=0;t<16;++t)n[i+t]=a[t];return n}return he(a)}const R="FINGERPRINT_LIVE_SHOPPING",Ee=()=>{let e=j.get(R);return e||(e=be(),j.set(R,e,{expires:1}),e)};export{B as AccountInvalidError,h as AggregateRoot,se as ApiGraphqlTypes,c as DomainError,w as Err,A as Ok,L as ResourceNotFoundError,k as Result,ee as StoreProvider,z as UnexpectedError,ue as apiCall,ce as createAggregateRoot,fe as err,Ee as getFingerprint,ie as getStore,pe as lazyLoad,Ne as ok,ve as searchParams,ke as shortId,ne as useStore};
98
+ */
99
+ var H = G, D = 60103;
100
+ u.Fragment = 60107;
101
+ if (typeof Symbol == "function" && Symbol.for) {
102
+ var C = Symbol.for;
103
+ D = C("react.element"), u.Fragment = C("react.fragment");
104
+ }
105
+ var X = H.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Y = Object.prototype.hasOwnProperty, Z = { key: !0, ref: !0, __self: !0, __source: !0 };
106
+ function A(n, e, i) {
107
+ var a, t = {}, d = null, o = null;
108
+ i !== void 0 && (d = "" + i), e.key !== void 0 && (d = "" + e.key), e.ref !== void 0 && (o = e.ref);
109
+ for (a in e)
110
+ Y.call(e, a) && !Z.hasOwnProperty(a) && (t[a] = e[a]);
111
+ if (n && n.defaultProps)
112
+ for (a in e = n.defaultProps, e)
113
+ t[a] === void 0 && (t[a] = e[a]);
114
+ return { $$typeof: D, type: n, key: d, ref: o, props: t, _owner: X.current };
115
+ }
116
+ u.jsx = A;
117
+ u.jsxs = A;
118
+ (function(n) {
119
+ n.exports = u;
120
+ })(_);
121
+ const f = _.exports.jsx;
122
+ let F = /* @__PURE__ */ new Map();
123
+ const S = L(F), Fe = ({
124
+ children: n,
125
+ stores: e
126
+ }) => {
127
+ const i = I(S), a = M(() => {
128
+ if (!e.length)
129
+ return i;
130
+ const t = /* @__PURE__ */ new Map();
131
+ return e.forEach((d) => {
132
+ let o;
133
+ try {
134
+ o = d();
135
+ } catch {
136
+ o = new d();
137
+ }
138
+ t.set(d, o);
139
+ }), F = new Map([...i, ...t]);
140
+ }, [e]);
141
+ return /* @__PURE__ */ f(S.Provider, {
142
+ value: a,
143
+ children: n
144
+ });
145
+ };
146
+ function he(n) {
147
+ return I(S).get(n);
148
+ }
149
+ function Ce(n) {
150
+ return F.get(n);
151
+ }
152
+ var j = /* @__PURE__ */ ((n) => (n.Add = "add", n.Remove = "remove", n))(j || {}), x = /* @__PURE__ */ ((n) => (n.Active = "active", n.Inactive = "inactive", n))(x || {});
153
+ const K = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "AddCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CreateCollectionInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "createCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, ee = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "DeleteCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "deleteCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, ne = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FindCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "findCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccess" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, ie = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "GetAllCollections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "getAllCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, ae = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "ManageCollectionProduct" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ManageCollectionProductInInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "manageCollectionProduct" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, te = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "SearchCollections" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "QueryInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "searchCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CollectionSuccessArray" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "data" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", name: { kind: "Name", value: "description" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }, { kind: "Field", name: { kind: "Name", value: "products" }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", name: { kind: "Name", value: "account" } }, { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", name: { kind: "Name", value: "link" } }, { kind: "Field", name: { kind: "Name", value: "pictures" } }, { kind: "Field", name: { kind: "Name", value: "price" } }, { kind: "Field", name: { kind: "Name", value: "salesprice" } }, { kind: "Field", name: { kind: "Name", value: "status" } }, { kind: "Field", name: { kind: "Name", value: "createdat" } }] } }] } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, de = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCollection" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "UpdateCollectionInput" } } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCollection" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "__typename" } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Error" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }, { kind: "InlineFragment", typeCondition: { kind: "NamedType", name: { kind: "Name", value: "ErrorGeneral" } }, selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "message" } }, { kind: "Field", name: { kind: "Name", value: "statusCode" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }] } }] } }] } }] }, be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154
+ __proto__: null,
155
+ Methods: j,
156
+ Status: x,
157
+ AddCollectionDocument: K,
158
+ DeleteCollectionDocument: ee,
159
+ FindCollectionDocument: ne,
160
+ GetAllCollectionsDocument: ie,
161
+ ManageCollectionProductDocument: ae,
162
+ SearchCollectionsDocument: te,
163
+ UpdateCollectionDocument: de
164
+ }, Symbol.toStringTag, { value: "Module" }));
165
+ async function we({
166
+ url: n,
167
+ method: e = "GET",
168
+ raw: i = !1,
169
+ ...a
170
+ }) {
171
+ var l;
172
+ const t = {
173
+ "Content-Type": "application/json",
174
+ ...a.headers
175
+ }, d = await fetch(n, { method: e, ...a, headers: t });
176
+ if (i)
177
+ return d;
178
+ const o = await d.json();
179
+ if (!d.ok) {
180
+ const m = (l = o == null ? void 0 : o.message) != null ? l : d.statusText;
181
+ throw new Error(m);
182
+ }
183
+ return o;
184
+ }
185
+ class b {
186
+ constructor() {
187
+ s(this, "store");
188
+ this.store = this.getStoreFromWindow();
189
+ }
190
+ getStoreFromWindow() {
191
+ let e = {};
192
+ try {
193
+ e = JSON.parse(window.self.name);
194
+ } catch {
195
+ return {};
196
+ }
197
+ return e && typeof e == "object" ? e : {};
198
+ }
199
+ setStoreToWindow(e) {
200
+ const i = JSON.stringify(e);
201
+ window.self.name = i;
202
+ }
203
+ setItem(e, i) {
204
+ this.store[e] = i, this.setStoreToWindow(this.store);
205
+ }
206
+ getItem(e) {
207
+ var i;
208
+ return (i = this.store[e]) != null ? i : null;
209
+ }
210
+ removeItem(e) {
211
+ delete this.store[e], this.setStoreToWindow(this.store);
212
+ }
213
+ clear() {
214
+ this.setStoreToWindow({});
215
+ }
216
+ key(e) {
217
+ var a;
218
+ return (a = Object.keys(this.store)[e]) != null ? a : null;
219
+ }
220
+ get length() {
221
+ return Object.keys(this.store).length;
222
+ }
223
+ }
224
+ function w(n) {
225
+ try {
226
+ const e = window[n], i = "__custom-storage__";
227
+ return e.setItem(i, i), e.removeItem(i), !0;
228
+ } catch {
229
+ return !1;
230
+ }
231
+ }
232
+ function O(n, e, i) {
233
+ const a = {
234
+ configurable: !1,
235
+ enumerable: !1,
236
+ writable: !1
237
+ };
238
+ typeof i < "u" && (a.value = i), Object.defineProperty(n, e, a);
239
+ }
240
+ class R {
241
+ static init() {
242
+ return new R();
243
+ }
244
+ constructor() {
245
+ window.top === window.self ? console.log("[CustomStorage] This is the main window") : console.log("[CustomStorage] This is NOT the main window"), this.replaceStorages();
246
+ }
247
+ replaceStorages() {
248
+ if (!this.isAvailable.localStorage) {
249
+ const e = new b();
250
+ O(window, "localStorage", e), console.log(
251
+ "[CustomStorage] LocalStorage is not available, custom implementation is defined"
252
+ );
253
+ }
254
+ if (!this.isAvailable.sessionStorage) {
255
+ const e = new b();
256
+ O(window, "sessionStorage", e), console.log(
257
+ "[CustomStorage] SessionStorage is not available, custom implementation is defined"
258
+ );
259
+ }
260
+ }
261
+ get isAvailable() {
262
+ return {
263
+ localStorage: w("localStorage"),
264
+ sessionStorage: w("sessionStorage")
265
+ };
266
+ }
267
+ }
268
+ /*! js-cookie v3.0.1 | MIT */
269
+ function c(n) {
270
+ for (var e = 1; e < arguments.length; e++) {
271
+ var i = arguments[e];
272
+ for (var a in i)
273
+ n[a] = i[a];
274
+ }
275
+ return n;
276
+ }
277
+ var oe = {
278
+ read: function(n) {
279
+ return n[0] === '"' && (n = n.slice(1, -1)), n.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
280
+ },
281
+ write: function(n) {
282
+ return encodeURIComponent(n).replace(
283
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
284
+ decodeURIComponent
285
+ );
286
+ }
287
+ };
288
+ function g(n, e) {
289
+ function i(t, d, o) {
290
+ if (!(typeof document > "u")) {
291
+ o = c({}, e, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), t = encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
292
+ var l = "";
293
+ for (var m in o)
294
+ !o[m] || (l += "; " + m, o[m] !== !0 && (l += "=" + o[m].split(";")[0]));
295
+ return document.cookie = t + "=" + n.write(d, t) + l;
296
+ }
297
+ }
298
+ function a(t) {
299
+ if (!(typeof document > "u" || arguments.length && !t)) {
300
+ for (var d = document.cookie ? document.cookie.split("; ") : [], o = {}, l = 0; l < d.length; l++) {
301
+ var m = d[l].split("="), P = m.slice(1).join("=");
302
+ try {
303
+ var p = decodeURIComponent(m[0]);
304
+ if (o[p] = n.read(P, p), t === p)
305
+ break;
306
+ } catch {
307
+ }
308
+ }
309
+ return t ? o[t] : o;
310
+ }
311
+ }
312
+ return Object.create(
313
+ {
314
+ set: i,
315
+ get: a,
316
+ remove: function(t, d) {
317
+ i(
318
+ t,
319
+ "",
320
+ c({}, d, {
321
+ expires: -1
322
+ })
323
+ );
324
+ },
325
+ withAttributes: function(t) {
326
+ return g(this.converter, c({}, this.attributes, t));
327
+ },
328
+ withConverter: function(t) {
329
+ return g(c({}, this.converter, t), this.attributes);
330
+ }
331
+ },
332
+ {
333
+ attributes: { value: Object.freeze(e) },
334
+ converter: { value: Object.freeze(n) }
335
+ }
336
+ );
337
+ }
338
+ var E = g(oe, { path: "/" }), k, le = new Uint8Array(16);
339
+ function re() {
340
+ if (!k && (k = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto), !k))
341
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
342
+ return k(le);
343
+ }
344
+ const se = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
345
+ function me(n) {
346
+ return typeof n == "string" && se.test(n);
347
+ }
348
+ var r = [];
349
+ for (var N = 0; N < 256; ++N)
350
+ r.push((N + 256).toString(16).substr(1));
351
+ function ue(n) {
352
+ var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, i = (r[n[e + 0]] + r[n[e + 1]] + r[n[e + 2]] + r[n[e + 3]] + "-" + r[n[e + 4]] + r[n[e + 5]] + "-" + r[n[e + 6]] + r[n[e + 7]] + "-" + r[n[e + 8]] + r[n[e + 9]] + "-" + r[n[e + 10]] + r[n[e + 11]] + r[n[e + 12]] + r[n[e + 13]] + r[n[e + 14]] + r[n[e + 15]]).toLowerCase();
353
+ if (!me(i))
354
+ throw TypeError("Stringified UUID is invalid");
355
+ return i;
356
+ }
357
+ function ce(n, e, i) {
358
+ n = n || {};
359
+ var a = n.random || (n.rng || re)();
360
+ if (a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, e) {
361
+ i = i || 0;
362
+ for (var t = 0; t < 16; ++t)
363
+ e[i + t] = a[t];
364
+ return e;
365
+ }
366
+ return ue(a);
367
+ }
368
+ const T = "FINGERPRINT_LIVE_SHOPPING", Oe = () => {
369
+ let n = E.get(T);
370
+ return n || (n = ce(), E.set(T, n, { expires: 1 }), n);
371
+ };
372
+ function Ee(n = 8) {
373
+ const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
374
+ let i = "";
375
+ const a = e.length;
376
+ for (let t = 0; t < n; t++)
377
+ i += e.charAt(Math.floor(Math.random() * a));
378
+ return i;
379
+ }
380
+ function Te(n) {
381
+ return new $(n);
382
+ }
383
+ const Ie = (n) => {
384
+ const e = Object.entries(n).map(([i, a]) => `${i}=${a}`).join("&");
385
+ return e ? `?${e}` : "";
386
+ }, _e = (n, e, i = {
387
+ fallback: null
388
+ }) => {
389
+ let a = n;
390
+ e && (a = () => n().then((d) => ({
391
+ default: e(d)
392
+ })));
393
+ const t = q(a);
394
+ return (d) => /* @__PURE__ */ f(z, {
395
+ fallback: i.fallback,
396
+ children: /* @__PURE__ */ f(t, {
397
+ ...d
398
+ })
399
+ });
400
+ };
401
+ class v {
402
+ constructor(e, i, a) {
403
+ s(this, "isOk");
404
+ s(this, "isErr");
405
+ s(this, "error");
406
+ s(this, "_value");
407
+ if (e && i)
408
+ throw new Error(
409
+ "InvalidOperation: A result cannot be successful and contain an error"
410
+ );
411
+ if (!e && !i)
412
+ throw new Error(
413
+ "InvalidOperation: A failing result needs to contain an error message"
414
+ );
415
+ this.isOk = e, this.isErr = !e, this.error = i, this._value = a, Object.freeze(this);
416
+ }
417
+ get value() {
418
+ if (this.isErr)
419
+ throw new Error(
420
+ "Can't get the value of an error result. Use 'errorValue' instead."
421
+ );
422
+ return this._value;
423
+ }
424
+ static ok(e) {
425
+ return new v(!0, void 0, e);
426
+ }
427
+ static fail(e) {
428
+ return new v(!1, e);
429
+ }
430
+ static combine(e) {
431
+ for (const i of e)
432
+ if (i.isErr)
433
+ return i;
434
+ return v.ok();
435
+ }
436
+ }
437
+ class ke {
438
+ constructor(e) {
439
+ s(this, "value");
440
+ this.value = e;
441
+ }
442
+ isErr() {
443
+ return !0;
444
+ }
445
+ isOk() {
446
+ return !1;
447
+ }
448
+ }
449
+ class ve {
450
+ constructor(e) {
451
+ s(this, "value");
452
+ this.value = e;
453
+ }
454
+ isErr() {
455
+ return !1;
456
+ }
457
+ isOk() {
458
+ return !0;
459
+ }
460
+ }
461
+ const De = (n) => new ke(n), Ae = (n) => new ve(n);
462
+ export {
463
+ ye as AccountInvalidError,
464
+ $ as AggregateRoot,
465
+ be as ApiGraphqlTypes,
466
+ R as CustomStorage,
467
+ y as DomainError,
468
+ ke as Err,
469
+ ve as Ok,
470
+ Se as ResourceNotFoundError,
471
+ v as Result,
472
+ Fe as StoreProvider,
473
+ ge as UnexpectedError,
474
+ we as apiCall,
475
+ Te as createAggregateRoot,
476
+ Ae as err,
477
+ Oe as getFingerprint,
478
+ Ce as getStore,
479
+ _e as lazyLoad,
480
+ De as ok,
481
+ Ie as searchParams,
482
+ Ee as shortId,
483
+ he as useStore
484
+ };
@@ -4,7 +4,6 @@ interface DomainErrorDTO {
4
4
  value?: any;
5
5
  }
6
6
  export declare class DomainError extends Error {
7
- message: string;
8
7
  value?: any;
9
8
  constructor(name: string, message: string, value?: any);
10
9
  toDTO(): DomainErrorDTO;
@@ -0,0 +1,12 @@
1
+ export declare class MemoryStorage implements Storage {
2
+ private store;
3
+ constructor();
4
+ private getStoreFromWindow;
5
+ private setStoreToWindow;
6
+ setItem(key: string, value: string): void;
7
+ getItem(key: string): string | null;
8
+ removeItem(key: string): void;
9
+ clear(): void;
10
+ key(index: number): string | null;
11
+ get length(): number;
12
+ }
@@ -0,0 +1,9 @@
1
+ export declare class CustomStorage {
2
+ static init(): CustomStorage;
3
+ constructor();
4
+ private replaceStorages;
5
+ get isAvailable(): {
6
+ localStorage: boolean;
7
+ sessionStorage: boolean;
8
+ };
9
+ }
@@ -0,0 +1,4 @@
1
+ declare type StorageType = 'localStorage' | 'sessionStorage';
2
+ export declare function isStorageAvailable(type: StorageType): boolean;
3
+ export declare function setProperty(obj: unknown, name: string, value: unknown): void;
4
+ export {};
@@ -1,5 +1,6 @@
1
1
  export * from './apiCall';
2
+ export * from './customStorage';
3
+ export * from './fingerprint';
2
4
  export * from './helpers';
3
5
  export * from './lazyLoad';
4
6
  export * from './Result';
5
- export * from './fingerprint';
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@nizza/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-beta.2",
4
+ "type": "module",
4
5
  "main": "dist/index.es.js",
5
6
  "module": "dist/index.es.js",
6
7
  "types": "dist/index.d.ts",
@@ -9,14 +10,12 @@
9
10
  "dist"
10
11
  ],
11
12
  "dependencies": {
12
- "js-cookie": "^3.0.1",
13
- "uuid": "^8.3.2"
13
+ "js-cookie": "^3.0.1"
14
14
  },
15
15
  "devDependencies": {
16
- "@types/js-cookie": "^3.0.2",
17
- "@types/uuid": "^8.3.1"
16
+ "@types/js-cookie": "^3.0.2"
18
17
  },
19
18
  "scripts": {
20
- "clean": "rimraf dist"
19
+ "clean": "rimraf dist/*"
21
20
  }
22
21
  }