sales-frontend-bridge 0.0.48 → 0.0.49

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/index.cjs CHANGED
@@ -2970,8 +2970,6 @@ async function SaveTotalPdf() {
2970
2970
  const filepath = await promise;
2971
2971
  return filepath;
2972
2972
  }
2973
-
2974
- // src/oz/utils/bridge-util/fetch-util.ts
2975
2973
  async function fetchDocument(args) {
2976
2974
  const { data: result } = await Bridge.native.downloadDocument(args);
2977
2975
  return result.data.map((i) => ({ ...i, startPage: 0, endPage: 0 }));
@@ -2981,32 +2979,9 @@ async function fetchFont() {
2981
2979
  const fontParms = Object.keys(fontMap).map((i) => `font.${i}=${fontMap[i]}`);
2982
2980
  return fontParms;
2983
2981
  }
2984
- function base64ToBlob(base64) {
2985
- const [meta, data] = base64.split(",");
2986
- if (meta === void 0) {
2987
- throw new Error(`unexpected sing image ${base64}`);
2988
- }
2989
- const mime = meta.match(/:(.*?);/)?.[1] || "";
2990
- const bytes = Uint8Array.from(atob(data || base64), (c) => c.charCodeAt(0));
2991
- return new Blob([bytes], { type: mime });
2992
- }
2993
- async function blobToBase64(blob) {
2994
- return new Promise((resolve, reject) => {
2995
- const reader = new FileReader();
2996
- reader.onloadend = () => {
2997
- if (typeof reader.result === "string") {
2998
- resolve(reader.result);
2999
- } else {
3000
- reject(new Error("Failed to convert Blob to Base64 string"));
3001
- }
3002
- };
3003
- reader.onerror = () => reject(reader.error);
3004
- reader.readAsDataURL(blob);
3005
- });
3006
- }
3007
2982
  async function postFiletoDud(imageStr) {
3008
2983
  const formData = new FormData();
3009
- formData.append("data", base64ToBlob(imageStr), "test.png");
2984
+ formData.append("data", salesFrontendUtils.base64ToFile(imageStr, "test.png"));
3010
2985
  formData.append("fileIdentifierValue", "string");
3011
2986
  formData.append("fileExtendContent1", "string");
3012
2987
  formData.append("fileExtendContent2", "string");
@@ -3055,7 +3030,7 @@ async function getFileFromDud(fileMgmtId) {
3055
3030
  body: JSON.stringify({ fileMgmtId, outputType })
3056
3031
  });
3057
3032
  const blob = await response.blob();
3058
- const base64String = await blobToBase64(blob);
3033
+ const base64String = await salesFrontendUtils.fileToBase64(blob);
3059
3034
  return base64String;
3060
3035
  }
3061
3036
 
@@ -3221,8 +3196,6 @@ exports.PromiseWithResolvers = PromiseWithResolvers;
3221
3196
  exports.SaveTotalPdf = SaveTotalPdf;
3222
3197
  exports.SignatureHandler = SignatureHandler;
3223
3198
  exports.TopHandler = TopHandler;
3224
- exports.base64ToBlob = base64ToBlob;
3225
- exports.blobToBase64 = blobToBase64;
3226
3199
  exports.btnStyle = btnStyle;
3227
3200
  exports.categorizeByPageRange = categorizeByPageRange;
3228
3201
  exports.checkDocumentsValidityByIndex = checkDocumentsValidityByIndex;