@merchi/product-form 1.19.12

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.
Files changed (188) hide show
  1. package/README.md +272 -0
  2. package/lib/actions/jobs.d.ts +3 -0
  3. package/lib/actions/jobs.js +80 -0
  4. package/lib/actions/leads.d.ts +7 -0
  5. package/lib/actions/leads.js +67 -0
  6. package/lib/components/AlertVariationSellerEditable.d.ts +6 -0
  7. package/lib/components/AlertVariationSellerEditable.js +46 -0
  8. package/lib/components/Collapse.d.ts +3 -0
  9. package/lib/components/Collapse.js +34 -0
  10. package/lib/components/DateCountdown.d.ts +44 -0
  11. package/lib/components/DateCountdown.js +188 -0
  12. package/lib/components/DropzoneInput.d.ts +10 -0
  13. package/lib/components/DropzoneInput.js +169 -0
  14. package/lib/components/DynamicVariationInput.d.ts +9 -0
  15. package/lib/components/DynamicVariationInput.js +71 -0
  16. package/lib/components/FormLead.d.ts +10 -0
  17. package/lib/components/FormLead.js +215 -0
  18. package/lib/components/GroupInventory.d.ts +6 -0
  19. package/lib/components/GroupInventory.js +16 -0
  20. package/lib/components/InputGroupQuantity.d.ts +8 -0
  21. package/lib/components/InputGroupQuantity.js +117 -0
  22. package/lib/components/InputHiddenStatic.d.ts +8 -0
  23. package/lib/components/InputHiddenStatic.js +24 -0
  24. package/lib/components/InputProductQuantity.d.ts +7 -0
  25. package/lib/components/InputProductQuantity.js +102 -0
  26. package/lib/components/InventoryStatus.d.ts +7 -0
  27. package/lib/components/InventoryStatus.js +67 -0
  28. package/lib/components/MerchiProductForm.d.ts +62 -0
  29. package/lib/components/MerchiProductForm.js +51 -0
  30. package/lib/components/PriceMatrix.d.ts +27 -0
  31. package/lib/components/PriceMatrix.js +106 -0
  32. package/lib/components/ProductButtonsSubmit.d.ts +3 -0
  33. package/lib/components/ProductButtonsSubmit.js +52 -0
  34. package/lib/components/ProductFeatureDeadline.d.ts +3 -0
  35. package/lib/components/ProductFeatureDeadline.js +25 -0
  36. package/lib/components/ProductGroupBuyStatus.d.ts +3 -0
  37. package/lib/components/ProductGroupBuyStatus.js +47 -0
  38. package/lib/components/ProductPriceMatrix.d.ts +3 -0
  39. package/lib/components/ProductPriceMatrix.js +51 -0
  40. package/lib/components/ProductTitle.d.ts +3 -0
  41. package/lib/components/ProductTitle.js +36 -0
  42. package/lib/components/ProductTotalCost.d.ts +3 -0
  43. package/lib/components/ProductTotalCost.js +74 -0
  44. package/lib/components/ProductUnitPrice.d.ts +7 -0
  45. package/lib/components/ProductUnitPrice.js +51 -0
  46. package/lib/components/TooltipElement.d.ts +9 -0
  47. package/lib/components/TooltipElement.js +35 -0
  48. package/lib/components/VariationAreaInput.d.ts +8 -0
  49. package/lib/components/VariationAreaInput.js +219 -0
  50. package/lib/components/VariationCheckBoxOrRadioOption.d.ts +10 -0
  51. package/lib/components/VariationCheckBoxOrRadioOption.js +82 -0
  52. package/lib/components/VariationCheckboxRadio.d.ts +17 -0
  53. package/lib/components/VariationCheckboxRadio.js +57 -0
  54. package/lib/components/VariationColourExtractInput.d.ts +8 -0
  55. package/lib/components/VariationColourExtractInput.js +395 -0
  56. package/lib/components/VariationError.d.ts +7 -0
  57. package/lib/components/VariationError.js +52 -0
  58. package/lib/components/VariationFieldInputInstructions.d.ts +10 -0
  59. package/lib/components/VariationFieldInputInstructions.js +50 -0
  60. package/lib/components/VariationFieldInstructions.d.ts +3 -0
  61. package/lib/components/VariationFieldInstructions.js +22 -0
  62. package/lib/components/VariationFieldNameAndCostInputs.d.ts +7 -0
  63. package/lib/components/VariationFieldNameAndCostInputs.js +34 -0
  64. package/lib/components/VariationFieldOptionDefaultInputs.d.ts +7 -0
  65. package/lib/components/VariationFieldOptionDefaultInputs.js +48 -0
  66. package/lib/components/VariationFieldStaticValues.d.ts +8 -0
  67. package/lib/components/VariationFieldStaticValues.js +57 -0
  68. package/lib/components/VariationFileInput.d.ts +8 -0
  69. package/lib/components/VariationFileInput.js +229 -0
  70. package/lib/components/VariationInput.d.ts +11 -0
  71. package/lib/components/VariationInput.js +97 -0
  72. package/lib/components/VariationLabel.d.ts +11 -0
  73. package/lib/components/VariationLabel.js +85 -0
  74. package/lib/components/VariationOptionColour.d.ts +8 -0
  75. package/lib/components/VariationOptionColour.js +50 -0
  76. package/lib/components/VariationOptionImage.d.ts +8 -0
  77. package/lib/components/VariationOptionImage.js +52 -0
  78. package/lib/components/VariationSelect.d.ts +8 -0
  79. package/lib/components/VariationSelect.js +66 -0
  80. package/lib/components/VariationSelectElements.d.ts +16 -0
  81. package/lib/components/VariationSelectElements.js +141 -0
  82. package/lib/components/VariationTurnaroundTime.d.ts +9 -0
  83. package/lib/components/VariationTurnaroundTime.js +156 -0
  84. package/lib/components/Variations.d.ts +9 -0
  85. package/lib/components/Variations.js +109 -0
  86. package/lib/components/VariationsGroups.d.ts +8 -0
  87. package/lib/components/VariationsGroups.js +79 -0
  88. package/lib/components/buttons/ButtonAddGroup.d.ts +7 -0
  89. package/lib/components/buttons/ButtonAddGroup.js +38 -0
  90. package/lib/components/buttons/ButtonProductSubmit.d.ts +7 -0
  91. package/lib/components/buttons/ButtonProductSubmit.js +33 -0
  92. package/lib/components/buttons/ButtonRemoveGroup.d.ts +8 -0
  93. package/lib/components/buttons/ButtonRemoveGroup.js +25 -0
  94. package/lib/components/buttons/index.d.ts +4 -0
  95. package/lib/components/buttons/index.js +5 -0
  96. package/lib/components/cost.d.ts +11 -0
  97. package/lib/components/cost.js +44 -0
  98. package/lib/components/currency.d.ts +16 -0
  99. package/lib/components/currency.js +184 -0
  100. package/lib/components/drafts/DraftApprovePanel.d.ts +6 -0
  101. package/lib/components/drafts/DraftApprovePanel.js +315 -0
  102. package/lib/components/drafts/DraftCanvas.d.ts +13 -0
  103. package/lib/components/drafts/DraftCanvas.js +496 -0
  104. package/lib/components/drafts/DraftDesignerSheet.d.ts +9 -0
  105. package/lib/components/drafts/DraftDesignerSheet.js +685 -0
  106. package/lib/components/drafts/ProductDraftsHost.d.ts +3 -0
  107. package/lib/components/drafts/ProductDraftsHost.js +207 -0
  108. package/lib/components/drafts/useHtmlImage.d.ts +1 -0
  109. package/lib/components/drafts/useHtmlImage.js +45 -0
  110. package/lib/components/icons/IconChecked.d.ts +3 -0
  111. package/lib/components/icons/IconChecked.js +10 -0
  112. package/lib/components/icons/IconCheckedOrNoStock.d.ts +7 -0
  113. package/lib/components/icons/IconCheckedOrNoStock.js +13 -0
  114. package/lib/components/icons/IconCountryFlag.d.ts +8 -0
  115. package/lib/components/icons/IconCountryFlag.js +27 -0
  116. package/lib/components/icons/IconFile.d.ts +7 -0
  117. package/lib/components/icons/IconFile.js +41 -0
  118. package/lib/components/icons/IconNoStock.d.ts +3 -0
  119. package/lib/components/icons/IconNoStock.js +12 -0
  120. package/lib/components/icons/index.d.ts +5 -0
  121. package/lib/components/icons/index.js +6 -0
  122. package/lib/components/quoteAfterFieldChange.d.ts +7 -0
  123. package/lib/components/quoteAfterFieldChange.js +11 -0
  124. package/lib/components/quoteAfterFieldChange.test.js +58 -0
  125. package/lib/components/utils.d.ts +26 -0
  126. package/lib/components/utils.js +500 -0
  127. package/lib/context/MerchiProductFormProvider.d.ts +177 -0
  128. package/lib/context/MerchiProductFormProvider.js +1020 -0
  129. package/lib/images/product-not-found.png +0 -0
  130. package/lib/index.d.ts +42 -0
  131. package/lib/index.js +41 -0
  132. package/lib/styles/globals.css +1590 -0
  133. package/lib/styles/globals.css.map +1 -0
  134. package/lib/styles/globals.scss +1698 -0
  135. package/lib/utils/area.d.ts +77 -0
  136. package/lib/utils/area.js +298 -0
  137. package/lib/utils/cleanFormVariationJson.d.ts +5 -0
  138. package/lib/utils/cleanFormVariationJson.js +39 -0
  139. package/lib/utils/cleanFormVariationJson.test.js +54 -0
  140. package/lib/utils/countries.d.ts +7 -0
  141. package/lib/utils/countries.js +290 -0
  142. package/lib/utils/currency.d.ts +2 -0
  143. package/lib/utils/currency.js +188 -0
  144. package/lib/utils/draftExport.d.ts +21 -0
  145. package/lib/utils/draftExport.js +481 -0
  146. package/lib/utils/draftExport.test.js +78 -0
  147. package/lib/utils/draftFonts.d.ts +55 -0
  148. package/lib/utils/draftFonts.js +68 -0
  149. package/lib/utils/draftStorage.d.ts +25 -0
  150. package/lib/utils/draftStorage.js +148 -0
  151. package/lib/utils/draftStorage.test.js +125 -0
  152. package/lib/utils/draftTemplates.d.ts +87 -0
  153. package/lib/utils/draftTemplates.js +579 -0
  154. package/lib/utils/draftTemplates.test.js +476 -0
  155. package/lib/utils/formErrors.d.ts +2 -0
  156. package/lib/utils/formErrors.js +29 -0
  157. package/lib/utils/index.d.ts +3 -0
  158. package/lib/utils/index.js +4 -0
  159. package/lib/utils/priceMatrix.d.ts +57 -0
  160. package/lib/utils/priceMatrix.js +82 -0
  161. package/lib/utils/priceMatrix.test.js +200 -0
  162. package/lib/utils/products.d.ts +40 -0
  163. package/lib/utils/products.js +68 -0
  164. package/lib/utils/quantity.d.ts +7 -0
  165. package/lib/utils/quantity.js +19 -0
  166. package/lib/utils/quantity.test.js +42 -0
  167. package/lib/utils/reconcileVariations.d.ts +25 -0
  168. package/lib/utils/reconcileVariations.js +246 -0
  169. package/lib/utils/reconcileVariations.test.js +239 -0
  170. package/lib/utils/selectedVariationCosts.d.ts +6 -0
  171. package/lib/utils/selectedVariationCosts.js +59 -0
  172. package/lib/utils/selectedVariationCosts.test.js +66 -0
  173. package/lib/utils/selections.d.ts +23 -0
  174. package/lib/utils/selections.js +76 -0
  175. package/lib/utils/selections.test.js +159 -0
  176. package/lib/utils/singleOptionVariation.d.ts +2 -0
  177. package/lib/utils/singleOptionVariation.js +22 -0
  178. package/lib/utils/singleOptionVariation.test.js +59 -0
  179. package/lib/utils/supportedNumbers.d.ts +1 -0
  180. package/lib/utils/supportedNumbers.js +27 -0
  181. package/lib/utils/types.d.ts +114 -0
  182. package/lib/utils/types.js +50 -0
  183. package/lib/utils/url.d.ts +3 -0
  184. package/lib/utils/url.js +65 -0
  185. package/lib/utils/variationFields.d.ts +5 -0
  186. package/lib/utils/variationFields.js +116 -0
  187. package/lib/utils/variationFields.test.js +108 -0
  188. package/package.json +93 -0
