Skip to content

Commit

Permalink
Make sure to pass disableAppFormat val to every instance of configSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
sadie-phantom committed Mar 15, 2024
1 parent b60c4f0 commit bbb6fb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/oTracker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export class oTracker {
options: TrackingOptions;

constructor(config: ConfigType, options: TrackingOptions) {
this._config = parseConfig(config);
this._config = parseConfig(
config,
options.disableAppFormatTransform || false
);
validateConfig(this._config, options.disableAppFormatTransform || false);
this._config.source_id = oTracking.getRootID();
this.options = options;
Expand Down
6 changes: 5 additions & 1 deletion src/utils/yupValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ const origamiEventSchema = object({
export type ConfigType = InferType<typeof configSchema>;
export type OrigamiEventType = InferType<typeof origamiEventSchema>;

export const parseConfig = (config: ConfigType): ConfigType => {
export const parseConfig = (
config: ConfigType,
disableAppFormatTransform: boolean
): ConfigType => {
disableAppFormatTransformValue = disableAppFormatTransform;
try {
//Replace app value based on deprecated hasVideo field and then remove hasVideo
if (config.hasVideo && config.app.toLowerCase() === "article") {
Expand Down

0 comments on commit bbb6fb5

Please sign in to comment.