@@ -8,29 +8,79 @@ sidebar_position: 2
88
99### Breaking Changes
1010
11- ### Capabilities deprecated
11+ The ` Salable ` class has been replaced with a new ` initSalable ` function. Using the new initialise function will enable
12+ vendors to use ` v2 ` or ` v3 ` of the API within the same version of the SDK.
13+
14+ ** v4.0.0 implementation**
15+ ``` typescript
16+ const salable = new Salable (' your-api-key' , ' v2' )
17+ ```
18+ ** v5.0.0 implementation**
19+ ``` typescript
20+ const salableV2 = initSalable (' your-api-key' , ' v2' ) // still supported
21+ const salableV3 = initSalable (' your-api-key' , ' v3' )
22+ ```
23+
24+ ### V3 Breaking changes
25+
26+ #### Capabilities deprecated
1227Capabilities used to be stored on the License at the point of creation with no way of editing them. We found this to be
1328too rigid, for flexibility we have deprecated capabilities in favour of using the plan's feature values which are
1429editable in the Salable app.
15- #### Deprecated capabilities deprecated
30+
31+ ##### Deprecated methods that use capabilities
1632- ` plans.capabilities `
17- - ` product .capabilities`
33+ - ` products .capabilities`
1834- ` licenses.check `
1935
20- ### Licenses deprecated
36+ #### Licenses deprecated
2137All license methods have been deprecated in favour of managing them through the subscription instead. This gives a
2238consistent implementation across all types of subscriptions.
2339- ` licenses.create ` moved to ` subscriptions.create ` - the ` owner ` value will be applied to the ` purchaser ` field of the license.
24- - ` license .check` moved to ` entitlements.check `
40+ - ` licenses .check` moved to ` entitlements.check `
2541- ` licenses.getAll ` moved to ` subscriptions.getSeats `
26- - ` licenses.getOne ` support removed
42+ - ` licenses.getOne ` support removed - fetch the parent subscription instead using ` subscriptions.getOne `
2743- ` licenses.getForPurchaser ` moved to ` subscriptions.getAll ` with the owner filter applied.
2844- ` licenses.update ` moved to ` subscriptions.update `
45+ - To update a seat's grantee use the ` subscriptions.manageSeats ` method.
2946- ` licenses.updateMany ` moved to ` subscriptions.manageSeats `
3047- ` licenses.getCount ` moved to ` subscriptions.getSeatCount `
3148- ` licenses.cancel ` moved to ` subscriptions.cancel ` - this will cancel all the subscription's child licenses.
3249- ` licenses.cancelMany ` moved to ` subscriptions.cancel ` - it is not possible to cancel many subscriptions in the same request.
3350
51+ #### Other deprecated endpoints
52+ - ` products.getFeatures ` moved to ` features.getAll ` with the ` productUuid ` filter applied.
53+ - ` products.getPlans ` moved to ` plans.getAll ` with the ` productUuid ` filter applied.
54+
55+ #### Affected responses
56+ - ` products.getAll ` now uses cursor-based pagination in the response.
57+
58+ ### What's new?
59+ #### New methods
60+ - ` features.getAll ` - Retrieves all features for an organisation. The response uses cursor-based pagination.
61+ - ` plans.getAll ` - Retrieves all plans for an organisation. The response uses cursor-based pagination.
62+ - ` entitlements.check ` - Check grantee access to specific features (replaces ` licenses.check ` ).
63+
64+ ** v4.0.0 SDK with API v2**
65+ ``` typescript
66+ const salable = new Salable (' your-api-key' , ' v2' );
67+ const check = await salable .licenses .check ({
68+ productUuid: ' your-product-uuid' ,
69+ granteeIds: [' your-grantee-id' ],
70+ });
71+ const hasAccess = check ?.capabilities .find ((c ) => c .capability === ' your-boolean-feature' );
72+ ```
73+
74+ ** v5.0.0 SDK with API v3**
75+ ``` typescript
76+ const salable = initSalable (' your-api-key' , ' v3' );
77+ const check = await salable .entitlements .check ({
78+ productUuid: ' your-product-uuid' ,
79+ granteeIds: [' your-grantee-id' ],
80+ });
81+ const hasAccess = check .features .find ((f ) => f .feature === ' your-boolean-feature' );
82+ ```
83+
3484## v4.0.0
3585
3686### Breaking Changes
0 commit comments