etiquetas.js 1.0.0-alpha.5 → 1.0.0-alpha.7
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/etiquetas.es.js +58 -59
- package/dist/etiquetas.umd.js +28 -28
- package/dist/etiquetas.umd.js.map +1 -1
- package/dist/{index-B10y8IWE.js → index-Tvy8FVsM.js} +291 -285
- package/dist/index-Tvy8FVsM.js.map +1 -0
- package/dist/{index.es-D4Dr85b7.js → index.es-yItW81m8.js} +2 -2
- package/dist/{index.es-D4Dr85b7.js.map → index.es-yItW81m8.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B10y8IWE.js.map +0 -1
|
@@ -89,6 +89,232 @@ var __asyncGenerator = (__this, __arguments, generator) => {
|
|
|
89
89
|
var __forAwait = (obj, it2, method) => (it2 = obj[__knownSymbol("asyncIterator")]) ? it2.call(obj) : (obj = obj[__knownSymbol("iterator")](), it2 = {}, method = (key, fn) => (fn = obj[key]) && (it2[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it2);
|
|
90
90
|
var _Util_static, getExtremumOnCurve_fn, getExtremum_fn, _regex, _toolbar, _colorPicker, _editor, _buttons, _altText, _comment, _signatureDescriptionButton, _l10nRemove, _EditorToolbar_static, pointerDown_fn, _EditorToolbar_instances, focusIn_fn, focusOut_fn, addListenersToElement_fn, divider_get, _buttons2, _toolbar2, _uiManager, _HighlightToolbar_instances, render_fn, getLastPoint_fn, addHighlightButton_fn, _id, _baseId, _id2, _cache, _ImageManager_instances, get_fn, _commands, _locked, _maxSize, _position, _KeyboardManager_instances, serialize_fn, _abortController, _activeEditor, _allEditors, _allLayers, _altTextManager, _annotationStorage, _changedExistingAnnotations, _commandManager, _commentManager, _copyPasteAC, _currentDrawingSession, _currentPageIndex, _deletedAnnotationsElementIds, _draggingEditors, _editorTypes, _editorsToRescale, _enableHighlightFloatingButton, _enableUpdatedAddImage, _enableNewAltTextWhenAddingImage, _filterFactory, _focusMainContainerTimeoutId, _focusManagerAC, _highlightColors, _highlightWhenShiftUp, _highlightToolbar, _idManager, _isEnabled, _isWaiting, _keyboardManagerAC, _lastActiveElement, _mainHighlightColorPicker, _missingCanvases, _mlManager, _mode, _selectedEditors, _selectedTextNode, _signatureManager, _pageColors, _showAllStates, _previousStates, _translation, _translationTimeoutId, _container, _viewer, _viewerAlert, _updateModeCapability, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn, getLayerForTextLayer_fn, displayHighlightToolbar_fn, selectionChange_fn, onSelectEnd_fn, addSelectionListener_fn, addFocusManager_fn, removeFocusManager_fn, addKeyboardManager_fn, removeKeyboardManager_fn, addCopyPasteListeners_fn, removeCopyPasteListeners_fn, addDragAndDropListeners_fn, dispatchUpdateStates_fn, dispatchUpdateUI_fn, enableAll_fn, disableAll_fn, addEditorToLayer_fn, lastSelectedEditor_get, isEmpty_fn, selectEditors_fn, _altText2, _altTextDecorative, _altTextButton, _altTextButtonLabel, _altTextTooltip, _altTextTooltipTimeout, _altTextWasFromKeyBoard, _badge, _editor2, _guessedText, _textWithDisclaimer, _useNewAltTextFlow, _l10nNewButton, _AltText_instances, label_get, setState_fn, _commentButton, _commentWasFromKeyBoard, _editor3, _initialText, _text, _date, _deleted, _container2, _isPinching, _isPinchingStopped, _isPinchingDisabled, _onPinchStart, _onPinching, _onPinchEnd, _pointerDownAC, _signal, _touchInfo, _touchManagerAC, _touchMoveAC, _TouchManager_instances, onTouchStart_fn, onTouchMove_fn, onTouchEnd_fn, _accessibilityData, _allResizerDivs, _altText3, _comment2, _disabled, _dragPointerId, _dragPointerType, _keepAspectRatio, _resizersDiv, _lastPointerCoords, _savedDimensions, _focusAC, _focusedResizerName, _hasBeenClicked, _initialRect, _isEditing, _isInEditMode, _isResizerEnabledForKeyboard, _moveInDOMTimeout, _prevDragX, _prevDragY, _telemetryTimeouts, _touchManager, _isDraggable, _zIndex, _AnnotationEditor_instances, translate_fn, _AnnotationEditor_static, rotatePoint_fn, getRotationMatrix_fn, createResizers_fn, resizerPointerdown_fn, resize_fn, addResizeToUndoStack_fn, resizerPointermove_fn, touchPinchStartCallback_fn, touchPinchCallback_fn, touchPinchEndCallback_fn, selectOnPointerEvent_fn, setUpDragSession_fn, addFocusListeners_fn, resizerKeydown_fn, resizerBlur_fn, resizerFocus_fn, setResizerTabIndex_fn, stopResizing_fn, _modified, _modifiedIds, _storage, _AnnotationStorage_instances, setModified_fn, _serializable, _systemFonts, _listeners, _deferred, _messageAC, _MessageHandler_instances, onMessage_fn, createStreamSink_fn, processStreamMessage_fn, deleteStreamController_fn, _enableHWA, _baseUrl, __cache, __defs, _docId, _document, __hcmCache, _id3, _DOMFilterFactory_instances, cache_get, hcmCache_get, defs_get, createTables_fn, createUrl_fn, addLuminosityConversion_fn, addGrayConversion_fn, createFilter_fn, appendFeFunc_fn, addTransferMapConversion_fn, addTransferMapAlphaConversion_fn, getRGB_fn, _CanvasGraphics_instances, restoreInitialState_fn, drawFilter_fn, getScaledPath_fn, _port, _src, _map, _data, _isDisplay, _isPrint, _userSet, _visible, _cachedGetHash, _groups, _initialHash, _order, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn, _objs, _PDFObjects_instances, ensureObj_fn, _g, _capability, _container3, _disableProcessItems, _fontInspectorEnabled, _lang, _layoutTextParams, _pageHeight, _pageWidth, _reader, _rootContainer, _rotation, _scale, _styleCache, _textContentItemsStr, _textContentSource, _textDivs, _textDivProperties, _transform, _ascentCache, _canvasContexts, _canvasCtxFonts, _minFontSize, _pendingTextLayers, _TextLayer_instances, processItems_fn, appendText_fn, layout_fn, _TextLayer_static, getCtx_fn, ensureCtxFont_fn, ensureMinFontSizeComputed_fn, getAscent_fn, _docId2, _capability2, _progressiveDoneListeners, _progressiveReadListeners, _progressListeners, _rangeListeners, _pendingCleanup, _PDFPageProxy_instances, tryCleanup_fn, _capability3, _messageHandler, _port2, _webWorker, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _PDFWorker_instances, resolve_fn, initializeFromPort_fn, initialize_fn, setupFakeWorker_fn, _PDFWorker_static, mainThreadWorkerMessageHandler_get, _methodPromises, _pageCache, _pagePromises, _pageRefCache, _passwordCapability, _WorkerTransport_instances, cacheSimpleMethod_fn, _internalRenderTask, _rAF, _canvasInUse, _button, _buttonSwatch, _defaultColor, _dropdown, _dropdownWasFromKeyboard, _isMainColorPicker, _editor4, _eventBus, _openDropdownAC, _uiManager2, _l10nColor, _ColorPicker_instances, getDropdownRoot_fn, colorSelect_fn, keyDown_fn, openDropdown_fn, pointerDown_fn2, isDropdownVisible_get, _input, _editor5, _uiManager3, _l10nColor2, _updates, _hasBorder, _popupElement, _AnnotationElement_instances, setRectEdited_fn, _LinkAnnotationElement_instances, setInternalLink_fn, bindAttachment_fn, bindSetOCGState_fn, _boundKeyDown, _boundHide, _boundShow, _boundToggle, _color, _container4, _contentsObj, _dateObj, _elements, _parent, _parentRect, _pinned, _popup, _popupAbortController, _position2, _rect, _richText, _titleObj, _updates2, _wasVisible, _PopupElement_instances, addEventListeners_fn, html_get, fontSize_get, fontColor_get, makePopupContent_fn, keyDown_fn2, setPosition_fn, toggle_fn, show_fn, hide_fn, _line, _square, _circle, _polyline, _polylinesGroupElement, _polylines, _InkAnnotationElement_instances, getTransform_fn, _trigger, _FileAttachmentAnnotationElement_instances, download_fn, _accessibilityManager, _annotationCanvasMap, _editableAnnotations, _structTreeLayer, _AnnotationLayer_instances, appendElement_fn, setAnnotationCanvasMap_fn, _color2, _content, _editorDivId, _editModeAC, _fontSize, _FreeTextEditor_instances, updateFontSize_fn, updateColor_fn, extractText_fn, setEditorDimensions_fn, _FreeTextEditor_static, getNodeContent_fn, setContent_fn, serializeContent_fn, deserializeContent_fn, hasElementChanged_fn, _box, _bottom, _innerMargin, _isLTR, _top, _last, _lastX, _lastY, _min, _min_dist, _scaleFactor, _thickness, _points, _MIN_DIST, _MIN_DIFF, _MIN, _FreeDrawOutliner_instances, getLastCoords_fn, toSVGPathTwoPoints_fn, toSVGPathStart_fn, toSVGPathEnd_fn, getOutlineTwoPoints_fn, getOutlineStart_fn, getOutlineEnd_fn, _box2, _bbox, _innerMargin2, _isLTR2, _points2, _scaleFactor2, _outline, _FreeDrawOutline_instances, computeMinMax_fn, _box3, _lastPoint, _verticalEdges, _intervals, _HighlightOutliner_instances, getOutlines_fn, binarySearch_fn, insert_fn, remove_fn, breakEdge_fn, _box4, _outlines, _anchorNode, _anchorOffset, _boxes, _clipPathId, _colorPicker2, _focusOutlines, _focusNode, _focusOffset, _highlightDiv, _highlightOutlines, _id4, _isFreeHighlight, _lastPoint2, _opacity, _outlineId, _text2, _thickness2, _methodOfCreation, _HighlightEditor_instances, createOutlines_fn, createFreeOutlines_fn, updateColor_fn2, updateThickness_fn, changeThickness_fn, cleanDrawLayer_fn, addToDrawLayer_fn, _HighlightEditor_static, rotateBbox_fn, keydown_fn, setCaret_fn, getRotation_fn, serializeBoxes_fn, serializeOutlines_fn, highlightMove_fn, endHighlight_fn, hasElementChanged_fn2, _svgProperties, _drawOutlines, _mustBeCommitted, _currentDraw, _currentDrawingAC, _currentDrawingOptions, _currentPointerId, _currentPointerType, _currentPointerIds, _currentMoveTimestamp, _DrawingEditor_instances, createDrawOutlines_fn, createDrawing_fn, cleanDrawLayer_fn2, addToDrawLayer_fn2, convertToParentSpace_fn, convertToDrawSpace_fn, updateBbox_fn, rotateBox_fn, _last2, _line2, _lines, _rotation2, _thickness3, _points3, _lastSVGPath, _lastIndex, _outlines2, _parentWidth, _parentHeight, _InkDrawOutliner_instances, normalizePoint_fn, _bbox2, _currentRotation, _innerMargin3, _lines2, _parentWidth2, _parentHeight2, _parentScale, _rotation3, _thickness4, _InkDrawOutline_instances, getMarginComponents_fn, getBBoxWithNoMargin_fn, computeBbox_fn, updateThickness_fn2, _InkEditor_instances, hasElementChanged_fn3, _PARAMETERS, _SignatureExtractor_static, neighborIndexToId_fn, _neighborIdToIndex, clockwiseNonZero_fn, counterClockwiseNonZero_fn, findContours_fn, douglasPeuckerHelper_fn, douglasPeucker_fn, bilateralFilter_fn, getHistogram_fn, toUint8_fn, guessThreshold_fn, getGrayPixels_fn, _isExtracted, _description, _signatureData, _signatureUUID, _bitmap, _bitmapId, _bitmapPromise, _bitmapUrl, _bitmapFile, _bitmapFileName, _canvas3, _missingCanvas, _resizeTimeoutId, _isSvg, _hasBeenAddedInUndoStack, _StampEditor_instances, getBitmapFetched_fn, getBitmapDone_fn, getBitmap_fn, createCanvas_fn, scaleBitmap_fn, drawBitmap_fn, serializeBitmap_fn, hasElementChanged_fn4, _accessibilityManager2, _allowClick, _annotationLayer, _clickAC, _editorFocusTimeoutId, _editors, _hadPointerDown, _isDisabling, _isEnabling, _drawingAC, _focusedElement, _textLayer, _textSelectionAC, _textLayerDblClickAC, _lastPointerDownTimestamp, _uiManager4, _editorTypes2, _AnnotationEditorLayer_instances, textLayerPointerDown_fn, currentEditorType_get, createNewEditor_fn, getCenterPoint_fn, cleanup_fn, _parent2, _mapping, _toUpdate, _id5, _DrawLayer_static, setBox_fn, _DrawLayer_instances, createSVG_fn, createClipPath_fn, updateProperties_fn;
|
|
91
91
|
import axios from "axios";
|
|
92
|
+
const API_BASE_URL = "https://db33.dev.dinabox.net/api";
|
|
93
|
+
const apiClient = axios.create({
|
|
94
|
+
baseURL: API_BASE_URL,
|
|
95
|
+
timeout: 1e4,
|
|
96
|
+
headers: {
|
|
97
|
+
"Content-Type": "application/json",
|
|
98
|
+
"Accept": "application/json"
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const updateApiToken = (token) => {
|
|
102
|
+
if (token) {
|
|
103
|
+
apiClient.defaults.headers.common["Authorization"] = `${token}`;
|
|
104
|
+
console.log("🔑 Token de API atualizado");
|
|
105
|
+
} else {
|
|
106
|
+
console.warn("⚠️ Token não fornecido");
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const LABEL_TYPES$1 = {
|
|
110
|
+
PART: "part",
|
|
111
|
+
SCRAP: "scrap",
|
|
112
|
+
THICKENED: "thickened",
|
|
113
|
+
INPUT: "input",
|
|
114
|
+
VOLUME: "volume"
|
|
115
|
+
};
|
|
116
|
+
apiClient.interceptors.response.use(
|
|
117
|
+
(response) => response,
|
|
118
|
+
(error) => {
|
|
119
|
+
var _a2;
|
|
120
|
+
console.error("Erro na API:", ((_a2 = error.response) == null ? void 0 : _a2.data) || error.message);
|
|
121
|
+
return Promise.reject(error);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
class LabelsAPI {
|
|
125
|
+
/**
|
|
126
|
+
* Lista etiquetas com filtros opcionais
|
|
127
|
+
* GET /v1/labels
|
|
128
|
+
*
|
|
129
|
+
* @param {Object} params - Parâmetros de consulta
|
|
130
|
+
* @param {number} [params.p] - Página
|
|
131
|
+
* @param {string} [params.s] - Busca
|
|
132
|
+
* @param {number} [params.label_id] - ID da etiqueta
|
|
133
|
+
* @param {string} [params.label_type] - Tipo da etiqueta (part, scrap, thickened, input, volume)
|
|
134
|
+
* @returns {Promise} Resposta da API
|
|
135
|
+
*/
|
|
136
|
+
static getLabels() {
|
|
137
|
+
return __async(this, arguments, function* (params = {}) {
|
|
138
|
+
try {
|
|
139
|
+
const response = yield apiClient.get("/v1/labels", { params });
|
|
140
|
+
return response.data;
|
|
141
|
+
} catch (error) {
|
|
142
|
+
throw new Error(`Erro ao buscar etiquetas: ${error.message}`);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Busca etiquetas por página
|
|
148
|
+
*
|
|
149
|
+
* @param {number} page - Número da página
|
|
150
|
+
* @param {Object} filters - Filtros adicionais
|
|
151
|
+
* @returns {Promise} Resposta da API
|
|
152
|
+
*/
|
|
153
|
+
static getLabelsByPage() {
|
|
154
|
+
return __async(this, arguments, function* (page = 1, filters = {}) {
|
|
155
|
+
return this.getLabels(__spreadValues({ p: page }, filters));
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Busca etiquetas por termo de pesquisa
|
|
160
|
+
*
|
|
161
|
+
* @param {string} searchTerm - Termo de busca
|
|
162
|
+
* @param {Object} filters - Filtros adicionais
|
|
163
|
+
* @returns {Promise} Resposta da API
|
|
164
|
+
*/
|
|
165
|
+
static searchLabels(_0) {
|
|
166
|
+
return __async(this, arguments, function* (searchTerm, filters = {}) {
|
|
167
|
+
return this.getLabels(__spreadValues({ s: searchTerm }, filters));
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Busca etiquetas por tipo
|
|
172
|
+
*
|
|
173
|
+
* @param {string} labelType - Tipo da etiqueta
|
|
174
|
+
* @param {Object} filters - Filtros adicionais
|
|
175
|
+
* @returns {Promise} Resposta da API
|
|
176
|
+
*/
|
|
177
|
+
static getLabelsByType(_0) {
|
|
178
|
+
return __async(this, arguments, function* (labelType, filters = {}) {
|
|
179
|
+
this.validateLabelType(labelType, true);
|
|
180
|
+
return this.getLabels(__spreadValues({ label_type: labelType }, filters));
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Obtém uma etiqueta específica
|
|
185
|
+
* GET /v1/label
|
|
186
|
+
*
|
|
187
|
+
* @param {number} labelId - ID da etiqueta
|
|
188
|
+
* @returns {Promise} Resposta da API
|
|
189
|
+
*/
|
|
190
|
+
static getLabel(labelId) {
|
|
191
|
+
return __async(this, null, function* () {
|
|
192
|
+
try {
|
|
193
|
+
const response = yield apiClient.get("/v1/label", {
|
|
194
|
+
params: { label_id: labelId }
|
|
195
|
+
});
|
|
196
|
+
if (!response.data || !response.data.labels || !response.data.labels.length) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
return response.data.labels.filter((label) => label.label_id == labelId)[0] || null;
|
|
200
|
+
} catch (error) {
|
|
201
|
+
throw new Error(`Erro ao buscar etiqueta ${labelId}: ${error.message}`);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Cria uma nova etiqueta
|
|
207
|
+
* POST /v1/label
|
|
208
|
+
*
|
|
209
|
+
* @param {Object} labelData - Dados da etiqueta
|
|
210
|
+
* @param {string} [labelData.label_type] - Tipo da etiqueta
|
|
211
|
+
* @param {string} [labelData.label_name] - Nome da etiqueta
|
|
212
|
+
* @param {string} [labelData.label_content] - Conteúdo da etiqueta
|
|
213
|
+
* @returns {Promise} Resposta da API
|
|
214
|
+
*/
|
|
215
|
+
static createLabel(labelData) {
|
|
216
|
+
return __async(this, null, function* () {
|
|
217
|
+
try {
|
|
218
|
+
if (labelData.label_type) {
|
|
219
|
+
this.validateLabelType(labelData.label_type, true);
|
|
220
|
+
}
|
|
221
|
+
const response = yield apiClient.post("/v1/label", labelData);
|
|
222
|
+
return response.data;
|
|
223
|
+
} catch (error) {
|
|
224
|
+
throw new Error(`Erro ao criar etiqueta: ${error.message}`);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Valida se o tipo de etiqueta é um dos tipos permitidos
|
|
230
|
+
*
|
|
231
|
+
* @param {string} labelType - Tipo de etiqueta a ser validado
|
|
232
|
+
* @returns {boolean} True se for válido, false caso contrário
|
|
233
|
+
* @throws {Error} Se o tipo for inválido e throwError for true
|
|
234
|
+
*/
|
|
235
|
+
static validateLabelType(labelType, throwError = false) {
|
|
236
|
+
const isValid = Object.values(LABEL_TYPES$1).includes(labelType);
|
|
237
|
+
if (!isValid && throwError) {
|
|
238
|
+
throw new Error(`Tipo de etiqueta inválido: "${labelType}" não é um de part, scrap, thickened, input e volume.`);
|
|
239
|
+
}
|
|
240
|
+
return isValid;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Retorna um tipo de etiqueta se for válido
|
|
244
|
+
*
|
|
245
|
+
* @param {string} labelType - Tipo de etiqueta a verificar
|
|
246
|
+
* @returns {string} O tipo de etiqueta validado
|
|
247
|
+
* @throws {Error} Se o tipo for inválido
|
|
248
|
+
*/
|
|
249
|
+
static labelByType(labelType) {
|
|
250
|
+
this.validateLabelType(labelType, true);
|
|
251
|
+
return labelType;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Atualiza uma etiqueta existente
|
|
255
|
+
* POST /v1/label (com label_id)
|
|
256
|
+
*
|
|
257
|
+
* @param {number} labelId - ID da etiqueta
|
|
258
|
+
* @param {Object} labelData - Dados atualizados da etiqueta
|
|
259
|
+
* @returns {Promise} Resposta da API
|
|
260
|
+
*/
|
|
261
|
+
static updateLabel(labelId, labelData) {
|
|
262
|
+
return __async(this, null, function* () {
|
|
263
|
+
try {
|
|
264
|
+
if (labelData.label_type) {
|
|
265
|
+
this.validateLabelType(labelData.label_type, true);
|
|
266
|
+
}
|
|
267
|
+
const response = yield apiClient.post("/v1/label", __spreadValues({
|
|
268
|
+
label_id: labelId
|
|
269
|
+
}, labelData));
|
|
270
|
+
return response.data;
|
|
271
|
+
} catch (error) {
|
|
272
|
+
throw new Error(`Erro ao atualizar etiqueta ${labelId}: ${error.message}`);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Remove uma etiqueta
|
|
278
|
+
* DELETE /v1/label
|
|
279
|
+
*
|
|
280
|
+
* @param {number} labelId - ID da etiqueta
|
|
281
|
+
* @returns {Promise} Resposta da API
|
|
282
|
+
*/
|
|
283
|
+
static deleteLabel(labelId) {
|
|
284
|
+
return __async(this, null, function* () {
|
|
285
|
+
try {
|
|
286
|
+
const response = yield apiClient.delete("/v1/label", {
|
|
287
|
+
params: { label_id: labelId }
|
|
288
|
+
});
|
|
289
|
+
return response.data;
|
|
290
|
+
} catch (error) {
|
|
291
|
+
throw new Error(`Erro ao deletar etiqueta ${labelId}: ${error.message}`);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Configura o token de autenticação
|
|
297
|
+
*
|
|
298
|
+
* @param {string} token - Token de autenticação
|
|
299
|
+
*/
|
|
300
|
+
static setAuthToken(token) {
|
|
301
|
+
apiClient.defaults.headers.common["Authorization"] = `${token}`;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Remove o token de autenticação
|
|
305
|
+
*/
|
|
306
|
+
static removeAuthToken() {
|
|
307
|
+
delete apiClient.defaults.headers.common["Authorization"];
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Configura a URL base da API
|
|
311
|
+
*
|
|
312
|
+
* @param {string} baseURL - Nova URL base
|
|
313
|
+
*/
|
|
314
|
+
static setBaseURL(baseURL) {
|
|
315
|
+
apiClient.defaults.baseURL = baseURL;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
92
318
|
const isBrowser = typeof window !== "undefined";
|
|
93
319
|
const isNodeJS$1 = !isBrowser;
|
|
94
320
|
const createBrowserCanvas = (width, height) => {
|
|
@@ -11303,7 +11529,7 @@ function(t2) {
|
|
|
11303
11529
|
*/
|
|
11304
11530
|
function(t2) {
|
|
11305
11531
|
function e2() {
|
|
11306
|
-
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-
|
|
11532
|
+
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-yItW81m8.js")).catch(function(t3) {
|
|
11307
11533
|
return Promise.reject(new Error("Could not load canvg: " + t3));
|
|
11308
11534
|
}).then(function(t3) {
|
|
11309
11535
|
return t3.default ? t3.default : t3;
|
|
@@ -58104,224 +58330,6 @@ const makeLamination = (mainObject) => {
|
|
|
58104
58330
|
}
|
|
58105
58331
|
return pdf.output("datauristring");
|
|
58106
58332
|
};
|
|
58107
|
-
const API_BASE_URL = "https://db33.dev.dinabox.net/api";
|
|
58108
|
-
const apiClient$1 = axios.create({
|
|
58109
|
-
baseURL: API_BASE_URL,
|
|
58110
|
-
timeout: 1e4,
|
|
58111
|
-
headers: {
|
|
58112
|
-
"Content-Type": "application/json",
|
|
58113
|
-
"Accept": "application/json"
|
|
58114
|
-
}
|
|
58115
|
-
});
|
|
58116
|
-
const LABEL_TYPES$1 = {
|
|
58117
|
-
PART: "part",
|
|
58118
|
-
SCRAP: "scrap",
|
|
58119
|
-
THICKENED: "thickened",
|
|
58120
|
-
INPUT: "input",
|
|
58121
|
-
VOLUME: "volume"
|
|
58122
|
-
};
|
|
58123
|
-
apiClient$1.interceptors.response.use(
|
|
58124
|
-
(response) => response,
|
|
58125
|
-
(error) => {
|
|
58126
|
-
var _a2;
|
|
58127
|
-
console.error("Erro na API:", ((_a2 = error.response) == null ? void 0 : _a2.data) || error.message);
|
|
58128
|
-
return Promise.reject(error);
|
|
58129
|
-
}
|
|
58130
|
-
);
|
|
58131
|
-
class LabelsAPI {
|
|
58132
|
-
/**
|
|
58133
|
-
* Lista etiquetas com filtros opcionais
|
|
58134
|
-
* GET /v1/labels
|
|
58135
|
-
*
|
|
58136
|
-
* @param {Object} params - Parâmetros de consulta
|
|
58137
|
-
* @param {number} [params.p] - Página
|
|
58138
|
-
* @param {string} [params.s] - Busca
|
|
58139
|
-
* @param {number} [params.label_id] - ID da etiqueta
|
|
58140
|
-
* @param {string} [params.label_type] - Tipo da etiqueta (part, scrap, thickened, input, volume)
|
|
58141
|
-
* @returns {Promise} Resposta da API
|
|
58142
|
-
*/
|
|
58143
|
-
static getLabels() {
|
|
58144
|
-
return __async(this, arguments, function* (params = {}) {
|
|
58145
|
-
try {
|
|
58146
|
-
const response = yield apiClient$1.get("/v1/labels", { params });
|
|
58147
|
-
return response.data;
|
|
58148
|
-
} catch (error) {
|
|
58149
|
-
throw new Error(`Erro ao buscar etiquetas: ${error.message}`);
|
|
58150
|
-
}
|
|
58151
|
-
});
|
|
58152
|
-
}
|
|
58153
|
-
/**
|
|
58154
|
-
* Busca etiquetas por página
|
|
58155
|
-
*
|
|
58156
|
-
* @param {number} page - Número da página
|
|
58157
|
-
* @param {Object} filters - Filtros adicionais
|
|
58158
|
-
* @returns {Promise} Resposta da API
|
|
58159
|
-
*/
|
|
58160
|
-
static getLabelsByPage() {
|
|
58161
|
-
return __async(this, arguments, function* (page = 1, filters = {}) {
|
|
58162
|
-
return this.getLabels(__spreadValues({ p: page }, filters));
|
|
58163
|
-
});
|
|
58164
|
-
}
|
|
58165
|
-
/**
|
|
58166
|
-
* Busca etiquetas por termo de pesquisa
|
|
58167
|
-
*
|
|
58168
|
-
* @param {string} searchTerm - Termo de busca
|
|
58169
|
-
* @param {Object} filters - Filtros adicionais
|
|
58170
|
-
* @returns {Promise} Resposta da API
|
|
58171
|
-
*/
|
|
58172
|
-
static searchLabels(_0) {
|
|
58173
|
-
return __async(this, arguments, function* (searchTerm, filters = {}) {
|
|
58174
|
-
return this.getLabels(__spreadValues({ s: searchTerm }, filters));
|
|
58175
|
-
});
|
|
58176
|
-
}
|
|
58177
|
-
/**
|
|
58178
|
-
* Busca etiquetas por tipo
|
|
58179
|
-
*
|
|
58180
|
-
* @param {string} labelType - Tipo da etiqueta
|
|
58181
|
-
* @param {Object} filters - Filtros adicionais
|
|
58182
|
-
* @returns {Promise} Resposta da API
|
|
58183
|
-
*/
|
|
58184
|
-
static getLabelsByType(_0) {
|
|
58185
|
-
return __async(this, arguments, function* (labelType, filters = {}) {
|
|
58186
|
-
this.validateLabelType(labelType, true);
|
|
58187
|
-
return this.getLabels(__spreadValues({ label_type: labelType }, filters));
|
|
58188
|
-
});
|
|
58189
|
-
}
|
|
58190
|
-
/**
|
|
58191
|
-
* Obtém uma etiqueta específica
|
|
58192
|
-
* GET /v1/label
|
|
58193
|
-
*
|
|
58194
|
-
* @param {number} labelId - ID da etiqueta
|
|
58195
|
-
* @returns {Promise} Resposta da API
|
|
58196
|
-
*/
|
|
58197
|
-
static getLabel(labelId) {
|
|
58198
|
-
return __async(this, null, function* () {
|
|
58199
|
-
try {
|
|
58200
|
-
const response = yield apiClient$1.get("/v1/label", {
|
|
58201
|
-
params: { label_id: labelId }
|
|
58202
|
-
});
|
|
58203
|
-
if (!response.data || !response.data.labels || !response.data.labels.length) {
|
|
58204
|
-
return null;
|
|
58205
|
-
}
|
|
58206
|
-
return response.data.labels.filter((label) => label.label_id == labelId)[0] || null;
|
|
58207
|
-
} catch (error) {
|
|
58208
|
-
throw new Error(`Erro ao buscar etiqueta ${labelId}: ${error.message}`);
|
|
58209
|
-
}
|
|
58210
|
-
});
|
|
58211
|
-
}
|
|
58212
|
-
/**
|
|
58213
|
-
* Cria uma nova etiqueta
|
|
58214
|
-
* POST /v1/label
|
|
58215
|
-
*
|
|
58216
|
-
* @param {Object} labelData - Dados da etiqueta
|
|
58217
|
-
* @param {string} [labelData.label_type] - Tipo da etiqueta
|
|
58218
|
-
* @param {string} [labelData.label_name] - Nome da etiqueta
|
|
58219
|
-
* @param {string} [labelData.label_content] - Conteúdo da etiqueta
|
|
58220
|
-
* @returns {Promise} Resposta da API
|
|
58221
|
-
*/
|
|
58222
|
-
static createLabel(labelData) {
|
|
58223
|
-
return __async(this, null, function* () {
|
|
58224
|
-
try {
|
|
58225
|
-
if (labelData.label_type) {
|
|
58226
|
-
this.validateLabelType(labelData.label_type, true);
|
|
58227
|
-
}
|
|
58228
|
-
const response = yield apiClient$1.post("/v1/label", labelData);
|
|
58229
|
-
return response.data;
|
|
58230
|
-
} catch (error) {
|
|
58231
|
-
throw new Error(`Erro ao criar etiqueta: ${error.message}`);
|
|
58232
|
-
}
|
|
58233
|
-
});
|
|
58234
|
-
}
|
|
58235
|
-
/**
|
|
58236
|
-
* Valida se o tipo de etiqueta é um dos tipos permitidos
|
|
58237
|
-
*
|
|
58238
|
-
* @param {string} labelType - Tipo de etiqueta a ser validado
|
|
58239
|
-
* @returns {boolean} True se for válido, false caso contrário
|
|
58240
|
-
* @throws {Error} Se o tipo for inválido e throwError for true
|
|
58241
|
-
*/
|
|
58242
|
-
static validateLabelType(labelType, throwError = false) {
|
|
58243
|
-
const isValid = Object.values(LABEL_TYPES$1).includes(labelType);
|
|
58244
|
-
if (!isValid && throwError) {
|
|
58245
|
-
throw new Error(`Tipo de etiqueta inválido: "${labelType}" não é um de part, scrap, thickened, input e volume.`);
|
|
58246
|
-
}
|
|
58247
|
-
return isValid;
|
|
58248
|
-
}
|
|
58249
|
-
/**
|
|
58250
|
-
* Retorna um tipo de etiqueta se for válido
|
|
58251
|
-
*
|
|
58252
|
-
* @param {string} labelType - Tipo de etiqueta a verificar
|
|
58253
|
-
* @returns {string} O tipo de etiqueta validado
|
|
58254
|
-
* @throws {Error} Se o tipo for inválido
|
|
58255
|
-
*/
|
|
58256
|
-
static labelByType(labelType) {
|
|
58257
|
-
this.validateLabelType(labelType, true);
|
|
58258
|
-
return labelType;
|
|
58259
|
-
}
|
|
58260
|
-
/**
|
|
58261
|
-
* Atualiza uma etiqueta existente
|
|
58262
|
-
* POST /v1/label (com label_id)
|
|
58263
|
-
*
|
|
58264
|
-
* @param {number} labelId - ID da etiqueta
|
|
58265
|
-
* @param {Object} labelData - Dados atualizados da etiqueta
|
|
58266
|
-
* @returns {Promise} Resposta da API
|
|
58267
|
-
*/
|
|
58268
|
-
static updateLabel(labelId, labelData) {
|
|
58269
|
-
return __async(this, null, function* () {
|
|
58270
|
-
try {
|
|
58271
|
-
if (labelData.label_type) {
|
|
58272
|
-
this.validateLabelType(labelData.label_type, true);
|
|
58273
|
-
}
|
|
58274
|
-
const response = yield apiClient$1.post("/v1/label", __spreadValues({
|
|
58275
|
-
label_id: labelId
|
|
58276
|
-
}, labelData));
|
|
58277
|
-
return response.data;
|
|
58278
|
-
} catch (error) {
|
|
58279
|
-
throw new Error(`Erro ao atualizar etiqueta ${labelId}: ${error.message}`);
|
|
58280
|
-
}
|
|
58281
|
-
});
|
|
58282
|
-
}
|
|
58283
|
-
/**
|
|
58284
|
-
* Remove uma etiqueta
|
|
58285
|
-
* DELETE /v1/label
|
|
58286
|
-
*
|
|
58287
|
-
* @param {number} labelId - ID da etiqueta
|
|
58288
|
-
* @returns {Promise} Resposta da API
|
|
58289
|
-
*/
|
|
58290
|
-
static deleteLabel(labelId) {
|
|
58291
|
-
return __async(this, null, function* () {
|
|
58292
|
-
try {
|
|
58293
|
-
const response = yield apiClient$1.delete("/v1/label", {
|
|
58294
|
-
params: { label_id: labelId }
|
|
58295
|
-
});
|
|
58296
|
-
return response.data;
|
|
58297
|
-
} catch (error) {
|
|
58298
|
-
throw new Error(`Erro ao deletar etiqueta ${labelId}: ${error.message}`);
|
|
58299
|
-
}
|
|
58300
|
-
});
|
|
58301
|
-
}
|
|
58302
|
-
/**
|
|
58303
|
-
* Configura o token de autenticação
|
|
58304
|
-
*
|
|
58305
|
-
* @param {string} token - Token de autenticação
|
|
58306
|
-
*/
|
|
58307
|
-
static setAuthToken(token) {
|
|
58308
|
-
apiClient$1.defaults.headers.common["Authorization"] = `${token}`;
|
|
58309
|
-
}
|
|
58310
|
-
/**
|
|
58311
|
-
* Remove o token de autenticação
|
|
58312
|
-
*/
|
|
58313
|
-
static removeAuthToken() {
|
|
58314
|
-
delete apiClient$1.defaults.headers.common["Authorization"];
|
|
58315
|
-
}
|
|
58316
|
-
/**
|
|
58317
|
-
* Configura a URL base da API
|
|
58318
|
-
*
|
|
58319
|
-
* @param {string} baseURL - Nova URL base
|
|
58320
|
-
*/
|
|
58321
|
-
static setBaseURL(baseURL) {
|
|
58322
|
-
apiClient$1.defaults.baseURL = baseURL;
|
|
58323
|
-
}
|
|
58324
|
-
}
|
|
58325
58333
|
function getTemplateById(templateId) {
|
|
58326
58334
|
return __async(this, null, function* () {
|
|
58327
58335
|
try {
|
|
@@ -58401,7 +58409,7 @@ const createSSESlice = (set, get3) => ({
|
|
|
58401
58409
|
printer: data.printer || null
|
|
58402
58410
|
});
|
|
58403
58411
|
} catch (error) {
|
|
58404
|
-
console.
|
|
58412
|
+
console.warn("Erro ao processar dados da impressora:", error);
|
|
58405
58413
|
}
|
|
58406
58414
|
});
|
|
58407
58415
|
newEventSource.onerror = (error) => {
|
|
@@ -58615,9 +58623,6 @@ const legacyFieldMap = {
|
|
|
58615
58623
|
const legacyTransformer = (data) => {
|
|
58616
58624
|
return applyTransformations(data, legacyFieldMap);
|
|
58617
58625
|
};
|
|
58618
|
-
const updateApiToken = (token) => {
|
|
58619
|
-
console.warn("updateApiToken não carregado - usando placeholder");
|
|
58620
|
-
};
|
|
58621
58626
|
new VariableManager();
|
|
58622
58627
|
let globalConfig = {
|
|
58623
58628
|
printerName: null,
|
|
@@ -58646,6 +58651,7 @@ function normalizeLabelData(labelData) {
|
|
|
58646
58651
|
});
|
|
58647
58652
|
}
|
|
58648
58653
|
const init = (config = {}) => {
|
|
58654
|
+
console.log(config);
|
|
58649
58655
|
if (config.defaultTransformer) {
|
|
58650
58656
|
const { fieldMap, fieldMapSource } = config.defaultTransformer;
|
|
58651
58657
|
if (!["legacy", "custom", "none"].includes(fieldMap)) {
|
|
@@ -58662,8 +58668,10 @@ const init = (config = {}) => {
|
|
|
58662
58668
|
autoConnectPrinter: true
|
|
58663
58669
|
}, config);
|
|
58664
58670
|
globalConfig = __spreadValues(__spreadValues({}, globalConfig), finalConfig);
|
|
58665
|
-
|
|
58666
|
-
|
|
58671
|
+
console.log(globalConfig);
|
|
58672
|
+
if (globalConfig.token) {
|
|
58673
|
+
console.log("🔑 Atualizando token da API", globalConfig.token);
|
|
58674
|
+
updateApiToken(globalConfig.token);
|
|
58667
58675
|
}
|
|
58668
58676
|
if (finalConfig.autoConnectPrinter) {
|
|
58669
58677
|
try {
|
|
@@ -59316,7 +59324,6 @@ const LABEL_TYPES = {
|
|
|
59316
59324
|
INPUT: "input",
|
|
59317
59325
|
VOLUME: "volume"
|
|
59318
59326
|
};
|
|
59319
|
-
const apiClient = null;
|
|
59320
59327
|
const getPartLabels = null;
|
|
59321
59328
|
const getScrapLabels = null;
|
|
59322
59329
|
const getThickenedLabels = null;
|
|
@@ -59331,70 +59338,69 @@ const EtiquetasJS = __spreadProps(__spreadValues({}, etiquetasAPI), {
|
|
|
59331
59338
|
}
|
|
59332
59339
|
});
|
|
59333
59340
|
export {
|
|
59334
|
-
|
|
59335
|
-
|
|
59336
|
-
|
|
59337
|
-
|
|
59338
|
-
|
|
59341
|
+
getAspectRatio as $,
|
|
59342
|
+
etiquetasAPI as A,
|
|
59343
|
+
isBrowser as B,
|
|
59344
|
+
isNodeJS$1 as C,
|
|
59345
|
+
createBrowserCanvas as D,
|
|
59339
59346
|
EtiquetasJS as E,
|
|
59340
|
-
|
|
59341
|
-
|
|
59342
|
-
|
|
59343
|
-
|
|
59344
|
-
|
|
59345
|
-
|
|
59347
|
+
loadImageBrowser as F,
|
|
59348
|
+
createBrowserDOM as G,
|
|
59349
|
+
downloadFile as H,
|
|
59350
|
+
serializeXML as I,
|
|
59351
|
+
createBuffer as J,
|
|
59352
|
+
base64Encode as K,
|
|
59346
59353
|
LABEL_TYPES as L,
|
|
59347
|
-
|
|
59348
|
-
|
|
59349
|
-
|
|
59350
|
-
|
|
59351
|
-
|
|
59352
|
-
|
|
59353
|
-
|
|
59354
|
-
|
|
59355
|
-
|
|
59356
|
-
|
|
59357
|
-
|
|
59358
|
-
|
|
59359
|
-
|
|
59360
|
-
|
|
59354
|
+
base64Decode as M,
|
|
59355
|
+
processLabelForParts as N,
|
|
59356
|
+
convertPdfToImages as O,
|
|
59357
|
+
checkPrinterAvailability as P,
|
|
59358
|
+
sendImagesToPrinter as Q,
|
|
59359
|
+
downloadPdfFallback as R,
|
|
59360
|
+
createMiniSheet as S,
|
|
59361
|
+
createImage as T,
|
|
59362
|
+
createImageFromPart as U,
|
|
59363
|
+
drawRect as V,
|
|
59364
|
+
setBorder as W,
|
|
59365
|
+
getBorderColor as X,
|
|
59366
|
+
makeLamination as Y,
|
|
59367
|
+
getNode as Z,
|
|
59361
59368
|
_typeof as _,
|
|
59362
|
-
|
|
59363
|
-
|
|
59364
|
-
|
|
59365
|
-
|
|
59366
|
-
|
|
59367
|
-
|
|
59368
|
-
|
|
59369
|
-
|
|
59370
|
-
|
|
59371
|
-
|
|
59372
|
-
|
|
59373
|
-
|
|
59374
|
-
getPartLabels as b,
|
|
59369
|
+
getPartLabels as a,
|
|
59370
|
+
DEFAULT_LAMINATION_COLORS as a0,
|
|
59371
|
+
stopCreatingLabels as a1,
|
|
59372
|
+
initializeBrowserEnvironment as a2,
|
|
59373
|
+
getImagesFromUrl as a3,
|
|
59374
|
+
getImagesFromUrlToBase64 as a4,
|
|
59375
|
+
mmToPx as a5,
|
|
59376
|
+
convertSVGTableToAutoTableData as a6,
|
|
59377
|
+
generateTableSVG as a7,
|
|
59378
|
+
dataTypeList as a8,
|
|
59379
|
+
getInputsByCategory as a9,
|
|
59380
|
+
getScrapLabels as b,
|
|
59375
59381
|
commonjsGlobal as c,
|
|
59376
|
-
|
|
59377
|
-
|
|
59378
|
-
|
|
59382
|
+
getThickenedLabels as d,
|
|
59383
|
+
getInputLabels as e,
|
|
59384
|
+
getVolumeLabels as f,
|
|
59379
59385
|
getDefaultExportFromCjs as g,
|
|
59380
|
-
|
|
59381
|
-
|
|
59382
|
-
|
|
59383
|
-
|
|
59384
|
-
|
|
59385
|
-
|
|
59386
|
-
|
|
59387
|
-
|
|
59388
|
-
|
|
59389
|
-
|
|
59386
|
+
LabelWorker as h,
|
|
59387
|
+
createLabelWorker as i,
|
|
59388
|
+
generateLabelsFromHookData as j,
|
|
59389
|
+
useLabelStore as k,
|
|
59390
|
+
getPartsForLabels as l,
|
|
59391
|
+
getInputForLabels as m,
|
|
59392
|
+
getPartsFromProjectToLabels as n,
|
|
59393
|
+
labelTypeNames as o,
|
|
59394
|
+
initialState as p,
|
|
59395
|
+
LabelsAPI as q,
|
|
59390
59396
|
reducer as r,
|
|
59391
|
-
|
|
59392
|
-
|
|
59397
|
+
init as s,
|
|
59398
|
+
getPrinterStatus as t,
|
|
59393
59399
|
useLabelData as u,
|
|
59394
|
-
|
|
59395
|
-
|
|
59396
|
-
|
|
59397
|
-
|
|
59398
|
-
|
|
59400
|
+
makeLabel as v,
|
|
59401
|
+
sendLabel as w,
|
|
59402
|
+
downloadPDF as x,
|
|
59403
|
+
sendToPrinter as y,
|
|
59404
|
+
validateLabelData as z
|
|
59399
59405
|
};
|
|
59400
|
-
//# sourceMappingURL=index-
|
|
59406
|
+
//# sourceMappingURL=index-Tvy8FVsM.js.map
|