@fire-spark/core 0.39.0 → 0.40.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
@@ -1367,7 +1367,7 @@ interface CartPlacement {
1367
1367
  declare const placeCartLines: (root: OrderLine, lines: OrderLine[], lookup: MenuLookup$1, locale: string) => CartPlacement;
1368
1368
  //#endregion
1369
1369
  //#region src/order/fees.d.ts
1370
- /** Root FEE line whose `metadata.fee_based_on` is a delivery/shipping basis. */
1370
+ /** Root FEE line that is a delivery/shipping fee. */
1371
1371
  declare const isShippingFeeLine: (line: OrderLine) => boolean;
1372
1372
  /** First root shipping/delivery FEE line in `lines`, if any. */
1373
1373
  declare const findShippingFeeLine: (lines: readonly OrderLine[]) => OrderLine | undefined;
package/dist/index.js CHANGED
@@ -7396,7 +7396,7 @@ const pickMultiLanguageText = (value, locale, fallback = "") => {
7396
7396
  };
7397
7397
  //#endregion
7398
7398
  //#region src/order/fees.ts
7399
- /** Root FEE line whose `metadata.fee_based_on` is a delivery/shipping basis. */
7399
+ /** Root FEE line that is a delivery/shipping fee. */
7400
7400
  const isShippingFeeLine = (line) => {
7401
7401
  return line.parent_uid == null && isDeliveryFee(line);
7402
7402
  };
@@ -7631,7 +7631,11 @@ const sumMoney = (parts) => {
7631
7631
  };
7632
7632
  const toFeeLine = (fee, money, locale, redeem = []) => {
7633
7633
  const name = feeName(fee.name, locale);
7634
- const metadata = { fee_based_on: requiredEffects(fee)[0]?.based_on ?? null };
7634
+ const required = requiredEffects(fee);
7635
+ const fee_based_on = required[0]?.based_on ?? null;
7636
+ const isShipping = required.some((effect) => effect.shipping === true);
7637
+ const metadata = { fee_based_on };
7638
+ if (isShipping) metadata.fee_shipping = true;
7635
7639
  const u = money.unit_subtotal;
7636
7640
  const d = 0;
7637
7641
  const tax = money.unit_tax_total;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fire-spark/core",
3
- "version": "0.39.0",
3
+ "version": "0.40.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.39.0",
24
- "@fire-spark/types": "^0.39.0"
23
+ "@fire-spark/payments": "^0.40.0",
24
+ "@fire-spark/types": "^0.40.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsdown": "^0.22.14",