@wix/builder-services 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/debug/es/builder-services.mjs +5564 -0
- package/dist/bundles/debug/es/builder-services.mjs.map +1 -0
- package/dist/bundles/debug/umd/builder-services.js +5565 -0
- package/dist/bundles/debug/umd/builder-services.js.map +1 -0
- package/dist/bundles/es/builder-services.mjs +3726 -0
- package/dist/bundles/es/builder-services.mjs.map +1 -0
- package/dist/bundles/umd/builder-services.js +21 -0
- package/dist/bundles/umd/builder-services.js.map +1 -0
- package/dist/businessLoggerService.d.ts +4 -0
- package/dist/businessLoggerService.js +14 -0
- package/dist/businessLoggerService.js.map +1 -0
- package/dist/createServicesProvider.d.ts +7 -0
- package/dist/createServicesProvider.js +18 -0
- package/dist/createServicesProvider.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/lightboxService.d.ts +13 -0
- package/dist/lightboxService.js +40 -0
- package/dist/lightboxService.js.map +1 -0
- package/package.json +67 -0
- package/src/businessLoggerService.ts +25 -0
- package/src/createServicesProvider.tsx +37 -0
- package/src/index.ts +3 -0
- package/src/lightboxService.ts +60 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ServiceFactory } from '@wix/services-manager/types';
|
|
2
|
+
import type { IBusinessLoggerDefinition, IBusinessLoggerServiceConfig } from '@wix/viewer-service-business-logger/definition';
|
|
3
|
+
export declare const BusinessLoggerDefinition: IBusinessLoggerDefinition;
|
|
4
|
+
export declare const BusinessLoggerService: ServiceFactory<IBusinessLoggerDefinition, IBusinessLoggerServiceConfig>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
// Matches the service id used by @wix/viewer-service-business-logger
|
|
3
|
+
export const BusinessLoggerDefinition = '@wix/viewer-service-business-logger';
|
|
4
|
+
export const BusinessLoggerService = () => {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
const noopLog = (_params, _context) => new Promise(() => {
|
|
7
|
+
console.warn('The logger is not implemented');
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
logger: { log: noopLog },
|
|
11
|
+
reportBi: noopLog,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=businessLoggerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"businessLoggerService.js","sourceRoot":"","sources":["../src/businessLoggerService.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAUZ,qEAAqE;AACrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,qCAAkE,CAAA;AAE1G,MAAM,CAAC,MAAM,qBAAqB,GAA4E,GAAG,EAAE;IAC/G,6DAA6D;IAC7D,MAAM,OAAO,GAAG,CAAC,OAA6B,EAAE,QAA+B,EAAE,EAAE,CAC/E,IAAI,OAAO,CAAC,GAAG,EAAE;QACb,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IAEN,OAA+B;QAC3B,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE;QACxB,QAAQ,EAAE,OAAO;KACpB,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ServiceBinding } from '@wix/services-manager/types';
|
|
3
|
+
type ServicesRecord = Record<string, ServiceBinding<any, any>>;
|
|
4
|
+
export declare function createServicesProvider(servicesConfigs: ServicesRecord, masterPageServicesConfigs: ServicesRecord, siteServicesConfigs: ServicesRecord): ({ children }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { createServicesManager, createServicesMap } from '@wix/services-manager';
|
|
5
|
+
import { ServicesManagerProvider } from '@wix/services-manager-react';
|
|
6
|
+
export function createServicesProvider(servicesConfigs, masterPageServicesConfigs, siteServicesConfigs) {
|
|
7
|
+
const mergedServices = _.mergeWith({}, servicesConfigs, masterPageServicesConfigs, siteServicesConfigs, (objValue, srcValue) => {
|
|
8
|
+
// array merge was added for the interactions service config merge
|
|
9
|
+
if (Array.isArray(objValue) && Array.isArray(srcValue)) {
|
|
10
|
+
return [...objValue, ...srcValue];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const servicesMap = createServicesMap(Object.values(mergedServices));
|
|
14
|
+
const servicesManager = createServicesManager(servicesMap);
|
|
15
|
+
const ServicesProvider = ({ children }) => (React.createElement(ServicesManagerProvider, { servicesManager: servicesManager }, children));
|
|
16
|
+
return ServicesProvider;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=createServicesProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createServicesProvider.js","sourceRoot":"","sources":["../src/createServicesProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEhF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAIrE,MAAM,UAAU,sBAAsB,CAClC,eAA+B,EAC/B,yBAAyC,EACzC,mBAAmC;IAEnC,MAAM,cAAc,GAAG,CAAC,CAAC,SAAS,CAC9B,EAAE,EACF,eAAe,EACf,yBAAyB,EACzB,mBAAmB,EACnB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE;QACnB,kEAAkE;QAClE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrD,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAA;QACrC,CAAC;IACL,CAAC,CACJ,CAAA;IAED,MAAM,WAAW,GAAG,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAA;IACpE,MAAM,eAAe,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAA;IAE1D,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE,CAAC,CACtE,oBAAC,uBAAuB,IAAC,eAAe,EAAE,eAAe,IAAG,QAAQ,CAA2B,CAClG,CAAA;IAED,OAAO,gBAAgB,CAAA;AAC3B,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ServiceDefinition, ServiceFactory } from '@wix/services-manager/types';
|
|
2
|
+
type ILightboxServiceConfig = {
|
|
3
|
+
close: () => void;
|
|
4
|
+
};
|
|
5
|
+
interface ILightboxService {
|
|
6
|
+
close: () => void;
|
|
7
|
+
}
|
|
8
|
+
type LightboxDefinitionType = ServiceDefinition<ILightboxService, ILightboxServiceConfig>;
|
|
9
|
+
export declare const LightboxService: ServiceFactory<LightboxDefinitionType, ILightboxServiceConfig>;
|
|
10
|
+
export declare const registerPopupReactRoot: (root: {
|
|
11
|
+
unmount(): void;
|
|
12
|
+
}, containerId: string) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Temporary local lightbox service implementation until it will be implemented in viewer-core-services
|
|
2
|
+
'use client';
|
|
3
|
+
const POPUP_QUERY_PARAM = 'popup';
|
|
4
|
+
const defaultClose = () => {
|
|
5
|
+
removePopupQueryParam();
|
|
6
|
+
restoreSiteScroll();
|
|
7
|
+
unmountPopup();
|
|
8
|
+
};
|
|
9
|
+
export const LightboxService = ({ config }) => ({
|
|
10
|
+
close: config.close ?? defaultClose,
|
|
11
|
+
});
|
|
12
|
+
const removePopupQueryParam = () => {
|
|
13
|
+
const url = new URL(window.location.href);
|
|
14
|
+
url.searchParams.delete(POPUP_QUERY_PARAM);
|
|
15
|
+
window.history.replaceState(null, '', url);
|
|
16
|
+
};
|
|
17
|
+
const restoreSiteScroll = () => {
|
|
18
|
+
const body = document.body;
|
|
19
|
+
const scrollY = parseFloat(body.style.getPropertyValue('--blocked-site-scroll-margin-top')) || 0;
|
|
20
|
+
body.classList.remove('blockSiteScrolling', 'siteScrollingBlocked');
|
|
21
|
+
body.style.removeProperty('--blocked-site-scroll-margin-top');
|
|
22
|
+
if (scrollY) {
|
|
23
|
+
window.scrollTo(0, scrollY);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
let popupReactRoot = null;
|
|
27
|
+
let popupContainerId = null;
|
|
28
|
+
export const registerPopupReactRoot = (root, containerId) => {
|
|
29
|
+
popupReactRoot = root;
|
|
30
|
+
popupContainerId = containerId;
|
|
31
|
+
};
|
|
32
|
+
const unmountPopup = () => {
|
|
33
|
+
popupReactRoot?.unmount();
|
|
34
|
+
popupReactRoot = null;
|
|
35
|
+
if (popupContainerId) {
|
|
36
|
+
document.getElementById(popupContainerId)?.remove();
|
|
37
|
+
popupContainerId = null;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=lightboxService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightboxService.js","sourceRoot":"","sources":["../src/lightboxService.ts"],"names":[],"mappings":"AAAA,uGAAuG;AAEvG,YAAY,CAAA;AAIZ,MAAM,iBAAiB,GAAG,OAAO,CAAA;AAYjC,MAAM,YAAY,GAAG,GAAG,EAAE;IACtB,qBAAqB,EAAE,CAAA;IACvB,iBAAiB,EAAE,CAAA;IACnB,YAAY,EAAE,CAAA;AAClB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAmE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5G,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,YAAY;CACtC,CAAC,CAAA;AAEF,MAAM,qBAAqB,GAAG,GAAG,EAAE;IAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACzC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;IAC1C,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;AAC9C,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC3B,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAA;IAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,kCAAkC,CAAC,CAAC,IAAI,CAAC,CAAA;IAChG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAA;IACnE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,kCAAkC,CAAC,CAAA;IAC7D,IAAI,OAAO,EAAE,CAAC;QACV,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;IAC/B,CAAC;AACL,CAAC,CAAA;AAED,IAAI,cAAc,GAA+B,IAAI,CAAA;AACrD,IAAI,gBAAgB,GAAkB,IAAI,CAAA;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAyB,EAAE,WAAmB,EAAE,EAAE;IACrF,cAAc,GAAG,IAAI,CAAA;IACrB,gBAAgB,GAAG,WAAW,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,GAAG,EAAE;IACtB,cAAc,EAAE,OAAO,EAAE,CAAA;IACzB,cAAc,GAAG,IAAI,CAAA;IACrB,IAAI,gBAAgB,EAAE,CAAC;QACnB,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;QACnD,gBAAgB,GAAG,IAAI,CAAA;IAC3B,CAAC;AACL,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wix/builder-services",
|
|
3
|
+
"version": "1.16.1",
|
|
4
|
+
"description": "Builder services wrapper for dynamic service registration",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"license": "UNLICENSED",
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"dist",
|
|
12
|
+
"!**/*.tsbuildinfo"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -b . --force && yarn run -T build:bundles builder-services",
|
|
16
|
+
"lint": "yarn run -T lint:package $npm_package_name",
|
|
17
|
+
"test-type-check": "tsc --project tsconfig.test.json",
|
|
18
|
+
"test": "yarn test-type-check && vitest --run",
|
|
19
|
+
"clean": "rm -rf coverage dist target tsconfig.tsbuildinfo"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@wix/services-manager": "^1.0.4",
|
|
23
|
+
"@wix/services-manager-react": "^1.0.4",
|
|
24
|
+
"lodash": "^4.17.21"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"react": "^18.3.1",
|
|
28
|
+
"typescript": "^5.3.3",
|
|
29
|
+
"vitest": "^4.0.10"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": "^18.3.1"
|
|
33
|
+
},
|
|
34
|
+
"publishUnscoped": false,
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"registry": "https://registry.npmjs.org/",
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"wix": {
|
|
40
|
+
"artifact": {
|
|
41
|
+
"groupId": "com.wixpress.npm",
|
|
42
|
+
"artifactId": "builder-services",
|
|
43
|
+
"targets": {
|
|
44
|
+
"static": {
|
|
45
|
+
"folderToUpload": "dist/bundles"
|
|
46
|
+
},
|
|
47
|
+
"docker": false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"validations": {
|
|
51
|
+
"postBuild": [
|
|
52
|
+
"test",
|
|
53
|
+
"lint"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"exports": {
|
|
58
|
+
".": {
|
|
59
|
+
"import": "./dist/bundles/es/builder-services.mjs",
|
|
60
|
+
"require": "./dist/bundles/umd/builder-services.js",
|
|
61
|
+
"types": "./dist/index.d.ts"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"module": "dist/bundles/es/builder-services.mjs",
|
|
65
|
+
"type": "module",
|
|
66
|
+
"falconPackageHash": "5b21abe26381aa5272115ab7bd4cb3db5bb7c7584dbd4388a87cb241"
|
|
67
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import type { ServiceFactory } from '@wix/services-manager/types'
|
|
4
|
+
import type {
|
|
5
|
+
IBusinessLoggerDefinition,
|
|
6
|
+
IBusinessLoggerService,
|
|
7
|
+
IBusinessLoggerServiceConfig,
|
|
8
|
+
} from '@wix/viewer-service-business-logger/definition'
|
|
9
|
+
import type { BusinessLoggerOptions, BusinessLoggerParams } from '@wix/viewer-service-business-logger/types'
|
|
10
|
+
|
|
11
|
+
// Matches the service id used by @wix/viewer-service-business-logger
|
|
12
|
+
export const BusinessLoggerDefinition = '@wix/viewer-service-business-logger' as IBusinessLoggerDefinition
|
|
13
|
+
|
|
14
|
+
export const BusinessLoggerService: ServiceFactory<IBusinessLoggerDefinition, IBusinessLoggerServiceConfig> = () => {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
+
const noopLog = (_params: BusinessLoggerParams, _context: BusinessLoggerOptions) =>
|
|
17
|
+
new Promise(() => {
|
|
18
|
+
console.warn('The logger is not implemented')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return <IBusinessLoggerService>{
|
|
22
|
+
logger: { log: noopLog },
|
|
23
|
+
reportBi: noopLog,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import _ from 'lodash'
|
|
5
|
+
import { createServicesManager, createServicesMap } from '@wix/services-manager'
|
|
6
|
+
import type { ServiceBinding } from '@wix/services-manager/types'
|
|
7
|
+
import { ServicesManagerProvider } from '@wix/services-manager-react'
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
type ServicesRecord = Record<string, ServiceBinding<any, any>>
|
|
10
|
+
|
|
11
|
+
export function createServicesProvider(
|
|
12
|
+
servicesConfigs: ServicesRecord,
|
|
13
|
+
masterPageServicesConfigs: ServicesRecord,
|
|
14
|
+
siteServicesConfigs: ServicesRecord
|
|
15
|
+
) {
|
|
16
|
+
const mergedServices = _.mergeWith(
|
|
17
|
+
{},
|
|
18
|
+
servicesConfigs,
|
|
19
|
+
masterPageServicesConfigs,
|
|
20
|
+
siteServicesConfigs,
|
|
21
|
+
(objValue, srcValue) => {
|
|
22
|
+
// array merge was added for the interactions service config merge
|
|
23
|
+
if (Array.isArray(objValue) && Array.isArray(srcValue)) {
|
|
24
|
+
return [...objValue, ...srcValue]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const servicesMap = createServicesMap(Object.values(mergedServices))
|
|
30
|
+
const servicesManager = createServicesManager(servicesMap)
|
|
31
|
+
|
|
32
|
+
const ServicesProvider = ({ children }: { children: React.ReactNode }) => (
|
|
33
|
+
<ServicesManagerProvider servicesManager={servicesManager}>{children}</ServicesManagerProvider>
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return ServicesProvider
|
|
37
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Temporary local lightbox service implementation until it will be implemented in viewer-core-services
|
|
2
|
+
|
|
3
|
+
'use client'
|
|
4
|
+
|
|
5
|
+
import type { ServiceDefinition, ServiceFactory } from '@wix/services-manager/types'
|
|
6
|
+
|
|
7
|
+
const POPUP_QUERY_PARAM = 'popup'
|
|
8
|
+
|
|
9
|
+
type ILightboxServiceConfig = {
|
|
10
|
+
close: () => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ILightboxService {
|
|
14
|
+
close: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type LightboxDefinitionType = ServiceDefinition<ILightboxService, ILightboxServiceConfig>
|
|
18
|
+
|
|
19
|
+
const defaultClose = () => {
|
|
20
|
+
removePopupQueryParam()
|
|
21
|
+
restoreSiteScroll()
|
|
22
|
+
unmountPopup()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const LightboxService: ServiceFactory<LightboxDefinitionType, ILightboxServiceConfig> = ({ config }) => ({
|
|
26
|
+
close: config.close ?? defaultClose,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const removePopupQueryParam = () => {
|
|
30
|
+
const url = new URL(window.location.href)
|
|
31
|
+
url.searchParams.delete(POPUP_QUERY_PARAM)
|
|
32
|
+
window.history.replaceState(null, '', url)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const restoreSiteScroll = () => {
|
|
36
|
+
const body = document.body
|
|
37
|
+
const scrollY = parseFloat(body.style.getPropertyValue('--blocked-site-scroll-margin-top')) || 0
|
|
38
|
+
body.classList.remove('blockSiteScrolling', 'siteScrollingBlocked')
|
|
39
|
+
body.style.removeProperty('--blocked-site-scroll-margin-top')
|
|
40
|
+
if (scrollY) {
|
|
41
|
+
window.scrollTo(0, scrollY)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let popupReactRoot: { unmount(): void } | null = null
|
|
46
|
+
let popupContainerId: string | null = null
|
|
47
|
+
|
|
48
|
+
export const registerPopupReactRoot = (root: { unmount(): void }, containerId: string) => {
|
|
49
|
+
popupReactRoot = root
|
|
50
|
+
popupContainerId = containerId
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const unmountPopup = () => {
|
|
54
|
+
popupReactRoot?.unmount()
|
|
55
|
+
popupReactRoot = null
|
|
56
|
+
if (popupContainerId) {
|
|
57
|
+
document.getElementById(popupContainerId)?.remove()
|
|
58
|
+
popupContainerId = null
|
|
59
|
+
}
|
|
60
|
+
}
|