@payloadcms/plugin-ecommerce 3.75.0-internal.880861f → 3.75.0-internal.e61a4d7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"validateOptions.d.ts","sourceRoot":"","sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,KAAK,GAAG;IACX,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,QAmE9C,CAAA"}
1
+ {"version":3,"file":"validateOptions.d.ts","sourceRoot":"","sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,KAAK,GAAG;IACX,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,QAoE9C,CAAA"}
@@ -17,6 +17,9 @@ export const validateOptions = (props)=>async (values, { data, req })=>{
17
17
  joins: {
18
18
  variants: {
19
19
  where: {
20
+ deletedAt: {
21
+ exists: false
22
+ },
20
23
  ...data.id && {
21
24
  id: {
22
25
  not_equals: data.id
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"sourcesContent":["import type { Validate } from 'payload'\n\ntype Props = {\n productsCollectionSlug?: string\n}\n\nexport const validateOptions: (props?: Props) => Validate =\n (props) =>\n async (values, { data, req }) => {\n const { productsCollectionSlug = 'products' } = props || {}\n const { t } = req\n\n if (!values || values.length === 0) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequired')\n }\n\n const productID = data.product\n\n if (!productID) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:productRequired')\n }\n\n const product = await req.payload.findByID({\n id: productID,\n collection: productsCollectionSlug,\n depth: 1,\n joins: {\n variants: {\n where: {\n ...(data.id && {\n id: {\n not_equals: data.id, // exclude the current variant from the search\n },\n }),\n },\n },\n },\n select: {\n variants: true,\n variantTypes: true,\n },\n user: req.user,\n })\n\n // @ts-expect-error - TODO: Fix types\n const variants = product.variants?.docs ?? []\n\n // @ts-expect-error - TODO: Fix types\n if (values.length < product?.variantTypes?.length) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequiredAll')\n }\n\n if (variants.length > 0) {\n const existingOptions: (number | string)[][] = []\n\n variants.forEach((variant: any) => {\n existingOptions.push(variant.options)\n })\n\n const exists = existingOptions.some(\n (combo) => combo.length === values.length && combo.every((val) => values.includes(val)),\n )\n\n if (exists) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsAlreadyExists')\n }\n }\n\n return true\n }\n"],"names":["validateOptions","props","values","data","req","productsCollectionSlug","t","length","productID","product","payload","findByID","id","collection","depth","joins","variants","where","not_equals","select","variantTypes","user","docs","existingOptions","forEach","variant","push","options","exists","some","combo","every","val","includes"],"mappings":"AAMA,OAAO,MAAMA,kBACX,CAACC,QACD,OAAOC,QAAQ,EAAEC,IAAI,EAAEC,GAAG,EAAE;QAC1B,MAAM,EAAEC,yBAAyB,UAAU,EAAE,GAAGJ,SAAS,CAAC;QAC1D,MAAM,EAAEK,CAAC,EAAE,GAAGF;QAEd,IAAI,CAACF,UAAUA,OAAOK,MAAM,KAAK,GAAG;YAClC,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,MAAME,YAAYL,KAAKM,OAAO;QAE9B,IAAI,CAACD,WAAW;YACd,qCAAqC;YACrC,OAAOF,EAAE;QACX;QAEA,MAAMG,UAAU,MAAML,IAAIM,OAAO,CAACC,QAAQ,CAAC;YACzCC,IAAIJ;YACJK,YAAYR;YACZS,OAAO;YACPC,OAAO;gBACLC,UAAU;oBACRC,OAAO;wBACL,GAAId,KAAKS,EAAE,IAAI;4BACbA,IAAI;gCACFM,YAAYf,KAAKS,EAAE;4BACrB;wBACF,CAAC;oBACH;gBACF;YACF;YACAO,QAAQ;gBACNH,UAAU;gBACVI,cAAc;YAChB;YACAC,MAAMjB,IAAIiB,IAAI;QAChB;QAEA,qCAAqC;QACrC,MAAML,WAAWP,QAAQO,QAAQ,EAAEM,QAAQ,EAAE;QAE7C,qCAAqC;QACrC,IAAIpB,OAAOK,MAAM,GAAGE,SAASW,cAAcb,QAAQ;YACjD,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,IAAIU,SAAST,MAAM,GAAG,GAAG;YACvB,MAAMgB,kBAAyC,EAAE;YAEjDP,SAASQ,OAAO,CAAC,CAACC;gBAChBF,gBAAgBG,IAAI,CAACD,QAAQE,OAAO;YACtC;YAEA,MAAMC,SAASL,gBAAgBM,IAAI,CACjC,CAACC,QAAUA,MAAMvB,MAAM,KAAKL,OAAOK,MAAM,IAAIuB,MAAMC,KAAK,CAAC,CAACC,MAAQ9B,OAAO+B,QAAQ,CAACD;YAGpF,IAAIJ,QAAQ;gBACV,qCAAqC;gBACrC,OAAOtB,EAAE;YACX;QACF;QAEA,OAAO;IACT,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"sourcesContent":["import type { Validate } from 'payload'\n\ntype Props = {\n productsCollectionSlug?: string\n}\n\nexport const validateOptions: (props?: Props) => Validate =\n (props) =>\n async (values, { data, req }) => {\n const { productsCollectionSlug = 'products' } = props || {}\n const { t } = req\n\n if (!values || values.length === 0) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequired')\n }\n\n const productID = data.product\n\n if (!productID) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:productRequired')\n }\n\n const product = await req.payload.findByID({\n id: productID,\n collection: productsCollectionSlug,\n depth: 1,\n joins: {\n variants: {\n where: {\n deletedAt: { exists: false },\n ...(data.id && {\n id: {\n not_equals: data.id, // exclude the current variant from the search\n },\n }),\n },\n },\n },\n select: {\n variants: true,\n variantTypes: true,\n },\n user: req.user,\n })\n\n // @ts-expect-error - TODO: Fix types\n const variants = product.variants?.docs ?? []\n\n // @ts-expect-error - TODO: Fix types\n if (values.length < product?.variantTypes?.length) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequiredAll')\n }\n\n if (variants.length > 0) {\n const existingOptions: (number | string)[][] = []\n\n variants.forEach((variant: any) => {\n existingOptions.push(variant.options)\n })\n\n const exists = existingOptions.some(\n (combo) => combo.length === values.length && combo.every((val) => values.includes(val)),\n )\n\n if (exists) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsAlreadyExists')\n }\n }\n\n return true\n }\n"],"names":["validateOptions","props","values","data","req","productsCollectionSlug","t","length","productID","product","payload","findByID","id","collection","depth","joins","variants","where","deletedAt","exists","not_equals","select","variantTypes","user","docs","existingOptions","forEach","variant","push","options","some","combo","every","val","includes"],"mappings":"AAMA,OAAO,MAAMA,kBACX,CAACC,QACD,OAAOC,QAAQ,EAAEC,IAAI,EAAEC,GAAG,EAAE;QAC1B,MAAM,EAAEC,yBAAyB,UAAU,EAAE,GAAGJ,SAAS,CAAC;QAC1D,MAAM,EAAEK,CAAC,EAAE,GAAGF;QAEd,IAAI,CAACF,UAAUA,OAAOK,MAAM,KAAK,GAAG;YAClC,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,MAAME,YAAYL,KAAKM,OAAO;QAE9B,IAAI,CAACD,WAAW;YACd,qCAAqC;YACrC,OAAOF,EAAE;QACX;QAEA,MAAMG,UAAU,MAAML,IAAIM,OAAO,CAACC,QAAQ,CAAC;YACzCC,IAAIJ;YACJK,YAAYR;YACZS,OAAO;YACPC,OAAO;gBACLC,UAAU;oBACRC,OAAO;wBACLC,WAAW;4BAAEC,QAAQ;wBAAM;wBAC3B,GAAIhB,KAAKS,EAAE,IAAI;4BACbA,IAAI;gCACFQ,YAAYjB,KAAKS,EAAE;4BACrB;wBACF,CAAC;oBACH;gBACF;YACF;YACAS,QAAQ;gBACNL,UAAU;gBACVM,cAAc;YAChB;YACAC,MAAMnB,IAAImB,IAAI;QAChB;QAEA,qCAAqC;QACrC,MAAMP,WAAWP,QAAQO,QAAQ,EAAEQ,QAAQ,EAAE;QAE7C,qCAAqC;QACrC,IAAItB,OAAOK,MAAM,GAAGE,SAASa,cAAcf,QAAQ;YACjD,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,IAAIU,SAAST,MAAM,GAAG,GAAG;YACvB,MAAMkB,kBAAyC,EAAE;YAEjDT,SAASU,OAAO,CAAC,CAACC;gBAChBF,gBAAgBG,IAAI,CAACD,QAAQE,OAAO;YACtC;YAEA,MAAMV,SAASM,gBAAgBK,IAAI,CACjC,CAACC,QAAUA,MAAMxB,MAAM,KAAKL,OAAOK,MAAM,IAAIwB,MAAMC,KAAK,CAAC,CAACC,MAAQ/B,OAAOgC,QAAQ,CAACD;YAGpF,IAAId,QAAQ;gBACV,qCAAqC;gBACrC,OAAOb,EAAE;YACX;QACF;QAEA,OAAO;IACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-ecommerce",
3
- "version": "3.75.0-internal.880861f",
3
+ "version": "3.75.0-internal.e61a4d7",
4
4
  "description": "Ecommerce plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -74,23 +74,23 @@
74
74
  ],
75
75
  "dependencies": {
76
76
  "qs-esm": "7.0.2",
77
- "@payloadcms/translations": "3.75.0-internal.880861f",
78
- "@payloadcms/ui": "3.75.0-internal.880861f"
77
+ "@payloadcms/translations": "3.75.0-internal.e61a4d7",
78
+ "@payloadcms/ui": "3.75.0-internal.e61a4d7"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@types/json-schema": "7.0.15",
82
82
  "@types/react": "19.2.9",
83
83
  "@types/react-dom": "19.2.3",
84
84
  "stripe": "18.3.0",
85
- "@payloadcms/next": "3.75.0-internal.880861f",
86
- "@payloadcms/translations": "3.75.0-internal.880861f",
87
85
  "@payloadcms/eslint-config": "3.28.0",
88
- "payload": "3.75.0-internal.880861f"
86
+ "@payloadcms/next": "3.75.0-internal.e61a4d7",
87
+ "@payloadcms/translations": "3.75.0-internal.e61a4d7",
88
+ "payload": "3.75.0-internal.e61a4d7"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
92
92
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
93
- "payload": "3.75.0-internal.880861f"
93
+ "payload": "3.75.0-internal.e61a4d7"
94
94
  },
95
95
  "publishConfig": {
96
96
  "registry": "https://registry.npmjs.org/"