@moonbase.sh/storefront-api 1.0.37 → 2.0.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.ts CHANGED
@@ -876,9 +876,9 @@ declare const activationRequestSchema: z.ZodObject<{
876
876
  } | undefined;
877
877
  }>;
878
878
 
879
- declare const schemas$a_activationRequestSchema: typeof activationRequestSchema;
880
- declare namespace schemas$a {
881
- export { schemas$a_activationRequestSchema as activationRequestSchema };
879
+ declare const schemas$b_activationRequestSchema: typeof activationRequestSchema;
880
+ declare namespace schemas$b {
881
+ export { schemas$b_activationRequestSchema as activationRequestSchema };
882
882
  }
883
883
 
884
884
  declare enum ActivationRequestFulfillmentType {
@@ -903,6 +903,59 @@ declare class ActivationRequestEndpoints {
903
903
  cancel(requestId: string): Promise<ActivationRequest>;
904
904
  }
905
905
 
906
+ declare const subscribeResponseSchema: z.ZodObject<{
907
+ status: z.ZodEnum<["subscribed", "confirmation_sent"]>;
908
+ }, "strip", z.ZodTypeAny, {
909
+ status: "subscribed" | "confirmation_sent";
910
+ }, {
911
+ status: "subscribed" | "confirmation_sent";
912
+ }>;
913
+ declare const communicationPreferencesViewSchema: z.ZodObject<{
914
+ email: z.ZodString;
915
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
916
+ newsletter: z.ZodBoolean;
917
+ productUpdates: z.ZodBoolean;
918
+ }, "strip", z.ZodTypeAny, {
919
+ email: string;
920
+ newsletter: boolean;
921
+ productUpdates: boolean;
922
+ name?: string | null | undefined;
923
+ }, {
924
+ email: string;
925
+ newsletter: boolean;
926
+ productUpdates: boolean;
927
+ name?: string | null | undefined;
928
+ }>;
929
+
930
+ declare const schemas$a_communicationPreferencesViewSchema: typeof communicationPreferencesViewSchema;
931
+ declare const schemas$a_subscribeResponseSchema: typeof subscribeResponseSchema;
932
+ declare namespace schemas$a {
933
+ export { schemas$a_communicationPreferencesViewSchema as communicationPreferencesViewSchema, schemas$a_subscribeResponseSchema as subscribeResponseSchema };
934
+ }
935
+
936
+ type SubscribeResponse = z.infer<typeof subscribeResponseSchema>;
937
+ type CommunicationPreferencesView = z.infer<typeof communicationPreferencesViewSchema>;
938
+ interface SubscribeInput {
939
+ email: string;
940
+ name?: string | null;
941
+ newsletter?: boolean;
942
+ productUpdates?: boolean;
943
+ }
944
+ interface CommunicationPreferencesInput {
945
+ newsletter: boolean;
946
+ productUpdates: boolean;
947
+ }
948
+
949
+ declare class CommunicationsEndpoints {
950
+ private api;
951
+ constructor(api: MoonbaseApi);
952
+ subscribe(input: SubscribeInput): Promise<SubscribeResponse>;
953
+ confirm(email: string, token: string): Promise<void>;
954
+ getPreferences(email: string, token: string): Promise<CommunicationPreferencesView>;
955
+ updatePreferences(email: string, token: string, preferences: CommunicationPreferencesInput): Promise<CommunicationPreferencesView>;
956
+ unsubscribe(email: string, token: string): Promise<void>;
957
+ }
958
+
906
959
  declare const addressSchema: z.ZodObject<{
907
960
  countryCode: z.ZodString;
908
961
  streetAddress1: z.ZodString;
@@ -927,10 +980,13 @@ declare const addressSchema: z.ZodObject<{
927
980
  }>;
928
981
  declare const communicationPreferencesSchema: z.ZodObject<{
929
982
  newsletterOptIn: z.ZodBoolean;
983
+ productUpdatesOptIn: z.ZodDefault<z.ZodBoolean>;
930
984
  }, "strip", z.ZodTypeAny, {
931
985
  newsletterOptIn: boolean;
986
+ productUpdatesOptIn: boolean;
932
987
  }, {
933
988
  newsletterOptIn: boolean;
989
+ productUpdatesOptIn?: boolean | undefined;
934
990
  }>;
935
991
  declare const ilokConnectedAccountSchema: z.ZodObject<{
936
992
  provider: z.ZodLiteral<ConnectableAccountProvider>;
@@ -1001,10 +1057,13 @@ declare const userSchema: z.ZodObject<{
1001
1057
  phone: z.ZodOptional<z.ZodString>;
1002
1058
  communicationPreferences: z.ZodObject<{
1003
1059
  newsletterOptIn: z.ZodBoolean;
1060
+ productUpdatesOptIn: z.ZodDefault<z.ZodBoolean>;
1004
1061
  }, "strip", z.ZodTypeAny, {
1005
1062
  newsletterOptIn: boolean;
1063
+ productUpdatesOptIn: boolean;
1006
1064
  }, {
1007
1065
  newsletterOptIn: boolean;
1066
+ productUpdatesOptIn?: boolean | undefined;
1008
1067
  }>;
1009
1068
  ownedProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1010
1069
  subscribedProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1034,6 +1093,7 @@ declare const userSchema: z.ZodObject<{
1034
1093
  tenantId: string;
1035
1094
  communicationPreferences: {
1036
1095
  newsletterOptIn: boolean;
1096
+ productUpdatesOptIn: boolean;
1037
1097
  };
1038
1098
  connectedAccounts: {
1039
1099
  provider: ConnectableAccountProvider;
@@ -1062,6 +1122,7 @@ declare const userSchema: z.ZodObject<{
1062
1122
  tenantId: string;
1063
1123
  communicationPreferences: {
1064
1124
  newsletterOptIn: boolean;
1125
+ productUpdatesOptIn?: boolean | undefined;
1065
1126
  };
1066
1127
  address?: {
1067
1128
  countryCode: string;
@@ -1114,10 +1175,13 @@ declare const identitySchema: z.ZodIntersection<z.ZodObject<{
1114
1175
  phone: z.ZodOptional<z.ZodString>;
1115
1176
  communicationPreferences: z.ZodObject<{
1116
1177
  newsletterOptIn: z.ZodBoolean;
1178
+ productUpdatesOptIn: z.ZodDefault<z.ZodBoolean>;
1117
1179
  }, "strip", z.ZodTypeAny, {
1118
1180
  newsletterOptIn: boolean;
1181
+ productUpdatesOptIn: boolean;
1119
1182
  }, {
1120
1183
  newsletterOptIn: boolean;
1184
+ productUpdatesOptIn?: boolean | undefined;
1121
1185
  }>;
1122
1186
  ownedProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1123
1187
  subscribedProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -1147,6 +1211,7 @@ declare const identitySchema: z.ZodIntersection<z.ZodObject<{
1147
1211
  tenantId: string;
1148
1212
  communicationPreferences: {
1149
1213
  newsletterOptIn: boolean;
1214
+ productUpdatesOptIn: boolean;
1150
1215
  };
1151
1216
  connectedAccounts: {
1152
1217
  provider: ConnectableAccountProvider;
@@ -1175,6 +1240,7 @@ declare const identitySchema: z.ZodIntersection<z.ZodObject<{
1175
1240
  tenantId: string;
1176
1241
  communicationPreferences: {
1177
1242
  newsletterOptIn: boolean;
1243
+ productUpdatesOptIn?: boolean | undefined;
1178
1244
  };
1179
1245
  address?: {
1180
1246
  countryCode: string;
@@ -1206,21 +1272,149 @@ declare const identitySchema: z.ZodIntersection<z.ZodObject<{
1206
1272
  accessToken: string;
1207
1273
  refreshToken: string;
1208
1274
  }>>;
1209
- declare const userAccountConfirmedSchema: z.ZodObject<{
1275
+ declare const userAccountConfirmedStatusSchema: z.ZodEnum<["PasswordSetupRequired", "SignedIn"]>;
1276
+ declare const userAccountConfirmedSchema: z.ZodIntersection<z.ZodObject<{
1210
1277
  id: z.ZodString;
1211
- name: z.ZodString;
1212
1278
  email: z.ZodString;
1213
- resetPasswordToken: z.ZodNullable<z.ZodString>;
1279
+ name: z.ZodString;
1280
+ tenantId: z.ZodString;
1281
+ address: z.ZodOptional<z.ZodObject<{
1282
+ countryCode: z.ZodString;
1283
+ streetAddress1: z.ZodString;
1284
+ streetAddress2: z.ZodNullable<z.ZodString>;
1285
+ locality: z.ZodNullable<z.ZodString>;
1286
+ region: z.ZodNullable<z.ZodString>;
1287
+ postCode: z.ZodNullable<z.ZodString>;
1288
+ }, "strip", z.ZodTypeAny, {
1289
+ countryCode: string;
1290
+ streetAddress1: string;
1291
+ streetAddress2: string | null;
1292
+ locality: string | null;
1293
+ region: string | null;
1294
+ postCode: string | null;
1295
+ }, {
1296
+ countryCode: string;
1297
+ streetAddress1: string;
1298
+ streetAddress2: string | null;
1299
+ locality: string | null;
1300
+ region: string | null;
1301
+ postCode: string | null;
1302
+ }>>;
1303
+ phone: z.ZodOptional<z.ZodString>;
1304
+ communicationPreferences: z.ZodObject<{
1305
+ newsletterOptIn: z.ZodBoolean;
1306
+ productUpdatesOptIn: z.ZodDefault<z.ZodBoolean>;
1307
+ }, "strip", z.ZodTypeAny, {
1308
+ newsletterOptIn: boolean;
1309
+ productUpdatesOptIn: boolean;
1310
+ }, {
1311
+ newsletterOptIn: boolean;
1312
+ productUpdatesOptIn?: boolean | undefined;
1313
+ }>;
1314
+ ownedProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1315
+ subscribedProducts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1316
+ confirmedAccount: z.ZodOptional<z.ZodBoolean>;
1317
+ hasProducts: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1318
+ hasSubscriptions: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1319
+ connectedAccounts: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"provider", [z.ZodObject<{
1320
+ provider: z.ZodLiteral<ConnectableAccountProvider>;
1321
+ isConnected: z.ZodBoolean;
1322
+ pendingLicenseFulfillments: z.ZodBoolean;
1323
+ accountId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1324
+ }, "strip", z.ZodTypeAny, {
1325
+ provider: ConnectableAccountProvider;
1326
+ isConnected: boolean;
1327
+ pendingLicenseFulfillments: boolean;
1328
+ accountId?: string | null | undefined;
1329
+ }, {
1330
+ provider: ConnectableAccountProvider;
1331
+ isConnected: boolean;
1332
+ pendingLicenseFulfillments: boolean;
1333
+ accountId?: string | null | undefined;
1334
+ }>]>, "many">>;
1214
1335
  }, "strip", z.ZodTypeAny, {
1215
1336
  id: string;
1216
1337
  email: string;
1217
1338
  name: string;
1218
- resetPasswordToken: string | null;
1339
+ tenantId: string;
1340
+ communicationPreferences: {
1341
+ newsletterOptIn: boolean;
1342
+ productUpdatesOptIn: boolean;
1343
+ };
1344
+ connectedAccounts: {
1345
+ provider: ConnectableAccountProvider;
1346
+ isConnected: boolean;
1347
+ pendingLicenseFulfillments: boolean;
1348
+ accountId?: string | null | undefined;
1349
+ }[];
1350
+ address?: {
1351
+ countryCode: string;
1352
+ streetAddress1: string;
1353
+ streetAddress2: string | null;
1354
+ locality: string | null;
1355
+ region: string | null;
1356
+ postCode: string | null;
1357
+ } | undefined;
1358
+ phone?: string | undefined;
1359
+ ownedProducts?: string[] | undefined;
1360
+ subscribedProducts?: string[] | undefined;
1361
+ confirmedAccount?: boolean | undefined;
1362
+ hasProducts?: boolean | null | undefined;
1363
+ hasSubscriptions?: boolean | null | undefined;
1219
1364
  }, {
1220
1365
  id: string;
1221
1366
  email: string;
1222
1367
  name: string;
1223
- resetPasswordToken: string | null;
1368
+ tenantId: string;
1369
+ communicationPreferences: {
1370
+ newsletterOptIn: boolean;
1371
+ productUpdatesOptIn?: boolean | undefined;
1372
+ };
1373
+ address?: {
1374
+ countryCode: string;
1375
+ streetAddress1: string;
1376
+ streetAddress2: string | null;
1377
+ locality: string | null;
1378
+ region: string | null;
1379
+ postCode: string | null;
1380
+ } | undefined;
1381
+ phone?: string | undefined;
1382
+ ownedProducts?: string[] | undefined;
1383
+ subscribedProducts?: string[] | undefined;
1384
+ confirmedAccount?: boolean | undefined;
1385
+ hasProducts?: boolean | null | undefined;
1386
+ hasSubscriptions?: boolean | null | undefined;
1387
+ connectedAccounts?: {
1388
+ provider: ConnectableAccountProvider;
1389
+ isConnected: boolean;
1390
+ pendingLicenseFulfillments: boolean;
1391
+ accountId?: string | null | undefined;
1392
+ }[] | undefined;
1393
+ }>, z.ZodObject<{
1394
+ status: z.ZodEnum<["PasswordSetupRequired", "SignedIn"]>;
1395
+ resetPasswordToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1396
+ accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1397
+ refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1398
+ }, "strip", z.ZodTypeAny, {
1399
+ status: "PasswordSetupRequired" | "SignedIn";
1400
+ accessToken?: string | null | undefined;
1401
+ refreshToken?: string | null | undefined;
1402
+ resetPasswordToken?: string | null | undefined;
1403
+ }, {
1404
+ status: "PasswordSetupRequired" | "SignedIn";
1405
+ accessToken?: string | null | undefined;
1406
+ refreshToken?: string | null | undefined;
1407
+ resetPasswordToken?: string | null | undefined;
1408
+ }>>;
1409
+ declare const pendingActivationSchema: z.ZodObject<{
1410
+ status: z.ZodLiteral<"activation_pending">;
1411
+ email: z.ZodString;
1412
+ }, "strip", z.ZodTypeAny, {
1413
+ email: string;
1414
+ status: "activation_pending";
1415
+ }, {
1416
+ email: string;
1417
+ status: "activation_pending";
1224
1418
  }>;
1225
1419
 
1226
1420
  declare const schemas$9_addressSchema: typeof addressSchema;
@@ -1229,10 +1423,12 @@ declare const schemas$9_connectedAccountSchema: typeof connectedAccountSchema;
1229
1423
  declare const schemas$9_connectionUrlSchema: typeof connectionUrlSchema;
1230
1424
  declare const schemas$9_identitySchema: typeof identitySchema;
1231
1425
  declare const schemas$9_ilokConnectedAccountSchema: typeof ilokConnectedAccountSchema;
1426
+ declare const schemas$9_pendingActivationSchema: typeof pendingActivationSchema;
1232
1427
  declare const schemas$9_userAccountConfirmedSchema: typeof userAccountConfirmedSchema;
1428
+ declare const schemas$9_userAccountConfirmedStatusSchema: typeof userAccountConfirmedStatusSchema;
1233
1429
  declare const schemas$9_userSchema: typeof userSchema;
1234
1430
  declare namespace schemas$9 {
1235
- export { schemas$9_addressSchema as addressSchema, schemas$9_communicationPreferencesSchema as communicationPreferencesSchema, schemas$9_connectedAccountSchema as connectedAccountSchema, schemas$9_connectionUrlSchema as connectionUrlSchema, schemas$9_identitySchema as identitySchema, schemas$9_ilokConnectedAccountSchema as ilokConnectedAccountSchema, schemas$9_userAccountConfirmedSchema as userAccountConfirmedSchema, schemas$9_userSchema as userSchema };
1431
+ export { schemas$9_addressSchema as addressSchema, schemas$9_communicationPreferencesSchema as communicationPreferencesSchema, schemas$9_connectedAccountSchema as connectedAccountSchema, schemas$9_connectionUrlSchema as connectionUrlSchema, schemas$9_identitySchema as identitySchema, schemas$9_ilokConnectedAccountSchema as ilokConnectedAccountSchema, schemas$9_pendingActivationSchema as pendingActivationSchema, schemas$9_userAccountConfirmedSchema as userAccountConfirmedSchema, schemas$9_userAccountConfirmedStatusSchema as userAccountConfirmedStatusSchema, schemas$9_userSchema as userSchema };
1236
1432
  }
1237
1433
 
1238
1434
  type CommunicationPreferences = z.infer<typeof communicationPreferencesSchema>;
@@ -1243,7 +1439,15 @@ type ConnectedAccount = z.infer<typeof connectedAccountSchema>;
1243
1439
  type User = z.infer<typeof userSchema>;
1244
1440
  type Identity = z.infer<typeof identitySchema>;
1245
1441
  type Address = z.infer<typeof addressSchema>;
1442
+ type UserAccountConfirmedStatus = z.infer<typeof userAccountConfirmedStatusSchema>;
1246
1443
  type UserAccountConfirmed = z.infer<typeof userAccountConfirmedSchema>;
1444
+ type SignUpResult = {
1445
+ status: 'signed-in';
1446
+ user: User;
1447
+ } | {
1448
+ status: 'activation-pending';
1449
+ email: string;
1450
+ };
1247
1451
 
1248
1452
  declare class IdentityEndpoints {
1249
1453
  private api;
@@ -1252,7 +1456,7 @@ declare class IdentityEndpoints {
1252
1456
  constructor(api: MoonbaseApi, tokenStore: ITokenStore, logger: ILogger);
1253
1457
  get(): Promise<User>;
1254
1458
  signIn(email: string, password: string): Promise<User>;
1255
- signUp(name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean, communicationOptIn?: boolean): Promise<User>;
1459
+ signUp(name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean, communicationOptIn?: boolean): Promise<SignUpResult>;
1256
1460
  signOut(): Promise<void>;
1257
1461
  update(name: string, email: string, emailConfirmationToken?: string, communicationPreferences?: CommunicationPreferences): Promise<{
1258
1462
  needsEmailConfirmationToken: boolean;
@@ -1263,6 +1467,7 @@ declare class IdentityEndpoints {
1263
1467
  tenantId: string;
1264
1468
  communicationPreferences: {
1265
1469
  newsletterOptIn: boolean;
1470
+ productUpdatesOptIn: boolean;
1266
1471
  };
1267
1472
  connectedAccounts: {
1268
1473
  provider: ConnectableAccountProvider;
@@ -38149,7 +38354,7 @@ declare namespace schemas$1 {
38149
38354
  }
38150
38355
 
38151
38356
  declare namespace schemas {
38152
- export { schemas$a as activationRequests, schemas$9 as identity, schemas$2 as inventory, schemas$5 as orders, schemas$1 as storefront, schemas$4 as vendor, schemas$3 as vouchers };
38357
+ export { schemas$b as activationRequests, schemas$a as communications, schemas$9 as identity, schemas$2 as inventory, schemas$5 as orders, schemas$1 as storefront, schemas$4 as vendor, schemas$3 as vouchers };
38153
38358
  }
38154
38359
 
38155
38360
  type StorefrontProduct = z.infer<typeof storefrontProductSchema>;
@@ -38231,6 +38436,7 @@ declare class MoonbaseClient {
38231
38436
  api: MoonbaseApi;
38232
38437
  storefront: StorefrontEndpoints;
38233
38438
  identity: IdentityEndpoints;
38439
+ communications: CommunicationsEndpoints;
38234
38440
  vouchers: VoucherEndpoints;
38235
38441
  activationRequests: ActivationRequestEndpoints;
38236
38442
  inventory: InventoryEndpoints;
@@ -38238,4 +38444,4 @@ declare class MoonbaseClient {
38238
38444
  orders: OrderEndpoints;
38239
38445
  }
38240
38446
 
38241
- export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CompletedOrder, ConnectableAccountProvider, type ConnectedAccount, ConsoleLogger, CycleLength, type Discount, DiscountUtils, type Download, type DownloadManifest, type ILogger, type IRecurrence, type IStore, type ITokenStore, type Identity, InMemoryStore, type License, LicenseStatus, type LineItem, LocalStorageStore, LogLevel, MarketingConsentType, type MilestoneProgress, type Money, type MoneyCollection, MoneyCollectionUtils, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OfferCondition, OfferUtils, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type Quantifiable, type RawPropertyObject, type RawPropertyValue, type SingleOrMultiple, type Storefront, type StorefrontBundle, type StorefrontOffer, type StorefrontProduct, type Subscription, SubscriptionStatus, type TaxEstimate, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type Vendor, type Voucher, objectToQuery, problemDetailsSchema, schemas, utmToObject };
38447
+ export { type Activation, ActivationMethod, type ActivationRequest, ActivationRequestFulfillmentType, ActivationRequestStatus, ActivationStatus, type Address, type BundleLineItem, type CommunicationPreferences, type CommunicationPreferencesInput, type CommunicationPreferencesView, type CompletedOrder, ConnectableAccountProvider, type ConnectedAccount, ConsoleLogger, CycleLength, type Discount, DiscountUtils, type Download, type DownloadManifest, type ILogger, type IRecurrence, type IStore, type ITokenStore, type Identity, InMemoryStore, type License, LicenseStatus, type LineItem, LocalStorageStore, LogLevel, MarketingConsentType, type MilestoneProgress, type Money, type MoneyCollection, MoneyCollectionUtils, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type OfferCondition, OfferUtils, type OpenOrder, type Order, OrderStatus, type OwnedProduct, type Page, Platform, type PricingTier, type PricingVariation, type ProblemDetails, type ProductLineItem, type Quantifiable, type RawPropertyObject, type RawPropertyValue, type SignUpResult, type SingleOrMultiple, type Storefront, type StorefrontBundle, type StorefrontOffer, type StorefrontProduct, type SubscribeInput, type SubscribeResponse, type Subscription, SubscriptionStatus, type TaxEstimate, TokenStore, type UrchinTrackingModule, type User, type UserAccountConfirmed, type UserAccountConfirmedStatus, type Vendor, type Voucher, objectToQuery, problemDetailsSchema, schemas, utmToObject };