@portnet/ui 5.0.12 → 5.0.14
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/dist/api/guideApi.js +12 -0
- package/dist/api/guideImageService.js +119 -0
- package/dist/api/reclamationApi.js +83 -0
- package/dist/assets/guides/FAQ.json +118 -0
- package/dist/assets/guides/index.js +11 -0
- package/dist/assets/images/tijariaLogo.ico +0 -0
- package/dist/components/common/PuiHelpWidgetContext.js +17 -0
- package/dist/components/providers/PuiHelpWidgetProvider.js +85 -0
- package/dist/components/widgets/GuideImage.js +251 -0
- package/dist/components/widgets/PuiHelpWidget.js +3633 -0
- package/dist/hooks/useReclamation.js +68 -0
- package/dist/index.js +14 -0
- package/dist/styles/ReclamationFormModal.css +569 -0
- package/dist/styles/help-widget.css +621 -0
- package/package.json +114 -100
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
5
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = exports.GuideImageGallery = exports.CompactImageGallery = void 0;
|
|
10
|
+
require("core-js/modules/es.promise.js");
|
|
11
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
12
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
13
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _material = require("@mui/material");
|
|
16
|
+
var _PuiHelpWidgetContext = require("../common/PuiHelpWidgetContext");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
const WIDGET_FONT = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
|
|
25
|
+
const GuideImage = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
projectCode,
|
|
28
|
+
imageOrder,
|
|
29
|
+
alt,
|
|
30
|
+
style,
|
|
31
|
+
className,
|
|
32
|
+
onClick: _onClick
|
|
33
|
+
} = _ref;
|
|
34
|
+
const {
|
|
35
|
+
guideImageService
|
|
36
|
+
} = (0, _PuiHelpWidgetContext.useHelpWidget)();
|
|
37
|
+
const [imageUrl, setImageUrl] = (0, _react.useState)(null);
|
|
38
|
+
const [loading, setLoading] = (0, _react.useState)(true);
|
|
39
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
40
|
+
(0, _react.useEffect)(() => {
|
|
41
|
+
let isMounted = true;
|
|
42
|
+
async function fetchImage() {
|
|
43
|
+
try {
|
|
44
|
+
setLoading(true);
|
|
45
|
+
setError(null);
|
|
46
|
+
const url = await guideImageService.loadGuideImage(projectCode, imageOrder);
|
|
47
|
+
if (isMounted) {
|
|
48
|
+
setImageUrl(url);
|
|
49
|
+
setLoading(false);
|
|
50
|
+
}
|
|
51
|
+
} catch (err) {
|
|
52
|
+
if (isMounted) {
|
|
53
|
+
setError(err.message || "Failed to load image");
|
|
54
|
+
setLoading(false);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
fetchImage();
|
|
59
|
+
return () => {
|
|
60
|
+
isMounted = false;
|
|
61
|
+
};
|
|
62
|
+
}, [projectCode, imageOrder, guideImageService]);
|
|
63
|
+
if (loading) {
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
65
|
+
style: _objectSpread({
|
|
66
|
+
width: "100%",
|
|
67
|
+
height: "200px",
|
|
68
|
+
display: "flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
backgroundColor: "#f8f9fa",
|
|
72
|
+
borderRadius: "8px",
|
|
73
|
+
border: "1px solid #e8eaed"
|
|
74
|
+
}, style),
|
|
75
|
+
className: className,
|
|
76
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
77
|
+
style: {
|
|
78
|
+
textAlign: "center"
|
|
79
|
+
},
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
|
|
81
|
+
size: 20,
|
|
82
|
+
sx: {
|
|
83
|
+
color: "#1967d2",
|
|
84
|
+
marginBottom: "8px"
|
|
85
|
+
}
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
87
|
+
component: "div",
|
|
88
|
+
sx: {
|
|
89
|
+
fontSize: "12px",
|
|
90
|
+
color: "#5f6368",
|
|
91
|
+
fontFamily: WIDGET_FONT,
|
|
92
|
+
lineHeight: "normal"
|
|
93
|
+
},
|
|
94
|
+
children: "Chargement de l'image..."
|
|
95
|
+
})]
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (error) {
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
101
|
+
style: _objectSpread({
|
|
102
|
+
width: "100%",
|
|
103
|
+
height: "200px",
|
|
104
|
+
display: "flex",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
justifyContent: "center",
|
|
107
|
+
backgroundColor: "#f8f9fa",
|
|
108
|
+
borderRadius: "8px",
|
|
109
|
+
border: "1px solid #e8eaed"
|
|
110
|
+
}, style),
|
|
111
|
+
className: className,
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
113
|
+
style: {
|
|
114
|
+
textAlign: "center",
|
|
115
|
+
padding: "20px"
|
|
116
|
+
},
|
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
|
|
118
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
119
|
+
width: "40",
|
|
120
|
+
height: "40",
|
|
121
|
+
viewBox: "0 0 24 24",
|
|
122
|
+
fill: "none",
|
|
123
|
+
stroke: "#5f6368",
|
|
124
|
+
strokeWidth: "2",
|
|
125
|
+
strokeLinecap: "round",
|
|
126
|
+
strokeLinejoin: "round",
|
|
127
|
+
style: {
|
|
128
|
+
marginBottom: "8px"
|
|
129
|
+
},
|
|
130
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
131
|
+
x: "3",
|
|
132
|
+
y: "3",
|
|
133
|
+
width: "18",
|
|
134
|
+
height: "18",
|
|
135
|
+
rx: "2",
|
|
136
|
+
ry: "2"
|
|
137
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
138
|
+
cx: "8.5",
|
|
139
|
+
cy: "8.5",
|
|
140
|
+
r: "1.5"
|
|
141
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("polyline", {
|
|
142
|
+
points: "21 15 16 10 5 21"
|
|
143
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
|
|
144
|
+
x1: "3",
|
|
145
|
+
y1: "3",
|
|
146
|
+
x2: "21",
|
|
147
|
+
y2: "21"
|
|
148
|
+
})]
|
|
149
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
150
|
+
component: "div",
|
|
151
|
+
sx: {
|
|
152
|
+
fontSize: "12px",
|
|
153
|
+
color: "#5f6368",
|
|
154
|
+
fontFamily: WIDGET_FONT,
|
|
155
|
+
lineHeight: "normal"
|
|
156
|
+
},
|
|
157
|
+
children: "Image non disponible"
|
|
158
|
+
})]
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
163
|
+
src: imageUrl,
|
|
164
|
+
alt: alt || "Image ".concat(imageOrder),
|
|
165
|
+
onClick: () => _onClick && _onClick(imageUrl),
|
|
166
|
+
style: _objectSpread({
|
|
167
|
+
width: "100%",
|
|
168
|
+
height: "auto",
|
|
169
|
+
borderRadius: "8px",
|
|
170
|
+
border: "1px solid #e8eaed",
|
|
171
|
+
display: "block",
|
|
172
|
+
cursor: _onClick ? "pointer" : "default",
|
|
173
|
+
transition: "transform 0.2s, box-shadow 0.2s"
|
|
174
|
+
}, style),
|
|
175
|
+
className: className,
|
|
176
|
+
onMouseEnter: e => {
|
|
177
|
+
if (_onClick) {
|
|
178
|
+
e.currentTarget.style.transform = "scale(1.02)";
|
|
179
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
onMouseLeave: e => {
|
|
183
|
+
if (_onClick) {
|
|
184
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
185
|
+
e.currentTarget.style.boxShadow = "none";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
const GuideImageGallery = _ref2 => {
|
|
191
|
+
let {
|
|
192
|
+
projectCode,
|
|
193
|
+
imageOrders,
|
|
194
|
+
columns = 1,
|
|
195
|
+
onImageClick
|
|
196
|
+
} = _ref2;
|
|
197
|
+
if (!imageOrders || imageOrders.length === 0) return null;
|
|
198
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
199
|
+
style: {
|
|
200
|
+
display: "grid",
|
|
201
|
+
gridTemplateColumns: columns === 1 ? "1fr" : "repeat(".concat(columns, ", 1fr)"),
|
|
202
|
+
gap: "16px",
|
|
203
|
+
marginTop: "16px",
|
|
204
|
+
marginBottom: "16px"
|
|
205
|
+
},
|
|
206
|
+
children: imageOrders.map((imageOrder, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(GuideImage, {
|
|
207
|
+
projectCode: projectCode,
|
|
208
|
+
imageOrder: imageOrder,
|
|
209
|
+
alt: "Image ".concat(index + 1),
|
|
210
|
+
onClick: onImageClick
|
|
211
|
+
}, imageOrder))
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
exports.GuideImageGallery = GuideImageGallery;
|
|
215
|
+
const CompactImageGallery = _ref3 => {
|
|
216
|
+
let {
|
|
217
|
+
projectCode,
|
|
218
|
+
imageOrders,
|
|
219
|
+
onImageClick
|
|
220
|
+
} = _ref3;
|
|
221
|
+
if (!imageOrders || imageOrders.length === 0) return null;
|
|
222
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
223
|
+
style: {
|
|
224
|
+
display: "flex",
|
|
225
|
+
gap: "12px",
|
|
226
|
+
overflowX: "auto",
|
|
227
|
+
marginTop: "16px",
|
|
228
|
+
marginBottom: "16px",
|
|
229
|
+
paddingBottom: "8px"
|
|
230
|
+
},
|
|
231
|
+
children: imageOrders.map((imageOrder, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
232
|
+
style: {
|
|
233
|
+
minWidth: "200px",
|
|
234
|
+
maxWidth: "200px",
|
|
235
|
+
flexShrink: 0
|
|
236
|
+
},
|
|
237
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GuideImage, {
|
|
238
|
+
projectCode: projectCode,
|
|
239
|
+
imageOrder: imageOrder,
|
|
240
|
+
alt: "Image ".concat(index + 1),
|
|
241
|
+
style: {
|
|
242
|
+
height: "150px",
|
|
243
|
+
objectFit: "cover"
|
|
244
|
+
},
|
|
245
|
+
onClick: onImageClick
|
|
246
|
+
})
|
|
247
|
+
}, imageOrder))
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
exports.CompactImageGallery = CompactImageGallery;
|
|
251
|
+
var _default = exports.default = GuideImage;
|