@feedmepos/mf-settings 0.0.75 → 0.0.77-dev.1

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.
@@ -1,12 +1,12 @@
1
1
  import { openBlock as u, createBlock as L, createCommentVNode as X, withScopeId as W, defineComponent as q, createElementBlock as x, unref as f, ref as r, watch as H, computed as G, watchEffect as Y, onBeforeUnmount as M, resolveComponent as l, createVNode as k, withCtx as _, createElementVNode as g, toDisplayString as S, Fragment as $, renderList as AA, normalizeClass as oA } from "vue";
2
- import { u as nA, F as gA } from "./index-211667a8.js";
2
+ import { u as nA, F as gA } from "./index-d3531f7b.js";
3
3
  import { useCoreStore as fA, useI18n as aA, useCountry as eA } from "@feedmepos/mf-common";
4
4
  import { useSnackbar as pA } from "@feedmepos/ui-library";
5
5
  import { _ as sA, r as dA } from "./rules-c9fa22f8.js";
6
- import { b as F } from "./business-84f3045f.js";
7
- import { a as tA } from "./app-925bdc75.js";
6
+ import { b as F } from "./business-aa881f3b.js";
7
+ import { a as tA } from "./app-8c2bd26c.js";
8
8
  import "pinia";
9
- import "./index-cdad1889.js";
9
+ import "./index-a468d838.js";
10
10
  import "@feedmepos/mf-mdm";
11
11
  import "@feedmepos/mf-media";
12
12
  import "@feedmepos/mf-order-setting";
