@fire-spark/core 0.51.0 → 0.52.0

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
@@ -389,6 +389,15 @@ declare const getOrderFulfillment: (id: string, options?: ServiceHttpOptions) =>
389
389
  * order fulfillment along an adjacent non-terminal edge (cloud and Local).
390
390
  */
391
391
  declare const advanceOrderFulfillment: (id: string, body: OrderAdvanceFulfillmentInput, options?: ServiceHttpOptions) => Promise<Order$1>;
392
+ /**
393
+ * `POST /storefront/v1/orders/:id/arrival`: the customer who owns the order
394
+ * says they arrived. Moves a WAITING `AWAITING_PICKUP_TIME` run to the next
395
+ * step of its workflow; the customer never picks the status. Rejects with
396
+ * `StorefrontHttpError` 409 (`details.code: "ORDER_NOT_AWAITING_ARRIVAL"`)
397
+ * when the run is elsewhere, or 422 (`ARRIVAL_EDGE_MISSING`) when the
398
+ * workflow has no step after it.
399
+ */
400
+ declare const notifyOrderArrival: (id: string, options?: ServiceHttpOptions) => Promise<Order$1>;
392
401
  declare const listOrderFulfillments: (ids: string[], options?: ServiceHttpOptions) => Promise<OrderFulfillment[]>;
393
402
  declare const updateOrder: (id: string, body: OrderUpdateInput, options?: ServiceHttpOptions) => Promise<Order$1>;
394
403
  /**
@@ -1005,6 +1014,17 @@ declare class Order {
1005
1014
  order_authorization_id?: string;
1006
1015
  injection_order_id?: string;
1007
1016
  }): Promise<Order$1>;
1017
+ /**
1018
+ * Tells the store the customer arrived to pick up this order
1019
+ * (`POST /api/storefront/v1/orders/:id/arrival`). Works with the
1020
+ * customer's session, unlike `advanceFulfillment`, and only moves a run
1021
+ * waiting at `AWAITING_PICKUP_TIME` to the next step of its workflow.
1022
+ * Rejects with `StorefrontHttpError` and `details.code`
1023
+ * `ORDER_NOT_AWAITING_ARRIVAL` (409) or `ARRIVAL_EDGE_MISSING` (422).
1024
+ * The returned snapshot is pre-resume: the new status arrives with
1025
+ * `order.changed`.
1026
+ */
1027
+ notifyArrival(): Promise<Order$1>;
1008
1028
  /**
1009
1029
  * Applies lines/redeem, recomputes totals (redeems never change them),
1010
1030
  * trims every redeem to its `before_taxes` cap and rebuilds the steps.
@@ -1916,6 +1936,7 @@ declare const services: {
1916
1936
  getFulfillment: typeof getOrderFulfillment;
1917
1937
  listFulfillments: typeof listOrderFulfillments;
1918
1938
  advanceFulfillment: typeof advanceOrderFulfillment;
1939
+ notifyArrival: typeof notifyOrderArrival;
1919
1940
  };
1920
1941
  payments: {
1921
1942
  list: typeof listPayments;
package/dist/index.js CHANGED
@@ -3496,6 +3496,17 @@ const getOrderFulfillment = (id, options) => {
3496
3496
  const advanceOrderFulfillment = (id, body, options) => {
3497
3497
  return postJson$1(`${orderPath(id)}/fulfillment/status`, body, options);
3498
3498
  };
3499
+ /**
3500
+ * `POST /storefront/v1/orders/:id/arrival`: the customer who owns the order
3501
+ * says they arrived. Moves a WAITING `AWAITING_PICKUP_TIME` run to the next
3502
+ * step of its workflow; the customer never picks the status. Rejects with
3503
+ * `StorefrontHttpError` 409 (`details.code: "ORDER_NOT_AWAITING_ARRIVAL"`)
3504
+ * when the run is elsewhere, or 422 (`ARRIVAL_EDGE_MISSING`) when the
3505
+ * workflow has no step after it.
3506
+ */
3507
+ const notifyOrderArrival = (id, options) => {
3508
+ return storefrontJson(`${orderPath(id)}/arrival`, { method: "POST" }, options);
3509
+ };
3499
3510
  const LIST_FULFILLMENT_LIMIT = 20;
3500
3511
  const listOrderFulfillments = async (ids, options) => {
3501
3512
  if (ids.length === 0) return [];
@@ -5687,7 +5698,8 @@ const services = {
5687
5698
  refundTender,
5688
5699
  getFulfillment: getOrderFulfillment,
5689
5700
  listFulfillments: listOrderFulfillments,
5690
- advanceFulfillment: advanceOrderFulfillment
5701
+ advanceFulfillment: advanceOrderFulfillment,
5702
+ notifyArrival: notifyOrderArrival
5691
5703
  },
5692
5704
  payments: {
5693
5705
  list: listPayments,
@@ -11447,6 +11459,24 @@ var Order = class Order {
11447
11459
  return this.getOrder();
11448
11460
  }
11449
11461
  /**
11462
+ * Tells the store the customer arrived to pick up this order
11463
+ * (`POST /api/storefront/v1/orders/:id/arrival`). Works with the
11464
+ * customer's session, unlike `advanceFulfillment`, and only moves a run
11465
+ * waiting at `AWAITING_PICKUP_TIME` to the next step of its workflow.
11466
+ * Rejects with `StorefrontHttpError` and `details.code`
11467
+ * `ORDER_NOT_AWAITING_ARRIVAL` (409) or `ARRIVAL_EDGE_MISSING` (422).
11468
+ * The returned snapshot is pre-resume: the new status arrives with
11469
+ * `order.changed`.
11470
+ */
11471
+ async notifyArrival() {
11472
+ if (!this.persisted) throw new Error("Only a placed order can notify arrival");
11473
+ this.flush.cancel();
11474
+ const p = [this.draft.id, this.activeHttp()];
11475
+ const next = await services.orders.notifyArrival(...p);
11476
+ this.applyServerOrder(next);
11477
+ return this.getOrder();
11478
+ }
11479
+ /**
11450
11480
  * Applies lines/redeem, recomputes totals (redeems never change them),
11451
11481
  * trims every redeem to its `before_taxes` cap and rebuilds the steps.
11452
11482
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fire-spark/core",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "Fire Spark headless SDK",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -20,8 +20,8 @@
20
20
  "big.js": "6.2.1",
21
21
  "dayjs": "1.11.9",
22
22
  "@types/big.js": "6.2.2",
23
- "@fire-spark/payments": "^0.51.0",
24
- "@fire-spark/types": "^0.51.0"
23
+ "@fire-spark/payments": "^0.52.0",
24
+ "@fire-spark/types": "^0.52.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsdown": "^0.22.14",