@shoppexio/storefront-react 0.2.0 → 0.3.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 (35) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/dist/account.js +1170 -196
  3. package/dist/account.js.map +1 -1
  4. package/dist/{chunk-ZEFZPUAW.js → chunk-NBOIS53R.js} +2 -1
  5. package/dist/chunk-NBOIS53R.js.map +1 -0
  6. package/dist/index.d.ts +151 -21
  7. package/dist/index.js +206 -61
  8. package/dist/index.js.map +1 -1
  9. package/eject/account/account-availability.ts +4 -1
  10. package/eject/account/account-page.tsx +26 -6
  11. package/eject/account/account-referrals.ts +179 -6
  12. package/eject/account/dashboard.tsx +1 -0
  13. package/eject/account/messages/ar.json +40 -3
  14. package/eject/account/messages/de.json +40 -3
  15. package/eject/account/messages/en.json +40 -3
  16. package/eject/account/messages/es.json +40 -3
  17. package/eject/account/messages/fi.json +40 -3
  18. package/eject/account/messages/fr.json +40 -3
  19. package/eject/account/messages/hi.json +40 -3
  20. package/eject/account/messages/it.json +40 -3
  21. package/eject/account/messages/lt.json +40 -3
  22. package/eject/account/messages/nl.json +40 -3
  23. package/eject/account/messages/pl.json +40 -3
  24. package/eject/account/messages/pt.json +40 -3
  25. package/eject/account/messages/ru.json +40 -3
  26. package/eject/account/messages/tr.json +40 -3
  27. package/eject/account/messages/uk.json +40 -3
  28. package/eject/account/messages/zh.json +40 -3
  29. package/eject/account/orders.tsx +53 -0
  30. package/eject/account/referrals.tsx +399 -153
  31. package/eject/account/rewards.tsx +38 -6
  32. package/eject/account/settings.tsx +98 -2
  33. package/eject/account/shared.tsx +3 -2
  34. package/package.json +4 -1
  35. package/dist/chunk-ZEFZPUAW.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,111 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ Added, in the customer account (`@shoppexio/storefront-react/account`). Each
