@bluepic/embed 0.4.0-next.106 → 0.4.0-next.108

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.
@@ -14,70 +14,23 @@ export declare function groupTemplatesByName(templates: {
14
14
  };
15
15
  };
16
16
  };
17
- /**
18
- * A campaign-level template→category override map (`config.categories`), keyed
19
- * by TEMPLATE ID. This is the sole source of a template's category — there is
20
- * no template-level category to fall back to. Templates with no entry
21
- * collapse into "Other".
22
- */
23
- export type CampaignCategories = {
24
- [templateId: string]: string;
25
- } | undefined;
26
17
  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[];
39
- export declare function collectTemplatesCategories(templates: {
40
- [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
41
- }, overrides?: CampaignCategories, categoryOrder?: string[]): string[];
42
- export declare function groupTemplatesByCategory(templates: {
43
- [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
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
18
  export type PortalAsset = z.infer<typeof Studio.publicCampaignAssetDescriptor>;
19
+ export type CampaignCategory = Studio.CampaignCategory;
60
20
  /**
61
- * Every category present across BOTH templates and assets, in portal order.
21
+ * Group templates AND assets by the campaign's categories.
62
22
  *
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.
23
+ * Takes the CONVERTED category array `Studio.convertCampaign` has already run
24
+ * at the boundary so there is no shape-guessing here, no legacy record, and
25
+ * no separate order field: array position IS the order.
73
26
  *
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.
27
+ * Anything no category claims falls into "Other", which always renders last.
28
+ * Categories that end up empty are dropped: an empty category is legitimate
29
+ * while editing, but not something to render a tab for.
77
30
  */
78
31
  export declare function groupPortalItemsByCategory(templates: {
79
32
  [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
80
- }, assets: PortalAsset[] | undefined, overrides?: CampaignCategories, categoryOrder?: string[]): {
33
+ }, assets: PortalAsset[] | undefined, categories: CampaignCategory[] | undefined): {
81
34
  category: string;
82
35
  templatesByName: {
83
36
  [k: string]: {
@@ -107,3 +60,7 @@ export declare function groupPortalItemsByCategory(templates: {
107
60
  pageCount?: number | undefined;
108
61
  }[];
109
62
  }[];
63
+ /** The category strip: only labels that actually have something in them. */
64
+ export declare function collectPortalCategories(templates: {
65
+ [k: string]: z.infer<typeof Studio.publicTemplateDescriptor>;
66
+ }, assets: PortalAsset[] | undefined, categories: CampaignCategory[] | undefined): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluepic/embed",
3
- "version": "0.4.0-next.106",
3
+ "version": "0.4.0-next.108",
4
4
  "description": "Bluepic embed sdk",
5
5
  "type": "module",
6
6
  "sideEffects": false,