@streamoid/settings 0.15.1 → 0.16.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/dist/index.d.mts +69 -5
- package/dist/index.d.ts +69 -5
- package/dist/index.js +469 -294
- package/dist/index.mjs +470 -294
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2995,7 +2995,8 @@ var APP_ACCESS_MARKS = {
|
|
|
2995
2995
|
"artifax": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M6%2029L15%207H21L30%2029H25.7L23.5%2023H12.5L10.3%2029ZM14%2019H22L18%209Z%22%2F%3E%3C%2Fsvg%3E%0A",
|
|
2996
2996
|
"photogenix": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M10%2029V7H20C25%207%2028%2010%2028%2014.5S25%2022%2020%2022H14V29ZM14%2011V18H20C22.7%2018%2024%2017%2024%2014.5S22.7%2011%2020%2011Z%22%2F%3E%3C%2Fsvg%3E%0A",
|
|
2997
2997
|
"catalogix": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M30%2012L26.5%2014C24.8%2011.5%2022.3%2010%2018.5%2010C12.7%2010%209%2013%209%2018S12.7%2026%2018.5%2026C22.3%2026%2024.8%2024.5%2026.5%2022L30%2024C27.7%2028%2023.7%2030%2018.5%2030C10.5%2030%205%2025.3%205%2018S10.5%206%2018.5%206C23.7%206%2027.7%208%2030%2012Z%22%2F%3E%3C%2Fsvg%3E%0A",
|
|
2998
|
-
"returns": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20transform%3D%22translate%288.034%207%29%20scale%280.782%29%22%20d%3D%22M4.536%2028.14H0V0H14.616C21%200%2024.948%203.024%2024.948%208.274C24.948%2012.936%2021.882%2015.792%2016.59%2016.086V16.38C18.774%2016.968%2019.782%2018.228%2020.79%2019.992L25.494%2028.14H20.286L15.792%2020.37C14.532%2018.144%2013.23%2017.22%209.702%2017.22H4.536V28.14ZM4.536%204.074V13.734H14.574C18.354%2013.734%2020.244%2012.432%2020.244%208.904C20.244%205.46%2018.354%204.074%2014.574%204.074H4.536Z%22%2F%3E%3C%2Fsvg%3E%0A"
|
|
2998
|
+
"returns": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20transform%3D%22translate%288.034%207%29%20scale%280.782%29%22%20d%3D%22M4.536%2028.14H0V0H14.616C21%200%2024.948%203.024%2024.948%208.274C24.948%2012.936%2021.882%2015.792%2016.59%2016.086V16.38C18.774%2016.968%2019.782%2018.228%2020.79%2019.992L25.494%2028.14H20.286L15.792%2020.37C14.532%2018.144%2013.23%2017.22%209.702%2017.22H4.536V28.14ZM4.536%204.074V13.734H14.574C18.354%2013.734%2020.244%2012.432%2020.244%208.904C20.244%205.46%2018.354%204.074%2014.574%204.074H4.536Z%22%2F%3E%3C%2Fsvg%3E%0A",
|
|
2999
|
+
"tactix": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M5%207H31V11H20V29H16V11H5Z%22%2F%3E%3C%2Fsvg%3E%0A"
|
|
2999
3000
|
};
|
|
3000
3001
|
|
|
3001
3002
|
// src/teams-content.tsx
|
|
@@ -3013,6 +3014,7 @@ import {
|
|
|
3013
3014
|
SiconClose as SiconClose2,
|
|
3014
3015
|
SiconArrowLeftRight,
|
|
3015
3016
|
SiconArtifacts,
|
|
3017
|
+
SiconChartBar,
|
|
3016
3018
|
SiconPhotogenix,
|
|
3017
3019
|
SiconSearch
|
|
3018
3020
|
} from "@streamoid/icons";
|
|
@@ -3034,6 +3036,7 @@ var svg_rodctpja6f_default = {
|
|
|
3034
3036
|
// src/team-types.ts
|
|
3035
3037
|
var APP_KEYS = [
|
|
3036
3038
|
"artifax",
|
|
3039
|
+
"tactix",
|
|
3037
3040
|
"photogenix",
|
|
3038
3041
|
"returns",
|
|
3039
3042
|
"catalogix"
|
|
@@ -3043,11 +3046,27 @@ var DEFAULT_PERMISSIONS = {
|
|
|
3043
3046
|
photogenix: true,
|
|
3044
3047
|
catalogix: true,
|
|
3045
3048
|
returns: true,
|
|
3049
|
+
tactix: true,
|
|
3046
3050
|
canUseCredits: true,
|
|
3047
3051
|
canInviteUser: true,
|
|
3048
3052
|
role: "admin",
|
|
3049
3053
|
catalogixStores: []
|
|
3050
3054
|
};
|
|
3055
|
+
function parseInviteEmails(input) {
|
|
3056
|
+
const emails = [];
|
|
3057
|
+
const invalid = [];
|
|
3058
|
+
for (const raw of input.split(/[\s,;]+/)) {
|
|
3059
|
+
const token = raw.trim();
|
|
3060
|
+
if (!token) continue;
|
|
3061
|
+
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(token)) {
|
|
3062
|
+
const email = token.toLowerCase();
|
|
3063
|
+
if (!emails.includes(email)) emails.push(email);
|
|
3064
|
+
} else if (!invalid.includes(token)) {
|
|
3065
|
+
invalid.push(token);
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
return { emails, invalid };
|
|
3069
|
+
}
|
|
3051
3070
|
|
|
3052
3071
|
// src/invite-update-modal.tsx
|
|
3053
3072
|
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -3168,7 +3187,8 @@ function InviteUpdateModal({
|
|
|
3168
3187
|
initialOrganizationStanding = "guest",
|
|
3169
3188
|
organizationDomain: _organizationDomain,
|
|
3170
3189
|
allowAdminRole = true,
|
|
3171
|
-
onInvite
|
|
3190
|
+
onInvite,
|
|
3191
|
+
onInviteMany
|
|
3172
3192
|
}) {
|
|
3173
3193
|
useOverlayOpen(open, onClose);
|
|
3174
3194
|
const [emailValue, setEmailValue] = useState7("");
|
|
@@ -3187,6 +3207,8 @@ function InviteUpdateModal({
|
|
|
3187
3207
|
!hiddenApps.includes("catalogix")
|
|
3188
3208
|
);
|
|
3189
3209
|
const [returnsOn, setReturnsOn] = useState7(!hiddenApps.includes("returns"));
|
|
3210
|
+
const [tactixOn, setTactixOn] = useState7(!hiddenApps.includes("tactix"));
|
|
3211
|
+
const [submitting, setSubmitting] = useState7(false);
|
|
3190
3212
|
const [storeSearch, setStoreSearch] = useState7("");
|
|
3191
3213
|
const [selectedStores, setSelectedStores] = useState7(/* @__PURE__ */ new Set());
|
|
3192
3214
|
const filteredStores = stores.filter(
|
|
@@ -3205,6 +3227,7 @@ function InviteUpdateModal({
|
|
|
3205
3227
|
);
|
|
3206
3228
|
setCatalogixOn(!hidden.has("catalogix") && initialPermissions.catalogix);
|
|
3207
3229
|
setReturnsOn(!hidden.has("returns") && initialPermissions.returns);
|
|
3230
|
+
setTactixOn(!hidden.has("tactix") && Boolean(initialPermissions.tactix));
|
|
3208
3231
|
setSelectedStores(
|
|
3209
3232
|
new Set(hidden.has("catalogix") ? [] : initialPermissions.catalogixStores)
|
|
3210
3233
|
);
|
|
@@ -3220,6 +3243,8 @@ function InviteUpdateModal({
|
|
|
3220
3243
|
setPhotogenixOn(!hidden.has("photogenix"));
|
|
3221
3244
|
setCatalogixOn(!hidden.has("catalogix"));
|
|
3222
3245
|
setReturnsOn(!hidden.has("returns"));
|
|
3246
|
+
setTactixOn(!hidden.has("tactix"));
|
|
3247
|
+
setSubmitting(false);
|
|
3223
3248
|
setStoreSearch("");
|
|
3224
3249
|
setSelectedStores(/* @__PURE__ */ new Set());
|
|
3225
3250
|
}
|
|
@@ -3227,7 +3252,8 @@ function InviteUpdateModal({
|
|
|
3227
3252
|
const adminLocked = mode === "invite" && !allowAdminRole;
|
|
3228
3253
|
if (!open) return null;
|
|
3229
3254
|
const isInvite = mode === "invite";
|
|
3230
|
-
const
|
|
3255
|
+
const parsedEmails = parseInviteEmails(emailValue);
|
|
3256
|
+
const hasEmail = parsedEmails.emails.length > 0 && parsedEmails.invalid.length === 0;
|
|
3231
3257
|
function markChanged() {
|
|
3232
3258
|
setHasChanges(true);
|
|
3233
3259
|
}
|
|
@@ -3237,12 +3263,13 @@ function InviteUpdateModal({
|
|
|
3237
3263
|
artifax: artifaxOn,
|
|
3238
3264
|
photogenix: photogenixOn,
|
|
3239
3265
|
returns: returnsOn,
|
|
3240
|
-
catalogix: catalogixOn
|
|
3266
|
+
catalogix: catalogixOn,
|
|
3267
|
+
tactix: tactixOn
|
|
3241
3268
|
};
|
|
3242
3269
|
const notLastShown = (key) => shownApps[shownApps.length - 1] !== key;
|
|
3243
3270
|
const appValue = (key) => role === "admin" || showsApp(key) ? appToggles[key] : false;
|
|
3244
3271
|
const grantsNoApp = role === "member" && shownApps.length > 0 && !shownApps.some((key) => appToggles[key]);
|
|
3245
|
-
const isSubmitDisabled = isInvite ? !hasEmail || grantsNoApp : !(allowSubmitWithoutChanges || hasChanges);
|
|
3272
|
+
const isSubmitDisabled = isInvite ? !hasEmail || grantsNoApp || submitting : !(allowSubmitWithoutChanges || hasChanges);
|
|
3246
3273
|
function toggleStore(storeId) {
|
|
3247
3274
|
setSelectedStores((prev) => {
|
|
3248
3275
|
const next = new Set(prev);
|
|
@@ -3348,6 +3375,7 @@ function InviteUpdateModal({
|
|
|
3348
3375
|
color: T6.primary
|
|
3349
3376
|
},
|
|
3350
3377
|
placeholder: "email@domain.in, email@domain.in, email@domain.in...",
|
|
3378
|
+
"aria-invalid": parsedEmails.invalid.length > 0,
|
|
3351
3379
|
value: emailValue,
|
|
3352
3380
|
onChange: (e) => setEmailValue(e.target.value)
|
|
3353
3381
|
}
|
|
@@ -3369,6 +3397,20 @@ function InviteUpdateModal({
|
|
|
3369
3397
|
}
|
|
3370
3398
|
) })
|
|
3371
3399
|
}
|
|
3400
|
+
),
|
|
3401
|
+
isInvite && parsedEmails.invalid.length > 0 && /* @__PURE__ */ jsx14(
|
|
3402
|
+
"span",
|
|
3403
|
+
{
|
|
3404
|
+
role: "alert",
|
|
3405
|
+
style: {
|
|
3406
|
+
fontFamily: T6.font,
|
|
3407
|
+
fontSize: T6.fsXs,
|
|
3408
|
+
fontWeight: 400,
|
|
3409
|
+
lineHeight: T6.lhXs,
|
|
3410
|
+
color: "var(--alias-text---icons-error)"
|
|
3411
|
+
},
|
|
3412
|
+
children: parsedEmails.invalid.length === 1 ? `Not a valid email: ${parsedEmails.invalid[0]}` : `Not valid emails: ${parsedEmails.invalid.join(", ")}`
|
|
3413
|
+
}
|
|
3372
3414
|
)
|
|
3373
3415
|
]
|
|
3374
3416
|
}
|
|
@@ -3803,6 +3845,101 @@ function InviteUpdateModal({
|
|
|
3803
3845
|
}
|
|
3804
3846
|
) })
|
|
3805
3847
|
] }) }),
|
|
3848
|
+
showsApp("tactix") && /* @__PURE__ */ jsx14(Fragment5, { children: /* @__PURE__ */ jsxs11("div", { className: "shrink-0 w-full relative", children: [
|
|
3849
|
+
notLastShown("tactix") && /* @__PURE__ */ jsx14(
|
|
3850
|
+
"div",
|
|
3851
|
+
{
|
|
3852
|
+
"aria-hidden": true,
|
|
3853
|
+
className: "absolute inset-0 pointer-events-none",
|
|
3854
|
+
style: {
|
|
3855
|
+
borderBottom: `1px solid ${T6.borderSubtle}`
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
),
|
|
3859
|
+
/* @__PURE__ */ jsx14("div", { className: "flex flex-row items-center size-full", children: /* @__PURE__ */ jsxs11(
|
|
3860
|
+
"div",
|
|
3861
|
+
{
|
|
3862
|
+
className: "flex items-center w-full",
|
|
3863
|
+
style: { padding: T6.sp3xl, gap: T6.spMd },
|
|
3864
|
+
children: [
|
|
3865
|
+
/* @__PURE__ */ jsxs11(
|
|
3866
|
+
"div",
|
|
3867
|
+
{
|
|
3868
|
+
className: "flex flex-1 min-w-0 items-center",
|
|
3869
|
+
style: { gap: T6.spXl },
|
|
3870
|
+
children: [
|
|
3871
|
+
/* @__PURE__ */ jsx14(
|
|
3872
|
+
"div",
|
|
3873
|
+
{
|
|
3874
|
+
className: "shrink-0 flex items-center",
|
|
3875
|
+
style: {
|
|
3876
|
+
background: T6.fillHover,
|
|
3877
|
+
borderRadius: T6.rXl,
|
|
3878
|
+
padding: T6.spMd
|
|
3879
|
+
},
|
|
3880
|
+
children: /* @__PURE__ */ jsx14(
|
|
3881
|
+
SiconChartBar,
|
|
3882
|
+
{
|
|
3883
|
+
className: "w-6 h-6",
|
|
3884
|
+
color: T6.primary
|
|
3885
|
+
}
|
|
3886
|
+
)
|
|
3887
|
+
}
|
|
3888
|
+
),
|
|
3889
|
+
/* @__PURE__ */ jsxs11(
|
|
3890
|
+
"div",
|
|
3891
|
+
{
|
|
3892
|
+
className: "flex flex-1 min-w-0 flex-col items-start overflow-hidden text-ellipsis whitespace-nowrap",
|
|
3893
|
+
style: { opacity: tactixOn ? 1 : 0.5 },
|
|
3894
|
+
children: [
|
|
3895
|
+
/* @__PURE__ */ jsx14(
|
|
3896
|
+
"p",
|
|
3897
|
+
{
|
|
3898
|
+
className: "w-full overflow-hidden shrink-0",
|
|
3899
|
+
style: {
|
|
3900
|
+
fontFamily: T6.font,
|
|
3901
|
+
fontSize: T6.fsSm,
|
|
3902
|
+
fontWeight: 500,
|
|
3903
|
+
lineHeight: T6.lhSm,
|
|
3904
|
+
color: T6.primary
|
|
3905
|
+
},
|
|
3906
|
+
children: "Tactix"
|
|
3907
|
+
}
|
|
3908
|
+
),
|
|
3909
|
+
/* @__PURE__ */ jsx14(
|
|
3910
|
+
"p",
|
|
3911
|
+
{
|
|
3912
|
+
className: "w-full overflow-hidden shrink-0",
|
|
3913
|
+
style: {
|
|
3914
|
+
fontFamily: T6.font,
|
|
3915
|
+
fontSize: T6.fsXs,
|
|
3916
|
+
fontWeight: 400,
|
|
3917
|
+
lineHeight: T6.lhXs,
|
|
3918
|
+
color: T6.tertiary
|
|
3919
|
+
},
|
|
3920
|
+
children: "Buying and planning"
|
|
3921
|
+
}
|
|
3922
|
+
)
|
|
3923
|
+
]
|
|
3924
|
+
}
|
|
3925
|
+
)
|
|
3926
|
+
]
|
|
3927
|
+
}
|
|
3928
|
+
),
|
|
3929
|
+
/* @__PURE__ */ jsx14(
|
|
3930
|
+
ToggleSwitch,
|
|
3931
|
+
{
|
|
3932
|
+
active: tactixOn,
|
|
3933
|
+
onClick: () => {
|
|
3934
|
+
setTactixOn(!tactixOn);
|
|
3935
|
+
markChanged();
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
)
|
|
3939
|
+
]
|
|
3940
|
+
}
|
|
3941
|
+
) })
|
|
3942
|
+
] }) }),
|
|
3806
3943
|
showsApp("photogenix") && /* @__PURE__ */ jsx14(Fragment5, { children: /* @__PURE__ */ jsxs11("div", { className: "shrink-0 w-full relative", children: [
|
|
3807
3944
|
notLastShown("photogenix") && /* @__PURE__ */ jsx14(
|
|
3808
3945
|
"div",
|
|
@@ -4317,18 +4454,27 @@ function InviteUpdateModal({
|
|
|
4317
4454
|
photogenix: appValue("photogenix"),
|
|
4318
4455
|
catalogix: appValue("catalogix"),
|
|
4319
4456
|
returns: appValue("returns"),
|
|
4457
|
+
tactix: appValue("tactix"),
|
|
4320
4458
|
// Stores ride on Catalogix, so they follow it: a
|
|
4321
4459
|
// hidden Catalogix grants no app and therefore no
|
|
4322
4460
|
// storefronts. Keeping them would leave a member
|
|
4323
4461
|
// scoped to stores in a product they cannot open.
|
|
4324
4462
|
catalogixStores: role === "admin" || showsApp("catalogix") ? Array.from(selectedStores) : []
|
|
4325
4463
|
};
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
)
|
|
4464
|
+
const standing = showOrganizationStanding ? orgStanding : void 0;
|
|
4465
|
+
if (isInvite && onInviteMany) {
|
|
4466
|
+
setSubmitting(true);
|
|
4467
|
+
Promise.resolve(
|
|
4468
|
+
onInviteMany(perms, parsedEmails.emails, standing)
|
|
4469
|
+
).then((result) => {
|
|
4470
|
+
if (result && result.failed.length > 0) {
|
|
4471
|
+
setEmailValue(result.failed.join(", "));
|
|
4472
|
+
}
|
|
4473
|
+
}).finally(() => setSubmitting(false));
|
|
4474
|
+
} else if (isInvite && onInvite) {
|
|
4475
|
+
for (const email of parsedEmails.emails) {
|
|
4476
|
+
onInvite(perms, email, standing);
|
|
4477
|
+
}
|
|
4332
4478
|
} else if (onSave) {
|
|
4333
4479
|
onSave(perms);
|
|
4334
4480
|
}
|
|
@@ -4563,6 +4709,7 @@ function appNameTokens(app) {
|
|
|
4563
4709
|
return ["artifax", "artifact", "artifacts", "artifex", "chat"];
|
|
4564
4710
|
if (app === "photogenix") return ["photogenix"];
|
|
4565
4711
|
if (app === "returns") return ["returns", "return"];
|
|
4712
|
+
if (app === "tactix") return ["tactix"];
|
|
4566
4713
|
return ["catalogix"];
|
|
4567
4714
|
}
|
|
4568
4715
|
function normalizeServiceName(value) {
|
|
@@ -4591,6 +4738,7 @@ function permissionServiceIds(services, permissions) {
|
|
|
4591
4738
|
if (serviceMatchesApp(s, "catalogix") && permissions.catalogix)
|
|
4592
4739
|
return true;
|
|
4593
4740
|
if (serviceMatchesApp(s, "returns") && permissions.returns) return true;
|
|
4741
|
+
if (serviceMatchesApp(s, "tactix") && permissions.tactix) return true;
|
|
4594
4742
|
return false;
|
|
4595
4743
|
}).map((s) => s._id);
|
|
4596
4744
|
}
|
|
@@ -4703,7 +4851,8 @@ function readInviteAppFlag(invRecord, app) {
|
|
|
4703
4851
|
],
|
|
4704
4852
|
photogenix: ["photogenix", "photogenixAccess"],
|
|
4705
4853
|
catalogix: ["catalogix", "catalogixAccess"],
|
|
4706
|
-
returns: ["returns", "return", "returnsAccess"]
|
|
4854
|
+
returns: ["returns", "return", "returnsAccess"],
|
|
4855
|
+
tactix: ["tactix", "tactixAccess"]
|
|
4707
4856
|
};
|
|
4708
4857
|
const containers = [invRecord];
|
|
4709
4858
|
for (const nestedKey of ["permissions", "permission", "access", "apps"]) {
|
|
@@ -4778,6 +4927,7 @@ function memberToTeamMember(m, services) {
|
|
|
4778
4927
|
const hasPhotogenix = isAdmin || userHasApp("photogenix");
|
|
4779
4928
|
const hasCatalogix = isAdmin || userHasApp("catalogix");
|
|
4780
4929
|
const hasReturns = isAdmin || userHasApp("returns");
|
|
4930
|
+
const hasTactix = isAdmin || userHasApp("tactix");
|
|
4781
4931
|
return {
|
|
4782
4932
|
id: m._id,
|
|
4783
4933
|
kind: "member",
|
|
@@ -4804,6 +4954,7 @@ function memberToTeamMember(m, services) {
|
|
|
4804
4954
|
photogenix: hasPhotogenix,
|
|
4805
4955
|
catalogix: hasCatalogix,
|
|
4806
4956
|
returns: hasReturns,
|
|
4957
|
+
tactix: hasTactix,
|
|
4807
4958
|
canUseCredits: m.creditAccess,
|
|
4808
4959
|
canInviteUser: m.inviteAccess,
|
|
4809
4960
|
role: m.role,
|
|
@@ -4822,14 +4973,17 @@ function inviteToTeamMember(inv, services) {
|
|
|
4822
4973
|
);
|
|
4823
4974
|
const derivedCatalogix = serviceNames.some((n) => matchesApp(n, "catalogix"));
|
|
4824
4975
|
const derivedReturns = serviceNames.some((n) => matchesApp(n, "returns"));
|
|
4976
|
+
const derivedTactix = serviceNames.some((n) => matchesApp(n, "tactix"));
|
|
4825
4977
|
const explicitArtifax = readInviteAppFlag(invRecord, "artifax");
|
|
4826
4978
|
const explicitPhotogenix = readInviteAppFlag(invRecord, "photogenix");
|
|
4827
4979
|
const explicitCatalogix = readInviteAppFlag(invRecord, "catalogix");
|
|
4828
4980
|
const explicitReturns = readInviteAppFlag(invRecord, "returns");
|
|
4981
|
+
const explicitTactix = readInviteAppFlag(invRecord, "tactix");
|
|
4829
4982
|
const artifaxFlag = Boolean(explicitArtifax) || derivedArtifax;
|
|
4830
4983
|
const photogenixFlag = Boolean(explicitPhotogenix) || derivedPhotogenix;
|
|
4831
4984
|
const catalogixFlag = Boolean(explicitCatalogix) || derivedCatalogix;
|
|
4832
4985
|
const returnsFlag = Boolean(explicitReturns) || derivedReturns;
|
|
4986
|
+
const tactixFlag = Boolean(explicitTactix) || derivedTactix;
|
|
4833
4987
|
const catalogixStores = uniqueNonEmpty([
|
|
4834
4988
|
...extractIdsFromMixedArray(invRecord.stores),
|
|
4835
4989
|
...extractIdsFromMixedArray(invRecord.storeIds)
|
|
@@ -4846,6 +5000,7 @@ function inviteToTeamMember(inv, services) {
|
|
|
4846
5000
|
photogenix: photogenixFlag,
|
|
4847
5001
|
catalogix: catalogixFlag,
|
|
4848
5002
|
returns: returnsFlag,
|
|
5003
|
+
tactix: tactixFlag,
|
|
4849
5004
|
canUseCredits: inv.creditAccess ?? false,
|
|
4850
5005
|
canInviteUser: inv.inviteAccess ?? false,
|
|
4851
5006
|
role: inv.role ?? "member",
|
|
@@ -4854,7 +5009,7 @@ function inviteToTeamMember(inv, services) {
|
|
|
4854
5009
|
};
|
|
4855
5010
|
}
|
|
4856
5011
|
function AccessIcons({ permissions }) {
|
|
4857
|
-
const apps = ["artifax", "photogenix", "catalogix", "returns"];
|
|
5012
|
+
const apps = ["artifax", "tactix", "photogenix", "catalogix", "returns"];
|
|
4858
5013
|
return /* @__PURE__ */ jsx16("div", { className: "flex items-center shrink-0", style: { gap: 6 }, children: apps.filter((app) => permissions[app]).map((app) => /* @__PURE__ */ jsx16(
|
|
4859
5014
|
"img",
|
|
4860
5015
|
{
|
|
@@ -5377,34 +5532,50 @@ function TeamsContent({
|
|
|
5377
5532
|
toast.error(msg);
|
|
5378
5533
|
}
|
|
5379
5534
|
};
|
|
5380
|
-
const
|
|
5535
|
+
const handleInviteMany = async (permissions, emails, organizationStanding) => {
|
|
5381
5536
|
if (!viewerCanInvite || permissions.role === "admin" && highestRole !== "admin") {
|
|
5382
5537
|
toast.error("You do not have permission to invite users");
|
|
5383
5538
|
closeModal();
|
|
5384
|
-
return;
|
|
5539
|
+
return { failed: [] };
|
|
5385
5540
|
}
|
|
5386
5541
|
const serviceIds = permissions.role === "admin" ? [] : permissionServiceIds(allServices, permissions);
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5542
|
+
const sent = [];
|
|
5543
|
+
const failed = [];
|
|
5544
|
+
for (const email of emails) {
|
|
5545
|
+
try {
|
|
5546
|
+
await api.inviteMember({
|
|
5547
|
+
email,
|
|
5548
|
+
creditAccess: permissions.canUseCredits,
|
|
5549
|
+
inviteAccess: permissions.canInviteUser,
|
|
5550
|
+
role: permissions.role,
|
|
5551
|
+
serviceIds,
|
|
5552
|
+
storeIds: permissions.catalogixStores || [],
|
|
5553
|
+
// Omitted when the control was never shown, which leaves the backend
|
|
5554
|
+
// deriving the standing from the invitee's email domain as before.
|
|
5555
|
+
...organizationStanding ? {
|
|
5556
|
+
organizationRole: organizationStanding === "colleague" ? "member" : "guest"
|
|
5557
|
+
} : {}
|
|
5558
|
+
});
|
|
5559
|
+
sent.push(email);
|
|
5560
|
+
} catch (err) {
|
|
5561
|
+
failed.push({ email, message: errorMessage(err, { method: "POST" }) });
|
|
5562
|
+
}
|
|
5407
5563
|
}
|
|
5564
|
+
if (sent.length === 1) toast.success(`Invitation sent to ${sent[0]}`);
|
|
5565
|
+
else if (sent.length > 1)
|
|
5566
|
+
toast.success(`Invitations sent to ${sent.length} people`);
|
|
5567
|
+
if (failed.length === 1) {
|
|
5568
|
+
toast.error(
|
|
5569
|
+
emails.length === 1 ? failed[0].message : `${failed[0].email}: ${failed[0].message}`
|
|
5570
|
+
);
|
|
5571
|
+
} else if (failed.length > 1) {
|
|
5572
|
+
toast.error(
|
|
5573
|
+
`${failed.length} invitations were not sent. ${failed[0].email}: ${failed[0].message}`
|
|
5574
|
+
);
|
|
5575
|
+
}
|
|
5576
|
+
if (sent.length > 0) await fetchData();
|
|
5577
|
+
if (failed.length === 0) closeModal();
|
|
5578
|
+
return { failed: failed.map((f) => f.email) };
|
|
5408
5579
|
};
|
|
5409
5580
|
const filteredActive = activeMembers.filter((m) => {
|
|
5410
5581
|
const q = searchQuery.toLowerCase();
|
|
@@ -5522,7 +5693,7 @@ function TeamsContent({
|
|
|
5522
5693
|
showOrganizationStanding: mayGrantOrgMembership,
|
|
5523
5694
|
organizationName: organizationName ?? orgCurrent?.name,
|
|
5524
5695
|
organizationDomain: workspaceOrgId && orgCurrent?.id === workspaceOrgId ? orgCurrent?.domain : void 0,
|
|
5525
|
-
|
|
5696
|
+
onInviteMany: handleInviteMany
|
|
5526
5697
|
}
|
|
5527
5698
|
)
|
|
5528
5699
|
] });
|
|
@@ -10611,6 +10782,34 @@ async function loadCurrentPlan(fetchCurrentPlan) {
|
|
|
10611
10782
|
return { subscription, entitlement, paid: hasPaidFeatures({ entitlement, subscription }) };
|
|
10612
10783
|
}
|
|
10613
10784
|
|
|
10785
|
+
// src/billing-layout.ts
|
|
10786
|
+
var BILLING_TABLE_MIN_HEIGHT = 300;
|
|
10787
|
+
var BILLING_TABLE_FRAME_STYLE = {
|
|
10788
|
+
flex: "1 0 auto",
|
|
10789
|
+
minHeight: BILLING_TABLE_MIN_HEIGHT,
|
|
10790
|
+
backgroundColor: "var(--alias-surface-base)",
|
|
10791
|
+
borderRadius: "var(--radius-3xl)",
|
|
10792
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10793
|
+
overflow: "clip"
|
|
10794
|
+
};
|
|
10795
|
+
var BILLING_TABLE_PAGER_STYLE = {
|
|
10796
|
+
position: "sticky",
|
|
10797
|
+
bottom: 0,
|
|
10798
|
+
zIndex: 2,
|
|
10799
|
+
backgroundColor: "var(--alias-surface-canvas)",
|
|
10800
|
+
paddingTop: "var(--spacing-xl)",
|
|
10801
|
+
paddingBottom: "var(--spacing-md)"
|
|
10802
|
+
};
|
|
10803
|
+
function productsForCountry(products, country) {
|
|
10804
|
+
const currency = country?.trim().toUpperCase() === "IN" ? "inr" : "usd";
|
|
10805
|
+
return products.map((product) => ({
|
|
10806
|
+
...product,
|
|
10807
|
+
prices: product.prices.filter(
|
|
10808
|
+
(price) => price.currency?.toLowerCase() === currency
|
|
10809
|
+
)
|
|
10810
|
+
})).filter((product) => product.prices.length > 0);
|
|
10811
|
+
}
|
|
10812
|
+
|
|
10614
10813
|
// src/usage-logs.ts
|
|
10615
10814
|
var USAGE_LOGS_PAGE_SIZE = 50;
|
|
10616
10815
|
var USAGE_LOGS_EXPORT_BATCH_SIZE = 100;
|
|
@@ -11554,7 +11753,6 @@ function BillingTabBar({
|
|
|
11554
11753
|
}
|
|
11555
11754
|
);
|
|
11556
11755
|
}
|
|
11557
|
-
var BILLING_TABLE_MIN_HEIGHT = 300;
|
|
11558
11756
|
function InvoiceHistoryTable({
|
|
11559
11757
|
invoices,
|
|
11560
11758
|
loading,
|
|
@@ -11628,64 +11826,51 @@ function InvoiceHistoryTable({
|
|
|
11628
11826
|
}
|
|
11629
11827
|
);
|
|
11630
11828
|
}
|
|
11631
|
-
return /* @__PURE__ */ jsxs26(
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11829
|
+
return /* @__PURE__ */ jsxs26("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
|
|
11830
|
+
/* @__PURE__ */ jsx29(
|
|
11831
|
+
"div",
|
|
11832
|
+
{
|
|
11833
|
+
style: {
|
|
11834
|
+
position: "sticky",
|
|
11835
|
+
top: 0,
|
|
11836
|
+
zIndex: 1,
|
|
11837
|
+
backgroundColor: "var(--alias-surface-base)"
|
|
11838
|
+
},
|
|
11839
|
+
children: /* @__PURE__ */ jsx29(ScBillingHistoryHeader, {})
|
|
11840
|
+
}
|
|
11841
|
+
),
|
|
11842
|
+
invoices.length === 0 && /* @__PURE__ */ jsx29(
|
|
11843
|
+
"div",
|
|
11844
|
+
{
|
|
11845
|
+
className: "flex items-center justify-center w-full",
|
|
11846
|
+
style: { padding: "var(--spacing-6xl)" },
|
|
11847
|
+
children: /* @__PURE__ */ jsx29(
|
|
11848
|
+
"span",
|
|
11645
11849
|
{
|
|
11646
11850
|
style: {
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11851
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
11852
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
11853
|
+
fontWeight: 400,
|
|
11854
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
11855
|
+
color: "var(--alias-text---icons-muted)"
|
|
11651
11856
|
},
|
|
11652
|
-
children:
|
|
11653
|
-
}
|
|
11654
|
-
),
|
|
11655
|
-
invoices.length === 0 && /* @__PURE__ */ jsx29(
|
|
11656
|
-
"div",
|
|
11657
|
-
{
|
|
11658
|
-
className: "flex items-center justify-center w-full",
|
|
11659
|
-
style: { padding: "var(--spacing-6xl)" },
|
|
11660
|
-
children: /* @__PURE__ */ jsx29(
|
|
11661
|
-
"span",
|
|
11662
|
-
{
|
|
11663
|
-
style: {
|
|
11664
|
-
fontFamily: "var(--font-family-font-family-body)",
|
|
11665
|
-
fontSize: "var(--font-size-font-size-sm)",
|
|
11666
|
-
fontWeight: 400,
|
|
11667
|
-
lineHeight: "var(--line-height-line-height-sm)",
|
|
11668
|
-
color: "var(--alias-text---icons-muted)"
|
|
11669
|
-
},
|
|
11670
|
-
children: "No invoices found"
|
|
11671
|
-
}
|
|
11672
|
-
)
|
|
11857
|
+
children: "No invoices found"
|
|
11673
11858
|
}
|
|
11674
|
-
)
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
);
|
|
11859
|
+
)
|
|
11860
|
+
}
|
|
11861
|
+
),
|
|
11862
|
+
invoices.map((inv) => /* @__PURE__ */ jsx29(
|
|
11863
|
+
ScBillingHistoryTableList,
|
|
11864
|
+
{
|
|
11865
|
+
invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
|
|
11866
|
+
amount: inv.amountPaid != null ? `${currencySymbol}${inv.amountPaid.toFixed(2)}` : `${currencySymbol}${(inv.amount / 100).toFixed(2)}`,
|
|
11867
|
+
date: formatDate3(inv.createdAt),
|
|
11868
|
+
downloadLabel: "Download invoice",
|
|
11869
|
+
onClick: (e) => handleRowClick(e, inv)
|
|
11870
|
+
},
|
|
11871
|
+
inv._id
|
|
11872
|
+
))
|
|
11873
|
+
] });
|
|
11689
11874
|
}
|
|
11690
11875
|
function UsageLogsTable({
|
|
11691
11876
|
logs,
|
|
@@ -11767,181 +11952,168 @@ function UsageLogsTable({
|
|
|
11767
11952
|
}
|
|
11768
11953
|
);
|
|
11769
11954
|
}
|
|
11770
|
-
return /* @__PURE__ */ jsxs26(
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
"
|
|
11955
|
+
return /* @__PURE__ */ jsxs26("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
|
|
11956
|
+
/* @__PURE__ */ jsxs26(
|
|
11957
|
+
"div",
|
|
11958
|
+
{
|
|
11959
|
+
style: {
|
|
11960
|
+
position: "sticky",
|
|
11961
|
+
top: 0,
|
|
11962
|
+
zIndex: 1,
|
|
11963
|
+
background: "var(--alias-fill-neutral-neutral, #1a1a1a)",
|
|
11964
|
+
padding: "var(--spacing-xl, 0.75rem) var(--spacing-3xl, 1rem)",
|
|
11965
|
+
display: "flex",
|
|
11966
|
+
flexDirection: "row",
|
|
11967
|
+
gap: "var(--spacing-6xl, 1.5rem)",
|
|
11968
|
+
alignItems: "center"
|
|
11969
|
+
},
|
|
11970
|
+
children: [
|
|
11971
|
+
/* @__PURE__ */ jsx29(
|
|
11972
|
+
ScHeader,
|
|
11973
|
+
{
|
|
11974
|
+
text: "App",
|
|
11975
|
+
state: "none",
|
|
11976
|
+
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11977
|
+
}
|
|
11978
|
+
),
|
|
11979
|
+
/* @__PURE__ */ jsx29(
|
|
11980
|
+
ScHeader,
|
|
11981
|
+
{
|
|
11982
|
+
text: "Activity",
|
|
11983
|
+
state: "none",
|
|
11984
|
+
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11985
|
+
}
|
|
11986
|
+
),
|
|
11987
|
+
/* @__PURE__ */ jsx29(
|
|
11988
|
+
ScHeader,
|
|
11989
|
+
{
|
|
11990
|
+
text: "Used by",
|
|
11991
|
+
state: "none",
|
|
11992
|
+
style: { flexShrink: 0, width: "7.5rem" }
|
|
11993
|
+
}
|
|
11994
|
+
),
|
|
11995
|
+
showWorkspace && /* @__PURE__ */ jsx29(
|
|
11996
|
+
ScHeader,
|
|
11997
|
+
{
|
|
11998
|
+
text: "Workspace",
|
|
11999
|
+
state: "none",
|
|
12000
|
+
style: { flexShrink: 0, width: "9rem" }
|
|
12001
|
+
}
|
|
12002
|
+
),
|
|
12003
|
+
/* @__PURE__ */ jsx29(
|
|
12004
|
+
ScHeader,
|
|
12005
|
+
{
|
|
12006
|
+
text: "Date",
|
|
12007
|
+
state: "none",
|
|
12008
|
+
style: { flexShrink: 0, width: "7.5rem" }
|
|
12009
|
+
}
|
|
12010
|
+
),
|
|
12011
|
+
/* @__PURE__ */ jsx29(
|
|
12012
|
+
ScHeader,
|
|
12013
|
+
{
|
|
12014
|
+
text: "Credits",
|
|
12015
|
+
state: "none",
|
|
12016
|
+
style: {
|
|
12017
|
+
flexShrink: 0,
|
|
12018
|
+
width: "5rem",
|
|
12019
|
+
justifyContent: "flex-end"
|
|
12020
|
+
}
|
|
12021
|
+
}
|
|
12022
|
+
)
|
|
12023
|
+
]
|
|
12024
|
+
}
|
|
12025
|
+
),
|
|
12026
|
+
logs.length === 0 && /* @__PURE__ */ jsx29(
|
|
12027
|
+
"div",
|
|
12028
|
+
{
|
|
12029
|
+
className: "flex items-center justify-center w-full",
|
|
12030
|
+
style: { padding: "var(--spacing-6xl)" },
|
|
12031
|
+
children: /* @__PURE__ */ jsx29(
|
|
12032
|
+
"span",
|
|
11784
12033
|
{
|
|
11785
12034
|
style: {
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
display: "flex",
|
|
11792
|
-
flexDirection: "row",
|
|
11793
|
-
gap: "var(--spacing-6xl, 1.5rem)",
|
|
11794
|
-
alignItems: "center"
|
|
12035
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
12036
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
12037
|
+
fontWeight: 400,
|
|
12038
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
12039
|
+
color: "var(--alias-text---icons-muted)"
|
|
11795
12040
|
},
|
|
11796
|
-
children:
|
|
11797
|
-
/* @__PURE__ */ jsx29(
|
|
11798
|
-
ScHeader,
|
|
11799
|
-
{
|
|
11800
|
-
text: "App",
|
|
11801
|
-
state: "none",
|
|
11802
|
-
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11803
|
-
}
|
|
11804
|
-
),
|
|
11805
|
-
/* @__PURE__ */ jsx29(
|
|
11806
|
-
ScHeader,
|
|
11807
|
-
{
|
|
11808
|
-
text: "Activity",
|
|
11809
|
-
state: "none",
|
|
11810
|
-
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11811
|
-
}
|
|
11812
|
-
),
|
|
11813
|
-
/* @__PURE__ */ jsx29(
|
|
11814
|
-
ScHeader,
|
|
11815
|
-
{
|
|
11816
|
-
text: "Used by",
|
|
11817
|
-
state: "none",
|
|
11818
|
-
style: { flexShrink: 0, width: "7.5rem" }
|
|
11819
|
-
}
|
|
11820
|
-
),
|
|
11821
|
-
showWorkspace && /* @__PURE__ */ jsx29(
|
|
11822
|
-
ScHeader,
|
|
11823
|
-
{
|
|
11824
|
-
text: "Workspace",
|
|
11825
|
-
state: "none",
|
|
11826
|
-
style: { flexShrink: 0, width: "9rem" }
|
|
11827
|
-
}
|
|
11828
|
-
),
|
|
11829
|
-
/* @__PURE__ */ jsx29(
|
|
11830
|
-
ScHeader,
|
|
11831
|
-
{
|
|
11832
|
-
text: "Date",
|
|
11833
|
-
state: "none",
|
|
11834
|
-
style: { flexShrink: 0, width: "7.5rem" }
|
|
11835
|
-
}
|
|
11836
|
-
),
|
|
11837
|
-
/* @__PURE__ */ jsx29(
|
|
11838
|
-
ScHeader,
|
|
11839
|
-
{
|
|
11840
|
-
text: "Credits",
|
|
11841
|
-
state: "none",
|
|
11842
|
-
style: {
|
|
11843
|
-
flexShrink: 0,
|
|
11844
|
-
width: "5rem",
|
|
11845
|
-
justifyContent: "flex-end"
|
|
11846
|
-
}
|
|
11847
|
-
}
|
|
11848
|
-
)
|
|
11849
|
-
]
|
|
12041
|
+
children: "No usage logs found"
|
|
11850
12042
|
}
|
|
11851
|
-
)
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
12043
|
+
)
|
|
12044
|
+
}
|
|
12045
|
+
),
|
|
12046
|
+
logs.map((log) => {
|
|
12047
|
+
const userName = log.triggeredByUserId ? userMap[log.triggeredByUserId] || "Unknown" : "System";
|
|
12048
|
+
const app = log.service?.serviceGroupName || "\u2014";
|
|
12049
|
+
const usedBy = usedByWorkspaceKey(log, currentWorkspaceId);
|
|
12050
|
+
const workspaceLabel2 = usedBy ? `Used by ${usedByNames[usedBy.toLowerCase()] ?? "another workspace"}` : "This workspace";
|
|
12051
|
+
const activity = log.type === "return" ? "Returned Credits" : log.meta?.info || "Credit usage";
|
|
12052
|
+
const isPositive = log.type === "return" || log.type === "add";
|
|
12053
|
+
const signedAmount = `${isPositive ? "+" : "-"}${log.amount}`;
|
|
12054
|
+
const amountColor = isPositive ? "var(--alias-text---icons-success, #1aa055)" : "var(--alias-text---icons-error, #d11a1a)";
|
|
12055
|
+
const rowCellRegular = {
|
|
12056
|
+
color: "var(--alias-text---icons-primary, #f5f5f5)",
|
|
12057
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
12058
|
+
fontSize: "var(--font-size-font-size-sm, 0.875rem)",
|
|
12059
|
+
fontWeight: 400,
|
|
12060
|
+
lineHeight: "var(--line-height-line-height-sm, 1.25rem)",
|
|
12061
|
+
textOverflow: "ellipsis",
|
|
12062
|
+
overflow: "hidden",
|
|
12063
|
+
whiteSpace: "nowrap"
|
|
12064
|
+
};
|
|
12065
|
+
return /* @__PURE__ */ jsxs26(
|
|
12066
|
+
"div",
|
|
12067
|
+
{
|
|
12068
|
+
style: {
|
|
12069
|
+
borderBottom: "0.0625rem solid var(--alias-border-subtle, #242424)",
|
|
12070
|
+
padding: "8px 16px",
|
|
12071
|
+
display: "flex",
|
|
12072
|
+
flexDirection: "row",
|
|
12073
|
+
gap: "var(--spacing-6xl, 1.5rem)",
|
|
12074
|
+
alignItems: "center"
|
|
12075
|
+
},
|
|
12076
|
+
children: [
|
|
12077
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
12078
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
12079
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
12080
|
+
showWorkspace && /* @__PURE__ */ jsx29(
|
|
12081
|
+
"div",
|
|
11859
12082
|
{
|
|
11860
12083
|
style: {
|
|
12084
|
+
...rowCellRegular,
|
|
12085
|
+
width: "9rem",
|
|
12086
|
+
color: usedBy ? "var(--alias-text---icons-primary, #f5f5f5)" : "var(--alias-text---icons-muted)"
|
|
12087
|
+
},
|
|
12088
|
+
title: workspaceLabel2,
|
|
12089
|
+
children: workspaceLabel2
|
|
12090
|
+
}
|
|
12091
|
+
),
|
|
12092
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate3(log.createdAt) }),
|
|
12093
|
+
/* @__PURE__ */ jsx29(
|
|
12094
|
+
"div",
|
|
12095
|
+
{
|
|
12096
|
+
style: {
|
|
12097
|
+
width: "5rem",
|
|
12098
|
+
color: amountColor,
|
|
11861
12099
|
fontFamily: "var(--font-family-font-family-body)",
|
|
11862
|
-
fontSize: "var(--font-size-font-size-
|
|
11863
|
-
fontWeight:
|
|
11864
|
-
lineHeight: "var(--line-height-line-height-
|
|
11865
|
-
|
|
12100
|
+
fontSize: "var(--font-size-font-size-md, 1rem)",
|
|
12101
|
+
fontWeight: 600,
|
|
12102
|
+
lineHeight: "var(--line-height-line-height-md, 1.5rem)",
|
|
12103
|
+
textAlign: "right",
|
|
12104
|
+
textOverflow: "ellipsis",
|
|
12105
|
+
overflow: "hidden",
|
|
12106
|
+
whiteSpace: "nowrap"
|
|
11866
12107
|
},
|
|
11867
|
-
children:
|
|
12108
|
+
children: signedAmount
|
|
11868
12109
|
}
|
|
11869
12110
|
)
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
const workspaceLabel2 = usedBy ? `Used by ${usedByNames[usedBy.toLowerCase()] ?? "another workspace"}` : "This workspace";
|
|
11877
|
-
const activity = log.type === "return" ? "Returned Credits" : log.meta?.info || "Credit usage";
|
|
11878
|
-
const isPositive = log.type === "return" || log.type === "add";
|
|
11879
|
-
const signedAmount = `${isPositive ? "+" : "-"}${log.amount}`;
|
|
11880
|
-
const amountColor = isPositive ? "var(--alias-text---icons-success, #1aa055)" : "var(--alias-text---icons-error, #d11a1a)";
|
|
11881
|
-
const rowCellRegular = {
|
|
11882
|
-
color: "var(--alias-text---icons-primary, #f5f5f5)",
|
|
11883
|
-
fontFamily: "var(--font-family-font-family-body)",
|
|
11884
|
-
fontSize: "var(--font-size-font-size-sm, 0.875rem)",
|
|
11885
|
-
fontWeight: 400,
|
|
11886
|
-
lineHeight: "var(--line-height-line-height-sm, 1.25rem)",
|
|
11887
|
-
textOverflow: "ellipsis",
|
|
11888
|
-
overflow: "hidden",
|
|
11889
|
-
whiteSpace: "nowrap"
|
|
11890
|
-
};
|
|
11891
|
-
return /* @__PURE__ */ jsxs26(
|
|
11892
|
-
"div",
|
|
11893
|
-
{
|
|
11894
|
-
style: {
|
|
11895
|
-
borderBottom: "0.0625rem solid var(--alias-border-subtle, #242424)",
|
|
11896
|
-
padding: "8px 16px",
|
|
11897
|
-
display: "flex",
|
|
11898
|
-
flexDirection: "row",
|
|
11899
|
-
gap: "var(--spacing-6xl, 1.5rem)",
|
|
11900
|
-
alignItems: "center"
|
|
11901
|
-
},
|
|
11902
|
-
children: [
|
|
11903
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
11904
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
11905
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
11906
|
-
showWorkspace && /* @__PURE__ */ jsx29(
|
|
11907
|
-
"div",
|
|
11908
|
-
{
|
|
11909
|
-
style: {
|
|
11910
|
-
...rowCellRegular,
|
|
11911
|
-
width: "9rem",
|
|
11912
|
-
color: usedBy ? "var(--alias-text---icons-primary, #f5f5f5)" : "var(--alias-text---icons-muted)"
|
|
11913
|
-
},
|
|
11914
|
-
title: workspaceLabel2,
|
|
11915
|
-
children: workspaceLabel2
|
|
11916
|
-
}
|
|
11917
|
-
),
|
|
11918
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate3(log.createdAt) }),
|
|
11919
|
-
/* @__PURE__ */ jsx29(
|
|
11920
|
-
"div",
|
|
11921
|
-
{
|
|
11922
|
-
style: {
|
|
11923
|
-
width: "5rem",
|
|
11924
|
-
color: amountColor,
|
|
11925
|
-
fontFamily: "var(--font-family-font-family-body)",
|
|
11926
|
-
fontSize: "var(--font-size-font-size-md, 1rem)",
|
|
11927
|
-
fontWeight: 600,
|
|
11928
|
-
lineHeight: "var(--line-height-line-height-md, 1.5rem)",
|
|
11929
|
-
textAlign: "right",
|
|
11930
|
-
textOverflow: "ellipsis",
|
|
11931
|
-
overflow: "hidden",
|
|
11932
|
-
whiteSpace: "nowrap"
|
|
11933
|
-
},
|
|
11934
|
-
children: signedAmount
|
|
11935
|
-
}
|
|
11936
|
-
)
|
|
11937
|
-
]
|
|
11938
|
-
},
|
|
11939
|
-
log._id
|
|
11940
|
-
);
|
|
11941
|
-
})
|
|
11942
|
-
]
|
|
11943
|
-
}
|
|
11944
|
-
);
|
|
12111
|
+
]
|
|
12112
|
+
},
|
|
12113
|
+
log._id
|
|
12114
|
+
);
|
|
12115
|
+
})
|
|
12116
|
+
] });
|
|
11945
12117
|
}
|
|
11946
12118
|
function UsageLogsPager({
|
|
11947
12119
|
page,
|
|
@@ -11957,7 +12129,7 @@ function UsageLogsPager({
|
|
|
11957
12129
|
"div",
|
|
11958
12130
|
{
|
|
11959
12131
|
className: "flex items-center justify-between shrink-0 w-full",
|
|
11960
|
-
style: { gap: "var(--spacing-md)" },
|
|
12132
|
+
style: { ...BILLING_TABLE_PAGER_STYLE, gap: "var(--spacing-md)" },
|
|
11961
12133
|
children: [
|
|
11962
12134
|
/* @__PURE__ */ jsxs26(
|
|
11963
12135
|
"span",
|
|
@@ -12098,7 +12270,12 @@ function BillingContent({
|
|
|
12098
12270
|
const [availableCredits, setAvailableCredits] = useState21(null);
|
|
12099
12271
|
const [sharedPool, setSharedPool] = useState21(null);
|
|
12100
12272
|
const [usedByNames, setUsedByNames] = useState21({});
|
|
12101
|
-
const [
|
|
12273
|
+
const [allProducts, setProducts] = useState21([]);
|
|
12274
|
+
const workspaceCountry = workspace.current?.country;
|
|
12275
|
+
const products = useMemo4(
|
|
12276
|
+
() => productsForCountry(allProducts, workspaceCountry),
|
|
12277
|
+
[allProducts, workspaceCountry]
|
|
12278
|
+
);
|
|
12102
12279
|
const [invoices, setInvoices] = useState21([]);
|
|
12103
12280
|
const [totalCredits, setTotalCredits] = useState21(null);
|
|
12104
12281
|
const [usageLogsState, dispatchUsageLogs] = useReducer(
|
|
@@ -12171,17 +12348,7 @@ function BillingContent({
|
|
|
12171
12348
|
if (creditsRes?.availableCredits != null)
|
|
12172
12349
|
setAvailableCredits(creditsRes.availableCredits);
|
|
12173
12350
|
setSharedPool(creditsRes?.sharedPool ?? null);
|
|
12174
|
-
if (productsRes?.data)
|
|
12175
|
-
const normalizedWorkspaceCountry = workspace.current?.country?.trim().toUpperCase();
|
|
12176
|
-
const targetCurrency = normalizedWorkspaceCountry === "IN" ? "inr" : "usd";
|
|
12177
|
-
const filteredProducts = productsRes.data.map((product) => ({
|
|
12178
|
-
...product,
|
|
12179
|
-
prices: product.prices.filter(
|
|
12180
|
-
(price) => price.currency?.toLowerCase() === targetCurrency
|
|
12181
|
-
)
|
|
12182
|
-
})).filter((product) => product.prices.length > 0);
|
|
12183
|
-
setProducts(filteredProducts);
|
|
12184
|
-
}
|
|
12351
|
+
if (productsRes?.data) setProducts(productsRes.data);
|
|
12185
12352
|
if (customRes?.data?.credits != null) {
|
|
12186
12353
|
setCustomPlanCredits(customRes.data.credits);
|
|
12187
12354
|
}
|
|
@@ -12190,7 +12357,7 @@ function BillingContent({
|
|
|
12190
12357
|
setLoadingBilling(false);
|
|
12191
12358
|
setBillingOverviewLoaded(true);
|
|
12192
12359
|
}
|
|
12193
|
-
}, [api
|
|
12360
|
+
}, [api]);
|
|
12194
12361
|
const fetchUserMap = useCallback8(async () => {
|
|
12195
12362
|
try {
|
|
12196
12363
|
const members = await api.fetchMembers();
|
|
@@ -13028,30 +13195,34 @@ function BillingContent({
|
|
|
13028
13195
|
loading: loadingTable,
|
|
13029
13196
|
workspaceCountry: workspace.current?.country
|
|
13030
13197
|
}
|
|
13031
|
-
) :
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13050
|
-
|
|
13051
|
-
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13198
|
+
) : (
|
|
13199
|
+
// Table and pager only, so the sticky pager stops at the table's top
|
|
13200
|
+
// and never floats over the cards above it.
|
|
13201
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col w-full", style: { flex: "1 0 auto" }, children: [
|
|
13202
|
+
/* @__PURE__ */ jsx29(
|
|
13203
|
+
UsageLogsTable,
|
|
13204
|
+
{
|
|
13205
|
+
logs: usageLogs.rows,
|
|
13206
|
+
userMap,
|
|
13207
|
+
loading: loadingUsageLogs,
|
|
13208
|
+
error: usageLogsError,
|
|
13209
|
+
onRetry: () => void loadUsageLogsPage(usageLogsState.requestedPage),
|
|
13210
|
+
currentWorkspaceId: workspaceId,
|
|
13211
|
+
usedByNames
|
|
13212
|
+
}
|
|
13213
|
+
),
|
|
13214
|
+
!usageLogsError && /* @__PURE__ */ jsx29(
|
|
13215
|
+
UsageLogsPager,
|
|
13216
|
+
{
|
|
13217
|
+
page: usageLogs.page,
|
|
13218
|
+
totalPages: usageLogs.totalPages,
|
|
13219
|
+
total: usageLogs.total,
|
|
13220
|
+
loading: loadingUsageLogs,
|
|
13221
|
+
onPageChange: goToUsageLogsPage
|
|
13222
|
+
}
|
|
13223
|
+
)
|
|
13224
|
+
] })
|
|
13225
|
+
),
|
|
13055
13226
|
showExportModal && /* @__PURE__ */ jsx29(
|
|
13056
13227
|
ExportDateModal,
|
|
13057
13228
|
{
|
|
@@ -17423,6 +17594,9 @@ export {
|
|
|
17423
17594
|
AppSettingsPage,
|
|
17424
17595
|
AppSettingsRow,
|
|
17425
17596
|
AppSettingsSection,
|
|
17597
|
+
BILLING_TABLE_FRAME_STYLE,
|
|
17598
|
+
BILLING_TABLE_MIN_HEIGHT,
|
|
17599
|
+
BILLING_TABLE_PAGER_STYLE,
|
|
17426
17600
|
BillingContent,
|
|
17427
17601
|
BuyCreditsModal,
|
|
17428
17602
|
ConfirmDeleteModal,
|
|
@@ -17516,11 +17690,13 @@ export {
|
|
|
17516
17690
|
minimumCreditLimit,
|
|
17517
17691
|
ownCreditsFirstText,
|
|
17518
17692
|
parseBillingEntitlement,
|
|
17693
|
+
parseInviteEmails,
|
|
17519
17694
|
pausedOwnCreditsText,
|
|
17520
17695
|
poolEndsAtFrom,
|
|
17521
17696
|
poolErrorMessage,
|
|
17522
17697
|
poolRenewsAtCycleEnd,
|
|
17523
17698
|
poolWorkspaceName,
|
|
17699
|
+
productsForCountry,
|
|
17524
17700
|
readSettingsCaller,
|
|
17525
17701
|
rememberSettingsCaller,
|
|
17526
17702
|
resolveSettingsTabFromPath,
|