@fruga/sdk 1.0.0 → 1.0.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.
package/LICENSE CHANGED
@@ -1,15 +1,202 @@
1
- ISC License
2
1
 
3
- Copyright (c) 2026, Fruga Team
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
4
5
 
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
7
 
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ @fruga/sdk
2
+ Copyright 2026 Fruga Team
3
+
4
+ This product includes software developed at Fruga (https://fruga.co.uk).
package/README.md CHANGED
@@ -1,13 +1,8 @@
1
- # Fruga Relay SDK (`@fruga/sdk`)
1
+ # Fruga SDK (`@fruga/sdk`)
2
2
 
3
3
  A lightweight, embeddable widget that allows third-party partners to display insurance quotes and cashback offers directly on their websites.
4
4
 
5
- ## Features
6
- - **Embeddable via Script Tag**: Ready for standalone usage without any dependencies.
7
- - **Configurable**: Fully customizable `partnerId` and `theme` options.
8
- - **Isolated Styles**: Uses Shadow DOM to prevent CSS leaks into the partner website.
9
- - **TypeScript Support**: Full type definitions included.
10
- - **Lightweight**: Optimized and tree-shaken build.
5
+ > Currently the SDK ships the **Relay** widget. The **Connect** widget is not available yet — its export paths exist but are subject to change.
11
6
 
12
7
  ## Installation
13
8
 
@@ -15,95 +10,25 @@ A lightweight, embeddable widget that allows third-party partners to display ins
15
10
  pnpm add @fruga/sdk
16
11
  ```
17
12
 
18
- For detailed instructions, including CDN usage and troubleshooting, see the [Installation Guide](./docs/INSTALLATION.md).
19
-
20
- ## Usage
21
-
22
- The SDK can be integrated via native React components or React hooks.
23
-
24
- ### Native React Component
25
-
26
- For an immediate, easy setup in React, import the `<FrugaWidget />` component. This automatically handles mounting and unmounting within the React lifecycle.
13
+ ## Quick start (React)
27
14
 
28
15
  ```tsx
29
16
  import { FrugaWidget } from '@fruga/sdk/loader/react';
30
17
 
31
18
  export default function MyPage() {
32
19
  return (
33
- <div style={{ width: '350px', height: '500px' }}>
34
- <FrugaWidget
35
- partnerKey="YOUR_PARTNER_KEY"
36
- theme="light"
37
- primaryColor="#ffff33"
38
- onClose={() => console.log('Widget closed')}
39
- />
20
+ <div style={{ width: '100%', minHeight: '600px' }}>
21
+ <FrugaWidget partnerKey="YOUR_PARTNER_KEY" />
40
22
  </div>
41
23
  );
42
24
  }
43
25
  ```
44
26
 
45
- ### React Hook (Manual Control)
46
-
47
- If you need manual control over when the widget mounts (e.g., waiting for a user to click a "Buy Now" button), use the `useFrugaWidget` hook.
48
-
49
- ```tsx
50
- import { useFrugaWidget } from '@fruga/sdk/loader/react';
51
-
52
- export default function App() {
53
- const { mount, unmount } = useFrugaWidget({
54
- partnerKey: 'YOUR_PARTNER_KEY',
55
- containerId: 'my-custom-container',
56
- autoMount: false
57
- });
58
-
59
- return (
60
- <div>
61
- <button onClick={mount}>Show Insurance Options</button>
62
- <button onClick={unmount}>Hide</button>
63
- <div id="my-custom-container" />
64
- </div>
65
- );
66
- }
67
- ```
68
-
69
- ### Script Tag Usage (Vanilla HTML)
70
-
71
- For non-React websites, drop the script tag directly into your HTML. The script acts independently and initializes the widget in the specified container.
72
-
73
- ```html
74
- <div id="fruga-widget-root"></div>
75
-
76
- <script src="https://unpkg.com/@fruga/sdk/dist/loader.global.js"></script>
77
- <script>
78
- FrugaLoader.init({
79
- partnerKey: 'YOUR_PARTNER_KEY',
80
- containerId: 'fruga-widget-root',
81
- autoMount: true
82
- });
83
- </script>
84
- ```
85
-
86
- ## Configuration Options
87
-
88
- | Option | Type | Description |
89
- | --- | --- | --- |
90
- | `partnerKey` | `string` | **Required.** Your unique partner identifier. |
91
- | `containerId` | `string` | (Optional) The ID of the container element. Defaults to `fruga-widget-root`. |
92
- | `theme` | `'light' \| 'dark'` | (Optional) The visual theme. Defaults to `light`. |
93
- | `primaryColor` | `string` | (Optional) Hex code for the primary brand color. |
94
- | `autoMount` | `boolean` | (Optional) If `true`, the widget mounts immediately after init. Defaults to `true`. |
95
- | `onClose` | `() => void` | (Optional) Callback function triggered when the widget is closed internally. |
96
-
97
- ## API Methods
98
-
99
- ### `init(options: LoaderOptions)`
100
- Initializes the loader with the given configuration.
27
+ An imperative API (`init`/`mount`/`unmount` from `@fruga/sdk/loader`) and a script-tag build are also available.
101
28
 
102
- ### `mount()`
103
- Renders the widget into the DOM.
29
+ ## Documentation
104
30
 
105
- ### `unmount()`
106
- Removes the widget from the DOM.
31
+ Full integration guides, authentication/JWT setup, configuration options, and API reference live at **[docs.fruga.co.uk](https://docs.fruga.co.uk)** — start with the [Relay Getting Started guide](https://docs.fruga.co.uk/relay/guides/start/).
107
32
 
108
33
  ## Development
109
34
 
@@ -115,4 +40,4 @@ pnpm test # Run tests
115
40
  ```
116
41
 
117
42
  ## License
118
- ISC
43
+ Apache-2.0 — see [LICENSE](./LICENSE).
@@ -0,0 +1,65 @@
1
+ "use strict";var FrugaLoader=(()=>{var Wt=Object.create;var me=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var zt=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty;var qt=(t,r,o)=>r in t?me(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o;var ne=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),Kt=(t,r)=>{for(var o in r)me(t,o,{get:r[o],enumerable:!0})},ut=(t,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of Yt(r))!Gt.call(t,c)&&c!==o&&me(t,c,{get:()=>r[c],enumerable:!(a=Ht(r,c))||a.enumerable});return t};var F=(t,r,o)=>(o=t!=null?Wt(zt(t)):{},ut(r||!t||!t.__esModule?me(o,"default",{value:t,enumerable:!0}):o,t)),Qt=t=>ut(me({},"__esModule",{value:!0}),t);var Re=(t,r,o)=>qt(t,typeof r!="symbol"?r+"":r,o);var lt=ne(Se=>{"use strict";var Xt=Symbol.for("react.transitional.element"),Zt=Symbol.for("react.fragment");function ct(t,r,o){var a=null;if(o!==void 0&&(a=""+o),r.key!==void 0&&(a=""+r.key),"key"in r){o={};for(var c in r)c!=="key"&&(o[c]=r[c])}else o=r;return r=o.ref,{$$typeof:Xt,type:t,key:a,ref:r!==void 0?r:null,props:o}}Se.Fragment=Zt;Se.jsx=ct;Se.jsxs=ct});var Tt=ne(p=>{"use strict";var De=Symbol.for("react.transitional.element"),Jt=Symbol.for("react.portal"),er=Symbol.for("react.fragment"),tr=Symbol.for("react.strict_mode"),rr=Symbol.for("react.profiler"),nr=Symbol.for("react.consumer"),or=Symbol.for("react.context"),sr=Symbol.for("react.forward_ref"),ar=Symbol.for("react.suspense"),ir=Symbol.for("react.memo"),mt=Symbol.for("react.lazy"),ur=Symbol.for("react.activity"),ft=Symbol.iterator;function cr(t){return t===null||typeof t!="object"?null:(t=ft&&t[ft]||t["@@iterator"],typeof t=="function"?t:null)}var ht={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},yt=Object.assign,Et={};function se(t,r,o){this.props=t,this.context=r,this.refs=Et,this.updater=o||ht}se.prototype.isReactComponent={};se.prototype.setState=function(t,r){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,r,"setState")};se.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function vt(){}vt.prototype=se.prototype;function je(t,r,o){this.props=t,this.context=r,this.refs=Et,this.updater=o||ht}var Ue=je.prototype=new vt;Ue.constructor=je;yt(Ue,se.prototype);Ue.isPureReactComponent=!0;var dt=Array.isArray;function Fe(){}var R={H:null,A:null,T:null,S:null},wt=Object.prototype.hasOwnProperty;function Be(t,r,o){var a=o.ref;return{$$typeof:De,type:t,key:r,ref:a!==void 0?a:null,props:o}}function lr(t,r){return Be(t.type,r,t.props)}function $e(t){return typeof t=="object"&&t!==null&&t.$$typeof===De}function fr(t){var r={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(o){return r[o]})}var pt=/\/+/g;function Ne(t,r){return typeof t=="object"&&t!==null&&t.key!=null?fr(""+t.key):r.toString(36)}function dr(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(Fe,Fe):(t.status="pending",t.then(function(r){t.status==="pending"&&(t.status="fulfilled",t.value=r)},function(r){t.status==="pending"&&(t.status="rejected",t.reason=r)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function oe(t,r,o,a,c){var l=typeof t;(l==="undefined"||l==="boolean")&&(t=null);var m=!1;if(t===null)m=!0;else switch(l){case"bigint":case"string":case"number":m=!0;break;case"object":switch(t.$$typeof){case De:case Jt:m=!0;break;case mt:return m=t._init,oe(m(t._payload),r,o,a,c)}}if(m)return c=c(t),m=a===""?"."+Ne(t,0):a,dt(c)?(o="",m!=null&&(o=m.replace(pt,"$&/")+"/"),oe(c,r,o,"",function(w){return w})):c!=null&&($e(c)&&(c=lr(c,o+(c.key==null||t&&t.key===c.key?"":(""+c.key).replace(pt,"$&/")+"/")+m)),r.push(c)),1;m=0;var k=a===""?".":a+":";if(dt(t))for(var _=0;_<t.length;_++)a=t[_],l=k+Ne(a,_),m+=oe(a,r,o,l,c);else if(_=cr(t),typeof _=="function")for(t=_.call(t),_=0;!(a=t.next()).done;)a=a.value,l=k+Ne(a,_++),m+=oe(a,r,o,l,c);else if(l==="object"){if(typeof t.then=="function")return oe(dr(t),r,o,a,c);throw r=String(t),Error("Objects are not valid as a React child (found: "+(r==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return m}function Ae(t,r,o){if(t==null)return t;var a=[],c=0;return oe(t,a,"","",function(l){return r.call(o,l,c++)}),a}function pr(t){if(t._status===-1){var r=t._result;r=r(),r.then(function(o){(t._status===0||t._status===-1)&&(t._status=1,t._result=o)},function(o){(t._status===0||t._status===-1)&&(t._status=2,t._result=o)}),t._status===-1&&(t._status=0,t._result=r)}if(t._status===1)return t._result.default;throw t._result}var gt=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},gr={map:Ae,forEach:function(t,r,o){Ae(t,function(){r.apply(this,arguments)},o)},count:function(t){var r=0;return Ae(t,function(){r++}),r},toArray:function(t){return Ae(t,function(r){return r})||[]},only:function(t){if(!$e(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};p.Activity=ur;p.Children=gr;p.Component=se;p.Fragment=er;p.Profiler=rr;p.PureComponent=je;p.StrictMode=tr;p.Suspense=ar;p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R;p.__COMPILER_RUNTIME={__proto__:null,c:function(t){return R.H.useMemoCache(t)}};p.cache=function(t){return function(){return t.apply(null,arguments)}};p.cacheSignal=function(){return null};p.cloneElement=function(t,r,o){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var a=yt({},t.props),c=t.key;if(r!=null)for(l in r.key!==void 0&&(c=""+r.key),r)!wt.call(r,l)||l==="key"||l==="__self"||l==="__source"||l==="ref"&&r.ref===void 0||(a[l]=r[l]);var l=arguments.length-2;if(l===1)a.children=o;else if(1<l){for(var m=Array(l),k=0;k<l;k++)m[k]=arguments[k+2];a.children=m}return Be(t.type,c,a)};p.createContext=function(t){return t={$$typeof:or,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:nr,_context:t},t};p.createElement=function(t,r,o){var a,c={},l=null;if(r!=null)for(a in r.key!==void 0&&(l=""+r.key),r)wt.call(r,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(c[a]=r[a]);var m=arguments.length-2;if(m===1)c.children=o;else if(1<m){for(var k=Array(m),_=0;_<m;_++)k[_]=arguments[_+2];c.children=k}if(t&&t.defaultProps)for(a in m=t.defaultProps,m)c[a]===void 0&&(c[a]=m[a]);return Be(t,l,c)};p.createRef=function(){return{current:null}};p.forwardRef=function(t){return{$$typeof:sr,render:t}};p.isValidElement=$e;p.lazy=function(t){return{$$typeof:mt,_payload:{_status:-1,_result:t},_init:pr}};p.memo=function(t,r){return{$$typeof:ir,type:t,compare:r===void 0?null:r}};p.startTransition=function(t){var r=R.T,o={};R.T=o;try{var a=t(),c=R.S;c!==null&&c(o,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(Fe,gt)}catch(l){gt(l)}finally{r!==null&&o.types!==null&&(r.types=o.types),R.T=r}};p.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()};p.use=function(t){return R.H.use(t)};p.useActionState=function(t,r,o){return R.H.useActionState(t,r,o)};p.useCallback=function(t,r){return R.H.useCallback(t,r)};p.useContext=function(t){return R.H.useContext(t)};p.useDebugValue=function(){};p.useDeferredValue=function(t,r){return R.H.useDeferredValue(t,r)};p.useEffect=function(t,r){return R.H.useEffect(t,r)};p.useEffectEvent=function(t){return R.H.useEffectEvent(t)};p.useId=function(){return R.H.useId()};p.useImperativeHandle=function(t,r,o){return R.H.useImperativeHandle(t,r,o)};p.useInsertionEffect=function(t,r){return R.H.useInsertionEffect(t,r)};p.useLayoutEffect=function(t,r){return R.H.useLayoutEffect(t,r)};p.useMemo=function(t,r){return R.H.useMemo(t,r)};p.useOptimistic=function(t,r){return R.H.useOptimistic(t,r)};p.useReducer=function(t,r,o){return R.H.useReducer(t,r,o)};p.useRef=function(t){return R.H.useRef(t)};p.useState=function(t){return R.H.useState(t)};p.useSyncExternalStore=function(t,r,o){return R.H.useSyncExternalStore(t,r,o)};p.useTransition=function(){return R.H.useTransition()};p.version="19.2.4"});var _t=ne((d,ke)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function t(e,n){Object.defineProperty(a.prototype,e,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",n[0],n[1])}})}function r(e){return e===null||typeof e!="object"?null:(e=ve&&e[ve]||e["@@iterator"],typeof e=="function"?e:null)}function o(e,n){e=(e=e.constructor)&&(e.displayName||e.name)||"ReactClass";var i=e+"."+n;Qe[i]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",n,e),Qe[i]=!0)}function a(e,n,i){this.props=e,this.context=n,this.refs=Me,this.updater=i||Ve}function c(){}function l(e,n,i){this.props=e,this.context=n,this.refs=Me,this.updater=i||Ve}function m(){}function k(e){return""+e}function _(e){try{k(e);var n=!1}catch{n=!0}if(n){n=console;var i=n.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),k(e)}}function w(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Dt?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case s:return"Profiler";case de:return"StrictMode";case q:return"Suspense";case pe:return"SuspenseList";case te:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case fe:return"Portal";case b:return e.displayName||"Context";case g:return(e._context.displayName||"Context")+".Consumer";case O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return n=e.displayName||null,n!==null?n:w(e.type)||"Memo";case L:n=e._payload,e=e._init;try{return w(e(n))}catch{}}return null}function M(e){if(e===ee)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===L)return"<...>";try{var n=w(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function C(){var e=y.A;return e===null?null:e.getOwner()}function D(){return Error("react-stack-top-frame")}function P(e){if(we.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function x(e,n){function i(){et||(et=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function ue(){var e=w(this.type);return rt[e]||(rt[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function j(e,n,i,u,f,E){var h=i.ref;return e={$$typeof:J,type:e,key:n,props:i,_owner:u},(h!==void 0?h:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:ue}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:f}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:E}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function Q(e,n){return n=j(e.type,n,e.props,e._owner,e._debugStack,e._debugTask),e._store&&(n._store.validated=e._store.validated),n}function I(e){U(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===L&&(e._payload.status==="fulfilled"?U(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function U(e){return typeof e=="object"&&e!==null&&e.$$typeof===J}function ce(e){var n={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return n[i]})}function z(e,n){return typeof e=="object"&&e!==null&&e.key!=null?(_(e.key),ce(""+e.key)):n.toString(36)}function Ie(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(m,m):(e.status="pending",e.then(function(n){e.status==="pending"&&(e.status="fulfilled",e.value=n)},function(n){e.status==="pending"&&(e.status="rejected",e.reason=n)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function $(e,n,i,u,f){var E=typeof e;(E==="undefined"||E==="boolean")&&(e=null);var h=!1;if(e===null)h=!0;else switch(E){case"bigint":case"string":case"number":h=!0;break;case"object":switch(e.$$typeof){case J:case fe:h=!0;break;case L:return h=e._init,$(h(e._payload),n,i,u,f)}}if(h){h=e,f=f(h);var T=u===""?"."+z(h,0):u;return Ze(f)?(i="",T!=null&&(i=T.replace(ot,"$&/")+"/"),$(f,n,i,"",function(Y){return Y})):f!=null&&(U(f)&&(f.key!=null&&(h&&h.key===f.key||_(f.key)),i=Q(f,i+(f.key==null||h&&h.key===f.key?"":(""+f.key).replace(ot,"$&/")+"/")+T),u!==""&&h!=null&&U(h)&&h.key==null&&h._store&&!h._store.validated&&(i._store.validated=2),f=i),n.push(f)),1}if(h=0,T=u===""?".":u+":",Ze(e))for(var v=0;v<e.length;v++)u=e[v],E=T+z(u,v),h+=$(u,n,i,E,f);else if(v=r(e),typeof v=="function")for(v===e.entries&&(nt||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),nt=!0),e=v.call(e),v=0;!(u=e.next()).done;)u=u.value,E=T+z(u,v++),h+=$(u,n,i,E,f);else if(E==="object"){if(typeof e.then=="function")return $(Ie(e),n,i,u,f);throw n=String(e),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.")}return h}function V(e,n,i){if(e==null)return e;var u=[],f=0;return $(e,u,"","",function(E){return n.call(i,E,f++)}),u}function le(e){if(e._status===-1){var n=e._ioInfo;n!=null&&(n.start=n.end=performance.now()),n=e._result;var i=n();if(i.then(function(f){if(e._status===0||e._status===-1){e._status=1,e._result=f;var E=e._ioInfo;E!=null&&(E.end=performance.now()),i.status===void 0&&(i.status="fulfilled",i.value=f)}},function(f){if(e._status===0||e._status===-1){e._status=2,e._result=f;var E=e._ioInfo;E!=null&&(E.end=performance.now()),i.status===void 0&&(i.status="rejected",i.reason=f)}}),n=e._ioInfo,n!=null){n.value=i;var u=i.displayName;typeof u=="string"&&(n.name=u)}e._status===-1&&(e._status=0,e._result=i)}if(e._status===1)return n=e._result,n===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
2
+
3
+ Your code should look like:
4
+ const MyComponent = lazy(() => import('./MyComponent'))
5
+
6
+ Did you accidentally put curly braces around the import?`,n),"default"in n||console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
7
+
8
+ Your code should look like:
9
+ const MyComponent = lazy(() => import('./MyComponent'))`,n),n.default;throw e._result}function S(){var e=y.H;return e===null&&console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
10
+ 1. You might have mismatching versions of React and the renderer (such as React DOM)
11
+ 2. You might be breaking the Rules of Hooks
12
+ 3. You might have more than one copy of React in the same app
13
+ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function Ee(){y.asyncTransitions--}function W(e){if(Te===null)try{var n=("require"+Math.random()).slice(0,7);Te=(ke&&ke[n]).call(ke,"timers").setImmediate}catch{Te=function(u){at===!1&&(at=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var f=new MessageChannel;f.port1.onmessage=u,f.port2.postMessage(void 0)}}return Te(e)}function H(e){return 1<e.length&&typeof AggregateError=="function"?new AggregateError(e):e[0]}function X(e,n){n!==_e-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),_e=n}function G(e,n,i){var u=y.actQueue;if(u!==null)if(u.length!==0)try{Z(u),W(function(){return G(e,n,i)});return}catch(f){y.thrownErrors.push(f)}else y.actQueue=null;0<y.thrownErrors.length?(u=H(y.thrownErrors),y.thrownErrors.length=0,i(u)):n(e)}function Z(e){if(!Le){Le=!0;var n=0;try{for(;n<e.length;n++){var i=e[n];do{y.didUsePromise=!1;var u=i(!1);if(u!==null){if(y.didUsePromise){e[n]=i,e.splice(0,n);return}i=u}else break}while(!0)}e.length=0}catch(f){e.splice(0,n+1),y.thrownErrors.push(f)}finally{Le=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var J=Symbol.for("react.transitional.element"),fe=Symbol.for("react.portal"),ee=Symbol.for("react.fragment"),de=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),b=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),pe=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),te=Symbol.for("react.activity"),ve=Symbol.iterator,Qe={},Ve={isMounted:function(){return!1},enqueueForceUpdate:function(e){o(e,"forceUpdate")},enqueueReplaceState:function(e){o(e,"replaceState")},enqueueSetState:function(e){o(e,"setState")}},Xe=Object.assign,Me={};Object.freeze(Me),a.prototype.isReactComponent={},a.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")},a.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var N={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(ge in N)N.hasOwnProperty(ge)&&t(ge,N[ge]);c.prototype=a.prototype,N=l.prototype=new c,N.constructor=l,Xe(N,a.prototype),N.isPureReactComponent=!0;var Ze=Array.isArray,Dt=Symbol.for("react.client.reference"),y={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},we=Object.prototype.hasOwnProperty,Je=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(e){return e()}};var et,tt,rt={},jt=N.react_stack_bottom_frame.bind(N,D)(),Ut=Je(M(D)),nt=!1,ot=/\/+/g,st=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},at=!1,Te=null,_e=0,be=!1,Le=!1,it=typeof queueMicrotask=="function"?function(e){queueMicrotask(function(){return queueMicrotask(e)})}:W;N=Object.freeze({__proto__:null,c:function(e){return S().useMemoCache(e)}});var ge={map:V,forEach:function(e,n,i){V(e,function(){n.apply(this,arguments)},i)},count:function(e){var n=0;return V(e,function(){n++}),n},toArray:function(e){return V(e,function(n){return n})||[]},only:function(e){if(!U(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};d.Activity=te,d.Children=ge,d.Component=a,d.Fragment=ee,d.Profiler=s,d.PureComponent=l,d.StrictMode=de,d.Suspense=q,d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=y,d.__COMPILER_RUNTIME=N,d.act=function(e){var n=y.actQueue,i=_e;_e++;var u=y.actQueue=n!==null?n:[],f=!1;try{var E=e()}catch(v){y.thrownErrors.push(v)}if(0<y.thrownErrors.length)throw X(n,i),e=H(y.thrownErrors),y.thrownErrors.length=0,e;if(E!==null&&typeof E=="object"&&typeof E.then=="function"){var h=E;return it(function(){f||be||(be=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(v,Y){f=!0,h.then(function(re){if(X(n,i),i===0){try{Z(u),W(function(){return G(re,v,Y)})}catch($t){y.thrownErrors.push($t)}if(0<y.thrownErrors.length){var Bt=H(y.thrownErrors);y.thrownErrors.length=0,Y(Bt)}}else v(re)},function(re){X(n,i),0<y.thrownErrors.length&&(re=H(y.thrownErrors),y.thrownErrors.length=0),Y(re)})}}}var T=E;if(X(n,i),i===0&&(Z(u),u.length!==0&&it(function(){f||be||(be=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),y.actQueue=null),0<y.thrownErrors.length)throw e=H(y.thrownErrors),y.thrownErrors.length=0,e;return{then:function(v,Y){f=!0,i===0?(y.actQueue=u,W(function(){return G(T,v,Y)})):v(T)}}},d.cache=function(e){return function(){return e.apply(null,arguments)}},d.cacheSignal=function(){return null},d.captureOwnerStack=function(){var e=y.getCurrentStack;return e===null?null:e()},d.cloneElement=function(e,n,i){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var u=Xe({},e.props),f=e.key,E=e._owner;if(n!=null){var h;e:{if(we.call(n,"ref")&&(h=Object.getOwnPropertyDescriptor(n,"ref").get)&&h.isReactWarning){h=!1;break e}h=n.ref!==void 0}h&&(E=C()),P(n)&&(_(n.key),f=""+n.key);for(T in n)!we.call(n,T)||T==="key"||T==="__self"||T==="__source"||T==="ref"&&n.ref===void 0||(u[T]=n[T])}var T=arguments.length-2;if(T===1)u.children=i;else if(1<T){h=Array(T);for(var v=0;v<T;v++)h[v]=arguments[v+2];u.children=h}for(u=j(e.type,f,u,E,e._debugStack,e._debugTask),f=2;f<arguments.length;f++)I(arguments[f]);return u},d.createContext=function(e){return e={$$typeof:b,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:g,_context:e},e._currentRenderer=null,e._currentRenderer2=null,e},d.createElement=function(e,n,i){for(var u=2;u<arguments.length;u++)I(arguments[u]);u={};var f=null;if(n!=null)for(v in tt||!("__self"in n)||"key"in n||(tt=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),P(n)&&(_(n.key),f=""+n.key),n)we.call(n,v)&&v!=="key"&&v!=="__self"&&v!=="__source"&&(u[v]=n[v]);var E=arguments.length-2;if(E===1)u.children=i;else if(1<E){for(var h=Array(E),T=0;T<E;T++)h[T]=arguments[T+2];Object.freeze&&Object.freeze(h),u.children=h}if(e&&e.defaultProps)for(v in E=e.defaultProps,E)u[v]===void 0&&(u[v]=E[v]);f&&x(u,typeof e=="function"?e.displayName||e.name||"Unknown":e);var v=1e4>y.recentlyCreatedOwnerStacks++;return j(e,f,u,C(),v?Error("react-stack-top-frame"):jt,v?Je(M(e)):Ut)},d.createRef=function(){var e={current:null};return Object.seal(e),e},d.forwardRef=function(e){e!=null&&e.$$typeof===A?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?console.error("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&e.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var n={$$typeof:O,render:e},i;return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return i},set:function(u){i=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),n},d.isValidElement=U,d.lazy=function(e){e={_status:-1,_result:e};var n={$$typeof:L,_payload:e,_init:le},i={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return e._ioInfo=i,n._debugInfo=[{awaited:i}],n},d.memo=function(e,n){e==null&&console.error("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e),n={$$typeof:A,type:e,compare:n===void 0?null:n};var i;return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return i},set:function(u){i=u,e.name||e.displayName||(Object.defineProperty(e,"name",{value:u}),e.displayName=u)}}),n},d.startTransition=function(e){var n=y.T,i={};i._updatedFibers=new Set,y.T=i;try{var u=e(),f=y.S;f!==null&&f(i,u),typeof u=="object"&&u!==null&&typeof u.then=="function"&&(y.asyncTransitions++,u.then(Ee,Ee),u.then(m,st))}catch(E){st(E)}finally{n===null&&i._updatedFibers&&(e=i._updatedFibers.size,i._updatedFibers.clear(),10<e&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),n!==null&&i.types!==null&&(n.types!==null&&n.types!==i.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),n.types=i.types),y.T=n}},d.unstable_useCacheRefresh=function(){return S().useCacheRefresh()},d.use=function(e){return S().use(e)},d.useActionState=function(e,n,i){return S().useActionState(e,n,i)},d.useCallback=function(e,n){return S().useCallback(e,n)},d.useContext=function(e){var n=S();return e.$$typeof===g&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),n.useContext(e)},d.useDebugValue=function(e,n){return S().useDebugValue(e,n)},d.useDeferredValue=function(e,n){return S().useDeferredValue(e,n)},d.useEffect=function(e,n){return e==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),S().useEffect(e,n)},d.useEffectEvent=function(e){return S().useEffectEvent(e)},d.useId=function(){return S().useId()},d.useImperativeHandle=function(e,n,i){return S().useImperativeHandle(e,n,i)},d.useInsertionEffect=function(e,n){return e==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),S().useInsertionEffect(e,n)},d.useLayoutEffect=function(e,n){return e==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),S().useLayoutEffect(e,n)},d.useMemo=function(e,n){return S().useMemo(e,n)},d.useOptimistic=function(e,n){return S().useOptimistic(e,n)},d.useReducer=function(e,n,i){return S().useReducer(e,n,i)},d.useRef=function(e){return S().useRef(e)},d.useState=function(e){return S().useState(e)},d.useSyncExternalStore=function(e,n,i){return S().useSyncExternalStore(e,n,i)},d.useTransition=function(){return S().useTransition()},d.version="19.2.4",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var ae=ne((Hr,We)=>{"use strict";process.env.NODE_ENV==="production"?We.exports=Tt():We.exports=_t()});var bt=ne(Oe=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function t(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Ee?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case j:return"Fragment";case I:return"Profiler";case Q:return"StrictMode";case Ie:return"Suspense";case $:return"SuspenseList";case S:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case ue:return"Portal";case ce:return s.displayName||"Context";case U:return(s._context.displayName||"Context")+".Consumer";case z:var g=s.render;return s=s.displayName,s||(s=g.displayName||g.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case V:return g=s.displayName||null,g!==null?g:t(s.type)||"Memo";case le:g=s._payload,s=s._init;try{return t(s(g))}catch{}}return null}function r(s){return""+s}function o(s){try{r(s);var g=!1}catch{g=!0}if(g){g=console;var b=g.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return b.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),r(s)}}function a(s){if(s===j)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===le)return"<...>";try{var g=t(s);return g?"<"+g+">":"<...>"}catch{return"<...>"}}function c(){var s=W.A;return s===null?null:s.getOwner()}function l(){return Error("react-stack-top-frame")}function m(s){if(H.call(s,"key")){var g=Object.getOwnPropertyDescriptor(s,"key").get;if(g&&g.isReactWarning)return!1}return s.key!==void 0}function k(s,g){function b(){Z||(Z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",g))}b.isReactWarning=!0,Object.defineProperty(s,"key",{get:b,configurable:!0})}function _(){var s=t(this.type);return J[s]||(J[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function w(s,g,b,O,q,pe){var A=b.ref;return s={$$typeof:x,type:s,key:g,props:b,_owner:O},(A!==void 0?A:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:_}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:pe}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function M(s,g,b,O,q,pe){var A=g.children;if(A!==void 0)if(O)if(X(A)){for(O=0;O<A.length;O++)C(A[O]);Object.freeze&&Object.freeze(A)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else C(A);if(H.call(g,"key")){A=t(s);var L=Object.keys(g).filter(function(ve){return ve!=="key"});O=0<L.length?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}",de[A+O]||(L=0<L.length?"{"+L.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
14
+ let props = %s;
15
+ <%s {...props} />
16
+ React keys must be passed directly to JSX without using spread:
17
+ let props = %s;
18
+ <%s key={someKey} {...props} />`,O,A,L,A),de[A+O]=!0)}if(A=null,b!==void 0&&(o(b),A=""+b),m(g)&&(o(g.key),A=""+g.key),"key"in g){b={};for(var te in g)te!=="key"&&(b[te]=g[te])}else b=g;return A&&k(b,typeof s=="function"?s.displayName||s.name||"Unknown":s),w(s,A,b,c(),q,pe)}function C(s){D(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===le&&(s._payload.status==="fulfilled"?D(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function D(s){return typeof s=="object"&&s!==null&&s.$$typeof===x}var P=ae(),x=Symbol.for("react.transitional.element"),ue=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),ce=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),Ie=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),Ee=Symbol.for("react.client.reference"),W=P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=Object.prototype.hasOwnProperty,X=Array.isArray,G=console.createTask?console.createTask:function(){return null};P={react_stack_bottom_frame:function(s){return s()}};var Z,J={},fe=P.react_stack_bottom_frame.bind(P,l)(),ee=G(a(l)),de={};Oe.Fragment=j,Oe.jsx=function(s,g,b){var O=1e4>W.recentlyCreatedOwnerStacks++;return M(s,g,b,!1,O?Error("react-stack-top-frame"):fe,O?G(a(s)):ee)},Oe.jsxs=function(s,g,b){var O=1e4>W.recentlyCreatedOwnerStacks++;return M(s,g,b,!0,O?Error("react-stack-top-frame"):fe,O?G(a(s)):ee)}})()});var B=ne((zr,He)=>{"use strict";process.env.NODE_ENV==="production"?He.exports=lt():He.exports=bt()});var _r={};Kt(_r,{getBalance:()=>Ft,init:()=>Ke,mount:()=>It,requestBalance:()=>Nt,setOptions:()=>Lt,unmount:()=>Mt});var mr=F(B());var ze=F(ae());var hr=F(B());var Ot=F(ae());var Rt=t=>{let r,o=new Set,a=(w,M)=>{let C=typeof w=="function"?w(r):w;if(!Object.is(C,r)){let D=r;r=M??(typeof C!="object"||C===null)?C:Object.assign({},r,C),o.forEach(P=>P(r,D))}},c=()=>r,k={setState:a,getState:c,getInitialState:()=>_,subscribe:w=>(o.add(w),()=>o.delete(w))},_=r=t(a,c,k);return k},St=(t=>t?Rt(t):Rt);var he=F(ae(),1);var yr=t=>t;function Er(t,r=yr){let o=he.default.useSyncExternalStore(t.subscribe,he.default.useCallback(()=>r(t.getState()),[t,r]),he.default.useCallback(()=>r(t.getInitialState()),[t,r]));return he.default.useDebugValue(o),o}var At=t=>{let r=St(t),o=a=>Er(r,a);return Object.assign(o,r),o},kt=(t=>t?At(t):At);var Ye=kt(t=>({isOpen:!1,isFocused:!0,isIdle:!1,available:0,pending:0,mode:"light",token:null,partnerPayout:null,isAddingPayoutFromAlert:!1,showPayoutSuccess:!1,toggle:()=>t(r=>({isOpen:!r.isOpen})),setOpen:r=>t({isOpen:r}),setFocused:r=>t({isFocused:r}),setIdle:r=>t({isIdle:r}),setBalances:(r,o)=>t({available:r,pending:o}),setMode:r=>t({mode:r}),setToken:r=>t({token:r}),setPartnerPayout:r=>t({partnerPayout:r}),setIsAddingPayoutFromAlert:r=>t({isAddingPayoutFromAlert:r}),setShowPayoutSuccess:r=>t({showPayoutSuccess:r})}));var Ge=F(B());var xt=F(B());var Ct=F(ae());var ye={BOOTSTRAP_DATA:"fruga_bootstrap",BOOTSTRAP_CONFIG:"fruga_active_config"},K=class{static set(r,o){if(!(typeof window>"u"))try{window.localStorage.setItem(r,JSON.stringify(o))}catch(a){console.warn(`[FrugaStorage] Failed to save key "${r}":`,a)}}static get(r){if(typeof window>"u")return null;try{let o=window.localStorage.getItem(r);return o?JSON.parse(o):null}catch(o){return console.warn(`[FrugaStorage] Failed to load key "${r}":`,o),null}}static remove(r){typeof window>"u"||window.localStorage.removeItem(r)}static clear(){typeof window>"u"||window.localStorage.clear()}};var vr=typeof process<"u"&&process.env.VITE_FRUGA_API_URL||"https://api-dev.fruga.co.uk",Pt=t=>t||vr;var qe={partnerEnvId:"env_dev_123",partnerId:"partner_abc_456",partnerType:"EXTERNAL_TENANT",partnerPayout:"USER",auth:{mode:"JWT",audience:"https://api.fruga.io",issuer:"https://auth.fruga.io",tokenTtlSeconds:70},config:{ui:{accent:"#F97316",defaultTheme:"light",launcherIcon:"arrow",showLauncher:!0,launcherLabel:"Help",accentTextDark:"#832424",accentTextLight:"#d81414",allowUserThemeControl:!0},validValues:{defaultTheme:["light","dark"],launcherIcon:["none","gift","sparkles","credit","arrow"]}}};var xe=class{async bootstrap(r,o){let a=Pt(o);if(typeof process<"u"&&process.env.VITE_FRUGA_MODE==="test")return console.log("Fruga SDK: Using bootstrap mocks (VITE_FRUGA_MODE=test)"),qe;try{let l=await fetch(`${a}/widget/bootstrap?partnerKey=${r}`,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}});if(!l.ok)throw new Error(`Bootstrap failed with status: ${l.status}`);return await l.json()}catch(l){return console.error("Fruga SDK: Bootstrap failed, falling back to mocks",l),qe}}};var Ce=class{mount(r,o,a){let{partnerKey:c,theme:l,primaryColor:m,appUrl:k,userId:_}=a,w=document.createElement("iframe"),M=o.partnerType==="EXTERNAL_TENANT"?"relay":"connect",C=typeof document<"u"?document.currentScript:null,D=C?.src||(typeof window<"u"?window.location.href:""),P=`./${M}/index.html`;if(!C)P=`https://frugainsurance.github.io/sdk/${M}/index.html`;else try{new URL(D).pathname.includes("/dist/")&&(P=`./${M}/index.html`)}catch{}let x=new URL(k||o.appUrl||P,D);x.searchParams.set("partnerKey",c),x.searchParams.set("partnerId",o.partnerId);let ue=typeof window<"u"?window.innerWidth<768:!1;if(x.searchParams.set("isHostMobile",String(ue)),typeof window<"u"&&(x.searchParams.set("hostHeight",String(window.innerHeight)),x.searchParams.set("hostWidth",String(window.innerWidth))),l&&x.searchParams.set("theme",l),m&&x.searchParams.set("primaryColor",m),_&&x.searchParams.set("userId",_),o.token&&x.searchParams.set("token",o.token),a.baseUrl&&x.searchParams.set("baseUrl",a.baseUrl),o.bootstrapConfig)try{let I=btoa(JSON.stringify(o.bootstrapConfig));x.searchParams.set("bootstrapConfig",I)}catch(I){console.warn("FrugaLoader: Failed to encode bootstrapConfig for iframe URL",I)}w.src=x.toString(),w.style.border="none",w.style.width="410px",w.style.height="600px",w.style.backgroundColor="transparent";let j=I=>{if(I.source===w.contentWindow&&I.data?.type==="FRUGA_RESIZE"){let{width:U,height:ce,isFullscreen:z}=I.data;z?(w.style.position="fixed",w.style.inset="0",w.style.width="100vw",w.style.height="100vh",w.style.zIndex="99999"):(w.style.position="static",w.style.width=`${U}px`,w.style.height=`${ce}px`,w.style.zIndex="auto")}},Q=()=>{w.contentWindow?.postMessage({type:"FRUGA_HOST_RESIZE",isHostMobile:window.innerWidth<768,hostHeight:window.innerHeight,hostWidth:window.innerWidth},"*")};return window.addEventListener("message",j),window.addEventListener("resize",Q),r.appendChild(w),{iframe:w,cleanup:()=>{window.removeEventListener("message",j),window.removeEventListener("resize",Q)}}}unmount(r){r.remove()}};var Pe=class{constructor(r,o){this.bootstrapService=r;this.widgetMounter=o;Re(this,"state",{container:null,iframe:null,options:null,currentToken:null});Re(this,"pendingRequests",new Map);Re(this,"handleIframeMessage",async r=>{if(!(this.state.iframe&&r.source!==this.state.iframe.contentWindow)){if(r.data?.type==="NEED_TOKEN"&&this.state.options?.onTokenRequired)try{let o=await this.state.options.onTokenRequired();this.state.currentToken=o,this.state.iframe?.contentWindow?.postMessage({type:"FRUGA_TOKEN_UPDATE",token:o},"*")}catch(o){console.error("FrugaLoader: Failed to refresh token:",o)}if(r.data?.type==="FRUGA_BALANCE_RESPONSE"){let{requestId:o,available:a,pending:c}=r.data;if(o&&this.pendingRequests.has(o)){let{resolve:l,timeout:m}=this.pendingRequests.get(o);clearTimeout(m),this.pendingRequests.delete(o),l({available:a,pending:c})}}}})}async init(r){if(this.state.options=r,r.autoMount!==!1){if(r.token&&(this.state.currentToken=r.token),r.onTokenRequired)try{this.state.currentToken=await r.onTokenRequired()}catch(a){console.error("FrugaLoader: Failed to fetch initial token:",a)}await this.mount()}}setOptions(r){this.state.options=r}async mount(){if(!this.state.options||this.state.container&&this.state.iframe&&document.body.contains(this.state.container))return;let r=K.get(ye.BOOTSTRAP_DATA);if(r)this.doMount(r);else{let o=K.get(ye.BOOTSTRAP_CONFIG);if(o){let a={partnerEnvId:"cached",partnerId:"cached",partnerType:"EXTERNAL_TENANT",partnerPayout:"USER",auth:{mode:"none",audience:"",issuer:"",tokenTtlSeconds:0},config:o};this.doMount(a)}}try{let o=await this.bootstrapService.bootstrap(this.state.options.partnerKey,this.state.options.baseUrl);K.set(ye.BOOTSTRAP_DATA,o),K.set(ye.BOOTSTRAP_CONFIG,o.config),this.doMount(o)}catch{}}doMount(r){if(!this.state.options)return;let{containerId:o="fruga-widget-root"}=this.state.options,a=document.getElementById(o);a?a.innerHTML="":(a=document.createElement("div"),a.id=o,document.body.appendChild(a)),a.style.position="fixed",a.style.bottom="0px",a.style.right="0px",a.style.zIndex="9999";let l={...{...this.state.options,containerId:this.state.options.containerId||"fruga-widget-root",bootstrapConfig:r,token:this.state.currentToken||void 0},partnerId:r.partnerId,partnerType:r.partnerType},{iframe:m,cleanup:k}=this.widgetMounter.mount(a,l,this.state.options);this.state.container=a,this.state.iframe=m,a._frugaCleanup=k,window.addEventListener("message",this.handleIframeMessage)}unmount(){if(this.state.container&&document.body.contains(this.state.container)){let r=this.state.container._frugaCleanup;r?.(),this.widgetMounter.unmount(this.state.container)}this.state.container=null,this.state.iframe=null,window.removeEventListener("message",this.handleIframeMessage)}requestBalance(){this.state.iframe&&this.state.iframe.contentWindow?.postMessage({type:"FRUGA_GET_BALANCE"},"*")}async getBalance(){if(!this.state.iframe)throw new Error("FrugaLoader: Cannot get balance - widget not mounted");let r=Math.random().toString(36).substring(2,15);return new Promise((o,a)=>{let c=setTimeout(()=>{this.pendingRequests.has(r)&&(this.pendingRequests.delete(r),a(new Error("FrugaLoader: Get balance request timed out")))},5e3);this.pendingRequests.set(r,{resolve:o,reject:a,timeout:c}),this.state.iframe?.contentWindow?.postMessage({type:"FRUGA_GET_BALANCE",requestId:r},"*")})}};var wr=new xe,Tr=new Ce,ie=new Pe(wr,Tr),It=async()=>{await ie.mount()},Mt=()=>{ie.unmount()},Ke=async t=>{await ie.init(t)},Lt=t=>{ie.setOptions(t)},Nt=()=>{ie.requestBalance()},Ft=async()=>ie.getBalance();if(typeof window<"u"){let t=document.currentScript;if(t){let r=t.getAttribute("data-partner-key"),o=t.getAttribute("data-container-id")||void 0,a=t.getAttribute("data-app-url")||void 0,c=t.getAttribute("data-base-url")||void 0,l=window.frugaConfig||{};(r||l.partnerKey)&&Ke({partnerKey:r||l.partnerKey||"demo-key",containerId:o||l.containerId,appUrl:a||l.appUrl,baseUrl:c||l.baseUrl,theme:l.theme,primaryColor:l.primaryColor})}window.FrugaLoader={init:Ke,setOptions:Lt,mount:It,unmount:Mt,requestBalance:Nt,getBalance:Ft}}return Qt(_r);})();
19
+ /*! Bundled license information:
20
+
21
+ react/cjs/react-jsx-runtime.production.js:
22
+ (**
23
+ * @license React
24
+ * react-jsx-runtime.production.js
25
+ *
26
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
27
+ *
28
+ * This source code is licensed under the MIT license found in the
29
+ * LICENSE file in the root directory of this source tree.
30
+ *)
31
+
32
+ react/cjs/react.production.js:
33
+ (**
34
+ * @license React
35
+ * react.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ *)
42
+
43
+ react/cjs/react.development.js:
44
+ (**
45
+ * @license React
46
+ * react.development.js
47
+ *
48
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
49
+ *
50
+ * This source code is licensed under the MIT license found in the
51
+ * LICENSE file in the root directory of this source tree.
52
+ *)
53
+
54
+ react/cjs/react-jsx-runtime.development.js:
55
+ (**
56
+ * @license React
57
+ * react-jsx-runtime.development.js
58
+ *
59
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
60
+ *
61
+ * This source code is licensed under the MIT license found in the
62
+ * LICENSE file in the root directory of this source tree.
63
+ *)
64
+ */
65
+ //# sourceMappingURL=loader.global.js.map
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@fruga/sdk",
3
3
  "private": false,
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
+ "license": "Apache-2.0",
5
6
  "description": "Fruga SDK",
6
7
  "main": "dist/index.js",
7
8
  "module": "dist/index.mjs",
@@ -46,11 +47,13 @@
46
47
  "!dist/**/*.map",
47
48
  "!dist/relay/**",
48
49
  "!dist/connect/**",
49
- "!dist/*.global.js",
50
+ "!dist/relay.global.js",
51
+ "!dist/connect.global.js",
50
52
  "loader/package.json",
51
53
  "relay/package.json",
52
54
  "connect/package.json",
53
- "core/package.json"
55
+ "core/package.json",
56
+ "NOTICE"
54
57
  ],
55
58
  "scripts": {
56
59
  "dev": "pnpm -r --parallel --filter !demo dev",