zakeke-configurator-react 0.1.233 → 0.1.234

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.
@@ -2,7 +2,7 @@ import { EventMessage, ExtensionFields, NftForm, NftSettings, OnBeforeSendDataTo
2
2
  import { FocusAttributesEventListener } from '../../../3D/src';
3
3
  import { PlatformAttributeSelection } from './integrations/Integration';
4
4
  import { BootParameters, Camera, Composition, FontFamily, Group, ImageMacroCategory, Item, Product, ProductQuantityRule, SellerSettings, Template, TemplateMacroCategory, Translations, TryOnGenericFineTuningSettings, TryOnProduct, TryOnSeller } from './models';
5
- import type { Image, PrintingMethodsRestrictions } from './models';
5
+ import type { Image, PrintingMethodsRestrictions, TextSanitationResult } from './models';
6
6
  declare global {
7
7
  interface Window {
8
8
  token: string;
@@ -238,6 +238,9 @@ export declare class ZakekeEnvironment {
238
238
  setItemColor: (guid: string, color: string) => void;
239
239
  setItemFontFamily: (guid: string, fontFamily: string) => Promise<void>;
240
240
  setItemTextOnPath: (guid: string, areaId: number, value: boolean) => void;
241
+ fullyLoadFont(font: string | FontFamily): Promise<FontFamily>;
242
+ sanitizeString: (family: FontFamily, text: string) => string;
243
+ getSanitationText: (family: FontFamily, text: string) => TextSanitationResult;
241
244
  createImage: (file: File, progress?: ((percentage: number) => void) | undefined) => Promise<Image>;
242
245
  createImageFromUrl: (url: string) => Promise<Image>;
243
246
  addItemImage: (id: number, areaId: number) => Promise<void>;
@@ -1,6 +1,9 @@
1
- import { FontFamily } from ".";
1
+ import { FontFamily, FontFamilyFace, TextSanitationResult } from '.';
2
2
  /**
3
3
  * Download a list of font families so that are available for the browser
4
+ *
5
+ * @param fontFamilies List of font families to download
6
+ * @returns A promise that resolves when all fonts are downloaded
4
7
  */
5
8
  export declare function loadFonts(fontFamilies: FontFamily[]): Promise<void>;
6
9
  /**
@@ -10,3 +13,63 @@ export declare function loadFonts(fontFamilies: FontFamily[]): Promise<void>;
10
13
  * @param downloadedFonts A list of downloaded fonts
11
14
  */
12
15
  export declare function downloadFontsOfDesign(design: MPlaza.Design, downloadedFonts: FontFamily[]): Promise<void>;
16
+ /**
17
+ * Remove invalid characters from the text.
18
+ * Invalid characters include backspace (\x08) and null (\u0000) characters.
19
+ *
20
+ * @param text The text to remove invalid characters from
21
+ * @returns The text without invalid characters
22
+ */
23
+ export declare function removeInvalidCharactersFromText(text: string): string;
24
+ /**
25
+ * Remove unsupported characters from the text.
26
+ * Unsupported characters include characters that cannot be displayed or processed correctly.
27
+ * @param face The font to check character support
28
+ * @param text The text to remove unsupported characters from
29
+ * @returns The text without unsupported characters
30
+ */
31
+ export declare function sanitizeString(face: FontFamilyFace, string: string): string;
32
+ /**
33
+ * Remove unsupported characters from the text and return a list of removed characters.
34
+ * Unsupported characters include characters that cannot be displayed or processed correctly.
35
+ * @param face The font to check character support
36
+ * @param text The text to remove unsupported characters from
37
+ * @returns The text without unsupported characters and a list of removed characters
38
+ */
39
+ export declare function sanitizeText(face: FontFamilyFace, text: string): TextSanitationResult;
40
+ /**
41
+ * Remove invalid characters from the text based on the font file.
42
+ * Invalid characters include whitespace or characters that are not supported by the font.
43
+ *
44
+ * @param text The text to remove invalid characters from
45
+ * @param fontFile The font file used to check character support
46
+ * @returns The text without invalid characters
47
+ */
48
+ export declare function removeInvalidCharacters(text: string, fontFile: any): string;
49
+ /**
50
+ * Get the parsed file from a font
51
+ *
52
+ * @param face The font to get the parsed file from
53
+ * @returns The parsed file
54
+ */
55
+ export declare function getParsedFileFromFont(face: FontFamilyFace): import("./models").FontFamilyFaceFiles | undefined;
56
+ /**
57
+ * Remove unsupported characters from the text.
58
+ * Unsupported characters include characters that cannot be displayed or processed correctly.
59
+ * @param text The text to remove unsupported characters from
60
+ * @returns The text without unsupported characters
61
+ */
62
+ export declare function removeUnsupportedCharacters(text: string, currentFont: FontFamilyFace): string;
63
+ /**
64
+ * Remove textual emojis from the text.
65
+ * Textual emojis include emojis that are made up of multiple characters.
66
+ * @param text The text to remove textual emojis from
67
+ * @returns The text without textual emojis
68
+ */
69
+ export declare function removeTextualEmojisFromText(text: string): string;
70
+ /**
71
+ * Remove emojis from the text.
72
+ * @param text The text to remove emojis from
73
+ * @returns The text without emojis
74
+ */
75
+ export declare function removeEmojisFromText(text: string): string;
@@ -257,6 +257,10 @@ export declare class PlatformSettings {
257
257
  constructor(ecommerceId: number, currencyId: number | undefined, apiKey: string, apiSecret: string, accessKey: string, accessSecret: string, remoteUrl: string, username: string, password: string, adminPath: string);
258
258
  static fromData(settings: PlatformSettingsDto): PlatformSettings;
259
259
  }
260
+ export interface TextSanitationResult {
261
+ sanitizedText: string;
262
+ dirtyChars: string[];
263
+ }
260
264
  export interface MerchantImageResultDto {
261
265
  fileNameSmall: string;
262
266
  fileNameBig: string;
@@ -284,12 +288,32 @@ export interface SubscriptionInfo {
284
288
  export interface FontFamily {
285
289
  fontFamilyID: number;
286
290
  fontFamilyGuid: number;
291
+ faces: FontFamilyFace[];
287
292
  name: string;
288
293
  imageUrl: string;
289
294
  cssUrl: string;
290
295
  isSystemFont: boolean;
291
296
  stretches: string;
292
297
  variations: string;
298
+ fullLoaded?: boolean;
299
+ }
300
+ export interface FontFamilyFace {
301
+ filesUrls: string[];
302
+ parsedFiles: FontFamilyFaceFiles[];
303
+ fontFaceGuid: string;
304
+ fontFaceID: number;
305
+ name: string;
306
+ openTypeStretch: string;
307
+ openTypeWeight: string;
308
+ stretch: string;
309
+ style: string;
310
+ variation: string;
311
+ version: string;
312
+ weight: string;
313
+ }
314
+ export interface FontFamilyFaceFiles {
315
+ url: string;
316
+ file: any;
293
317
  }
294
318
  /**
295
319
  * Represents an image.
@@ -1,3 +1,3 @@
1
- import { Zakeke } from "./providerValue";
2
- import { AppState } from "./state";
1
+ import { Zakeke } from './providerValue';
2
+ import { AppState } from './state';
3
3
  export declare const createProviderValue: (state: AppState, dispatch: React.Dispatch<any>) => Zakeke;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @module Zakeke
3
3
  */
4
- import { EventMessage, FontFamily, Group, Item, NftForm, NftSettings, OnBeforeSendDataToParent, PrintingMethodsRestrictions, Product, Template, TemplateMacroCategory, Translations, VisibleEventMessage } from '..';
4
+ import { EventMessage, FontFamily, Group, Item, NftForm, NftSettings, OnBeforeSendDataToParent, PrintingMethodsRestrictions, Product, Template, TemplateMacroCategory, TextSanitationResult, Translations, VisibleEventMessage } from '..';
5
5
  import { FocusAttributesEventListener } from '../../../../3D/src';
6
6
  import { Camera, Image, ImageMacroCategory, ProductQuantityRule, SellerSettings, TemplateUploadRestrictictions } from '../models';
7
7
  interface RestrictionColor {
@@ -111,6 +111,9 @@ export interface Zakeke {
111
111
  setCameraZoomEnabled: (enabled: boolean) => void;
112
112
  resetCameraPivot: () => void;
113
113
  setCameraPivot: (meshId: string) => void;
114
+ fullyLoadFont: (fontFamily: string | FontFamily) => Promise<FontFamily>;
115
+ sanitizeString: (family: FontFamily, text: string) => string;
116
+ getSanitationText: (family: FontFamily, text: string) => TextSanitationResult;
114
117
  getImages: (categoryId: number) => Promise<Image[]>;
115
118
  getMacroCategories: () => Promise<ImageMacroCategory[]>;
116
119
  previewOnly__setItemImageFromBase64: (guid: string, base64: string) => void;