makea-cli 0.2.37__py3-none-any.whl → 0.2.39__py3-none-any.whl

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.
makea_cli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.37"
1
+ __version__ = "0.2.39"
makea_cli/api_client.py CHANGED
@@ -973,6 +973,13 @@ def get_growth_snapshot(snapshot_id: str = "latest") -> Any:
973
973
  return get_json(f"/admin/growth/snapshots/{quote(snapshot_id, safe='')}", timeout=120.0)
974
974
 
975
975
 
976
+ def get_engagement_stats(start: str = "", end: str = "", customer: str = "") -> Any:
977
+ """GET /admin/engagement-stats?start=&end=&customer= — brand/factory messages
978
+ and Beeboo's actions per customer and per product. Scans the table: slow-ish."""
979
+ params = {k: v for k, v in (("start", start), ("end", end), ("customer", customer)) if v}
980
+ return get_json("/admin/engagement-stats", params=params, timeout=120.0)
981
+
982
+
976
983
  def import_growth_snapshot(sources_path: Path, *, check_only: bool = False) -> Any:
977
984
  """POST /admin/growth/snapshots — gate and publish one reconciled snapshot.
978
985
 
@@ -1480,6 +1487,19 @@ def designer_get_order_flow(product_id: str) -> Any:
1480
1487
  return get_json(f"/designer/products/{product_id}/order_flow")
1481
1488
 
1482
1489
 
1490
+ def designer_step_library(product_id: str) -> Any:
1491
+ """GET /designer/products/{id}/order_flow/step_library — the steps the brand
1492
+ used on its other orders, its step rules, and this order's steps a new one
1493
+ may follow."""
1494
+ return get_json(f"/designer/products/{product_id}/order_flow/step_library")
1495
+
1496
+
1497
+ def designer_add_custom_steps(product_id: str, steps: list[dict[str, Any]]) -> Any:
1498
+ """POST /designer/products/{id}/order_flow/custom_steps/batch — several
1499
+ steps at once; each names ``after`` or ``anchor_type``."""
1500
+ return post_json(f"{_designer_step_path(product_id)}/batch", {"steps": steps})
1501
+
1502
+
1483
1503
  def designer_add_custom_step(product_id: str, body: dict[str, Any]) -> Any:
1484
1504
  """POST /designer/products/{id}/order_flow/custom_steps — {label, after, who,
1485
1505
  completion, due, hold, note, placement?, joins?}."""
@@ -133,6 +133,53 @@ def register(app: typer.Typer) -> None:
133
133
 
134
134
  print_json_or_exit(console, _do)
135
135
 
136
+ @command(
137
+ app,
138
+ "admin",
139
+ "get",
140
+ "engagement-stats",
141
+ api="GET /admin/engagement-stats",
142
+ help=(
143
+ "GET /admin/engagement-stats — per customer and per product: messages "
144
+ "brand to factory, factory to brand and makea to factory, Beeboo's "
145
+ "nudges (reminders to the brand, morning emails that carried them, "
146
+ "chases to the factory) and every other action Beeboo took."
147
+ ),
148
+ )
149
+ def get_engagement_stats(
150
+ start: str = typer.Option(None, "--start", help="First day, YYYY-MM-DD (inclusive)."),
151
+ end: str = typer.Option(None, "--end", help="Last day, YYYY-MM-DD (inclusive)."),
152
+ customer: str = typer.Option(
153
+ None, "--customer", "-c", help="Only customers whose name contains this."
154
+ ),
155
+ view: str = typer.Option(
156
+ "all",
157
+ "--view",
158
+ "-v",
159
+ help="all | customers | products | totals | definitions.",
160
+ ),
161
+ ) -> None:
162
+ """A customer is a team (named after its owner's brand) or a lone account.
163
+ Counts come from the threads and Beeboo's day log; nothing is estimated.
164
+
165
+ Output JSON: {"period", "definitions", "totals", "customers", "products"};
166
+ every row has the same counters plus "messages" (the three message
167
+ counts) and "beeboo_actions" (every Beeboo counter). "definitions" says
168
+ what each counter means, in words fit for a slide. --view keeps one part.
169
+ """
170
+ views = ("all", "customers", "products", "totals", "definitions")
171
+ if view not in views:
172
+ console.print(f"[red]--view must be one of {', '.join(views)}.[/red]")
173
+ raise typer.Exit(1)
174
+
175
+ def _do():
176
+ result = (
177
+ api_client.get_engagement_stats(start or "", end or "", customer or "") or {}
178
+ ).get("result") or {}
179
+ return result if view == "all" else result.get(view)
180
+
181
+ print_json_or_exit(console, _do)
182
+
136
183
  @command(
137
184
  app,
138
185
  "admin",
@@ -23,6 +23,7 @@ them.
23
23
 
24
24
  from __future__ import annotations
25
25
 
26
+ import json
26
27
  from pathlib import Path
27
28
  from typing import Any
28
29
 
@@ -492,6 +493,66 @@ def _register_designer(app: typer.Typer) -> None:
492
493
  )
493
494
  print_json_or_exit(console, lambda: api_client.designer_add_custom_step(product_id, body))
494
495
 
496
+ @command(
497
+ app,
498
+ "designer",
499
+ "list",
500
+ "step-library",
501
+ api="GET /designer/products/{product_id}/order_flow/step_library",
502
+ help=(
503
+ "Steps you used on your other orders (most used first: name, who does "
504
+ "it, how it is done, the kind of step it came after as anchor_type, how "
505
+ "many orders and which), your rules that add a step to every order, and "
506
+ "this order's steps a new one can follow. Read it before setting an "
507
+ "order up like your last ones."
508
+ ),
509
+ )
510
+ def designer_list_step_library(
511
+ product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
512
+ ) -> None:
513
+ """Steps you used on other orders, to set this one up."""
514
+ print_json_or_exit(console, lambda: api_client.designer_step_library(product_id))
515
+
516
+ @command(
517
+ app,
518
+ "designer",
519
+ "create",
520
+ "custom-steps",
521
+ api="POST /designer/products/{product_id}/order_flow/custom_steps/batch",
522
+ side_effects=[
523
+ "every step shows on your order page, and the factory's when it does it",
524
+ "whoever does a step gets an action card once it opens",
525
+ ],
526
+ approval="ask",
527
+ help=(
528
+ "Add several steps to your order at once, from a JSON list in --file. "
529
+ "Each item: label, who (BRAND, SUPPLIER, MAKEA), completion (check, "
530
+ "upload, send), and either after (a step id) or anchor_type (the kind "
531
+ "of step it follows, as step-library gives it); optional placement "
532
+ "(inline, alongside), hold, note, due ({mode: before, key, days} or "
533
+ "{mode: date, date})."
534
+ ),
535
+ )
536
+ def designer_create_custom_steps(
537
+ product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
538
+ file: Path = typer.Option(
539
+ ...,
540
+ "--file",
541
+ "-f",
542
+ exists=True,
543
+ dir_okay=False,
544
+ help="JSON list of steps.",
545
+ ),
546
+ ) -> None:
547
+ """Add several steps to your order at once."""
548
+ try:
549
+ steps = json.loads(file.read_text(encoding="utf-8"))
550
+ except ValueError as e:
551
+ raise typer.BadParameter(f"--file is not valid JSON: {e}") from e
552
+ if not isinstance(steps, list) or not steps:
553
+ raise typer.BadParameter("--file must hold a JSON list of steps")
554
+ print_json_or_exit(console, lambda: api_client.designer_add_custom_steps(product_id, steps))
555
+
495
556
  @command(
496
557
  app,
497
558
  "designer",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.37
3
+ Version: 0.2.39
4
4
  Summary: Makea admin CLI (browser login + Makea admin HTTP API)
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: click<9,>=8.1
@@ -130,6 +130,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
130
130
  | `makea-cli admin get analytics-query` | read | `POST /admin/analytics/query` | Run an arbitrary HogQL query (escape hatch). Example: analytics-query "SELECT count() FROM events" | `analytics-query` |
131
131
  | `makea-cli admin get file` | read | local (makea_cli.file_reader) | read a pattern (DXF/RUL/PLT), artwork (AI/EPS/PSD/SVG), embroidery (PES/DST/EMB), ZIP or AVIF/TIFF file on this machine; saves PNG pictures of what it draws next to it. No API call. | — |
132
132
  | `makea-cli admin get currency-conversion` | read | `GET /admin/fx/rates` | the platform's own exchange rates and rounding (rate table for several --from; one --from with --amount converts it). | `convert-currency` |
133
+ | `makea-cli admin get engagement-stats` | read | `GET /admin/engagement-stats` | per customer and per product: messages brand↔factory and makea→factory, Beeboo's nudges (reminders to the brand, the morning emails that carried them, chases to the factory) and its other actions; `--start/--end`, `--customer`, `--view`. | — |
133
134
  | `makea-cli admin get feature-usage` | read | `POST /admin/analytics/query` | How many distinct users used a feature recently, plus event volume. Matches $pageview path and feature_time_spent eve… | `analytics-feature-usage` |
134
135
  | `makea-cli admin get growth-snapshot` | read | `GET /admin/growth/snapshots/{id}` | one reconciled Growth Analysis snapshot (default `latest`); `--block` prints one block (headline, gates, review_items, …). | — |
135
136
  | `makea-cli admin get library-schema` | read | `GET /admin/library_components/schema` | the tech-pack library taxonomy: sections and their library-role field keys (run this before create/update). | `library-schema` |
@@ -213,6 +214,8 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
213
214
  | `makea-cli designer create checkout` | write(ask) | `POST /designer/payments/basket/create-session` | a Stripe checkout link for one or more charges. --key repeats: sampling:<sampling_order_id>, production:<production_o… | — |
214
215
  | `makea-cli designer create collection` | write(auto) | `POST /designer/collections/create` | create or update a designer collection. | `designer-create-collection` |
215
216
  | `makea-cli designer create custom-step` | write(ask) | `POST /designer/products/{product_id}/order_flow/custom_steps` | add a step to your order: `--after`, `--placement inline\|alongside\|beside` (default alongside), `--joins` / `--no-joins`, `--who`, `--done-when`, due, `--note`. | — |
217
+ | `makea-cli designer create custom-steps` | write(ask) | `POST /designer/products/{product_id}/order_flow/custom_steps/batch` | add several steps at once from `--file` (a JSON list; each item names `after` or `anchor_type`). | — |
218
+ | `makea-cli designer list step-library` | read | `GET /designer/products/{product_id}/order_flow/step_library` | steps used on your other orders, your step rules, and this order's steps a new one can follow. | — |
216
219
  | `makea-cli designer create library-element` | write(auto) | `POST /designer/library_components` | add a fabric, trim or other part to the brand's library; --document attaches a photo or data sheet, --draft when required fields are unknown. | — |
217
220
  | `makea-cli designer create note` | write(ask) | `POST /designer/products/{product_id}/notes` | post a message into a product's conversation. | — |
218
221
  | `makea-cli designer create pack-file` | write(auto) | `POST /designer/products/{product_id}/tech_spec/files` | put an uploaded file on a tech pack section; a pattern file (DXF, RUL, PLT) goes on Patterns when no section is named. | — |
@@ -1,6 +1,6 @@
1
- makea_cli/__init__.py,sha256=5cBA1BOigyaIjTZkiKDnt-MqIStCt3LXAj1D5m_PUbg,23
1
+ makea_cli/__init__.py,sha256=OLeSZoOE5KDS2bHV78zl4JEvBz59oQbMDw2kbLLG_BU,23
2
2
  makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
3
- makea_cli/api_client.py,sha256=5HmLZuY1ljqbSDd-BpGFyWLFZt2iCCYENAjBX11EwGU,90271
3
+ makea_cli/api_client.py,sha256=-tZjD5oh5qbaVf1Rcrrr7qO3zd_gFkZa8QJn-v4L8eE,91322
4
4
  makea_cli/auth_pkce.py,sha256=iXSyJ7DM3qVuj-3FwPiqM25CxXz9ebFs9FNthZdw3ws,7315
5
5
  makea_cli/broker.py,sha256=5O650nAdRuF-u9E1MuVM2jVv796iBdxJGIaJasxHij0,3019
6
6
  makea_cli/companion.py,sha256=lEEMRDbS-5-CWPawlkPDeCij08pAYW8MsXLVSG3_8V0,10116
@@ -39,9 +39,9 @@ makea_cli/commands/flags/cmd.py,sha256=BC9Vu2h9HKid5S2SNNUqtgQaqTWRx2Ne529gzGmqr
39
39
  makea_cli/commands/library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  makea_cli/commands/library/cmd.py,sha256=eXZa6iLyPaoEWtRd-UmhRT6Ox-zlfs89gJqGn-IPuSU,11187
41
41
  makea_cli/commands/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- makea_cli/commands/metrics/cmd.py,sha256=gAYNztkhvdK8miP3ayDu0JgYzxLr42-ToeiXBCrAQeA,8656
42
+ makea_cli/commands/metrics/cmd.py,sha256=juK9vWaQrZCAiDpaGBHlZfKEk7ant0vm-2Ak94Zzz1o,10674
43
43
  makea_cli/commands/order_flow/__init__.py,sha256=SmD-TaDbNZLeu8q1nkPi2H6gJaKCrNAyW3Ejj6-UBog,79
44
- makea_cli/commands/order_flow/cmd.py,sha256=3kUelbdFDDaxxLp0GMjtSG__CbV_aQQDhswxeJCR4aY,30960
44
+ makea_cli/commands/order_flow/cmd.py,sha256=epZ7E8vsVzy8bGLQ0e4MmqwvBqp2da1kpFVsXUjwiLg,33479
45
45
  makea_cli/commands/orders/__init__.py,sha256=6WKPqX02e0RRPmItPIBJ0TA4_yDI2PVvBDkAiMQu9rU,75
46
46
  makea_cli/commands/orders/cmd.py,sha256=LgYPmC-eXEIvKhDYLKxo03DsJ2529-yKPKFPixnMBu0,23072
47
47
  makea_cli/commands/playbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -59,7 +59,7 @@ makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNL
59
59
  makea_cli/commands/supplier/cmd.py,sha256=12YzQIz8478ksOUbuI7pSwSAwQAqLTvXu-AKjyrwLgA,64039
60
60
  makea_cli/commands/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  makea_cli/commands/tasks/cmd.py,sha256=72MrVigmjjQCpDVF2a3aJn_gclw2iBbJdFmyd87mXec,8549
62
- makea_cli-0.2.37.dist-info/METADATA,sha256=ls1R_knOZuxyOxXZnERi-rPst9gUhmTpxBg629G4z7Q,51096
63
- makea_cli-0.2.37.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
64
- makea_cli-0.2.37.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
65
- makea_cli-0.2.37.dist-info/RECORD,,
62
+ makea_cli-0.2.39.dist-info/METADATA,sha256=HCO1jPpuIcs6XMGevS9BjW3ygAbv3N8ObVreorn-S5s,51883
63
+ makea_cli-0.2.39.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
64
+ makea_cli-0.2.39.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
65
+ makea_cli-0.2.39.dist-info/RECORD,,