@progus/connector 0.5.4 → 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 +33 -0
- package/package.json +1 -1
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
|