Skip to content

Commit 10b67bc

Browse files
authored
Revert adding Reflag integration and update Bucket integration (#981)
* Revert new reflag integration and instead update bucket one * Add changeset * Update bun.lock * Udate schema prop
1 parent 9886804 commit 10b67bc

File tree

20 files changed

+40
-502
lines changed

20 files changed

+40
-502
lines changed

.changeset/happy-cases-guess.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/khaki-sheep-knock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/integration-bucket': minor
3+
---
4+
5+
Update Bucket integration for Bucket->Reflag rebrand

bun.lock

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -467,19 +467,6 @@
467467
"@gitbook/tsconfig": "workspace:*",
468468
},
469469
},
470-
"integrations/reflag": {
471-
"name": "@gitbook/integration-reflag",
472-
"version": "0.3.3",
473-
"dependencies": {
474-
"@gitbook/runtime": "*",
475-
"itty-router": "^5.0.18",
476-
},
477-
"devDependencies": {
478-
"@cloudflare/workers-types": "*",
479-
"@gitbook/cli": "workspace:*",
480-
"@gitbook/tsconfig": "workspace:*",
481-
},
482-
},
483470
"integrations/reo": {
484471
"name": "@gitbook/integration-reo.dev",
485472
"version": "0.5.0",
@@ -1072,8 +1059,6 @@
10721059

10731060
"@gitbook/integration-posthog": ["@gitbook/integration-posthog@workspace:integrations/posthog"],
10741061

1075-
"@gitbook/integration-reflag": ["@gitbook/integration-reflag@workspace:integrations/reflag"],
1076-
10771062
"@gitbook/integration-reo.dev": ["@gitbook/integration-reo.dev@workspace:integrations/reo"],
10781063

10791064
"@gitbook/integration-runkit": ["@gitbook/integration-runkit@workspace:integrations/runkit"],
5.93 KB
Loading
225 KB
Loading

integrations/bucket/gitbook-manifest.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: bucket
2-
title: Bucket
2+
title: Reflag
33
script: src/index.ts
4-
description: Sync your GitBook site’s schema with Bucket to deliver adaptive experiences to users.
4+
description: Sync your GitBook site’s schema with Reflag to deliver adaptive experiences to users.
55
summary: |
66
# Overview
77
8-
This integration allows you to sync your GitBook site’s schema with feature flags from Bucket in order to bring user data into content allowing you to create adaptive content experiences.
8+
This integration allows you to sync your GitBook site’s schema with feature flags from Reflag in order to bring user data into content allowing you to create adaptive content experiences.
99
1010
# How it works
1111
12-
The integration automatically synchronizes your GitBook site schema with the feature flags defined in Bucket. Any changes made in Bucket will be reflected in your site's schema.
12+
The integration automatically synchronizes your GitBook site schema with the feature flags defined in Reflag. Any changes made in Reflag will be reflected in your site's schema.
1313
1414
# Configure
1515
16-
To configure the integration, you need to connect your GitBook site to your Bucket account by providing your Bucket secret key. Once connected, you can manage your feature flags in Bucket, and they will be automatically reflected in your GitBook site schema.
16+
To configure the integration, you need to connect your GitBook site to your Reflag account by providing your Reflag secret key. Once connected, you can manage your feature flags in Reflag, and they will be automatically reflected in your GitBook site schema.
1717
icon: ./assets/icon.png
1818
previewImages:
1919
- ./assets/preview.png

integrations/bucket/src/components.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { createComponent, ExposableError } from '@gitbook/runtime';
22
import {
3-
BucketAction,
4-
BucketProps,
5-
BucketRuntimeContext,
6-
BucketSiteInstallationConfiguration,
7-
BucketState,
3+
ReflagAction,
4+
ReflagProps,
5+
ReflagRuntimeContext,
6+
ReflagSiteInstallationConfiguration,
7+
ReflagState,
88
} from './types';
99
import { assertInstallation, assertSiteInstallation } from './utils';
1010
import { GitBookAPI } from '@gitbook/api';
1111

1212
export const configBlock = createComponent<
13-
BucketProps,
14-
BucketState,
15-
BucketAction,
16-
BucketRuntimeContext
13+
ReflagProps,
14+
ReflagState,
15+
ReflagAction,
16+
ReflagRuntimeContext
1717
>({
1818
componentId: 'config',
1919
initialState: (props) => {
@@ -32,11 +32,11 @@ export const configBlock = createComponent<
3232
const secretKey = element.state.secret_key;
3333
if (typeof secretKey !== 'string' || !secretKey) {
3434
throw new ExposableError(
35-
'Incomplete configuration: missing Bucket environment secret key',
35+
'Incomplete configuration: missing Reflag environment secret key',
3636
);
3737
}
3838

39-
const configurationBody: BucketSiteInstallationConfiguration = {
39+
const configurationBody: ReflagSiteInstallationConfiguration = {
4040
secret_key: secretKey,
4141
};
4242

@@ -84,10 +84,10 @@ export const configBlock = createComponent<
8484
label="Secret key"
8585
hint={
8686
<text>
87-
The secret key from your Bucket{' '}
87+
The secret key from your Reflag{' '}
8888
<link
8989
target={{
90-
url: 'https://app.bucket.co/envs/current/settings/app-environments',
90+
url: 'https://app.reflag.com/envs/current/settings/app-environments',
9191
}}
9292
>
9393
environment settings.
@@ -116,7 +116,7 @@ export const configBlock = createComponent<
116116
) : (
117117
<input
118118
label="Enable Adaptive Content"
119-
hint="To use Bucket, you need to enable Adaptive Content in your site audience settings."
119+
hint="To use the Reflag integration, you need to enable Adaptive Content in your site audience settings."
120120
element={
121121
<button
122122
label="Enable"

integrations/bucket/src/schema.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import { Logger } from '@gitbook/runtime';
2-
import type { BucketRuntimeContext } from './types';
2+
import type { ReflagRuntimeContext } from './types';
33
import {
44
GitBookAPI,
55
GitBookAPIError,
66
IntegrationEnvironmentSiteInstallation,
77
IntegrationInstallation,
8-
IntegrationSiteInstallation,
98
type SiteAdaptiveJSONSchema,
109
} from '@gitbook/api';
1110

12-
const logger = Logger('bucket:tasks');
11+
const logger = Logger('reflag:tasks');
1312

1413
export const SYNC_ADAPTIVE_SCHEMA_SCHEDULE_SECONDS = 3600; // 1 hour
1514

1615
export async function handleSyncAdaptiveSchema(
17-
context: BucketRuntimeContext,
16+
context: ReflagRuntimeContext,
1817
installation: IntegrationInstallation,
1918
siteInstallation: IntegrationEnvironmentSiteInstallation,
2019
): Promise<void> {
@@ -80,9 +79,9 @@ export async function handleSyncAdaptiveSchema(
8079
...(existing.properties.unsigned?.type === 'object'
8180
? existing.properties.unsigned.properties
8281
: {}),
83-
[context.environment.integration.name]: {
82+
reflag: {
8483
type: 'object',
85-
description: `Feature flags from the ${integrationId} integration`,
84+
description: `Feature flags from the reflag integration`,
8685
properties: {
8786
...featureFlags.reduce(
8887
(acc, feature) => {
@@ -155,7 +154,7 @@ async function getExistingAdaptiveSchema(
155154
}
156155

157156
async function getFeatureFlags(secretKey: string) {
158-
const res = await fetch('https://front.bucket.co/features', {
157+
const res = await fetch('https://front.reflag.com/features', {
159158
headers: {
160159
Authorization: `Bearer ${secretKey}`,
161160
},

integrations/bucket/src/types.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import type { RuntimeContext, RuntimeEnvironment } from '@gitbook/runtime';
22

3-
export type BucketSiteInstallationConfiguration = {
3+
export type ReflagSiteInstallationConfiguration = {
44
secret_key?: string;
55
lastSyncAttemptAt?: number;
66
};
77

8-
export type BucketRuntimeEnvironment = RuntimeEnvironment<{}, BucketSiteInstallationConfiguration>;
8+
export type ReflagRuntimeEnvironment = RuntimeEnvironment<{}, ReflagSiteInstallationConfiguration>;
99

10-
export type BucketRuntimeContext = RuntimeContext<BucketRuntimeEnvironment>;
10+
export type ReflagRuntimeContext = RuntimeContext<ReflagRuntimeEnvironment>;
1111

12-
export type BucketState = BucketSiteInstallationConfiguration;
12+
export type ReflagState = ReflagSiteInstallationConfiguration;
1313

14-
export type BucketProps = {
14+
export type ReflagProps = {
1515
siteInstallation: {
16-
configuration?: BucketSiteInstallationConfiguration;
16+
configuration?: ReflagSiteInstallationConfiguration;
1717
};
1818
};
19-
export type BucketAction = { action: 'save.config' };
19+
export type ReflagAction = { action: 'save.config' };

integrations/bucket/src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { BucketRuntimeEnvironment } from './types';
1+
import { ReflagRuntimeEnvironment } from './types';
22

3-
export function assertSiteInstallation(environment: BucketRuntimeEnvironment) {
3+
export function assertSiteInstallation(environment: ReflagRuntimeEnvironment) {
44
const siteInstallation = environment.siteInstallation;
55
if (!siteInstallation) {
66
throw new Error('Expected a site installation, but none was found');
@@ -9,7 +9,7 @@ export function assertSiteInstallation(environment: BucketRuntimeEnvironment) {
99
return siteInstallation;
1010
}
1111

12-
export function assertInstallation(environment: BucketRuntimeEnvironment) {
12+
export function assertInstallation(environment: ReflagRuntimeEnvironment) {
1313
const installation = environment.installation;
1414
if (!installation) {
1515
throw new Error('Expected an installation, but none was found');

0 commit comments

Comments
 (0)