@unvired/turboforms-embed-sdk 2.0.64 → 2.0.65
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/turboforms.esm.js +5 -3
- package/dist/turboforms.html +100 -42
- package/dist/turboforms.js +5 -3
- package/package.json +1 -1
package/dist/turboforms.html
CHANGED
|
@@ -30095,33 +30095,59 @@ class SmartFileComponent extends FieldComponent {
|
|
|
30095
30095
|
});
|
|
30096
30096
|
}
|
|
30097
30097
|
|
|
30098
|
-
if (this.refs.cameraButton
|
|
30098
|
+
if (this.refs.cameraButton) {
|
|
30099
30099
|
this.addEventListener(this.refs.cameraButton, 'click', (event) => {
|
|
30100
30100
|
event.preventDefault();
|
|
30101
|
-
webViewCamera
|
|
30102
|
-
|
|
30103
|
-
|
|
30104
|
-
|
|
30105
|
-
|
|
30106
|
-
|
|
30107
|
-
|
|
30108
|
-
|
|
30109
|
-
|
|
30110
|
-
|
|
30111
|
-
|
|
30112
|
-
|
|
30113
|
-
|
|
30101
|
+
if (webViewCamera) {
|
|
30102
|
+
webViewCamera.getPicture((success) => {
|
|
30103
|
+
window.resolveLocalFileSystemURL(success, (fileEntry) => {
|
|
30104
|
+
fileEntry.file((file) => {
|
|
30105
|
+
const reader = new FileReader();
|
|
30106
|
+
reader.onloadend = (evt) => {
|
|
30107
|
+
const blob = new Blob([new Uint8Array(evt.target.result)], {
|
|
30108
|
+
type: file.type
|
|
30109
|
+
});
|
|
30110
|
+
blob.name = file.name;
|
|
30111
|
+
replace = false;
|
|
30112
|
+
this.processAndUpload([blob]);
|
|
30113
|
+
};
|
|
30114
|
+
reader.readAsArrayBuffer(file);
|
|
30115
|
+
});
|
|
30114
30116
|
});
|
|
30117
|
+
}, (err) => {
|
|
30118
|
+
logger.error(err);
|
|
30119
|
+
}, {
|
|
30120
|
+
sourceType: webViewCamera.PictureSourceType.CAMERA,
|
|
30121
|
+
encodingType: webViewCamera.EncodingType.PNG,
|
|
30122
|
+
mediaType: webViewCamera.MediaType.PICTURE,
|
|
30123
|
+
saveToPhotoAlbum: true,
|
|
30124
|
+
correctOrientation: false,
|
|
30115
30125
|
});
|
|
30116
|
-
}
|
|
30117
|
-
|
|
30118
|
-
|
|
30119
|
-
|
|
30120
|
-
|
|
30121
|
-
|
|
30122
|
-
|
|
30123
|
-
|
|
30124
|
-
|
|
30126
|
+
} else {
|
|
30127
|
+
let id = this.component.id;
|
|
30128
|
+
isfileBrowse = false;
|
|
30129
|
+
window.isListenerSet = false;
|
|
30130
|
+
let eventCustom = new CustomEvent("openCamera", {
|
|
30131
|
+
detail: {
|
|
30132
|
+
controlId: id,
|
|
30133
|
+
},
|
|
30134
|
+
});
|
|
30135
|
+
|
|
30136
|
+
if (window.parent && window.parent !== window) {
|
|
30137
|
+
window.parent.postMessage(
|
|
30138
|
+
{
|
|
30139
|
+
type: "OPEN_CAMERA",
|
|
30140
|
+
data: { controlId: id },
|
|
30141
|
+
status: "sucess",
|
|
30142
|
+
message: "camera triggerd",
|
|
30143
|
+
},
|
|
30144
|
+
"*"
|
|
30145
|
+
);
|
|
30146
|
+
}
|
|
30147
|
+
|
|
30148
|
+
logger.info("[TF_SDK] ✅ Dispatching openCamera event for controlId:", id);
|
|
30149
|
+
document.dispatchEvent(eventCustom);
|
|
30150
|
+
}
|
|
30125
30151
|
});
|
|
30126
30152
|
}
|
|
30127
30153
|
|
|
@@ -30189,24 +30215,47 @@ class SmartFileComponent extends FieldComponent {
|
|
|
30189
30215
|
logger.info("[TF_SDK:84] ✅ event.detail.controlId =" + event.detail.controlId)
|
|
30190
30216
|
if (that.component.id == event.detail.controlId) {
|
|
30191
30217
|
if (!window.isListenerSet) {
|
|
30192
|
-
|
|
30193
|
-
|
|
30194
|
-
|
|
30195
|
-
const
|
|
30196
|
-
|
|
30197
|
-
|
|
30198
|
-
|
|
30199
|
-
|
|
30200
|
-
|
|
30201
|
-
|
|
30202
|
-
|
|
30203
|
-
|
|
30204
|
-
|
|
30205
|
-
|
|
30206
|
-
|
|
30207
|
-
|
|
30208
|
-
|
|
30209
|
-
|
|
30218
|
+
const isBase64 = typeof event.detail.imageData === 'string' && event.detail.imageData.startsWith('data:');
|
|
30219
|
+
if (isBase64 || typeof window.resolveLocalFileSystemURL !== 'function') {
|
|
30220
|
+
const base64ToFile = (base64, filename, contentType = 'image/jpeg') => {
|
|
30221
|
+
const arr = base64.split(',');
|
|
30222
|
+
const mime = arr[0].match(/:(.*?);/)[1];
|
|
30223
|
+
const bstr = atob(arr[1]);
|
|
30224
|
+
let n = bstr.length;
|
|
30225
|
+
const u8arr = new Uint8Array(n);
|
|
30226
|
+
while (n--) {
|
|
30227
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
30228
|
+
}
|
|
30229
|
+
return new File([u8arr], filename, { type: contentType });
|
|
30230
|
+
};
|
|
30231
|
+
const file = base64ToFile(
|
|
30232
|
+
event.detail.imageData,
|
|
30233
|
+
event.detail.fileName || `photo-${Date.now()}.jpg`
|
|
30234
|
+
);
|
|
30235
|
+
isfileBrowse = false;
|
|
30236
|
+
replace = false;
|
|
30237
|
+
that.compressFile([file]);
|
|
30238
|
+
window.isListenerSet = true;
|
|
30239
|
+
} else {
|
|
30240
|
+
window.resolveLocalFileSystemURL(event.detail.imageData, (fileEntry) => {
|
|
30241
|
+
fileEntry.file((file) => {
|
|
30242
|
+
logger.info("[TF_SDK:85] ✅ fileEntry =" + file)
|
|
30243
|
+
const reader = new FileReader();
|
|
30244
|
+
reader.onloadend = (evt) => {
|
|
30245
|
+
logger.info("[TF_SDK:86] ✅ onloadend =" + evt)
|
|
30246
|
+
const blob = new Blob([new Uint8Array(evt.target.result)], {
|
|
30247
|
+
type: file.type
|
|
30248
|
+
});
|
|
30249
|
+
blob.name = file.name;
|
|
30250
|
+
logger.info("[TF_SDK:87] ✅ file.name =" + file.name);
|
|
30251
|
+
logger.info("[TF_SDK:88] ✅ blob instanceOf Blob =" + blob)
|
|
30252
|
+
that.compressFile([blob])
|
|
30253
|
+
};
|
|
30254
|
+
reader.readAsArrayBuffer(file);
|
|
30255
|
+
});
|
|
30256
|
+
})
|
|
30257
|
+
window.isListenerSet = true;
|
|
30258
|
+
}
|
|
30210
30259
|
}
|
|
30211
30260
|
}
|
|
30212
30261
|
}, false);
|
|
@@ -41662,7 +41711,7 @@ initThemeHook();
|
|
|
41662
41711
|
</div>
|
|
41663
41712
|
|
|
41664
41713
|
<div id="sticky-footer">
|
|
41665
|
-
<div class="build-version">SDK v2.0.
|
|
41714
|
+
<div class="build-version">SDK v2.0.65</div>
|
|
41666
41715
|
|
|
41667
41716
|
<button class="footer-btn footer-btn-secondary" id="prevBtn" style="display:none" onclick="FormOnPrevious()">
|
|
41668
41717
|
<i class="bi bi-chevron-left"></i> Previous
|
|
@@ -42150,6 +42199,15 @@ initThemeHook();
|
|
|
42150
42199
|
|
|
42151
42200
|
if (showLoader && sdkLoader) {
|
|
42152
42201
|
sdkLoader.classList.remove('hidden');
|
|
42202
|
+
// Handle loader back button visibility
|
|
42203
|
+
const loaderBackBtn = sdkLoader.querySelector('.sdk-loader-back-btn');
|
|
42204
|
+
if (loaderBackBtn) {
|
|
42205
|
+
if (payloadData.showBackButton === false || payloadData.showBackButton === 'false') {
|
|
42206
|
+
loaderBackBtn.style.setProperty('display', 'none', 'important');
|
|
42207
|
+
} else {
|
|
42208
|
+
loaderBackBtn.style.setProperty('display', 'inline-block', 'important');
|
|
42209
|
+
}
|
|
42210
|
+
}
|
|
42153
42211
|
} else {
|
|
42154
42212
|
if (sdkLoader) sdkLoader.classList.add('hidden');
|
|
42155
42213
|
document.querySelectorAll('.tf-form-loading').forEach(el => el.classList.remove('tf-form-loading'));
|