@bluepic/embed 0.4.0-next.102 → 0.4.0-next.103

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.
@@ -23,12 +23,61 @@ export declare function groupTemplatesByName(templates: {
23
23
  export type CampaignCategories = {
24
24
  [templateId: string]: string;
25
25
  } | undefined;
26
+ export declare const OTHER_CATEGORY = "Other";
27
+ /**
28
+ * Order a set of category names.
29
+ *
30
+ * `categoryOrder` (campaign config) wins, in its own order; anything not listed
31
+ * follows alphabetically; "Other" is always last.
32
+ *
33
+ * Alphabetical-only was fine for a template gallery but wrong for a brand
34
+ * portal — customers expect "Logos, Templates, Guidelines" in that order.
35
+ * Unknown categories degrade to the old behaviour instead of disappearing, so
36
+ * an incomplete `categoryOrder` never hides content.
37
+ */
38
+ export declare function orderCategories(categories: Iterable<string>, categoryOrder?: string[]): string[];
26
39
  export declare function collectTemplatesCategories(templates: {
27
40
  [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
28
- }, overrides?: CampaignCategories): string[];
41
+ }, overrides?: CampaignCategories, categoryOrder?: string[]): string[];
29
42
  export declare function groupTemplatesByCategory(templates: {
30
43
  [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
31
- }, overrides?: CampaignCategories): {
44
+ }, overrides?: CampaignCategories, categoryOrder?: string[]): {
45
+ category: string;
46
+ templatesByName: {
47
+ [k: string]: {
48
+ [k: string]: {
49
+ serial: any;
50
+ preview: string | null;
51
+ name: string;
52
+ width: number;
53
+ height: number;
54
+ dpi?: number | undefined;
55
+ };
56
+ };
57
+ };
58
+ }[];
59
+ export type PortalAsset = z.infer<typeof Studio.publicCampaignAssetDescriptor>;
60
+ /**
61
+ * Every category present across BOTH templates and assets, in portal order.
62
+ *
63
+ * They must be collected together: two independent category strips on one page
64
+ * is the obvious failure mode of storing template categories in a config map
65
+ * and asset categories on the join row. The category STRING is the join key —
66
+ * a template in "Logos" and an asset in "Logos" land in the same tab.
67
+ */
68
+ export declare function collectPortalCategories(templates: {
69
+ [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
70
+ }, assets: PortalAsset[] | undefined, overrides?: CampaignCategories, categoryOrder?: string[]): string[];
71
+ /**
72
+ * Group templates AND assets by category, in portal order.
73
+ *
74
+ * Each entry carries both, so a category renders its templates and its assets
75
+ * together — a template is "editable" and an asset is "ready-made", and the
76
+ * visitor came for both. Categories with neither are dropped.
77
+ */
78
+ export declare function groupPortalItemsByCategory(templates: {
79
+ [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
80
+ }, assets: PortalAsset[] | undefined, overrides?: CampaignCategories, categoryOrder?: string[]): {
32
81
  category: string;
33
82
  templatesByName: {
34
83
  [k: string]: {
@@ -42,4 +91,19 @@ export declare function groupTemplatesByCategory(templates: {
42
91
  };
43
92
  };
44
93
  };
94
+ assets: {
95
+ id: string;
96
+ kind: "image" | "file";
97
+ title: string;
98
+ description: string | null;
99
+ category: string | null;
100
+ mime: string;
101
+ size: number;
102
+ filename: string;
103
+ previewUrl: string | null;
104
+ downloadUrl: string;
105
+ width?: number | undefined;
106
+ height?: number | undefined;
107
+ pageCount?: number | undefined;
108
+ }[];
45
109
  }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluepic/embed",
3
- "version": "0.4.0-next.102",
3
+ "version": "0.4.0-next.103",
4
4
  "description": "Bluepic embed sdk",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -30,14 +30,15 @@
30
30
  "dev:vite": "vite build --watch",
31
31
  "dev:types": "vue-tsc -p tsconfig.build.json --declaration --emitDeclarationOnly --outDir dist --watch",
32
32
  "playground:dev": "vite --config vite.playground.config.ts",
33
- "test:autocrop": "tsx src/util/autoCrop/solveAutoCrop.test.ts"
33
+ "test:autocrop": "tsx src/util/autoCrop/solveAutoCrop.test.ts",
34
+ "test:gallery": "tsx src/util/gallery.test.ts"
34
35
  },
35
36
  "peerDependencies": {
36
37
  "vue": "^3.5.23"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@auth0/auth0-vue": "^2.4.0",
40
- "@bluepic/types": "^0.6.456",
41
+ "@bluepic/types": "^0.6.466",
41
42
  "@hono/zod-openapi": "^1.1.4",
42
43
  "@types/css": "^0.0.38",
43
44
  "@types/downloadjs": "^1.4.6",
@@ -88,4 +89,4 @@
88
89
  "vue3-delay-watch": "^0.1.3",
89
90
  "vue3-rich-text-editor": "^0.1.15"
90
91
  }
91
- }
92
+ }