6
+ needs the storefront SDK build that carries the matching customer method;
7
+ against an older SDK the control answers with the account's generic error.
8
+
9
+ - Referrals: a buyer makes a referral link with a code of their own, when the
10
+ shop allows it (`can_create_custom_links`; a shop that does not shows its
11
+ own reason instead). A buyer the shop has not enrolled yet (auto-join off)
12
+ gets the control too, without the balance and history. A link that asks for
13
+ its own rates is reported as waiting for approval. Payouts, conversions and
14
+ sharebacks stay out.
15
+ - Orders: "Download invoice (PDF)" on an order.
16
+ - Settings: three order-mail switches (order confirmations, order receipts,
17
+ payment issues), next to the marketing lists.
18
+ - `ShoppexSdk` declares `createAffiliateLink`, `invoicePdf`,
19
+ `notificationPreferences`
20
+ and `updateNotificationPreferences`; `SdkCustomerAffiliateSummary` carries
21
+ `can_create_custom_links` and `custom_link_request_disabled_reason`.
22
+
23
+ A project that already ejected the account keeps its own copy. Take
24
+ `referrals.tsx`, `orders.tsx`, `settings.tsx` and `account-referrals.ts` from `eject/account` again to get these.
25
+
26
+ Added, in the cart:
27
+
28
+ - `useCart().requote()`: asks the server to price the cart again, for a Retry
29
+ under a failed quote. It is the cart's own refresh, so it writes only the
30
+ quote and `quoteError`, never clears a failed write's `mutationError`, and
31
+ settles once the answer is in.
32
+
33
+ Added, in the payload:
34
+
35
+ - `ProductCustomField.options`: the labels of a `type: 'select'` field, in
36
+ the merchant's order. Draw a select as a dropdown of exactly these labels.
37
+ - `StorefrontProduct.addonsRequired` and `addonChoiceMissing(product, chosen)`:
38
+ the buyer must pick one of the product's add-ons, the rule the server
39
+ refuses a line by (`errors.checkout.addon_required`). It asks nothing when
40
+ the product offers no add-on; a required (locked) add-on counts as the pick.
41
+ A template's buy box reads it to ask before the add; a card or tile that adds
42
+ without a choice sends the buyer to the product page.
43
+ - `StorefrontProduct.upsellProductIds`: the merchant's upsell picks as product
44
+ uniqids (`StorefrontProduct.id`), in the merchant's order; empty when they
45
+ picked none. The Easy lane lists them on the product page instead of the
46
+ automatic related products.
47
+
48
+ A template that builds `StorefrontProduct` objects itself adds
49
+ `addonsRequired` and `upsellProductIds`.
50
+
51
+ - `ProductAddon.description`: the merchant's line under an add-on's title,
52
+ `null` when they wrote none (the wire sends `''`). The Easy lane prints it
53
+ under the title; a template that builds `ProductAddon` objects itself adds
54
+ the field.
55
+ - `StorefrontProduct.images`: the gallery with each image's `kind`
56
+ (`'art' | 'logo' | null`) and `inkColor` (`#rrggbb` or `null`), next to
57
+ `imageUrls`. Both are the backend's pixel analysis; null means "not analysed",
58
+ and an unknown value is read as null, never guessed. A template draws a logo
59
+ on a contrasting plate from them.
60
+ - `StorefrontShop.description`: the shop's one-line description, or `null`
61
+ when the merchant set none. The Easy lane's footer shows it under the
62
+ brand; a code template shows it where its own footer copy is blank, so both
63
+ lanes say the same thing.
64
+ - `StorefrontProduct.deliveryType` (`ProductDeliveryType`): what the buyer
65
+ receives, `'key' | 'download' | 'service' | 'shipped'`, as the backend reads
66
+ it off the product's delivery mechanism. `null` where the mechanism does not
67
+ say (an item the merchant's webhook makes, an information card) and for a
68
+ value this version does not know. The Loadout Easy-lane card shows it as its
69
+ type cell, in `unitLabelSingular` when the merchant set one.
70
+
71
+ Changed:
72
+
73
+ - `validateCheckoutFieldValue` refuses a select answer that is not one of its
74
+ `options` with "<name> must be one of the listed options." (the server
75
+ refuses it with `custom_field_option_invalid`).
76
+ - A product's `customFields` leave out the fields the merchant collects after
77
+ payment (`collect_after_payment`): the buyer answers those on the invoice,
78
+ and the server drops a value the cart sends for them.
79
+ - `useCart().add` refuses a product with `addonsRequired` when the line names
80
+ none of its add-ons ("Choose an add-on for <product> to continue."), and a
81
+ bundle add refuses such a member, instead of writing a line the quote
82
+ refuses.
83
+ - Rewards: when a points conversion's result is unknown (the API answered
84
+ `RESPONSE_CONTRACT_VIOLATION`), the account shows "Loading your rewards"
85
+ and keeps the conversion form locked until a fresh read of the balance
86
+ answers, so a buyer cannot convert the same points twice.
87
+ - Line prices match the invoice to the cent. `calculateDisplayLineTotal`,
88
+ `calculateLinePricing` and the cart view now use the backend's decimal line
89
+ math: a mill unit price is multiplied before rounding ($0.012 × 3 is $0.04,
90
+ not $0.03), an exact half cent rounds up, totals above ~$90 billion keep
91
+ their last cent, and add-on prices are added as decimals instead of a float
92
+ sum. `calculateDisplayLineTotal` takes the selected add-on prices as an
93
+ optional fifth argument. Volume-discount rules are read like the invoice
94
+ reads them (`"3units"` is no tier, `value: true` is 1).
95
+ - `formatMoney` keeps the currency's decimals on a whole amount too: `$64.00`,
96
+ not `$64`, as the Easy lane prints every price. Card prices, the "from"
97
+ price, buy box totals and the cart all follow. A template test that pinned
98
+ `$49` reads `$49.00` after the bump.
99
+
100
+ ## 0.2.1
101
+
102
+ - Favorites follow the account session without a reload. Signing in on the
103
+ account page reloads the favorites store, so the hearts on cards and the
104
+ product page work at once instead of sending the buyer back to Account.
105
+ Signing out reloads it too, which clears the previous buyer's saved set
106
+ instead of leaving it on the page for whoever uses the browser next.
107
+ (`announceCustomerSessionChange()`, `signOutEndedSession()`.)
108
+
3
109
  ## 0.2.0
4
110
 
5
111
  Breaking: