@shoppexio/storefront 0.3.0 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - Add `program_enabled` to affiliate validation responses.
6
+ - Clarify disabled affiliate program handling for headless storefronts.
7
+
3
8
  ## 0.3.0
4
9
 
5
10
  - Publish the active Storefront SDK runtime under `@shoppexio/storefront`.
package/README.md CHANGED
@@ -42,7 +42,29 @@ const result = await shoppex.validateCoupon('SAVE10', {
42
42
  });
43
43
  ```
44
44
 
45
- Calling `validateCoupon(code)` without options validates against the current SDK cart. Affiliate/referral codes are separate and should use `validateAffiliateCode` or `applyAffiliateCode`.
45
+ Calling `validateCoupon(code)` without options validates against the current SDK cart. Affiliate/referral codes are separate and should use `validateAffiliateCode` or `applyAffiliateCode`. If `program_enabled` is false in an affiliate validation response, the shop-level affiliate program is disabled even if individual links exist.
46
+
47
+ ## Live online users
48
+
49
+ The SDK can power a custom live online visitor counter. It provides the data; your storefront renders the badge.
50
+
51
+ ```ts
52
+ import shoppex from '@shoppexio/storefront';
53
+
54
+ shoppex.init('my-store');
55
+
56
+ async function refreshLiveUsers() {
57
+ await shoppex.touchStorefrontPresence();
58
+
59
+ const result = await shoppex.getStorefrontOnlineUsers();
60
+ if (result.success && result.data) {
61
+ console.log(`${result.data.count} online`);
62
+ }
63
+ }
64
+
65
+ await refreshLiveUsers();
66
+ setInterval(refreshLiveUsers, 30_000);
67
+ ```
46
68
 
47
69
  ## Not this package
48
70