@getpara/shared 1.28.0 → 1.30.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.
Files changed (33) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/schemas/permissionsV2.js +577 -6
  3. package/dist/cjs/schemas/permissionsV2UserParameters.js +85 -0
  4. package/dist/cjs/types/assets.js +7 -2
  5. package/dist/cjs/types/headlessOnRamp.js +0 -7
  6. package/dist/esm/index.js +1 -0
  7. package/dist/esm/schemas/permissionsV2.js +575 -5
  8. package/dist/esm/schemas/permissionsV2UserParameters.js +82 -0
  9. package/dist/esm/types/assets.js +7 -2
  10. package/dist/esm/types/headlessOnRamp.js +0 -7
  11. package/dist/types/index.d.ts +1 -0
  12. package/dist/types/index.d.ts.map +1 -1
  13. package/dist/types/schemas/permissionsV2.d.ts +12646 -503
  14. package/dist/types/schemas/permissionsV2.d.ts.map +1 -1
  15. package/dist/types/schemas/permissionsV2UserParameters.d.ts +468 -0
  16. package/dist/types/schemas/permissionsV2UserParameters.d.ts.map +1 -0
  17. package/dist/types/types/assets.d.ts +47 -4
  18. package/dist/types/types/assets.d.ts.map +1 -1
  19. package/dist/types/types/auth.d.ts +10 -0
  20. package/dist/types/types/auth.d.ts.map +1 -1
  21. package/dist/types/types/authState.d.ts +36 -12
  22. package/dist/types/types/authState.d.ts.map +1 -1
  23. package/dist/types/types/headlessOnRamp.d.ts +25 -0
  24. package/dist/types/types/headlessOnRamp.d.ts.map +1 -1
  25. package/dist/types/types/partner.d.ts +5 -2
  26. package/dist/types/types/partner.d.ts.map +1 -1
  27. package/dist/types/types/partnerAppConfig.d.ts +40 -2
  28. package/dist/types/types/partnerAppConfig.d.ts.map +1 -1
  29. package/dist/types/types/pending-transaction.d.ts +2 -0
  30. package/dist/types/types/pending-transaction.d.ts.map +1 -1
  31. package/dist/types/types/permissions.d.ts +25 -2
  32. package/dist/types/types/permissions.d.ts.map +1 -1
  33. package/package.json +1 -1
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.permissionsV2UserParameterHistorySchema = exports.permissionsV2UserParameterViewSchema = exports.permissionsV2UserParameterReadyViewSchema = exports.permissionsV2UserParameterResetSchema = exports.permissionsV2UserParameterSaveSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const templateRevisionFields = {
6
+ policyVersion: zod_1.z.string().min(1),
7
+ policyHash: zod_1.z.string().min(1),
8
+ expectedRevision: zod_1.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
9
+ };
10
+ exports.permissionsV2UserParameterSaveSchema = zod_1.z
11
+ .object({
12
+ ...templateRevisionFields,
13
+ values: zod_1.z.record(zod_1.z.string()),
14
+ })
15
+ .strict();
16
+ exports.permissionsV2UserParameterResetSchema = zod_1.z.object(templateRevisionFields).strict();
17
+ const storedRevision = zod_1.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
18
+ const provenance = zod_1.z.enum(['default', 'personal']);
19
+ const parameterDescriptor = zod_1.z
20
+ .object({
21
+ id: zod_1.z.string().min(1),
22
+ label: zod_1.z.string().min(1),
23
+ defaultValue: zod_1.z.string(),
24
+ fact: zod_1.z.string().min(1),
25
+ asset: zod_1.z.string().optional(),
26
+ window: zod_1.z.string().optional(),
27
+ })
28
+ .strict();
29
+ const viewFields = {
30
+ userId: zod_1.z.string().min(1),
31
+ partnerId: zod_1.z.string().min(1),
32
+ appId: zod_1.z.string().min(1),
33
+ policyId: zod_1.z.string().min(1),
34
+ policyVersion: zod_1.z.string().min(1),
35
+ policyHash: zod_1.z.string().min(1),
36
+ parameters: zod_1.z.array(parameterDescriptor),
37
+ };
38
+ exports.permissionsV2UserParameterReadyViewSchema = zod_1.z.union([
39
+ zod_1.z
40
+ .object({
41
+ ...viewFields,
42
+ status: zod_1.z.literal('ready'),
43
+ revision: zod_1.z.literal(0),
44
+ provenance: zod_1.z.literal('default'),
45
+ values: zod_1.z.record(zod_1.z.string()),
46
+ })
47
+ .strict(),
48
+ zod_1.z
49
+ .object({
50
+ ...viewFields,
51
+ status: zod_1.z.literal('ready'),
52
+ revision: storedRevision,
53
+ provenance,
54
+ values: zod_1.z.record(zod_1.z.string()),
55
+ configurationHash: zod_1.z.string().min(1),
56
+ })
57
+ .strict(),
58
+ ]);
59
+ exports.permissionsV2UserParameterViewSchema = zod_1.z.union([
60
+ exports.permissionsV2UserParameterReadyViewSchema,
61
+ zod_1.z
62
+ .object({
63
+ ...viewFields,
64
+ status: zod_1.z.literal('needs_confirmation'),
65
+ revision: storedRevision,
66
+ provenance,
67
+ previousValues: zod_1.z.record(zod_1.z.string()),
68
+ })
69
+ .strict(),
70
+ ]);
71
+ exports.permissionsV2UserParameterHistorySchema = zod_1.z
72
+ .object({
73
+ revisions: zod_1.z.array(zod_1.z
74
+ .object({
75
+ policyVersion: zod_1.z.string().min(1),
76
+ policyHash: zod_1.z.string().min(1),
77
+ revision: storedRevision,
78
+ provenance,
79
+ values: zod_1.z.record(zod_1.z.string()),
80
+ changedAt: zod_1.z.string().datetime(),
81
+ })
82
+ .strict()),
83
+ nextBeforeRevision: storedRevision.optional(),
84
+ })
85
+ .strict();
@@ -8,10 +8,13 @@ var OnRampProvider;
8
8
  OnRampProvider["STRIPE"] = "STRIPE";
