powr-sdk-web 6.2.0 → 6.2.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/activities/PowrActivityList.js +3 -3
- package/dist/activities/index.js +3 -3
- package/dist/admin/PowrBaseAdminFull.js +4 -4
- package/dist/admin/coreSectionLoaders.js +3 -3
- package/dist/admin/optionalSectionLoaders.js +8 -8
- package/dist/auth/index.js +11 -2
- package/dist/calendar/index.js +2 -2
- package/dist/session/index.js +18 -18
- package/dist/shell/PowrBaseAppWrapper.js +10 -10
- package/dist/shell/styles.js +3 -3
- package/dist/sso/api.js +11 -11
- package/dist/sso/index.js +16 -16
- package/dist/sso/openPowrLogin.js +18 -18
- package/dist/theme/PowrThemeProvider.js +23 -23
- package/dist/theme/PowrThemeSettings.js +19 -19
- package/dist/theme/host.js +16 -16
- package/dist/theme/initScript.js +16 -16
- package/dist/theme/tokens.js +30 -30
- package/dist/thread/components/AttachModal.js +2 -2
- package/dist/thread/components/ThreadComposer.js +3 -3
- package/dist/thread/components/ThreadItem.js +3 -3
- package/dist/thread/components/ThreadList.js +3 -3
- package/dist/thread/index.js +4 -4
- package/dist/thread/utils/linkify.js +4 -4
- package/dist/utils/phone.js +3 -3
- package/dist/utils/useMediaQuery.js +3 -3
- package/package.json +67 -67
|
@@ -52,9 +52,9 @@ function formatWhen(iso, locale) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* Presentational list for PowrBase activity-shaped rows (`activity.activity`, `activity.actor`, `activity.action`, `createdAt`).
|
|
57
|
-
* Does not fetch — pass data from parent or use {@link PowrBaseActivities}.
|
|
55
|
+
/**
|
|
56
|
+
* Presentational list for PowrBase activity-shaped rows (`activity.activity`, `activity.actor`, `activity.action`, `createdAt`).
|
|
57
|
+
* Does not fetch — pass data from parent or use {@link PowrBaseActivities}.
|
|
58
58
|
*/
|
|
59
59
|
function PowrActivityList(_ref) {
|
|
60
60
|
var activities = _ref.activities,
|
package/dist/activities/index.js
CHANGED
|
@@ -36,9 +36,9 @@ var wrapperStyle = {
|
|
|
36
36
|
fontFamily: 'Roboto, sans-serif'
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Fetches activities like comments: GET with contentId + projectId (via apiCall).
|
|
41
|
-
* Date filtering is client-side: calendar picks a day, list shows items for that day.
|
|
39
|
+
/**
|
|
40
|
+
* Fetches activities like comments: GET with contentId + projectId (via apiCall).
|
|
41
|
+
* Date filtering is client-side: calendar picks a day, list shows items for that day.
|
|
42
42
|
*/
|
|
43
43
|
function PowrBaseActivities(_ref) {
|
|
44
44
|
var projectId = _ref.projectId,
|
|
@@ -18,10 +18,10 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
18
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
19
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
20
20
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
21
|
-
/**
|
|
22
|
-
* Full PowrBaseAdmin for host apps that already install optional peers
|
|
23
|
-
* (Excelrs / Spriny via the package root export).
|
|
24
|
-
* Prefer `powr-sdk-web/dist/admin` in lean apps (Ampy Ops) to avoid monaco/lucide.
|
|
21
|
+
/**
|
|
22
|
+
* Full PowrBaseAdmin for host apps that already install optional peers
|
|
23
|
+
* (Excelrs / Spriny via the package root export).
|
|
24
|
+
* Prefer `powr-sdk-web/dist/admin` in lean apps (Ampy Ops) to avoid monaco/lucide.
|
|
25
25
|
*/
|
|
26
26
|
function PowrBaseAdminFull(props) {
|
|
27
27
|
var sectionLoaders = props.sectionLoaders,
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CORE_SECTION_LOADERS = void 0;
|
|
7
7
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
8
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
9
|
-
/**
|
|
10
|
-
* Core admin sections — no heavy optional peers (monaco / lucide / hot-toast).
|
|
11
|
-
* Safe for apps that only need Users (e.g. Ampy Ops).
|
|
9
|
+
/**
|
|
10
|
+
* Core admin sections — no heavy optional peers (monaco / lucide / hot-toast).
|
|
11
|
+
* Safe for apps that only need Users (e.g. Ampy Ops).
|
|
12
12
|
*/
|
|
13
13
|
var CORE_SECTION_LOADERS = exports.CORE_SECTION_LOADERS = {
|
|
14
14
|
users: function users() {
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = exports.OPTIONAL_SECTION_LOADERS = void 0;
|
|
7
7
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
8
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
9
|
-
/**
|
|
10
|
-
* Heavy admin sections. Import only from apps that install optional peers:
|
|
11
|
-
* lucide-react, @monaco-editor/react, react-hot-toast
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* import PowrBaseAdmin from 'powr-sdk-web/dist/admin';
|
|
15
|
-
* import { OPTIONAL_SECTION_LOADERS } from 'powr-sdk-web/dist/admin/optionalSectionLoaders';
|
|
16
|
-
* <PowrBaseAdmin sections={['Users','Functions']} sectionLoaders={OPTIONAL_SECTION_LOADERS} />
|
|
9
|
+
/**
|
|
10
|
+
* Heavy admin sections. Import only from apps that install optional peers:
|
|
11
|
+
* lucide-react, @monaco-editor/react, react-hot-toast
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import PowrBaseAdmin from 'powr-sdk-web/dist/admin';
|
|
15
|
+
* import { OPTIONAL_SECTION_LOADERS } from 'powr-sdk-web/dist/admin/optionalSectionLoaders';
|
|
16
|
+
* <PowrBaseAdmin sections={['Users','Functions']} sectionLoaders={OPTIONAL_SECTION_LOADERS} />
|
|
17
17
|
*/
|
|
18
18
|
var OPTIONAL_SECTION_LOADERS = exports.OPTIONAL_SECTION_LOADERS = {
|
|
19
19
|
functions: function functions() {
|
package/dist/auth/index.js
CHANGED
|
@@ -43,6 +43,10 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
43
43
|
requirePhoneVerification = _ref$requirePhoneVeri === void 0 ? true : _ref$requirePhoneVeri,
|
|
44
44
|
_ref$showForgotPasswo = _ref.showForgotPassword,
|
|
45
45
|
showForgotPassword = _ref$showForgotPasswo === void 0 ? true : _ref$showForgotPasswo,
|
|
46
|
+
_ref$passwordResetHel = _ref.passwordResetHelpUrl,
|
|
47
|
+
passwordResetHelpUrl = _ref$passwordResetHel === void 0 ? null : _ref$passwordResetHel,
|
|
48
|
+
_ref$passwordResetHel2 = _ref.passwordResetHelpLabel,
|
|
49
|
+
passwordResetHelpLabel = _ref$passwordResetHel2 === void 0 ? 'Forgot password? WhatsApp us' : _ref$passwordResetHel2,
|
|
46
50
|
_ref$completeProfileO = _ref.completeProfileOnLogin,
|
|
47
51
|
completeProfileOnLogin = _ref$completeProfileO === void 0 ? false : _ref$completeProfileO,
|
|
48
52
|
_ref$requireTerms = _ref.requireTerms,
|
|
@@ -871,13 +875,18 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
871
875
|
style: styles.checkbox
|
|
872
876
|
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
873
877
|
style: styles.checkboxText
|
|
874
|
-
}, "Remember me")),
|
|
878
|
+
}, "Remember me")), passwordResetHelpUrl ? /*#__PURE__*/_react["default"].createElement("a", {
|
|
879
|
+
href: passwordResetHelpUrl,
|
|
880
|
+
target: "_blank",
|
|
881
|
+
rel: "noopener noreferrer",
|
|
882
|
+
style: styles.forgotPasswordLink
|
|
883
|
+
}, passwordResetHelpLabel) : showForgotPassword ? /*#__PURE__*/_react["default"].createElement("button", {
|
|
875
884
|
type: "button",
|
|
876
885
|
onClick: function onClick() {
|
|
877
886
|
return setShowOtpOption(!showOtpOption);
|
|
878
887
|
},
|
|
879
888
|
style: styles.forgotPasswordLink
|
|
880
|
-
}, "Forgot password?")), isLogin && showForgotPassword && showOtpOption && /*#__PURE__*/_react["default"].createElement("div", {
|
|
889
|
+
}, "Forgot password?") : null), isLogin && !passwordResetHelpUrl && showForgotPassword && showOtpOption && /*#__PURE__*/_react["default"].createElement("div", {
|
|
881
890
|
style: styles.otpSection
|
|
882
891
|
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
883
892
|
style: styles.otpText
|
package/dist/calendar/index.js
CHANGED
|
@@ -101,8 +101,8 @@ function ChevronRight() {
|
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* Week strip + day picker (controlled). No data fetching — use anywhere you need a date range UI.
|
|
104
|
+
/**
|
|
105
|
+
* Week strip + day picker (controlled). No data fetching — use anywhere you need a date range UI.
|
|
106
106
|
*/
|
|
107
107
|
function PowrCalendarStrip(_ref) {
|
|
108
108
|
var selectedDate = _ref.selectedDate,
|
package/dist/session/index.js
CHANGED
|
@@ -29,16 +29,16 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
29
29
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
30
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
31
31
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
|
-
/**
|
|
33
|
-
* Powr session — the file every new app used to copy (`utils/store.ts`).
|
|
34
|
-
*
|
|
35
|
-
* Owns `localStorage['auth-store']` in the zustand-persist shape
|
|
36
|
-
* `{ state: { user, token }, version }` so:
|
|
37
|
-
* - `apiCall` (utils/auth.getAuthToken) keeps reading the bearer from it
|
|
38
|
-
* - apps that already run a zustand `auth-store` can pass `user`/`token`
|
|
39
|
-
* as props (controlled) and nothing moves.
|
|
40
|
-
*
|
|
41
|
-
* No zustand dependency. Plain React context.
|
|
32
|
+
/**
|
|
33
|
+
* Powr session — the file every new app used to copy (`utils/store.ts`).
|
|
34
|
+
*
|
|
35
|
+
* Owns `localStorage['auth-store']` in the zustand-persist shape
|
|
36
|
+
* `{ state: { user, token }, version }` so:
|
|
37
|
+
* - `apiCall` (utils/auth.getAuthToken) keeps reading the bearer from it
|
|
38
|
+
* - apps that already run a zustand `auth-store` can pass `user`/`token`
|
|
39
|
+
* as props (controlled) and nothing moves.
|
|
40
|
+
*
|
|
41
|
+
* No zustand dependency. Plain React context.
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
var POWR_SESSION_STORAGE_KEY = exports.POWR_SESSION_STORAGE_KEY = "auth-store";
|
|
@@ -111,14 +111,14 @@ var PowrSessionContext = /*#__PURE__*/(0, _react.createContext)(_objectSpread(_o
|
|
|
111
111
|
clear: function clear() {}
|
|
112
112
|
}));
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
* @param {object} props
|
|
116
|
-
* @param {object|null} [props.user] - Controlled mode: app's own store is truth.
|
|
117
|
-
* @param {string|null} [props.token] - Controlled mode.
|
|
118
|
-
* @param {string|null} [props.refreshToken]
|
|
119
|
-
* @param {(session: {user, token, refreshToken}) => void} [props.onChange] - After setSession / clear.
|
|
120
|
-
* @param {() => void} [props.onLogout] - Controlled mode: clear your store here.
|
|
121
|
-
* @param {boolean} [props.persist=true] - Uncontrolled mode: write `auth-store`.
|
|
114
|
+
/**
|
|
115
|
+
* @param {object} props
|
|
116
|
+
* @param {object|null} [props.user] - Controlled mode: app's own store is truth.
|
|
117
|
+
* @param {string|null} [props.token] - Controlled mode.
|
|
118
|
+
* @param {string|null} [props.refreshToken]
|
|
119
|
+
* @param {(session: {user, token, refreshToken}) => void} [props.onChange] - After setSession / clear.
|
|
120
|
+
* @param {() => void} [props.onLogout] - Controlled mode: clear your store here.
|
|
121
|
+
* @param {boolean} [props.persist=true] - Uncontrolled mode: write `auth-store`.
|
|
122
122
|
*/
|
|
123
123
|
function PowrSessionProvider(_ref2) {
|
|
124
124
|
var userProp = _ref2.user,
|
|
@@ -36,16 +36,16 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
36
36
|
var config = require("../config");
|
|
37
37
|
var POWR_SHELL_MODES = exports.POWR_SHELL_MODES = Object.freeze(["sidebar", "topbar"]);
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* PowrBaseAppWrapper — the one root mount for a Powr web app.
|
|
41
|
-
*
|
|
42
|
-
* Replaces the files every new app copied: auth store, route guards, top bar /
|
|
43
|
-
* sidebar, login page glue, providers. Chrome + selectors live here; palette,
|
|
44
|
-
* presets, logo, nav items, product roles and public pages stay in the product.
|
|
45
|
-
*
|
|
46
|
-
* Guardrails: no colours of its own (every colour is `var(--powr-*)`), more
|
|
47
|
-
* than one shape (`sidebar` | `topbar`), no `next/*` import — `Link` and
|
|
48
|
-
* `pathname` come in as props, like `apiUrl` does elsewhere.
|
|
39
|
+
/**
|
|
40
|
+
* PowrBaseAppWrapper — the one root mount for a Powr web app.
|
|
41
|
+
*
|
|
42
|
+
* Replaces the files every new app copied: auth store, route guards, top bar /
|
|
43
|
+
* sidebar, login page glue, providers. Chrome + selectors live here; palette,
|
|
44
|
+
* presets, logo, nav items, product roles and public pages stay in the product.
|
|
45
|
+
*
|
|
46
|
+
* Guardrails: no colours of its own (every colour is `var(--powr-*)`), more
|
|
47
|
+
* than one shape (`sidebar` | `topbar`), no `next/*` import — `Link` and
|
|
48
|
+
* `pathname` come in as props, like `apiUrl` does elsewhere.
|
|
49
49
|
*/
|
|
50
50
|
function PowrBaseAppWrapper(props) {
|
|
51
51
|
var theme = props.theme,
|
package/dist/shell/styles.js
CHANGED
|
@@ -9,9 +9,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9
9
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
11
11
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
|
-
/**
|
|
13
|
-
* Shell styles. Every colour is a `--powr-*` var with today's neutral as the
|
|
14
|
-
* fallback — the wrapper has no palette of its own (clone-leak guardrail).
|
|
12
|
+
/**
|
|
13
|
+
* Shell styles. Every colour is a `--powr-*` var with today's neutral as the
|
|
14
|
+
* fallback — the wrapper has no palette of its own (clone-leak guardrail).
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
var v = exports.v = {
|
package/dist/sso/api.js
CHANGED
|
@@ -27,21 +27,21 @@ function safeNextPath(next) {
|
|
|
27
27
|
return fallback;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* Issue a one-time login code (caller must already be authenticated).
|
|
32
|
-
* Host `injectProjectId` needs destination `projectId` on the body.
|
|
33
|
-
* @param {string} apiUrl - Powr API base
|
|
34
|
-
* @param {string} bearerToken
|
|
35
|
-
* @param {{ projectId?: string }} [opts]
|
|
30
|
+
/**
|
|
31
|
+
* Issue a one-time login code (caller must already be authenticated).
|
|
32
|
+
* Host `injectProjectId` needs destination `projectId` on the body.
|
|
33
|
+
* @param {string} apiUrl - Powr API base
|
|
34
|
+
* @param {string} bearerToken
|
|
35
|
+
* @param {{ projectId?: string }} [opts]
|
|
36
36
|
*/
|
|
37
37
|
function issueLoginCode(_x, _x2) {
|
|
38
38
|
return _issueLoginCode.apply(this, arguments);
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Exchange loginId for session (same shape as /login).
|
|
42
|
-
* @param {string} apiUrl
|
|
43
|
-
* @param {string} loginId
|
|
44
|
-
* @param {{ projectId?: string }} [opts]
|
|
40
|
+
/**
|
|
41
|
+
* Exchange loginId for session (same shape as /login).
|
|
42
|
+
* @param {string} apiUrl
|
|
43
|
+
* @param {string} loginId
|
|
44
|
+
* @param {{ projectId?: string }} [opts]
|
|
45
45
|
*/
|
|
46
46
|
function _issueLoginCode() {
|
|
47
47
|
_issueLoginCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(apiUrl, bearerToken) {
|
package/dist/sso/index.js
CHANGED
|
@@ -145,22 +145,22 @@ var btnStyle = {
|
|
|
145
145
|
cursor: "pointer"
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
/**
|
|
149
|
-
* Cross-app SSO handoff UI (UrbanStall → Powr apps).
|
|
150
|
-
* Apps keep a thin `/sso` page that renders this with `apiUrl` + `onSuccess`.
|
|
151
|
-
*
|
|
152
|
-
* @param {object} props
|
|
153
|
-
* @param {string} [props.apiUrl] - Powr host. Defaults to https://powr-api.lawazia.tech
|
|
154
|
-
* @param {string} [props.projectId] - Destination Powr id. Defaults to NEXT_PUBLIC_PROJECT_ID
|
|
155
|
-
* @param {string} [props.appName]
|
|
156
|
-
* @param {boolean} [props.ready=true] - Wait (e.g. auth hydrate) before exchanging code
|
|
157
|
-
* @param {string} [props.loginHref="/login"]
|
|
158
|
-
* @param {string} [props.loginId] - Defaults to ?loginId=
|
|
159
|
-
* @param {string} [props.next] - Defaults to ?next=
|
|
160
|
-
* @param {(data: object, ctx: { next: string, safeNext: string }) => void | Promise<void>} props.onSuccess
|
|
161
|
-
* @param {string} [props.signingInTitle]
|
|
162
|
-
* @param {string} [props.signingInMessage]
|
|
163
|
-
* @param {string} [props.errorTitle]
|
|
148
|
+
/**
|
|
149
|
+
* Cross-app SSO handoff UI (UrbanStall → Powr apps).
|
|
150
|
+
* Apps keep a thin `/sso` page that renders this with `apiUrl` + `onSuccess`.
|
|
151
|
+
*
|
|
152
|
+
* @param {object} props
|
|
153
|
+
* @param {string} [props.apiUrl] - Powr host. Defaults to https://powr-api.lawazia.tech
|
|
154
|
+
* @param {string} [props.projectId] - Destination Powr id. Defaults to NEXT_PUBLIC_PROJECT_ID
|
|
155
|
+
* @param {string} [props.appName]
|
|
156
|
+
* @param {boolean} [props.ready=true] - Wait (e.g. auth hydrate) before exchanging code
|
|
157
|
+
* @param {string} [props.loginHref="/login"]
|
|
158
|
+
* @param {string} [props.loginId] - Defaults to ?loginId=
|
|
159
|
+
* @param {string} [props.next] - Defaults to ?next=
|
|
160
|
+
* @param {(data: object, ctx: { next: string, safeNext: string }) => void | Promise<void>} props.onSuccess
|
|
161
|
+
* @param {string} [props.signingInTitle]
|
|
162
|
+
* @param {string} [props.signingInMessage]
|
|
163
|
+
* @param {string} [props.errorTitle]
|
|
164
164
|
*/
|
|
165
165
|
function PowrBaseSso(_ref) {
|
|
166
166
|
var apiUrl = _ref.apiUrl,
|
|
@@ -79,10 +79,10 @@ function resolvePowrApiUrl(apiUrl) {
|
|
|
79
79
|
return "";
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
* @param {string} url
|
|
84
|
-
* @param {string[]|Array<{url?: string, projectId?: string}>} [origins] - sibling card list or origins
|
|
85
|
-
* @returns {{ origin: string, pathname: string, search: string, hash: string, projectId: string } | null}
|
|
82
|
+
/**
|
|
83
|
+
* @param {string} url
|
|
84
|
+
* @param {string[]|Array<{url?: string, projectId?: string}>} [origins] - sibling card list or origins
|
|
85
|
+
* @returns {{ origin: string, pathname: string, search: string, hash: string, projectId: string } | null}
|
|
86
86
|
*/
|
|
87
87
|
function matchPowrTarget(url, origins) {
|
|
88
88
|
var dest = parseDest(url);
|
|
@@ -98,13 +98,13 @@ function matchPowrTarget(url, origins) {
|
|
|
98
98
|
return dest;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/**
|
|
102
|
-
* @deprecated Product `/powr` URLs are gone. Pass `apiUrl` + the card list as `origins`.
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Product `/powr` URLs are gone. Pass `apiUrl` + the card list as `origins`.
|
|
103
103
|
*/
|
|
104
104
|
var DEFAULT_POWR_TARGETS = exports.DEFAULT_POWR_TARGETS = [];
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
* Build destination `/sso?loginId=` (+ optional `next`) on the sibling app.
|
|
106
|
+
/**
|
|
107
|
+
* Build destination `/sso?loginId=` (+ optional `next`) on the sibling app.
|
|
108
108
|
*/
|
|
109
109
|
function buildPowrSsoUrl(target, loginId) {
|
|
110
110
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
@@ -124,16 +124,16 @@ function openPlain(url) {
|
|
|
124
124
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
/**
|
|
128
|
-
* Issue a login code and navigate to `/sso?loginId=`.
|
|
129
|
-
* Host is the SDK default. Omit `apiUrl` unless this call is a real override.
|
|
130
|
-
*
|
|
131
|
-
* @param {string} url - Destination app URL (from the sibling card / banner)
|
|
132
|
-
* @param {string|null|undefined} token
|
|
133
|
-
* @param {object} [options]
|
|
134
|
-
* @param {string} [options.apiUrl] - Override host. Do not pass product `/powr`.
|
|
135
|
-
* @param {string} [options.projectId] - Destination Powr id (else from matched card)
|
|
136
|
-
* @param {string[]|Array<{url?: string, projectId?: string}>} [options.origins] - The card list
|
|
127
|
+
/**
|
|
128
|
+
* Issue a login code and navigate to `/sso?loginId=`.
|
|
129
|
+
* Host is the SDK default. Omit `apiUrl` unless this call is a real override.
|
|
130
|
+
*
|
|
131
|
+
* @param {string} url - Destination app URL (from the sibling card / banner)
|
|
132
|
+
* @param {string|null|undefined} token
|
|
133
|
+
* @param {object} [options]
|
|
134
|
+
* @param {string} [options.apiUrl] - Override host. Do not pass product `/powr`.
|
|
135
|
+
* @param {string} [options.projectId] - Destination Powr id (else from matched card)
|
|
136
|
+
* @param {string[]|Array<{url?: string, projectId?: string}>} [options.origins] - The card list
|
|
137
137
|
*/
|
|
138
138
|
function openPowrLogin(_x, _x2) {
|
|
139
139
|
return _openPowrLogin.apply(this, arguments);
|
|
@@ -54,25 +54,25 @@ function systemPrefersDark() {
|
|
|
54
54
|
return window.matchMedia(DARK_QUERY).matches;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* Root of the Powr theme. Mount once per app (the future `PowrBaseAppWrapper`
|
|
59
|
-
* mounts it for you). Structure (light / dark / density) is the SDK's;
|
|
60
|
-
* colours come from the product via `theme` and `presets`.
|
|
61
|
-
*
|
|
62
|
-
* With no props it writes today's neutral values, so SDK components render
|
|
63
|
-
* exactly as before.
|
|
64
|
-
*
|
|
65
|
-
* @param {object} props
|
|
66
|
-
* @param {object} [props.theme] - Product tokens. Flat `{ primary, bg, … }` (light) or `{ light: {…}, dark: {…} }`.
|
|
67
|
-
* @param {Array<{id: string, label?: string, tokens?: object, dark?: object}>} [props.presets] - Product-named presets users may pick.
|
|
68
|
-
* @param {"light"|"dark"|"system"} [props.scheme="light"] - Starting scheme; the user can change it (card 2 panel).
|
|
69
|
-
* @param {"comfortable"|"compact"} [props.density="comfortable"] - Starting density.
|
|
70
|
-
* @param {string} [props.preset] - Starting preset id.
|
|
71
|
-
* @param {string} [props.projectId] - Cache key scope. Defaults to NEXT_PUBLIC_PROJECT_ID.
|
|
72
|
-
* @param {boolean} [props.persist=true] - Cache choices in localStorage (cache, not truth — host save is card 3).
|
|
73
|
-
* @param {"root"|"scoped"} [props.attach="root"] - `root` writes vars on <html>; `scoped` wraps children in one div carrying the vars.
|
|
74
|
-
* @param {string} [props.className] - For `scoped` only.
|
|
75
|
-
* @param {(value: {scheme: string, density: string, preset: string|null}) => void} [props.onChange] - Fires when a selector changes.
|
|
57
|
+
/**
|
|
58
|
+
* Root of the Powr theme. Mount once per app (the future `PowrBaseAppWrapper`
|
|
59
|
+
* mounts it for you). Structure (light / dark / density) is the SDK's;
|
|
60
|
+
* colours come from the product via `theme` and `presets`.
|
|
61
|
+
*
|
|
62
|
+
* With no props it writes today's neutral values, so SDK components render
|
|
63
|
+
* exactly as before.
|
|
64
|
+
*
|
|
65
|
+
* @param {object} props
|
|
66
|
+
* @param {object} [props.theme] - Product tokens. Flat `{ primary, bg, … }` (light) or `{ light: {…}, dark: {…} }`.
|
|
67
|
+
* @param {Array<{id: string, label?: string, tokens?: object, dark?: object}>} [props.presets] - Product-named presets users may pick.
|
|
68
|
+
* @param {"light"|"dark"|"system"} [props.scheme="light"] - Starting scheme; the user can change it (card 2 panel).
|
|
69
|
+
* @param {"comfortable"|"compact"} [props.density="comfortable"] - Starting density.
|
|
70
|
+
* @param {string} [props.preset] - Starting preset id.
|
|
71
|
+
* @param {string} [props.projectId] - Cache key scope. Defaults to NEXT_PUBLIC_PROJECT_ID.
|
|
72
|
+
* @param {boolean} [props.persist=true] - Cache choices in localStorage (cache, not truth — host save is card 3).
|
|
73
|
+
* @param {"root"|"scoped"} [props.attach="root"] - `root` writes vars on <html>; `scoped` wraps children in one div carrying the vars.
|
|
74
|
+
* @param {string} [props.className] - For `scoped` only.
|
|
75
|
+
* @param {(value: {scheme: string, density: string, preset: string|null}) => void} [props.onChange] - Fires when a selector changes.
|
|
76
76
|
*/
|
|
77
77
|
function PowrThemeProvider(_ref) {
|
|
78
78
|
var theme = _ref.theme,
|
|
@@ -304,10 +304,10 @@ var UNMOUNTED_THEME = function () {
|
|
|
304
304
|
});
|
|
305
305
|
}();
|
|
306
306
|
|
|
307
|
-
/**
|
|
308
|
-
* Read the theme. Outside a provider returns the neutral defaults and no-op
|
|
309
|
-
* setters (`mounted: false`), so SDK components work in apps that have not
|
|
310
|
-
* adopted the theme yet.
|
|
307
|
+
/**
|
|
308
|
+
* Read the theme. Outside a provider returns the neutral defaults and no-op
|
|
309
|
+
* setters (`mounted: false`), so SDK components work in apps that have not
|
|
310
|
+
* adopted the theme yet.
|
|
311
311
|
*/
|
|
312
312
|
function usePowrTheme() {
|
|
313
313
|
var ctx = (0, _react.useContext)(PowrThemeContext);
|
|
@@ -24,16 +24,16 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
24
24
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
25
25
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
26
26
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
27
|
-
/**
|
|
28
|
-
* User-level theme selectors: scheme · density · product preset.
|
|
29
|
-
*
|
|
30
|
-
* Reads and writes through `usePowrTheme()`, so it needs a `PowrThemeProvider`
|
|
31
|
-
* above it. Legacy apps mount this inside their own Settings page; the
|
|
32
|
-
* wrapper opens it in a drawer. Presets come from the product — this panel
|
|
33
|
-
* never invents colours (no colour wheel).
|
|
34
|
-
*
|
|
35
|
-
* `onSave` is the hook for card 3 (host `/users/me/preferences`). Until then
|
|
36
|
-
* changes are live + cached in localStorage by the provider.
|
|
27
|
+
/**
|
|
28
|
+
* User-level theme selectors: scheme · density · product preset.
|
|
29
|
+
*
|
|
30
|
+
* Reads and writes through `usePowrTheme()`, so it needs a `PowrThemeProvider`
|
|
31
|
+
* above it. Legacy apps mount this inside their own Settings page; the
|
|
32
|
+
* wrapper opens it in a drawer. Presets come from the product — this panel
|
|
33
|
+
* never invents colours (no colour wheel).
|
|
34
|
+
*
|
|
35
|
+
* `onSave` is the hook for card 3 (host `/users/me/preferences`). Until then
|
|
36
|
+
* changes are live + cached in localStorage by the provider.
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
var SCHEME_LABELS = {
|
|
@@ -169,15 +169,15 @@ function presetSwatches(preset, dark) {
|
|
|
169
169
|
return [t.bg, t.surface, t.primary, t.text].filter(Boolean);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
/**
|
|
173
|
-
* @param {object} props
|
|
174
|
-
* @param {string} [props.title="Appearance"]
|
|
175
|
-
* @param {boolean} [props.showScheme=true]
|
|
176
|
-
* @param {boolean} [props.showDensity=true]
|
|
177
|
-
* @param {boolean} [props.showPresets=true] - Hidden automatically when the product passed no presets.
|
|
178
|
-
* @param {(value: {scheme, density, preset}) => void|Promise<void>} [props.onSave] - Card 3: host save. Shows a Save button when given.
|
|
179
|
-
* @param {boolean} [props.saving]
|
|
180
|
-
* @param {string} [props.saveLabel="Save"]
|
|
172
|
+
/**
|
|
173
|
+
* @param {object} props
|
|
174
|
+
* @param {string} [props.title="Appearance"]
|
|
175
|
+
* @param {boolean} [props.showScheme=true]
|
|
176
|
+
* @param {boolean} [props.showDensity=true]
|
|
177
|
+
* @param {boolean} [props.showPresets=true] - Hidden automatically when the product passed no presets.
|
|
178
|
+
* @param {(value: {scheme, density, preset}) => void|Promise<void>} [props.onSave] - Card 3: host save. Shows a Save button when given.
|
|
179
|
+
* @param {boolean} [props.saving]
|
|
180
|
+
* @param {string} [props.saveLabel="Save"]
|
|
181
181
|
*/
|
|
182
182
|
function PowrThemeSettings(_ref2) {
|
|
183
183
|
var _ref2$title = _ref2.title,
|
package/dist/theme/host.js
CHANGED
|
@@ -19,13 +19,13 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
19
19
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
20
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
21
21
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
22
|
-
/**
|
|
23
|
-
* Theme preference on the Powr host — `GET/PUT /users/me/preferences`.
|
|
24
|
-
*
|
|
25
|
-
* localStorage is the cache before first paint; the host is the truth once
|
|
26
|
-
* the user is logged in. Pull once per token, apply what the host has, and
|
|
27
|
-
* write on Save. Same thesis as login: host stores, SDK reads/writes,
|
|
28
|
-
* products omit `apiUrl`.
|
|
22
|
+
/**
|
|
23
|
+
* Theme preference on the Powr host — `GET/PUT /users/me/preferences`.
|
|
24
|
+
*
|
|
25
|
+
* localStorage is the cache before first paint; the host is the truth once
|
|
26
|
+
* the user is logged in. Pull once per token, apply what the host has, and
|
|
27
|
+
* write on Save. Same thesis as login: host stores, SDK reads/writes,
|
|
28
|
+
* products omit `apiUrl`.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
var ENDPOINT = "/users/me/preferences";
|
|
@@ -80,15 +80,15 @@ function _fetchThemePreference() {
|
|
|
80
80
|
function saveThemePreference() {
|
|
81
81
|
return _saveThemePreference.apply(this, arguments);
|
|
82
82
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Keep the mounted `PowrThemeProvider` in sync with the host for one user.
|
|
85
|
-
*
|
|
86
|
-
* @param {object} opts
|
|
87
|
-
* @param {string|null} [opts.token] - Powr JWT. No token → nothing happens (cache only).
|
|
88
|
-
* @param {string} [opts.apiUrl] - Leave unset; SDK default host.
|
|
89
|
-
* @param {string} [opts.projectId] - Defaults to NEXT_PUBLIC_PROJECT_ID.
|
|
90
|
-
* @param {boolean} [opts.enabled=true]
|
|
91
|
-
* @returns {{ loaded: boolean, saving: boolean, error: string|null, save: (theme?) => Promise<void>, refresh: () => Promise<void> }}
|
|
83
|
+
/**
|
|
84
|
+
* Keep the mounted `PowrThemeProvider` in sync with the host for one user.
|
|
85
|
+
*
|
|
86
|
+
* @param {object} opts
|
|
87
|
+
* @param {string|null} [opts.token] - Powr JWT. No token → nothing happens (cache only).
|
|
88
|
+
* @param {string} [opts.apiUrl] - Leave unset; SDK default host.
|
|
89
|
+
* @param {string} [opts.projectId] - Defaults to NEXT_PUBLIC_PROJECT_ID.
|
|
90
|
+
* @param {boolean} [opts.enabled=true]
|
|
91
|
+
* @returns {{ loaded: boolean, saving: boolean, error: string|null, save: (theme?) => Promise<void>, refresh: () => Promise<void> }}
|
|
92
92
|
*/
|
|
93
93
|
function _saveThemePreference() {
|
|
94
94
|
_saveThemePreference = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
package/dist/theme/initScript.js
CHANGED
|
@@ -13,22 +13,22 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
13
13
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
14
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
15
15
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
-
/**
|
|
17
|
-
* No-flash head script.
|
|
18
|
-
*
|
|
19
|
-
* `PowrThemeProvider` applies vars in an effect, so a cached dark user sees one
|
|
20
|
-
* light frame on hard reload. This returns a tiny inline script that reads the
|
|
21
|
-
* same localStorage cache and paints `<html>` before React runs.
|
|
22
|
-
*
|
|
23
|
-
* No logic is duplicated: the css-var table for every scheme × preset × density
|
|
24
|
-
* is precomputed here with `resolvePowrTokens` and embedded. The script only
|
|
25
|
-
* looks up.
|
|
26
|
-
*
|
|
27
|
-
* Next (app router) root layout:
|
|
28
|
-
* <head><script dangerouslySetInnerHTML={{ __html: powrThemeInitScript({ projectId, theme, presets }) }} /></head>
|
|
29
|
-
*
|
|
30
|
-
* @param {object} opts - The same `theme` / `presets` / `projectId` you give the provider.
|
|
31
|
-
* @returns {string} JavaScript source.
|
|
16
|
+
/**
|
|
17
|
+
* No-flash head script.
|
|
18
|
+
*
|
|
19
|
+
* `PowrThemeProvider` applies vars in an effect, so a cached dark user sees one
|
|
20
|
+
* light frame on hard reload. This returns a tiny inline script that reads the
|
|
21
|
+
* same localStorage cache and paints `<html>` before React runs.
|
|
22
|
+
*
|
|
23
|
+
* No logic is duplicated: the css-var table for every scheme × preset × density
|
|
24
|
+
* is precomputed here with `resolvePowrTokens` and embedded. The script only
|
|
25
|
+
* looks up.
|
|
26
|
+
*
|
|
27
|
+
* Next (app router) root layout:
|
|
28
|
+
* <head><script dangerouslySetInnerHTML={{ __html: powrThemeInitScript({ projectId, theme, presets }) }} /></head>
|
|
29
|
+
*
|
|
30
|
+
* @param {object} opts - The same `theme` / `presets` / `projectId` you give the provider.
|
|
31
|
+
* @returns {string} JavaScript source.
|
|
32
32
|
*/
|
|
33
33
|
function powrThemeInitScript() {
|
|
34
34
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
package/dist/theme/tokens.js
CHANGED
|
@@ -25,20 +25,20 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
25
25
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
26
26
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
27
27
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
28
|
-
/**
|
|
29
|
-
* Powr theme token contract.
|
|
30
|
-
*
|
|
31
|
-
* Ten CSS variables every Powr web app and every SDK component share.
|
|
32
|
-
* The SDK ships structure only (light / dark scheme, density). Colours that
|
|
33
|
-
* make a product look like itself come from the product via `theme` and
|
|
34
|
-
* `presets`.
|
|
35
|
-
*
|
|
36
|
-
* Components read `var(--powr-<name>, <today's hex>)` inline — no CSS file,
|
|
37
|
-
* no Tailwind colour classes, so a bump changes nothing until a product
|
|
38
|
-
* mounts `PowrThemeProvider`.
|
|
39
|
-
*
|
|
40
|
-
* Vocabulary: `scheme` = light / dark / system. `mode` is reserved for the
|
|
41
|
-
* layout shape (`sidebar` / `topbar` …) that `PowrBaseAppWrapper` owns.
|
|
28
|
+
/**
|
|
29
|
+
* Powr theme token contract.
|
|
30
|
+
*
|
|
31
|
+
* Ten CSS variables every Powr web app and every SDK component share.
|
|
32
|
+
* The SDK ships structure only (light / dark scheme, density). Colours that
|
|
33
|
+
* make a product look like itself come from the product via `theme` and
|
|
34
|
+
* `presets`.
|
|
35
|
+
*
|
|
36
|
+
* Components read `var(--powr-<name>, <today's hex>)` inline — no CSS file,
|
|
37
|
+
* no Tailwind colour classes, so a bump changes nothing until a product
|
|
38
|
+
* mounts `PowrThemeProvider`.
|
|
39
|
+
*
|
|
40
|
+
* Vocabulary: `scheme` = light / dark / system. `mode` is reserved for the
|
|
41
|
+
* layout shape (`sidebar` / `topbar` …) that `PowrBaseAppWrapper` owns.
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
/** token key → CSS variable (without the `--powr-` prefix). */
|
|
@@ -103,9 +103,9 @@ var BASE_BY_SCHEME = {
|
|
|
103
103
|
dark: DARK_POWR_TOKENS
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
* `powrVar("primary", "#2563eb")` → `var(--powr-primary, #2563eb)`.
|
|
108
|
-
* Components use this so the fallback stays today's value.
|
|
106
|
+
/**
|
|
107
|
+
* `powrVar("primary", "#2563eb")` → `var(--powr-primary, #2563eb)`.
|
|
108
|
+
* Components use this so the fallback stays today's value.
|
|
109
109
|
*/
|
|
110
110
|
function powrVar(key, fallback) {
|
|
111
111
|
var name = POWR_TOKENS[key] || key;
|
|
@@ -130,9 +130,9 @@ function pickKnown(tokens) {
|
|
|
130
130
|
return out;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* Product `theme` may be flat (light only) or `{ light, dark }`.
|
|
135
|
-
* Returns the token overrides for one resolved scheme.
|
|
133
|
+
/**
|
|
134
|
+
* Product `theme` may be flat (light only) or `{ light, dark }`.
|
|
135
|
+
* Returns the token overrides for one resolved scheme.
|
|
136
136
|
*/
|
|
137
137
|
function themeForScheme(theme, scheme) {
|
|
138
138
|
if (!theme || _typeof(theme) !== "object") return {};
|
|
@@ -156,13 +156,13 @@ function normalizeDensity(density) {
|
|
|
156
156
|
return Object.prototype.hasOwnProperty.call(POWR_DENSITIES, density) ? density : DEFAULT_POWR_DENSITY;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
/**
|
|
160
|
-
* Pure resolver. Order: structural base (light/dark) ← product theme[scheme]
|
|
161
|
-
* ← chosen preset (`tokens` / `dark`) ← density.
|
|
162
|
-
*
|
|
163
|
-
* `scheme` must already be `light` or `dark` (resolve `system` first).
|
|
164
|
-
* Also used by the head init script (card 3) so the server and the client
|
|
165
|
-
* compute the same variables.
|
|
159
|
+
/**
|
|
160
|
+
* Pure resolver. Order: structural base (light/dark) ← product theme[scheme]
|
|
161
|
+
* ← chosen preset (`tokens` / `dark`) ← density.
|
|
162
|
+
*
|
|
163
|
+
* `scheme` must already be `light` or `dark` (resolve `system` first).
|
|
164
|
+
* Also used by the head init script (card 3) so the server and the client
|
|
165
|
+
* compute the same variables.
|
|
166
166
|
*/
|
|
167
167
|
function resolvePowrTokens() {
|
|
168
168
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
@@ -186,9 +186,9 @@ function resolvePowrTokens() {
|
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
/**
|
|
190
|
-
* `{ bg: "#fff" }` → `{ "--powr-bg": "#fff", "--powr-density": "1" }`.
|
|
191
|
-
* Safe to spread into a React `style` or to write on `document.documentElement`.
|
|
189
|
+
/**
|
|
190
|
+
* `{ bg: "#fff" }` → `{ "--powr-bg": "#fff", "--powr-density": "1" }`.
|
|
191
|
+
* Safe to spread into a React `style` or to write on `document.documentElement`.
|
|
192
192
|
*/
|
|
193
193
|
function tokensToCssVars(tokens, densityScale) {
|
|
194
194
|
var out = {};
|
|
@@ -8,8 +8,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _uploader = _interopRequireDefault(require("../../uploader"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
-
/**
|
|
12
|
-
* Shared attach modal used by thread (comments + chat). Uses PowrBaseUploader.
|
|
11
|
+
/**
|
|
12
|
+
* Shared attach modal used by thread (comments + chat). Uses PowrBaseUploader.
|
|
13
13
|
*/
|
|
14
14
|
var AttachModal = function AttachModal(_ref) {
|
|
15
15
|
var open = _ref.open,
|
|
@@ -7,9 +7,9 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
-
/**
|
|
11
|
-
* Composer: textarea, optional attach button, send button.
|
|
12
|
-
* variant 'message' = rectangular send button; 'comment' = pill style with play button.
|
|
10
|
+
/**
|
|
11
|
+
* Composer: textarea, optional attach button, send button.
|
|
12
|
+
* variant 'message' = rectangular send button; 'comment' = pill style with play button.
|
|
13
13
|
*/
|
|
14
14
|
var ThreadComposer = function ThreadComposer(_ref) {
|
|
15
15
|
var value = _ref.value,
|
|
@@ -16,9 +16,9 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
16
16
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
17
17
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
18
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19
|
-
/**
|
|
20
|
-
* Renders a single thread item. variant: 'message' = chat bubble (isOwn right), 'comment' = comment card.
|
|
21
|
-
* item: { id, content, senderName, timestamp, isOwn, files?, formattedTime? }
|
|
19
|
+
/**
|
|
20
|
+
* Renders a single thread item. variant: 'message' = chat bubble (isOwn right), 'comment' = comment card.
|
|
21
|
+
* item: { id, content, senderName, timestamp, isOwn, files?, formattedTime? }
|
|
22
22
|
*/
|
|
23
23
|
var ThreadItem = function ThreadItem(_ref) {
|
|
24
24
|
var item = _ref.item,
|
|
@@ -14,9 +14,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
14
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
16
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
-
/**
|
|
18
|
-
* items: array of { id, content, senderName, timestamp, isOwn, files?, formattedTime? }
|
|
19
|
-
* dateGroups: optional array of { date, items } when groupByDate is true
|
|
17
|
+
/**
|
|
18
|
+
* items: array of { id, content, senderName, timestamp, isOwn, files?, formattedTime? }
|
|
19
|
+
* dateGroups: optional array of { date, items } when groupByDate is true
|
|
20
20
|
*/
|
|
21
21
|
var ThreadList = function ThreadList(_ref) {
|
|
22
22
|
var items = _ref.items,
|
package/dist/thread/index.js
CHANGED
|
@@ -23,10 +23,10 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
23
23
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
24
24
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
25
25
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
26
|
-
/**
|
|
27
|
-
* Shared thread UI for chat messages and comments.
|
|
28
|
-
* items: array of { id, content, senderName, timestamp, isOwn, files?, formattedTime? }
|
|
29
|
-
* dateGroups: when groupByDate true, array of { date, items }
|
|
26
|
+
/**
|
|
27
|
+
* Shared thread UI for chat messages and comments.
|
|
28
|
+
* items: array of { id, content, senderName, timestamp, isOwn, files?, formattedTime? }
|
|
29
|
+
* dateGroups: when groupByDate true, array of { date, items }
|
|
30
30
|
*/
|
|
31
31
|
var PowrBaseThread = function PowrBaseThread(_ref) {
|
|
32
32
|
var _ref$items = _ref.items,
|
|
@@ -9,10 +9,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
9
9
|
// Match http(s) URLs; simple pattern for display
|
|
10
10
|
var URL_REGEX = /(https?:\/\/[^\s<]+)/g;
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Splits text and returns React nodes with URLs as clickable links.
|
|
14
|
-
* @param {string} text - Plain text that may contain URLs
|
|
15
|
-
* @returns {Array} Array of React elements (strings and <a> tags)
|
|
12
|
+
/**
|
|
13
|
+
* Splits text and returns React nodes with URLs as clickable links.
|
|
14
|
+
* @param {string} text - Plain text that may contain URLs
|
|
15
|
+
* @returns {Array} Array of React elements (strings and <a> tags)
|
|
16
16
|
*/
|
|
17
17
|
function linkify(text) {
|
|
18
18
|
if (!text || typeof text !== 'string') return null;
|
package/dist/utils/phone.js
CHANGED
|
@@ -71,9 +71,9 @@ function normalizePhone(input) {
|
|
|
71
71
|
return parsed ? parsed.format('E.164') : '';
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/**
|
|
75
|
-
* Normalize phone for storage. Salvages digit runs when input has trailing junk.
|
|
76
|
-
* Returns null when invalid — never returns raw input.
|
|
74
|
+
/**
|
|
75
|
+
* Normalize phone for storage. Salvages digit runs when input has trailing junk.
|
|
76
|
+
* Returns null when invalid — never returns raw input.
|
|
77
77
|
*/
|
|
78
78
|
function coercePhoneForStorage(input) {
|
|
79
79
|
var defaultCountry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_COUNTRY;
|
|
@@ -11,9 +11,9 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
11
11
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
12
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
13
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
-
/**
|
|
15
|
-
* `window.matchMedia` as a hook. SSR-safe: returns `fallback` until mounted,
|
|
16
|
-
* so server and first client render agree (no hydration mismatch).
|
|
14
|
+
/**
|
|
15
|
+
* `window.matchMedia` as a hook. SSR-safe: returns `fallback` until mounted,
|
|
16
|
+
* so server and first client render agree (no hydration mismatch).
|
|
17
17
|
*/
|
|
18
18
|
function useMediaQuery(query) {
|
|
19
19
|
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "powr-sdk-web",
|
|
3
|
-
"version": "6.2.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist"
|
|
7
|
-
],
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "babel src -d dist --copy-files",
|
|
10
|
-
"prepublishOnly": "npm run build"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"react",
|
|
14
|
-
"component",
|
|
15
|
-
"npm",
|
|
16
|
-
"file-upload",
|
|
17
|
-
"powrbase",
|
|
18
|
-
"comments"
|
|
19
|
-
],
|
|
20
|
-
"author": "Lawazia Tech",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/lawaziatech/powr-sdk-web.git"
|
|
25
|
-
},
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"@monaco-editor/react": "*",
|
|
28
|
-
"filepond": "*",
|
|
29
|
-
"lucide-react": "*",
|
|
30
|
-
"react": "*",
|
|
31
|
-
"react-dom": "*",
|
|
32
|
-
"react-hot-toast": "*",
|
|
33
|
-
"react-toastify": "*"
|
|
34
|
-
},
|
|
35
|
-
"peerDependenciesMeta": {
|
|
36
|
-
"@monaco-editor/react": {
|
|
37
|
-
"optional": true
|
|
38
|
-
},
|
|
39
|
-
"filepond": {
|
|
40
|
-
"optional": true
|
|
41
|
-
},
|
|
42
|
-
"lucide-react": {
|
|
43
|
-
"optional": true
|
|
44
|
-
},
|
|
45
|
-
"react-hot-toast": {
|
|
46
|
-
"optional": true
|
|
47
|
-
},
|
|
48
|
-
"react-toastify": {
|
|
49
|
-
"optional": true
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"axios": "^1.7.7",
|
|
54
|
-
"filepond": "*",
|
|
55
|
-
"firebase": "^12.2.1",
|
|
56
|
-
"libphonenumber-js": "^1.12.9",
|
|
57
|
-
"prop-types": "^15.8.1",
|
|
58
|
-
"react-filepond": "^7.1.2",
|
|
59
|
-
"react-hook-form": "^7.58.0"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@babel/cli": "^7.24.1",
|
|
63
|
-
"@babel/core": "^7.24.4",
|
|
64
|
-
"@babel/preset-env": "^7.24.4",
|
|
65
|
-
"@babel/preset-react": "^7.24.1"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "powr-sdk-web",
|
|
3
|
+
"version": "6.2.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "babel src -d dist --copy-files",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"react",
|
|
14
|
+
"component",
|
|
15
|
+
"npm",
|
|
16
|
+
"file-upload",
|
|
17
|
+
"powrbase",
|
|
18
|
+
"comments"
|
|
19
|
+
],
|
|
20
|
+
"author": "Lawazia Tech",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/lawaziatech/powr-sdk-web.git"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@monaco-editor/react": "*",
|
|
28
|
+
"filepond": "*",
|
|
29
|
+
"lucide-react": "*",
|
|
30
|
+
"react": "*",
|
|
31
|
+
"react-dom": "*",
|
|
32
|
+
"react-hot-toast": "*",
|
|
33
|
+
"react-toastify": "*"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"@monaco-editor/react": {
|
|
37
|
+
"optional": true
|
|
38
|
+
},
|
|
39
|
+
"filepond": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"lucide-react": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"react-hot-toast": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"react-toastify": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"axios": "^1.7.7",
|
|
54
|
+
"filepond": "*",
|
|
55
|
+
"firebase": "^12.2.1",
|
|
56
|
+
"libphonenumber-js": "^1.12.9",
|
|
57
|
+
"prop-types": "^15.8.1",
|
|
58
|
+
"react-filepond": "^7.1.2",
|
|
59
|
+
"react-hook-form": "^7.58.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@babel/cli": "^7.24.1",
|
|
63
|
+
"@babel/core": "^7.24.4",
|
|
64
|
+
"@babel/preset-env": "^7.24.4",
|
|
65
|
+
"@babel/preset-react": "^7.24.1"
|
|
66
|
+
}
|
|
67
|
+
}
|