rasp-feedback 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/nextjs/components/MainViewHandler.d.ts +10 -0
  2. package/dist/nextjs/components/MainViewHandler.d.ts.map +1 -0
  3. package/dist/nextjs/components/MainViewHandler.js +17 -0
  4. package/dist/nextjs/components/PostItem.d.ts +7 -0
  5. package/dist/nextjs/components/PostItem.d.ts.map +1 -0
  6. package/dist/nextjs/components/PostItem.js +56 -0
  7. package/dist/nextjs/components/Posttem.d.ts +7 -0
  8. package/dist/nextjs/components/Posttem.d.ts.map +1 -0
  9. package/dist/nextjs/components/Posttem.js +14 -0
  10. package/dist/nextjs/components/RaspForm.d.ts.map +1 -1
  11. package/dist/nextjs/components/RaspForm.js +35 -12
  12. package/dist/nextjs/components/RaspProvider.d.ts.map +1 -1
  13. package/dist/nextjs/components/RaspProvider.js +346 -100
  14. package/dist/nextjs/components/StaticFormComponent.d.ts.map +1 -1
  15. package/dist/nextjs/components/StaticFormComponent.js +73 -24
  16. package/dist/nextjs/functions/functionsexp.d.ts +3 -0
  17. package/dist/nextjs/functions/functionsexp.d.ts.map +1 -1
  18. package/dist/nextjs/functions/functionsexp.js +71 -0
  19. package/dist/vue/components/PostItem.vue.d.ts +13 -0
  20. package/dist/vue/components/PostItem.vue.d.ts.map +1 -0
  21. package/dist/vue/components/RaspForm.vue.d.ts.map +1 -1
  22. package/dist/vue/components/RaspProvider.vue.d.ts.map +1 -1
  23. package/dist/vue/components/Skeleton.vue.d.ts.map +1 -1
  24. package/dist/vue/components/StaticFormComponent.vue.d.ts +3 -3
  25. package/dist/vue/components/StaticFormComponent.vue.d.ts.map +1 -1
  26. package/dist/vue/functions/functionsexp.d.ts +3 -0
  27. package/dist/vue/functions/functionsexp.d.ts.map +1 -1
  28. package/dist/vue/index.css +1 -1
  29. package/dist/vue/index.js +978 -440
  30. package/dist/vue/index.umd.cjs +1 -1
  31. package/dist/vue/rasp-feedback.css +1 -0
  32. package/package.json +97 -97
@@ -0,0 +1,10 @@
1
+ declare function MainViewHandler({ form, mainTheme, fields, post, companyId, isLoadingFeedbackModal }: {
2
+ form: any;
3
+ mainTheme: any;
4
+ fields: any[];
5
+ post?: any;
6
+ companyId: string;
7
+ isLoadingFeedbackModal: boolean;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ export default MainViewHandler;
10
+ //# sourceMappingURL=MainViewHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MainViewHandler.d.ts","sourceRoot":"","sources":["../../../src/nextjs/components/MainViewHandler.tsx"],"names":[],"mappings":"AAGA,iBAAS,eAAe,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,sBAAsB,EAAC,EAAC;IAAG,IAAI,EAAE,GAAG,CAAC;IACvG,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,GAAG,EAAE,CAAC;IACZ,IAAI,CAAC,EAAC,GAAG,CAAC;IACV,SAAS,EAAC,MAAM,CAAC;IACjB,sBAAsB,EAAC,OAAO,CAAC;CAClC,2CAuBA;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect } from 'react';
3
+ function MainViewHandler({ form, mainTheme, fields, post, companyId, isLoadingFeedbackModal }) {
4
+ useEffect(() => {
5
+ if (typeof window === 'undefined')
6
+ return;
7
+ if (!document.getElementById('rasp-google-fonts')) {
8
+ const link = document.createElement('link');
9
+ link.id = 'rasp-google-fonts';
10
+ link.rel = 'stylesheet';
11
+ link.href = 'https://fonts.googleapis.com/css2?family=Inter:wght@600&family=Roboto:wght@600&family=Poppins:wght@800&family=Wix+Madefor+Text:wght@400&family=Montserrat:wght@600&family=Nunito:wght@600&family=Open+Sans:wght@600&family=Lato:wght@700&family=Work+Sans:wght@600&family=Source+Sans+3:wght@600&family=Rubik:wght@600&family=Playfair+Display:wght@700&family=Raleway:wght@700&family=DM+Serif+Display&family=Oswald:wght@600&family=Bebas+Neue&family=Merriweather:wght@700&family=Libre+Baskerville:wght@700&family=Cormorant+Garamond:wght@600&family=JetBrains+Mono:wght@600&family=Fira+Code:wght@600&display=swap';
12
+ document.head.appendChild(link);
13
+ }
14
+ }, []);
15
+ return (_jsx("div", {}));
16
+ }
17
+ export default MainViewHandler;
@@ -0,0 +1,7 @@
1
+ declare function PostItem({ post, setShowVoteUI, setCurrentPost }: {
2
+ post: any;
3
+ setShowVoteUI: any;
4
+ setCurrentPost: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export default PostItem;
7
+ //# sourceMappingURL=PostItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostItem.d.ts","sourceRoot":"","sources":["../../../src/nextjs/components/PostItem.tsx"],"names":[],"mappings":"AAIA,iBAAS,QAAQ,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,cAAc,EAAC,EAAC;IACpD,IAAI,EAAC,GAAG,CAAC;IACT,aAAa,EAAC,GAAG,CAAC;IAClB,cAAc,EAAC,GAAG,CAAC;CAEtB,2CAoEA;AAED,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { fontMap } from '../constants/fontexp';
4
+ import { CircleArrowDown, CircleArrowUp } from 'lucide-react';
5
+ function PostItem({ post, setShowVoteUI, setCurrentPost }) {
6
+ const [isMobile, setIsMobile] = useState(false);
7
+ useEffect(() => {
8
+ if (typeof window === 'undefined')
9
+ return;
10
+ const checkMobile = () => {
11
+ setIsMobile(window.innerWidth <= 768);
12
+ };
13
+ checkMobile();
14
+ window.addEventListener('resize', checkMobile);
15
+ return () => window.removeEventListener('resize', checkMobile);
16
+ }, []);
17
+ return (_jsxs("div", { onClick: () => {
18
+ setCurrentPost(post);
19
+ setShowVoteUI(true);
20
+ }, style: {
21
+ padding: isMobile ? "8px" : "5px",
22
+ width: "100%",
23
+ display: "flex",
24
+ flexDirection: "row",
25
+ gap: isMobile ? "10px" : "20px",
26
+ justifyContent: "start",
27
+ alignItems: "center",
28
+ borderBottom: "2px solid black",
29
+ cursor: "pointer"
30
+ }, children: [_jsxs("div", { style: {
31
+ display: "flex",
32
+ flexDirection: "row",
33
+ gap: "5px",
34
+ alignItems: "center",
35
+ minWidth: isMobile ? "60px" : "auto"
36
+ }, children: [_jsx(CircleArrowUp, { size: isMobile ? 16 : 20 }), _jsx("p", { className: fontMap.wixmadefor.className, style: {
37
+ fontSize: isMobile ? "12px" : "14px"
38
+ }, children: post.upvote_count }), _jsx(CircleArrowDown, { size: isMobile ? 16 : 20 }), _jsx("p", { className: fontMap.wixmadefor.className, style: {
39
+ fontSize: isMobile ? "12px" : "14px"
40
+ }, children: post.downvote_count })] }), _jsxs("div", { style: {
41
+ flex: 1,
42
+ overflow: "hidden"
43
+ }, children: [_jsx("h1", { className: fontMap.poppins.className, style: {
44
+ fontSize: isMobile ? "11px" : "12px",
45
+ whiteSpace: isMobile ? "nowrap" : "normal",
46
+ overflow: isMobile ? "hidden" : "visible",
47
+ textOverflow: isMobile ? "ellipsis" : "clip"
48
+ }, children: post.title }), _jsx("h2", { className: fontMap.wixmadefor.className, style: {
49
+ fontSize: isMobile ? "9px" : "10px",
50
+ color: "gray",
51
+ whiteSpace: isMobile ? "nowrap" : "normal",
52
+ overflow: isMobile ? "hidden" : "visible",
53
+ textOverflow: isMobile ? "ellipsis" : "clip"
54
+ }, children: isMobile ? post.subtitle.slice(0, 45) + "..." : post.subtitle.slice(0, 65) + "..." })] })] }));
55
+ }
56
+ export default PostItem;
@@ -0,0 +1,7 @@
1
+ declare function Posttem({ post, setShowVoteUI, setCurrentPost }: {
2
+ post: any;
3
+ setShowVoteUI: any;
4
+ setCurrentPost: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ export default Posttem;
7
+ //# sourceMappingURL=Posttem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Posttem.d.ts","sourceRoot":"","sources":["../../../src/nextjs/components/Posttem.tsx"],"names":[],"mappings":"AAGA,iBAAS,OAAO,CAAC,EAAC,IAAI,EAAE,aAAa,EAAE,cAAc,EAAC,EAAC;IACnD,IAAI,EAAC,GAAG,CAAC;IACT,aAAa,EAAC,GAAG,CAAC;IAClB,cAAc,EAAC,GAAG,CAAC;CAEtB,2CAeA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { fontMap } from '../constants/fontexp';
3
+ function Posttem({ post, setShowVoteUI, setCurrentPost }) {
4
+ return (_jsxs("div", { onClick: () => {
5
+ setCurrentPost(post);
6
+ setShowVoteUI(true);
7
+ }, style: { padding: "5px" }, children: [_jsx("h1", { className: fontMap.poppins.className, style: {
8
+ fontSize: "12px"
9
+ }, children: post.title }), _jsx("h2", { className: fontMap.poppins.className, style: {
10
+ fontSize: "12px",
11
+ color: "gray"
12
+ }, children: post.subtitle.slice(0, 25) + "..." })] }));
13
+ }
14
+ export default Posttem;
@@ -1 +1 @@
1
- {"version":3,"file":"RaspForm.d.ts","sourceRoot":"","sources":["../../../src/nextjs/components/RaspForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAS3C,UAAU,KAAK;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,QAAQ,CAAC,EAAE,WAAW,EAAE,EAAE,KAAK,2CAmK9C"}
1
+ {"version":3,"file":"RaspForm.d.ts","sourceRoot":"","sources":["../../../src/nextjs/components/RaspForm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAS3C,UAAU,KAAK;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,QAAQ,CAAC,EAAE,WAAW,EAAE,EAAE,KAAK,2CA6L9C"}
@@ -14,6 +14,7 @@ export function RaspForm({ otherStyles }) {
14
14
  const [fields, setFields] = useState(null);
15
15
  const [mainTheme, setMainTheme] = useState(null);
16
16
  const [isLoading, setIsLoading] = useState(true);
17
+ const [isMobile, setIsMobile] = useState(false);
17
18
  const getForm = async () => {
18
19
  const f = await getFormByDomainOrCompany(companyId, currentUrl);
19
20
  if (!f) {
@@ -27,6 +28,13 @@ export function RaspForm({ otherStyles }) {
27
28
  if (typeof window !== 'undefined') {
28
29
  setCompanyId(process.env.NEXT_PUBLIC_RASP_COMPANY_ID);
29
30
  setCurrentUrl(window.location.href);
31
+ // Check if mobile
32
+ const checkMobile = () => {
33
+ setIsMobile(window.innerWidth <= 768);
34
+ };
35
+ checkMobile();
36
+ window.addEventListener('resize', checkMobile);
37
+ return () => window.removeEventListener('resize', checkMobile);
30
38
  }
31
39
  }, []);
32
40
  useEffect(() => {
@@ -74,7 +82,7 @@ export function RaspForm({ otherStyles }) {
74
82
  width: "auto",
75
83
  height: "auto",
76
84
  display: "inline-block",
77
- transform: "translate(-50%, -25%)",
85
+ transform: isMobile ? "none" : "translate(-50%, -25%)",
78
86
  overflow: "visible",
79
87
  ...otherStyles
80
88
  }, children: _jsx(StaticFormComponent, { form: form, mainTheme: mainTheme, fields: fields }) }) }), !isLoading && !form && _jsxs("div", { style: {
@@ -83,13 +91,27 @@ export function RaspForm({ otherStyles }) {
83
91
  alignItems: 'center',
84
92
  borderRadius: '0.75rem',
85
93
  backgroundColor: 'white',
86
- margin: '1.25rem',
87
- width: '470px',
88
- minHeight: '400px',
94
+ margin: isMobile ? '0.75rem' : '1.25rem',
95
+ width: isMobile ? '90vw' : '470px',
96
+ maxWidth: '470px',
97
+ minHeight: isMobile ? '350px' : '400px',
89
98
  border: '1px solid black',
90
- padding: '1rem',
99
+ padding: isMobile ? '0.75rem' : '1rem',
91
100
  boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)'
92
- }, children: [_jsx("br", {}), _jsx("br", {}), _jsx("img", { src: RASP_LOGO_BASE64, width: "150px", height: "150px", alt: "rasp logo" }), _jsx("h1", { className: `${fontMap.poppins.className}`, children: "404" }), _jsx("h2", { className: `${fontMap.wixmadefor.className}`, style: { textAlign: 'center' }, children: !companyId ? "CompanyId is not provided. Please provide companyId in your env file." : "No forms found for this URL." }), !companyId && _jsxs("p", { className: `${fontMap.wixmadefor.className}`, style: { textAlign: 'center' }, children: [" Refer to Rasp docs for help: ", _jsx("a", { href: 'https://tryrasp.online/docs', style: { textDecoration: "underline" }, children: "https://tryrasp.online/docs" })] }), companyId && _jsxs("p", { className: `${fontMap.wixmadefor.className}`, style: { textAlign: 'center' }, children: [" Set this as your form domain url: ", currentUrl] })] }), isLoading &&
101
+ }, children: [_jsx("br", {}), _jsx("br", {}), _jsx("img", { src: RASP_LOGO_BASE64, width: isMobile ? "120px" : "150px", height: isMobile ? "120px" : "150px", alt: "rasp logo" }), _jsx("h1", { className: `${fontMap.poppins.className}`, style: { fontSize: isMobile ? '2rem' : '2.5rem' }, children: "404" }), _jsx("h2", { className: `${fontMap.wixmadefor.className}`, style: {
102
+ textAlign: 'center',
103
+ fontSize: isMobile ? '0.9rem' : '1rem',
104
+ padding: isMobile ? '0 0.5rem' : '0'
105
+ }, children: !companyId ? "CompanyId is not provided. Please provide companyId in your env file." : "No forms found for this URL." }), !companyId && _jsxs("p", { className: `${fontMap.wixmadefor.className}`, style: {
106
+ textAlign: 'center',
107
+ fontSize: isMobile ? '0.85rem' : '1rem',
108
+ padding: isMobile ? '0 0.5rem' : '0'
109
+ }, children: [" Refer to Rasp docs for help: ", _jsx("a", { href: 'https://tryrasp.online/docs', style: { textDecoration: "underline" }, children: "https://tryrasp.online/docs" })] }), companyId && _jsxs("p", { className: `${fontMap.wixmadefor.className}`, style: {
110
+ textAlign: 'center',
111
+ fontSize: isMobile ? '0.85rem' : '1rem',
112
+ padding: isMobile ? '0 0.5rem' : '0',
113
+ wordBreak: 'break-all'
114
+ }, children: [" Set this as your form domain url: ", currentUrl] })] }), isLoading &&
93
115
  _jsx("div", { id: "rasp-form-div", style: {
94
116
  padding: 0,
95
117
  margin: 0,
@@ -98,7 +120,7 @@ export function RaspForm({ otherStyles }) {
98
120
  width: "auto",
99
121
  height: "auto",
100
122
  display: "inline-block",
101
- transform: "translate(-50%, -25%)",
123
+ transform: isMobile ? "none" : "translate(-50%, -25%)",
102
124
  overflow: "visible",
103
125
  }, children: _jsx("div", { style: {
104
126
  display: 'flex',
@@ -106,11 +128,12 @@ export function RaspForm({ otherStyles }) {
106
128
  justifyContent: 'center',
107
129
  borderRadius: '0.75rem',
108
130
  backgroundColor: "white",
109
- margin: '1.25rem',
110
- width: '470px',
111
- minHeight: '400px',
131
+ margin: isMobile ? '0.75rem' : '1.25rem',
132
+ width: isMobile ? '90vw' : '470px',
133
+ maxWidth: '470px',
134
+ minHeight: isMobile ? '350px' : '400px',
112
135
  border: '1px solid whitesmoke',
113
- padding: '2rem',
136
+ padding: isMobile ? '1.5rem' : '2rem',
114
137
  paddingTop: "0px"
115
- }, children: _jsxs("div", { style: { marginTop: "-30px" }, children: [_jsx(Skeleton, { width: 400, height: 40 }), _jsx(Skeleton, { width: 400, height: 30 }), _jsx("br", {}), _jsx(Skeleton, { width: 400, height: 70 }), _jsx(Skeleton, { width: 400, height: 100 })] }) }) })] }));
138
+ }, children: _jsxs("div", { style: { marginTop: "-30px" }, children: [_jsx(Skeleton, { width: isMobile ? Math.min(window.innerWidth * 0.8, 400) : 400, height: 40 }), _jsx(Skeleton, { width: isMobile ? Math.min(window.innerWidth * 0.8, 400) : 400, height: 30 }), _jsx("br", {}), _jsx(Skeleton, { width: isMobile ? Math.min(window.innerWidth * 0.8, 400) : 400, height: 70 }), _jsx(Skeleton, { width: isMobile ? Math.min(window.innerWidth * 0.8, 400) : 400, height: 100 })] }) }) })] }));
116
139
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RaspProvider.d.ts","sourceRoot":"","sources":["../../../src/nextjs/components/RaspProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAKlD,OAAO,cAAc,CAAA;AAMrB,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAC;QAChB,GAAG,CAAC,EAAC,MAAM,CAAC;QACZ,IAAI,CAAC,EAAC,MAAM,CAAA;KACb,CAAA;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAGD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAoNpD,CAAA"}
1
+ {"version":3,"file":"RaspProvider.d.ts","sourceRoot":"","sources":["../../../src/nextjs/components/RaspProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAKlD,OAAO,cAAc,CAAA;AAQrB,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAC;QAChB,GAAG,CAAC,EAAC,MAAM,CAAC;QACZ,IAAI,CAAC,EAAC,MAAM,CAAA;KACb,CAAA;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAGD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqiBpD,CAAA"}