notify-me-wl 1.4.4 → 2.1.0

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
@@ -16,9 +16,23 @@ This JavaScript widget allows users to register their interest in a product that
16
16
  Add the following script to your HTML to include the widget:
17
17
 
18
18
  ```html
19
- <script src="https://cdn.jsdelivr.net/npm/notify-me-wl/index.js"></script>
19
+ <script src="https://cdn.jsdelivr.net/npm/notify-me-wl/build/notify-me-wl.min.js"></script>
20
20
  ```
21
21
 
22
+ ### Development / Build
23
+
24
+ Source lives in `src/` (TypeScript) and is bundled with Rollup into `build/`.
25
+
26
+ ```bash
27
+ npm install # install dev dependencies
28
+ npm run build # emit build/notify-me-wl.js and build/notify-me-wl.min.js
29
+ npm run dev # rebuild on change (watch mode)
30
+ npm run typecheck # type-check without emitting
31
+ ```
32
+
33
+ > **v2.0.0 path change:** the distributed bundle moved from `index.js` to
34
+ > `build/notify-me-wl.min.js`. Update embeds to the new CDN URL above.
35
+
22
36
  ### Usage
23
37
 
24
38
  Add a button to your HTML where you want the widget to appear. The button should have an `id` of `popup-open`, a `data-fields` attribute with the fields you want to include in the form (as a JSON string), and a `data-type` attribute to specify the widget type (`notify-me` or `coming-soon`).
@@ -32,12 +46,13 @@ Add a button to your HTML where you want the widget to appear. The button should
32
46
 
33
47
  - `data-fields`: A JSON array specifying the optional fields to include in the form. Possible values are `"email"`, `"mobile"`, `"firstName"`, `"lastName"`, `"countryCode"`, and `"provinceCode"`. Defaults to `["email"]`. (A required Size selector is always shown and populated from the product's variants.)
34
48
  - `data-type`: Specifies the type of the widget. Possible values are `"notify-me"` and `"coming-soon"`.
35
- - `data-auth`: Auth mode. `"token"` (default) uses the bundled server-issued access token. `"proxy"` uses the Shopify App Proxy at `/apps/twc-sdk/auth/token` to obtain a tenant-scoped token (requires the customer to be logged in to the storefront).
49
+ - `data-auth`: Auth mode. `"token"` (default) uses the bundled server-issued access token. `"proxy"` uses the Shopify App Proxy at `/apps/<proxy-app>/auth/token` to obtain a tenant-scoped token (requires the customer to be logged in to the storefront).
36
50
  - `data-tenant`: The TWC tenant sent as the `X-Twc-Tenant` header. Used in both auth modes. Falls back to the bundled `TENANT_ID` if omitted.
51
+ - `data-proxy-app`: The Shopify App Proxy subpath, forming the `/apps/<proxy-app>/...` URL prefix used by the `"proxy"` auth mode. Falls back to the bundled `PROXY_APP_NAME` (`twc-sdk`) if omitted.
37
52
 
38
53
  ### Proxy auth mode
39
54
 
40
- When `data-auth="proxy"` is set, the widget does not use the bundled access token. Instead, on form submit it lazily fetches a tenant-scoped access token from the same-origin Shopify App Proxy endpoint `/apps/twc-sdk/auth/token` (Shopify signs and forwards the request). The token is cached for the page session and reused across submissions.
55
+ When `data-auth="proxy"` is set, the widget does not use the bundled access token. Instead, on form submit it lazily fetches a tenant-scoped access token from the same-origin Shopify App Proxy endpoint `/apps/<proxy-app>/auth/token` (where `<proxy-app>` comes from `data-proxy-app`, defaulting to `twc-sdk`; Shopify signs and forwards the request). The token is cached for the page session and reused across submissions.
41
56
 
42
57
  Because the proxy only issues a token for a logged-in customer, if the token cannot be obtained the popup stays open and shows an inline "Please log in to your account to continue." message; submission is blocked until a token is available.
43
58