@mercurjs/dashboard-shared 2.2.0-canary.2 → 2.2.0-canary.20

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.
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ type FieldDiff = {
37
37
  field: string;
38
38
  previous: unknown;
39
39
  next: unknown;
40
+ variant_id?: string;
40
41
  };
41
42
  type ProductChangePartition = {
42
43
  updated: FieldDiff[];
@@ -44,7 +45,7 @@ type ProductChangePartition = {
44
45
  removed: ProductChangeActionDTO[];
45
46
  deleteRequested: boolean;
46
47
  };
47
- type ReferenceField = "brand_id" | "type_id" | "collection_id" | "categories" | "tags";
48
+ type ReferenceField = "type_id" | "collection_id" | "categories" | "tags";
48
49
  declare const REFERENCE_FIELDS: ReferenceField[];
49
50
  declare const isReferenceField: (field: string) => field is ReferenceField;
50
51
  declare const isImageList: (value: unknown) => value is {
package/dist/index.js CHANGED
@@ -9030,17 +9030,12 @@ var require_common38 = __commonJS({
9030
9030
  "../types/dist/commission/common.js"(exports) {
9031
9031
  "use strict";
9032
9032
  Object.defineProperty(exports, "__esModule", { value: true });
9033
- exports.CommissionRateTarget = exports.CommissionRateType = void 0;
9033
+ exports.CommissionRateType = void 0;
9034
9034
  var CommissionRateType;
9035
9035
  (function(CommissionRateType2) {
9036
9036
  CommissionRateType2["FIXED"] = "fixed";
9037
9037
  CommissionRateType2["PERCENTAGE"] = "percentage";
9038
9038
  })(CommissionRateType || (exports.CommissionRateType = CommissionRateType = {}));
9039
- var CommissionRateTarget;
9040
- (function(CommissionRateTarget2) {
9041
- CommissionRateTarget2["ITEM"] = "item";
9042
- CommissionRateTarget2["SHIPPING"] = "shipping";
9043
- })(CommissionRateTarget || (exports.CommissionRateTarget = CommissionRateTarget = {}));
9044
9039
  }
9045
9040
  });
9046
9041
 
@@ -9198,14 +9193,6 @@ var require_product_attribute = __commonJS({
9198
9193
  }
9199
9194
  });
9200
9195
 
9201
- // ../types/dist/http/product-brand.js
9202
- var require_product_brand = __commonJS({
9203
- "../types/dist/http/product-brand.js"(exports) {
9204
- "use strict";
9205
- Object.defineProperty(exports, "__esModule", { value: true });
9206
- }
9207
- });
9208
-
9209
9196
  // ../types/dist/http/product-category.js
9210
9197
  var require_product_category4 = __commonJS({
9211
9198
  "../types/dist/http/product-category.js"(exports) {
@@ -9318,14 +9305,6 @@ var require_commission2 = __commonJS({
9318
9305
  }
9319
9306
  });
9320
9307
 
9321
- // ../types/dist/http/subscription.js
9322
- var require_subscription = __commonJS({
9323
- "../types/dist/http/subscription.js"(exports) {
9324
- "use strict";
9325
- Object.defineProperty(exports, "__esModule", { value: true });
9326
- }
9327
- });
9328
-
9329
9308
  // ../types/dist/http/index.js
9330
9309
  var require_http3 = __commonJS({
9331
9310
  "../types/dist/http/index.js"(exports) {
@@ -9368,7 +9347,6 @@ var require_http3 = __commonJS({
9368
9347
  __exportStar(require_product4(), exports);
9369
9348
  __exportStar(require_promotion4(), exports);
9370
9349
  __exportStar(require_product_attribute(), exports);
9371
- __exportStar(require_product_brand(), exports);
9372
9350
  __exportStar(require_product_category4(), exports);
9373
9351
  __exportStar(require_product_tag2(), exports);
9374
9352
  __exportStar(require_product_type2(), exports);
@@ -9383,54 +9361,11 @@ var require_http3 = __commonJS({
9383
9361
  __exportStar(require_payout(), exports);
9384
9362
  __exportStar(require_offer(), exports);
9385
9363
  __exportStar(require_commission2(), exports);
9386
- __exportStar(require_subscription(), exports);
9387
- }
9388
- });
9389
-
9390
- // ../types/dist/subscription/common.js
9391
- var require_common39 = __commonJS({
9392
- "../types/dist/subscription/common.js"(exports) {
9393
- "use strict";
9394
- Object.defineProperty(exports, "__esModule", { value: true });
9395
- }
9396
- });
9397
-
9398
- // ../types/dist/subscription/mutation.js
9399
- var require_mutation3 = __commonJS({
9400
- "../types/dist/subscription/mutation.js"(exports) {
9401
- "use strict";
9402
- Object.defineProperty(exports, "__esModule", { value: true });
9403
- }
9404
- });
9405
-
9406
- // ../types/dist/subscription/index.js
9407
- var require_subscription2 = __commonJS({
9408
- "../types/dist/subscription/index.js"(exports) {
9409
- "use strict";
9410
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
9411
- if (k2 === void 0) k2 = k;
9412
- var desc = Object.getOwnPropertyDescriptor(m, k);
9413
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9414
- desc = { enumerable: true, get: function() {
9415
- return m[k];
9416
- } };
9417
- }
9418
- Object.defineProperty(o, k2, desc);
9419
- }) : (function(o, m, k, k2) {
9420
- if (k2 === void 0) k2 = k;
9421
- o[k2] = m[k];
9422
- }));
9423
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
9424
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
9425
- };
9426
- Object.defineProperty(exports, "__esModule", { value: true });
9427
- __exportStar(require_common39(), exports);
9428
- __exportStar(require_mutation3(), exports);
9429
9364
  }
9430
9365
  });
9431
9366
 
9432
9367
  // ../types/dist/payout/common.js
9433
- var require_common40 = __commonJS({
9368
+ var require_common39 = __commonJS({
9434
9369
  "../types/dist/payout/common.js"(exports) {
9435
9370
  "use strict";
9436
9371
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -9503,14 +9438,14 @@ var require_payout2 = __commonJS({
9503
9438
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
9504
9439
  };
9505
9440
  Object.defineProperty(exports, "__esModule", { value: true });
9506
- __exportStar(require_common40(), exports);
9441
+ __exportStar(require_common39(), exports);
9507
9442
  __exportStar(require_provider9(), exports);
9508
9443
  __exportStar(require_mutations24(), exports);
9509
9444
  }
9510
9445
  });
9511
9446
 
9512
9447
  // ../types/dist/offer/common.js
9513
- var require_common41 = __commonJS({
9448
+ var require_common40 = __commonJS({
9514
9449
  "../types/dist/offer/common.js"(exports) {
9515
9450
  "use strict";
9516
9451
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -9546,25 +9481,32 @@ var require_offer2 = __commonJS({
9546
9481
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
9547
9482
  };
9548
9483
  Object.defineProperty(exports, "__esModule", { value: true });
9549
- __exportStar(require_common41(), exports);
9484
+ __exportStar(require_common40(), exports);
9550
9485
  __exportStar(require_mutations25(), exports);
9551
9486
  }
9552
9487
  });
9553
9488
 
9489
+ // ../types/dist/product/status.js
9490
+ var require_status = __commonJS({
9491
+ "../types/dist/product/status.js"(exports) {
9492
+ "use strict";
9493
+ Object.defineProperty(exports, "__esModule", { value: true });
9494
+ exports.ProductStatus = void 0;
9495
+ exports.ProductStatus = {
9496
+ DRAFT: "draft",
9497
+ PROPOSED: "proposed",
9498
+ PUBLISHED: "published",
9499
+ REJECTED: "rejected"
9500
+ };
9501
+ }
9502
+ });
9503
+
9554
9504
  // ../types/dist/product/common.js
9555
- var require_common42 = __commonJS({
9505
+ var require_common41 = __commonJS({
9556
9506
  "../types/dist/product/common.js"(exports) {
9557
9507
  "use strict";
9558
9508
  Object.defineProperty(exports, "__esModule", { value: true });
9559
- exports.ProductChangeActionType = exports.ProductChangeStatus = exports.AttributeType = exports.ProductStatus = void 0;
9560
- var ProductStatus;
9561
- (function(ProductStatus2) {
9562
- ProductStatus2["DRAFT"] = "draft";
9563
- ProductStatus2["PROPOSED"] = "proposed";
9564
- ProductStatus2["PUBLISHED"] = "published";
9565
- ProductStatus2["REQUIRES_ACTION"] = "requires_action";
9566
- ProductStatus2["REJECTED"] = "rejected";
9567
- })(ProductStatus || (exports.ProductStatus = ProductStatus = {}));
9509
+ exports.ProductChangeActionType = exports.ProductChangeStatus = exports.AttributeType = void 0;
9568
9510
  var AttributeType;
9569
9511
  (function(AttributeType2) {
9570
9512
  AttributeType2["SINGLE_SELECT"] = "single_select";
@@ -9590,6 +9532,7 @@ var require_common42 = __commonJS({
9590
9532
  ProductChangeActionType3["ATTRIBUTE_ADD"] = "ATTRIBUTE_ADD";
9591
9533
  ProductChangeActionType3["ATTRIBUTE_REMOVE"] = "ATTRIBUTE_REMOVE";
9592
9534
  ProductChangeActionType3["PRODUCT_DELETE"] = "PRODUCT_DELETE";
9535
+ ProductChangeActionType3["CHANGE_REQUESTED"] = "CHANGE_REQUESTED";
9593
9536
  })(ProductChangeActionType2 || (exports.ProductChangeActionType = ProductChangeActionType2 = {}));
9594
9537
  }
9595
9538
  });
@@ -9623,7 +9566,7 @@ var require_product5 = __commonJS({
9623
9566
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
9624
9567
  };
9625
9568
  Object.defineProperty(exports, "__esModule", { value: true });
9626
- __exportStar(require_common42(), exports);
9569
+ __exportStar(require_common41(), exports);
9627
9570
  __exportStar(require_mutations26(), exports);
9628
9571
  }
9629
9572
  });
@@ -9637,10 +9580,12 @@ var require_modules = __commonJS({
9637
9580
  var MercurModules;
9638
9581
  (function(MercurModules2) {
9639
9582
  MercurModules2["SELLER"] = "seller";
9640
- MercurModules2["SUBSCRIPTION"] = "subscription";
9641
9583
  MercurModules2["COMMISSION"] = "commission";
9642
9584
  MercurModules2["PAYOUT"] = "payout";
9643
9585
  MercurModules2["OFFER"] = "offer";
9586
+ MercurModules2["MEDIA"] = "media";
9587
+ MercurModules2["PRODUCT_ATTRIBUTE"] = "product_attribute";
9588
+ MercurModules2["PRODUCT_EDIT"] = "product_edit";
9644
9589
  MercurModules2["CUSTOM_FIELDS"] = "custom_fields";
9645
9590
  MercurModules2["VENDOR_UI"] = "vendor_ui";
9646
9591
  MercurModules2["ADMIN_UI"] = "admin_ui";
@@ -9730,13 +9675,13 @@ var require_dist2 = __commonJS({
9730
9675
  __exportStar(require_order_group(), exports);
9731
9676
  __exportStar(require_commission(), exports);
9732
9677
  exports.HttpTypes = __importStar(require_http3());
9733
- __exportStar(require_subscription2(), exports);
9734
9678
  __exportStar(require_payout2(), exports);
9735
9679
  __exportStar(require_offer2(), exports);
9736
- var product_1 = require_product5();
9680
+ var status_1 = require_status();
9737
9681
  Object.defineProperty(exports, "ProductStatus", { enumerable: true, get: function() {
9738
- return product_1.ProductStatus;
9682
+ return status_1.ProductStatus;
9739
9683
  } });
9684
+ var product_1 = require_product5();
9740
9685
  Object.defineProperty(exports, "AttributeType", { enumerable: true, get: function() {
9741
9686
  return product_1.AttributeType;
9742
9687
  } });
@@ -9774,13 +9719,13 @@ var queryKeysFactory = (globalKey) => {
9774
9719
  // src/lib/product-change-diff.ts
9775
9720
  var import_types = __toESM(require_dist2(), 1);
9776
9721
  var REFERENCE_FIELDS = [
9777
- "brand_id",
9778
9722
  "type_id",
9779
9723
  "collection_id",
9780
9724
  "categories",
9781
9725
  "tags"
9782
9726
  ];
9783
9727
  var isReferenceField = (field) => REFERENCE_FIELDS.includes(field);
9728
+ var NON_EDITABLE_VARIANT_FIELDS = /* @__PURE__ */ new Set(["manage_inventory"]);
9784
9729
  var isImageList = (value) => Array.isArray(value) && value.length > 0 && value.every(
9785
9730
  (entry) => typeof entry === "object" && entry !== null && "url" in entry && typeof entry.url === "string"
9786
9731
  );
@@ -9813,7 +9758,7 @@ var formatFieldValue = (value, field) => {
9813
9758
  if (typeof value === "boolean") return value ? "True" : "False";
9814
9759
  if (typeof value === "string") return value;
9815
9760
  if (typeof value === "number") return String(value);
9816
- if (field === "attribute_values") {
9761
+ if (field === "attribute_values" || field === "options") {
9817
9762
  const pretty = formatAttributeValues(value);
9818
9763
  if (pretty) return pretty;
9819
9764
  }
@@ -9846,11 +9791,14 @@ var partitionProductChangeActions = (actions) => {
9846
9791
  case import_types.ProductChangeActionType.VARIANT_UPDATE: {
9847
9792
  const fields = details.fields ?? {};
9848
9793
  const previousFields = details.previous_fields ?? {};
9794
+ const variantId = details.variant_id !== void 0 && details.variant_id !== null ? String(details.variant_id) : void 0;
9849
9795
  for (const [field, value] of Object.entries(fields)) {
9796
+ if (NON_EDITABLE_VARIANT_FIELDS.has(field)) continue;
9850
9797
  updated.push({
9851
9798
  field,
9852
9799
  previous: previousFields[field],
9853
- next: value
9800
+ next: value,
9801
+ variant_id: variantId
9854
9802
  });
9855
9803
  }
9856
9804
  break;
@@ -9866,6 +9814,8 @@ var partitionProductChangeActions = (actions) => {
9866
9814
  case import_types.ProductChangeActionType.PRODUCT_DELETE:
9867
9815
  deleteRequested = true;
9868
9816
  break;
9817
+ case import_types.ProductChangeActionType.CHANGE_REQUESTED:
9818
+ break;
9869
9819
  }
9870
9820
  }
9871
9821
  return { updated, added, removed, deleteRequested };
@@ -12565,6 +12515,7 @@ var FileUpload = ({
12565
12515
  "input",
12566
12516
  {
12567
12517
  hidden: true,
12518
+ "aria-label": "File upload",
12568
12519
  ref: inputRef,
12569
12520
  onChange: handleFileChange,
12570
12521
  type: "file",
@@ -18916,6 +18867,7 @@ var DataGridRowSkeleton = ({
18916
18867
  "div",
18917
18868
  {
18918
18869
  role: "gridcell",
18870
+ "aria-label": "Cell input",
18919
18871
  style: { width: vc.size },
18920
18872
  className: "relative flex items-center border-b border-r p-0 outline-none",
18921
18873
  children: /* @__PURE__ */ jsx42("div", { className: "flex h-full w-full items-center px-4", children: /* @__PURE__ */ jsx42("div", { className: "bg-ui-bg-component h-4 w-3/4 animate-pulse rounded" }) })
@@ -20696,14 +20648,17 @@ var KeyboundForm = React7.forwardRef(({ onSubmit, onKeyDown, ...rest }, ref) =>
20696
20648
  }
20697
20649
  }
20698
20650
  };
20699
- return /* @__PURE__ */ jsx62(
20700
- "form",
20701
- {
20702
- ...rest,
20703
- onSubmit: handleSubmit,
20704
- onKeyDown: onKeyDown ?? handleKeyDown,
20705
- ref
20706
- }
20651
+ return (
20652
+ // oxlint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
20653
+ /* @__PURE__ */ jsx62(
20654
+ "form",
20655
+ {
20656
+ ...rest,
20657
+ onSubmit: handleSubmit,
20658
+ onKeyDown: onKeyDown ?? handleKeyDown,
20659
+ ref
20660
+ }
20661
+ )
20707
20662
  );
20708
20663
  });
20709
20664
  KeyboundForm.displayName = "KeyboundForm";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/dashboard-shared",
3
- "version": "2.2.0-canary.2",
3
+ "version": "2.2.0-canary.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",
@@ -63,7 +63,7 @@
63
63
  "zod": "3.25.76"
64
64
  },
65
65
  "devDependencies": {
66
- "@mercurjs/types": "2.2.0-canary.2",
66
+ "@mercurjs/types": "workspace:*",
67
67
  "@mercurjs/core": "2.2.0-canary.2",
68
68
  "@mercurjs/dashboard-sdk": "2.2.0-canary.2",
69
69
  "tsup": "^8.0.2",