File tree Expand file tree Collapse file tree
openfeature-browser-provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @bucketco/browser-sdk" ,
3- "version" : " 3.3.0 " ,
3+ "version" : " 3.3.1 " ,
44 "packageManager" : " yarn@4.1.1" ,
55 "license" : " MIT" ,
66 "repository" : {
Original file line number Diff line number Diff line change @@ -372,6 +372,10 @@ export class FeaturesClient {
372372 * @param cb - Callback to call after the event is sent. Might be skipped if the event was rate limited.
373373 */
374374 async sendCheckEvent ( checkEvent : CheckEvent , cb : ( ) => void ) {
375+ if ( this . config . offline ) {
376+ return ;
377+ }
378+
375379 const rateLimitKey = `check-event:${ this . fetchParams ( ) . toString ( ) } :${ checkEvent . key } :${ checkEvent . version } :${ checkEvent . value } ` ;
376380 await this . rateLimiter . rateLimited ( rateLimitKey , async ( ) => {
377381 const payload = {
Original file line number Diff line number Diff line change @@ -444,6 +444,23 @@ describe(`sends "check" events `, () => {
444444 } ) ;
445445 } ) ;
446446
447+ it ( `does not send check events when offline` , async ( ) => {
448+ const postSpy = vi . spyOn ( HttpClient . prototype , "post" ) ;
449+
450+ const client = new BucketClient ( {
451+ publishableKey : KEY ,
452+ user : { id : "uid" } ,
453+ company : { id : "cid" } ,
454+ offline : true ,
455+ } ) ;
456+ await client . initialize ( ) ;
457+
458+ const featureA = client . getFeature ( "featureA" ) ;
459+ expect ( featureA . isEnabled ) . toBe ( false ) ;
460+
461+ expect ( postSpy ) . not . toHaveBeenCalled ( ) ;
462+ } ) ;
463+
447464 it ( `sends check event when accessing "isEnabled"` , async ( ) => {
448465 const sendCheckEventSpy = vi . spyOn (
449466 FeaturesClient . prototype ,
Original file line number Diff line number Diff line change 11{
22 "name" : " @bucketco/openfeature-browser-provider" ,
3- "version" : " 0.6.0 " ,
3+ "version" : " 0.6.1 " ,
44 "packageManager" : " yarn@4.1.1" ,
55 "license" : " MIT" ,
66 "repository" : {
3535 }
3636 },
3737 "dependencies" : {
38- "@bucketco/browser-sdk" : " 3.3.0 "
38+ "@bucketco/browser-sdk" : " 3.3.1 "
3939 },
4040 "devDependencies" : {
4141 "@bucketco/eslint-config" : " 0.0.2" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " @bucketco/react-sdk" ,
3- "version" : " 3.3.0 " ,
3+ "version" : " 3.3.1 " ,
44 "license" : " MIT" ,
55 "repository" : {
66 "type" : " git" ,
3434 }
3535 },
3636 "dependencies" : {
37- "@bucketco/browser-sdk" : " 3.3.0 " ,
37+ "@bucketco/browser-sdk" : " 3.3.1 " ,
3838 "canonical-json" : " ^0.0.4" ,
3939 "rollup" : " ^4.2.0"
4040 },
Original file line number Diff line number Diff line change @@ -683,7 +683,7 @@ __metadata:
683683 languageName: node
684684 linkType: hard
685685
686- "@bucketco/browser-sdk@npm:3.3.0 , @bucketco/browser-sdk@workspace:packages/browser-sdk":
686+ "@bucketco/browser-sdk@npm:3.3.1 , @bucketco/browser-sdk@workspace:packages/browser-sdk":
687687 version: 0.0.0-use.local
688688 resolution: "@bucketco/browser-sdk@workspace:packages/browser-sdk"
689689 dependencies:
@@ -828,7 +828,7 @@ __metadata:
828828 version: 0.0.0-use.local
829829 resolution: "@bucketco/openfeature-browser-provider@workspace:packages/openfeature-browser-provider"
830830 dependencies:
831- "@bucketco/browser-sdk": "npm:3.3.0 "
831+ "@bucketco/browser-sdk": "npm:3.3.1 "
832832 "@bucketco/eslint-config": "npm:0.0.2"
833833 "@bucketco/tsconfig": "npm:0.0.2"
834834 "@openfeature/core": "npm:1.5.0"
@@ -874,7 +874,7 @@ __metadata:
874874 version: 0.0.0-use.local
875875 resolution: "@bucketco/react-sdk@workspace:packages/react-sdk"
876876 dependencies:
877- "@bucketco/browser-sdk": "npm:3.3.0 "
877+ "@bucketco/browser-sdk": "npm:3.3.1 "
878878 "@bucketco/eslint-config": "workspace:^"
879879 "@bucketco/tsconfig": "workspace:^"
880880 "@testing-library/react": "npm:^15.0.7"
You can’t perform that action at this time.
0 commit comments