@@ -0,0 +1,87 @@
1
+ import { DraftArtworkRole, DraftCanvasObject, DraftCanvasObjectType, DraftCanvasState, DraftFieldBinding } from './types';
2
+ export declare function productHasDraftTemplates(product: any): boolean;
3
+ export declare function productAllowsClientDesign(product: any): boolean;
4
+ export declare function productHasVariationGroups(product: any): boolean;
5
+ export declare function designGroupCount(product: any, formValues: any): number;
6
+ export declare function parseSelectedOptionIds(value: any): number[];
7
+ export declare function selectedOptionIdsFromVariations(variations: any[]): Set<number>;
8
+ export declare function isTemplateVisible(template: any, selectedOptionIds: Set<number>): boolean;
9
+ export declare function visibleTemplatesForGroup(product: any, independentVariations: any[], groupVariations: any[]): any[];
10
+ export declare function blankTemplate(product?: any): {
11
+ id: number;
12
+ name: string;
13
+ width: number;
14
+ height: number;
15
+ file: any;
16
+ editedByVariationFields: any[];
17
+ selectedByVariationFieldOptions: any[];
18
+ };
19
+ export declare function templatesForGroup(product: any, independentVariations: any[], groupVariations: any[]): any[];
20
+ export declare function canvasKindForFieldType(fieldType: any): DraftCanvasObjectType | null;
21
+ export declare function variationCanvasContent(variation: any): {
22
+ kind: DraftCanvasObjectType | null;
23
+ text?: string;
24
+ src?: string;
25
+ fill?: string;
26
+ };
27
+ export declare function normaliseCssColour(...candidates: any[]): string | undefined;
28
+ export declare function linkedVariationsForTemplate(template: any, variations: any[]): any[];
29
+ export declare function variationsForGroup(formValues: any, groupIndex: number): any[];
30
+ export declare function regionsForRole(customisationMap: any, role: string): number[][];
31
+ export declare function bboxToPixels(bbox: number[], width: number, height: number): {
32
+ x: number;
33
+ y: number;
34
+ width: number;
35
+ height: number;
36
+ };
37
+ export declare function fieldBindingsFrom(template: any): DraftFieldBinding[];
38
+ export declare function bindingForField(bindings: DraftFieldBinding[], fieldId: any): DraftFieldBinding | undefined;
39
+ export declare function inferArtworkRole(field: any, linkedFields?: any[]): DraftArtworkRole;
40
+ export declare function resolveArtworkRole(field: any, template: any, linkedFields?: any[]): DraftArtworkRole;
41
+ export declare function inferTextTargetFieldId(field: any, template: any, linkedFields?: any[]): number | undefined;
42
+ export declare function fitInside(box: {
43
+ x: number;
44
+ y: number;
45
+ width: number;
46
+ height: number;
47
+ }, contentWidth: number, contentHeight: number, lockAspectRatio?: boolean): {
48
+ x: number;
49
+ y: number;
50
+ width: number;
51
+ height: number;
52
+ };
53
+ export declare function shouldLockImageAspect(field: any, template?: any): boolean;
54
+ export declare function isBackgroundFill(obj: {
55
+ type?: string;
56
+ }): boolean;
57
+ export declare function isFullArtboardFill(obj: {
58
+ x?: number;
59
+ y?: number;
60
+ width?: number;
61
+ height?: number;
62
+ }, artWidth: number, artHeight: number): boolean;
63
+ export declare function measureDraftText(text: string, fontSize?: number, fontFamily?: string): {
64
+ width: number;
65
+ height: number;
66
+ };
67
+ export declare function fitTextBox(obj: Pick<DraftCanvasObject, 'x' | 'y' | 'width' | 'height' | 'text' | 'fontSize' | 'fontFamily'>): {
68
+ x: number;
69
+ y: number;
70
+ width: number;
71
+ height: number;
72
+ };
73
+ export declare function defaultPlacement(kind: DraftCanvasObjectType, index: number, artWidth: number, artHeight: number): {
74
+ x: number;
75
+ y: number;
76
+ width: number;
77
+ height: number;
78
+ };
79
+ export declare function createObjectId(): string;
80
+ export declare function seedOrSyncCanvas(existing: DraftCanvasState | null | undefined, template: any, variations: any[]): DraftCanvasState;
81
+ export declare function detachField(state: DraftCanvasState, objectId: string): DraftCanvasState;
82
+ export declare function printAreaGuides(template: any): Array<{
83
+ x: number;
84
+ y: number;
85
+ width: number;
86
+ height: number;
87
+ }>;