Skip to content

Commit 59a3475

Browse files
committed
Update statusCode
1 parent 30a8b4d commit 59a3475

File tree

20 files changed

+40
-150
lines changed

20 files changed

+40
-150
lines changed

packages/signals/signals-example/src/lib/analytics.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const isStage = process.env.STAGE === 'true'
3434
const signalsPlugin = new SignalsPlugin({
3535
...(isStage ? { apiHost: 'signals.segment.build/v1' } : {}),
3636
enableDebugLogging: true,
37-
// processSignal: processSignalExample,
37+
processSignal: processSignalExample,
3838
})
3939

4040
export const loadAnalytics = () =>
@@ -46,6 +46,7 @@ export const loadAnalytics = () =>
4646
...(isStage ? { cdnURL: 'https://cdn.segment.build' } : {}),
4747
},
4848
{
49+
initialPageview: true,
4950
...(isStage
5051
? {
5152
integrations: {

packages/signals/signals-runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"gen-editor-types": "node gen-editor-types.js",
2424
"build:esm": "yarn tsc -p tsconfig.build.json",
2525
"build:cjs": "yarn tsc -p tsconfig.build.json --outDir ./dist/cjs --module commonjs",
26-
"watch": "yarn concurrently 'yarn build:bundle-dev --watch' 'yarn build:esm --watch'",
26+
"watch": "yarn build:esm --watch",
2727
"watch:test": "yarn test --watch",
2828
"tsc": "yarn run -T tsc",
2929
"eslint": "yarn run -T eslint",

packages/signals/signals-runtime/src/mobile/mobile-signals-types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BaseSignal } from '../shared/shared-types'
1+
import { BaseSignal, ISignalsRuntime } from '../shared/shared-types'
22

33
export type SignalTypes = Signal['type']
44

@@ -88,3 +88,5 @@ interface InstrumentationData {
8888
interface InstrumentationSignal extends RawSignal<'instrumentation'> {
8989
data: InstrumentationData
9090
}
91+
92+
export interface MobileSignalsRuntime extends ISignalsRuntime<Signal> {}

packages/signals/signals-runtime/src/web/web-exports-globals.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// all import directives will be removed in the final build
2-
import { ISignalsRuntime } from '../shared/shared-types'
3-
import { Signal } from './web-exports'
2+
import { WebSignalsRuntime } from './web-exports'
43

54
// This will be appended to the generated code - dts-bundle-generator will not write declare const for whatever reason.
6-
declare const signals: ISignalsRuntime<Signal>
5+
declare const signals: WebSignalsRuntime
76
declare const SignalType: {
87
Interaction: 'interaction'
98
Navigation: 'navigation'

packages/signals/signals-runtime/src/web/web-signals-types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { BaseSignal, JSONValue } from '../shared/shared-types'
2+
import { ISignalsRuntime } from '../shared/shared-types'
23

34
export type SignalTypes = Signal['type']
45

@@ -79,6 +80,8 @@ interface NetworkRequestData extends BaseNetworkData {
7980
interface NetworkResponseData extends BaseNetworkData {
8081
action: 'response'
8182
url: string
83+
statusCode: number
84+
ok: boolean
8285
}
8386

8487
export type NetworkData = NetworkRequestData | NetworkResponseData
@@ -97,3 +100,5 @@ export type Signal =
97100
| InstrumentationSignal
98101
| NetworkSignal
99102
| UserDefinedSignal
103+
104+
export interface WebSignalsRuntime extends ISignalsRuntime<Signal> {}

packages/signals/signals/src/core/buffer/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Signal } from '../../types'
1+
import { Signal } from '@segment/analytics-signals-runtime'
22
import { openDB, DBSchema, IDBPDatabase } from 'idb'
33
import { logger } from '../../lib/logger'
44

packages/signals/signals/src/core/client/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Analytics, segmentio } from '@segment/analytics-next'
22
import { logger } from '../../lib/logger'
3-
import { Signal } from '../../types'
3+
import { Signal } from '@segment/analytics-signals-runtime'
44
import { redactSignalData } from './redact'
55

66
export class SignalsIngestSettings {

packages/signals/signals/src/core/client/redact.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Signal } from '../../types'
1+
import { Signal } from '@segment/analytics-signals-runtime'
22

33
export const redactSignalData = (signalArg: Signal): Signal => {
44
const signal = structuredClone(signalArg)

packages/signals/signals/src/core/processor/processor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { logger } from '../../lib/logger'
2-
import { AnyAnalytics, Signal } from '../../types'
2+
import { Signal } from '@segment/analytics-signals-runtime'
3+
import { AnyAnalytics } from '../../types'
34
import { MethodName, Sandbox } from './sandbox'
45

56
export class SignalEventProcessor {

packages/signals/signals/src/core/signal-generators/network-gen/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export function isPlainObject(obj: unknown): obj is Record<string, unknown> {
6666
)
6767
}
6868

69-
export const isOk = (status: number) => status >= 200 && status < 300
69+
export const isOk = (statusCode: number) =>
70+
statusCode >= 200 && statusCode < 300
7071

7172
/**
7273
* Safely parse JSON, if it fails, return the original text.

0 commit comments

Comments
 (0)