@tugitark/react-widget 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +4 -3
  2. package/index.js +1 -45
  3. package/package.json +12 -5
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import type { Props } from '@tugitark/declarative-widget';
2
- declare function Widget(p: Props): null;
3
- export default Widget;
1
+ import type { Props, TugiWidget, WidgetInitializeOptions, WidgetFreeVersionOptions, TugiWidgetEvents, WidgetFreeSection } from '@tugitark/declarative-widget';
2
+ export type { Props, TugiWidget, WidgetInitializeOptions, WidgetFreeVersionOptions, TugiWidgetEvents, WidgetFreeSection, };
3
+ declare function TugiWidget(props: Props): any;
4
+ export default TugiWidget;
package/index.js CHANGED
@@ -1,45 +1 @@
1
- // Copyright (c) 2026, TugiTark. All rights reserved.
2
-
3
- import { useState, useCallback } from 'react';
4
-
5
- import render from '@tugitark/declarative-widget';
6
-
7
- function Widget({ onNotification, onReady, onOpened, onClosed, onError, ...props }) {
8
- // Is this the first time this component has been rendered ever?
9
- const [firstTime, setFirstTime] = useState(true);
10
- const isFree = props.jwtFn == null && props.user == null;
11
-
12
- const onNotification_ = useCallback((hasNotification) => {
13
- if (isFree && !firstTime) {
14
- // Replicate FAQ internal behaviour at a per-component level.
15
- return;
16
- }
17
- onNotification && onNotification(hasNotification);
18
- }, [onNotification, firstTime, isFree]);
19
-
20
- props.onReady = useCallback(() => {
21
- if (firstTime) {
22
- setFirstTime(false);
23
- onReady && onReady();
24
- }
25
- }, [onReady, firstTime]);
26
-
27
- props.onOpened = useCallback(() => {
28
- onOpened && onOpened();
29
- }, [onOpened]);
30
-
31
- props.onClosed = useCallback(() => {
32
- onClosed && onClosed();
33
- }, [onClosed]);
34
-
35
- props.onError = useCallback((e) => {
36
- onError && onError(e);
37
- }, [onError]);
38
-
39
- render(props);
40
-
41
- return null;
42
- }
43
-
44
- export default Widget;
45
-
1
+ import{useState as s,useCallback as u}from"react";import v from"@tugitark/declarative-widget";function c(i){var n=s(!0),e=n[0],o=n[1],r=i.onNotification,a=i.onReady,t=Object.assign({},i),f=t.jwtFn==null&&t.user==null;return t.onNotification=u(function(l){f&&!e||r&&r(l)},[r,e,f]),t.onReady=u(function(){e&&(o(!1),a&&a())},[a,e,o]),v(t),null}export default c;
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@tugitark/react-widget",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Wraps the tugitark widget in a React component.",
5
5
  "scripts": {
6
- "release": "npm publish --access public"
6
+ "build": "npx esbuild index.ts --target=es6 --outfile=index.js && sed -i 's/\\bconst\\b/var/g' index.js && sed -i 's/\\blet\\b/var/g' index.js && npx esbuild index.js --allow-overwrite --minify --target=es5 --outfile=index.js && npx tsc --noErrorTruncation --declaration --emitDeclarationOnly --target es6 --module nodenext --moduleResolution nodenext --outDir . index.ts",
7
+ "release": "npm publish --access public",
8
+ "prerelease": "npm run build"
7
9
  },
8
10
  "files": [
9
11
  "index.d.ts",
@@ -12,9 +14,14 @@
12
14
  ],
13
15
  "dependencies": {
14
16
  "@tugitark/declarative-widget": "^1.0.2"
15
- },
16
- "peerDependencies": {
17
- "react": ">=0.0.0"
17
+ },
18
+ "peerDependencies": {
19
+ "react": ">=0.0.0"
20
+ },
21
+ "devDependencies": {
22
+ "esbuild": "^0.27.2",
23
+ "react": "^19.2.3",
24
+ "typescript": "^5.9.3"
18
25
  },
19
26
  "keywords": [
20
27
  "Typescript",