9
9
  OnRampProvider["MOONPAY"] = "MOONPAY";
10
10
  OnRampProvider["CDP"] = "CDP";
11
+ // Coinbase's hosted onramp WIDGET — distinct from CDP (which is the headless guest-checkout Apple Pay flow).
12
+ // Same Coinbase asset universe, but a partner-opt-in widget provider with its own (broader) geo.
13
+ OnRampProvider["COINBASE"] = "COINBASE";
11
14
  OnRampProvider["MERCURYO"] = "MERCURYO";
12
15
  OnRampProvider["BRALE"] = "BRALE";
13
16
  })(OnRampProvider || (exports.OnRampProvider = OnRampProvider = {}));
14
- exports.ON_RAMP_PROVIDERS = ['RAMP', 'STRIPE', 'MOONPAY', 'CDP', 'MERCURYO', 'BRALE'];
17
+ exports.ON_RAMP_PROVIDERS = ['RAMP', 'STRIPE', 'MOONPAY', 'CDP', 'COINBASE', 'MERCURYO', 'BRALE'];
15
18
  // Payment flows a provider can offer for an implementation in the request's region. Drives which
16
19
  // call-to-action the AddFunds modal renders. WIDGET = the hosted redirect flow (provider selection +
17
20
  // Continue) that every widget provider supports; APPLE_PAY / CARD / BANK are headless flows enabled
@@ -23,7 +26,9 @@ exports.PROVIDER_PAYMENT_METHODS = {
23
26
  RAMP: ['WIDGET'],
24
27
  STRIPE: ['WIDGET'],
25
28
  MOONPAY: ['WIDGET', 'CARD'],
26
- CDP: ['WIDGET', 'APPLE_PAY'],
29
+ // CDP is the headless guest-checkout Apple Pay flow only — NOT a widget (the hosted widget is COINBASE).
30
+ CDP: ['APPLE_PAY'],
31
+ COINBASE: ['WIDGET'],
27
32
  MERCURYO: ['WIDGET', 'APPLE_PAY'],
28
33
  BRALE: ['BANK'],
29
34
  };
@@ -1,9 +1,2 @@
1
1
  "use strict";
2
- // Headless on-ramp types, shared between the server and the web-sdk client so request/response shapes
3
- // aren't duplicated across the server and the user-management-client.
4
- //
5
- // Each headless (native Apple Pay / Platform SDK) provider has its own router and route per action —
6
- // POST /users/:userId/onramp/<provider>/<action> — with its param/result types defined below. CDP
7
- // (Coinbase) is the only provider defined + wired today; Mercuryo and MoonPay add their types here when
8
- // they land on their own branches.
9
2
  Object.defineProperty(exports, "__esModule", { value: true });
package/dist/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './types/index.js';
2
2
  export * from './types/permissions.js';
3
3
  export * from './schemas/permissionsV2.js';
4
+ export * from './schemas/permissionsV2UserParameters.js';
4
5
  export * from './utils/index.js';
5
6
  import * as transactionTypes from './types/transaction.js';
6
7
  export { transactionTypes };