From 9d83b16972aac3db59981ad9419dead0d0780816 Mon Sep 17 00:00:00 2001 From: Patrik Wilhelmsson Date: Tue, 10 Sep 2024 14:28:07 +0200 Subject: [PATCH] refactor: move wrapping helper to utils (#16) --- package.json | 5 +++++ src/advantage/index.ts | 2 +- src/utils/index.ts | 1 + src/{advantage => utils}/wrapping-helper.ts | 0 www/docs/tutorial/publisher.md | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) rename src/{advantage => utils}/wrapping-helper.ts (100%) diff --git a/package.json b/package.json index 1348428..eb275d6 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,11 @@ "import": "./dist/advantage/messaging/publisher-side.js", "require": "./dist/advantage/messaging/publisher-side.cjs", "types": "./dist/advantage/messaging/publisher-side.d.ts" + }, + "./utils": { + "import": "./dist/utils/index.js", + "require": "./dist/utils/index.cjs", + "types": "./dist/utils/index.d.ts" } }, "scripts": { diff --git a/src/advantage/index.ts b/src/advantage/index.ts index fe715a1..6dbdc7f 100644 --- a/src/advantage/index.ts +++ b/src/advantage/index.ts @@ -2,7 +2,7 @@ export { Advantage } from "./advantage"; import { AdvantageWrapper } from "./wrapper"; import { AdvantageUILayer } from "./ui-layer"; import logger from "../utils/logging"; -import { advantageWrapAdSlotElement as actualAdvantageWrapAdSlotElement } from "./wrapping-helper"; +import { advantageWrapAdSlotElement as actualAdvantageWrapAdSlotElement } from "../utils/wrapping-helper"; export { actualAdvantageWrapAdSlotElement as advantageWrapAdSlotElement }; export * from "./messaging"; export * from "../types"; diff --git a/src/utils/index.ts b/src/utils/index.ts index da72680..1673b76 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,3 +5,4 @@ export { sendMessageAndOpenChannel, sendMessageAndAwaitResponse } from "./messaging"; +export * from "./wrapping-helper"; diff --git a/src/advantage/wrapping-helper.ts b/src/utils/wrapping-helper.ts similarity index 100% rename from src/advantage/wrapping-helper.ts rename to src/utils/wrapping-helper.ts diff --git a/www/docs/tutorial/publisher.md b/www/docs/tutorial/publisher.md index 1758ec8..679a804 100644 --- a/www/docs/tutorial/publisher.md +++ b/www/docs/tutorial/publisher.md @@ -62,7 +62,7 @@ It is now time to wrap your ad slots in the Advantage Wrapper. You can also choose to use a helper method that does the wrapping for you: ```ts -import { advantageWrapAdSlotElement } from "@get-advantage/advantage"; +import { advantageWrapAdSlotElement } from "@get-advantage/advantage/utils"; /* advantageWrapAdSlotElement is a function that wraps an ad slot element with an Advantage-wrapper. It takes either a selector string or an HTMLElement as an argument.