@@ -3,11 +3,11 @@ var Rv = (l, d, f) => d in l ? Pv(l, d, { enumerable: !0, configurable: !0, writ
3
3
  var Xo = (l, d, f) => (Rv(l, typeof d != "symbol" ? d + "" : d, f), f);
4
4
  import { h as _d, defineComponent as bc, ref as Xt, resolveComponent as Kt, openBlock as Zt, createElementBlock as Nr, Fragment as Xa, renderSlot as Cp, createVNode as Rt, unref as vt, withCtx as Tn, createElementVNode as nt, computed as _r, watch as Dp, withKeys as Cv, toDisplayString as kn, renderList as uc, createBlock as xa, createCommentVNode as oc, getCurrentInstance as Dv, withModifiers as Nv } from "vue";
5
5
  import { useI18n as yc, useCoreStore as vc, RestaurantSelector as F$ } from "@feedmepos/mf-common";
6
- import { c as X, b as Np } from "./app-925bdc75.js";
7
- import { l as D, d as Be } from "./index-cdad1889.js";
8
- import { d as Pe, c as D$, g as Pr, r as Ei, b as zh, u as N$ } from "./index-211667a8.js";
6
+ import { c as X, b as Np } from "./app-8c2bd26c.js";
7
+ import { l as D, d as Be } from "./index-a468d838.js";
8
+ import { d as Pe, f as D$, g as Pr, r as Ei, b as zh, u as N$ } from "./index-d3531f7b.js";
9
9
  import { c as Wu } from "./_commonjs-dynamic-modules-bed80856.js";
10
- import { d as Bv, u as qv, _ as Uv } from "./dayjs.min-84add9d0.js";
10
+ import { d as Bv, u as qv, _ as Uv } from "./dayjs.min-4b595624.js";
11
11
  import { components as ys, useSnackbar as _c, useDialogChild as Lv, useDialog as Bp, useBreakpoints as Gv } from "@feedmepos/ui-library";
12
12
  import { c as qp, _ as Vv, a as vg } from "./object-8ac0c0d8.js";
13
13
  import "@feedmepos/mf-mdm";
@@ -2,13 +2,13 @@ import { defineComponent as Ur, h as Ri, getCurrentInstance as Wi, inject as $m,
2
2
  import "@vue/devtools-api";
3
3
  import { useI18n as Uo, useCoreStore as ko } from "@feedmepos/mf-common";
4
4
  import { useDialog as Wo, useSnackbar as Vo, components as Qm, useBreakpoints as zm, FmButtonVariant as jm } from "@feedmepos/ui-library";
5
- import { c as Rr, _ as ev } from "./app-925bdc75.js";
5
+ import { c as Rr, _ as ev } from "./app-8c2bd26c.js";
6
6
  import { c as xi, _ as nv, a as uo } from "./object-8ac0c0d8.js";
7
- import { u as Bo } from "./index-211667a8.js";
7
+ import { u as Bo } from "./index-d3531f7b.js";
8
8
  import { _ as so, c as tv } from "./FormSection.vue_vue_type_script_setup_true_lang-f34c8596.js";
9
- import "./index-cdad1889.js";
9
+ import "./index-a468d838.js";
10
10
  import { defineStore as rv } from "pinia";
11
- import { b as ss } from "./business-84f3045f.js";
11
+ import { b as ss } from "./business-aa881f3b.js";
12
12
  import "@feedmepos/mf-mdm";
13
13
  import "@feedmepos/mf-media";
14
14
  import "@feedmepos/mf-order-setting";
@@ -4151,7 +4151,7 @@ const W = ({
4151
4151
  {
4152
4152
  path: "/business",
4153
4153
  name: "$settings-my-business",
4154
- component: U(() => import("./Business-c26e8fa0.js")),
4154
+ component: U(() => import("./Business-083ba84f.js")),
4155
4155
  meta: W({
4156
4156
  i18nKey: "settings.business.title"
4157
4157
  })
@@ -4159,7 +4159,7 @@ const W = ({
4159
4159
  {
4160
4160
  path: "/create-business",
4161
4161
  name: "$settings-create-business",
4162
- component: U(() => import("./CreateBusiness-45988eda.js")),
4162
+ component: U(() => import("./CreateBusiness-35369ca0.js")),
4163
4163
  meta: {
4164
4164
  hideNavigation: !0
4165
4165
  }
@@ -4167,7 +4167,7 @@ const W = ({
4167
4167
  {
4168
4168
  path: "/foodcourt",
4169
4169
  name: "$settings-food-court",
4170
- component: U(() => import("./FoodCourt-04097df3.js")),
4170
+ component: U(() => import("./FoodCourt-cbb595f9.js")),
4171
4171
  meta: W({
4172
4172
  i18nKey: "settings.food_court.list.title"
4173
4173
  })
@@ -4201,7 +4201,7 @@ const W = ({
4201
4201
  {
4202
4202
  path: "/tagging",
4203
4203
  name: "$settings-tagging",
4204
- component: Ee(U(() => import("./Tagging-3954a06b.js"))),
4204
+ component: Ee(U(() => import("./Tagging-f05dc43f.js"))),
4205
4205
  meta: {
4206
4206
  i18nKey: "settings.tagging.title",
4207
4207
  validationManifest: {
@@ -4238,7 +4238,7 @@ ie.push({
4238
4238
  name: ((xe = ie[0].children) == null ? void 0 : xe[0].name) || ie[0].name
4239
4239
  }
4240
4240
  });
4241
- const Jn = U(() => import("./App-3a747a35.js")), kn = {
4241
+ const Jn = U(() => import("./App-fc19c11d.js")), kn = {
4242
4242
  "en-US": {
4243
4243
  ...kt,
4244
4244
  ...J["en-US"],
package/dist/app.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "@feedmepos/mf-mdm";
2
2
  import "@feedmepos/mf-media";
3
3
  import "@feedmepos/mf-order-setting";
4
- import { F as d, d as f, r as g } from "./app-925bdc75.js";
4
+ import { F as d, d as f, r as g } from "./app-8c2bd26c.js";
5
5
  import "vue";
6
6
  import "@feedmepos/ui-library";
7
7
  import "vue-router";
@@ -0,0 +1,65 @@
1
+ /**
2
+ * media-service client — upload and delete only.
3
+ *
4
+ * Docs: https://github.com/feedmepos/media-service/blob/main/docs/integration.md
5
+ *
6
+ * Settings stores plain photographs: no aspect-ratio variants, no AI. Every call
7
+ * here passes `aspectRatios: []`, which media-service reads as "store the original
8
+ * and queue nothing" — the billing precheck runs only when that list is non-empty,
9
+ * so these uploads cost the business nothing. Anything ratio- or AI-related lives
10
+ * in mf-menu's richer client (`apps/mf-menu/src/api/media.ts`); do not grow this one
11
+ * into a copy of it.
12
+ */
13
+ /**
14
+ * The four key segments identify an image: `{businessId}/{refType}/{refId}/{imageId}`.
15
+ * `refType` is caller-owned — the service takes whatever string it is given — so the
16
+ * values used here (`restaurant`, `business`) are ours to define.
17
+ *
18
+ * Segments are capped at 64 characters and must match `[A-Za-z0-9_.:-]+`; a Mongo id
19
+ * and the timestamps built in `mediaStorage` both satisfy that.
20
+ */
21
+ export interface MediaImageRef {
22
+ refType: string;
23
+ refId: string;
24
+ imageId: string;
25
+ }
26
+ export interface UploadIntentRes {
27
+ prefix: string;
28
+ objectKey: string;
29
+ uploadUrl: string;
30
+ method: string;
31
+ expiresAt: string;
32
+ }
33
+ export interface ConfirmRes {
34
+ prefix: string;
35
+ original: {
36
+ url: string;
37
+ width: number;
38
+ height: number;
39
+ };
40
+ }
41
+ export declare function currentBusinessId(): string;
42
+ export declare const mediaApi: {
43
+ uploadIntent(businessId: string, ref: MediaImageRef, file: File, restaurantId?: string): Promise<UploadIntentRes>;
44
+ /**
45
+ * Sends the bytes straight to object storage, so they never pass through a service
46
+ * pod. Deliberately a bare axios call: the signed URL must not carry our
47
+ * Authorization header, and `Content-Type` has to match what `uploadIntent` was told
48
+ * because the signature is bound to it.
49
+ */
50
+ putBytes(uploadUrl: string, file: File): Promise<void>;
51
+ confirm(businessId: string, ref: MediaImageRef, meta: {
52
+ width: number;
53
+ height: number;
54
+ fileName: string;
55
+ restaurantId?: string;
56
+ }): Promise<ConfirmRes>;
57
+ /**
58
+ * Deletes the whole set for one image id, original included.
59
+ *
60
+ * `aspectRatios: null` is what means "everything"; `[]` is rejected as a likely
61
+ * caller bug. Deleting something that no longer exists comes back as `not_found`,
62
+ * which the service counts as success, so this is safe to call twice.
63
+ */
64
+ deleteImage(businessId: string, ref: MediaImageRef): Promise<void>;
65
+ };
@@ -41,8 +41,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<im
41
41
  required: true;
42
42
  };
43
43
  }>> & Readonly<{}>, {
44
- initialValue: RestaurantDialogData;
45
44
  restaurantId: string;
45
+ initialValue: RestaurantDialogData;
46
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
47
47
  trigger?(_: {
48
48
  trigger: (restaurantId?: string | undefined, initialValue?: RestaurantDialogData | undefined) => void;
@@ -0,0 +1,51 @@
1
+ import { type MediaImageRef } from "@/api/media";
2
+ /**
3
+ * Photo storage for business and restaurant profiles, backed by media-service.
4
+ *
5
+ * Replaces the previous direct-to-R2 client, which had to ship an R2 access key and
6
+ * secret inside the production bundle to sign its own requests. Here the browser only
7
+ * ever holds a short-lived signed upload URL handed out by the service.
8
+ */
9
+ /** media-service rejects anything else with `415 UNSUPPORTED_MEDIA_TYPE`. */
10
+ export declare const SUPPORTED_MIME_TYPES: string[];
11
+ /**
12
+ * For `ImageDropField`. Narrower than the field's default because gif — which the old
13
+ * direct-to-R2 path accepted, since it validated nothing — cannot be stored here.
14
+ */
15
+ export declare const SUPPORTED_FILE_ACCEPT = ".jpg, .jpeg, .png, .webp";
16
+ export declare function isManagedUrl(url: string | null | undefined): boolean;
17
+ interface Scope {
18
+ businessId?: string;
19
+ restaurantId?: string;
20
+ }
21
+ export declare const mediaStorage: {
22
+ /**
23
+ * Uploads bytes and returns the URL to persist.
24
+ *
25
+ * Three calls: reserve a signed URL, PUT to it, then confirm so the asset row exists.
26
+ * A failure after the PUT leaves an orphaned object and no asset row, which is why
27
+ * `confirm` is never skipped.
28
+ */
29
+ upload(ref: MediaImageRef, file: File, options?: Scope & {
30
+ bustCache?: boolean;
31
+ }): Promise<string>;
32
+ /**
33
+ * Removes an image the merchant cleared.
34
+ *
35
+ * `currentUrl` is what the profile currently holds. Anything written before the
36
+ * media-service migration lives at a URL this API cannot address, so those objects
37
+ * are left in place and only the profile field is cleared by the caller — the images
38
+ * stay readable at their old URL either way, and no merchant-visible surface reads a
39
+ * profile field we did not clear.
40
+ */
41
+ remove(ref: MediaImageRef, currentUrl: string | null | undefined, options?: Scope): Promise<void>;
42
+ };
43
+ /**
44
+ * Carousel photos have no natural id, so they get a minted one.
45
+ *
46
+ * No colons or dots, unlike the ISO string the old key used: they are legal in a key
47
+ * segment today, but nothing here needs them and a plain alphanumeric stamp cannot be
48
+ * mangled by a URL encoder on the way to storage.
49
+ */
50
+ export declare function mintPhotoImageId(index: number): string;
51
+ export {};