@progus/connector 0.5.3 → 0.5.5

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/README.md CHANGED
@@ -37,6 +37,39 @@ await connector.trackSubscriptionUpdated({
37
37
  await connector.trackUninstall({ shopDomain: session.shop });
38
38
  ```
39
39
 
40
+ ## Prompt: Partner program implementation (copy/paste)
41
+
42
+ ```
43
+ You are integrating Progus Partner Program using @progus/connector in a Shopify app.
44
+
45
+ Implement these pieces:
46
+ 1) Server connector:
47
+ - createProgusConnector({ appKey, PARTNERS_API_URL, PARTNERS_SECRET_KEY, PARTNERS_API_KEY })
48
+ - expose getPartnersConnector() + isPartnersConnectorConfigured()
49
+
50
+ 2) Install tracking:
51
+ - after app install, call trackInstall({ shopDomain, partnerId })
52
+ - partnerId source: read cookie "progus_partner_id" on progus.com
53
+ - cookie must be JS-readable (HttpOnly=false) and cross-site (SameSite=None; Secure)
54
+ - if partnerId is missing, skip tracking
55
+
56
+ 3) Partner ID assignment UI:
57
+ - save partnerId from merchant input (Partner ID field)
58
+ - call assignPartnerId({ shopDomain, partnerId }) on save
59
+ - lock the field after successful save
60
+ - optionally check partnerId on load with checkPartnerId({ shopDomain })
61
+
62
+ 4) Subscription tracking:
63
+ - on app_subscriptions/update webhook, send trackSubscriptionUpdated
64
+ - payload must include: subscriptionId (digits), subscriptionPrice (number), subscriptionPeriod ("EVERY_30_DAYS" or "ANNUAL"), subscriptionStatus, subscriptionName
65
+ - if webhook payload is missing price/interval, fetch details via Admin GraphQL node(id) -> AppSubscription -> lineItems.plan.pricingDetails
66
+
67
+ 5) Uninstall tracking:
68
+ - on app/uninstalled webhook, call trackUninstall({ shopDomain })
69
+
70
+ Return errors gracefully; do not break webhooks if partner tracking fails.
71
+ ```
72
+
40
73
  ## Partner ID assignment
41
74
 
42
75
  ```ts
package/dist/index.cjs CHANGED
@@ -215,14 +215,12 @@ function createProgusConnector(config) {
215
215
  return null;
216
216
  }
217
217
  const subscriptionName = data.subscriptionName ? data.subscriptionName.toLowerCase() : void 0;
218
- const subscriptionStatus = data.subscriptionStatus ? data.subscriptionStatus.toLowerCase() : void 0;
219
218
  return {
220
219
  ...data,
221
220
  subscriptionId,
222
221
  subscriptionPrice,
223
222
  subscriptionPeriod: period,
224
- subscriptionName,
225
- subscriptionStatus
223
+ subscriptionName
226
224
  };
227
225
  }
228
226
  return {
package/dist/index.js CHANGED
@@ -187,14 +187,12 @@ function createProgusConnector(config) {
187
187
  return null;
188
188
  }
189
189
  const subscriptionName = data.subscriptionName ? data.subscriptionName.toLowerCase() : void 0;
190
- const subscriptionStatus = data.subscriptionStatus ? data.subscriptionStatus.toLowerCase() : void 0;
191
190
  return {
192
191
  ...data,
193
192
  subscriptionId,
194
193
  subscriptionPrice,
195
194
  subscriptionPeriod: period,
196
- subscriptionName,
197
- subscriptionStatus
195
+ subscriptionName
198
196
  };
199
197
  }
200
198
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progus/connector",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Progus partner/affiliate connector helpers",
5
5
  "license": "MIT",
6
6
  "type": "module",