@manta-eu/lib 0.1.0 → 0.1.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/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @manta-eu/lib
|
|
2
|
+
|
|
3
|
+
Small TypeScript helpers shared across the Manta packages — plain functions and types, no
|
|
4
|
+
framework and no service calls.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add @manta-eu/lib
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
Each module is its own subpath, so you import only what you use:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { arrayWrap } from "@manta-eu/lib/array";
|
|
18
|
+
import { humanBytes, humanDuration } from "@manta-eu/lib/humanize";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Modules include `array`, `date`, `number`, `color`, `file`, `enum`, `humanize`, `present`,
|
|
22
|
+
`countries` and `ad-platform-links`. `present` carries `isPresent`, which is how this repo checks for
|
|
23
|
+
a value rather than testing `.length` or truthiness.
|
|
24
|
+
|
|
25
|
+
This package exists so `@manta-eu/client`, `@manta-eu/react` and `@manta-eu/rdf-lib` share one copy
|
|
26
|
+
of these helpers rather than three. It is published because those packages depend on it; most
|
|
27
|
+
consumers reach it transitively rather than naming it directly.
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type MetaAdsManagerCampaignLinkOptions = {
|
|
2
2
|
adAccountExternalId: string;
|
|
3
3
|
campaignExternalId: string[];
|
|
4
|
-
|
|
4
|
+
/** Meta business the ad account is shared with; omit when the link is not going through one. */
|
|
5
|
+
partnerBusinessId?: string;
|
|
5
6
|
};
|
|
6
7
|
export declare function generateMetaAdsManagerCampaignLink(args: MetaAdsManagerCampaignLinkOptions): string;
|
|
7
8
|
//# sourceMappingURL=ad-platform-links.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ad-platform-links.d.ts","sourceRoot":"","sources":["../src/ad-platform-links.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iCAAiC,GAAG;IAC9C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,
|
|
1
|
+
{"version":3,"file":"ad-platform-links.d.ts","sourceRoot":"","sources":["../src/ad-platform-links.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iCAAiC,GAAG;IAC9C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,gGAAgG;IAChG,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,iCAAiC,UAYzF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export function generateMetaAdsManagerCampaignLink(args) {
|
|
2
|
-
const { adAccountExternalId, campaignExternalId,
|
|
2
|
+
const { adAccountExternalId, campaignExternalId, partnerBusinessId } = args;
|
|
3
3
|
const recordSeparator = String.fromCharCode(0x1e);
|
|
4
4
|
const campaignIds = campaignExternalId.map((id) => `"${id}"`).join(",");
|
|
5
5
|
const filterSet = `SEARCH_BY_CAMPAIGN_GROUP_IDS-STRING_SET${recordSeparator}ANY${recordSeparator}[${campaignIds}]`;
|
|
6
6
|
const url = new URL("https://adsmanager.facebook.com/adsmanager/manage/campaigns");
|
|
7
7
|
url.searchParams.set("act", adAccountExternalId);
|
|
8
|
-
if (
|
|
9
|
-
url.searchParams.set("business_id",
|
|
8
|
+
if (partnerBusinessId) {
|
|
9
|
+
url.searchParams.set("business_id", partnerBusinessId);
|
|
10
10
|
}
|
|
11
11
|
url.searchParams.set("filter_set", filterSet);
|
|
12
12
|
return url.toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manta-eu/lib",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Pure TypeScript helpers shared across the Manta packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
|
-
"build": "tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json --resolve-full-paths",
|
|
63
|
-
"build:lib": "tsc --project tsconfig.build.json",
|
|
62
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json --resolve-full-paths",
|
|
63
|
+
"build:lib": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc --project tsconfig.build.json",
|
|
64
64
|
"test": "vitest --run",
|
|
65
65
|
"test:watch": "vitest --watch",
|
|
66
66
|
"check": "vitest --run",
|