@greatapps/common 1.1.726 → 1.1.727
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.
|
@@ -6,7 +6,7 @@ const PixPendingDataSchema = z.object({
|
|
|
6
6
|
expires_at: z.string().nullable().optional()
|
|
7
7
|
});
|
|
8
8
|
const SubscriptionPendingPixResponseSchema = z.object({
|
|
9
|
-
id: z.null(),
|
|
9
|
+
id: z.union([z.string(), z.null()]).optional(),
|
|
10
10
|
pending: z.literal(true),
|
|
11
11
|
payment_method: z.literal(3),
|
|
12
12
|
pix: PixPendingDataSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/modules/subscriptions/types/pix-pending.type.ts"],"sourcesContent":["import z from \"zod\";\n\n/**\n * Shape efêmero do pix gerado pelo backend quando uma operação de subscription\n * (create ou update com cobrança imediata) produz uma cobrança via pix.\n */\nexport const PixPendingDataSchema = z.object({\n qr_code: z.string().nullable().optional(),\n payment_link: z.string().nullable().optional(),\n correlation_id: z.string(),\n expires_at: z.string().nullable().optional(),\n});\n\nexport type PixPendingData = z.infer<typeof PixPendingDataSchema>;\n\n/**\n * Resposta especial que o backend devolve no lugar da subscription quando\n * a operação dispara um pix pendente. `
|
|
1
|
+
{"version":3,"sources":["../../../../src/modules/subscriptions/types/pix-pending.type.ts"],"sourcesContent":["import z from \"zod\";\n\n/**\n * Shape efêmero do pix gerado pelo backend quando uma operação de subscription\n * (create ou update com cobrança imediata) produz uma cobrança via pix.\n */\nexport const PixPendingDataSchema = z.object({\n qr_code: z.string().nullable().optional(),\n payment_link: z.string().nullable().optional(),\n correlation_id: z.string(),\n expires_at: z.string().nullable().optional(),\n});\n\nexport type PixPendingData = z.infer<typeof PixPendingDataSchema>;\n\n/**\n * Resposta especial que o backend devolve no lugar da subscription quando\n * a operação dispara um pix pendente. Discrimina por `pending` + `payment_method`\n * + presença de `pix` — nenhuma subscription real carrega esses três juntos.\n *\n * `id` é aceito como null OU string: as trilhas de pix do backend divergem no\n * campo (a de re-autorização de mandato manda null, a de addons manda o id da\n * invoice Stripe). Exigir null aqui fazia o safeParse falhar nessa segunda, o\n * objeto era reparseado como subscription comum e o `pix` sumia — cobrança\n * criada e cliente sem QR (ID-4779).\n */\nexport const SubscriptionPendingPixResponseSchema = z\n .object({\n id: z.union([z.string(), z.null()]).optional(),\n pending: z.literal(true),\n payment_method: z.literal(3),\n pix: PixPendingDataSchema,\n })\n .passthrough();\n\nexport type SubscriptionPendingPixResponse = z.infer<\n typeof SubscriptionPendingPixResponseSchema\n>;\n\nexport function isSubscriptionPendingPixResponse(\n value: unknown,\n): value is SubscriptionPendingPixResponse {\n return SubscriptionPendingPixResponseSchema.safeParse(value).success;\n}\n"],"mappings":"AAAA,OAAO,OAAO;AAMP,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACxC,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EAC7C,gBAAgB,EAAE,OAAO;AAAA,EACzB,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAC7C,CAAC;AAeM,MAAM,uCAAuC,EACjD,OAAO;AAAA,EACN,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,SAAS;AAAA,EAC7C,SAAS,EAAE,QAAQ,IAAI;AAAA,EACvB,gBAAgB,EAAE,QAAQ,CAAC;AAAA,EAC3B,KAAK;AACP,CAAC,EACA,YAAY;AAMR,SAAS,iCACd,OACyC;AACzC,SAAO,qCAAqC,UAAU,KAAK,EAAE;AAC/D;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@greatapps/common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.727",
|
|
4
4
|
"description": "Shared library for GreatApps frontend applications",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -46,6 +46,12 @@
|
|
|
46
46
|
"dist",
|
|
47
47
|
"src"
|
|
48
48
|
],
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"dev": "tsup --watch",
|
|
52
|
+
"typecheck": "tsc --noEmit",
|
|
53
|
+
"prepublishOnly": "npm run build"
|
|
54
|
+
},
|
|
49
55
|
"keywords": [],
|
|
50
56
|
"author": "",
|
|
51
57
|
"license": "ISC",
|
|
@@ -129,10 +135,5 @@
|
|
|
129
135
|
"@faker-js/faker": {
|
|
130
136
|
"optional": true
|
|
131
137
|
}
|
|
132
|
-
},
|
|
133
|
-
"scripts": {
|
|
134
|
-
"build": "tsup",
|
|
135
|
-
"dev": "tsup --watch",
|
|
136
|
-
"typecheck": "tsc --noEmit"
|
|
137
138
|
}
|
|
138
|
-
}
|
|
139
|
+
}
|
|
@@ -15,12 +15,18 @@ export type PixPendingData = z.infer<typeof PixPendingDataSchema>;
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Resposta especial que o backend devolve no lugar da subscription quando
|
|
18
|
-
* a operação dispara um pix pendente.
|
|
19
|
-
*
|
|
18
|
+
* a operação dispara um pix pendente. Discrimina por `pending` + `payment_method`
|
|
19
|
+
* + presença de `pix` — nenhuma subscription real carrega esses três juntos.
|
|
20
|
+
*
|
|
21
|
+
* `id` é aceito como null OU string: as trilhas de pix do backend divergem no
|
|
22
|
+
* campo (a de re-autorização de mandato manda null, a de addons manda o id da
|
|
23
|
+
* invoice Stripe). Exigir null aqui fazia o safeParse falhar nessa segunda, o
|
|
24
|
+
* objeto era reparseado como subscription comum e o `pix` sumia — cobrança
|
|
25
|
+
* criada e cliente sem QR (ID-4779).
|
|
20
26
|
*/
|
|
21
27
|
export const SubscriptionPendingPixResponseSchema = z
|
|
22
28
|
.object({
|
|
23
|
-
id: z.null(),
|
|
29
|
+
id: z.union([z.string(), z.null()]).optional(),
|
|
24
30
|
pending: z.literal(true),
|
|
25
31
|
payment_method: z.literal(3),
|
|
26
32
|
pix: PixPendingDataSchema,
|