@mayson-org/inject-script 1.0.4 → 1.0.7
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
CHANGED
|
@@ -29,7 +29,7 @@ The pill:
|
|
|
29
29
|
|
|
30
30
|
- Fixed bottom-right “Edit with Mayson” (logo + label)
|
|
31
31
|
- Dismiss (×) hides it for the session
|
|
32
|
-
- Click
|
|
32
|
+
- Click navigates to https://mayson.dev/ (hardcoded for now)
|
|
33
33
|
|
|
34
34
|
### API gating (`show_remix_pill` / `enable_remix`)
|
|
35
35
|
|
|
@@ -41,9 +41,9 @@ Header: `M-Web-Token: {MAYSON_WEB_TOKEN}`
|
|
|
41
41
|
| API field | Effect |
|
|
42
42
|
|-----------|--------|
|
|
43
43
|
| `show_remix_pill` | If `false`, watermark is **not** injected; if `true`, inject |
|
|
44
|
-
| `enable_remix` |
|
|
44
|
+
| `enable_remix` | Still fetched for later use; click target is hardcoded to https://mayson.dev/ for now |
|
|
45
45
|
|
|
46
|
-
**Metadata not found (404):** if the API returns HTTP 404 or a body like `{ "response_code": 404, "message": "Generated app metadata not found", "value": {} }`, treat as **`show_remix_pill=true`** and **`enable_remix=true`** (show watermark
|
|
46
|
+
**Metadata not found (404):** if the API returns HTTP 404 or a body like `{ "response_code": 404, "message": "Generated app metadata not found", "value": {} }`, treat as **`show_remix_pill=true`** and **`enable_remix=true`** (show watermark).
|
|
47
47
|
|
|
48
48
|
Defaults when the API is not called or fails for other reasons: `showRemixPill=false`, `enableRemix=false` (watermark skipped).
|
|
49
49
|
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { PluginGenerateContext } from '../../core/types.js';
|
|
2
|
-
export type WatermarkTemplateOptions = {
|
|
3
|
-
enableRemix: boolean;
|
|
4
|
-
appBaseUrl: string;
|
|
5
|
-
collectionId: string;
|
|
6
|
-
};
|
|
7
2
|
/** Source for the consumer-app MaysonWatermark client component. */
|
|
8
|
-
export declare function buildMaysonWatermarkSource(
|
|
3
|
+
export declare function buildMaysonWatermarkSource(_context?: PluginGenerateContext): string;
|
|
9
4
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/plugins/watermark/template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/plugins/watermark/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAKjE,oEAAoE;AACpE,wBAAgB,0BAA0B,CACxC,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,MAAM,CA8GR"}
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import { buildRemixRedirectUrl } from '../../shared/remix-url.js';
|
|
2
1
|
const LOGO_URL = 'https://mayson.dev/logo/brand-logo-dark.png';
|
|
3
|
-
|
|
4
|
-
const wm = context?.watermark;
|
|
5
|
-
return {
|
|
6
|
-
enableRemix: wm?.enableRemix ?? false,
|
|
7
|
-
appBaseUrl: wm?.appBaseUrl || 'https://mayson.dev',
|
|
8
|
-
collectionId: wm?.collectionId || '',
|
|
9
|
-
};
|
|
10
|
-
}
|
|
2
|
+
const MAYSON_HOME_URL = 'https://mayson.dev/';
|
|
11
3
|
/** Source for the consumer-app MaysonWatermark client component. */
|
|
12
|
-
export function buildMaysonWatermarkSource(
|
|
13
|
-
const options = resolveWatermarkOptions(context);
|
|
14
|
-
const remixUrl = buildRemixRedirectUrl({
|
|
15
|
-
appBaseUrl: options.appBaseUrl,
|
|
16
|
-
collectionId: options.collectionId,
|
|
17
|
-
enableRemix: options.enableRemix,
|
|
18
|
-
});
|
|
4
|
+
export function buildMaysonWatermarkSource(_context) {
|
|
19
5
|
return `'use client';
|
|
20
6
|
|
|
21
7
|
import React, { useState } from 'react';
|
|
22
8
|
|
|
23
9
|
const LOGO_URL = ${JSON.stringify(LOGO_URL)};
|
|
24
|
-
const REMIX_URL = ${JSON.stringify(
|
|
10
|
+
const REMIX_URL = ${JSON.stringify(MAYSON_HOME_URL)};
|
|
25
11
|
|
|
26
12
|
export function MaysonWatermark() {
|
|
27
13
|
const [dismissed, setDismissed] = useState(false);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mayson-org/inject-script",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "CLI and library to
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "CLI and library to inject Mayson watermark and ascii into Next.js App Router layouts.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"type": "module",
|