Skip to content

Commit c214ab7

Browse files
committed
fix(captcha providers): remove barrel files and fix exports
1 parent 26fec4a commit c214ab7

24 files changed

+33
-34
lines changed

injected/src/features/broker-protection/actions/captcha-deprecated.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { captchaCallback } from './captcha-callback.js';
2-
import { getElement } from '../utils';
2+
import { getElement } from '../utils/utils.js';
33
import { ErrorResponse, SuccessResponse } from '../types.js';
44

55
/**

injected/src/features/broker-protection/actions/click.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getElements } from '../utils';
1+
import { getElements } from '../utils/utils.js';
22
import { ErrorResponse, SuccessResponse } from '../types.js';
33
import { extractProfiles } from './extract.js';
44
import { processTemplateStringWithUserData } from './build-url-transforms.js';

injected/src/features/broker-protection/actions/expectation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getElement } from '../utils';
1+
import { getElement } from '../utils/utils.js';
22
import { ErrorResponse, SuccessResponse } from '../types.js';
33

44
/**

injected/src/features/broker-protection/actions/extract.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cleanArray, getElement, getElementMatches, getElements, sortAddressesByStateAndCity } from '../utils'; // Assuming you have imported the address comparison function
1+
import { cleanArray, getElement, getElementMatches, getElements, sortAddressesByStateAndCity } from '../utils/utils.js'; // Assuming you have imported the address comparison function
22
import { ErrorResponse, ProfileResult, SuccessResponse } from '../types.js';
33
import { isSameAge } from '../comparisons/is-same-age.js';
44
import { isSameName } from '../comparisons/is-same-name.js';

injected/src/features/broker-protection/actions/fill-form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getElement, generateRandomInt } from '../utils';
1+
import { getElement, generateRandomInt } from '../utils/utils.js';
22
import { ErrorResponse, SuccessResponse } from '../types.js';
33
import { generatePhoneNumber, generateZipCode, generateStreetAddress } from './generators.js';
44

injected/src/features/broker-protection/actions/generators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { generateRandomInt } from '../utils';
1+
import { generateRandomInt } from '../utils/utils.js';
22

33
export function generatePhoneNumber() {
44
/**

injected/src/features/broker-protection/actions/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { extract } from './extract.js';
2-
import { fillForm } from './fill-form.js';
3-
import { click } from './click.js';
4-
import { expectation } from './expectation.js';
1+
import { extract } from './extract';
2+
import { fillForm } from './fill-form';
3+
import { click } from './click';
4+
import { expectation } from './expectation';
55
import { navigate } from './navigate';
66
import { buildUrl } from './build-url';
7-
import * as captchaHandlers from '../captcha-services';
7+
import * as captchaHandlers from '../captcha-services/captcha.service';
88
import * as deprecatedCaptchaHandlers from './captcha-deprecated';
99

1010
/**

injected/src/features/broker-protection/actions/navigate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getSupportingCodeToInject } from '../captcha-services';
1+
import { getSupportingCodeToInject } from '../captcha-services/captcha.service';
22
import { ErrorResponse, SuccessResponse } from '../types';
33
import { buildUrl } from './build-url';
44

injected/src/features/broker-protection/captcha-services/captcha.service.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { getElement, removeUrlQueryParams } from '../utils';
1+
import { getElement } from '../utils/utils.js';
2+
import { removeUrlQueryParams } from '../utils/url.js';
23
import { ErrorResponse, SuccessResponse } from '../types';
34
import { getCaptchaProvider, getCaptchaSolveProvider } from './get-captcha-provider';
4-
import { captchaFactory } from './providers';
5+
import { captchaFactory } from './providers/registry.js';
56

67
/**
78
* Returns the supporting code to inject for the given captcha type

injected/src/features/broker-protection/captcha-services/get-captcha-provider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { captchaFactory } from './providers';
1+
import { captchaFactory } from './providers/registry';
22

33
/**
44
* Gets the captcha provider for the getCaptchaInfo action

injected/src/features/broker-protection/captcha-services/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

injected/src/features/broker-protection/captcha-services/providers/hcaptcha.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { getUrlHashParameter, getUrlParameter } from '../../utils/url';
2+
import { getElementByName, getElementWithSrcStart } from '../../utils/utils';
3+
import { stringifyFunction } from '../utils/stringify-function';
4+
import { injectTokenIntoElement } from '../utils/token';
15
import { CaptchaProvider } from './provider.interface';
2-
import { injectTokenIntoElement, stringifyFunction } from '../utils';
3-
import { getUrlParameter, getUrlHashParameter, getElementByName, getElementWithSrcStart } from '../../utils';
46

57
/**
68
* Provider for hCaptcha

injected/src/features/broker-protection/captcha-services/providers/recaptcha-v2.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { CaptchaProvider } from './provider.interface';
2-
import { getElementByName, getElementWithSrcStart } from '../../utils';
3-
import { injectTokenIntoElement, getSiteKeyFromSearchParam, stringifyFunction } from '../utils';
2+
import { getElementByName, getElementWithSrcStart } from '../../utils/utils';
3+
import { getSiteKeyFromSearchParam } from '../utils/sitekey';
4+
import { stringifyFunction } from '../utils/stringify-function';
5+
import { injectTokenIntoElement } from '../utils/token';
46
// TODO move on the same folder level once we deprecate the existing captcha scripts
57
import { captchaCallback } from '../../actions/captcha-callback';
68

injected/src/features/broker-protection/captcha-services/utils/index.js

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

injected/src/features/broker-protection/captcha-services/utils/sitekey.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getUrlParameter } from '../../utils';
1+
import { getUrlParameter } from '../../utils/url';
22

33
/**
44
* Extracts a site key from a captcha element's URL search parameters.

injected/src/features/broker-protection/captcha-services/utils/stringify-function.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { safeCall } from '../../utils';
1+
import { safeCall } from '../../utils/safe-call';
22

33
/**
44
* @param {Object} params

injected/src/features/broker-protection/captcha-services/utils/token.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getElementByName, safeCall } from '../../utils';
1+
import { safeCall } from '../../utils/safe-call';
2+
import { getElementByName } from '../../utils/utils';
23

34
/**
45
* Inject a token into a named element

injected/src/features/broker-protection/comparisons/address.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { states } from './constants.js';
2-
import { matchingPair } from '../utils';
2+
import { matchingPair } from '../utils/utils.js';
33

44
/**
55
* @param {{city: string; state: string | null}[]} userAddresses

injected/src/features/broker-protection/extractors/profile-url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// eslint-disable-next-line @typescript-eslint/no-unused-vars
22
import { AsyncProfileTransform, Extractor } from '../types.js';
3-
import { hashObject } from '../utils';
3+
import { hashObject } from '../utils/utils.js';
44

55
/**
66
* @implements {Extractor<{profileUrl: string; identifier: string} | null>}

injected/src/features/broker-protection/utils/index.js

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

injected/unit-test/broker-protection-extract.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { aggregateFields, createProfile, stringValuesFromElements } from '../src/features/broker-protection/actions/extract.js';
2-
import { cleanArray } from '../src/features/broker-protection/utils';
2+
import { cleanArray } from '../src/features/broker-protection/utils/utils.js';
33

44
describe('create profiles from extracted data', () => {
55
describe('cleanArray', () => {

injected/unit-test/broker-protection-extractors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fc from 'fast-check';
2-
import { cleanArray } from '../src/features/broker-protection/utils';
2+
import { cleanArray } from '../src/features/broker-protection/utils/utils.js';
33
import { PhoneExtractor } from '../src/features/broker-protection/extractors/phone.js';
44
import { ProfileUrlExtractor } from '../src/features/broker-protection/extractors/profile-url.js';
55

injected/unit-test/broker-protection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { addressMatch } from '../src/features/broker-protection/comparisons/addr
66
import { replaceTemplatedUrl } from '../src/features/broker-protection/actions/build-url.js';
77
import { processTemplateStringWithUserData } from '../src/features/broker-protection/actions/build-url-transforms.js';
88
import { names } from '../src/features/broker-protection/comparisons/constants.js';
9-
import { generateRandomInt, hashObject, sortAddressesByStateAndCity } from '../src/features/broker-protection/utils';
9+
import { generateRandomInt, hashObject, sortAddressesByStateAndCity } from '../src/features/broker-protection/utils/utils.js';
1010
import { generatePhoneNumber, generateZipCode, generateStreetAddress } from '../src/features/broker-protection/actions/generators.js';
1111
import { CityStateExtractor } from '../src/features/broker-protection/extractors/address.js';
1212
import { ProfileHashTransformer } from '../src/features/broker-protection/extractors/profile-url.js';

0 commit comments

Comments
 (0)