@pairbo/ui-kit 0.1.1 → 0.2.0

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.
@@ -13,11 +13,14 @@ export default class PboEditor extends PairboElement {
13
13
  "pbo-type-form": typeof PboTypeForm;
14
14
  };
15
15
  cardInnerImageUrl: string;
16
- typingForm: PboTypeForm;
16
+ card: Card | null;
17
+ submitTypeForm: SubmitTypeForm | undefined;
18
+ submitHandwrittenForm: SubmitHandwrittenForm | undefined;
19
+ getProcessedImg: GetProcessedImg | undefined;
20
+ typeForm: PboTypeForm;
17
21
  handwrittenForm: PboHandwrittenForm;
18
22
  slider: PboEditorCardSlider;
19
23
  zoomedPreview: PboDrawer;
20
- card: Card | null;
21
24
  private formData;
22
25
  private handwrittenFormState;
23
26
  private editorType;
@@ -19,7 +19,14 @@ export default class PboHandwrittenForm extends PairboElement {
19
19
  static styles: CSSResultGroup;
20
20
  imageInput: HTMLInputElement;
21
21
  handwrittenForm: HTMLFormElement;
22
+ card: Card | null;
23
+ submitHandwrittenForm: SubmitHandwrittenForm;
24
+ getProcessedImg: GetProcessedImg;
22
25
  sourceImg: File | null;
26
+ processedImg: {
27
+ fileUrl: string | null;
28
+ imgId: string | null;
29
+ };
23
30
  processedFileUrl: string | null;
24
31
  handwrittenDimensions: {
25
32
  top: number | null;
@@ -32,6 +39,7 @@ export default class PboHandwrittenForm extends PairboElement {
32
39
  showPicker(): void;
33
40
  handleSourceImgChange(oldFile: File | null, newFile: File | null): void;
34
41
  handleProcessImageChange(oldFileUrl: string | null, newFileUrl: string | null): void;
42
+ get formData(): HandwrittenFormData;
35
43
  setDimensions(dimensions: {
36
44
  top: number | null;
37
45
  left: number | null;
@@ -23,13 +23,19 @@ export default class PboPageManager extends PairboElement {
23
23
  editorEl: PboEditor;
24
24
  onClose: () => void;
25
25
  currentPage: "selection" | "editor";
26
- selectedCard: string | null;
27
26
  categories: Category[];
27
+ submitTypeForm: SubmitTypeForm | undefined;
28
+ submitHandwrittenForm: SubmitHandwrittenForm | undefined;
29
+ getProcessedImg: GetProcessedImg | undefined;
30
+ selectedCard: string | null;
28
31
  selectedCardId: string | null;
29
32
  selectedCardDetails: {
30
33
  cover_url: string;
31
34
  id: string;
32
35
  } | null;
36
+ handleSubmitTypeFormUpdate(): void;
37
+ handleSubmitHandwrittenFormUpdate(): void;
38
+ handleGetProcessedImgUpdate(): void;
33
39
  private goToEditor;
34
40
  private goToSelector;
35
41
  connectedCallback(): void;
@@ -37,7 +37,6 @@ export default class PboTypeForm extends PairboElement {
37
37
  textArea: PboTextarea;
38
38
  windowHeight: number;
39
39
  private resizeTimeout;
40
- private formData;
41
40
  charsNum: number;
42
41
  static readonly CTA_STATES: {
43
42
  danger: {
@@ -54,13 +53,10 @@ export default class PboTypeForm extends PairboElement {
54
53
  message: string;
55
54
  };
56
55
  cardInnerImageUrl: string;
56
+ card: Card | null;
57
+ submitTypeForm: SubmitTypeForm;
57
58
  protected firstUpdated(): void;
58
- get form(): {
59
- font: any;
60
- text: string;
61
- color: string;
62
- alignment: string;
63
- };
59
+ get formData(): TypeFormData;
64
60
  private handleFormChange;
65
61
  hostConnected(): void;
66
62
  hostDisconnected(): void;
@@ -1,3 +1,6 @@
1
+ import { default as PboDrawer } from '../../components/drawer/drawer.component';
2
+ import { default as PboGiftOptions } from '../../components/gift-options/gift-options.component';
3
+ import { default as PboPageManager } from '../../components/page-manager/page-manager.component';
1
4
  /**
2
5
  * @summary Default implementation of PboIntegration
3
6
  * @description
@@ -6,27 +9,23 @@
6
9
  * Sate management, event handling, and API interactions are handled here.
7
10
  */
8
11
  export declare class PboBridge {
9
- drawer: "pbo-drawer";
10
- giftOptions: "pbo-gift-options";
12
+ private _drawer;
13
+ private _giftOptions;
14
+ private _pageManager;
11
15
  private _isLoading;
12
- private _isError;
13
- private _isDrawerOpen;
14
- private _eventListeners;
15
- constructor(customBridgeProps: PboBridgeProps);
16
- toggleDrawer(visible: boolean): void;
17
- get isDrawerOpen(): boolean;
18
- getCards(): Promise<Card[]>;
19
- afterGetCards(cards: Card[]): void;
20
- getCategories(): Promise<Category[]>;
21
- private afterGetCategories;
22
- get isLoading(): boolean;
23
- private _setLoading;
24
- init(): Promise<void>;
25
- asyncExecute<T>(callback: () => Promise<T>): Promise<void>;
26
- uploadHandwrittenImage(file: File): Promise<string>;
27
- submitCard(payload: SubmittedCardPayload): Promise<void>;
28
- onSubmitted(): void;
29
- addEventListener(event: PboIntegrationEvent, callback: (event: CustomEvent) => void): void;
30
- removeEventListener(event: PboIntegrationEvent, callback: (event: CustomEvent) => void): void;
31
- private dispatchEvent;
16
+ private _cards;
17
+ private _categories;
18
+ private setDrawer;
19
+ getDrawer(): PboDrawer | null | undefined;
20
+ private setGiftOptions;
21
+ getGiftOptions(): PboGiftOptions | null | undefined;
22
+ private setPageManager;
23
+ getPageManager(): PboPageManager | null | undefined;
24
+ getCategories(): Category[];
25
+ setCategories(categories: Category[]): void;
26
+ getCards(): Card[];
27
+ setCards(cards: Card[]): void;
28
+ setIsLoading(isLoading: boolean): void;
29
+ setIsError(isError: boolean): void;
30
+ constructor({ getCards, getCategories, drawer, pageManager, giftOptions, selectionGroupBy, submitTypeForm, submitHandwrittenForm, getProcessedImg, }: PboBridgeConstructorProps);
32
31
  }
@@ -1,3 +1,4 @@
1
+ import { PboBridge } from './PboBridge';
1
2
  /**
2
3
  * @summary Factory function to create a PboIntegration instance
3
4
  * @description
@@ -17,4 +18,4 @@
17
18
  * });
18
19
  * ```
19
20
  */
20
- export declare function createPboBridge(): PboBridgeInterface;
21
+ export declare function createPboBridge(): PboBridge;
@@ -1,2 +1,3 @@
1
1
  export declare const shopifyCardsHandler: import('msw').HttpHandler;
2
2
  export declare const shopifyCategoriesHandler: import('msw').HttpHandler;
3
+ export declare const shopifyHandwrittenHandler: import('msw').HttpHandler;
@@ -1,3 +1,4 @@
1
1
  export declare const isMobileDevice: () => boolean;
2
2
  export declare const isNullOrUndefined: (...values: any[]) => boolean;
3
3
  export declare const isValid: <T>(value: T) => value is NonNullable<T>;
4
+ export declare const removeNullUndefined: <T extends Object>(obj: T) => Partial<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pairbo/ui-kit",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "readme": "./README-NPM.md",