hookwright 2.1.0 → 2.2.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.
Files changed (2) hide show
  1. package/dist/cli.js +14 -14
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -24,7 +24,7 @@ var init_package = __esm({
24
24
  "package.json"() {
25
25
  package_default = {
26
26
  name: "hookwright",
27
- version: "2.1.0",
27
+ version: "2.2.0",
28
28
  description: "Build real, signed e-commerce webhooks from a live Shopify catalogue \u2014 interactive terminal UI, no backend",
29
29
  keywords: [
30
30
  "webhook",
@@ -1875,7 +1875,7 @@ function editableFieldsFor3(eventName) {
1875
1875
  }
1876
1876
  var editableFields6 = editableFieldsFor3(DEFAULT_EVENT4);
1877
1877
  function statusBlock(reached, at, comment = null) {
1878
- return { status: reached, comment, created_at: reached ? at : null };
1878
+ return { status: reached, comment: comment ?? "quickreply test", created_at: at };
1879
1879
  }
1880
1880
  function buildPayload6(ctx) {
1881
1881
  const { config, items, phone } = ctx;
@@ -1898,14 +1898,14 @@ function buildPayload6(ctx) {
1898
1898
  id: Number(sel?.variant?.id ?? sel?.product?.id ?? 0),
1899
1899
  refund: {
1900
1900
  requested_mode: "store_credit",
1901
- actual_mode: def.status === "rejected" ? "store_credit" : null,
1902
- meta: def.status === "rejected" && ctx.couponCode ? { discount_code: ctx.couponCode } : null,
1903
- status: def.status === "rejected" ? "refunded" : "pending",
1901
+ actual_mode: "store_credit",
1902
+ meta: { discount_code: ctx.couponCode ?? `RP${String(now.getTime()).slice(-7)}` },
1903
+ status: def.status === "requested" ? "pending" : "refunded",
1904
1904
  refunded_amount: {
1905
- shop_money: { ...def.status === "rejected" ? { amount: originalPrice } : {}, currency_code: currency },
1906
- presentment_money: { ...def.status === "rejected" ? { amount: originalPrice } : {}, currency_code: currency }
1905
+ shop_money: { amount: originalPrice, currency_code: currency },
1906
+ presentment_money: { amount: originalPrice, currency_code: currency }
1907
1907
  },
1908
- refunded_at: def.status === "rejected" ? at : null,
1908
+ refunded_at: at,
1909
1909
  comment: null
1910
1910
  },
1911
1911
  return_fee: {
@@ -1917,8 +1917,8 @@ function buildPayload6(ctx) {
1917
1917
  },
1918
1918
  exchange_fee: {
1919
1919
  price_set: {
1920
- shop_money: { amount: null, currency_code: null },
1921
- presentment_money: { amount: null, currency_code: null }
1920
+ shop_money: { amount: ctx.exchangeFee ?? 0, currency_code: currency },
1921
+ presentment_money: { amount: ctx.exchangeFee ?? 0, currency_code: currency }
1922
1922
  }
1923
1923
  },
1924
1924
  exchange: { order: null },
@@ -1947,7 +1947,7 @@ function buildPayload6(ctx) {
1947
1947
  }
1948
1948
  } : {},
1949
1949
  shipping: [
1950
- def.status === "requested" ? { tracking_available: false, labels: [] } : {
1950
+ {
1951
1951
  shipping_company: "bluedartV2",
1952
1952
  tracking_available: true,
1953
1953
  awb: String(now.getTime()).slice(-11),
@@ -1980,13 +1980,13 @@ function buildPayload6(ctx) {
1980
1980
  do_not_carry_forward_discount: true
1981
1981
  },
1982
1982
  shopify_order_fulfillment_location: null,
1983
- return_location: def.status === "requested" ? null : {
1983
+ return_location: {
1984
1984
  id: "rp-location-1",
1985
1985
  fullName: config.shopify.shop?.name ?? config.shopify.domain,
1986
1986
  mobileNumber: nationalNumber(phone, cust.countryCode),
1987
1987
  pinCode: cust.zip,
1988
1988
  streetAddress1: cust.address1,
1989
- streetAddress2: cust.address2 ?? "",
1989
+ streetAddress2: cust.address2 || "Second line",
1990
1990
  landmark: "",
1991
1991
  city: cust.city,
1992
1992
  state: cust.province,
@@ -2039,7 +2039,7 @@ function buildPayload6(ctx) {
2039
2039
  country_code: cust.countryCode,
2040
2040
  province_code: cust.provinceCode,
2041
2041
  address_line_1: cust.address1,
2042
- address_line_2: cust.address2 ?? "",
2042
+ address_line_2: cust.address2 || "Second line",
2043
2043
  country: cust.country,
2044
2044
  address_line_3: ""
2045
2045
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hookwright",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Build real, signed e-commerce webhooks from a live Shopify catalogue — interactive terminal UI, no backend",
5
5
  "keywords": [
6
6
  "webhook",